Commit 9c8318ff authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Linus Walleij

gpio: always compile label support

Compiling out GPIO labels results in a space gain so small that it can
hardly be justified. Labels can also be useful for printing debug
messages, so always keep them around.
Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a0e827c6
...@@ -66,9 +66,7 @@ struct gpio_desc { ...@@ -66,9 +66,7 @@ struct gpio_desc {
#define GPIO_FLAGS_MASK ((1 << ID_SHIFT) - 1) #define GPIO_FLAGS_MASK ((1 << ID_SHIFT) - 1)
#define GPIO_TRIGGER_MASK (BIT(FLAG_TRIG_FALL) | BIT(FLAG_TRIG_RISE)) #define GPIO_TRIGGER_MASK (BIT(FLAG_TRIG_FALL) | BIT(FLAG_TRIG_RISE))
#ifdef CONFIG_DEBUG_FS
const char *label; const char *label;
#endif
}; };
static struct gpio_desc gpio_desc[ARCH_NR_GPIOS]; static struct gpio_desc gpio_desc[ARCH_NR_GPIOS];
...@@ -87,7 +85,6 @@ static void gpiod_free(struct gpio_desc *desc); ...@@ -87,7 +85,6 @@ static void gpiod_free(struct gpio_desc *desc);
/* With descriptor prefix */ /* With descriptor prefix */
#ifdef CONFIG_DEBUG_FS
#define gpiod_emerg(desc, fmt, ...) \ #define gpiod_emerg(desc, fmt, ...) \
pr_emerg("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\ pr_emerg("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\
##__VA_ARGS__) ##__VA_ARGS__)
...@@ -106,20 +103,6 @@ static void gpiod_free(struct gpio_desc *desc); ...@@ -106,20 +103,6 @@ static void gpiod_free(struct gpio_desc *desc);
#define gpiod_dbg(desc, fmt, ...) \ #define gpiod_dbg(desc, fmt, ...) \
pr_debug("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\ pr_debug("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\
##__VA_ARGS__) ##__VA_ARGS__)
#else
#define gpiod_emerg(desc, fmt, ...) \
pr_emerg("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
#define gpiod_crit(desc, fmt, ...) \
pr_crit("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
#define gpiod_err(desc, fmt, ...) \
pr_err("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
#define gpiod_warn(desc, fmt, ...) \
pr_warn("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
#define gpiod_info(desc, fmt, ...) \
pr_info("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
#define gpiod_dbg(desc, fmt, ...) \
pr_debug("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__)
#endif
/* With chip prefix */ /* With chip prefix */
...@@ -138,9 +121,7 @@ static void gpiod_free(struct gpio_desc *desc); ...@@ -138,9 +121,7 @@ static void gpiod_free(struct gpio_desc *desc);
static inline void desc_set_label(struct gpio_desc *d, const char *label) static inline void desc_set_label(struct gpio_desc *d, const char *label)
{ {
#ifdef CONFIG_DEBUG_FS
d->label = label; d->label = label;
#endif
} }
/* /*
...@@ -1906,8 +1887,8 @@ EXPORT_SYMBOL_GPL(gpio_free_array); ...@@ -1906,8 +1887,8 @@ EXPORT_SYMBOL_GPL(gpio_free_array);
* @offset: of signal within controller's 0..(ngpio - 1) range * @offset: of signal within controller's 0..(ngpio - 1) range
* *
* Returns NULL if the GPIO is not currently requested, else a string. * Returns NULL if the GPIO is not currently requested, else a string.
* If debugfs support is enabled, the string returned is the label passed * The string returned is the label passed to gpio_request(); if none has been
* to gpio_request(); otherwise it is a meaningless constant. * passed it is a meaningless, non-NULL constant.
* *
* This function is for use by GPIO controller drivers. The label can * This function is for use by GPIO controller drivers. The label can
* help with diagnostics, and knowing that the signal is used as a GPIO * help with diagnostics, and knowing that the signal is used as a GPIO
...@@ -1924,11 +1905,7 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset) ...@@ -1924,11 +1905,7 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset)
if (test_bit(FLAG_REQUESTED, &desc->flags) == 0) if (test_bit(FLAG_REQUESTED, &desc->flags) == 0)
return NULL; return NULL;
#ifdef CONFIG_DEBUG_FS
return desc->label; return desc->label;
#else
return "?";
#endif
} }
EXPORT_SYMBOL_GPL(gpiochip_is_requested); EXPORT_SYMBOL_GPL(gpiochip_is_requested);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment