All of lore.kernel.org
 help / color / mirror / Atom feed
From: prylowski@metasoft.pl (Rafal Prylowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] ep93xx: IDE driver platform support code
Date: Thu, 05 Apr 2012 14:15:55 +0200	[thread overview]
Message-ID: <4F7D8CFB.70100@metasoft.pl> (raw)
In-Reply-To: <ADE657CA350FB648AAC2C43247A983F002069840A0CF@AUSP01VMBX24.collaborationhost.net>

[linux-ide mailing list removed from Cc, because topic is not related to IDE/libata]

On 2012-04-04 19:11, H Hartley Sweeten wrote:
> On Wednesday, April 04, 2012 9:43 AM, H Hartley Sweeten wrote:
>> On Wednesday, April 04, 2012 9:20 AM, H Hartley Sweeten wrote:
>>> On Wednesday, April 04, 2012 1:41 AM, Rafal Prylowski wrote:
>>>> On 2012-04-03 19:41, H Hartley Sweeten wrote:
>>>> [not related to my patch, but ep93xx keypad]:
>>>> Isn't ep93xx_keypad_acquire_gpio be more correct if we apply the following patch:
>>>>
>>>> Index: linux-2.6/arch/arm/mach-ep93xx/core.c
>>>> ===================================================================
>>>> --- linux-2.6.orig/arch/arm/mach-ep93xx/core.c
>>>> +++ linux-2.6/arch/arm/mach-ep93xx/core.c
>>>> @@ -734,7 +734,7 @@ int ep93xx_keypad_acquire_gpio(struct pl
>>>>  fail_gpio_d:
>>>>  	gpio_free(EP93XX_GPIO_LINE_C(i));
>>>>  fail_gpio_c:
>>>> -	for ( ; i >= 0; --i) {
>>>> +	for (--i; i >= 0; --i) {
>>>>  		gpio_free(EP93XX_GPIO_LINE_C(i));
>>>>  		gpio_free(EP93XX_GPIO_LINE_D(i));
>>>>  	}
>>>>
>>>> This way we don't double free EP93XX_GPIO_LINE_C(i), and don't free lines which were not
>>>> successfully acquired (I noticed this when writing my patch, which is based on
>>>> ep93xx_keypad_acquire/release_gpio).
>>>
>>> You are correct... ;-)
>>>
>>> Care to submit an actual patch?

Yes, patch should be on LAKML already.

>>
>> Note, if/when the devm_gpio_request patch gets into the kernel tree we can use
>> that and get rid of the gpio_free's completely.

I doubt if using devm_gpio_request() would help here. We need to call both
ep93xx_*_acquire and ep93xx_*_release_gpio in drivers, because it also sets up
some registers, etc. If ep93xx_*_acquire_gpio fails, then gpio lines should be
freed immediately and not when the driver unloads (because the driver might
want to use them in some other way..).

>>
>> Sorry, I don't have a link to that patch...
> 
> I just pulled linux-next. It looks like the devm_gpio_* stuff is now in.
> 
> commit 1a0703ede4493bd74f9c6b53f782b749e175a88e
> Author: John Crispin <blogic@openwrt.org>
> Date:   Tue Dec 20 21:40:21 2011 +0100
> 
>     GPIO: add bindings for managed devices
>     
>     This patch adds 2 functions that allow managed devices to request GPIOs.
>     These GPIOs will then be managed by drivers/base/devres.c.
>     
>     Signed-off-by: John Crispin <blogic@openwrt.org>
>     Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> 

I see that this is also in v3.4rc1 :)

Regards,
RP

  reply	other threads:[~2012-04-05 12:15 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 14:42 [PATCH v2 0/3] Add PATA host controller support for Cirrus Logic EP93xx CPU Rafal Prylowski
2012-04-03 14:42 ` Rafal Prylowski
2012-04-03 14:45 ` [PATCH v2 1/3] PATA host controller driver for ep93xx Rafal Prylowski
2012-04-03 14:45   ` Rafal Prylowski
2012-04-03 18:25   ` H Hartley Sweeten
2012-04-03 18:25     ` H Hartley Sweeten
2012-04-03 20:08     ` Arnd Bergmann
2012-04-03 20:08       ` Arnd Bergmann
2012-04-03 20:37       ` H Hartley Sweeten
2012-04-03 20:37         ` H Hartley Sweeten
2012-04-04 12:50         ` Arnd Bergmann
2012-04-04 12:50           ` Arnd Bergmann
2012-04-04 12:40       ` Rafal Prylowski
2012-04-04 12:40         ` Rafal Prylowski
2012-04-04 13:23         ` Arnd Bergmann
2012-04-04 13:23           ` Arnd Bergmann
2012-04-04 15:11           ` Rafal Prylowski
2012-04-04 15:11             ` Rafal Prylowski
2012-04-04 15:16             ` Rafal Prylowski
2012-04-04 15:16               ` Rafal Prylowski
2012-04-04 15:23               ` Arnd Bergmann
2012-04-04 15:23                 ` Arnd Bergmann
2012-04-05  7:52                 ` Rafal Prylowski
2012-04-05  7:52                   ` Rafal Prylowski
2012-04-05  9:07                   ` Rafal Prylowski
2012-04-05  9:07                     ` Rafal Prylowski
2012-04-04  7:39     ` Rafal Prylowski
2012-04-04  7:39       ` Rafal Prylowski
2012-04-03 18:55   ` H Hartley Sweeten
2012-04-03 18:55     ` H Hartley Sweeten
2012-04-04  7:47     ` Rafal Prylowski
2012-04-04  7:47       ` Rafal Prylowski
2012-04-03 14:47 ` [PATCH v2 2/3] ep93xx: IDE driver platform support code Rafal Prylowski
2012-04-03 14:47   ` Rafal Prylowski
2012-04-03 17:41   ` H Hartley Sweeten
2012-04-03 17:41     ` H Hartley Sweeten
2012-04-04  8:41     ` Rafal Prylowski
2012-04-04  8:41       ` Rafal Prylowski
2012-04-04 16:20       ` H Hartley Sweeten
2012-04-04 16:20         ` H Hartley Sweeten
2012-04-04 16:43         ` H Hartley Sweeten
2012-04-04 16:43           ` H Hartley Sweeten
2012-04-04 17:11           ` H Hartley Sweeten
2012-04-04 17:11             ` H Hartley Sweeten
2012-04-05 12:15             ` Rafal Prylowski [this message]
2012-04-04  1:43   ` H Hartley Sweeten
2012-04-04  1:43     ` H Hartley Sweeten
2012-04-03 14:48 ` [PATCH v2 3/3] ep93xx: Add IDE support to edb93xx boards Rafal Prylowski
2012-04-03 14:48   ` Rafal Prylowski
2012-04-03 17:44   ` H Hartley Sweeten
2012-04-03 17:44     ` H Hartley Sweeten

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=4F7D8CFB.70100@metasoft.pl \
    --to=prylowski@metasoft.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.