Skip to content

Commit

Permalink
mfd: Use mfd cell platform_data for mc13xxx cells platform bits
Browse files Browse the repository at this point in the history
With the addition of a platform device mfd_cell pointer, MFD drivers
can go back to passing platform data back to their sub drivers.
This allows for an mfd_cell->mfd_data removal and thus keep the
sub drivers MFD agnostic. This is mostly needed for non MFD aware
sub drivers.

Cc: Mark Brown <[email protected]>
Cc: Liam Girdwood <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Samuel Ortiz committed May 26, 2011
1 parent 9abd768 commit c8a03c9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
7 changes: 3 additions & 4 deletions drivers/leds/leds-mc13783.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/leds.h>
#include <linux/workqueue.h>
#include <linux/mfd/mc13783.h>
#include <linux/mfd/core.h>
#include <linux/slab.h>

struct mc13783_led {
Expand Down Expand Up @@ -184,7 +183,7 @@ static int __devinit mc13783_led_setup(struct mc13783_led *led, int max_current)

static int __devinit mc13783_leds_prepare(struct platform_device *pdev)
{
struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev);
struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent);
int ret = 0;
int reg = 0;
Expand Down Expand Up @@ -265,7 +264,7 @@ static int __devinit mc13783_leds_prepare(struct platform_device *pdev)

static int __devinit mc13783_led_probe(struct platform_device *pdev)
{
struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev);
struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct mc13783_led_platform_data *led_cur;
struct mc13783_led *led, *led_dat;
int ret, i;
Expand Down Expand Up @@ -352,7 +351,7 @@ static int __devinit mc13783_led_probe(struct platform_device *pdev)

static int __devexit mc13783_led_remove(struct platform_device *pdev)
{
struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev);
struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct mc13783_led *led = platform_get_drvdata(pdev);
struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent);
int i;
Expand Down
12 changes: 7 additions & 5 deletions drivers/mfd/mc13xxx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,14 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion);

static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
const char *format, void *pdata)
const char *format, void *pdata, size_t pdata_size)
{
char buf[30];
const char *name = mc13xxx_get_chipname(mc13xxx);

struct mfd_cell cell = {
.mfd_data = pdata,
.platform_data = pdata,
.pdata_size = pdata_size,
};

/* there is no asnprintf in the kernel :-( */
Expand All @@ -705,7 +706,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,

static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format)
{
return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL);
return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL, 0);
}

static int mc13xxx_probe(struct spi_device *spi)
Expand Down Expand Up @@ -764,7 +765,7 @@ static int mc13xxx_probe(struct spi_device *spi)

if (pdata->flags & MC13XXX_USE_REGULATOR) {
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
&pdata->regulators);
&pdata->regulators, sizeof(pdata->regulators));
}

if (pdata->flags & MC13XXX_USE_RTC)
Expand All @@ -774,7 +775,8 @@ static int mc13xxx_probe(struct spi_device *spi)
mc13xxx_add_subdevice(mc13xxx, "%s-ts");

if (pdata->flags & MC13XXX_USE_LED)
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led", pdata->leds);
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
pdata->leds, sizeof(*pdata->leds));

return 0;
}
Expand Down
7 changes: 4 additions & 3 deletions drivers/regulator/mc13783-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/regulator/driver.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/err.h>
Expand Down Expand Up @@ -337,7 +336,8 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
{
struct mc13xxx_regulator_priv *priv;
struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev);
struct mc13783_regulator_platform_data *pdata =
dev_get_platdata(&pdev->dev);
struct mc13783_regulator_init_data *init_data;
int i, ret;

Expand Down Expand Up @@ -381,7 +381,8 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
{
struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev);
struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev);
struct mc13783_regulator_platform_data *pdata =
dev_get_platdata(&pdev->dev);
int i;

platform_set_drvdata(pdev, NULL);
Expand Down
7 changes: 4 additions & 3 deletions drivers/regulator/mc13892-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/regulator/driver.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/err.h>
Expand Down Expand Up @@ -521,7 +520,8 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
{
struct mc13xxx_regulator_priv *priv;
struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent);
struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev);
struct mc13xxx_regulator_platform_data *pdata =
dev_get_platdata(&pdev->dev);
struct mc13xxx_regulator_init_data *init_data;
int i, ret;
u32 val;
Expand Down Expand Up @@ -595,7 +595,8 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
static int __devexit mc13892_regulator_remove(struct platform_device *pdev)
{
struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev);
struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev);
struct mc13xxx_regulator_platform_data *pdata =
dev_get_platdata(&pdev->dev);
int i;

platform_set_drvdata(pdev, NULL);
Expand Down

0 comments on commit c8a03c9

Please sign in to comment.