Skip to contentSkip to conversation

pinctrl: denverton: Enable platform device in the absence of ACPI enumeration

PATCH In review Andy Shevchenko 4 participants 10 messages Sep 26, 2023 – Oct 5, 2023

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

PATCH 1/1 pinctrl: denverton: Enable platform device in the absence of ACPI enumeration

This is to cater the need for non-ACPI system whereby a platform device has to be created in order to bind with the Denverton pinctrl platform driver.

---
 drivers/pinctrl/intel/pinctrl-denverton.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pinctrl/intel/pinctrl-denverton.c +7 -0
index 0c4694cfa594..a1a7242e0451 100644
@@ -257,6 +257,11 @@ static const struct acpi_device_id dnv_pinctrl_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, dnv_pinctrl_acpi_match);
 
+static const struct platform_device_id dnv_pinctrl_platform_ids[] = {
+	{ "denverton-pinctrl", (kernel_ulong_t)&dnv_soc_data },
+	{ }
+};
+
 static struct platform_driver dnv_pinctrl_driver = {
 	.probe = intel_pinctrl_probe_by_hid,
 	.driver = {
@@ -264,6 +269,7 @@ static struct platform_driver dnv_pinctrl_driver = {
 		.acpi_match_table = dnv_pinctrl_acpi_match,
 		.pm = &dnv_pinctrl_pm_ops,
 	},
+	.id_table = dnv_pinctrl_platform_ids,
 };
 
 static int __init dnv_pinctrl_init(void)
@@ -281,4 +287,5 @@ module_exit(dnv_pinctrl_exit);
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Denverton SoC pinctrl/GPIO driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:denverton-pinctrl");
 MODULE_IMPORT_NS(PINCTRL_INTEL);
Signature · 1 line
2.40.0.1.gaa8946217a0b
#3 lore raw
In reply to Andy Shevchenko
Quoted 34 lines · Andy Shevchenko

This is to cater the need for non-ACPI system whereby a platform device has to be created in order to bind with the Denverton pinctrl platform driver.

---
 drivers/pinctrl/intel/pinctrl-denverton.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pinctrl/intel/pinctrl-denverton.c +6 -0
index 0c4694cfa594..a1a7242e0451 100644
@@ -257,6 +257,11 @@ static const struct acpi_device_id dnv_pinctrl_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, dnv_pinctrl_acpi_match);
 
+static const struct platform_device_id dnv_pinctrl_platform_ids[] = {
+	{ "denverton-pinctrl", (kernel_ulong_t)&dnv_soc_data },
+	{ }
+};
+
 static struct platform_driver dnv_pinctrl_driver = {
 	.probe = intel_pinctrl_probe_by_hid,
 	.driver = {
@@ -264,6 +269,7 @@ static struct platform_driver dnv_pinctrl_driver = {
 		.acpi_match_table = dnv_pinctrl_acpi_match,
 		.pm = &dnv_pinctrl_pm_ops,
 	},
+	.id_table = dnv_pinctrl_platform_ids,
 };
 
 static int __init dnv_pinctrl_init(void)

drivers/pinctrl/intel/pinctrl-denverton.c module_exit(dnv_pinctrl_exit); · line 290

Quoted 4 lines
drivers/pinctrl/intel/pinctrl-denverton.c +1 -0
@@ -281,4 +287,5 @@ module_exit(dnv_pinctrl_exit);
 MODULE_AUTHOR("Mika Westerberg <[email protected]>");
 MODULE_DESCRIPTION("Intel Denverton SoC pinctrl/GPIO driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

Best regards,
Krzysztof

#4 lore raw
Quoted 1 line · Krzysztof Kozlowski

On 26/09/2023 21:08, Andy Shevchenko wrote:

...

Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

This is cargo cult from pinctrl-broxton.c. If we want to fix, we need to fix both.
Care to send patches?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Krzysztof Kozlowski

On 26/09/2023 21:08, Andy Shevchenko wrote:

...

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

This is cargo cult from pinctrl-broxton.c. If we want to fix, we need to fix both.
Care to send patches?

I don't understand how some other file affects this. Why do you exactly need module alias here? Which use-case does not work without it (after adding proper MODULE_DEVICE_TABLE())?

Best regards,
Krzysztof

#6 lore raw
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Krzysztof Kozlowski

On 26/09/2023 21:08, Andy Shevchenko wrote:

...

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

Quoted 7 lines
Quoted 3 lines

This is cargo cult from pinctrl-broxton.c. If we want to fix, we need to fix both.
Care to send patches?

I don't understand how some other file affects this. Why do you exactly need module alias here? Which use-case does not work without it (after adding proper MODULE_DEVICE_TABLE())?

We try to keep these drivers uniform. So, if something should be done differently, it should be done for all affected drivers. Since patch is applied, now we have two drivers to improve.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
Quoted 16 lines · Andy Shevchenko
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Krzysztof Kozlowski

On 26/09/2023 21:08, Andy Shevchenko wrote:

...

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

This is cargo cult from pinctrl-broxton.c. If we want to fix, we need to fix both.
Care to send patches?

Quoted 7 lines
Quoted 3 lines

I don't understand how some other file affects this. Why do you exactly need module alias here? Which use-case does not work without it (after adding proper MODULE_DEVICE_TABLE())?

We try to keep these drivers uniform. So, if something should be done differently, it should be done for all affected drivers. Since patch is applied, now we have two drivers to improve.

Awesome reason. So if you add accidentally bug to one driver, it should be copied to other file as well.

Best regards,
Krzysztof

#8 lore raw
Quoted 5 lines · Krzysztof Kozlowski
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Krzysztof Kozlowski

On 26/09/2023 21:08, Andy Shevchenko wrote:

...

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

This is cargo cult from pinctrl-broxton.c. If we want to fix, we need to fix both.
Care to send patches?

I don't understand how some other file affects this. Why do you exactly need module alias here? Which use-case does not work without it (after adding proper MODULE_DEVICE_TABLE())?

Quoted 6 lines
Quoted 3 lines

We try to keep these drivers uniform. So, if something should be done differently, it should be done for all affected drivers. Since patch is applied, now we have two drivers to improve.

Awesome reason. So if you add accidentally bug to one driver, it should be copied to other file as well.

I'm not sure where it's a bug, it works. The problem is implementation and I believe Mika and certainly me agree with your points that MODULE_DEVICE_TABLE() is a right way to go.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Krzysztof Kozlowski
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Krzysztof Kozlowski

On 26/09/2023 21:08, Andy Shevchenko wrote:

...

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:denverton-pinctrl");

Why do you need the alias? It's the same as ID table. You most likely miss MODULE_DEVICE_TABLE() or your table is just wrong.

Quoted 7 lines
Quoted 3 lines

This is cargo cult from pinctrl-broxton.c. If we want to fix, we need to fix both.
Care to send patches?

I don't understand how some other file affects this. Why do you exactly need module alias here? Which use-case does not work without it (after adding proper MODULE_DEVICE_TABLE())?

We try to keep these drivers uniform. So, if something should be done differently, it should be done for all affected drivers. Since patch is applied, now we have two drivers to improve.

Quoted 6 lines
Quoted 2 lines

Awesome reason. So if you add accidentally bug to one driver, it should be copied to other file as well.

I'm not sure where it's a bug, it works. The problem is implementation and I believe Mika and certainly me agree with your points that MODULE_DEVICE_TABLE() is a right way to go.

The initial implementation was done by 0c3013bbe1d8 ("pinctrl/broxton:
enable platform device in the absence of ACPI enumeration"). It was ACKed by the driver maintainer as this one. But again, we agree that your way is better.

Signature · 2 lines
With Best Regards,
Andy Shevchenko