All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabien DESSENNE <fabien.dessenne@foss.st.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	<linux-gpio@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v1 1/1] pinctrl: stm32: Unshadow np variable in stm32_pctl_probe()
Date: Mon, 9 May 2022 09:39:57 +0200	[thread overview]
Message-ID: <30a2c669-693f-45ec-df0e-610e1f94bffd@foss.st.com> (raw)
In-Reply-To: <20220507102257.26414-1-andriy.shevchenko@linux.intel.com>

Hi Andy


Thank you for the patch.

Will this patch be applied in Linus pinctrl tree, or in the gpio-intel 
tree before being merged (linux-next) in the pinctrl tree?

BR

Fabien



On 07/05/2022 12:22, Andy Shevchenko wrote:
> The np variable is used globally for stm32_pctl_probe() and in one of
> its code branches. cppcheck is not happy with that:
> 
>    pinctrl-stm32.c:1530:23: warning: Local variable 'np' shadows outer variable [shadowVariable]
> 
> Instead of simply renaming one of the variables convert some code to
> use a device pointer directly.
> 
> Fixes: bb949ed9b16b ("pinctrl: stm32: Switch to use for_each_gpiochip_node() helper")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Fabien Dessenne <fabien.dessenne@foss.st.com>



> ---
>   drivers/pinctrl/stm32/pinctrl-stm32.c | 21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index e73f2d24611f..5d1d067b2247 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1364,8 +1364,9 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
>   	return err;
>   }
>   
> -static struct irq_domain *stm32_pctrl_get_irq_domain(struct device_node *np)
> +static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pdev)
>   {
> +	struct device_node *np = pdev->dev.of_node;
>   	struct device_node *parent;
>   	struct irq_domain *domain;
>   
> @@ -1482,23 +1483,19 @@ static int stm32_pctrl_create_pins_tab(struct stm32_pinctrl *pctl,
>   
>   int stm32_pctl_probe(struct platform_device *pdev)
>   {
> -	struct device_node *np = pdev->dev.of_node;
> +	const struct stm32_pinctrl_match_data *match_data;
>   	struct fwnode_handle *child;
> -	const struct of_device_id *match;
>   	struct device *dev = &pdev->dev;
>   	struct stm32_pinctrl *pctl;
>   	struct pinctrl_pin_desc *pins;
>   	int i, ret, hwlock_id;
>   	unsigned int banks;
>   
> -	if (!np)
> -		return -EINVAL;
> -
> -	match = of_match_device(dev->driver->of_match_table, dev);
> -	if (!match || !match->data)
> +	match_data = device_get_match_data(dev);
> +	if (!match_data)
>   		return -EINVAL;
>   
> -	if (!of_find_property(np, "pins-are-numbered", NULL)) {
> +	if (!device_property_present(dev, "pins-are-numbered")) {
>   		dev_err(dev, "only support pins-are-numbered format\n");
>   		return -EINVAL;
>   	}
> @@ -1510,7 +1507,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, pctl);
>   
>   	/* check for IRQ controller (may require deferred probe) */
> -	pctl->domain = stm32_pctrl_get_irq_domain(np);
> +	pctl->domain = stm32_pctrl_get_irq_domain(pdev);
>   	if (IS_ERR(pctl->domain))
>   		return PTR_ERR(pctl->domain);
>   
> @@ -1526,10 +1523,10 @@ int stm32_pctl_probe(struct platform_device *pdev)
>   	spin_lock_init(&pctl->irqmux_lock);
>   
>   	pctl->dev = dev;
> -	pctl->match_data = match->data;
> +	pctl->match_data = match_data;
>   
>   	/*  get optional package information */
> -	if (!of_property_read_u32(np, "st,package", &pctl->pkg))
> +	if (!device_property_read_u32(dev, "st,package", &pctl->pkg))
>   		dev_dbg(pctl->dev, "package detected: %x\n", pctl->pkg);
>   
>   	pctl->pins = devm_kcalloc(pctl->dev, pctl->match_data->npins,

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Fabien DESSENNE <fabien.dessenne@foss.st.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	<linux-gpio@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v1 1/1] pinctrl: stm32: Unshadow np variable in stm32_pctl_probe()
Date: Mon, 9 May 2022 09:39:57 +0200	[thread overview]
Message-ID: <30a2c669-693f-45ec-df0e-610e1f94bffd@foss.st.com> (raw)
In-Reply-To: <20220507102257.26414-1-andriy.shevchenko@linux.intel.com>

Hi Andy


Thank you for the patch.

Will this patch be applied in Linus pinctrl tree, or in the gpio-intel 
tree before being merged (linux-next) in the pinctrl tree?

BR

Fabien



On 07/05/2022 12:22, Andy Shevchenko wrote:
> The np variable is used globally for stm32_pctl_probe() and in one of
> its code branches. cppcheck is not happy with that:
> 
>    pinctrl-stm32.c:1530:23: warning: Local variable 'np' shadows outer variable [shadowVariable]
> 
> Instead of simply renaming one of the variables convert some code to
> use a device pointer directly.
> 
> Fixes: bb949ed9b16b ("pinctrl: stm32: Switch to use for_each_gpiochip_node() helper")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Fabien Dessenne <fabien.dessenne@foss.st.com>



> ---
>   drivers/pinctrl/stm32/pinctrl-stm32.c | 21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index e73f2d24611f..5d1d067b2247 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1364,8 +1364,9 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode
>   	return err;
>   }
>   
> -static struct irq_domain *stm32_pctrl_get_irq_domain(struct device_node *np)
> +static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pdev)
>   {
> +	struct device_node *np = pdev->dev.of_node;
>   	struct device_node *parent;
>   	struct irq_domain *domain;
>   
> @@ -1482,23 +1483,19 @@ static int stm32_pctrl_create_pins_tab(struct stm32_pinctrl *pctl,
>   
>   int stm32_pctl_probe(struct platform_device *pdev)
>   {
> -	struct device_node *np = pdev->dev.of_node;
> +	const struct stm32_pinctrl_match_data *match_data;
>   	struct fwnode_handle *child;
> -	const struct of_device_id *match;
>   	struct device *dev = &pdev->dev;
>   	struct stm32_pinctrl *pctl;
>   	struct pinctrl_pin_desc *pins;
>   	int i, ret, hwlock_id;
>   	unsigned int banks;
>   
> -	if (!np)
> -		return -EINVAL;
> -
> -	match = of_match_device(dev->driver->of_match_table, dev);
> -	if (!match || !match->data)
> +	match_data = device_get_match_data(dev);
> +	if (!match_data)
>   		return -EINVAL;
>   
> -	if (!of_find_property(np, "pins-are-numbered", NULL)) {
> +	if (!device_property_present(dev, "pins-are-numbered")) {
>   		dev_err(dev, "only support pins-are-numbered format\n");
>   		return -EINVAL;
>   	}
> @@ -1510,7 +1507,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, pctl);
>   
>   	/* check for IRQ controller (may require deferred probe) */
> -	pctl->domain = stm32_pctrl_get_irq_domain(np);
> +	pctl->domain = stm32_pctrl_get_irq_domain(pdev);
>   	if (IS_ERR(pctl->domain))
>   		return PTR_ERR(pctl->domain);
>   
> @@ -1526,10 +1523,10 @@ int stm32_pctl_probe(struct platform_device *pdev)
>   	spin_lock_init(&pctl->irqmux_lock);
>   
>   	pctl->dev = dev;
> -	pctl->match_data = match->data;
> +	pctl->match_data = match_data;
>   
>   	/*  get optional package information */
> -	if (!of_property_read_u32(np, "st,package", &pctl->pkg))
> +	if (!device_property_read_u32(dev, "st,package", &pctl->pkg))
>   		dev_dbg(pctl->dev, "package detected: %x\n", pctl->pkg);
>   
>   	pctl->pins = devm_kcalloc(pctl->dev, pctl->match_data->npins,

  reply	other threads:[~2022-05-09  7:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 10:22 [PATCH v1 1/1] pinctrl: stm32: Unshadow np variable in stm32_pctl_probe() Andy Shevchenko
2022-05-07 10:22 ` Andy Shevchenko
2022-05-09  7:39 ` Fabien DESSENNE [this message]
2022-05-09  7:39   ` Fabien DESSENNE
2022-05-09  9:27   ` Andy Shevchenko
2022-05-09  9:27     ` Andy Shevchenko
2022-05-13 23:14 ` Linus Walleij
2022-05-13 23:14   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30a2c669-693f-45ec-df0e-610e1f94bffd@foss.st.com \
    --to=fabien.dessenne@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lkp@intel.com \
    --cc=mcoquelin.stm32@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.