Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Alexandre Courbot and committed by
Linus Walleij
9c8318ff a0e827c6

+2 -25
+2 -25
drivers/gpio/gpiolib.c
··· 66 66 #define GPIO_FLAGS_MASK ((1 << ID_SHIFT) - 1) 67 67 #define GPIO_TRIGGER_MASK (BIT(FLAG_TRIG_FALL) | BIT(FLAG_TRIG_RISE)) 68 68 69 - #ifdef CONFIG_DEBUG_FS 70 69 const char *label; 71 - #endif 72 70 }; 73 71 static struct gpio_desc gpio_desc[ARCH_NR_GPIOS]; 74 72 ··· 85 87 86 88 /* With descriptor prefix */ 87 89 88 - #ifdef CONFIG_DEBUG_FS 89 90 #define gpiod_emerg(desc, fmt, ...) \ 90 91 pr_emerg("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\ 91 92 ##__VA_ARGS__) ··· 103 106 #define gpiod_dbg(desc, fmt, ...) \ 104 107 pr_debug("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\ 105 108 ##__VA_ARGS__) 106 - #else 107 - #define gpiod_emerg(desc, fmt, ...) \ 108 - pr_emerg("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 109 - #define gpiod_crit(desc, fmt, ...) \ 110 - pr_crit("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 111 - #define gpiod_err(desc, fmt, ...) \ 112 - pr_err("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 113 - #define gpiod_warn(desc, fmt, ...) \ 114 - pr_warn("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 115 - #define gpiod_info(desc, fmt, ...) \ 116 - pr_info("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 117 - #define gpiod_dbg(desc, fmt, ...) \ 118 - pr_debug("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) 119 - #endif 120 109 121 110 /* With chip prefix */ 122 111 ··· 121 138 122 139 static inline void desc_set_label(struct gpio_desc *d, const char *label) 123 140 { 124 - #ifdef CONFIG_DEBUG_FS 125 141 d->label = label; 126 - #endif 127 142 } 128 143 129 144 /* ··· 1887 1906 * @offset: of signal within controller's 0..(ngpio - 1) range 1888 1907 * 1889 1908 * Returns NULL if the GPIO is not currently requested, else a string. 1890 - * If debugfs support is enabled, the string returned is the label passed 1891 - * to gpio_request(); otherwise it is a meaningless constant. 1909 + * The string returned is the label passed to gpio_request(); if none has been 1910 + * passed it is a meaningless, non-NULL constant. 1892 1911 * 1893 1912 * This function is for use by GPIO controller drivers. The label can 1894 1913 * help with diagnostics, and knowing that the signal is used as a GPIO ··· 1905 1924 1906 1925 if (test_bit(FLAG_REQUESTED, &desc->flags) == 0) 1907 1926 return NULL; 1908 - #ifdef CONFIG_DEBUG_FS 1909 1927 return desc->label; 1910 - #else 1911 - return "?"; 1912 - #endif 1913 1928 } 1914 1929 EXPORT_SYMBOL_GPL(gpiochip_is_requested); 1915 1930