Skip to contentSkip to conversation

pinctrl: convert to subsys_platform_driver()

PATCH In review Brian Masney 4 participants 8 messages Nov 7 – Nov 11

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

cover pinctrl: convert to subsys_platform_driver()

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

---
Brian Masney (2):
pinctrl: ingenic: convert to subsys_platform_driver_probe()
pinctrl: intel: convert to subsys_platform_driver()

 drivers/pinctrl/intel/pinctrl-broxton.c      | 12 +-----------
 drivers/pinctrl/intel/pinctrl-cedarfork.c    | 12 +-----------
 drivers/pinctrl/intel/pinctrl-cherryview.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-denverton.c    | 12 +-----------
 drivers/pinctrl/intel/pinctrl-geminilake.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-lynxpoint.c    | 12 +-----------
 drivers/pinctrl/intel/pinctrl-merrifield.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-moorefield.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-sunrisepoint.c | 12 +-----------
 drivers/pinctrl/pinctrl-ingenic.c            |  8 ++------
 10 files changed, 11 insertions(+), 105 deletions(-)

---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261106-pinctrl-subsys-361b22a4b107

Best regards,

Signature · 1 line
Brian Masney <[email protected]>
#1 lore raw

PATCH 1/2 pinctrl: ingenic: convert to subsys_platform_driver_probe()

Reduce boilerplate code in this driver and convert it over to use the macro subsys_platform_driver_probe().

---
 drivers/pinctrl/pinctrl-ingenic.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-ingenic.c +2 -6
index d8ee489897ae..bdadb343c7cc 100644
@@ -4698,9 +4698,5 @@ static struct platform_driver ingenic_pinctrl_driver = {
 	},
 };
 
-static int __init ingenic_pinctrl_drv_register(void)
-{
-	return platform_driver_probe(&ingenic_pinctrl_driver,
-				     ingenic_pinctrl_probe);
-}
-subsys_initcall(ingenic_pinctrl_drv_register);
+subsys_platform_driver_probe(ingenic_pinctrl_driver,
+			     ingenic_pinctrl_probe);
Signature · 1 line
2.56.0
#2 lore raw

Re: [PATCH 1/2] pinctrl: ingenic: convert to subsys_platform_driver_probe()

Quoted 3 lines · Brian Masney

Reduce boilerplate code in this driver and convert it over to use the macro subsys_platform_driver_probe().

Wasn't there already a set of patches from somebody for the same reason?

...

drivers/pinctrl/pinctrl-ingenic.c static struct platform_driver ingenic_pinctrl_driver = { · line 4702

Quoted 2 lines
drivers/pinctrl/pinctrl-ingenic.c +2 -0
+subsys_platform_driver_probe(ingenic_pinctrl_driver,
+                            ingenic_pinctrl_probe);

Anyway, this should be a single line, it reads better that way.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Re: [PATCH 1/2] pinctrl: ingenic: convert to subsys_platform_driver_probe()

Hi Andy,

Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Brian Masney

Reduce boilerplate code in this driver and convert it over to use the macro subsys_platform_driver_probe().

Wasn't there already a set of patches from somebody for the same reason?

I just searched the linux-gpio archives and I see the effort back in June to also add subsys_platform_driver(). I wasn't aware of that effort, and it was never unfortunately merged into the driver core.

I got the macros added in 7.4-rc1, and I posted patches across the tree to use the new macros.

Brian

maintainer
#4 lore raw

Re: [PATCH 1/2] pinctrl: ingenic: convert to subsys_platform_driver_probe()

In reply to Brian Masney
Quoted 4 lines · Brian Masney

Reduce boilerplate code in this driver and convert it over to use the macro subsys_platform_driver_probe().

Patch applied, catenated statement to one line as requested by Andy while applying.

Andy will deal with patch 2/2!

Yours,
Linus Walleij

#5 lore raw

PATCH 2/2 pinctrl: intel: convert to subsys_platform_driver()

In reply to Brian Masney

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

---
 drivers/pinctrl/intel/pinctrl-broxton.c      | 12 +-----------
 drivers/pinctrl/intel/pinctrl-cedarfork.c    | 12 +-----------
 drivers/pinctrl/intel/pinctrl-cherryview.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-denverton.c    | 12 +-----------
 drivers/pinctrl/intel/pinctrl-geminilake.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-lynxpoint.c    | 12 +-----------
 drivers/pinctrl/intel/pinctrl-merrifield.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-moorefield.c   | 12 +-----------
 drivers/pinctrl/intel/pinctrl-sunrisepoint.c | 12 +-----------
 9 files changed, 9 insertions(+), 99 deletions(-)
drivers/pinctrl/intel/pinctrl-broxton.c +1 -11
index 269b8e25db84..e79e3d6d954f 100644
@@ -1010,17 +1010,7 @@ static struct platform_driver bxt_pinctrl_driver = {
 	.id_table = bxt_pinctrl_platform_ids,
 };
 
-static int __init bxt_pinctrl_init(void)
-{
-	return platform_driver_register(&bxt_pinctrl_driver);
-}
-subsys_initcall(bxt_pinctrl_init);
-
-static void __exit bxt_pinctrl_exit(void)
-{
-	platform_driver_unregister(&bxt_pinctrl_driver);
-}
-module_exit(bxt_pinctrl_exit);
+subsys_platform_driver(bxt_pinctrl_driver);
 
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Broxton SoC pinctrl/GPIO driver");
drivers/pinctrl/intel/pinctrl-cedarfork.c +1 -11
index 02fd1cc4fd1b..9f0c3b7f746d 100644
@@ -327,17 +327,7 @@ static struct platform_driver cdf_pinctrl_driver = {
 	},
 };
 
-static int __init cdf_pinctrl_init(void)
-{
-	return platform_driver_register(&cdf_pinctrl_driver);
-}
-subsys_initcall(cdf_pinctrl_init);
-
-static void __exit cdf_pinctrl_exit(void)
-{
-	platform_driver_unregister(&cdf_pinctrl_driver);
-}
-module_exit(cdf_pinctrl_exit);
+subsys_platform_driver(cdf_pinctrl_driver);
 
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Cedar Fork PCH pinctrl/GPIO driver");
drivers/pinctrl/intel/pinctrl-cherryview.c +1 -11
index a33eca5eafc4..800d3e360ba4 100644
@@ -1769,17 +1769,7 @@ static struct platform_driver chv_pinctrl_driver = {
 	},
 };
 
-static int __init chv_pinctrl_init(void)
-{
-	return platform_driver_register(&chv_pinctrl_driver);
-}
-subsys_initcall(chv_pinctrl_init);
-
-static void __exit chv_pinctrl_exit(void)
-{
-	platform_driver_unregister(&chv_pinctrl_driver);
-}
-module_exit(chv_pinctrl_exit);
+subsys_platform_driver(chv_pinctrl_driver);
 
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Cherryview/Braswell pinctrl driver");
drivers/pinctrl/intel/pinctrl-denverton.c +1 -11
index 47636a9719ed..015d0c405c22 100644
@@ -264,17 +264,7 @@ static struct platform_driver dnv_pinctrl_driver = {
 	.id_table = dnv_pinctrl_platform_ids,
 };
 
-static int __init dnv_pinctrl_init(void)
-{
-	return platform_driver_register(&dnv_pinctrl_driver);
-}
-subsys_initcall(dnv_pinctrl_init);
-
-static void __exit dnv_pinctrl_exit(void)
-{
-	platform_driver_unregister(&dnv_pinctrl_driver);
-}
-module_exit(dnv_pinctrl_exit);
+subsys_platform_driver(dnv_pinctrl_driver);
 
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Denverton SoC pinctrl/GPIO driver");
drivers/pinctrl/intel/pinctrl-geminilake.c +1 -11
index 21d0d5051b04..256b39308a93 100644
@@ -456,17 +456,7 @@ static struct platform_driver glk_pinctrl_driver = {
 	},
 };
 
-static int __init glk_pinctrl_init(void)
-{
-	return platform_driver_register(&glk_pinctrl_driver);
-}
-subsys_initcall(glk_pinctrl_init);
-
-static void __exit glk_pinctrl_exit(void)
-{
-	platform_driver_unregister(&glk_pinctrl_driver);
-}
-module_exit(glk_pinctrl_exit);
+subsys_platform_driver(glk_pinctrl_driver);
 
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Gemini Lake SoC pinctrl/GPIO driver");
drivers/pinctrl/intel/pinctrl-lynxpoint.c +1 -11
index 299ee4f22bdc..c6a1d36a0536 100644
@@ -834,17 +834,7 @@ static struct platform_driver lp_gpio_driver = {
 	},
 };
 
-static int __init lp_gpio_init(void)
-{
-	return platform_driver_register(&lp_gpio_driver);
-}
-subsys_initcall(lp_gpio_init);
-
-static void __exit lp_gpio_exit(void)
-{
-	platform_driver_unregister(&lp_gpio_driver);
-}
-module_exit(lp_gpio_exit);
+subsys_platform_driver(lp_gpio_driver);
 
 MODULE_AUTHOR("Mathias Nyman (Intel)");
 MODULE_AUTHOR("Andy Shevchenko (Intel)");
drivers/pinctrl/intel/pinctrl-merrifield.c +1 -11
index 5cf54bc18f86..2227e8e78a9f 100644
@@ -363,17 +363,7 @@ static struct platform_driver mrfld_pinctrl_driver = {
 	},
 };
 
-static int __init mrfld_pinctrl_init(void)
-{
-	return platform_driver_register(&mrfld_pinctrl_driver);
-}
-subsys_initcall(mrfld_pinctrl_init);
-
-static void __exit mrfld_pinctrl_exit(void)
-{
-	platform_driver_unregister(&mrfld_pinctrl_driver);
-}
-module_exit(mrfld_pinctrl_exit);
+subsys_platform_driver(mrfld_pinctrl_driver);
 
 MODULE_AUTHOR("Andy Shevchenko <[email protected]>");
 MODULE_DESCRIPTION("Intel Merrifield SoC pinctrl driver");
drivers/pinctrl/intel/pinctrl-moorefield.c +1 -11
index 59f46b0e2156..5fe034dd7a9e 100644
@@ -324,17 +324,7 @@ static struct platform_driver mofld_pinctrl_driver = {
 	},
 };
 
-static int __init mofld_pinctrl_init(void)
-{
-	return platform_driver_register(&mofld_pinctrl_driver);
-}
-subsys_initcall(mofld_pinctrl_init);
-
-static void __exit mofld_pinctrl_exit(void)
-{
-	platform_driver_unregister(&mofld_pinctrl_driver);
-}
-module_exit(mofld_pinctrl_exit);
+subsys_platform_driver(mofld_pinctrl_driver);
 
 MODULE_AUTHOR("Andy Shevchenko <[email protected]>");
 MODULE_DESCRIPTION("Intel Moorefield SoC pinctrl driver");
drivers/pinctrl/intel/pinctrl-sunrisepoint.c +1 -11
index 77ac32ab9577..ae3f1ad627a9 100644
@@ -580,17 +580,7 @@ static struct platform_driver spt_pinctrl_driver = {
 	},
 };
 
-static int __init spt_pinctrl_init(void)
-{
-	return platform_driver_register(&spt_pinctrl_driver);
-}
-subsys_initcall(spt_pinctrl_init);
-
-static void __exit spt_pinctrl_exit(void)
-{
-	platform_driver_unregister(&spt_pinctrl_driver);
-}
-module_exit(spt_pinctrl_exit);
+subsys_platform_driver(spt_pinctrl_driver);
 
 MODULE_AUTHOR("Mathias Nyman <[email protected]>");
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
Signature · 1 line
2.56.0
#6 lore raw

Re: [PATCH 2/2] pinctrl: intel: convert to subsys_platform_driver()

Quoted 2 lines · Brian Masney

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

Look at [email protected].

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

Re: [PATCH 2/2] pinctrl: intel: convert to subsys_platform_driver()

Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Brian Masney

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

Look at [email protected].

OK thanks for the pointer. There's no need for a follow up from me then since the series from Peng already covers everything here.

Brian