* [PATCH v2] gpio: provide stubs for devres gpio functions
@ 2013-10-25 15:40 Linus Walleij
2013-10-27 6:58 ` Alexandre Courbot
2013-10-27 21:38 ` David Cohen
0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2013-10-25 15:40 UTC (permalink / raw)
To: linux-gpio; +Cc: Alexandre Courbot, Linus Walleij
commit 6b3d8145dcfdbbb43f13544e16f44f4574f941dd
"gpiolib: make GPIO_DEVRES depend on GPIOLIB"
breaks builds when device drivers are using devm_gpio*
devres functions without enabling GPIOLIB, relying on
the devres code to be compiled anyway.
Provide stubs so that we get these if we're using the
devres functions without GPIOLIB.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Actually add the keywords "static inline" in the proper place
for all stubs.
---
include/linux/gpio.h | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index c691df044458..0c56b9e9c209 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -77,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq)
#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
+/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
+
+struct device;
+
+int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
+int devm_gpio_request_one(struct device *dev, unsigned gpio,
+ unsigned long flags, const char *label);
+void devm_gpio_free(struct device *dev, unsigned int gpio);
+
#else /* ! CONFIG_GPIOLIB */
#include <linux/kernel.h>
@@ -241,14 +250,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
WARN_ON(1);
}
-#endif /* ! CONFIG_GPIOLIB */
+static inline int devm_gpio_request(struct device *dev, unsigned gpio,
+ const char *label)
+{
+ WARN_ON(1);
+ return -EINVAL;
+}
-struct device;
+static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
+ unsigned long flags, const char *label)
+{
+ WARN_ON(1);
+ return -EINVAL;
+}
-/* bindings for managed devices that want to request gpios */
-int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
-int devm_gpio_request_one(struct device *dev, unsigned gpio,
- unsigned long flags, const char *label);
-void devm_gpio_free(struct device *dev, unsigned int gpio);
+static inline void devm_gpio_free(struct device *dev, unsigned int gpio)
+{
+ WARN_ON(1);
+}
+
+#endif /* ! CONFIG_GPIOLIB */
#endif /* __LINUX_GPIO_H */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] gpio: provide stubs for devres gpio functions
2013-10-25 15:40 [PATCH v2] gpio: provide stubs for devres gpio functions Linus Walleij
@ 2013-10-27 6:58 ` Alexandre Courbot
2013-10-27 21:38 ` David Cohen
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2013-10-27 6:58 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio@vger.kernel.org, Alexandre Courbot
On Sat, Oct 26, 2013 at 12:40 AM, Linus Walleij
<linus.walleij@linaro.org> wrote:
> commit 6b3d8145dcfdbbb43f13544e16f44f4574f941dd
> "gpiolib: make GPIO_DEVRES depend on GPIOLIB"
> breaks builds when device drivers are using devm_gpio*
> devres functions without enabling GPIOLIB, relying on
> the devres code to be compiled anyway.
>
> Provide stubs so that we get these if we're using the
> devres functions without GPIOLIB.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] gpio: provide stubs for devres gpio functions
2013-10-25 15:40 [PATCH v2] gpio: provide stubs for devres gpio functions Linus Walleij
2013-10-27 6:58 ` Alexandre Courbot
@ 2013-10-27 21:38 ` David Cohen
1 sibling, 0 replies; 3+ messages in thread
From: David Cohen @ 2013-10-27 21:38 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, Alexandre Courbot
On 10/25/2013 08:40 AM, Linus Walleij wrote:
> commit 6b3d8145dcfdbbb43f13544e16f44f4574f941dd
> "gpiolib: make GPIO_DEVRES depend on GPIOLIB"
> breaks builds when device drivers are using devm_gpio*
> devres functions without enabling GPIOLIB, relying on
> the devres code to be compiled anyway.
>
> Provide stubs so that we get these if we're using the
> devres functions without GPIOLIB.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Actually add the keywords "static inline" in the proper place
> for all stubs.
> ---
> include/linux/gpio.h | 34 +++++++++++++++++++++++++++-------
> 1 file changed, 27 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/gpio.h b/include/linux/gpio.h
> index c691df044458..0c56b9e9c209 100644
> --- a/include/linux/gpio.h
> +++ b/include/linux/gpio.h
> @@ -77,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq)
>
> #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
>
> +/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
> +
> +struct device;
> +
> +int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
> +int devm_gpio_request_one(struct device *dev, unsigned gpio,
> + unsigned long flags, const char *label);
> +void devm_gpio_free(struct device *dev, unsigned int gpio);
> +
> #else /* ! CONFIG_GPIOLIB */
>
> #include <linux/kernel.h>
> @@ -241,14 +250,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
> WARN_ON(1);
> }
>
> -#endif /* ! CONFIG_GPIOLIB */
> +static inline int devm_gpio_request(struct device *dev, unsigned gpio,
> + const char *label)
> +{
> + WARN_ON(1);
> + return -EINVAL;
I wonder if -ENODEV is a better error code.
Br, David Cohen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-27 21:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 15:40 [PATCH v2] gpio: provide stubs for devres gpio functions Linus Walleij
2013-10-27 6:58 ` Alexandre Courbot
2013-10-27 21:38 ` David Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).