linux-mips
[Top] [All Lists]

Re: [PATCH 1/8] bcma: add locking around GPIO register accesses

To: John Crispin <john@phrozen.org>
Subject: Re: [PATCH 1/8] bcma: add locking around GPIO register accesses
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Tue, 20 Nov 2012 22:05:25 +0100
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org, linux-wireless@vger.kernel.org, florian@openwrt.org, zajec5@gmail.com, m@bues.ch
In-reply-to: <50AB3AFF.2000001@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: <1353365877-11131-1-git-send-email-hauke@hauke-m.de> <1353365877-11131-2-git-send-email-hauke@hauke-m.de> <50AB3AFF.2000001@phrozen.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2
On 11/20/2012 09:10 AM, John Crispin wrote:
> Hi Hauke
> 
>> u32 bcma_chipco_gpio_in(struct bcma_drv_cc *cc, u32 mask)
>>   {
>> -    return bcma_cc_read32(cc, BCMA_CC_GPIOIN)&  mask;
>> +    unsigned long flags;
>> +    u32 res;
>> +
>> +    spin_lock_irqsave(&cc->gpio_lock, flags);
>> +    res = bcma_cc_read32(cc, BCMA_CC_GPIOIN)&  mask;
>> +    spin_unlock_irqrestore(&cc->gpio_lock, flags);
>> +
>> +    return res;
>>   }
>>
> 
> Hi Hauke,
> 
> do you need to lock the read access ?
> 
> if bcma_cc_read32() is a simple memory read wrapper you most likely wont
> need the lock
> 
>     John
Yes you are right, I do not need it here, it is just needed for the
masked write to the other GPIO registers.

Hauke

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