aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2014-09-26 06:55:33 -0400
committerLee Jones <lee.jones@linaro.org>2014-11-25 11:18:43 -0500
commit6e3f62f0793ebff3f91076490ff0fbb107939701 (patch)
tree403503551f4c2d3546858109201aa09172a2f777 /drivers/mfd
parent16b5fe2966b8dc4a474d6618d382d26933d90b24 (diff)
mfd: core: Fix platform-device id generation
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/mfd-core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index f3338fe9d069..2a87f69be53d 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -125,9 +125,15 @@ static int mfd_add_device(struct device *parent, int id,
125 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct device_node *np = NULL; 126 struct device_node *np = NULL;
127 int ret = -ENOMEM; 127 int ret = -ENOMEM;
128 int platform_id;
128 int r; 129 int r;
129 130
130 pdev = platform_device_alloc(cell->name, id + cell->id); 131 if (id < 0)
132 platform_id = id;
133 else
134 platform_id = id + cell->id;
135
136 pdev = platform_device_alloc(cell->name, platform_id);
131 if (!pdev) 137 if (!pdev)
132 goto fail_alloc; 138 goto fail_alloc;
133 139