aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-07-28 19:30:26 -0400
committerSamuel Ortiz <sameo@openedhand.com>2008-07-28 19:30:26 -0400
commit424f525a1241351da947fb48a938128ddd774511 (patch)
treee837c0f6b15a3efe38bb0aa3db5a46305e5a9f38 /drivers
parent56edb58be157a06dc147a988af3588059556d392 (diff)
mfd: accept pure device as a parent, not only platform_device
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/mfd-core.c14
-rw-r--r--drivers/mfd/tc6393xb.c4
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index ad4e4d16a36a..9c9c126ed334 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -15,7 +15,7 @@
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
18static int mfd_add_device(struct platform_device *parent, 18static 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)
@@ -25,11 +25,11 @@ static int mfd_add_device(struct platform_device *parent,
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->platform_data, cell->data_size); 35 cell->platform_data, cell->data_size);
@@ -75,7 +75,7 @@ fail_alloc:
75 return ret; 75 return ret;
76} 76}
77 77
78int mfd_add_devices(struct platform_device *parent, 78int mfd_add_devices(struct device *parent, int id,
79 const struct mfd_cell *cells, int n_devs, 79 const struct mfd_cell *cells, int n_devs,
80 struct resource *mem_base, 80 struct resource *mem_base,
81 int irq_base) 81 int irq_base)
@@ -84,7 +84,7 @@ int mfd_add_devices(struct platform_device *parent,
84 int ret = 0; 84 int ret = 0;
85 85
86 for (i = 0; i < n_devs; i++) { 86 for (i = 0; i < n_devs; i++) {
87 ret = mfd_add_device(parent, cells + i, mem_base, irq_base); 87 ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base);
88 if (ret) 88 if (ret)
89 break; 89 break;
90 } 90 }
@@ -102,9 +102,9 @@ static int mfd_remove_devices_fn(struct device *dev, void *unused)
102 return 0; 102 return 0;
103} 103}
104 104
105void mfd_remove_devices(struct platform_device *parent) 105void mfd_remove_devices(struct device *parent)
106{ 106{
107 device_for_each_child(&parent->dev, NULL, mfd_remove_devices_fn); 107 device_for_each_child(parent, NULL, mfd_remove_devices_fn);
108} 108}
109EXPORT_SYMBOL(mfd_remove_devices); 109EXPORT_SYMBOL(mfd_remove_devices);
110 110
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 9908aaa4881a..f4fd797c1590 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -471,7 +471,7 @@ static int __devinit tc6393xb_probe(struct platform_device *dev)
471 tc6393xb_cells[TC6393XB_CELL_NAND].data_size = 471 tc6393xb_cells[TC6393XB_CELL_NAND].data_size =
472 sizeof(tc6393xb_cells[TC6393XB_CELL_NAND]); 472 sizeof(tc6393xb_cells[TC6393XB_CELL_NAND]);
473 473
474 retval = mfd_add_devices(dev, 474 retval = mfd_add_devices(&dev->dev, dev->id,
475 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), 475 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
476 iomem, tcpd->irq_base); 476 iomem, tcpd->irq_base);
477 477
@@ -505,7 +505,7 @@ static int __devexit tc6393xb_remove(struct platform_device *dev)
505 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); 505 struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
506 int ret; 506 int ret;
507 507
508 mfd_remove_devices(dev); 508 mfd_remove_devices(&dev->dev);
509 509
510 if (tc6393xb->irq) 510 if (tc6393xb->irq)
511 tc6393xb_detach_irq(dev); 511 tc6393xb_detach_irq(dev);