Skip to content

Commit 2129e56

Browse files
author
Lee Jones
committed
mfd: cs5535-mfd: Remove mfd_cell->id hack
The current implementation abuses the platform 'id' mfd_cell member to index into the correct resources entry. Seeing as enough resource slots are already available, let's just loop through all available bars and allocate them to their appropriate slot, even if they happen to be zero. Signed-off-by: Lee Jones <[email protected]> Reviewed-by: Daniel Thompson <[email protected]>
1 parent 601e428 commit 2129e56

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

drivers/mfd/cs5535-mfd.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,21 @@ static struct resource cs5535_mfd_resources[NR_BARS];
6363

6464
static struct mfd_cell cs5535_mfd_cells[] = {
6565
{
66-
.id = SMB_BAR,
6766
.name = "cs5535-smb",
6867
.num_resources = 1,
6968
.resources = &cs5535_mfd_resources[SMB_BAR],
7069
},
7170
{
72-
.id = GPIO_BAR,
7371
.name = "cs5535-gpio",
7472
.num_resources = 1,
7573
.resources = &cs5535_mfd_resources[GPIO_BAR],
7674
},
7775
{
78-
.id = MFGPT_BAR,
7976
.name = "cs5535-mfgpt",
8077
.num_resources = 1,
8178
.resources = &cs5535_mfd_resources[MFGPT_BAR],
8279
},
8380
{
84-
.id = PMS_BAR,
8581
.name = "cs5535-pms",
8682
.num_resources = 1,
8783
.resources = &cs5535_mfd_resources[PMS_BAR],
@@ -90,7 +86,6 @@ static struct mfd_cell cs5535_mfd_cells[] = {
9086
.disable = cs5535_mfd_res_disable,
9187
},
9288
{
93-
.id = ACPI_BAR,
9489
.name = "cs5535-acpi",
9590
.num_resources = 1,
9691
.resources = &cs5535_mfd_resources[ACPI_BAR],
@@ -108,23 +103,18 @@ static const char *olpc_acpi_clones[] = {
108103
static int cs5535_mfd_probe(struct pci_dev *pdev,
109104
const struct pci_device_id *id)
110105
{
111-
int err, i;
106+
int err, bar;
112107

113108
err = pci_enable_device(pdev);
114109
if (err)
115110
return err;
116111

117-
/* fill in IO range for each cell; subdrivers handle the region */
118-
for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) {
119-
int bar = cs5535_mfd_cells[i].id;
112+
for (bar = 0; bar < NR_BARS; bar++) {
120113
struct resource *r = &cs5535_mfd_resources[bar];
121114

122115
r->flags = IORESOURCE_IO;
123116
r->start = pci_resource_start(pdev, bar);
124117
r->end = pci_resource_end(pdev, bar);
125-
126-
/* id is used for temporarily storing BAR; unset it now */
127-
cs5535_mfd_cells[i].id = 0;
128118
}
129119

130120
err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, cs5535_mfd_cells,

0 commit comments

Comments
 (0)