Skip to content

Commit b944a68

Browse files
author
Lee Jones
committed
mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device()
Most of the complexity of mfd_platform_add_cell() has been removed. The only functionality left duplicates cell memory into the child's platform device. Since it's only a few lines, moving it to the main thread and removing the superfluous function makes sense. Signed-off-by: Lee Jones <[email protected]> Reviewed-by: Daniel Thompson <[email protected]> Reviewed-by: Mark Brown <[email protected]>
1 parent 5a47c0f commit b944a68

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

drivers/mfd/mfd-core.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ int mfd_cell_disable(struct platform_device *pdev)
4949
}
5050
EXPORT_SYMBOL(mfd_cell_disable);
5151

52-
static int mfd_platform_add_cell(struct platform_device *pdev,
53-
const struct mfd_cell *cell)
54-
{
55-
if (!cell)
56-
return 0;
57-
58-
pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL);
59-
if (!pdev->mfd_cell)
60-
return -ENOMEM;
61-
62-
return 0;
63-
}
64-
6552
#if IS_ENABLED(CONFIG_ACPI)
6653
static void mfd_acpi_add_device(const struct mfd_cell *cell,
6754
struct platform_device *pdev)
@@ -141,6 +128,10 @@ static int mfd_add_device(struct device *parent, int id,
141128
if (!pdev)
142129
goto fail_alloc;
143130

131+
pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL);
132+
if (!pdev->mfd_cell)
133+
goto fail_device;
134+
144135
res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);
145136
if (!res)
146137
goto fail_device;
@@ -183,10 +174,6 @@ static int mfd_add_device(struct device *parent, int id,
183174
goto fail_alias;
184175
}
185176

186-
ret = mfd_platform_add_cell(pdev, cell);
187-
if (ret)
188-
goto fail_alias;
189-
190177
for (r = 0; r < cell->num_resources; r++) {
191178
res[r].name = cell->resources[r].name;
192179
res[r].flags = cell->resources[r].flags;

0 commit comments

Comments
 (0)