Skip to content

Commit f310f2e

Browse files
metuxLinus Walleij
authored andcommitted
gpio: Add comments on #if/#else/#endif
Improve readability a bit by commenting #if/#else/#endif statements with the checked preprocessor symbols. Signed-off-by: Enrico Weigelt <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent a100067 commit f310f2e

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎include/linux/gpio/driver.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct gpio_irq_chip {
161161
*/
162162
void (*irq_disable)(struct irq_data *data);
163163
};
164-
#endif
164+
#endif /* CONFIG_GPIOLIB_IRQCHIP */
165165

166166
/**
167167
* struct gpio_chip - abstract a GPIO controller
@@ -301,7 +301,7 @@ struct gpio_chip {
301301
spinlock_t bgpio_lock;
302302
unsigned long bgpio_data;
303303
unsigned long bgpio_dir;
304-
#endif
304+
#endif /* CONFIG_GPIO_GENERIC */
305305

306306
#ifdef CONFIG_GPIOLIB_IRQCHIP
307307
/*
@@ -316,7 +316,7 @@ struct gpio_chip {
316316
* used to handle IRQs for most practical cases.
317317
*/
318318
struct gpio_irq_chip irq;
319-
#endif
319+
#endif /* CONFIG_GPIOLIB_IRQCHIP */
320320

321321
/**
322322
* @need_valid_mask:
@@ -363,7 +363,7 @@ struct gpio_chip {
363363
*/
364364
int (*of_xlate)(struct gpio_chip *gc,
365365
const struct of_phandle_args *gpiospec, u32 *flags);
366-
#endif
366+
#endif /* CONFIG_OF_GPIO */
367367
};
368368

369369
extern const char *gpiochip_is_requested(struct gpio_chip *chip,
@@ -406,7 +406,7 @@ extern int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
406406
})
407407
#else
408408
#define gpiochip_add_data(chip, data) gpiochip_add_data_with_key(chip, data, NULL, NULL)
409-
#endif
409+
#endif /* CONFIG_LOCKDEP */
410410

411411
static inline int gpiochip_add(struct gpio_chip *chip)
412412
{
@@ -461,7 +461,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev,
461461
#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */
462462
#define BGPIOF_NO_OUTPUT BIT(5) /* only input */
463463

464-
#endif
464+
#endif /* CONFIG_GPIO_GENERIC */
465465

466466
#ifdef CONFIG_GPIOLIB_IRQCHIP
467467

@@ -531,7 +531,7 @@ static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
531531
handler, type, true,
532532
&lock_key, &request_key);
533533
}
534-
#else
534+
#else /* ! CONFIG_LOCKDEP */
535535
static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
536536
struct irq_chip *irqchip,
537537
unsigned int first_irq,
@@ -582,7 +582,7 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip,
582582
unsigned int gpio_offset, const char *pin_group);
583583
void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
584584

585-
#else
585+
#else /* ! CONFIG_PINCTRL */
586586

587587
static inline int
588588
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,

‎include/linux/gpio/gpio-reg.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg,
1111

1212
int gpio_reg_resume(struct gpio_chip *gc);
1313

14-
#endif
14+
#endif /* GPIO_REG_H */

‎include/linux/gpio/machine.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
9797
void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n);
9898
void gpiod_remove_lookup_table(struct gpiod_lookup_table *table);
9999
void gpiod_add_hogs(struct gpiod_hog *hogs);
100-
#else
100+
#else /* ! CONFIG_GPIOLIB */
101101
static inline
102102
void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
103103
static inline
104104
void gpiod_add_lookup_tables(struct gpiod_lookup_table **tables, size_t n) {}
105105
static inline
106106
void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {}
107107
static inline void gpiod_add_hogs(struct gpiod_hog *hogs) {}
108-
#endif
108+
#endif /* CONFIG_GPIOLIB */
109109

110110
#endif /* __LINUX_GPIO_MACHINE_H */

0 commit comments

Comments
 (0)