All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: sh-pfc: Print correct pinmux info name
@ 2017-03-18 20:52 Eugeniu Rosca
  2017-03-19 14:02 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Eugeniu Rosca @ 2017-03-18 20:52 UTC (permalink / raw)
  To: laurent.pinchart, geert+renesas, linus.walleij, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 0001-pinctrl-sh-pfc-Print-correct-pinmux-info-name.patch --]
[-- Type: text/x-diff, Size: 1410 bytes --]

>From cce7953dac965d620bb4fe5a456cffe40793f39b Mon Sep 17 00:00:00 2001
From: Eugeniu Rosca <erosca@de.adit-jv.com>
Date: Tue, 28 Feb 2017 13:38:36 +0100
Subject: [PATCH] pinctrl: sh-pfc: Print correct pinmux info name

commit 0c151062f32c ("sh-pfc: Add support for SoC-specific
initialization") allows defining SoC specific init functions.
Such custom functions can register new pinmux info structures.
Here is an example:

static int my_pinmux_init(struct sh_pfc *pfc)
{
    if (my_criteria())
        pfc->info = &new_pinmux_info;
}

A side effect of the pfc->info update in the above example is that
the `const struct sh_pfc_soc_info *info` pointer used in the probe
routine becomes outdated. One consequence of it is printing the wrong
pinmux info structure name at the end of `sh_pfc_probe()`. Fix this.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
---
 drivers/pinctrl/sh-pfc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 6399eb1feb12..37fc70fb8e4d 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -703,7 +703,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pfc);
 
-	dev_info(pfc->dev, "%s support registered\n", info->name);
+	dev_info(pfc->dev, "%s support registered\n", pfc->info->name);
 
 	return 0;
 }
-- 
2.12.0


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

* Re: [PATCH] pinctrl: sh-pfc: Print correct pinmux info name
  2017-03-18 20:52 [PATCH] pinctrl: sh-pfc: Print correct pinmux info name Eugeniu Rosca
@ 2017-03-19 14:02 ` Geert Uytterhoeven
  2017-03-19 16:20   ` Eugeniu Rosca
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2017-03-19 14:02 UTC (permalink / raw)
  To: Eugeniu Rosca
  Cc: Laurent Pinchart, Geert Uytterhoeven, Linus Walleij, Linux-Renesas

Hi Eugeniu,

On Sat, Mar 18, 2017 at 9:52 PM, Eugeniu Rosca <roscaeugeniu@gmail.com> wrote:
> commit 0c151062f32c ("sh-pfc: Add support for SoC-specific
> initialization") allows defining SoC specific init functions.
> Such custom functions can register new pinmux info structures.
> Here is an example:
>
> static int my_pinmux_init(struct sh_pfc *pfc)
> {
>     if (my_criteria())
>         pfc->info = &new_pinmux_info;
> }
>
> A side effect of the pfc->info update in the above example is that
> the `const struct sh_pfc_soc_info *info` pointer used in the probe
> routine becomes outdated. One consequence of it is printing the wrong
> pinmux info structure name at the end of `sh_pfc_probe()`. Fix this.
>
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>

Thanks for your patch!
But next time, please send it inline, for easier commenting.

> ---
>  drivers/pinctrl/sh-pfc/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
> index 6399eb1feb12..37fc70fb8e4d 100644
> --- a/drivers/pinctrl/sh-pfc/core.c
> +++ b/drivers/pinctrl/sh-pfc/core.c
> @@ -703,7 +703,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
>
>       platform_set_drvdata(pdev, pfc);
>
> -     dev_info(pfc->dev, "%s support registered\n", info->name);
> +     dev_info(pfc->dev, "%s support registered\n", pfc->info->name);

>From a code maintenance point of view, I think it's safer to update the info
pointer itself, cfr. "[PATCH v2 1/4] pinctrl: sh-pfc: Update info pointer
after SoC-specific init"
(https://www.spinics.net/lists/linux-renesas-soc/msg12375.html).

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: Print correct pinmux info name
  2017-03-19 14:02 ` Geert Uytterhoeven
@ 2017-03-19 16:20   ` Eugeniu Rosca
  0 siblings, 0 replies; 3+ messages in thread
From: Eugeniu Rosca @ 2017-03-19 16:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Eugeniu Rosca, Laurent Pinchart, Linus Walleij, Linux-Renesas

On Sun, Mar 19, 2017 at 03:02:48PM +0100, Geert Uytterhoeven wrote:

Hi Geert,

> Thanks for your patch!
> But next time, please send it inline, for easier commenting.

Thanks! Will do that next time.

> From a code maintenance point of view, I think it's safer to update the info
> pointer itself, cfr. "[PATCH v2 1/4] pinctrl: sh-pfc: Update info pointer
> after SoC-specific init"
> (https://www.spinics.net/lists/linux-renesas-soc/msg12375.html).

Agree! It's good that printing the correct PFC driver name is already
fixed on your side.

Best regards,
Eugeniu.

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

end of thread, other threads:[~2017-03-19 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-18 20:52 [PATCH] pinctrl: sh-pfc: Print correct pinmux info name Eugeniu Rosca
2017-03-19 14:02 ` Geert Uytterhoeven
2017-03-19 16:20   ` Eugeniu Rosca

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.