public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: ryan@bluewatersys•com (Ryan Mallon)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 3/3 v2] at91/atmel-mci: inclusion of sd/mmc driver in at91sam9g45 chip and board
Date: Tue, 03 Nov 2009 15:30:56 +1300	[thread overview]
Message-ID: <4AEF95E0.7040602@bluewatersys.com> (raw)
In-Reply-To: <4AEF12B7.3040704@atmel.com>

Nicolas Ferre wrote:
> Ben Nizette :
>   
>> On Wed, 2009-10-28 at 21:53 +0200, Andrew Victor wrote:
>>     
>>> hi,
>>>
>>>       
>>>> Then I think it would be best to use GPIO_PIN_NONE. Makes it clear
>>>> what is expected and avoids confusion on what should be the proper
>>>> value.
>>>> I hope I'm not saying non-sense, but even if I am, I guess you can see
>>>> that I'm advocating against the magic numbers :)
>>>>         
>>> What magic numbers ?
>>>       
>> I think Thiago was referring to the "-1" in the original patch as the
>> magic number.
>>
>> Leaving the field blank to be initialised to 0 is certainly the
>> cleanest, I agree, but it doesn't actually /work/.  On many archs 0 is a
>> valid gpio number; the gpio_is_valid check used throughout the kernel
>> (including atmel-mci.c) looks like
>>
>> static inline int gpio_is_valid(int number)
>> {
>> 	/* only some non-negative numbers are valid */
>> 	return ((unsigned)number) < ARCH_NR_GPIOS;
>> }
>>     
>
> I understand that the better way to solve this issue is to:
> - keep the AT91 way of specifying not connected pins (= 0)
> - code the gpio_is_valid() function for at91 that tests this way of
> handling not connected gpio
>   
It doesn't appear that the gpio_is_valid function can be overridden by a
platform specific version. However, as you point out, on AT91 it appears
broken since anything less than AT91_PIN_PA0 (32) is not a valid gpio.

IIRC, we can't mark static inline functions as weak, and we don't want
to turn gpio_is_valid into an actual function call. We could do some
preprocessor magic, but that gets a bit messy.

CC'ed David Brownell, who does most of the gpiolib stuff. Any ideas?

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751 
Fax:   +64 3 3779135			  USA 1800 261 2934

  parent reply	other threads:[~2009-11-03  2:30 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090930155557.7dae503b@hskinnemoen-d830>
2009-10-23 16:34 ` [PATCH 0/2 v2]mmc: atmel-mci: introduce MCI2 support on at91 Nicolas Ferre
2009-10-23 16:34 ` [PATCH 1/3 v2] atmel-mci: change use of dma slave interface Nicolas Ferre
2009-10-23 16:34 ` [PATCH 2/3 v2] mmc: atmel-mci: New MCI2 module support in atmel-mci driver Nicolas Ferre
2009-11-02 17:18   ` Nicolas Ferre
2009-11-18 13:33     ` Nicolas Ferre
2009-10-23 16:34 ` [PATCH 3/3 v2] at91/atmel-mci: inclusion of sd/mmc driver in at91sam9g45 chip and board Nicolas Ferre
2009-10-26  8:15   ` Yegor Yefremov
2009-11-02 17:14     ` Nicolas Ferre
2009-10-27 19:43   ` Andrew Victor
2009-10-28  0:35     ` Haavard Skinnemoen
2009-10-28  0:53       ` Thiago A. Corrêa
2009-10-28  1:31         ` Haavard Skinnemoen
2009-10-28 19:53         ` Andrew Victor
2009-10-28 20:50           ` Ben Nizette
2009-11-02 17:11             ` Nicolas Ferre
2009-11-02 22:10               ` Ben Nizette
2009-11-02 22:14               ` Ben Nizette
2009-11-03  2:30               ` Ryan Mallon [this message]
2009-11-03  2:55                 ` Ben Nizette
2009-11-07 11:20                   ` Haavard Skinnemoen
2010-08-23 15:01                     ` [PATCH] pio: add arch specific gpio_is_valid() function Nicolas Ferre
2010-08-23 16:36                       ` David Brownell
2010-08-24  8:19                         ` Nicolas Ferre
2010-09-06 14:21                           ` [PATCH v2] AT91: pio: add " Nicolas Ferre
2010-09-07  1:51                             ` David Brownell
2010-09-03 16:41                       ` [PATCH] pio: add arch specific " Jean-Christophe PLAGNIOL-VILLARD
2010-09-07  2:23                         ` David Brownell
2010-09-07  2:44                           ` Ryan Mallon
2010-09-07  3:54                             ` Eric Miao
2010-09-07  4:07                               ` Ryan Mallon
2010-09-07  4:19                                 ` Eric Miao
2010-09-07  4:26                                   ` Ryan Mallon
2010-09-07 18:10                                     ` David Brownell
2010-09-07 19:13                                       ` avictor.za at gmail.com
2010-09-07 19:30                                         ` Ryan Mallon
2010-09-07 21:22                                           ` Alan Cox
2010-09-07 23:44                                             ` David Brownell
2010-09-08  0:11                                               ` Alan Cox
2010-09-07  6:33                             ` David Brownell
2010-09-07  8:41                               ` Ben Nizette
2010-09-07 17:32                                 ` David Brownell

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=4AEF95E0.7040602@bluewatersys.com \
    --to=ryan@bluewatersys$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox