diff mbox series

[2/2] gpio: mmio: Parse ngpios property

Message ID 20241016-gpio-ngpios-v1-2-f16cf154f715@linaro.org
State New
Headers show
Series gpio: mmio: Support ngpios property | expand

Commit Message

Linus Walleij Oct. 16, 2024, 7:21 a.m. UTC
This makes the MMIO GPIO driver parse the ngpios property from
devices instatiated directly from the device tree so we can
further restrict the number of GPIOs down from the number of
bits on the target register.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-mmio.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

kernel test robot Oct. 17, 2024, 2:05 a.m. UTC | #1
Hi Linus,

kernel test robot noticed the following build errors:

[auto build test ERROR on 9852d85ec9d492ebef56dc5f229416c925758edc]

url:    https://github.com/intel-lab-lkp/linux/commits/Linus-Walleij/dt-bindings-gpio-mmio-Add-ngpios-property/20241016-152354
base:   9852d85ec9d492ebef56dc5f229416c925758edc
patch link:    https://lore.kernel.org/r/20241016-gpio-ngpios-v1-2-f16cf154f715%40linaro.org
patch subject: [PATCH 2/2] gpio: mmio: Parse ngpios property
config: i386-buildonly-randconfig-003-20241017 (https://download.01.org/0day-ci/archive/20241017/202410170940.KyJaAkpF-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241017/202410170940.KyJaAkpF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410170940.KyJaAkpF-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpio/gpio-mmio.c:709:10: error: no member named 'ngpios' in 'struct bgpio_pdata'; did you mean 'ngpio'?
     709 |                 pdata->ngpios = ngpios;
         |                        ^~~~~~
         |                        ngpio
   include/linux/gpio/driver.h:688:6: note: 'ngpio' declared here
     688 |         int ngpio;
         |             ^
   1 error generated.


vim +709 drivers/gpio/gpio-mmio.c

   693	
   694	static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *flags)
   695	{
   696		struct bgpio_pdata *pdata;
   697		u32 ngpios;
   698	
   699		if (!dev_fwnode(dev))
   700			return NULL;
   701	
   702		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
   703		if (!pdata)
   704			return ERR_PTR(-ENOMEM);
   705	
   706		pdata->base = -1;
   707	
   708		if (!device_property_read_u32(dev, "ngpios", &ngpios))
 > 709			pdata->ngpios = ngpios;
   710	
   711		if (device_is_big_endian(dev))
   712			*flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;
   713	
   714		if (device_property_read_bool(dev, "no-output"))
   715			*flags |= BGPIOF_NO_OUTPUT;
   716	
   717		return pdata;
   718	}
   719
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index d89e78f0ead3..9e944c191551 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -694,6 +694,7 @@  MODULE_DEVICE_TABLE(of, bgpio_of_match);
 static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *flags)
 {
 	struct bgpio_pdata *pdata;
+	u32 ngpios;
 
 	if (!dev_fwnode(dev))
 		return NULL;
@@ -704,6 +705,9 @@  static struct bgpio_pdata *bgpio_parse_fw(struct device *dev, unsigned long *fla
 
 	pdata->base = -1;
 
+	if (!device_property_read_u32(dev, "ngpios", &ngpios))
+		pdata->ngpios = ngpios;
+
 	if (device_is_big_endian(dev))
 		*flags |= BGPIOF_BIG_ENDIAN_BYTE_ORDER;