diff options
Diffstat (limited to 'drivers/mfd/mfd-core.c')
-rw-r--r-- | drivers/mfd/mfd-core.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 0454be4266c1..9c9c126ed334 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -15,24 +15,24 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/mfd/core.h> | 16 | #include <linux/mfd/core.h> |
17 | 17 | ||
18 | static int mfd_add_device(struct platform_device *parent, | 18 | static int mfd_add_device(struct device *parent, int id, |
19 | const struct mfd_cell *cell, | 19 | const struct mfd_cell *cell, |
20 | struct resource *mem_base, | 20 | struct resource *mem_base, |
21 | int irq_base) | 21 | int irq_base) |
22 | { | 22 | { |
23 | struct resource res[cell->num_resources]; | 23 | struct resource res[cell->num_resources]; |
24 | struct platform_device *pdev; | 24 | struct platform_device *pdev; |
25 | int ret = -ENOMEM; | 25 | int ret = -ENOMEM; |
26 | int r; | 26 | int r; |
27 | 27 | ||
28 | pdev = platform_device_alloc(cell->name, parent->id); | 28 | pdev = platform_device_alloc(cell->name, id); |
29 | if (!pdev) | 29 | if (!pdev) |
30 | goto fail_alloc; | 30 | goto fail_alloc; |
31 | 31 | ||
32 | pdev->dev.parent = &parent->dev; | 32 | pdev->dev.parent = parent; |
33 | 33 | ||
34 | ret = platform_device_add_data(pdev, | 34 | ret = platform_device_add_data(pdev, |
35 | cell, sizeof(struct mfd_cell)); | 35 | cell->platform_data, cell->data_size); |
36 | if (ret) | 36 | if (ret) |
37 | goto fail_device; | 37 | goto fail_device; |
38 | 38 | ||
@@ -75,17 +75,16 @@ fail_alloc: | |||
75 | return ret; | 75 | return ret; |
76 | } | 76 | } |
77 | 77 | ||
78 | int mfd_add_devices( | 78 | int mfd_add_devices(struct device *parent, int id, |
79 | struct platform_device *parent, | 79 | const struct mfd_cell *cells, int n_devs, |
80 | const struct mfd_cell *cells, int n_devs, | 80 | struct resource *mem_base, |
81 | struct resource *mem_base, | 81 | int irq_base) |
82 | int irq_base) | ||
83 | { | 82 | { |
84 | int i; | 83 | int i; |
85 | int ret = 0; | 84 | int ret = 0; |
86 | 85 | ||
87 | for (i = 0; i < n_devs; i++) { | 86 | for (i = 0; i < n_devs; i++) { |
88 | ret = mfd_add_device(parent, cells + i, mem_base, irq_base); | 87 | ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base); |
89 | if (ret) | 88 | if (ret) |
90 | break; | 89 | break; |
91 | } | 90 | } |
@@ -99,14 +98,13 @@ EXPORT_SYMBOL(mfd_add_devices); | |||
99 | 98 | ||
100 | static int mfd_remove_devices_fn(struct device *dev, void *unused) | 99 | static int mfd_remove_devices_fn(struct device *dev, void *unused) |
101 | { | 100 | { |
102 | platform_device_unregister( | 101 | platform_device_unregister(to_platform_device(dev)); |
103 | container_of(dev, struct platform_device, dev)); | ||
104 | return 0; | 102 | return 0; |
105 | } | 103 | } |
106 | 104 | ||
107 | void mfd_remove_devices(struct platform_device *parent) | 105 | void mfd_remove_devices(struct device *parent) |
108 | { | 106 | { |
109 | device_for_each_child(&parent->dev, NULL, mfd_remove_devices_fn); | 107 | device_for_each_child(parent, NULL, mfd_remove_devices_fn); |
110 | } | 108 | } |
111 | EXPORT_SYMBOL(mfd_remove_devices); | 109 | EXPORT_SYMBOL(mfd_remove_devices); |
112 | 110 | ||