2023-11-18 08:51:22

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 00/10] staging: rtl8192e: Remove constant variable channel_plan

Remove constant variable channel_plan to increase readability of the code.

Tested with rtl8192e (WLL6130-D99) in Mode n (12.5 MB/s)
Transferred this patch over wlan connection of rtl8192e.
Tested on Channels: 1, 2, 10, 13

Philipp Hortmann (10):
staging: rtl8192e: Remove unused return value of rtl92e_set_channel()
staging: rtl8192e: Change parameter "ch" of set_chan() to u8
staging: rtl8192e: Unwind pointer to pointer to rtl92e_set_channel()
staging: rtl8192e: Remove equation that results in constant for
chnl_plan
staging: rtl8192e: Remove constant variable chnl_plan
staging: rtl8192e: Remove unused variable eeprom_chnl_plan
staging: rtl8192e: Remove equation to check limits of channel
staging: rtl8192e: Remove check if channel_array[channel_plan].len !=
0
staging: rtl8192e: Remove switch for a constant in
dot11d_channel_map()
staging: rtl8192e: Remove constant index from channel_array[]

drivers/staging/rtl8192e/dot11d.c | 63 +++----------------
drivers/staging/rtl8192e/dot11d.h | 2 +-
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 12 ----
.../staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ++--
.../staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 20 +-----
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 --
drivers/staging/rtl8192e/rtllib.h | 2 +-
8 files changed, 21 insertions(+), 96 deletions(-)

--
2.42.0


2023-11-18 08:51:45

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 01/10] staging: rtl8192e: Remove unused return value of rtl92e_set_channel()

Remove unused return value of rtl92e_set_channel().

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ++++++------
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 4d12d7385041..e1bd4d67e862 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -671,16 +671,16 @@ static void _rtl92e_phy_switch_channel_work_item(struct net_device *dev)
_rtl92e_phy_switch_channel(dev, priv->chan);
}

-u8 rtl92e_set_channel(struct net_device *dev, u8 channel)
+void rtl92e_set_channel(struct net_device *dev, u8 channel)
{
struct r8192_priv *priv = rtllib_priv(dev);

if (!priv->up) {
netdev_err(dev, "%s(): Driver is not initialized\n", __func__);
- return false;
+ return;
}
if (priv->sw_chnl_in_progress)
- return false;
+ return;

switch (priv->rtllib->mode) {
case WIRELESS_MODE_B:
@@ -688,7 +688,7 @@ u8 rtl92e_set_channel(struct net_device *dev, u8 channel)
netdev_warn(dev,
"Channel %d not available in 802.11b.\n",
channel);
- return false;
+ return;
}
break;
case WIRELESS_MODE_G:
@@ -697,7 +697,7 @@ u8 rtl92e_set_channel(struct net_device *dev, u8 channel)
netdev_warn(dev,
"Channel %d not available in 802.11g.\n",
channel);
- return false;
+ return;
}
break;
}
@@ -714,7 +714,7 @@ u8 rtl92e_set_channel(struct net_device *dev, u8 channel)
if (priv->up)
_rtl92e_phy_switch_channel_work_item(dev);
priv->sw_chnl_in_progress = false;
- return true;
+ return;
}

static void _rtl92e_cck_tx_power_track_bw_switch_tssi(struct net_device *dev)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
index 6c4c33ded6a9..ff4b4004b0d0 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
@@ -41,7 +41,7 @@ void rtl92e_get_tx_power(struct net_device *dev);
void rtl92e_set_tx_power(struct net_device *dev, u8 channel);
u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath);

-u8 rtl92e_set_channel(struct net_device *dev, u8 channel);
+void rtl92e_set_channel(struct net_device *dev, u8 channel);
void rtl92e_set_bw_mode(struct net_device *dev,
enum ht_channel_width bandwidth,
enum ht_extchnl_offset Offset);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index a4afbf3e934d..9b0be6dff627 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -228,7 +228,7 @@ struct r8192_priv {
struct rt_stats stats;
struct iw_statistics wstats;

- u8 (*rf_set_chan)(struct net_device *dev, u8 ch);
+ void (*rf_set_chan)(struct net_device *dev, u8 ch);

struct rx_desc *rx_ring;
struct sk_buff *rx_buf[MAX_RX_COUNT];
--
2.42.0

2023-11-18 08:51:46

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 02/10] staging: rtl8192e: Change parameter "ch" of set_chan() to u8

Change parameter "ch" of set_chan() to u8 to combine functions in the
following patch.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
drivers/staging/rtl8192e/rtllib.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 995daab906c9..98b25768f614 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -226,7 +226,7 @@ static void _rtl92e_tx_timeout(struct net_device *dev, unsigned int txqueue)
netdev_info(dev, "TXTIMEOUT");
}

-static void _rtl92e_set_chan(struct net_device *dev, short ch)
+static void _rtl92e_set_chan(struct net_device *dev, u8 ch)
{
struct r8192_priv *priv = rtllib_priv(dev);

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index adaab56a9fb1..1d0878d1f696 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1469,7 +1469,7 @@ struct rtllib_device {
* This function can sleep. the driver should ensure
* the radio has been switched before return.
*/
- void (*set_chan)(struct net_device *dev, short ch);
+ void (*set_chan)(struct net_device *dev, u8 ch);

/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
--
2.42.0

2023-11-18 08:52:08

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 04/10] staging: rtl8192e: Remove equation that results in constant for chnl_plan

Remove equation for chnl_plan as the last line sets chnl_plan to a
constant.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index e93394c51264..44898e0be21c 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -387,23 +387,15 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)

rtl92e_init_adaptive_rate(dev);

- priv->chnl_plan = priv->eeprom_chnl_plan;
-
switch (priv->eeprom_customer_id) {
case EEPROM_CID_NetCore:
priv->customer_id = RT_CID_819X_NETCORE;
break;
case EEPROM_CID_TOSHIBA:
priv->customer_id = RT_CID_TOSHIBA;
- if (priv->eeprom_chnl_plan & 0x80)
- priv->chnl_plan = priv->eeprom_chnl_plan & 0x7f;
- else
- priv->chnl_plan = 0x0;
break;
}

- if (priv->chnl_plan > CHANNEL_PLAN_LEN - 1)
- priv->chnl_plan = 0;
priv->chnl_plan = COUNTRY_CODE_WORLD_WIDE_13;

if (priv->eeprom_vid == 0x1186 && priv->eeprom_did == 0x3304)
--
2.42.0

2023-11-18 08:52:13

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 03/10] staging: rtl8192e: Unwind pointer to pointer to rtl92e_set_channel()

Replace pointer to function to pointer to rtl92e_set_channel() with
pointer to rtl92e_set_channel(). This increases readability of the code.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 13 +------------
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 --
2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 98b25768f614..2789f428e4f9 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -226,16 +226,6 @@ static void _rtl92e_tx_timeout(struct net_device *dev, unsigned int txqueue)
netdev_info(dev, "TXTIMEOUT");
}

-static void _rtl92e_set_chan(struct net_device *dev, u8 ch)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
-
- priv->chan = ch;
-
- if (priv->rf_set_chan)
- priv->rf_set_chan(dev, priv->chan);
-}
-
static void _rtl92e_update_cap(struct net_device *dev, u16 cap)
{
struct r8192_priv *priv = rtllib_priv(dev);
@@ -685,7 +675,7 @@ static void _rtl92e_init_priv_handler(struct net_device *dev)
struct r8192_priv *priv = rtllib_priv(dev);

priv->rtllib->softmac_hard_start_xmit = _rtl92e_hard_start_xmit;
- priv->rtllib->set_chan = _rtl92e_set_chan;
+ priv->rtllib->set_chan = rtl92e_set_channel;
priv->rtllib->link_change = rtl92e_link_change;
priv->rtllib->softmac_data_hard_start_xmit = _rtl92e_hard_data_xmit;
priv->rtllib->check_nic_enough_desc = _rtl92e_check_nic_enough_desc;
@@ -694,7 +684,6 @@ static void _rtl92e_init_priv_handler(struct net_device *dev)
priv->rtllib->set_wireless_mode = rtl92e_set_wireless_mode;
priv->rtllib->leisure_ps_leave = rtl92e_leisure_ps_leave;
priv->rtllib->set_bw_mode_handler = rtl92e_set_bw_mode;
- priv->rf_set_chan = rtl92e_set_channel;

priv->rtllib->sta_wake_up = rtl92e_hw_wakeup;
priv->rtllib->enter_sleep_state = rtl92e_enter_sleep;
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index 9b0be6dff627..348df71e122e 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -228,8 +228,6 @@ struct r8192_priv {
struct rt_stats stats;
struct iw_statistics wstats;

- void (*rf_set_chan)(struct net_device *dev, u8 ch);
-
struct rx_desc *rx_ring;
struct sk_buff *rx_buf[MAX_RX_COUNT];
dma_addr_t rx_ring_dma;
--
2.42.0

2023-11-18 08:52:26

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 05/10] staging: rtl8192e: Remove constant variable chnl_plan

Remove constant variable chnl_plan and replace it with its constant.
Remove equation that limits maximum value of chnl_plan as it is always
false.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 --
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 +------
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 -
3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 44898e0be21c..9b51deba149b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -396,8 +396,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
break;
}

- priv->chnl_plan = COUNTRY_CODE_WORLD_WIDE_13;
-
if (priv->eeprom_vid == 0x1186 && priv->eeprom_did == 0x3304)
priv->rtllib->bSupportRemoteWakeUp = true;
else
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 2789f428e4f9..68bd03500267 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -795,13 +795,8 @@ static short _rtl92e_get_channel_map(struct net_device *dev)

struct r8192_priv *priv = rtllib_priv(dev);

- if (priv->chnl_plan >= COUNTRY_CODE_MAX) {
- netdev_info(dev,
- "rtl819x_init:Error channel plan! Set to default.\n");
- priv->chnl_plan = COUNTRY_CODE_FCC;
- }
dot11d_init(priv->rtllib);
- dot11d_channel_map(priv->chnl_plan, priv->rtllib);
+ dot11d_channel_map(COUNTRY_CODE_WORLD_WIDE_13, priv->rtllib);
for (i = 1; i <= 11; i++)
(priv->rtllib->active_channel_map)[i] = 1;
(priv->rtllib->active_channel_map)[12] = 2;
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index 348df71e122e..addaa1eb39ee 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -310,7 +310,6 @@ struct r8192_priv {

bool tx_pwr_data_read_from_eeprom;

- u16 chnl_plan;
u8 hw_rf_off_action;

bool rf_change_in_progress;
--
2.42.0

2023-11-18 08:52:30

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 08/10] staging: rtl8192e: Remove check if channel_array[channel_plan].len != 0

channel_plan is constant COUNTRY_CODE_WORLD_WIDE_13. Remove equation to
check length of array as it is always not 0.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/dot11d.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c
index bb7b5c793b26..b515008045bd 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -55,13 +55,11 @@ void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee)

ieee->global_domain = false;

- if (channel_array[channel_plan].len != 0) {
- memset(GET_DOT11D_INFO(ieee)->channel_map, 0,
- sizeof(GET_DOT11D_INFO(ieee)->channel_map));
- for (i = 0; i < channel_array[channel_plan].len; i++) {
- GET_DOT11D_INFO(ieee)->channel_map[channel_array
- [channel_plan].channel[i]] = 1;
- }
+ memset(GET_DOT11D_INFO(ieee)->channel_map, 0,
+ sizeof(GET_DOT11D_INFO(ieee)->channel_map));
+ for (i = 0; i < channel_array[channel_plan].len; i++) {
+ GET_DOT11D_INFO(ieee)->channel_map[channel_array
+ [channel_plan].channel[i]] = 1;
}

switch (channel_plan) {
--
2.42.0

2023-11-18 08:52:34

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 07/10] staging: rtl8192e: Remove equation to check limits of channel

channel_plan is constant COUNTRY_CODE_WORLD_WIDE_13. Remove equation to
check limits of channel as those are always in limit.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/dot11d.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c
index d0b7332645be..bb7b5c793b26 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -51,7 +51,7 @@ EXPORT_SYMBOL(dot11d_init);

void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee)
{
- int i, max_chan = 14, min_chan = 1;
+ int i;

ieee->global_domain = false;

@@ -59,9 +59,6 @@ void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee)
memset(GET_DOT11D_INFO(ieee)->channel_map, 0,
sizeof(GET_DOT11D_INFO(ieee)->channel_map));
for (i = 0; i < channel_array[channel_plan].len; i++) {
- if (channel_array[channel_plan].channel[i] < min_chan ||
- channel_array[channel_plan].channel[i] > max_chan)
- break;
GET_DOT11D_INFO(ieee)->channel_map[channel_array
[channel_plan].channel[i]] = 1;
}
--
2.42.0

2023-11-18 08:52:53

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 09/10] staging: rtl8192e: Remove switch for a constant in dot11d_channel_map()

Remove switch for a constant in dot11d_channel_map() as the result will
always be the same.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/dot11d.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c
index b515008045bd..37106fd54f00 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -62,24 +62,9 @@ void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee)
[channel_plan].channel[i]] = 1;
}

- switch (channel_plan) {
- case COUNTRY_CODE_GLOBAL_DOMAIN:
- ieee->global_domain = true;
- for (i = 12; i <= 14; i++)
- GET_DOT11D_INFO(ieee)->channel_map[i] = 2;
- ieee->bss_start_channel = 10;
- break;
-
- case COUNTRY_CODE_WORLD_WIDE_13:
- for (i = 12; i <= 13; i++)
- GET_DOT11D_INFO(ieee)->channel_map[i] = 2;
- ieee->bss_start_channel = 10;
- break;
-
- default:
- ieee->bss_start_channel = 1;
- break;
- }
+ for (i = 12; i <= 13; i++)
+ GET_DOT11D_INFO(ieee)->channel_map[i] = 2;
+ ieee->bss_start_channel = 10;
}
EXPORT_SYMBOL(dot11d_channel_map);

--
2.42.0

2023-11-18 08:53:00

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 10/10] staging: rtl8192e: Remove constant index from channel_array[]

Used index of channel_array[] is always COUNTRY_CODE_WORLD_WIDE_13. Remove
index and store only used entry in channel_array. This shortens the code
and increases readability.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/dot11d.c | 31 +++-----------------
drivers/staging/rtl8192e/dot11d.h | 2 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
3 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c
index 37106fd54f00..fdc39e6e7abb 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -12,28 +12,7 @@ struct channel_list {
u8 len;
};

-static struct channel_list channel_array[] = {
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64,
- 149, 153, 157, 161, 165}, 24},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56,
- 60, 64}, 21},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52,
- 56, 60, 64}, 22},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52,
- 56, 60, 64}, 22},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52,
- 56, 60, 64}, 22},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52,
- 56, 60, 64}, 22},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13},
- {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52,
- 56, 60, 64}, 21}
-};
+static struct channel_list channel_array = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13};

void dot11d_init(struct rtllib_device *ieee)
{
@@ -49,7 +28,7 @@ void dot11d_init(struct rtllib_device *ieee)
}
EXPORT_SYMBOL(dot11d_init);

-void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee)
+void dot11d_channel_map(struct rtllib_device *ieee)
{
int i;

@@ -57,10 +36,8 @@ void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee)

memset(GET_DOT11D_INFO(ieee)->channel_map, 0,
sizeof(GET_DOT11D_INFO(ieee)->channel_map));
- for (i = 0; i < channel_array[channel_plan].len; i++) {
- GET_DOT11D_INFO(ieee)->channel_map[channel_array
- [channel_plan].channel[i]] = 1;
- }
+ for (i = 0; i < channel_array.len; i++)
+ GET_DOT11D_INFO(ieee)->channel_map[channel_array.channel[i]] = 1;

for (i = 12; i <= 13; i++)
GET_DOT11D_INFO(ieee)->channel_map[i] = 2;
diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h
index 6d2b93acfa43..78d1ca1e7743 100644
--- a/drivers/staging/rtl8192e/dot11d.h
+++ b/drivers/staging/rtl8192e/dot11d.h
@@ -75,7 +75,7 @@ static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__ieee_dev)
#define UPDATE_CIE_WATCHDOG(__ieee_dev) (++GET_CIE_WATCHDOG(__ieee_dev))

void dot11d_init(struct rtllib_device *dev);
-void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee);
+void dot11d_channel_map(struct rtllib_device *ieee);
void dot11d_reset(struct rtllib_device *dev);
void dot11d_update_country(struct rtllib_device *dev, u8 *address,
u16 country_len, u8 *country);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 68bd03500267..4b842a1789c2 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -796,7 +796,7 @@ static short _rtl92e_get_channel_map(struct net_device *dev)
struct r8192_priv *priv = rtllib_priv(dev);

dot11d_init(priv->rtllib);
- dot11d_channel_map(COUNTRY_CODE_WORLD_WIDE_13, priv->rtllib);
+ dot11d_channel_map(priv->rtllib);
for (i = 1; i <= 11; i++)
(priv->rtllib->active_channel_map)[i] = 1;
(priv->rtllib->active_channel_map)[12] = 2;
--
2.42.0

2023-11-18 08:53:25

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 06/10] staging: rtl8192e: Remove unused variable eeprom_chnl_plan

Remove unused variable eeprom_chnl_plan.

Signed-off-by: Philipp Hortmann <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 --
drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 -
2 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 9b51deba149b..8fe4c03b19c1 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -261,7 +261,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
priv->eeprom_customer_id = usValue & 0xff;
usValue = rtl92e_eeprom_read(dev,
EEPROM_ICVersion_ChannelPlan >> 1);
- priv->eeprom_chnl_plan = usValue & 0xff;
IC_Version = (usValue & 0xff00) >> 8;

ICVer8192 = IC_Version & 0xf;
@@ -283,7 +282,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
priv->eeprom_vid = 0;
priv->eeprom_did = 0;
priv->eeprom_customer_id = 0;
- priv->eeprom_chnl_plan = 0;
}

if (!priv->autoload_fail_flag) {
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
index addaa1eb39ee..e7b331c4661c 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h
@@ -284,7 +284,6 @@ struct r8192_priv {
u16 eeprom_vid;
u16 eeprom_did;
u8 eeprom_customer_id;
- u16 eeprom_chnl_plan;

u8 eeprom_tx_pwr_level_cck[14];
u8 eeprom_tx_pwr_level_ofdm24g[14];
--
2.42.0