From patchwork Wed Mar 20 17:06:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13598026 X-Patchwork-Delegate: kvalo@adurom.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60E5369DFF for ; Wed, 20 Mar 2024 17:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954420; cv=none; b=jj9VVu3359T1CAGnzJyduwk7l3UXhrJLeEawTsJqSBkXIt4ZXnzHcOlsWyVbrZ5S+3YgI+60nlD+WZef/UnzpeTXwF4JgVoSzTIXJ+w/ge5uNSb7OxuGDRRl377mMClvT1nc1yKdoLMGH/IbUDvNj5FxFjLKqRcOViY+5WzVRDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954420; c=relaxed/simple; bh=DUxuvt+EOgdceiAGNNxvFz0FDIS7bKghTm0uubPaxq0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gG9uyjb39urhL+JSNOakGXqV7LVr2eQr+JAvle4yC5IvHU97MsIOgpf4IibLzRBoYYIvoIGdVx43eNzp5A+6zf87AZbjxbyAFNLrOVXp2xhl8Gs7JiSKpisQxUyKBADc1/kQmxK0CqCP+qcvh1VX0Gt4wbCrjglxEHIC9beME7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gs85bH2/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gs85bH2/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37A89C433C7; Wed, 20 Mar 2024 17:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710954419; bh=DUxuvt+EOgdceiAGNNxvFz0FDIS7bKghTm0uubPaxq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gs85bH2/3HzUT4wN6qYiX01bc/SOiLLPIaOLogA8NIMelZT3fmQgOFwbQ/PoBwwyU 6abUQ5Kg7X4MJvJ+PY0z+s0Eg8qaFN++se7180Ip8mCZ2dC2E7XlNu+RB9xq+d8kzl gO/EL7vPGcycS+BXsOCTpdyZ8DOHD4VnX1hlD1xZkNPNz0SOhRA2Nn6j68iHqs5LY2 St+J2O3m/tWVpjgSbkLVw9qZX3QORgkLc/Si3dy4a4dCjXXJFSVld/FQbrMLKpKtZi Bkfp9W84odVhmRGBjZE/mgHYJiqlhS/4HTB05amkAMO0WT9iJYgpy/Pm7Ry4ojCsOn DyO6Yw+6D7Haw== From: Kalle Valo To: toke@toke.dk Cc: linux-wireless@vger.kernel.org Subject: [PATCH 1/3] wifi: ath9k: ath9k_set_moredata(): fix sparse warnings Date: Wed, 20 Mar 2024 19:06:54 +0200 Message-Id: <20240320170656.3534265-2-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320170656.3534265-1-kvalo@kernel.org> References: <20240320170656.3534265-1-kvalo@kernel.org> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kalle Valo Sparse warns: drivers/net/wireless/ath/ath9k/xmit.c:1677:20: warning: incorrect type in initializer (different base types) drivers/net/wireless/ath/ath9k/xmit.c:1677:20: expected unsigned short [usertype] mask drivers/net/wireless/ath/ath9k/xmit.c:1677:20: got restricted __le16 [usertype] drivers/net/wireless/ath/ath9k/xmit.c:1681:17: warning: restricted __le16 degrades to integer drivers/net/wireless/ath/ath9k/xmit.c:1682:42: warning: restricted __le16 degrades to integer drivers/net/wireless/ath/ath9k/xmit.c:1682:36: warning: incorrect type in assignment (different base types) drivers/net/wireless/ath/ath9k/xmit.c:1682:36: expected restricted __le16 [usertype] frame_control drivers/net/wireless/ath/ath9k/xmit.c:1682:36: got int Fix ath9k_set_moredata() to use __le16 with masks and use if statement instead of multiply operator. Compile tested only. Signed-off-by: Kalle Valo Acked-by: Jeff Johnson Acked-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/xmit.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index d519b676a109..35aa47a9db90 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -1674,8 +1674,14 @@ static void ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val) { struct ieee80211_hdr *hdr; - u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA); - u16 mask_val = mask * val; + __le16 mask, mask_val; + + mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA); + + if (val) + mask_val = mask; + else + mask_val = 0; hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; if ((hdr->frame_control & mask) != mask_val) { From patchwork Wed Mar 20 17:06:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13598027 X-Patchwork-Delegate: kvalo@adurom.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CCAB6A01C for ; Wed, 20 Mar 2024 17:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954421; cv=none; b=B10PJ3WfZBILFL4NbtxStS5Zg1Fd1T+8DxU64X8Blhi6SVaVgYJdfW37o81lnPe6cz55Ums745qtu46/z9o2vlg+sGIuqXBrri2EY/E2GtvhuYR662UAxMMWWsOgrfOyKqOcTQ82uzrLBqNBXZKiLnWcHTEPCGP32M9qjaKTezY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954421; c=relaxed/simple; bh=3oVIDyfU9AbyJddK/V9yEYzg8fnE5awHx0dwfTl+eSI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lwIpWL3JQDmj9nDLbKR6VXUotSCODoDydsp/jyq/9Ci8t6FKZpz8YAZZOTS+RX+pTEikBjQin1+EiZbzxHuYAIr7AGjUZs7zOx0nVtW6wWEqkjK8gqOdyr6UfGLQtrVHacH6w0tnEUCcYYQ6QDdOuPj/OjrTW7HTgR6MUjfunsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sg94xf0y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sg94xf0y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60BF3C43390; Wed, 20 Mar 2024 17:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710954421; bh=3oVIDyfU9AbyJddK/V9yEYzg8fnE5awHx0dwfTl+eSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sg94xf0ySjDMK9MX/8mc/o3Vu++gqnoX/AzSarvDazcAzDY2spxdPeo2Cf/uHOXQf u50arUGCX/3ImY12ooHndlQJ0G0+kCATvRa7EOij2XwaoajYhjivWH2k/f3iUk2y4+ akfNiSQAZFA5KyT0la7xesK/zrOu3eY0plgILodiWq4GXzyVOvEdy5RO43Uu2fC7vY rO/PhU0DDYn2Qor+T4sEIEPwek3sESHYkz8ZxI0jHp48StR1CAsn/sXYrhnlUmsLZc PEGBRZXhPQtBQL/hJ9nptqLnlkGU2Je/PPSzVKJEyzdR/xAQe2YS61yOOZmDAU0Dfc TYHecGClJixRQ== From: Kalle Valo To: toke@toke.dk Cc: linux-wireless@vger.kernel.org Subject: [PATCH 2/3] wifi: ath9k: fix ath9k_use_msi declaration Date: Wed, 20 Mar 2024 19:06:55 +0200 Message-Id: <20240320170656.3534265-3-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320170656.3534265-1-kvalo@kernel.org> References: <20240320170656.3534265-1-kvalo@kernel.org> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kalle Valo Sparse warns: drivers/net/wireless/ath/ath9k/init.c:79:5: warning: symbol 'ath9k_use_msi' was not declared. Should it be static? Move the extern to ath9k.h so that it's visible in init.c. Compile tested only. Signed-off-by: Kalle Valo Acked-by: Jeff Johnson Acked-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/pci.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 668fc07b3073..29ca65a732a6 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h @@ -39,6 +39,7 @@ extern int ath9k_modparam_nohwcrypt; extern int ath9k_led_blink; extern bool is_ath9k_unloaded; extern int ath9k_use_chanctx; +extern int ath9k_use_msi; /*************************/ /* Descriptor Management */ diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index e655cd8bbf94..1ff53520f0a3 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -21,8 +21,6 @@ #include #include "ath9k.h" -extern int ath9k_use_msi; - static const struct pci_device_id ath_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x0023) }, /* PCI */ { PCI_VDEVICE(ATHEROS, 0x0024) }, /* PCI-E */ From patchwork Wed Mar 20 17:06:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13598028 X-Patchwork-Delegate: kvalo@adurom.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97E616A033 for ; Wed, 20 Mar 2024 17:07:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954422; cv=none; b=PGK9KD6JWOeYDZMjWyvWuHwA77UtLcCz/Sqf2iFuc1nqtK01Z5nsVYf9KnAzJKPHh4/luqn1zJrH+CJFp9bH9yDZzlXFuEKfqeZFSFTL+QE6cmPn4TGr1Gu4BJtLtta2KYLXWtP0zCl+90MI9q2NCYOAuBHyTyRydNIvJb5WTug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954422; c=relaxed/simple; bh=MJIuwMNyBaP6c/MES5ezK1cro0kM8LG+AbXPwf4yrxk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hZf0KpV8I8v7TdF3+K6xTU4lcmpHy+2DaKCr+fbPnfkN9TROq8XzbP19R7TzEjo/TZPHEXkVOb/06XtznxmHxiXX7xR/VIBXN9iRF/kKXnX5j+7PYlUSphZ24SvXpiLyvs5yLdUkTXiqRHldEO+ThkxioE/k5UgrOl6Ba3dkIis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AqMp6IT4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AqMp6IT4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ABD6C433F1; Wed, 20 Mar 2024 17:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710954422; bh=MJIuwMNyBaP6c/MES5ezK1cro0kM8LG+AbXPwf4yrxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqMp6IT4pJbQRgiBGOc4ANGThv5cYwE50IPjsvgI2Rc+Ie5lRmYD5wnXZJnl2084P 65APS5YUKUAk25hjUwJ+kPu8GqYNf+hAx268YGdo+GlARSl1I91QExghoWxOK3rkQF W4L8+lk3LyK0ycbr1Ibyzloi+NreWL1SEjxGL8WmAZwD391+3uSCaM2w7sS+rim60n eqvfYnFp6GepmaVOrj7x0qG1JwltlXIgCHEnMN90zyXHLshx9Myave9vsQPQIE5s6t uY8UIcvbg2UAZyiSmQJuhgXkF7EyNvR3+GE/oWZ+P0DMA5xiYQwMhottXnYAZuBqHV HOIb8EsX5fQ3w== From: Kalle Valo To: toke@toke.dk Cc: linux-wireless@vger.kernel.org Subject: [PATCH 3/3] wifi: ath9k: eeprom: fix sparse endian warnings Date: Wed, 20 Mar 2024 19:06:56 +0200 Message-Id: <20240320170656.3534265-4-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320170656.3534265-1-kvalo@kernel.org> References: <20240320170656.3534265-1-kvalo@kernel.org> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kalle Valo Sparse warns: drivers/net/wireless/ath/ath9k/eeprom_9287.c:82:9: warning: cast to restricted __le16 drivers/net/wireless/ath/ath9k/eeprom_9287.c:82:9: warning: cast from restricted __le32 drivers/net/wireless/ath/ath9k/eeprom_9287.c:83:9: warning: cast to restricted __le16 drivers/net/wireless/ath/ath9k/eeprom_9287.c:83:9: warning: cast from restricted __le32 drivers/net/wireless/ath/ath9k/eeprom_def.c:138:9: warning: cast to restricted __le16 drivers/net/wireless/ath/ath9k/eeprom_def.c:138:9: warning: cast from restricted __le32 drivers/net/wireless/ath/ath9k/eeprom_def.c:139:9: warning: cast to restricted __le16 drivers/net/wireless/ath/ath9k/eeprom_def.c:139:9: warning: cast from restricted __le32 drivers/net/wireless/ath/ath9k/eeprom_def.c:140:9: warning: cast to restricted __le16 drivers/net/wireless/ath/ath9k/eeprom_def.c:140:9: warning: cast from restricted __le32 drivers/net/wireless/ath/ath9k/eeprom_4k.c:79:9: warning: cast to restricted __le16 drivers/net/wireless/ath/ath9k/eeprom_4k.c:79:9: warning: cast from restricted __le32 antCtrlChain is an array of __le32 so le32_to_cpu() needs to be used. Compile tested only. Signed-off-by: Kalle Valo Acked-by: Jeff Johnson Acked-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 2 +- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 4 ++-- drivers/net/wireless/ath/ath9k/eeprom_def.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index e8c2cc03be0c..27b860b0c769 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c @@ -76,7 +76,7 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) static u32 ath9k_dump_4k_modal_eeprom(char *buf, u32 len, u32 size, struct modal_eep_4k_header *modal_hdr) { - PR_EEP("Chain0 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[0])); + PR_EEP("Chain0 Ant. Control", le32_to_cpu(modal_hdr->antCtrlChain[0])); PR_EEP("Ant. Common Control", le32_to_cpu(modal_hdr->antCtrlCommon)); PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]); PR_EEP("Switch Settle", modal_hdr->switchSettling); diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index fd5312c2a7e3..d85472ee4d85 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c @@ -79,8 +79,8 @@ static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) static u32 ar9287_dump_modal_eeprom(char *buf, u32 len, u32 size, struct modal_eep_ar9287_header *modal_hdr) { - PR_EEP("Chain0 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[0])); - PR_EEP("Chain1 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[1])); + PR_EEP("Chain0 Ant. Control", le32_to_cpu(modal_hdr->antCtrlChain[0])); + PR_EEP("Chain1 Ant. Control", le32_to_cpu(modal_hdr->antCtrlChain[1])); PR_EEP("Ant. Common Control", le32_to_cpu(modal_hdr->antCtrlCommon)); PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]); PR_EEP("Chain1 Ant. Gain", modal_hdr->antennaGainCh[1]); diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 7685f8ab371e..84b31caf8ca6 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c @@ -135,9 +135,9 @@ static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah) static u32 ath9k_def_dump_modal_eeprom(char *buf, u32 len, u32 size, struct modal_eep_header *modal_hdr) { - PR_EEP("Chain0 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[0])); - PR_EEP("Chain1 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[1])); - PR_EEP("Chain2 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[2])); + PR_EEP("Chain0 Ant. Control", le32_to_cpu(modal_hdr->antCtrlChain[0])); + PR_EEP("Chain1 Ant. Control", le32_to_cpu(modal_hdr->antCtrlChain[1])); + PR_EEP("Chain2 Ant. Control", le32_to_cpu(modal_hdr->antCtrlChain[2])); PR_EEP("Ant. Common Control", le32_to_cpu(modal_hdr->antCtrlCommon)); PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]); PR_EEP("Chain1 Ant. Gain", modal_hdr->antennaGainCh[1]);