mirror of https://github.com/hak5/openwrt.git
gpio-button-hotplug: use pr_debug and pr_err
pr_debug can be used with dynamic debugging. Tested-by: Kuan-Yi Li <kyli.tw@gmail.com> Signed-off-by: Petr Štetiar <ynezz@true.cz>openwrt-19.07
parent
0299a4b73e
commit
33ccfe0e14
|
@ -29,22 +29,11 @@
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/gpio_keys.h>
|
#include <linux/gpio_keys.h>
|
||||||
|
|
||||||
#define DRV_NAME "gpio-keys"
|
|
||||||
|
|
||||||
#define BH_SKB_SIZE 2048
|
#define BH_SKB_SIZE 2048
|
||||||
|
|
||||||
|
#define DRV_NAME "gpio-keys"
|
||||||
#define PFX DRV_NAME ": "
|
#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 {
|
struct bh_priv {
|
||||||
unsigned long seen;
|
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);
|
s = skb_put(event->skb, len + 1);
|
||||||
strcpy(s, buf);
|
strcpy(s, buf);
|
||||||
|
|
||||||
BH_DBG("added variable '%s'\n", s);
|
pr_debug(PFX "added variable '%s'\n", s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +194,7 @@ static void button_hotplug_work(struct work_struct *work)
|
||||||
|
|
||||||
out_free_skb:
|
out_free_skb:
|
||||||
if (ret) {
|
if (ret) {
|
||||||
BH_ERR("work error %d\n", ret);
|
pr_err(PFX "work error %d\n", ret);
|
||||||
kfree_skb(event->skb);
|
kfree_skb(event->skb);
|
||||||
}
|
}
|
||||||
out_free_event:
|
out_free_event:
|
||||||
|
@ -217,7 +206,7 @@ static int button_hotplug_create_event(const char *name, unsigned int type,
|
||||||
{
|
{
|
||||||
struct bh_event *event;
|
struct bh_event *event;
|
||||||
|
|
||||||
BH_DBG("create event, name=%s, seen=%lu, pressed=%d\n",
|
pr_debug(PFX "create event, name=%s, seen=%lu, pressed=%d\n",
|
||||||
name, seen, pressed);
|
name, seen, pressed);
|
||||||
|
|
||||||
event = kzalloc(sizeof(*event), GFP_KERNEL);
|
event = kzalloc(sizeof(*event), GFP_KERNEL);
|
||||||
|
@ -255,7 +244,7 @@ static void button_hotplug_event(struct gpio_keys_button_data *data,
|
||||||
unsigned long seen = jiffies;
|
unsigned long seen = jiffies;
|
||||||
int btn;
|
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))
|
if ((type != EV_KEY) && (type != EV_SW))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue