From 33ccfe0e149f19c9d18165fa45b9df4b0c30e881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 3 Jun 2019 22:05:41 +0200 Subject: gpio-button-hotplug: use pr_debug and pr_err MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pr_debug can be used with dynamic debugging. Tested-by: Kuan-Yi Li Signed-off-by: Petr Štetiar --- .../gpio-button-hotplug/src/gpio-button-hotplug.c | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'package/kernel/gpio-button-hotplug/src') diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 11c914d4ef..d81898f932 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -29,22 +29,11 @@ #include #include -#define DRV_NAME "gpio-keys" - #define BH_SKB_SIZE 2048 +#define DRV_NAME "gpio-keys" #define PFX DRV_NAME ": " -#undef BH_DEBUG - -#ifdef BH_DEBUG -#define BH_DBG(fmt, args...) printk(KERN_DEBUG "%s: " fmt, DRV_NAME, ##args ) -#else -#define BH_DBG(fmt, args...) do {} while (0) -#endif - -#define BH_ERR(fmt, args...) printk(KERN_ERR "%s: " fmt, DRV_NAME, ##args ) - struct bh_priv { unsigned long seen; }; @@ -138,7 +127,7 @@ int bh_event_add_var(struct bh_event *event, int argv, const char *format, ...) s = skb_put(event->skb, len + 1); strcpy(s, buf); - BH_DBG("added variable '%s'\n", s); + pr_debug(PFX "added variable '%s'\n", s); return 0; } @@ -205,7 +194,7 @@ static void button_hotplug_work(struct work_struct *work) out_free_skb: if (ret) { - BH_ERR("work error %d\n", ret); + pr_err(PFX "work error %d\n", ret); kfree_skb(event->skb); } out_free_event: @@ -217,8 +206,8 @@ static int button_hotplug_create_event(const char *name, unsigned int type, { struct bh_event *event; - BH_DBG("create event, name=%s, seen=%lu, pressed=%d\n", - name, seen, pressed); + pr_debug(PFX "create event, name=%s, seen=%lu, pressed=%d\n", + name, seen, pressed); event = kzalloc(sizeof(*event), GFP_KERNEL); if (!event) @@ -255,7 +244,7 @@ static void button_hotplug_event(struct gpio_keys_button_data *data, unsigned long seen = jiffies; int btn; - BH_DBG("event type=%u, code=%u, value=%d\n", type, data->b->code, value); + pr_debug(PFX "event type=%u, code=%u, value=%d\n", type, data->b->code, value); if ((type != EV_KEY) && (type != EV_SW)) return; -- cgit v1.2.3