All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
@ 2014-09-10 21:55 Laurent Pinchart
  2014-09-11  7:12 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Pinchart @ 2014-09-10 21:55 UTC (permalink / raw)
  To: linux-sh

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>
---
 drivers/pinctrl/sh-pfc/core.c       | 10 +---------
 drivers/pinctrl/sh-pfc/core.h       |  1 -
 drivers/pinctrl/sh-pfc/pfc-sh73a0.c | 19 ++++---------------
 drivers/pinctrl/sh-pfc/sh_pfc.h     |  1 -
 4 files changed, 5 insertions(+), 26 deletions(-)

Changes since v1:

- Remove the unused sh_pfc soc_data field and sh_pfc_soc_operations exit
  field.

diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index ded027a..2e3fe0b 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -548,7 +548,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
 	/*
@@ -570,11 +570,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)
@@ -586,9 +581,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;
 }
 
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index 55f2323..69e1047 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -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;
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
index 0bd8f44..43d7673 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,
  * 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;
 }
 
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 1eac070..126009d 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -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);
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
  2014-09-10 21:55 [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
@ 2014-09-11  7:12 ` Geert Uytterhoeven
  2014-09-13 20:45 ` Laurent Pinchart
  2014-09-23 15:12 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2014-09-11  7:12 UTC (permalink / raw)
  To: linux-sh

On Wed, Sep 10, 2014 at 11:55 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> 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>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
  2014-09-10 21:55 [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
  2014-09-11  7:12 ` Geert Uytterhoeven
@ 2014-09-13 20:45 ` Laurent Pinchart
  2014-09-23 15:12 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2014-09-13 20:45 UTC (permalink / raw)
  To: linux-sh

On Thursday 11 September 2014 09:12:22 Geert Uytterhoeven wrote:
> On Wed, Sep 10, 2014 at 11:55 PM, Laurent Pinchart wrote:
> > 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>

Thank you. Linus, could you please pick this up for v3.18 ?

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
  2014-09-10 21:55 [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
  2014-09-11  7:12 ` Geert Uytterhoeven
  2014-09-13 20:45 ` Laurent Pinchart
@ 2014-09-23 15:12 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2014-09-23 15:12 UTC (permalink / raw)
  To: linux-sh

On Wed, Sep 10, 2014 at 11:55 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:

> 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>

Patch applied with Geert's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-23 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10 21:55 [PATCH v2] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
2014-09-11  7:12 ` Geert Uytterhoeven
2014-09-13 20:45 ` Laurent Pinchart
2014-09-23 15:12 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.