gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells
PATCH v2 1/2 gpio: wcd934x: Remove duplicate assignment of of_gpio_n_cells
The of_gpio_n_cells default is 2 when ->of_xlate() callback is not defined. No need to assign it explicitly in the driver.
---
v2: no changes
drivers/gpio/gpio-wcd934x.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpio/gpio-wcd934x.c +0 -1
@@ -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);
Signature · 1 line
2.39.0
PATCH v2 2/2 gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
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.
---
v2: added one more missing header (LKP)
drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-wcd934x.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpio/Kconfig +1 -1
@@ -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.
drivers/gpio/gpio-wcd934x.c +4 -2
@@ -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
Signature · 1 line
2.39.0
Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
Quoted 32 lines · Andy Shevchenko
The driver doesn't depend on the
OF_GPIOto be complied. Hence the proper header to use ismod_devicetable.h. Replace of*.h with the above mentioned and drop redundant dependency.Signed-off-by Andy Shevchenko <[email protected]>---
v2: added one more missing header (LKP)drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-wcd934x.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/gpio/Kconfig +1
-1@@ -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.drivers/gpio/gpio-wcd934x.c +0
-0@@ -1,11 +1,13 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019, Linaro Limited
drivers/gpio/gpio-wcd934x.c line 10
Quoted 10 lines
drivers/gpio/gpio-wcd934x.c +4
-2+#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
Quoted 6 lines
drivers/gpio/gpio-wcd934x.c +0
-1#define WCD_PIN_MASK (p) BIT(p)#define WCD_REG_DIR_CTL_OFFSET 0x42 --2.39.0
Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
Quoted 2 lines · Bartosz Golaszewski
On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
<[email protected]> wrote:
...
Quoted 11 lines
drivers/gpio/gpio-wcd934x.c line 10
Quoted 9 lines
drivers/gpio/gpio-wcd934x.c +4
-2+#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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
Quoted 19 lines · Andy Shevchenko
Quoted 2 lines · Bartosz Golaszewski
On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
<[email protected]> wrote:...
Quoted 11 lines
drivers/gpio/gpio-wcd934x.c line 10
Quoted 9 lines
drivers/gpio/gpio-wcd934x.c +4
-2+#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?
Quoted 5 lines
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
Re: [PATCH v2 2/2] gpio: wcd934x: Use proper headers and drop OF_GPIO dependency
Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Bartosz Golaszewski
On Fri, Jan 13, 2023 at 7:25 PM Andy Shevchenko
<[email protected]> wrote:
...
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
drivers/gpio/gpio-wcd934x.c line 10
Quoted 9 lines
drivers/gpio/gpio-wcd934x.c +4
-2+#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?
Quoted 6 lines
Quoted 2 lines
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!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Bartosz Golaszewski
AppliedQuoted 23 lines · Andy Shevchenko
The
of_gpio_n_cellsdefault is 2 when ->of_xlate() callback is not defined. No need to assign it explicitly in the driver.Signed-off-by Andy Shevchenko <[email protected]>---
v2: no changesdrivers/gpio/gpio-wcd934x.c | 1 - 1 file changed, 1 deletion(-)drivers/gpio/gpio-wcd934x.c +0
-2@@ -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); --
Quoted 2 lines
2.39.0
Applied, thanks!
Bart