[OpenWrt-Devel] [PATCH 1/2] gpio-button-hotplug: use pr_debug and pr_err

Petr Štetiar ynezz at true.cz
Mon Jun 3 18:23:28 EDT 2019


pr_debug can be used with dynamic debugging.

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 .../gpio-button-hotplug/src/gpio-button-hotplug.c  | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

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 11c914d4ef3c..d81898f932a1 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 <linux/of_irq.h>
 #include <linux/gpio_keys.h>
 
-#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;
-- 
1.9.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list