aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-09-09 05:33:50 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-09-19 08:49:17 -0400
commit7b17b59feaa8b0a54a333005b87ad7ea804d021f (patch)
treee4f2a03b930d041c9d6478a553046b432e757b2f /drivers/gpio/gpiolib.c
parent6424de5af1942e33ce0267cbfe9ff12e387d93d6 (diff)
gpiolib: Include GPIO label in log messages for GPIOs
Provide the human readable label for the GPIO as well as the number when we are recording it in order to improve the readability of log messages. Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 417ee75d82d3..8048c3dbb8ad 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -102,6 +102,26 @@ static int gpiod_export_link(struct device *dev, const char *name,
102static int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value); 102static int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value);
103static void gpiod_unexport(struct gpio_desc *desc); 103static void gpiod_unexport(struct gpio_desc *desc);
104 104
105#ifdef CONFIG_DEBUG_FS
106#define gpiod_emerg(desc, fmt, ...) \
107 pr_emerg("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \
108 ##__VA_ARGS__)
109#define gpiod_crit(desc, fmt, ...) \
110 pr_crit("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \
111 ##__VA_ARGS__)
112#define gpiod_err(desc, fmt, ...) \
113 pr_err("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \
114 ##__VA_ARGS__)
115#define gpiod_warn(desc, fmt, ...) \
116 pr_warn("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \
117 ##__VA_ARGS__)
118#define gpiod_info(desc, fmt, ...) \
119 pr_info("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \
120 ##__VA_ARGS__)
121#define gpiod_dbg(desc, fmt, ...) \
122 pr_debug("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \
123 ##__VA_ARGS__)
124#else
105#define gpiod_emerg(desc, fmt, ...) \ 125#define gpiod_emerg(desc, fmt, ...) \
106 pr_emerg("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 126 pr_emerg("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
107#define gpiod_crit(desc, fmt, ...) \ 127#define gpiod_crit(desc, fmt, ...) \
@@ -114,6 +134,7 @@ static void gpiod_unexport(struct gpio_desc *desc);
114 pr_info("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 134 pr_info("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
115#define gpiod_dbg(desc, fmt, ...) \ 135#define gpiod_dbg(desc, fmt, ...) \
116 pr_debug("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 136 pr_debug("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
137#endif
117 138
118static inline void desc_set_label(struct gpio_desc *d, const char *label) 139static inline void desc_set_label(struct gpio_desc *d, const char *label)
119{ 140{