All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Pramod Gurav <pramod.gurav.etc@gmail.com>
Cc: Pramod Gurav <pramod.gurav@smartplayin.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Maxime Coquelin <maxime.coquelin@st.com>,
	Patrice Chotard <patrice.chotard@st.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] pinctrl: st: Fix Sparse error
Date: Mon, 29 Sep 2014 16:38:56 +0100	[thread overview]
Message-ID: <54297D10.9050907@linaro.org> (raw)
In-Reply-To: <CAMf-jSmdNibSK+ffBOdcuVjyhmHFcfi5s4nQzctrS0dK889+FA@mail.gmail.com>



On 29/09/14 16:05, Pramod Gurav wrote:
>> >I think the correct fix is:
>> >
>> >diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
>> >index 5475374..4060c30 100644
>> >--- a/drivers/pinctrl/pinctrl-st.c
>> >+++ b/drivers/pinctrl/pinctrl-st.c
>> >@@ -1512,7 +1512,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl
>> >*info,
>> >                                              gpio_irq, st_gpio_irq_handler);
>> >         }
>> >
>> >-       if (info->irqmux_base > 0 || gpio_irq > 0) {
>> >+       if (!IS_ERR(info->irqmux_base) || gpio_irq > 0) {
>> >                 err = gpiochip_irqchip_add(&bank->gpio_chip,
> But if I am not wrong in function st_pctl_probe_dt, This is already done:
>
> if (IS_ERR(info->irqmux_base))
>              return PTR_ERR(info->irqmux_base);
>
> That is the reason I thought there is no need to recheck the pointer
> info->irqmux_base.
> Am I misunderstanding something?

Ok, we want to add the irqchip only when there is a valid irqmux_base or 
a valid gpio_irq per bank.

As st_gpiolib_register_bank() is used by both types of irq wirings and 
it does not know if irqmux or gpio irq is in use, so we need this 
explicit check. Also we want to make sure that atleast one type is valid 
before adding irqchip.

If you just check for only gpio_irq in this code, you would miss the 
case where irqmux is used.

As Dan pointed you could check if irqmux_base is valid and not remove it 
totally. Removing it will *break* the irqmux support as I explained.

thanks,
srini



>> >&st_gpio_irqchip,
>> >                                            0, handle_simple_irq,
>> >                                            IRQ_TYPE_LEVEL_LOW);
>> >
>> >

  reply	other threads:[~2014-09-29 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 13:48 [PATCH] pinctrl: st: Fix Sparse error Pramod Gurav
2014-09-29 13:47 ` Patrice Chotard
2014-09-29 14:46 ` Srinivas Kandagatla
2014-09-29 15:05   ` Pramod Gurav
2014-09-29 15:38     ` Srinivas Kandagatla [this message]
2014-09-29 16:10       ` Pramod Gurav
2014-09-29 15:09   ` Daniel Thompson

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=54297D10.9050907@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.coquelin@st.com \
    --cc=patrice.chotard@st.com \
    --cc=pramod.gurav.etc@gmail.com \
    --cc=pramod.gurav@smartplayin.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.