Skip to contentSkip to conversation

wifi: ath9k: mark PN9Data as const

PATCH Superseded Rosen Penev 2 participants 3 messages Jun 16 – Jun 18 Qualcomm Atheros ATH9K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath9k: mark PN9Data as const

PN9Data is a read-only lookup table and is never modified. Adding const lets the compiler place it in .rodata and prevents accidental writes.

Assisted-by opencode:big-pickle
---
 drivers/net/wireless/ath/ath9k/tx99.c | 16 ++++++++--------
 drivers/net/wireless/ath/ath9k/xmit.c |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/tx99.c +8 -8
index f2144fd39093..b52d84f6cbc9 100644
@@ -39,14 +39,14 @@ static void ath9k_tx99_stop(struct ath_softc *sc)
 
 static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
 {
-	static u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
-			       0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
-			       0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
-			       0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
-			       0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
-			       0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
-			       0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
-			       0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
+	static const u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
+			             0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
+			             0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
+			             0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
+			             0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
+			             0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
+			             0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
+			             0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
 	u32 len = 1200;
 	struct ieee80211_tx_rate *rate;
 	struct ieee80211_hw *hw = sc->hw;
drivers/net/wireless/ath/ath9k/xmit.c +1 -1
index 89d8b3178784..57e451548958 100644
@@ -41,7 +41,7 @@
 #define ATH9K_PWRTBL_11NG_HT_SHIFT      12
 
 
-static u16 bits_per_symbol[][2] = {
+static const u16 bits_per_symbol[][2] = {
 	/* 20MHz 40MHz */
 	{    26,   54 },     /*  0: BPSK */
 	{    52,  108 },     /*  1: QPSK 1/2 */

--
2.54.0

#1 lore raw
Quoted 42 lines · Rosen Penev

PN9Data is a read-only lookup table and is never modified. Adding const lets the compiler place it in .rodata and prevents accidental writes.

Assisted-by opencode:big-pickle
---
 drivers/net/wireless/ath/ath9k/tx99.c | 16 ++++++++--------
 drivers/net/wireless/ath/ath9k/xmit.c |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/tx99.c +8 -8
index f2144fd39093..b52d84f6cbc9 100644
@@ -39,14 +39,14 @@ static void ath9k_tx99_stop(struct ath_softc *sc)
 
 static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
 {
-	static u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
-			       0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
-			       0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
-			       0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
-			       0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
-			       0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
-			       0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
-			       0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
+	static const u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
+			             0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
+			             0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
+			             0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
+			             0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
+			             0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
+			             0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
+			             0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
 	u32 len = 1200;
 	struct ieee80211_tx_rate *rate;
 	struct ieee80211_hw *hw = sc->hw;
drivers/net/wireless/ath/ath9k/xmit.c +0 -0
index 89d8b3178784..57e451548958 100644

drivers/net/wireless/ath/ath9k/xmit.c line 44

Quoted 5 lines
drivers/net/wireless/ath/ath9k/xmit.c +1 -1
@@ -41,7 +41,7 @@
 #define ATH9K_PWRTBL_11NG_HT_SHIFT      12
 
 
-static u16 bits_per_symbol[][2] = {
+static const u16 bits_per_symbol[][2] = {

unrelated change not mentioned in the commit text?

Quoted 5 lines
drivers/net/wireless/ath/ath9k/xmit.c +0 -1
 	/* 20MHz 40MHz */
 	{    26,   54 },     /*  0: BPSK */
 	{    52,  108 },     /*  1: QPSK 1/2 */
--

2.54.0

#2 lore raw
Quoted 47 lines · Jeff Johnson
Quoted 45 lines · Rosen Penev

PN9Data is a read-only lookup table and is never modified. Adding const lets the compiler place it in .rodata and prevents accidental writes.

Assisted-by opencode:big-pickle
---
 drivers/net/wireless/ath/ath9k/tx99.c | 16 ++++++++--------
 drivers/net/wireless/ath/ath9k/xmit.c |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/tx99.c +8 -8
index f2144fd39093..b52d84f6cbc9 100644
@@ -39,14 +39,14 @@ static void ath9k_tx99_stop(struct ath_softc *sc)
 
 static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
 {
-     static u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
-                            0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
-                            0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
-                            0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
-                            0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
-                            0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
-                            0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
-                            0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
+     static const u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
+                                  0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
+                                  0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
+                                  0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
+                                  0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
+                                  0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
+                                  0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
+                                  0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
      u32 len = 1200;
      struct ieee80211_tx_rate *rate;
      struct ieee80211_hw *hw = sc->hw;
drivers/net/wireless/ath/ath9k/xmit.c +0 -0
index 89d8b3178784..57e451548958 100644
@@ -41,7 +41,7 @@
 #define ATH9K_PWRTBL_11NG_HT_SHIFT      12
 
 
Quoted 4 lines

drivers/net/wireless/ath/ath9k/xmit.c line 44

Quoted 2 lines
drivers/net/wireless/ath/ath9k/xmit.c +1 -1
-static u16 bits_per_symbol[][2] = {
+static const u16 bits_per_symbol[][2] = {

unrelated change not mentioned in the commit text?

Yeah. Will do in v2.

Quoted 7 lines
Quoted 6 lines
drivers/net/wireless/ath/ath9k/xmit.c +0 -1
      /* 20MHz 40MHz */
      {    26,   54 },     /*  0: BPSK */
      {    52,  108 },     /*  1: QPSK 1/2 */
--

2.54.0