aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2008-07-28 19:23:32 -0400
committerSamuel Ortiz <sameo@openedhand.com>2008-07-28 19:23:32 -0400
commit56edb58be157a06dc147a988af3588059556d392 (patch)
tree3771389d15ef26bf40ac19f8abd0d39454dc6db6
parent7f71ac9374fec066e428892a68db158946cee1fb (diff)
mfd: add platform_data to mfd_cell
Adding platform_data to mfd_cell allows passing of platform data directly to the platform_device created for each cell and thus reuse of existing drivers. On the other side it can be used as a hook to mfd_cell itself removing the need in mfd_get_cell method. Signed-off-by: Mike Rapoport <mike@compulab.co.il> Acked-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
-rw-r--r--drivers/mfd/mfd-core.c2
-rw-r--r--drivers/mfd/tc6393xb.c4
-rw-r--r--include/linux/mfd/core.h13
3 files changed, 12 insertions, 7 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 50207700140c..ad4e4d16a36a 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -32,7 +32,7 @@ static int mfd_add_device(struct platform_device *parent,
32 pdev->dev.parent = &parent->dev; 32 pdev->dev.parent = &parent->dev;
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
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 94e55e8e7ce6..9908aaa4881a 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -466,6 +466,10 @@ static int __devinit tc6393xb_probe(struct platform_device *dev)
466 tc6393xb_attach_irq(dev); 466 tc6393xb_attach_irq(dev);
467 467
468 tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; 468 tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data;
469 tc6393xb_cells[TC6393XB_CELL_NAND].platform_data =
470 &tc6393xb_cells[TC6393XB_CELL_NAND];
471 tc6393xb_cells[TC6393XB_CELL_NAND].data_size =
472 sizeof(tc6393xb_cells[TC6393XB_CELL_NAND]);
469 473
470 retval = mfd_add_devices(dev, 474 retval = mfd_add_devices(dev,
471 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), 475 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index b7cbb9968339..ea45d4a5a2ac 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -29,7 +29,13 @@ struct mfd_cell {
29 int (*suspend)(struct platform_device *dev); 29 int (*suspend)(struct platform_device *dev);
30 int (*resume)(struct platform_device *dev); 30 int (*resume)(struct platform_device *dev);
31 31
32 void *driver_data; /* driver-specific data */ 32 /* driver-specific data for MFD-aware "cell" drivers */
33 void *driver_data;
34
35 /* platform_data can be used to either pass data to "generic"
36 driver or as a hook to mfd_cell for the "cell" drivers */
37 void *platform_data;
38 size_t data_size;
33 39
34 /* 40 /*
35 * This resources can be specified relatievly to the parent device. 41 * This resources can be specified relatievly to the parent device.
@@ -39,11 +45,6 @@ struct mfd_cell {
39 const struct resource *resources; 45 const struct resource *resources;
40}; 46};
41 47
42static inline struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
43{
44 return (struct mfd_cell *)pdev->dev.platform_data;
45}
46
47extern int mfd_add_devices(struct platform_device *parent, 48extern int mfd_add_devices(struct platform_device *parent,
48 const struct mfd_cell *cells, int n_devs, 49 const struct mfd_cell *cells, int n_devs,
49 struct resource *mem_base, 50 struct resource *mem_base,