All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: Igor Grinberg <grinberg@compulab.co.il>
Cc: Kevin Hilman <khilman@ti.com>, Tony Lindgren <tony@atomide.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] ARM: OMAP2+: ads7846 init: fix fault caused by freeing pen-down GPIO
Date: Mon, 23 Jul 2012 16:18:34 +0300	[thread overview]
Message-ID: <500D4F2A.9090706@compulab.co.il> (raw)
In-Reply-To: <500D494D.8020606@compulab.co.il>

Hi Kevin,

I've just noticed that the patch has been modified by Arnd in a way
that of course will trigger GPIO use without being requested.
I'm sorry, I was not available by that time Arnd changed the patch.

So that is not my original patch that is triggering the issue,
but it does not meter already...
And currently, I think that the proper solution would be
to remove the gpio_free() call as your patch does, but.......

Tony, please pay attention to which branch it gets applied....
It should only apply to the branches that have the patch modified
by Arnd and not to those with unmodified patch
(e.g. fixes-non-critical should not receive the patch).

Kevin, thanks for the patch.

On 07/23/12 15:53, Igor Grinberg wrote:
> On 07/12/12 02:18, Kevin Hilman wrote:
>> commit 97ee9f01d6 (ARM: OMAP: fix the ads7846 init code) mistakenly
>> frees the pen-down GPIO even though it will be used by the ads7846
>> driver.
> 
> But the driver requests the GPIO in ads7846_setup_pendown() method...
> 
>>
>> Freeing a GPIO means that the GPIO bank containing that GPIO can be
>> runtime suspended if its the last/only GPIO being used in that bank.
>> If the GPIO bank is runtime suspended, any accesses to that bank will
>> cause faults.
> 
> Unless, it is requested again, or am I missing something?
> 
>>
>> Because the current code frees the GPIO, the ads7846 driver probe will
>> fault when it requests its IRQ line.
> 
> But it requests that GPIO... in ads7846_setup_pendown()
> prior to requesting the IRQ...
> 
>> Because the IRQ is a GPIO line,
>> the request IRQ will trickle down into the OMAP GPIO layer:
>> gpio_irq_type() --> _set_gpio_triggering() which can fault if the
>> bank has been runtime suspended.
>>
>> This is exctly what happens on Overo platforms (3530 Water, 3730 Overo
>> FireSTORM) since this is the only GPIO used in the bank.
>>
>> To fix, don't free the GPIO at all since it is always in use.
>>
>> Cc: Igor Grinberg <grinberg@compulab.co.il>
>> Signed-off-by: Kevin Hilman <khilman@ti.com>

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

>> ---
>> Tony, this applies on top of your current fixes-non-critical branch and
>> should probably go in to v3.5-rc since the patch which introduced the
>> problem did as well.

No, this patch is not good for fixes-non-critical,
as fixes-non-critical has unmodified version and
will result in double requesting.
It should be applied to master or derivatives that
have the modified patch version.

>>
>>  arch/arm/mach-omap2/common-board-devices.c |    3 ---
>>  1 file changed, 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
>> index c187586..1ae6fd6 100644
>> --- a/arch/arm/mach-omap2/common-board-devices.c
>> +++ b/arch/arm/mach-omap2/common-board-devices.c
>> @@ -84,9 +84,6 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>>  		ads7846_config.gpio_pendown = gpio_pendown;
>>  	}
>>  
>> -	if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
>> -		gpio_free(gpio_pendown);
>> -
>>  	spi_register_board_info(&ads7846_spi_board_info, 1);
>>  }
>>  #else
> 

-- 
Regards,
Igor.

WARNING: multiple messages have this Message-ID (diff)
From: grinberg@compulab.co.il (Igor Grinberg)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: OMAP2+: ads7846 init: fix fault caused by freeing pen-down GPIO
Date: Mon, 23 Jul 2012 16:18:34 +0300	[thread overview]
Message-ID: <500D4F2A.9090706@compulab.co.il> (raw)
In-Reply-To: <500D494D.8020606@compulab.co.il>

Hi Kevin,

I've just noticed that the patch has been modified by Arnd in a way
that of course will trigger GPIO use without being requested.
I'm sorry, I was not available by that time Arnd changed the patch.

So that is not my original patch that is triggering the issue,
but it does not meter already...
And currently, I think that the proper solution would be
to remove the gpio_free() call as your patch does, but.......

Tony, please pay attention to which branch it gets applied....
It should only apply to the branches that have the patch modified
by Arnd and not to those with unmodified patch
(e.g. fixes-non-critical should not receive the patch).

Kevin, thanks for the patch.

On 07/23/12 15:53, Igor Grinberg wrote:
> On 07/12/12 02:18, Kevin Hilman wrote:
>> commit 97ee9f01d6 (ARM: OMAP: fix the ads7846 init code) mistakenly
>> frees the pen-down GPIO even though it will be used by the ads7846
>> driver.
> 
> But the driver requests the GPIO in ads7846_setup_pendown() method...
> 
>>
>> Freeing a GPIO means that the GPIO bank containing that GPIO can be
>> runtime suspended if its the last/only GPIO being used in that bank.
>> If the GPIO bank is runtime suspended, any accesses to that bank will
>> cause faults.
> 
> Unless, it is requested again, or am I missing something?
> 
>>
>> Because the current code frees the GPIO, the ads7846 driver probe will
>> fault when it requests its IRQ line.
> 
> But it requests that GPIO... in ads7846_setup_pendown()
> prior to requesting the IRQ...
> 
>> Because the IRQ is a GPIO line,
>> the request IRQ will trickle down into the OMAP GPIO layer:
>> gpio_irq_type() --> _set_gpio_triggering() which can fault if the
>> bank has been runtime suspended.
>>
>> This is exctly what happens on Overo platforms (3530 Water, 3730 Overo
>> FireSTORM) since this is the only GPIO used in the bank.
>>
>> To fix, don't free the GPIO at all since it is always in use.
>>
>> Cc: Igor Grinberg <grinberg@compulab.co.il>
>> Signed-off-by: Kevin Hilman <khilman@ti.com>

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

>> ---
>> Tony, this applies on top of your current fixes-non-critical branch and
>> should probably go in to v3.5-rc since the patch which introduced the
>> problem did as well.

No, this patch is not good for fixes-non-critical,
as fixes-non-critical has unmodified version and
will result in double requesting.
It should be applied to master or derivatives that
have the modified patch version.

>>
>>  arch/arm/mach-omap2/common-board-devices.c |    3 ---
>>  1 file changed, 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
>> index c187586..1ae6fd6 100644
>> --- a/arch/arm/mach-omap2/common-board-devices.c
>> +++ b/arch/arm/mach-omap2/common-board-devices.c
>> @@ -84,9 +84,6 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>>  		ads7846_config.gpio_pendown = gpio_pendown;
>>  	}
>>  
>> -	if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
>> -		gpio_free(gpio_pendown);
>> -
>>  	spi_register_board_info(&ads7846_spi_board_info, 1);
>>  }
>>  #else
> 

-- 
Regards,
Igor.

  reply	other threads:[~2012-07-23 13:18 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 23:18 [PATCH] ARM: OMAP2+: ads7846 init: fix fault caused by freeing pen-down GPIO Kevin Hilman
2012-07-11 23:18 ` Kevin Hilman
2012-07-23 12:53 ` Igor Grinberg
2012-07-23 12:53   ` Igor Grinberg
2012-07-23 13:18   ` Igor Grinberg [this message]
2012-07-23 13:18     ` Igor Grinberg
2012-07-26 19:30     ` Kevin Hilman
2012-07-26 19:30       ` Kevin Hilman
2012-07-26 21:19       ` zumeng.chen
2012-07-26 21:19         ` zumeng.chen
2012-07-26 21:58         ` Kevin Hilman
2012-07-26 21:58           ` Kevin Hilman
2012-07-26 22:40           ` zumeng.chen
2012-07-26 22:40             ` zumeng.chen
2012-07-27  5:02           ` Zumeng Chen
2012-07-27  5:02             ` Zumeng Chen
2012-07-27 15:30       ` Igor Grinberg
2012-07-27 15:30         ` Igor Grinberg
2012-07-27 17:46         ` Kevin Hilman
2012-07-27 17:46           ` Kevin Hilman
2012-07-27 19:04           ` Igor Grinberg
2012-07-27 19:04             ` Igor Grinberg
2012-07-28  0:28             ` Kevin Hilman
2012-07-28  0:28               ` Kevin Hilman
2012-08-06 20:22               ` [PATCH] Revert "ARM: OMAP3530evm: set pendown_state and debounce time for ads7846" Igor Grinberg
2012-08-06 20:22                 ` Igor Grinberg
2012-08-06 20:52                 ` Kevin Hilman
2012-08-06 20:52                   ` Kevin Hilman
2012-08-07  1:44                   ` Zumeng Chen
2012-08-07  1:44                     ` Zumeng Chen
2012-08-07  5:58                   ` Igor Grinberg
2012-08-07  5:58                     ` Igor Grinberg
2012-08-07 10:58                   ` Tony Lindgren
2012-08-07 10:58                     ` Tony Lindgren
2012-08-07  1:42                 ` Zumeng Chen
2012-08-07  1:42                   ` Zumeng Chen
2012-08-07  6:05                   ` Igor Grinberg
2012-08-07  6:05                     ` Igor Grinberg
2012-07-27 18:58       ` [PATCH] ARM: OMAP2+: ads7846 init: fix fault caused by freeing pen-down GPIO Igor Grinberg
2012-07-27 18:58         ` Igor Grinberg
2012-07-27 19:05         ` Kevin Hilman
2012-07-27 19:05           ` Kevin Hilman

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=500D4F2A.9090706@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=arnd@arndb.de \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.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.