Skip to contentSkip to conversation

mfd: mt6397: Add platform device ID table

PATCH In review Javier Martinez Canillas 2 participants 2 messages Feb 10, 2016 – Feb 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mfd: mt6397: Add platform device ID table

The platform bus_type .match callback attempts to match the platform device name with an entry on the .id_table if provided and fallbacks to match with the driver's name if a table is not provided.

Using a platform device ID to match is more explicit, allows the driver to support more than one device and also the MODULE_DEVICE_TABLE macro can be used to export the module aliases information instead of the MODULE_ALIAS.

---

Changes in v2:
- Insert spaces at both ends of curly braces. Suggested by Lee Jones.
- Remove the sentinel comment from the NULL entry. Suggested by Lee Jones.

 drivers/mfd/mt6397-core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mfd/mt6397-core.c +7 -1
index 1749c1c9f405..41fe2ec2f92f 100644
@@ -275,6 +275,12 @@ static const struct of_device_id mt6397_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, mt6397_of_match);
 
+static const struct platform_device_id mt6397_id[] = {
+	{ "mt6397", 0 },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, mt6397_id);
+
 static struct platform_driver mt6397_driver = {
 	.probe = mt6397_probe,
 	.remove = mt6397_remove,
@@ -283,6 +289,7 @@ static struct platform_driver mt6397_driver = {
 		.of_match_table = of_match_ptr(mt6397_of_match),
 		.pm = &mt6397_pm_ops,
 	},
+	.id_table = mt6397_id,
 };
 
 module_platform_driver(mt6397_driver);
@@ -290,4 +297,3 @@ module_platform_driver(mt6397_driver);
 MODULE_AUTHOR("Flora Fu, MediaTek");
 MODULE_DESCRIPTION("Driver for MediaTek MT6397 PMIC");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:mt6397");
Signature · 1 line
2.5.0
#1 lore raw
Quoted 10 lines · Javier Martinez Canillas

The platform bus_type .match callback attempts to match the platform device name with an entry on the .id_table if provided and fallbacks to match with the driver's name if a table is not provided.

Using a platform device ID to match is more explicit, allows the driver to support more than one device and also the MODULE_DEVICE_TABLE macro can be used to export the module aliases information instead of the MODULE_ALIAS.

Quoted 8 lines

---

Changes in v2:
- Insert spaces at both ends of curly braces. Suggested by Lee Jones.
- Remove the sentinel comment from the NULL entry. Suggested by Lee Jones.

 drivers/mfd/mt6397-core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Thanks for fixing. Now applied.

Quoted 30 lines
drivers/mfd/mt6397-core.c +7 -1
index 1749c1c9f405..41fe2ec2f92f 100644
@@ -275,6 +275,12 @@ static const struct of_device_id mt6397_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, mt6397_of_match);
 
+static const struct platform_device_id mt6397_id[] = {
+	{ "mt6397", 0 },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, mt6397_id);
+
 static struct platform_driver mt6397_driver = {
 	.probe = mt6397_probe,
 	.remove = mt6397_remove,
@@ -283,6 +289,7 @@ static struct platform_driver mt6397_driver = {
 		.of_match_table = of_match_ptr(mt6397_of_match),
 		.pm = &mt6397_pm_ops,
 	},
+	.id_table = mt6397_id,
 };
 
 module_platform_driver(mt6397_driver);
@@ -290,4 +297,3 @@ module_platform_driver(mt6397_driver);
 MODULE_AUTHOR("Flora Fu, MediaTek");
 MODULE_DESCRIPTION("Driver for MediaTek MT6397 PMIC");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:mt6397");
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog