pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 10 Sep 2014 21:55:55 +0000 (00:55 +0300)
committerSimon Horman <horms+renesas@verge.net.au>
Fri, 5 Dec 2014 01:10:45 +0000 (10:10 +0900)
The SoC data structure allocated at init time only holds a regulator
pointer that is only used in the init function. Replace it with a local
variable and get rid of the SoC data structure allocation altogether.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 0a332c96c29c84cd9205c29dfa1add4667456059)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/pinctrl/sh-pfc/core.c
drivers/pinctrl/sh-pfc/core.h
drivers/pinctrl/sh-pfc/pfc-sh73a0.c
drivers/pinctrl/sh-pfc/sh_pfc.h

index b9b464d..6572c23 100644 (file)
@@ -542,7 +542,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
         */
        ret = sh_pfc_register_pinctrl(pfc);
        if (unlikely(ret != 0))
-               goto error;
+               return ret;
 
 #ifdef CONFIG_GPIO_SH_PFC
        /*
@@ -564,11 +564,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
        dev_info(pfc->dev, "%s support registered\n", info->name);
 
        return 0;
-
-error:
-       if (info->ops && info->ops->exit)
-               info->ops->exit(pfc);
-       return ret;
 }
 
 static int sh_pfc_remove(struct platform_device *pdev)
@@ -580,9 +575,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
 #endif
        sh_pfc_unregister_pinctrl(pfc);
 
-       if (pfc->info->ops && pfc->info->ops->exit)
-               pfc->info->ops->exit(pfc);
-
        return 0;
 }
 
index b7b0e6c..3daaa52 100644 (file)
@@ -33,7 +33,6 @@ struct sh_pfc_pin_range {
 struct sh_pfc {
        struct device *dev;
        const struct sh_pfc_soc_info *info;
-       void *soc_data;
        spinlock_t lock;
 
        unsigned int num_windows;
index 2dd8fd5..d2efbfb 100644 (file)
@@ -3824,35 +3824,24 @@ static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
  * SoC information
  */
 
-struct sh73a0_pinmux_data {
-       struct regulator_dev *vccq_mc0;
-};
-
 static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
 {
-       struct sh73a0_pinmux_data *data;
        struct regulator_config cfg = { };
+       struct regulator_dev *vccq;
        int ret;
 
-       data = devm_kzalloc(pfc->dev, sizeof(*data), GFP_KERNEL);
-       if (data == NULL)
-               return -ENOMEM;
-
        cfg.dev = pfc->dev;
        cfg.init_data = &sh73a0_vccq_mc0_init_data;
        cfg.driver_data = pfc;
 
-       data->vccq_mc0 = devm_regulator_register(pfc->dev,
-                                                &sh73a0_vccq_mc0_desc, &cfg);
-       if (IS_ERR(data->vccq_mc0)) {
-               ret = PTR_ERR(data->vccq_mc0);
+       vccq = devm_regulator_register(pfc->dev, &sh73a0_vccq_mc0_desc, &cfg);
+       if (IS_ERR(vccq)) {
+               ret = PTR_ERR(vccq);
                dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n",
                        ret);
                return ret;
        }
 
-       pfc->soc_data = data;
-
        return 0;
 }
 
index d482c40..5b72831 100644 (file)
@@ -116,7 +116,6 @@ struct sh_pfc;
 
 struct sh_pfc_soc_operations {
        int (*init)(struct sh_pfc *pfc);
-       void (*exit)(struct sh_pfc *pfc);
        unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
        void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
                         unsigned int bias);