Skip to content

Commit

Permalink
mfd: core: Fix platform-device id generation
Browse files Browse the repository at this point in the history
Make sure to always honour multi-function devices registered with
PLATFORM_DEVID_NONE (-1) or PLATFORM_DEVID_AUTO (-2) as id base. In this
case it does not make sense to append the cell id to the mfd-id base and
potentially change the requested behaviour.

Specifically this will allow multi-function devices to be registered
with PLATFORM_DEVID_AUTO while still having non-zero cell ids.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
jhovold authored and Lee Jones committed Nov 25, 2014
1 parent 16b5fe2 commit 6e3f62f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/mfd/mfd-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ static int mfd_add_device(struct device *parent, int id,
struct platform_device *pdev;
struct device_node *np = NULL;
int ret = -ENOMEM;
int platform_id;
int r;

pdev = platform_device_alloc(cell->name, id + cell->id);
if (id < 0)
platform_id = id;
else
platform_id = id + cell->id;

pdev = platform_device_alloc(cell->name, platform_id);
if (!pdev)
goto fail_alloc;

Expand Down

0 comments on commit 6e3f62f

Please sign in to comment.