Re: [PATCH] gpiolib: Add 'struct gpio_chip' forward declaration for !GPIOLIB case

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Anton Vorontsov
Date: Tuesday, August 31, 2010 - 10:07 am

On Tue, Aug 31, 2010 at 10:44:14AM -0600, Grant Likely wrote:

Grrr. Grant, look again, even closer than you did.

They are stubs!

#else /* CONFIG_OF_GPIO */  <<<<<< !OF_GPIO (or !GPIOLIB) case.

/* Drivers may not strictly depend on the GPIO support, so let them link. */
static inline int of_get_gpio_flags(struct device_node *np, int index,
                                    enum of_gpio_flags *flags)
{
        return -ENOSYS;
}

static inline unsigned int of_gpio_count(struct device_node *np)
{
        return 0;
}

static inline void of_gpiochip_add(struct gpio_chip *gc) { }
static inline void of_gpiochip_remove(struct gpio_chip *gc) { }

#endif /* CONFIG_OF_GPIO */

The errors are triggered by the of_gpiochip_*() stubs, which
are needed by the drivers/gpio/gpiolib.c.

Do you want to add another #ifdef CONFIG_GPIOLIB around
of_gpiochip_*()? That would be ugly.

There's nothing wrong in providing the forward decls, you
can't dereference it anyway (so you would still catch the
bogus users). And at the same time it's will work great
for these stubs.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] gpiolib: Add 'struct gpio_chip' forward declar ..., Anton Vorontsov, (Tue Aug 31, 10:07 am)