linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells
@ 2023-01-13 18:26 Andy Shevchenko
  2023-01-13 18:26 ` [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency Andy Shevchenko
  2023-01-16  9:03 ` [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells Bartosz Golaszewski
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-01-13 18:26 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

The of_gpio_n_cells default is 2 when ->of_xlate() callback is
not defined. No need to assign it explicitly in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/gpio/gpio-wcd934x.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
index 97e6caedf1f3..817750e4e033 100644
--- a/drivers/gpio/gpio-wcd934x.c
+++ b/drivers/gpio/gpio-wcd934x.c
@@ -98,7 +98,6 @@ static int wcd_gpio_probe(struct platform_device *pdev)
 	chip->base = -1;
 	chip->ngpio = WCD934X_NPINS;
 	chip->label = dev_name(dev);
-	chip->of_gpio_n_cells = 2;
 	chip->can_sleep = false;
 
 	return devm_gpiochip_add_data(dev, chip, data);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
  2023-01-13 18:26 [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells Andy Shevchenko
@ 2023-01-13 18:26 ` Andy Shevchenko
  2023-01-16  9:03   ` Bartosz Golaszewski
  2023-01-16  9:03 ` [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells Bartosz Golaszewski
  1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-01-13 18:26 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

The driver doesn't depend on the OF_GPIO to be complied. Hence
the proper header to use is mod_devicetable.h. Replace of*.h with
the above mentioned and drop redundant dependency.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: added one more missing header (LKP)
 drivers/gpio/Kconfig        | 2 +-
 drivers/gpio/gpio-wcd934x.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 9995e23673dd..a2f64f880163 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -700,7 +700,7 @@ config GPIO_VX855
 
 config GPIO_WCD934X
 	tristate "Qualcomm Technologies Inc WCD9340/WCD9341 GPIO controller driver"
-	depends on MFD_WCD934X && OF_GPIO
+	depends on MFD_WCD934X
 	help
          This driver is to support GPIO block found on the Qualcomm Technologies
 	 Inc WCD9340/WCD9341 Audio Codec.
diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
index 817750e4e033..b999af6b900b 100644
--- a/drivers/gpio/gpio-wcd934x.c
+++ b/drivers/gpio/gpio-wcd934x.c
@@ -1,11 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0
 // Copyright (c) 2019, Linaro Limited
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/gpio/driver.h>
+#include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
-#include <linux/of_device.h>
+
+#include <linux/gpio/driver.h>
 
 #define WCD_PIN_MASK(p) BIT(p)
 #define WCD_REG_DIR_CTL_OFFSET 0x42
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells
  2023-01-13 18:26 [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells Andy Shevchenko
  2023-01-13 18:26 ` [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency Andy Shevchenko
@ 2023-01-16  9:03 ` Bartosz Golaszewski
  1 sibling, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2023-01-16  9:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The of_gpio_n_cells default is 2 when ->of_xlate() callback is
> not defined. No need to assign it explicitly in the driver.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: no changes
>  drivers/gpio/gpio-wcd934x.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
> index 97e6caedf1f3..817750e4e033 100644
> --- a/drivers/gpio/gpio-wcd934x.c
> +++ b/drivers/gpio/gpio-wcd934x.c
> @@ -98,7 +98,6 @@ static int wcd_gpio_probe(struct platform_device *pdev)
>         chip->base = -1;
>         chip->ngpio = WCD934X_NPINS;
>         chip->label = dev_name(dev);
> -       chip->of_gpio_n_cells = 2;
>         chip->can_sleep = false;
>
>         return devm_gpiochip_add_data(dev, chip, data);
> --
> 2.39.0
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
  2023-01-13 18:26 ` [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency Andy Shevchenko
@ 2023-01-16  9:03   ` Bartosz Golaszewski
  2023-01-16 12:00     ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Bartosz Golaszewski @ 2023-01-16  9:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The driver doesn't depend on the OF_GPIO to be complied. Hence
> the proper header to use is mod_devicetable.h. Replace of*.h with
> the above mentioned and drop redundant dependency.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: added one more missing header (LKP)
>  drivers/gpio/Kconfig        | 2 +-
>  drivers/gpio/gpio-wcd934x.c | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 9995e23673dd..a2f64f880163 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -700,7 +700,7 @@ config GPIO_VX855
>
>  config GPIO_WCD934X
>         tristate "Qualcomm Technologies Inc WCD9340/WCD9341 GPIO controller driver"
> -       depends on MFD_WCD934X && OF_GPIO
> +       depends on MFD_WCD934X
>         help
>           This driver is to support GPIO block found on the Qualcomm Technologies
>          Inc WCD9340/WCD9341 Audio Codec.
> diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
> index 817750e4e033..b999af6b900b 100644
> --- a/drivers/gpio/gpio-wcd934x.c
> +++ b/drivers/gpio/gpio-wcd934x.c
> @@ -1,11 +1,13 @@
>  // SPDX-License-Identifier: GPL-2.0
>  // Copyright (c) 2019, Linaro Limited
>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> -#include <linux/gpio/driver.h>
> +#include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/slab.h>
> -#include <linux/of_device.h>
> +
> +#include <linux/gpio/driver.h>

Any reason for having it separately here?

Bart

>
>  #define WCD_PIN_MASK(p) BIT(p)
>  #define WCD_REG_DIR_CTL_OFFSET 0x42
> --
> 2.39.0
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
  2023-01-16  9:03   ` Bartosz Golaszewski
@ 2023-01-16 12:00     ` Andy Shevchenko
  2023-01-16 13:56       ` Bartosz Golaszewski
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-01-16 12:00 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Mon, Jan 16, 2023 at 10:03:47AM +0100, Bartosz Golaszewski wrote:
> On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

...

> > +#include <linux/mod_devicetable.h>
> >  #include <linux/module.h>
> > -#include <linux/gpio/driver.h>
> > +#include <linux/platform_device.h>
> >  #include <linux/regmap.h>
> >  #include <linux/slab.h>
> > -#include <linux/of_device.h>
> > +
> > +#include <linux/gpio/driver.h>
> 
> Any reason for having it separately here?

Yes. The idea is to emphasize the relationship between the driver and
the subsystem it's written for.

P.S. Thanks for applying the rest of my contribution.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
  2023-01-16 12:00     ` Andy Shevchenko
@ 2023-01-16 13:56       ` Bartosz Golaszewski
  2023-01-16 14:43         ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Bartosz Golaszewski @ 2023-01-16 13:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Mon, Jan 16, 2023 at 1:00 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Jan 16, 2023 at 10:03:47AM +0100, Bartosz Golaszewski wrote:
> > On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
>
> ...
>
> > > +#include <linux/mod_devicetable.h>
> > >  #include <linux/module.h>
> > > -#include <linux/gpio/driver.h>
> > > +#include <linux/platform_device.h>
> > >  #include <linux/regmap.h>
> > >  #include <linux/slab.h>
> > > -#include <linux/of_device.h>
> > > +
> > > +#include <linux/gpio/driver.h>
> >
> > Any reason for having it separately here?
>
> Yes. The idea is to emphasize the relationship between the driver and
> the subsystem it's written for.
>
> P.S. Thanks for applying the rest of my contribution.
>

We almost never do it and I prefer all linux/ headers to be grouped
together. I like separate sections for asm/ and local includes but
this is overkill IMO.

Bart

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
  2023-01-16 13:56       ` Bartosz Golaszewski
@ 2023-01-16 14:43         ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-01-16 14:43 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Mon, Jan 16, 2023 at 02:56:23PM +0100, Bartosz Golaszewski wrote:
> On Mon, Jan 16, 2023 at 1:00 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Jan 16, 2023 at 10:03:47AM +0100, Bartosz Golaszewski wrote:
> > > On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:

...

> > > > +#include <linux/mod_devicetable.h>
> > > >  #include <linux/module.h>
> > > > -#include <linux/gpio/driver.h>
> > > > +#include <linux/platform_device.h>
> > > >  #include <linux/regmap.h>
> > > >  #include <linux/slab.h>
> > > > -#include <linux/of_device.h>
> > > > +
> > > > +#include <linux/gpio/driver.h>
> > >
> > > Any reason for having it separately here?
> >
> > Yes. The idea is to emphasize the relationship between the driver and
> > the subsystem it's written for.

> We almost never do it and I prefer all linux/ headers to be grouped
> together. I like separate sections for asm/ and local includes but
> this is overkill IMO.

OK!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-16 14:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 18:26 [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells Andy Shevchenko
2023-01-13 18:26 ` [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency Andy Shevchenko
2023-01-16  9:03   ` Bartosz Golaszewski
2023-01-16 12:00     ` Andy Shevchenko
2023-01-16 13:56       ` Bartosz Golaszewski
2023-01-16 14:43         ` Andy Shevchenko
2023-01-16  9:03 ` [PATCH v2 1/2] gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells Bartosz Golaszewski

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