diff mbox

[v2,6/7] gpio / ACPI: get rid of acpi_gpio.h

Message ID 1385122474-14926-7-git-send-email-mika.westerberg@linux.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Mika Westerberg Nov. 22, 2013, 12:14 p.m. UTC
Now that all users of acpi_gpio.h have been moved to user either the GPIO
descriptor interface or to the internal gpiolib.h we can get rid of
acpi_gpio.h entirely.

Once this is done the only interface to get GPIOs to drivers enumerated
from ACPI namespace is the descriptor based interface.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c |  4 +++-
 drivers/gpio/gpiolib.c      |  1 -
 drivers/gpio/gpiolib.h      | 23 +++++++++++++++++++++++
 include/linux/acpi_gpio.h   | 45 ---------------------------------------------
 4 files changed, 26 insertions(+), 47 deletions(-)
 delete mode 100644 include/linux/acpi_gpio.h

Comments

Alexandre Courbot Nov. 23, 2013, 9:21 a.m. UTC | #1
On Fri, Nov 22, 2013 at 9:14 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> Now that all users of acpi_gpio.h have been moved to user either the GPIO

s/user/use

> descriptor interface or to the internal gpiolib.h we can get rid of

gpiolib.h will also need to be renamed if you follow my suggestion below.

> acpi_gpio.h entirely.
>
> Once this is done the only interface to get GPIOs to drivers enumerated
> from ACPI namespace is the descriptor based interface.

Oh, do I like this. :)

>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
>  drivers/gpio/gpiolib-acpi.c |  4 +++-
>  drivers/gpio/gpiolib.c      |  1 -
>  drivers/gpio/gpiolib.h      | 23 +++++++++++++++++++++++
>  include/linux/acpi_gpio.h   | 45 ---------------------------------------------
>  4 files changed, 26 insertions(+), 47 deletions(-)
>  delete mode 100644 include/linux/acpi_gpio.h
>
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index cb2da66fbbfe..6c158d9a6efa 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -12,11 +12,13 @@
>
>  #include <linux/errno.h>
>  #include <linux/gpio/consumer.h>
> +#include <linux/gpio/driver.h>
>  #include <linux/export.h>
> -#include <linux/acpi_gpio.h>
>  #include <linux/acpi.h>
>  #include <linux/interrupt.h>
>
> +#include "gpiolib.h"
> +
>  struct acpi_gpio_evt_pin {
>         struct list_head node;
>         acpi_handle *evt_handle;
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 70abccf0d144..a6b82413c290 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -10,7 +10,6 @@
>  #include <linux/seq_file.h>
>  #include <linux/gpio.h>
>  #include <linux/of_gpio.h>
> -#include <linux/acpi_gpio.h>
>  #include <linux/idr.h>
>  #include <linux/slab.h>
>  #include <linux/acpi.h>
> diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
> index 2ed23ab8298c..82be586c1f90 100644
> --- a/drivers/gpio/gpiolib.h
> +++ b/drivers/gpio/gpiolib.h
> @@ -12,12 +12,35 @@
>  #ifndef GPIOLIB_H
>  #define GPIOLIB_H
>
> +#include <linux/err.h>
> +#include <linux/device.h>
> +
> +/**
> + * struct acpi_gpio_info - ACPI GPIO specific information
> + * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
> + * @active_low: in case of @gpioint, the pin is active low
> + */
> +struct acpi_gpio_info {
> +       bool gpioint;
> +       bool active_low;
> +};
> +
>  #ifdef CONFIG_ACPI
>  void acpi_gpiochip_add(struct gpio_chip *chip);
>  void acpi_gpiochip_remove(struct gpio_chip *chip);
> +
> +struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
> +                                         struct acpi_gpio_info *info);
>  #else
>  static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
>  static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
> +
> +static inline struct gpio_desc *
> +acpi_get_gpiod_by_index(struct device *dev, int index,
> +                       struct acpi_gpio_info *info)
> +{
> +       return ERR_PTR(-ENOSYS);
> +}
>  #endif

Since this header contains purely ACPI-related declarations so far, I wonder
if it should not be renamed acpi.h?
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexandre Courbot Nov. 25, 2013, 8:51 a.m. UTC | #2
On 11/25/2013 05:54 PM, Mika Westerberg wrote:
> On Sat, Nov 23, 2013 at 06:21:03PM +0900, Alexandre Courbot wrote:
>> On Fri, Nov 22, 2013 at 9:14 PM, Mika Westerberg
>> <mika.westerberg@linux.intel.com> wrote:
>>> Now that all users of acpi_gpio.h have been moved to user either the GPIO
>>
>> s/user/use
>
> OK.
>
>>
>>> descriptor interface or to the internal gpiolib.h we can get rid of
>>
>> gpiolib.h will also need to be renamed if you follow my suggestion below.
>>
>>> acpi_gpio.h entirely.
>>>
>>> Once this is done the only interface to get GPIOs to drivers enumerated
>>> from ACPI namespace is the descriptor based interface.
>>
>> Oh, do I like this. :)
>>
>>>
>>> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>>> ---
>>>   drivers/gpio/gpiolib-acpi.c |  4 +++-
>>>   drivers/gpio/gpiolib.c      |  1 -
>>>   drivers/gpio/gpiolib.h      | 23 +++++++++++++++++++++++
>>>   include/linux/acpi_gpio.h   | 45 ---------------------------------------------
>>>   4 files changed, 26 insertions(+), 47 deletions(-)
>>>   delete mode 100644 include/linux/acpi_gpio.h
>>>
>>> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
>>> index cb2da66fbbfe..6c158d9a6efa 100644
>>> --- a/drivers/gpio/gpiolib-acpi.c
>>> +++ b/drivers/gpio/gpiolib-acpi.c
>>> @@ -12,11 +12,13 @@
>>>
>>>   #include <linux/errno.h>
>>>   #include <linux/gpio/consumer.h>
>>> +#include <linux/gpio/driver.h>
>>>   #include <linux/export.h>
>>> -#include <linux/acpi_gpio.h>
>>>   #include <linux/acpi.h>
>>>   #include <linux/interrupt.h>
>>>
>>> +#include "gpiolib.h"
>>> +
>>>   struct acpi_gpio_evt_pin {
>>>          struct list_head node;
>>>          acpi_handle *evt_handle;
>>> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
>>> index 70abccf0d144..a6b82413c290 100644
>>> --- a/drivers/gpio/gpiolib.c
>>> +++ b/drivers/gpio/gpiolib.c
>>> @@ -10,7 +10,6 @@
>>>   #include <linux/seq_file.h>
>>>   #include <linux/gpio.h>
>>>   #include <linux/of_gpio.h>
>>> -#include <linux/acpi_gpio.h>
>>>   #include <linux/idr.h>
>>>   #include <linux/slab.h>
>>>   #include <linux/acpi.h>
>>> diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
>>> index 2ed23ab8298c..82be586c1f90 100644
>>> --- a/drivers/gpio/gpiolib.h
>>> +++ b/drivers/gpio/gpiolib.h
>>> @@ -12,12 +12,35 @@
>>>   #ifndef GPIOLIB_H
>>>   #define GPIOLIB_H
>>>
>>> +#include <linux/err.h>
>>> +#include <linux/device.h>
>>> +
>>> +/**
>>> + * struct acpi_gpio_info - ACPI GPIO specific information
>>> + * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
>>> + * @active_low: in case of @gpioint, the pin is active low
>>> + */
>>> +struct acpi_gpio_info {
>>> +       bool gpioint;
>>> +       bool active_low;
>>> +};
>>> +
>>>   #ifdef CONFIG_ACPI
>>>   void acpi_gpiochip_add(struct gpio_chip *chip);
>>>   void acpi_gpiochip_remove(struct gpio_chip *chip);
>>> +
>>> +struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
>>> +                                         struct acpi_gpio_info *info);
>>>   #else
>>>   static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
>>>   static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
>>> +
>>> +static inline struct gpio_desc *
>>> +acpi_get_gpiod_by_index(struct device *dev, int index,
>>> +                       struct acpi_gpio_info *info)
>>> +{
>>> +       return ERR_PTR(-ENOSYS);
>>> +}
>>>   #endif
>>
>> Since this header contains purely ACPI-related declarations so far, I wonder
>> if it should not be renamed acpi.h?
>
> Well, for now it contains only ACPI related stuff but once you guys start
> tearing DT interfaces away from drivers, this header is expected to grow :)
>
> So idea is to have gpiolib internal/private header where we can add stuff
> taht is not going to be exported to drivers.

I just wondered if these headers should not be split by GPIO providers, 
but if you prefer it that way I'm fine with it too. We can move stuff 
later if needed.

Acked-by: Alexandre Courbot <acourbot@nvidia.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mika Westerberg Nov. 25, 2013, 8:54 a.m. UTC | #3
On Sat, Nov 23, 2013 at 06:21:03PM +0900, Alexandre Courbot wrote:
> On Fri, Nov 22, 2013 at 9:14 PM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> > Now that all users of acpi_gpio.h have been moved to user either the GPIO
> 
> s/user/use

OK.

> 
> > descriptor interface or to the internal gpiolib.h we can get rid of
> 
> gpiolib.h will also need to be renamed if you follow my suggestion below.
> 
> > acpi_gpio.h entirely.
> >
> > Once this is done the only interface to get GPIOs to drivers enumerated
> > from ACPI namespace is the descriptor based interface.
> 
> Oh, do I like this. :)
> 
> >
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> >  drivers/gpio/gpiolib-acpi.c |  4 +++-
> >  drivers/gpio/gpiolib.c      |  1 -
> >  drivers/gpio/gpiolib.h      | 23 +++++++++++++++++++++++
> >  include/linux/acpi_gpio.h   | 45 ---------------------------------------------
> >  4 files changed, 26 insertions(+), 47 deletions(-)
> >  delete mode 100644 include/linux/acpi_gpio.h
> >
> > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> > index cb2da66fbbfe..6c158d9a6efa 100644
> > --- a/drivers/gpio/gpiolib-acpi.c
> > +++ b/drivers/gpio/gpiolib-acpi.c
> > @@ -12,11 +12,13 @@
> >
> >  #include <linux/errno.h>
> >  #include <linux/gpio/consumer.h>
> > +#include <linux/gpio/driver.h>
> >  #include <linux/export.h>
> > -#include <linux/acpi_gpio.h>
> >  #include <linux/acpi.h>
> >  #include <linux/interrupt.h>
> >
> > +#include "gpiolib.h"
> > +
> >  struct acpi_gpio_evt_pin {
> >         struct list_head node;
> >         acpi_handle *evt_handle;
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index 70abccf0d144..a6b82413c290 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -10,7 +10,6 @@
> >  #include <linux/seq_file.h>
> >  #include <linux/gpio.h>
> >  #include <linux/of_gpio.h>
> > -#include <linux/acpi_gpio.h>
> >  #include <linux/idr.h>
> >  #include <linux/slab.h>
> >  #include <linux/acpi.h>
> > diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
> > index 2ed23ab8298c..82be586c1f90 100644
> > --- a/drivers/gpio/gpiolib.h
> > +++ b/drivers/gpio/gpiolib.h
> > @@ -12,12 +12,35 @@
> >  #ifndef GPIOLIB_H
> >  #define GPIOLIB_H
> >
> > +#include <linux/err.h>
> > +#include <linux/device.h>
> > +
> > +/**
> > + * struct acpi_gpio_info - ACPI GPIO specific information
> > + * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
> > + * @active_low: in case of @gpioint, the pin is active low
> > + */
> > +struct acpi_gpio_info {
> > +       bool gpioint;
> > +       bool active_low;
> > +};
> > +
> >  #ifdef CONFIG_ACPI
> >  void acpi_gpiochip_add(struct gpio_chip *chip);
> >  void acpi_gpiochip_remove(struct gpio_chip *chip);
> > +
> > +struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
> > +                                         struct acpi_gpio_info *info);
> >  #else
> >  static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
> >  static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
> > +
> > +static inline struct gpio_desc *
> > +acpi_get_gpiod_by_index(struct device *dev, int index,
> > +                       struct acpi_gpio_info *info)
> > +{
> > +       return ERR_PTR(-ENOSYS);
> > +}
> >  #endif
> 
> Since this header contains purely ACPI-related declarations so far, I wonder
> if it should not be renamed acpi.h?

Well, for now it contains only ACPI related stuff but once you guys start
tearing DT interfaces away from drivers, this header is expected to grow :)

So idea is to have gpiolib internal/private header where we can add stuff
taht is not going to be exported to drivers.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mika Westerberg Nov. 25, 2013, 10:18 a.m. UTC | #4
On Mon, Nov 25, 2013 at 05:51:00PM +0900, Alex Courbot wrote:
> I just wondered if these headers should not be split by GPIO
> providers, but if you prefer it that way I'm fine with it too. We
> can move stuff later if needed.
> 
> Acked-by: Alexandre Courbot <acourbot@nvidia.com>

Thanks!

BTW, I noticed that I missed removing EXPORT_SYMBOL_GPL() from
acpi_get_gpiod_by_index(). I'm folding that change to this patch for the
next version if nobody objects.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index cb2da66fbbfe..6c158d9a6efa 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -12,11 +12,13 @@ 
 
 #include <linux/errno.h>
 #include <linux/gpio/consumer.h>
+#include <linux/gpio/driver.h>
 #include <linux/export.h>
-#include <linux/acpi_gpio.h>
 #include <linux/acpi.h>
 #include <linux/interrupt.h>
 
+#include "gpiolib.h"
+
 struct acpi_gpio_evt_pin {
 	struct list_head node;
 	acpi_handle *evt_handle;
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 70abccf0d144..a6b82413c290 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -10,7 +10,6 @@ 
 #include <linux/seq_file.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
-#include <linux/acpi_gpio.h>
 #include <linux/idr.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 2ed23ab8298c..82be586c1f90 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -12,12 +12,35 @@ 
 #ifndef GPIOLIB_H
 #define GPIOLIB_H
 
+#include <linux/err.h>
+#include <linux/device.h>
+
+/**
+ * struct acpi_gpio_info - ACPI GPIO specific information
+ * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
+ * @active_low: in case of @gpioint, the pin is active low
+ */
+struct acpi_gpio_info {
+	bool gpioint;
+	bool active_low;
+};
+
 #ifdef CONFIG_ACPI
 void acpi_gpiochip_add(struct gpio_chip *chip);
 void acpi_gpiochip_remove(struct gpio_chip *chip);
+
+struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
+					  struct acpi_gpio_info *info);
 #else
 static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
 static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
+
+static inline struct gpio_desc *
+acpi_get_gpiod_by_index(struct device *dev, int index,
+			struct acpi_gpio_info *info)
+{
+	return ERR_PTR(-ENOSYS);
+}
 #endif
 
 #endif /* GPIOLIB_H */
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
deleted file mode 100644
index af96a0d452f6..000000000000
--- a/include/linux/acpi_gpio.h
+++ /dev/null
@@ -1,45 +0,0 @@ 
-#ifndef _LINUX_ACPI_GPIO_H_
-#define _LINUX_ACPI_GPIO_H_
-
-#include <linux/device.h>
-#include <linux/err.h>
-#include <linux/errno.h>
-#include <linux/gpio.h>
-#include <linux/gpio/consumer.h>
-
-/**
- * struct acpi_gpio_info - ACPI GPIO specific information
- * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
- * @active_low: in case of @gpioint, the pin is active low
- */
-struct acpi_gpio_info {
-	bool gpioint;
-	bool active_low;
-};
-
-#ifdef CONFIG_GPIO_ACPI
-
-struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
-					  struct acpi_gpio_info *info);
-#else /* CONFIG_GPIO_ACPI */
-
-static inline struct gpio_desc *
-acpi_get_gpiod_by_index(struct device *dev, int index,
-			struct acpi_gpio_info *info)
-{
-	return ERR_PTR(-ENOSYS);
-}
-
-#endif /* CONFIG_GPIO_ACPI */
-
-static inline int acpi_get_gpio_by_index(struct device *dev, int index,
-					 struct acpi_gpio_info *info)
-{
-	struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
-
-	if (IS_ERR(desc))
-		return PTR_ERR(desc);
-	return desc_to_gpio(desc);
-}
-
-#endif /* _LINUX_ACPI_GPIO_H_ */