linux-mips
[Top] [All Lists]

Re: [PATCH v2 3/3] MIPS: BCM47xx: rewrite GPIO handling and use gpiolib

To: John Crispin <john@phrozen.org>
Subject: Re: [PATCH v2 3/3] MIPS: BCM47xx: rewrite GPIO handling and use gpiolib
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Fri, 17 Aug 2012 00:33:51 +0200
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org, linux-wireless@vger.kernel.org
In-reply-to: <502D4B70.4010509@phrozen.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1345132801-8430-1-git-send-email-hauke@hauke-m.de> <1345132801-8430-4-git-send-email-hauke@hauke-m.de> <502D4B70.4010509@phrozen.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
On 08/16/2012 09:35 PM, John Crispin wrote:
> On 16/08/12 18:00, Hauke Mehrtens wrote:
>> int gpio_get_value(unsigned gpio)
>> +{
>> +    if (gpio < bcm47xx_gpio_count)
>> +            return bcm47xx_gpio_in(1 << gpio);
>> +
>> +    return __gpio_get_value(gpio);
>> +}
>> +EXPORT_SYMBOL(gpio_get_value);
> 
> Hi,
> 
> You are using a gpio_chip. simply doing this
> 
> #define gpio_get_value __gpio_get_value
> 
> inside your arch/mips/include/asm/mach-bcm47xx/gpio.h will be enough.
> __gpio_get_value() will then automatically find and use
> bcm47xx_gpio_get_value() via the gpio_chip.

With this code gpio_get_value() is faster as the hole gpiolib is not
called for the get and set methods. I assume then these gpios are the
first being registered and all calls to these gpios are directly handled
by this methods and are not going through the gpiolib code.
This is based on the way it is done for ath79.

Hauke



<Prev in Thread] Current Thread [Next in Thread>