aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-09-10 17:55:55 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-23 11:11:22 -0400
commit0a332c96c29c84cd9205c29dfa1add4667456059 (patch)
tree165f8a7a8e4ce52a5af28cab0624e48401c3cb32 /drivers/pinctrl
parent6064b1474ef3cfa523916008b5176026bbc990d3 (diff)
pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
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>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/sh-pfc/core.c10
-rw-r--r--drivers/pinctrl/sh-pfc/core.h1
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh73a0.c19
-rw-r--r--drivers/pinctrl/sh-pfc/sh_pfc.h1
4 files changed, 5 insertions, 26 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index b9b464d0578c..6572c233f73d 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -542,7 +542,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
542 */ 542 */
543 ret = sh_pfc_register_pinctrl(pfc); 543 ret = sh_pfc_register_pinctrl(pfc);
544 if (unlikely(ret != 0)) 544 if (unlikely(ret != 0))
545 goto error; 545 return ret;
546 546
547#ifdef CONFIG_GPIO_SH_PFC 547#ifdef CONFIG_GPIO_SH_PFC
548 /* 548 /*
@@ -564,11 +564,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
564 dev_info(pfc->dev, "%s support registered\n", info->name); 564 dev_info(pfc->dev, "%s support registered\n", info->name);
565 565
566 return 0; 566 return 0;
567
568error:
569 if (info->ops && info->ops->exit)
570 info->ops->exit(pfc);
571 return ret;
572} 567}
573 568
574static int sh_pfc_remove(struct platform_device *pdev) 569static int sh_pfc_remove(struct platform_device *pdev)
@@ -580,9 +575,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
580#endif 575#endif
581 sh_pfc_unregister_pinctrl(pfc); 576 sh_pfc_unregister_pinctrl(pfc);
582 577
583 if (pfc->info->ops && pfc->info->ops->exit)
584 pfc->info->ops->exit(pfc);
585
586 return 0; 578 return 0;
587} 579}
588 580
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index b7b0e6ccf305..3daaa5241c47 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -33,7 +33,6 @@ struct sh_pfc_pin_range {
33struct sh_pfc { 33struct sh_pfc {
34 struct device *dev; 34 struct device *dev;
35 const struct sh_pfc_soc_info *info; 35 const struct sh_pfc_soc_info *info;
36 void *soc_data;
37 spinlock_t lock; 36 spinlock_t lock;
38 37
39 unsigned int num_windows; 38 unsigned int num_windows;
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
index 2dd8fd524a80..d2efbfb776ac 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
@@ -3824,35 +3824,24 @@ static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
3824 * SoC information 3824 * SoC information
3825 */ 3825 */
3826 3826
3827struct sh73a0_pinmux_data {
3828 struct regulator_dev *vccq_mc0;
3829};
3830
3831static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc) 3827static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
3832{ 3828{
3833 struct sh73a0_pinmux_data *data;
3834 struct regulator_config cfg = { }; 3829 struct regulator_config cfg = { };
3830 struct regulator_dev *vccq;
3835 int ret; 3831 int ret;
3836 3832
3837 data = devm_kzalloc(pfc->dev, sizeof(*data), GFP_KERNEL);
3838 if (data == NULL)
3839 return -ENOMEM;
3840
3841 cfg.dev = pfc->dev; 3833 cfg.dev = pfc->dev;
3842 cfg.init_data = &sh73a0_vccq_mc0_init_data; 3834 cfg.init_data = &sh73a0_vccq_mc0_init_data;
3843 cfg.driver_data = pfc; 3835 cfg.driver_data = pfc;
3844 3836
3845 data->vccq_mc0 = devm_regulator_register(pfc->dev, 3837 vccq = devm_regulator_register(pfc->dev, &sh73a0_vccq_mc0_desc, &cfg);
3846 &sh73a0_vccq_mc0_desc, &cfg); 3838 if (IS_ERR(vccq)) {
3847 if (IS_ERR(data->vccq_mc0)) { 3839 ret = PTR_ERR(vccq);
3848 ret = PTR_ERR(data->vccq_mc0);
3849 dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n", 3840 dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n",
3850 ret); 3841 ret);
3851 return ret; 3842 return ret;
3852 } 3843 }
3853 3844
3854 pfc->soc_data = data;
3855
3856 return 0; 3845 return 0;
3857} 3846}
3858 3847
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index d482c40b012a..5b7283182c1e 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -116,7 +116,6 @@ struct sh_pfc;
116 116
117struct sh_pfc_soc_operations { 117struct sh_pfc_soc_operations {
118 int (*init)(struct sh_pfc *pfc); 118 int (*init)(struct sh_pfc *pfc);
119 void (*exit)(struct sh_pfc *pfc);
120 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin); 119 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
121 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin, 120 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
122 unsigned int bias); 121 unsigned int bias);