Skip to content

Commit d59b4ea

Browse files
Shawn GuoLinus Walleij
authored andcommitted
gpio: fix warning of 'struct gpio_chip' declaration
The struct gpio_chip is only defined inside #ifdef CONFIG_GPIOLIB, but it's referenced by gpiochip_add_pin_range() and gpiochip_remove_pin_ranges() which are outside #ifdef CONFIG_GPIOLIB. Thus, we see the following warning when building blackfin image, where GPIOLIB is not required. CC arch/blackfin/kernel/bfin_gpio.o CC init/version.o In file included from arch/blackfin/include/asm/gpio.h:321, from arch/blackfin/kernel/bfin_gpio.c:15: include/asm-generic/gpio.h:298: warning: 'struct gpio_chip' declared inside parameter list include/asm-generic/gpio.h:298: warning: its scope is only this definition or declaration, which is probably not what you want include/asm-generic/gpio.h:304: warning: 'struct gpio_chip' declared inside parameter list Move pinctrl trunk into #ifdef CONFIG_GPIOLIB to fix the warning, since it appears that pinctrl gpio range support depends on GPIOLIB. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c111fea commit d59b4ea

1 file changed

Lines changed: 37 additions & 37 deletions

File tree

include/asm-generic/gpio.h

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,43 @@ extern void gpio_unexport(unsigned gpio);
212212

213213
#endif /* CONFIG_GPIO_SYSFS */
214214

215+
#ifdef CONFIG_PINCTRL
216+
217+
/**
218+
* struct gpio_pin_range - pin range controlled by a gpio chip
219+
* @head: list for maintaining set of pin ranges, used internally
220+
* @pctldev: pinctrl device which handles corresponding pins
221+
* @range: actual range of pins controlled by a gpio controller
222+
*/
223+
224+
struct gpio_pin_range {
225+
struct list_head node;
226+
struct pinctrl_dev *pctldev;
227+
struct pinctrl_gpio_range range;
228+
};
229+
230+
int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
231+
unsigned int gpio_offset, unsigned int pin_offset,
232+
unsigned int npins);
233+
void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
234+
235+
#else
236+
237+
static inline int
238+
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
239+
unsigned int gpio_offset, unsigned int pin_offset,
240+
unsigned int npins)
241+
{
242+
return 0;
243+
}
244+
245+
static inline void
246+
gpiochip_remove_pin_ranges(struct gpio_chip *chip)
247+
{
248+
}
249+
250+
#endif /* CONFIG_PINCTRL */
251+
215252
#else /* !CONFIG_GPIOLIB */
216253

217254
static inline bool gpio_is_valid(int number)
@@ -270,41 +307,4 @@ static inline void gpio_unexport(unsigned gpio)
270307
}
271308
#endif /* CONFIG_GPIO_SYSFS */
272309

273-
#ifdef CONFIG_PINCTRL
274-
275-
/**
276-
* struct gpio_pin_range - pin range controlled by a gpio chip
277-
* @head: list for maintaining set of pin ranges, used internally
278-
* @pctldev: pinctrl device which handles corresponding pins
279-
* @range: actual range of pins controlled by a gpio controller
280-
*/
281-
282-
struct gpio_pin_range {
283-
struct list_head node;
284-
struct pinctrl_dev *pctldev;
285-
struct pinctrl_gpio_range range;
286-
};
287-
288-
int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
289-
unsigned int gpio_offset, unsigned int pin_offset,
290-
unsigned int npins);
291-
void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
292-
293-
#else
294-
295-
static inline int
296-
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
297-
unsigned int gpio_offset, unsigned int pin_offset,
298-
unsigned int npins)
299-
{
300-
return 0;
301-
}
302-
303-
static inline void
304-
gpiochip_remove_pin_ranges(struct gpio_chip *chip)
305-
{
306-
}
307-
308-
#endif /* CONFIG_PINCTRL */
309-
310310
#endif /* _ASM_GENERIC_GPIO_H */

0 commit comments

Comments
 (0)