linux-mips
[Top] [All Lists]

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

To: Hauke Mehrtens <hauke@hauke-m.de>
Subject: Re: [PATCH 1/8] bcma: add locking around GPIO register accesses
From: John Crispin <john@phrozen.org>
Date: Tue, 20 Nov 2012 09:10:39 +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: <1353365877-11131-2-git-send-email-hauke@hauke-m.de>
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>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120922 Icedove/10.0.7
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

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