Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / mfd / wm8994-core.c
index be1a424..57c488d 100644 (file)
@@ -374,21 +374,21 @@ static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo)
 }
 #endif
 
-static const __devinitconst struct reg_default wm8994_revc_patch[] = {
+static const struct reg_default wm8994_revc_patch[] = {
        { 0x102, 0x3 },
        { 0x56, 0x3 },
        { 0x817, 0x0 },
        { 0x102, 0x0 },
 };
 
-static const __devinitconst struct reg_default wm8958_reva_patch[] = {
+static const struct reg_default wm8958_reva_patch[] = {
        { 0x102, 0x3 },
        { 0xcb, 0x81 },
        { 0x817, 0x0 },
        { 0x102, 0x0 },
 };
 
-static const __devinitconst struct reg_default wm1811_reva_patch[] = {
+static const struct reg_default wm1811_reva_patch[] = {
        { 0x102, 0x3 },
        { 0x56, 0xc07 },
        { 0x5d, 0x7e },
@@ -399,15 +399,21 @@ static const __devinitconst struct reg_default wm1811_reva_patch[] = {
 /*
  * Instantiate the generic non-control parts of the device.
  */
-static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)
+static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 {
-       struct wm8994_pdata *pdata = wm8994->dev->platform_data;
+       struct wm8994_pdata *pdata;
        struct regmap_config *regmap_config;
        const struct reg_default *regmap_patch = NULL;
        const char *devname;
        int ret, i, patch_regs;
        int pulls = 0;
 
+       if (dev_get_platdata(wm8994->dev)) {
+               pdata = dev_get_platdata(wm8994->dev);
+               wm8994->pdata = *pdata;
+       }
+       pdata = &wm8994->pdata;
+
        dev_set_drvdata(wm8994->dev, wm8994);
 
        /* Add the on-chip regulators first for bootstrapping */
@@ -595,24 +601,21 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)
                }
        }
 
-       if (pdata) {
-               wm8994->irq_base = pdata->irq_base;
-               wm8994->gpio_base = pdata->gpio_base;
-
-               /* GPIO configuration is only applied if it's non-zero */
-               for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) {
-                       if (pdata->gpio_defaults[i]) {
-                               wm8994_set_bits(wm8994, WM8994_GPIO_1 + i,
-                                               0xffff,
-                                               pdata->gpio_defaults[i]);
-                       }
+       wm8994->irq_base = pdata->irq_base;
+       wm8994->gpio_base = pdata->gpio_base;
+
+       /* GPIO configuration is only applied if it's non-zero */
+       for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) {
+               if (pdata->gpio_defaults[i]) {
+                       wm8994_set_bits(wm8994, WM8994_GPIO_1 + i,
+                                       0xffff, pdata->gpio_defaults[i]);
                }
+       }
 
-               wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven;
+       wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven;
 
-               if (pdata->spkmode_pu)
-                       pulls |= WM8994_SPKMODE_PU;
-       }
+       if (pdata->spkmode_pu)
+               pulls |= WM8994_SPKMODE_PU;
 
        /* Disable unneeded pulls */
        wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
@@ -662,7 +665,7 @@ err:
        return ret;
 }
 
-static __devexit void wm8994_device_exit(struct wm8994 *wm8994)
+static void wm8994_device_exit(struct wm8994 *wm8994)
 {
        pm_runtime_disable(wm8994->dev);
        mfd_remove_devices(wm8994->dev);
@@ -680,7 +683,7 @@ static const struct of_device_id wm8994_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, wm8994_of_match);
 
-static __devinit int wm8994_i2c_probe(struct i2c_client *i2c,
+static int wm8994_i2c_probe(struct i2c_client *i2c,
                                      const struct i2c_device_id *id)
 {
        struct wm8994 *wm8994;
@@ -706,7 +709,7 @@ static __devinit int wm8994_i2c_probe(struct i2c_client *i2c,
        return wm8994_device_init(wm8994, i2c->irq);
 }
 
-static __devexit int wm8994_i2c_remove(struct i2c_client *i2c)
+static int wm8994_i2c_remove(struct i2c_client *i2c)
 {
        struct wm8994 *wm8994 = i2c_get_clientdata(i2c);
 
@@ -735,7 +738,7 @@ static struct i2c_driver wm8994_i2c_driver = {
                .of_match_table = wm8994_of_match,
        },
        .probe = wm8994_i2c_probe,
-       .remove = __devexit_p(wm8994_i2c_remove),
+       .remove = wm8994_i2c_remove,
        .id_table = wm8994_i2c_id,
 };