mirror of https://gitee.com/openkylin/linux.git
mfd: Use mfd cell platform_data for mc13xxx cells platform bits
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 <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
9abd768a8d
commit
c8a03c96b6
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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 :-( */
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue