* [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon()
@ 2023-09-12 19:27 Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 1/8] staging: rtl8192e: Remove useless equation in debug output Philipp Hortmann
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:27 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Remove useless equation in debug output.
Use standard functions like ieee80211_is_beacon().
Optimize code for improved readability.
Tested with rtl8192e (WLL6130-D99) in Mode n (12.5 MB/s)
Transferred this patch over wlan connection of rtl8192e.
---
v1->v2: Only patch 4/8 was changed
Take wrongly removed definition of fc back in.
Philipp Hortmann (8):
staging: rtl8192e: Remove useless equation in debug output
staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt()
staging: rtl8192e: Use standard function in
rtllib_process_probe_response()
staging: rtl8192e: Use standard function in
rtllib_rx_check_duplicate()
staging: rtl8192e: Use standard function in softmac_mgmt_xmit()
staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable
staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable
staging: rtl8192e: Remove rtllib_get_payload()
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 +--
.../staging/rtl8192e/rtl8192e/r8192E_dev.h | 2 -
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 18 -------
drivers/staging/rtl8192e/rtllib.h | 24 ---------
drivers/staging/rtl8192e/rtllib_rx.c | 53 ++++++-------------
drivers/staging/rtl8192e/rtllib_softmac.c | 11 +---
6 files changed, 22 insertions(+), 92 deletions(-)
--
2.42.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/8] staging: rtl8192e: Remove useless equation in debug output
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 2/8] staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt() Philipp Hortmann
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
When "switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)))" results
in "case RTLLIB_STYPE_BEACON:" there is no need to calculate this again
inside "case" and when a frame is a beacon there is no need to print the
frame identifier again as it is explicit.
Same for PROBE RESPONSE and PROBE REQUEST. Remove dead code.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtllib_rx.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 0e695b144b36..9f944eefa41e 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2652,8 +2652,7 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee,
switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) {
case RTLLIB_STYPE_BEACON:
- netdev_dbg(ieee->dev, "received BEACON (%d)\n",
- WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)));
+ netdev_dbg(ieee->dev, "received BEACON\n");
rtllib_process_probe_response(
ieee, (struct rtllib_probe_response *)header,
stats);
@@ -2666,14 +2665,12 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee,
break;
case RTLLIB_STYPE_PROBE_RESP:
- netdev_dbg(ieee->dev, "received PROBE RESPONSE (%d)\n",
- WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)));
+ netdev_dbg(ieee->dev, "received PROBE RESPONSE\n");
rtllib_process_probe_response(ieee,
(struct rtllib_probe_response *)header, stats);
break;
case RTLLIB_STYPE_PROBE_REQ:
- netdev_dbg(ieee->dev, "received PROBE REQUEST (%d)\n",
- WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)));
+ netdev_dbg(ieee->dev, "received PROBE REQUEST\n");
if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
(ieee->iw_mode == IW_MODE_ADHOC &&
ieee->link_state == MAC80211_LINKED))
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/8] staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt()
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 1/8] staging: rtl8192e: Remove useless equation in debug output Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 3/8] staging: rtl8192e: Use standard function in rtllib_process_probe_response() Philipp Hortmann
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Replace WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) and comparison
with standard function to avoid proprietary code and to increase
readability.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtllib_rx.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 9f944eefa41e..108238aa61d9 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2644,14 +2644,11 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee,
{
struct rtllib_hdr_4addr *header = (struct rtllib_hdr_4addr *)skb->data;
- if ((WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) !=
- RTLLIB_STYPE_PROBE_RESP) &&
- (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) !=
- RTLLIB_STYPE_BEACON))
+ if (!ieee80211_is_probe_resp(header->frame_ctl) &&
+ (!ieee80211_is_beacon(header->frame_ctl)))
ieee->last_rx_ps_time = jiffies;
- switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) {
- case RTLLIB_STYPE_BEACON:
+ if (ieee80211_is_beacon(header->frame_ctl)) {
netdev_dbg(ieee->dev, "received BEACON\n");
rtllib_process_probe_response(
ieee, (struct rtllib_probe_response *)header,
@@ -2661,20 +2658,15 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee,
ieee->iw_mode == IW_MODE_INFRA &&
ieee->link_state == MAC80211_LINKED))
schedule_work(&ieee->ps_task);
-
- break;
-
- case RTLLIB_STYPE_PROBE_RESP:
+ } else if (ieee80211_is_probe_resp(header->frame_ctl)) {
netdev_dbg(ieee->dev, "received PROBE RESPONSE\n");
rtllib_process_probe_response(ieee,
(struct rtllib_probe_response *)header, stats);
- break;
- case RTLLIB_STYPE_PROBE_REQ:
+ } else if (ieee80211_is_probe_req(header->frame_ctl)) {
netdev_dbg(ieee->dev, "received PROBE REQUEST\n");
if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
(ieee->iw_mode == IW_MODE_ADHOC &&
ieee->link_state == MAC80211_LINKED))
rtllib_rx_probe_rq(ieee, skb);
- break;
}
}
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/8] staging: rtl8192e: Use standard function in rtllib_process_probe_response()
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 1/8] staging: rtl8192e: Remove useless equation in debug output Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 2/8] staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt() Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 4/8] staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate() Philipp Hortmann
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Replace proprietary is_beacon() with ieee80211_is_beacon() and
proprietary "WLAN_FC_GET_STYPE(frame_ctl) == RTLLIB_STYPE_PROBE_RESP"
with standard function to increase readability.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtllib_rx.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 108238aa61d9..89c8d66765fe 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2448,11 +2448,6 @@ static inline void update_network(struct rtllib_device *ieee,
dst->BssCcxVerNumber = src->BssCcxVerNumber;
}
-static inline int is_beacon(u16 fc)
-{
- return (WLAN_FC_GET_STYPE(fc) == RTLLIB_STYPE_BEACON);
-}
-
static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel)
{
if (channel > MAX_CHANNEL_NUMBER) {
@@ -2491,7 +2486,7 @@ static inline void rtllib_process_probe_response(
short renew;
struct rtllib_network *network = kzalloc(sizeof(struct rtllib_network),
GFP_ATOMIC);
- u16 frame_ctl = le16_to_cpu(beacon->header.frame_ctl);
+ __le16 frame_ctl = beacon->header.frame_ctl;
if (!network)
return;
@@ -2521,14 +2516,14 @@ static inline void rtllib_process_probe_response(
netdev_dbg(ieee->dev, "Dropped '%s' ( %pM) via %s.\n",
escape_essid(info_element->data, info_element->len),
beacon->header.addr3,
- is_beacon(frame_ctl) ? "BEACON" : "PROBE RESPONSE");
+ ieee80211_is_beacon(frame_ctl) ? "BEACON" : "PROBE RESPONSE");
goto free_network;
}
if (!rtllib_legal_channel(ieee, network->channel))
goto free_network;
- if (WLAN_FC_GET_STYPE(frame_ctl) == RTLLIB_STYPE_PROBE_RESP) {
+ if (ieee80211_is_probe_resp(frame_ctl)) {
if (IsPassiveChannel(ieee, network->channel)) {
netdev_info(ieee->dev,
"GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n",
@@ -2561,7 +2556,7 @@ static inline void rtllib_process_probe_response(
else
ieee->current_network.buseprotection = false;
}
- if (is_beacon(frame_ctl)) {
+ if (ieee80211_is_beacon(frame_ctl)) {
if (ieee->link_state >= MAC80211_LINKED)
ieee->link_detect_info.NumRecvBcnInPeriod++;
}
@@ -2597,7 +2592,7 @@ static inline void rtllib_process_probe_response(
netdev_dbg(ieee->dev, "Adding '%s' ( %pM) via %s.\n",
escape_essid(network->ssid, network->ssid_len),
network->bssid,
- is_beacon(frame_ctl) ? "BEACON" : "PROBE RESPONSE");
+ ieee80211_is_beacon(frame_ctl) ? "BEACON" : "PROBE RESPONSE");
memcpy(target, network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
@@ -2607,7 +2602,7 @@ static inline void rtllib_process_probe_response(
netdev_dbg(ieee->dev, "Updating '%s' ( %pM) via %s.\n",
escape_essid(target->ssid, target->ssid_len),
target->bssid,
- is_beacon(frame_ctl) ? "BEACON" : "PROBE RESPONSE");
+ ieee80211_is_beacon(frame_ctl) ? "BEACON" : "PROBE RESPONSE");
/* we have an entry and we are going to update it. But this
* entry may be already expired. In this case we do the same
@@ -2628,7 +2623,7 @@ static inline void rtllib_process_probe_response(
}
spin_unlock_irqrestore(&ieee->lock, flags);
- if (is_beacon(frame_ctl) &&
+ if (ieee80211_is_beacon(frame_ctl) &&
is_same_network(&ieee->current_network, network,
(network->ssid_len ? 1 : 0)) &&
(ieee->link_state == MAC80211_LINKED)) {
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/8] staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate()
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
` (2 preceding siblings ...)
2023-09-12 19:28 ` [PATCH v2 3/8] staging: rtl8192e: Use standard function in rtllib_process_probe_response() Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 5/8] staging: rtl8192e: Use standard function in softmac_mgmt_xmit() Philipp Hortmann
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Use standard function ieee80211_is_beacon() to avoid proprietary code and
to increase readability.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Take wrongly removed definition of fc back in.
---
drivers/staging/rtl8192e/rtllib_rx.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 89c8d66765fe..7c16d4db67ad 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -904,11 +904,9 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee,
{
struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
u16 fc, sc;
- u8 frag, type, stype;
+ u8 frag;
fc = le16_to_cpu(hdr->frame_ctl);
- type = WLAN_FC_GET_TYPE(fc);
- stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
@@ -916,8 +914,7 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee,
!ieee->current_network.qos_data.active ||
!IsDataFrame(skb->data) ||
IsLegacyDataFrame(skb->data)) {
- if (!((type == RTLLIB_FTYPE_MGMT) &&
- (stype == RTLLIB_STYPE_BEACON))) {
+ if (!ieee80211_is_beacon(hdr->frame_ctl)) {
if (is_duplicate_packet(ieee, hdr))
return -1;
}
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/8] staging: rtl8192e: Use standard function in softmac_mgmt_xmit()
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
` (3 preceding siblings ...)
2023-09-12 19:28 ` [PATCH v2 4/8] staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate() Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 6/8] staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable Philipp Hortmann
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Use standard function ieee80211_is_beacon() to avoid proprietary code to
identify beacon and to increase readability in softmac_mgmt_xmit() and
_rtl92e_translate_rx_signal_stats()
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +-
drivers/staging/rtl8192e/rtllib.h | 1 -
drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 58e90b7772ef..8adf53174239 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1584,7 +1584,7 @@ static void _rtl92e_translate_rx_signal_stats(struct net_device *dev,
(!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV));
bpacket_toself = bpacket_match_bssid && /* check this */
ether_addr_equal(praddr, priv->rtllib->dev->dev_addr);
- if (WLAN_FC_GET_FRAMETYPE(fc) == RTLLIB_STYPE_BEACON)
+ if (ieee80211_is_beacon(hdr->frame_ctl))
bPacketBeacon = true;
_rtl92e_process_phyinfo(priv, tmp_buf, &previous_stats, pstats);
_rtl92e_query_rxphystatus(priv, pstats, pdesc, pdrvinfo,
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 95c9f6679d71..7dfb93f0590c 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -459,7 +459,6 @@ enum _REG_PREAMBLE_MODE {
#define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE)
#define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA)
-#define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)
#define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
#define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index de1702491191..5de57331c1cf 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -197,7 +197,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)
/* called with 2nd param 0, no mgmt lock required */
rtllib_sta_wakeup(ieee, 0);
- if (le16_to_cpu(header->frame_ctl) == RTLLIB_STYPE_BEACON)
+ if (ieee80211_is_beacon(header->frame_ctl))
tcb_desc->queue_index = BEACON_QUEUE;
else
tcb_desc->queue_index = MGNT_QUEUE;
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 6/8] staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
` (4 preceding siblings ...)
2023-09-12 19:28 ` [PATCH v2 5/8] staging: rtl8192e: Use standard function in softmac_mgmt_xmit() Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 7/8] staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 8/8] staging: rtl8192e: Remove rtllib_get_payload() Philipp Hortmann
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Replace rtl92e_disable_irq with rtl92e_irq_disable to increase
readability. priv->irq_enabled = 0 was set in both functions.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +-
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 1 -
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 9 ---------
3 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 8adf53174239..e0500946dea5 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1879,7 +1879,7 @@ void rtl92e_enable_irq(struct net_device *dev)
rtl92e_writel(dev, INTA_MASK, priv->irq_mask[0]);
}
-void rtl92e_disable_irq(struct net_device *dev)
+void rtl92e_irq_disable(struct net_device *dev)
{
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h
index 11366fda4ec3..3c06e1da4408 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h
@@ -17,7 +17,6 @@ void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta);
void rtl92e_enable_rx(struct net_device *dev);
void rtl92e_enable_tx(struct net_device *dev);
void rtl92e_enable_irq(struct net_device *dev);
-void rtl92e_disable_irq(struct net_device *dev);
void rtl92e_init_variables(struct net_device *dev);
void rtl92e_start_beacon(struct net_device *dev);
void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 50eb8f3494ec..055cd513d76a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -236,15 +236,6 @@ void rtl92e_irq_enable(struct net_device *dev)
rtl92e_enable_irq(dev);
}
-void rtl92e_irq_disable(struct net_device *dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
-
- rtl92e_disable_irq(dev);
-
- priv->irq_enabled = 0;
-}
-
static void _rtl92e_set_chan(struct net_device *dev, short ch)
{
struct r8192_priv *priv = rtllib_priv(dev);
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 7/8] staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
` (5 preceding siblings ...)
2023-09-12 19:28 ` [PATCH v2 6/8] staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 8/8] staging: rtl8192e: Remove rtllib_get_payload() Philipp Hortmann
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Replace rtl92e_enable_irq with rtl92e_irq_enable to increase readability.
priv->irq_enabled = 1 was set in both functions.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +-
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 1 -
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 9 ---------
3 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index e0500946dea5..70e1eff9c600 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1870,7 +1870,7 @@ rtl92e_init_variables(struct net_device *dev)
priv->bfirst_after_down = false;
}
-void rtl92e_enable_irq(struct net_device *dev)
+void rtl92e_irq_enable(struct net_device *dev)
{
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h
index 3c06e1da4408..14a091ae1b7d 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h
@@ -16,7 +16,6 @@ bool rtl92e_is_rx_stuck(struct net_device *dev);
void rtl92e_ack_irq(struct net_device *dev, u32 *p_inta);
void rtl92e_enable_rx(struct net_device *dev);
void rtl92e_enable_tx(struct net_device *dev);
-void rtl92e_enable_irq(struct net_device *dev);
void rtl92e_init_variables(struct net_device *dev);
void rtl92e_start_beacon(struct net_device *dev);
void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 055cd513d76a..63bf8be3fda5 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -227,15 +227,6 @@ static void _rtl92e_tx_timeout(struct net_device *dev, unsigned int txqueue)
netdev_info(dev, "TXTIMEOUT");
}
-void rtl92e_irq_enable(struct net_device *dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
-
- priv->irq_enabled = 1;
-
- rtl92e_enable_irq(dev);
-}
-
static void _rtl92e_set_chan(struct net_device *dev, short ch)
{
struct r8192_priv *priv = rtllib_priv(dev);
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 8/8] staging: rtl8192e: Remove rtllib_get_payload()
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
` (6 preceding siblings ...)
2023-09-12 19:28 ` [PATCH v2 7/8] staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable Philipp Hortmann
@ 2023-09-12 19:28 ` Philipp Hortmann
7 siblings, 0 replies; 9+ messages in thread
From: Philipp Hortmann @ 2023-09-12 19:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
rtllib_process_action() is only called in one place with management
frames. Frame is passed over to rtllib_get_payload() which passes it to
rtllib_get_hdrlen(). In rtllib_get_hdrlen() all management frames
return with hdrlen = RTLLIB_3ADDR_LEN. Therefore the switch in
rtllib_get_payload() is useless and dead code. The condition act == NULL
cannot occur and can also be removed. Then rtllib_hdr_2addr is not used
anymore and can be removed as well.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
v1->v2: Unchanged
---
drivers/staging/rtl8192e/rtllib.h | 23 -----------------------
drivers/staging/rtl8192e/rtllib_softmac.c | 9 +--------
2 files changed, 1 insertion(+), 31 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 7dfb93f0590c..565a6e41b982 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -692,14 +692,6 @@ struct rtllib_hdr_1addr {
u8 payload[];
} __packed;
-struct rtllib_hdr_2addr {
- __le16 frame_ctl;
- __le16 duration_id;
- u8 addr1[ETH_ALEN];
- u8 addr2[ETH_ALEN];
- u8 payload[];
-} __packed;
-
struct rtllib_hdr_3addr {
__le16 frame_ctl;
__le16 duration_id;
@@ -1781,21 +1773,6 @@ static inline int rtllib_get_hdrlen(u16 fc)
return hdrlen;
}
-static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr)
-{
- switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
- case RTLLIB_1ADDR_LEN:
- return ((struct rtllib_hdr_1addr *)hdr)->payload;
- case RTLLIB_2ADDR_LEN:
- return ((struct rtllib_hdr_2addr *)hdr)->payload;
- case RTLLIB_3ADDR_LEN:
- return ((struct rtllib_hdr_3addr *)hdr)->payload;
- case RTLLIB_4ADDR_LEN:
- return ((struct rtllib_hdr_4addr *)hdr)->payload;
- }
- return NULL;
-}
-
static inline int rtllib_is_ofdm_rate(u8 rate)
{
switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 5de57331c1cf..904be0ef867f 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1921,16 +1921,9 @@ EXPORT_SYMBOL(rtllib_ps_tx_ack);
static void rtllib_process_action(struct rtllib_device *ieee,
struct sk_buff *skb)
{
- struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *)skb->data;
- u8 *act = rtllib_get_payload((struct rtllib_hdr *)header);
+ u8 *act = skb->data + RTLLIB_3ADDR_LEN;
u8 category = 0;
- if (act == NULL) {
- netdev_warn(ieee->dev,
- "Error getting payload of action frame\n");
- return;
- }
-
category = *act;
act++;
switch (category) {
--
2.42.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-09-12 19:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12 19:27 [PATCH v2 0/8] staging: rtl8192e: Use standard functions like ieee80211_is_beacon() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 1/8] staging: rtl8192e: Remove useless equation in debug output Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 2/8] staging: rtl8192e: Use standard ieee80211 function in rtllib_rx_mgt() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 3/8] staging: rtl8192e: Use standard function in rtllib_process_probe_response() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 4/8] staging: rtl8192e: Use standard function in rtllib_rx_check_duplicate() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 5/8] staging: rtl8192e: Use standard function in softmac_mgmt_xmit() Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 6/8] staging: rtl8192e: Replace rtl92e_disable_irq with rtl92e_irq_disable Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 7/8] staging: rtl8192e: Replace rtl92e_enable_irq with rtl92e_irq_enable Philipp Hortmann
2023-09-12 19:28 ` [PATCH v2 8/8] staging: rtl8192e: Remove rtllib_get_payload() Philipp Hortmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).