Skip to contentSkip to conversation

mfd: lpc_ich: Assign subdevice ids automatically

PATCH Superseded Mika Westerberg 2 participants 3 messages May 8, 2015 – Jun 9, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: lpc_ich: Assign subdevice ids automatically

Using -1 as platform device id means that the platform driver core will not assign any id to the device (the device name will not have id at all). This results problems on systems that have multiple PCHs (Platform Controller HUBs) because all of them also include their own copy of LPC device.

All the subsequent device creations will fail because there already exists platform device with the same name.

Fix this by passing -2 as a platform device id. This makes the platform device core to allocate new ids automatically.

---
 drivers/mfd/lpc_ich.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/lpc_ich.c +2 -2
index 12d960a60ec4..c211cf361680 100644
@@ -934,7 +934,7 @@ gpe0_done:
 	lpc_ich_enable_gpio_space(dev);
 
 	lpc_ich_finalize_cell(dev, &lpc_ich_cells[LPC_GPIO]);
-	ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_GPIO],
+	ret = mfd_add_devices(&dev->dev, -2, &lpc_ich_cells[LPC_GPIO],
 			      1, NULL, 0, NULL);
 
 gpio_done:
@@ -1008,7 +1008,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
 	}
 
 	lpc_ich_finalize_cell(dev, &lpc_ich_cells[LPC_WDT]);
-	ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_WDT],
+	ret = mfd_add_devices(&dev->dev, -2, &lpc_ich_cells[LPC_WDT],
 			      1, NULL, 0, NULL);
 
 wdt_done:
Signature · 1 line
2.1.4
#1 lore raw

Ping on this.

Quoted 40 lines · Mika Westerberg

Using -1 as platform device id means that the platform driver core will not assign any id to the device (the device name will not have id at all). This results problems on systems that have multiple PCHs (Platform Controller HUBs) because all of them also include their own copy of LPC device.

All the subsequent device creations will fail because there already exists platform device with the same name.

Fix this by passing -2 as a platform device id. This makes the platform device core to allocate new ids automatically.

---
 drivers/mfd/lpc_ich.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/lpc_ich.c +2 -2
index 12d960a60ec4..c211cf361680 100644
@@ -934,7 +934,7 @@ gpe0_done:
 	lpc_ich_enable_gpio_space(dev);
 
 	lpc_ich_finalize_cell(dev, &lpc_ich_cells[LPC_GPIO]);
-	ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_GPIO],
+	ret = mfd_add_devices(&dev->dev, -2, &lpc_ich_cells[LPC_GPIO],
 			      1, NULL, 0, NULL);
 
 gpio_done:
@@ -1008,7 +1008,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
 	}
 
 	lpc_ich_finalize_cell(dev, &lpc_ich_cells[LPC_WDT]);
-	ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_WDT],
+	ret = mfd_add_devices(&dev->dev, -2, &lpc_ich_cells[LPC_WDT],
 			      1, NULL, 0, NULL);
 
 wdt_done:
Signature · 1 line
2.1.4
#2 lore raw
In reply to Mika Westerberg
Quoted 10 lines · Mika Westerberg

Using -1 as platform device id means that the platform driver core will not assign any id to the device (the device name will not have id at all). This results problems on systems that have multiple PCHs (Platform Controller HUBs) because all of them also include their own copy of LPC device.

All the subsequent device creations will fail because there already exists platform device with the same name.

Fix this by passing -2 as a platform device id. This makes the platform device core to allocate new ids automatically.

Please use the defines provided in:

include/linux/platform_device.h

Quoted 27 lines
---
 drivers/mfd/lpc_ich.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/lpc_ich.c +2 -2
index 12d960a60ec4..c211cf361680 100644
@@ -934,7 +934,7 @@ gpe0_done:
 	lpc_ich_enable_gpio_space(dev);
 
 	lpc_ich_finalize_cell(dev, &lpc_ich_cells[LPC_GPIO]);
-	ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_GPIO],
+	ret = mfd_add_devices(&dev->dev, -2, &lpc_ich_cells[LPC_GPIO],
 			      1, NULL, 0, NULL);
 
 gpio_done:
@@ -1008,7 +1008,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
 	}
 
 	lpc_ich_finalize_cell(dev, &lpc_ich_cells[LPC_WDT]);
-	ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_WDT],
+	ret = mfd_add_devices(&dev->dev, -2, &lpc_ich_cells[LPC_WDT],
 			      1, NULL, 0, NULL);
 
 wdt_done:
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog