Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF8F0C433F5 for ; Thu, 16 Dec 2021 03:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233355AbhLPD0c (ORCPT ); Wed, 15 Dec 2021 22:26:32 -0500 Received: from o1.ptr2625.egauge.net ([167.89.112.53]:33732 "EHLO o1.ptr2625.egauge.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbhLPD01 (ORCPT ); Wed, 15 Dec 2021 22:26:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=egauge.net; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type; s=sgd; bh=KRpEVBdV5fyCa6LhCrnHan24UbFb7eiesIdyenFXa7Y=; b=vrzxiOGv3LXZ9VKE49ikXabLbdri6NRpcRJNvESo8vdYblH205CB1m0Mb7T2DD3dKFZk FJrtbsObpkQc6pjlxYePUR+M/GcOcveepG0hBQMs1z04zTNRtEd5gnbMRJpZ/BmC53kOcY 8OwswO3ATqxPbx2cnPB4IJLn9/K6/W7JDxGZHcuxCgchcCPt0lw0LjuMz/2babccmmHRac k18ADIRXXntkkX4yJD02IecllySf8wOdSIaEfHGoAm+VwUnHkJVLSb8oI60yQRRa2Y+Q5R hpGcX4QshnS/cJyPvTM3bvNsr4wqg/QdOnO8pa019rs/MW00PJ1Q45mW3t4Dh52w== Received: by filterdrecv-75ff7b5ffb-96rhp with SMTP id filterdrecv-75ff7b5ffb-96rhp-1-61BAB1E0-2B 2021-12-16 03:26:24.932642305 +0000 UTC m=+9090364.813149035 Received: from pearl.egauge.net (unknown) by geopod-ismtpd-1-1 (SG) with ESMTP id nfkc_PERRVCbY_jCotLESg Thu, 16 Dec 2021 03:26:24.779 +0000 (UTC) Received: by pearl.egauge.net (Postfix, from userid 1000) id 03B46700E72; Wed, 15 Dec 2021 20:26:24 -0700 (MST) From: David Mosberger-Tang Subject: [PATCH] wilc1000: Convert static "chipid" variable to device-local variable Date: Thu, 16 Dec 2021 03:26:25 +0000 (UTC) Message-Id: <20211216032612.3798573-1-davidm@egauge.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?+kMxBqj35EdRUKoy8diX1j4AXmPtd302oan+iXZuF8m2Nw4HRW2irNspffT=2Fkh?= =?us-ascii?Q?ET6RJF6+Prbl0h=2FEtF1rRLvBvrXi7igiw3S+MCi?= =?us-ascii?Q?w8n5f20b4RWHzEw2hbU+cN3vLQB7L=2FZRmxUZZYa?= =?us-ascii?Q?ONJ7E9hp73OJnR2yp4FRhnQ=2FZ5xror6lESWmhGK?= =?us-ascii?Q?zNXNfqzKsnDz3iEON29mSpksdjLGhbvBx0WGtzd?= =?us-ascii?Q?Du8+HLn8gt0bNzhNcJ7h3kHI1A=2FduMew=2FJ1x7Wq?= =?us-ascii?Q?A0=2FI1Nh5ETW27h6ZPmpFg=3D=3D?= To: Ajay Singh Cc: Claudiu Beznea , Kalle Valo , "David S. Miller" , Jakub Kicinski , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David Mosberger-Tang X-Entity-ID: Xg4JGAcGrJFIz2kDG9eoaQ== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Move "chipid" variable into the per-driver structure so the code doesn't break if more than one wilc1000 module is present. Signed-off-by: David Mosberger-Tang --- .../net/wireless/microchip/wilc1000/netdev.h | 1 + .../net/wireless/microchip/wilc1000/wlan.c | 27 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h index b9a88b3e322f..41a92a1368ab 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.h +++ b/drivers/net/wireless/microchip/wilc1000/netdev.h @@ -212,6 +212,7 @@ struct wilc { s8 mac_status; struct clk *rtc_clk; bool initialized; + u32 chipid; int dev_irq_num; int close; u8 vif_num; diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 1aa4236a2fe4..c8e103500235 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -1443,31 +1443,30 @@ static int init_chip(struct net_device *dev) u32 wilc_get_chipid(struct wilc *wilc, bool update) { - static u32 chipid; - u32 tempchipid = 0; + u32 chipid = 0; u32 rfrevid = 0; - if (chipid == 0 || update) { - wilc->hif_func->hif_read_reg(wilc, WILC_CHIPID, &tempchipid); + if (wilc->chipid == 0 || update) { + wilc->hif_func->hif_read_reg(wilc, WILC_CHIPID, &chipid); wilc->hif_func->hif_read_reg(wilc, WILC_RF_REVISION_ID, &rfrevid); - if (!is_wilc1000(tempchipid)) { - chipid = 0; - return chipid; + if (!is_wilc1000(chipid)) { + wilc->chipid = 0; + return wilc->chipid; } - if (tempchipid == WILC_1000_BASE_ID_2A) { /* 0x1002A0 */ + if (chipid == WILC_1000_BASE_ID_2A) { /* 0x1002A0 */ if (rfrevid != 0x1) - tempchipid = WILC_1000_BASE_ID_2A_REV1; - } else if (tempchipid == WILC_1000_BASE_ID_2B) { /* 0x1002B0 */ + chipid = WILC_1000_BASE_ID_2A_REV1; + } else if (chipid == WILC_1000_BASE_ID_2B) { /* 0x1002B0 */ if (rfrevid == 0x4) - tempchipid = WILC_1000_BASE_ID_2B_REV1; + chipid = WILC_1000_BASE_ID_2B_REV1; else if (rfrevid != 0x3) - tempchipid = WILC_1000_BASE_ID_2B_REV2; + chipid = WILC_1000_BASE_ID_2B_REV2; } - chipid = tempchipid; + wilc->chipid = chipid; } - return chipid; + return wilc->chipid; } int wilc_wlan_init(struct net_device *dev) -- 2.25.1