staging: rtl8192e: Remove entries from struct rtl819x_ops start with .tx_enable
cover staging: rtl8192e: Remove entries from struct rtl819x_ops start with .tx_enable
Remove unnecessary entries from rtl819x_ops and replace them with function names when required. This increases readability of the code as the reader does not always need to look up the corresponding function name. One patch just removes dead code which increases also readability.
Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e
This patch series requires the this patch series:
"[PATCH 00/11] staging: rtl8192e: Remove entries from struct rtl819x_ops start with .get_eeprom_size"
Philipp Hortmann (7):
staging: rtl8192e: Remove entry .tx_enable from struct rtl819x_ops
staging: rtl8192e: Remove entry .interrupt_re.. from struct
rtl819x_ops
staging: rtl8192e: Remove entry .tx_check_stuc.. from struct
rtl819x_ops
staging: rtl8192e: Remove entry .rx_check_stuc.. from struct
rtl819x_ops staging: rtl8192e: Remove dead code from struct rtl819x_ops
staging: rtl8192e: Remove entry .link_change from struct rtl819x_ops
staging: rtl8192e: Remove entry .nic_type from struct rtl819x_ops
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 20 +++++--------------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 12 ------------ drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 6 +++--- 3 files changed, 8 insertions(+), 30 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/7 staging: rtl8192e: Remove entry .tx_enable from struct rtl819x_ops
Remove entry .tx_enable and replace it with function name rtl92e_enable_tx. This increases readability of the code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
@@ -30,7 +30,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, .irq_clear = rtl92e_clear_irq, - .tx_enable = rtl92e_enable_tx, .interrupt_recognized = rtl92e_ack_irq, .tx_check_stuck_handler = rtl92e_is_tx_stuck, .rx_check_stuck_handler = rtl92e_is_rx_stuck,
@@ -1406,7 +1405,7 @@ void rtl92e_tx_enable(struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev); - priv->ops->tx_enable (dev); +rtl92e_enable_tx (dev);rtllib_reset_queue (priv->rtllib); }
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -211,7 +211,6 @@ struct rtl819x_ops {struct sk_buff *skb, struct rx_desc *pdesc);void (*irq_clear)(struct net_device *dev); -void (*tx_enable)(struct net_device *dev);void (*interrupt_recognized)(struct net_device *dev,u32 *p_inta,u32 *p_intb);bool (*tx_check_stuck_handler)(struct net_device *dev);
Signature · 1 line
2.39.2
PATCH 2/7 staging: rtl8192e: Remove entry .interrupt_re.. from struct rtl819x_ops
In reply to Philipp HortmannRemove entry .interrupt_recognized and replace it with function name rtl92e_ack_irq. This increases readability of the code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
@@ -30,7 +30,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, .irq_clear = rtl92e_clear_irq, - .interrupt_recognized = rtl92e_ack_irq, .tx_check_stuck_handler = rtl92e_is_tx_stuck, .rx_check_stuck_handler = rtl92e_is_rx_stuck, };
@@ -2103,7 +2102,7 @@ static irqreturn_t _rtl92e_irq(int irq, void *netdev)spin_lock_irqsave (&priv->irq_th_lock, flags); - priv->ops->interrupt_recognized (dev, &inta, &intb); +rtl92e_ack_irq (dev, &inta, &intb);if (!inta) {spin_unlock_irqrestore (&priv->irq_th_lock, flags);
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
@@ -211,8 +211,6 @@ struct rtl819x_ops {struct sk_buff *skb, struct rx_desc *pdesc);void (*irq_clear)(struct net_device *dev); -void (*interrupt_recognized)(struct net_device *dev, -u32 *p_inta,u32 *p_intb);bool (*tx_check_stuck_handler)(struct net_device *dev);bool (*rx_check_stuck_handler)(struct net_device *dev); };
Signature · 1 line
2.39.2
PATCH 3/7 staging: rtl8192e: Remove entry .tx_check_stuc.. from struct rtl819x_ops
In reply to Philipp HortmannRemove entry .tx_check_stuck_handler and replace it with function name rtl92e_is_tx_stuck. This increases readability of the code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
@@ -30,7 +30,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, .irq_clear = rtl92e_clear_irq, - .tx_check_stuck_handler = rtl92e_is_tx_stuck, .rx_check_stuck_handler = rtl92e_is_rx_stuck, };
@@ -1055,7 +1054,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)spin_unlock_irqrestore (&priv->irq_th_lock, flags);if (bCheckFwTxCnt) { -if (priv->ops->tx_check_stuck_handler (dev)) +if (rtl92e_is_tx_stuck (dev))return RESET_TYPE_SILENT ; }
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -211,7 +211,6 @@ struct rtl819x_ops {struct sk_buff *skb, struct rx_desc *pdesc);void (*irq_clear)(struct net_device *dev); -bool (*tx_check_stuck_handler)(struct net_device *dev);bool (*rx_check_stuck_handler)(struct net_device *dev); };
Signature · 1 line
2.39.2
PATCH 4/7 staging: rtl8192e: Remove entry .rx_check_stuc.. from struct rtl819x_ops
In reply to Philipp HortmannRemove entry .rx_check_stuck_handler and replace it with function name rtl92e_is_rx_stuck. This increases readability of the code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -4
@@ -30,7 +30,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, .irq_clear = rtl92e_clear_irq, - .rx_check_stuck_handler = rtl92e_is_rx_stuck, };static struct pci_device_id rtl8192_pci_id_tbl[] = {
@@ -1063,9 +1062,7 @@ static enum reset_type _rtl92e_tx_check_stuck(struct net_device *dev)static enum reset_type _rtl92e_rx_check_stuck (struct net_device *dev) { -struct r8192_priv *priv =rtllib_priv (dev); - -if (priv->ops->rx_check_stuck_handler (dev)) +if (rtl92e_is_rx_stuck (dev))return RESET_TYPE_SILENT ;return RESET_TYPE_NORESET ;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -211,7 +211,6 @@ struct rtl819x_ops {struct sk_buff *skb, struct rx_desc *pdesc);void (*irq_clear)(struct net_device *dev); -bool (*rx_check_stuck_handler)(struct net_device *dev); };struct r8192_priv {
Signature · 1 line
2.39.2
PATCH 5/7 staging: rtl8192e: Remove dead code from struct rtl819x_ops
In reply to Philipp HortmannRemove entry .rx_command_packet_handler, .irq_clear and .init_before_adapter_start as it is dead code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 ----- 2 files changed, 7 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -2
@@ -28,8 +28,6 @@ static char *ifname = "wlan%d";static const struct rtl819x_ops rtl819xp_ops = { .nic_type =NIC_8192E , .link_change = rtl92e_link_change, - .rx_command_packet_handler =NULL , - .irq_clear = rtl92e_clear_irq, };static struct pci_device_id rtl8192_pci_id_tbl[] = {
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -5
@@ -205,12 +205,7 @@ struct rtl8192_tx_ring {struct rtl819x_ops {enum nic_t nic_type; -void (*init_before_adapter_start)(struct net_device *dev);void (*link_change)(struct net_device *dev); -bool (*rx_command_packet_handler)(struct net_device *dev, -struct sk_buff *skb, -struct rx_desc *pdesc); -void (*irq_clear)(struct net_device *dev); };struct r8192_priv {
Signature · 1 line
2.39.2
PATCH 6/7 staging: rtl8192e: Remove entry .link_change from struct rtl819x_ops
In reply to Philipp HortmannRemove entry .link_change and replace it with function name rtl92e_link_change. This increases readability of the code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
@@ -27,7 +27,6 @@ static char *ifname = "wlan%d";static const struct rtl819x_ops rtl819xp_ops = { .nic_type =NIC_8192E , - .link_change = rtl92e_link_change, };static struct pci_device_id rtl8192_pci_id_tbl[] = {
@@ -762,7 +761,7 @@ static void _rtl92e_init_priv_handler(struct net_device *dev) priv->rtllib->softmac_hard_start_xmit = _rtl92e_hard_start_xmit; priv->rtllib->set_chan = _rtl92e_set_chan; - priv->rtllib->link_change = priv->ops->link_change; + 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; priv->rtllib->handle_assoc_response = _rtl92e_handle_assoc_response;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -205,7 +205,6 @@ struct rtl8192_tx_ring {struct rtl819x_ops {enum nic_t nic_type; -void (*link_change)(struct net_device *dev); };struct r8192_priv {
Signature · 1 line
2.39.2
PATCH 7/7 staging: rtl8192e: Remove entry .nic_type from struct rtl819x_ops
In reply to Philipp HortmannRemove unchanged entry .nic_type and replace it with constant NIC_8192E. This increases readability of the code.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 6 +++--- 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -26,7 +26,6 @@ int hwwep = 1;static char *ifname ="wlan%d" ;static const struct rtl819x_ops rtl819xp_ops = { - .nic_type =NIC_8192E , };static struct pci_device_id rtl8192_pci_id_tbl[] = {
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -204,7 +204,6 @@ struct rtl8192_tx_ring { };struct rtl819x_ops { -enum nic_t nic_type; };struct r8192_priv {
drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +3 -3
@@ -39,7 +39,7 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) revision_id = pdev->revision;pci_read_config_word (pdev,0x3C , &irq_line); - priv->card_8192 = priv->ops->nic_type; + priv->card_8192 =NIC_8192E ;if (device_id ==0x8192 ) {switch (revision_id) {
@@ -64,10 +64,10 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) } } -if (priv->ops->nic_type != priv->card_8192) { +if (priv->card_8192 !=NIC_8192E ) {dev_info (&pdev->dev,"Detect info(%x) and hardware info(%x) not match!\n" , - priv->ops->nic_type, priv->card_8192); +NIC_8192E , priv->card_8192);dev_info (&pdev->dev,"Please select proper driver before install!!!!\n" );return false;
Signature · 1 line
2.39.2
Re: [PATCH 7/7] staging: rtl8192e: Remove entry .nic_type from struct rtl819x_ops
Quoted 15 lines · Philipp Hortmann
Remove unchanged entry .nic_type and replace it with constant
NIC_8192E. This increases readability of the code.Signed-off-by Philipp Hortmann <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 6 +++--- 3 files changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0
-0
drivers/staging/rtl8192e/rtl8192e/rtl_core.c int hwwep = 1; · line 29
Quoted 5 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0
-1@@ -26,7 +26,6 @@ int hwwep = 1;static char *ifname ="wlan%d" ;static const struct rtl819x_ops rtl819xp_ops = { - .nic_type =NIC_8192E , };
Delete.
drivers/staging/rtl8192e/rtl8192e/rtl_core.h struct rtl8192_tx_ring { · line 207
Quoted 12 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0
-0static struct pci_device_id rtl8192_pci_id_tbl[] = {drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0
-1@@ -204,7 +204,6 @@ struct rtl8192_tx_ring { };struct rtl819x_ops { -enum nic_t nic_type; };
Delete this empty struct too.
Otherwise these patches are really nice. Thanks!
regards,
dan carpenter