linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arend van Spriel <arend@broadcom.com>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	Brett Rudley <brudley@broadcom.com>,
	"Franky (Zhenhui) Lin" <frankyl@broadcom.com>,
	Hante Meuleman <meuleman@broadcom.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Pieter-Paul Giesberts <pieterpg@broadcom.com>,
	Daniel Kim <dekim@broadcom.com>,
	linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
Date: Thu, 9 Jul 2015 20:25:21 +0200	[thread overview]
Message-ID: <559EBC91.2070600@broadcom.com> (raw)
In-Reply-To: <1436429599-10762-3-git-send-email-vgupta@synopsys.com>

On 07/09/2015 10:13 AM, Vineet Gupta wrote:
> There's already a generic implementation so use that instead.

There is or there was? If there is now I am fine with this patch, but if 
it already was there the author might have had a reason for adding a 
local function and I would like to hear that reason.

> ---
> I'm not sure if the driver usage of atomic_or?() is correct in terms of
> storage size of @val for 64 bit arches.
>
> Assuming LP64 programming model for linux on say x86_64: atomic_or()
> callers in this driver use long (sana 64 bit) storage and pass it to
> atomic_orr/atomic_or which downcasts it to 32 bits. Is that OK ?

The function is used with 32bit register value from the device so I 
think it is ok.

Regards,
Arend

> ---
> Cc: Brett Rudley <brudley@broadcom.com>
> Cc: Arend van Spriel <arend@broadcom.com>
> Cc: "Franky (Zhenhui) Lin" <frankyl@broadcom.com>
> Cc: Hante Meuleman <meuleman@broadcom.com>
> Cc: Kalle Valo <kvalo@codeaurora.org>
> Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
> Cc: Daniel Kim <dekim@broadcom.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: brcm80211-dev-list@broadcom.com
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: netdev@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> ---
>   drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 13 ++-----------
>   1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
> index d36f5f3d931b..f990e3d0e696 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
> @@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
>   	}
>   }
>
> -static void atomic_orr(int val, atomic_t *v)
> -{
> -	int old_val;
> -
> -	old_val = atomic_read(v);
> -	while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
> -		old_val = atomic_read(v);
> -}
> -
>   static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
>   {
>   	struct brcmf_core *buscore;
> @@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
>   	if (val) {
>   		brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
>   		bus->sdcnt.f1regdata++;
> -		atomic_orr(val, &bus->intstatus);
> +		atomic_or(val, &bus->intstatus);
>   	}
>
>   	return ret;
> @@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_sdio *bus)
>
>   	/* Keep still-pending events for next scheduling */
>   	if (intstatus)
> -		atomic_orr(intstatus, &bus->intstatus);
> +		atomic_or(intstatus, &bus->intstatus);
>
>   	brcmf_sdio_clrintr(bus);
>
>

  reply	other threads:[~2015-07-09 18:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  8:13 [PATCH 0/3] atomic_or() related changes Vineet Gupta
2015-07-09  8:13 ` [PATCH 1/3] asm-generic/atomic.h: ARCH_HAS_ATOMIC_OR -> CONFIG_ARCH_HAS_ATOMIC_OR Vineet Gupta
2015-07-09  8:13 ` [PATCH 2/3] brcmfmac: dhd_sdio.c: use existing atomic_or primitive Vineet Gupta
2015-07-09 18:25   ` Arend van Spriel [this message]
2015-07-09 18:31     ` Arend van Spriel
2015-07-09 19:57       ` Peter Zijlstra
2015-07-10  4:49     ` Vineet Gupta
2015-07-10  9:05       ` Arend van Spriel
2015-07-10  9:05         ` Arend van Spriel
2015-07-24 17:02   ` Kalle Valo
2015-07-24 17:22     ` Vineet Gupta
2015-07-24 17:22       ` Vineet Gupta
2015-07-26 11:12       ` Arend van Spriel
2015-07-26 11:12         ` Arend van Spriel
2015-07-27 10:08         ` Kalle Valo
2015-07-27 10:08           ` Kalle Valo
2015-07-27 10:23           ` Vineet Gupta
2015-08-13 12:30   ` [2/3] " Kalle Valo
2015-08-13 12:30     ` Kalle Valo
2015-07-09  8:13 ` [PATCH 3/3] ARC: provide atomic_or() and define ARCH_HAS_ATOMIC_OR Vineet Gupta
2015-07-09 12:31 ` [PATCH 0/3] atomic_or() related changes Peter Zijlstra
2015-07-09 13:05   ` Vineet Gupta
2015-07-09 13:20     ` Peter Zijlstra

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=559EBC91.2070600@broadcom.com \
    --to=arend@broadcom.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=arnd@arndb.de \
    --cc=brcm80211-dev-list@broadcom.com \
    --cc=brudley@broadcom.com \
    --cc=dekim@broadcom.com \
    --cc=frankyl@broadcom.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=meuleman@broadcom.com \
    --cc=mingo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pieterpg@broadcom.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).