diff mbox

[1/2] gpio: fix warning of 'struct gpio_chip' declaration

Message ID 1358239056-703-2-git-send-email-shawn.guo@linaro.org
State New
Headers show

Commit Message

Shawn Guo Jan. 15, 2013, 8:37 a.m. UTC
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>
---
 include/asm-generic/gpio.h |   74 ++++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

Comments

Linus Walleij Jan. 17, 2013, 1:30 p.m. UTC | #1
On Tue, Jan 15, 2013 at 9:37 AM, Shawn Guo <shawn.guo@linaro.org> wrote:

> 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>

Shawn can you please try to repost this with something that does not
turn into quoted-printable? Look:

MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
(...)
@@ -212,6 +212,43 @@ extern void gpio_unexport(unsigned gpio);
=20
 #endif	/* CONFIG_GPIO_SYSFS */
=20
+#ifdef CONFIG_PINCTRL

I can't apply that.

Second: if this is not an immediate regression I'd prefer to put it
for-next now, as touching this file always brings down something.

OK?

Yours,
Linus Walleij
Linus Walleij Jan. 17, 2013, 2:10 p.m. UTC | #2
On Thu, Jan 17, 2013 at 3:03 PM, Shawn Guo <shawn.guo@linaro.org> wrote:

> 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>

Thanks, patch applied to devel (for-next)

Let's see if something explodes!

Yours,
Linus Walleij
Shawn Guo Jan. 17, 2013, 2:13 p.m. UTC | #3
On Thu, Jan 17, 2013 at 02:30:01PM +0100, Linus Walleij wrote:
> Shawn can you please try to repost this with something that does not
> turn into quoted-printable? Look:
> 
Sorry for that.  Just resent it.

> MIME-Version: 1.0
> Content-Type: text/plain; charset="UTF-8"
> Content-Transfer-Encoding: quoted-printable
> (...)
> @@ -212,6 +212,43 @@ extern void gpio_unexport(unsigned gpio);
> =20
>  #endif	/* CONFIG_GPIO_SYSFS */
> =20
> +#ifdef CONFIG_PINCTRL
> 
> I can't apply that.
> 
> Second: if this is not an immediate regression I'd prefer to put it
> for-next now, as touching this file always brings down something.
> 
> OK?
> 
The warning the first patch tries to fix seems new to v3.8-rc, while
the second patch is definitely fine for -next.

Since I do not care much about the warning seen on blackfin, I'm fine
with both of them being for -next.

Shawn
diff mbox

Patch

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 20ca766..2341014 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -212,6 +212,43 @@  extern void gpio_unexport(unsigned gpio);
 
 #endif	/* CONFIG_GPIO_SYSFS */
 
+#ifdef CONFIG_PINCTRL
+
+/**
+ * struct gpio_pin_range - pin range controlled by a gpio chip
+ * @head: list for maintaining set of pin ranges, used internally
+ * @pctldev: pinctrl device which handles corresponding pins
+ * @range: actual range of pins controlled by a gpio controller
+ */
+
+struct gpio_pin_range {
+	struct list_head node;
+	struct pinctrl_dev *pctldev;
+	struct pinctrl_gpio_range range;
+};
+
+int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
+			   unsigned int gpio_offset, unsigned int pin_offset,
+			   unsigned int npins);
+void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
+
+#else
+
+static inline int
+gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
+		       unsigned int gpio_offset, unsigned int pin_offset,
+		       unsigned int npins)
+{
+	return 0;
+}
+
+static inline void
+gpiochip_remove_pin_ranges(struct gpio_chip *chip)
+{
+}
+
+#endif /* CONFIG_PINCTRL */
+
 #else	/* !CONFIG_GPIOLIB */
 
 static inline bool gpio_is_valid(int number)
@@ -270,41 +307,4 @@  static inline void gpio_unexport(unsigned gpio)
 }
 #endif	/* CONFIG_GPIO_SYSFS */
 
-#ifdef CONFIG_PINCTRL
-
-/**
- * struct gpio_pin_range - pin range controlled by a gpio chip
- * @head: list for maintaining set of pin ranges, used internally
- * @pctldev: pinctrl device which handles corresponding pins
- * @range: actual range of pins controlled by a gpio controller
- */
-
-struct gpio_pin_range {
-	struct list_head node;
-	struct pinctrl_dev *pctldev;
-	struct pinctrl_gpio_range range;
-};
-
-int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
-			   unsigned int gpio_offset, unsigned int pin_offset,
-			   unsigned int npins);
-void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
-
-#else
-
-static inline int
-gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
-		       unsigned int gpio_offset, unsigned int pin_offset,
-		       unsigned int npins)
-{
-	return 0;
-}
-
-static inline void
-gpiochip_remove_pin_ranges(struct gpio_chip *chip)
-{
-}
-
-#endif /* CONFIG_PINCTRL */
-
 #endif /* _ASM_GENERIC_GPIO_H */