Add platform_device_id struct and use the platform_get_device_id() output
to match which PMIC device is in use. With new name options, the gpio_chip
.label field is now assigned to the platform_device name match.
Remove MODULE_ALIAS since it is now generated by MODULE_DEVICE_TABLE.
Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
---
drivers/gpio/gpio-tps65219.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-tps65219.c b/drivers/gpio/gpio-tps65219.c
index 526640c39a11..7e03be0c7c92 100644
--- a/drivers/gpio/gpio-tps65219.c
+++ b/drivers/gpio/gpio-tps65219.c
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * GPIO driver for TI TPS65219 PMICs
+ * GPIO driver for TI TPS65215/TPS65219 PMICs
*
- * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
*/
#include <linux/bits.h>
@@ -141,7 +141,6 @@ static int tps65219_gpio_direction_output(struct gpio_chip *gc, unsigned int off
}
static const struct gpio_chip tps65219_template_chip = {
- .label = "tps65219-gpio",
.owner = THIS_MODULE,
.get_direction = tps65219_gpio_get_direction,
.direction_input = tps65219_gpio_direction_input,
@@ -164,20 +163,28 @@ static int tps65219_gpio_probe(struct platform_device *pdev)
gpio->tps = tps;
gpio->gpio_chip = tps65219_template_chip;
+ gpio->gpio_chip.label = dev_name(&pdev->dev);
gpio->gpio_chip.parent = tps->dev;
return devm_gpiochip_add_data(&pdev->dev, &gpio->gpio_chip, gpio);
}
+static const struct platform_device_id tps6521x_gpio_id_table[] = {
+ { "tps65215-gpio", TPS65215 },
+ { "tps65219-gpio", TPS65219 },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, tps6521x_gpio_id_table);
+
static struct platform_driver tps65219_gpio_driver = {
.driver = {
.name = "tps65219-gpio",
},
.probe = tps65219_gpio_probe,
+ .id_table = tps6521x_gpio_id_table,
};
module_platform_driver(tps65219_gpio_driver);
-MODULE_ALIAS("platform:tps65219-gpio");
MODULE_AUTHOR("Jonathan Cormier <jcormier@criticallink.com>");
-MODULE_DESCRIPTION("TPS65219 GPIO driver");
+MODULE_DESCRIPTION("TPS65215/TPS65219 GPIO driver");
MODULE_LICENSE("GPL");
--
2.43.0
Hi Shree,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20250113]
[also build test ERROR on linus/master v6.13-rc7]
[cannot apply to tmlind-omap/for-next v6.13-rc7 v6.13-rc6 v6.13-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shree-Ramamoorthy/gpio-tps65215-Add-TPS65215-to-platform_device_id-table/20250114-065813
base: next-20250113
patch link: https://lore.kernel.org/r/20250113225530.124213-2-s-ramamoorthy%40ti.com
patch subject: [PATCH v3 1/3] gpio: tps65215: Add TPS65215 to platform_device_id table
config: i386-randconfig-003-20250117 (https://download.01.org/0day-ci/archive/20250118/202501180342.Bi6C2Axf-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250118/202501180342.Bi6C2Axf-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/202501180342.Bi6C2Axf-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/gpio/gpio-tps65219.c:173:28: error: 'TPS65215' undeclared here (not in a function); did you mean 'TPS65219'?
173 | { "tps65215-gpio", TPS65215 },
| ^~~~~~~~
| TPS65219
vim +173 drivers/gpio/gpio-tps65219.c
171
172 static const struct platform_device_id tps6521x_gpio_id_table[] = {
> 173 { "tps65215-gpio", TPS65215 },
174 { "tps65219-gpio", TPS65219 },
175 { }
176 };
177 MODULE_DEVICE_TABLE(platform, tps6521x_gpio_id_table);
178
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Shree,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20250113]
[also build test ERROR on linus/master v6.13-rc7]
[cannot apply to tmlind-omap/for-next v6.13-rc7 v6.13-rc6 v6.13-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shree-Ramamoorthy/gpio-tps65215-Add-TPS65215-to-platform_device_id-table/20250114-065813
base: next-20250113
patch link: https://lore.kernel.org/r/20250113225530.124213-2-s-ramamoorthy%40ti.com
patch subject: [PATCH v3 1/3] gpio: tps65215: Add TPS65215 to platform_device_id table
config: i386-randconfig-004-20250117 (https://download.01.org/0day-ci/archive/20250118/202501180129.Eu47rQjQ-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250118/202501180129.Eu47rQjQ-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/202501180129.Eu47rQjQ-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/gpio/gpio-tps65219.c:173:21: error: use of undeclared identifier 'TPS65215'
173 | { "tps65215-gpio", TPS65215 },
| ^
>> drivers/gpio/gpio-tps65219.c:177:1: error: definition of variable with array type needs an explicit size or an initializer
177 | MODULE_DEVICE_TABLE(platform, tps6521x_gpio_id_table);
| ^
include/linux/module.h:250:21: note: expanded from macro 'MODULE_DEVICE_TABLE'
250 | extern typeof(name) __mod_device_table__##type##__##name \
| ^
<scratch space>:249:1: note: expanded from here
249 | __mod_device_table__platform__tps6521x_gpio_id_table
| ^
2 errors generated.
vim +/TPS65215 +173 drivers/gpio/gpio-tps65219.c
171
172 static const struct platform_device_id tps6521x_gpio_id_table[] = {
> 173 { "tps65215-gpio", TPS65215 },
174 { "tps65219-gpio", TPS65219 },
175 { }
176 };
> 177 MODULE_DEVICE_TABLE(platform, tps6521x_gpio_id_table);
178
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.