Commit 3dab794f authored by Aaron Sierra's avatar Aaron Sierra Committed by Lee Jones

mfd: lpc_ich: Separate device cells for clarity

The lpc_ich_cells array gives the wrong impression about the
relationship between the watchdog and GPIO devices. They are
completely distinct devices, so this patch separates the
array into distinct mfd_cell structs per device.

A side effect of removing the array, is that the lpc_cells enum
is no longer needed.
Signed-off-by: default avatarAaron Sierra <asierra@xes-inc.com>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 39d047c0
...@@ -132,24 +132,18 @@ static struct resource gpio_ich_res[] = { ...@@ -132,24 +132,18 @@ static struct resource gpio_ich_res[] = {
}, },
}; };
enum lpc_cells { static struct mfd_cell lpc_ich_wdt_cell = {
LPC_WDT = 0,
LPC_GPIO,
};
static struct mfd_cell lpc_ich_cells[] = {
[LPC_WDT] = {
.name = "iTCO_wdt", .name = "iTCO_wdt",
.num_resources = ARRAY_SIZE(wdt_ich_res), .num_resources = ARRAY_SIZE(wdt_ich_res),
.resources = wdt_ich_res, .resources = wdt_ich_res,
.ignore_resource_conflicts = true, .ignore_resource_conflicts = true,
}, };
[LPC_GPIO] = {
static struct mfd_cell lpc_ich_gpio_cell = {
.name = "gpio_ich", .name = "gpio_ich",
.num_resources = ARRAY_SIZE(gpio_ich_res), .num_resources = ARRAY_SIZE(gpio_ich_res),
.resources = gpio_ich_res, .resources = gpio_ich_res,
.ignore_resource_conflicts = true, .ignore_resource_conflicts = true,
},
}; };
/* chipset related info */ /* chipset related info */
...@@ -841,7 +835,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev) ...@@ -841,7 +835,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev)
struct itco_wdt_platform_data *pdata; struct itco_wdt_platform_data *pdata;
struct lpc_ich_priv *priv = pci_get_drvdata(dev); struct lpc_ich_priv *priv = pci_get_drvdata(dev);
struct lpc_ich_info *info; struct lpc_ich_info *info;
struct mfd_cell *cell = &lpc_ich_cells[LPC_WDT]; struct mfd_cell *cell = &lpc_ich_wdt_cell;
pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) if (!pdata)
...@@ -860,7 +854,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev) ...@@ -860,7 +854,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev)
static void lpc_ich_finalize_gpio_cell(struct pci_dev *dev) static void lpc_ich_finalize_gpio_cell(struct pci_dev *dev)
{ {
struct lpc_ich_priv *priv = pci_get_drvdata(dev); struct lpc_ich_priv *priv = pci_get_drvdata(dev);
struct mfd_cell *cell = &lpc_ich_cells[LPC_GPIO]; struct mfd_cell *cell = &lpc_ich_gpio_cell;
cell->platform_data = &lpc_chipset_info[priv->chipset]; cell->platform_data = &lpc_chipset_info[priv->chipset];
cell->pdata_size = sizeof(struct lpc_ich_info); cell->pdata_size = sizeof(struct lpc_ich_info);
...@@ -904,7 +898,7 @@ static int lpc_ich_init_gpio(struct pci_dev *dev) ...@@ -904,7 +898,7 @@ static int lpc_ich_init_gpio(struct pci_dev *dev)
base_addr = base_addr_cfg & 0x0000ff80; base_addr = base_addr_cfg & 0x0000ff80;
if (!base_addr) { if (!base_addr) {
dev_notice(&dev->dev, "I/O space for ACPI uninitialized\n"); dev_notice(&dev->dev, "I/O space for ACPI uninitialized\n");
lpc_ich_cells[LPC_GPIO].num_resources--; lpc_ich_gpio_cell.num_resources--;
goto gpe0_done; goto gpe0_done;
} }
...@@ -918,7 +912,7 @@ static int lpc_ich_init_gpio(struct pci_dev *dev) ...@@ -918,7 +912,7 @@ static int lpc_ich_init_gpio(struct pci_dev *dev)
* the platform_device subsystem doesn't see this resource * the platform_device subsystem doesn't see this resource
* or it will register an invalid region. * or it will register an invalid region.
*/ */
lpc_ich_cells[LPC_GPIO].num_resources--; lpc_ich_gpio_cell.num_resources--;
acpi_conflict = true; acpi_conflict = true;
} else { } else {
lpc_ich_enable_acpi_space(dev); lpc_ich_enable_acpi_space(dev);
...@@ -958,12 +952,12 @@ static int lpc_ich_init_gpio(struct pci_dev *dev) ...@@ -958,12 +952,12 @@ static int lpc_ich_init_gpio(struct pci_dev *dev)
lpc_ich_finalize_gpio_cell(dev); lpc_ich_finalize_gpio_cell(dev);
ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO, ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO,
&lpc_ich_cells[LPC_GPIO], 1, NULL, 0, NULL); &lpc_ich_gpio_cell, 1, NULL, 0, NULL);
gpio_done: gpio_done:
if (acpi_conflict) if (acpi_conflict)
pr_warn("Resource conflict(s) found affecting %s\n", pr_warn("Resource conflict(s) found affecting %s\n",
lpc_ich_cells[LPC_GPIO].name); lpc_ich_gpio_cell.name);
return ret; return ret;
} }
...@@ -1007,7 +1001,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev) ...@@ -1007,7 +1001,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
*/ */
if (lpc_chipset_info[priv->chipset].iTCO_version == 1) { if (lpc_chipset_info[priv->chipset].iTCO_version == 1) {
/* Don't register iomem for TCO ver 1 */ /* Don't register iomem for TCO ver 1 */
lpc_ich_cells[LPC_WDT].num_resources--; lpc_ich_wdt_cell.num_resources--;
} else if (lpc_chipset_info[priv->chipset].iTCO_version == 2) { } else if (lpc_chipset_info[priv->chipset].iTCO_version == 2) {
pci_read_config_dword(dev, RCBABASE, &base_addr_cfg); pci_read_config_dword(dev, RCBABASE, &base_addr_cfg);
base_addr = base_addr_cfg & 0xffffc000; base_addr = base_addr_cfg & 0xffffc000;
...@@ -1035,7 +1029,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev) ...@@ -1035,7 +1029,7 @@ static int lpc_ich_init_wdt(struct pci_dev *dev)
goto wdt_done; goto wdt_done;
ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO, ret = mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO,
&lpc_ich_cells[LPC_WDT], 1, NULL, 0, NULL); &lpc_ich_wdt_cell, 1, NULL, 0, NULL);
wdt_done: wdt_done:
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment