aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/cs5535-mfd.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2011-03-21 22:19:35 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-26 19:09:30 -0400
commitfa1df691688f34cbcd5bf77bd084bbe47e9d6bfe (patch)
tree83df18f1d427115c0016a059535b04f2d600a2d0 /drivers/mfd/cs5535-mfd.c
parent16c29dafcc86024048f1dbb8349d31cb22c7c55a (diff)
mfd: Add mfd_clone_cell(), convert cs5535-mfd/olpc-xo1 to it
Replace mfd_shared_platform_driver_register with mfd_clone_cell. The former was called by an mfd client, and registered both a platform driver and device. The latter is called by an mfd driver, and registers only a platform device. The downside of this is that mfd drivers need to be modified whenever new clients are added that share a cell; the upside is that it fits Linux's driver model better. It's also simpler. This also converts cs5535-mfd/olpc-xo1 from the old API. cs5535-mfd now creates the olpc-xo1-{acpi,pms} devices, while olpc-xo1 binds to them via platform drivers. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/cs5535-mfd.c')
-rw-r--r--drivers/mfd/cs5535-mfd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
index 886a06871065..24959ddd9324 100644
--- a/drivers/mfd/cs5535-mfd.c
+++ b/drivers/mfd/cs5535-mfd.c
@@ -27,6 +27,7 @@
27#include <linux/mfd/core.h> 27#include <linux/mfd/core.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <asm/olpc.h>
30 31
31#define DRV_NAME "cs5535-mfd" 32#define DRV_NAME "cs5535-mfd"
32 33
@@ -111,6 +112,22 @@ static __devinitdata struct mfd_cell cs5535_mfd_cells[] = {
111 }, 112 },
112}; 113};
113 114
115#ifdef CONFIG_OLPC
116static void __devinit cs5535_clone_olpc_cells(void)
117{
118 const char *acpi_clones[] = { "olpc-xo1-acpi" };
119 const char *pms_clones[] = { "olpc-xo1-pms" };
120
121 if (!machine_is_olpc())
122 return;
123
124 mfd_clone_cell("cs5535-acpi", acpi_clones, ARRAY_SIZE(acpi_clones));
125 mfd_clone_cell("cs5535-pms", pms_clones, ARRAY_SIZE(pms_clones));
126}
127#else
128static void cs5535_clone_olpc_cells(void) { }
129#endif
130
114static int __devinit cs5535_mfd_probe(struct pci_dev *pdev, 131static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
115 const struct pci_device_id *id) 132 const struct pci_device_id *id)
116{ 133{
@@ -139,6 +156,7 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
139 dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); 156 dev_err(&pdev->dev, "MFD add devices failed: %d\n", err);
140 goto err_disable; 157 goto err_disable;
141 } 158 }
159 cs5535_clone_olpc_cells();
142 160
143 dev_info(&pdev->dev, "%zu devices registered.\n", 161 dev_info(&pdev->dev, "%zu devices registered.\n",
144 ARRAY_SIZE(cs5535_mfd_cells)); 162 ARRAY_SIZE(cs5535_mfd_cells));