linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
@ 2014-09-10 13:33 Laurent Pinchart
  2014-09-10 15:25 ` Geert Uytterhoeven
  2014-09-10 21:56 ` Laurent Pinchart
  0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2014-09-10 13:33 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/pfc-sh73a0.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

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;
 }
 
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
  2014-09-10 13:33 [PATCH] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
@ 2014-09-10 15:25 ` Geert Uytterhoeven
  2014-09-10 21:56 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2014-09-10 15:25 UTC (permalink / raw)
  To: linux-sh

Hi Laurent,

On Wed, Sep 10, 2014 at 3:33 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>

> --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c

> -       pfc->soc_data = data;

Now soc_data is also unused, so it can be removed from struct sh_pfc.
Likewise for sh_pfc_soc_operations.exit(), which only used to exist for
freeing the data associated with soc_data.

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] 3+ messages in thread

* Re: [PATCH] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation
  2014-09-10 13:33 [PATCH] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
  2014-09-10 15:25 ` Geert Uytterhoeven
@ 2014-09-10 21:56 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2014-09-10 21:56 UTC (permalink / raw)
  To: linux-sh

Hi Geert,

On Wednesday 10 September 2014 17:25:24 Geert Uytterhoeven wrote:
> On Wed, Sep 10, 2014 at 3:33 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>
> 
> > --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> > +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
> > 
> > -       pfc->soc_data = data;
> 
> Now soc_data is also unused, so it can be removed from struct sh_pfc.
> Likewise for sh_pfc_soc_operations.exit(), which only used to exist for
> freeing the data associated with soc_data.

Indeed, good point. I've submitted a v2.

-- 
Regards,

Laurent Pinchart


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

end of thread, other threads:[~2014-09-10 21:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 13:33 [PATCH] pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation Laurent Pinchart
2014-09-10 15:25 ` Geert Uytterhoeven
2014-09-10 21:56 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).