All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <t.figa@samsung.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Doug Anderson <dianders@chromium.org>,
	Jean-Jacques Hiblot <jjhiblot@traphandler.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Subject: Re: [PATCH 4/6] pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs
Date: Tue, 08 Jul 2014 12:50:59 +0200	[thread overview]
Message-ID: <53BBCD13.7020902@samsung.com> (raw)
In-Reply-To: <CACRpkdYD=6iV0qFRQrAf2TJc7tg=m2ZEr6SvhruEwsGQLzskSA@mail.gmail.com>

Hi Linus,

On 08.07.2014 11:03, Linus Walleij wrote:
> On Wed, Jul 2, 2014 at 5:41 PM, Tomasz Figa <t.figa@samsung.com> wrote:
> 
>> Currently after configuring a GPIO pin as an interrupt related pinmux
>> registers are changed, but there is no protection from calling
>> gpio_direction_*() in a badly written driver, which would cause the same
>> pinmux register to be reconfigured for regular input/output and this
>> disabling interrupt capability of the pin.
>>
>> This patch addresses this issue by moving pinmux reconfiguration to
>> .irq_startup() callback of irq_chip and calling gpio_lock_as_irq()
>> helper to prevent reconfiguration of pin direction.
>>
>> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> (...)
>> +               .irq_startup = exynos_irq_startup,
>> +               .irq_shutdown = exynos_irq_shutdown,
> 
> I think you should be using the
> .irq_request_resources and .irq_release_resources callbacks instead.
> 
> The reason is that startup and shutdown cannot really fail (ret code
> is unsigned...), so using the other callbacks is safer.

Hmm, I used the at91 pinctrl driver as an example, but I agree that
request/release_resources would be better. I guess it should be changed
there as well. [Ccing Jean-Jacques and Jean-Christophe]

> 
> Can you have a quick look at this before I apply any more of the
> Samsung patches?

The two remaining patches are pretty much independent from this one and
rest of this series so please take a look at them while I prepare new
version of this patch.

Best regards,
Tomasz

WARNING: multiple messages have this Message-ID (diff)
From: t.figa@samsung.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs
Date: Tue, 08 Jul 2014 12:50:59 +0200	[thread overview]
Message-ID: <53BBCD13.7020902@samsung.com> (raw)
In-Reply-To: <CACRpkdYD=6iV0qFRQrAf2TJc7tg=m2ZEr6SvhruEwsGQLzskSA@mail.gmail.com>

Hi Linus,

On 08.07.2014 11:03, Linus Walleij wrote:
> On Wed, Jul 2, 2014 at 5:41 PM, Tomasz Figa <t.figa@samsung.com> wrote:
> 
>> Currently after configuring a GPIO pin as an interrupt related pinmux
>> registers are changed, but there is no protection from calling
>> gpio_direction_*() in a badly written driver, which would cause the same
>> pinmux register to be reconfigured for regular input/output and this
>> disabling interrupt capability of the pin.
>>
>> This patch addresses this issue by moving pinmux reconfiguration to
>> .irq_startup() callback of irq_chip and calling gpio_lock_as_irq()
>> helper to prevent reconfiguration of pin direction.
>>
>> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> (...)
>> +               .irq_startup = exynos_irq_startup,
>> +               .irq_shutdown = exynos_irq_shutdown,
> 
> I think you should be using the
> .irq_request_resources and .irq_release_resources callbacks instead.
> 
> The reason is that startup and shutdown cannot really fail (ret code
> is unsigned...), so using the other callbacks is safer.

Hmm, I used the at91 pinctrl driver as an example, but I agree that
request/release_resources would be better. I guess it should be changed
there as well. [Ccing Jean-Jacques and Jean-Christophe]

> 
> Can you have a quick look at this before I apply any more of the
> Samsung patches?

The two remaining patches are pretty much independent from this one and
rest of this series so please take a look at them while I prepare new
version of this patch.

Best regards,
Tomasz

  reply	other threads:[~2014-07-08 10:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02 15:40 [PATCH 0/6] Various improvements for samsung-pinctrl driver Tomasz Figa
2014-07-02 15:40 ` Tomasz Figa
2014-07-02 15:40 ` [PATCH 1/6] pinctrl: samsung: Decouple direction setting from pinctrl Tomasz Figa
2014-07-02 15:40   ` Tomasz Figa
2014-07-08  8:54   ` Linus Walleij
2014-07-08  8:54     ` Linus Walleij
2014-07-02 15:41 ` [PATCH 2/6] pinctrl: samsung: Handle GPIO request and free using pinctrl helpers Tomasz Figa
2014-07-02 15:41   ` Tomasz Figa
2014-07-04  9:41   ` Sachin Kamat
2014-07-04  9:41     ` Sachin Kamat
2014-07-04 11:00     ` Tomasz Figa
2014-07-04 11:00       ` Tomasz Figa
2014-07-08  8:57   ` Linus Walleij
2014-07-08  8:57     ` Linus Walleij
2014-07-02 15:41 ` [PATCH 3/6] pinctrl: exynos: Consolidate irq_chips of GPIO and WKUP EINTs Tomasz Figa
2014-07-02 15:41   ` Tomasz Figa
2014-07-08  8:59   ` Linus Walleij
2014-07-08  8:59     ` Linus Walleij
2014-07-02 15:41 ` [PATCH 4/6] pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs Tomasz Figa
2014-07-02 15:41   ` Tomasz Figa
2014-07-08  9:03   ` Linus Walleij
2014-07-08  9:03     ` Linus Walleij
2014-07-08 10:50     ` Tomasz Figa [this message]
2014-07-08 10:50       ` Tomasz Figa
2014-07-02 15:41 ` [PATCH 5/6] pinctrl: samsung: Allow grouping multiple pinmux/pinconf nodes Tomasz Figa
2014-07-02 15:41   ` Tomasz Figa
2014-07-09  7:32   ` Linus Walleij
2014-07-09  7:32     ` Linus Walleij
2014-07-09  8:06     ` Tomasz Figa
2014-07-09  8:06       ` Tomasz Figa
2014-07-02 15:41 ` [PATCH 6/6] pinctrl: samsung: Allow pin value to be initialized using pinfunc Tomasz Figa
2014-07-02 15:41   ` Tomasz Figa
2014-07-09  7:35   ` Linus Walleij
2014-07-09  7:35     ` Linus Walleij
2014-07-09  8:07     ` Tomasz Figa
2014-07-09  8:07       ` Tomasz Figa

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=53BBCD13.7020902@samsung.com \
    --to=t.figa@samsung.com \
    --cc=dianders@chromium.org \
    --cc=jjhiblot@traphandler.com \
    --cc=kgene.kim@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=plagnioj@jcrosoft.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.