From patchwork Thu Jul 9 08:13:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 6753941 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3221CC05AC for ; Thu, 9 Jul 2015 08:14:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45CB72058A for ; Thu, 9 Jul 2015 08:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47258205E9 for ; Thu, 9 Jul 2015 08:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752581AbbGIIOh (ORCPT ); Thu, 9 Jul 2015 04:14:37 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:41020 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751700AbbGIIOA (ORCPT ); Thu, 9 Jul 2015 04:14:00 -0400 Received: from dc8secmta1.synopsys.com (dc8secmta1.synopsys.com [10.13.218.200]) by smtprelay.synopsys.com (Postfix) with ESMTP id 4025F10C0575; Thu, 9 Jul 2015 01:14:00 -0700 (PDT) Received: from dc8secmta1.internal.synopsys.com (dc8secmta1.internal.synopsys.com [127.0.0.1]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id 32EB527115; Thu, 9 Jul 2015 01:14:00 -0700 (PDT) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id BE18327114; Thu, 9 Jul 2015 01:13:59 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id A07B352C; Thu, 9 Jul 2015 01:13:59 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 804AE52B; Thu, 9 Jul 2015 01:13:59 -0700 (PDT) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 9 Jul 2015 01:13:58 -0700 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 9 Jul 2015 13:43:56 +0530 Received: from vineetg-E7440.internal.synopsys.com (10.12.197.226) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 9 Jul 2015 13:43:55 +0530 From: Vineet Gupta To: Peter Zijlstra , Ingo Molnar , Arnd Bergmann CC: , , Vineet Gupta , Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , "Hante Meuleman" , Kalle Valo , Pieter-Paul Giesberts , Daniel Kim , , , Subject: [PATCH 2/3] brcmfmac: dhd_sdio.c: use existing atomic_or primitive Date: Thu, 9 Jul 2015 13:43:18 +0530 Message-ID: <1436429599-10762-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436429599-10762-1-git-send-email-vgupta@synopsys.com> References: <1436429599-10762-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.197.226] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's already a generic implementation so use that instead. --- 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 ? --- Cc: Brett Rudley Cc: Arend van Spriel Cc: "Franky (Zhenhui) Lin" Cc: Hante Meuleman Cc: Kalle Valo Cc: Pieter-Paul Giesberts Cc: Daniel Kim Cc: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com Cc: Peter Zijlstra Cc: Ingo Molnar Cc: netdev@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Vineet Gupta Signed-off-by: Vineet Gupta --- 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);