From d1c1ace35e1586025a56c39eb201b6d54a592a09 Mon Sep 17 00:00:00 2001 From: Shibo Li Date: Mon, 20 Feb 2023 09:04:30 +0000 Subject: [PATCH 001/185] staging: rtl8712: Remove extra spaces This patch fixes the problem of irregular indentation Signed-off-by: Shibo Li Link: https://lore.kernel.org/r/20230220090430.19589-1-zzutcyha@163.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_mlme.c | 93 +++++++++++++------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 63e12b157001..d42ec1053a6e 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -663,7 +663,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (!pnetwork) return; memcpy((u8 *)pnetwork + 16, (u8 *)pbuf + 8, - sizeof(struct wlan_network) - 16); + sizeof(struct wlan_network) - 16); } else { pnetwork = (struct wlan_network *)pbuf; } @@ -674,36 +674,36 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) pnetwork->network_type = le32_to_cpu(pnetwork->network_type); pnetwork->network.Length = le32_to_cpu(pnetwork->network.Length); pnetwork->network.Ssid.SsidLength = - le32_to_cpu(pnetwork->network.Ssid.SsidLength); + le32_to_cpu(pnetwork->network.Ssid.SsidLength); pnetwork->network.Privacy = le32_to_cpu(pnetwork->network.Privacy); pnetwork->network.Rssi = le32_to_cpu(pnetwork->network.Rssi); pnetwork->network.NetworkTypeInUse = - le32_to_cpu(pnetwork->network.NetworkTypeInUse); + le32_to_cpu(pnetwork->network.NetworkTypeInUse); pnetwork->network.Configuration.ATIMWindow = - le32_to_cpu(pnetwork->network.Configuration.ATIMWindow); + le32_to_cpu(pnetwork->network.Configuration.ATIMWindow); pnetwork->network.Configuration.BeaconPeriod = - le32_to_cpu(pnetwork->network.Configuration.BeaconPeriod); + le32_to_cpu(pnetwork->network.Configuration.BeaconPeriod); pnetwork->network.Configuration.DSConfig = - le32_to_cpu(pnetwork->network.Configuration.DSConfig); + le32_to_cpu(pnetwork->network.Configuration.DSConfig); pnetwork->network.Configuration.FHConfig.DwellTime = - le32_to_cpu(pnetwork->network.Configuration.FHConfig.DwellTime); + le32_to_cpu(pnetwork->network.Configuration.FHConfig.DwellTime); pnetwork->network.Configuration.FHConfig.HopPattern = - le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopPattern); + le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopPattern); pnetwork->network.Configuration.FHConfig.HopSet = - le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopSet); + le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopSet); pnetwork->network.Configuration.FHConfig.Length = - le32_to_cpu(pnetwork->network.Configuration.FHConfig.Length); + le32_to_cpu(pnetwork->network.Configuration.FHConfig.Length); pnetwork->network.Configuration.Length = - le32_to_cpu(pnetwork->network.Configuration.Length); + le32_to_cpu(pnetwork->network.Configuration.Length); pnetwork->network.InfrastructureMode = - le32_to_cpu(pnetwork->network.InfrastructureMode); + le32_to_cpu(pnetwork->network.InfrastructureMode); pnetwork->network.IELength = le32_to_cpu(pnetwork->network.IELength); #endif the_same_macaddr = !memcmp(pnetwork->network.MacAddress, - cur_network->network.MacAddress, ETH_ALEN); + cur_network->network.MacAddress, ETH_ALEN); pnetwork->network.Length = - r8712_get_wlan_bssid_ex_sz(&pnetwork->network); + r8712_get_wlan_bssid_ex_sz(&pnetwork->network); spin_lock_irqsave(&pmlmepriv->lock, irqL); if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) goto ignore_joinbss_callback; @@ -713,24 +713,24 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, _FW_LINKED)) { if (the_same_macaddr) { ptarget_wlan = - r8712_find_network(&pmlmepriv->scanned_queue, - cur_network->network.MacAddress); + r8712_find_network(&pmlmepriv->scanned_queue, + cur_network->network.MacAddress); } else { pcur_wlan = - r8712_find_network(&pmlmepriv->scanned_queue, - cur_network->network.MacAddress); + r8712_find_network(&pmlmepriv->scanned_queue, + cur_network->network.MacAddress); if (pcur_wlan) pcur_wlan->fixed = false; pcur_sta = r8712_get_stainfo(pstapriv, - cur_network->network.MacAddress); + cur_network->network.MacAddress); spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL2); r8712_free_stainfo(adapter, pcur_sta); spin_unlock_irqrestore(&(pstapriv->sta_hash_lock), irqL2); ptarget_wlan = - r8712_find_network(&pmlmepriv->scanned_queue, - pnetwork->network.MacAddress); + r8712_find_network(&pmlmepriv->scanned_queue, + pnetwork->network.MacAddress); if (ptarget_wlan) ptarget_wlan->fixed = true; } @@ -745,7 +745,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) pmlmepriv->fw_state ^= - _FW_UNDER_LINKING; + _FW_UNDER_LINKING; goto ignore_joinbss_callback; } @@ -753,16 +753,16 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { if (the_same_macaddr) { ptarget_sta = - r8712_get_stainfo(pstapriv, - pnetwork->network.MacAddress); + r8712_get_stainfo(pstapriv, + pnetwork->network.MacAddress); if (!ptarget_sta) ptarget_sta = - r8712_alloc_stainfo(pstapriv, - pnetwork->network.MacAddress); + r8712_alloc_stainfo(pstapriv, + pnetwork->network.MacAddress); } else { ptarget_sta = - r8712_alloc_stainfo(pstapriv, - pnetwork->network.MacAddress); + r8712_alloc_stainfo(pstapriv, + pnetwork->network.MacAddress); } if (ptarget_sta) /*update ptarget_sta*/ { ptarget_sta->aid = pnetwork->join_res; @@ -776,24 +776,25 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) ptarget_sta->XPrivacy = adapter-> securitypriv.PrivacyAlgrthm; memset((u8 *)&ptarget_sta->x_UncstKey, - 0, - sizeof(union Keytype)); + 0, + sizeof(union Keytype)); memset((u8 *)&ptarget_sta->tkiprxmickey, - 0, - sizeof(union Keytype)); + 0, + sizeof(union Keytype)); memset((u8 *)&ptarget_sta->tkiptxmickey, - 0, - sizeof(union Keytype)); - memset((u8 *)&ptarget_sta->txpn, 0, - sizeof(union pn48)); - memset((u8 *)&ptarget_sta->rxpn, 0, - sizeof(union pn48)); + 0, + sizeof(union Keytype)); + memset((u8 *)&ptarget_sta->txpn, + 0, + sizeof(union pn48)); + memset((u8 *)&ptarget_sta->rxpn, + 0, + sizeof(union pn48)); } } else { - if (check_fwstate(pmlmepriv, - _FW_UNDER_LINKING)) + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) pmlmepriv->fw_state ^= - _FW_UNDER_LINKING; + _FW_UNDER_LINKING; goto ignore_joinbss_callback; } } @@ -815,12 +816,12 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) break; } r8712_update_protection(adapter, - (cur_network->network.IEs) + - sizeof(struct NDIS_802_11_FIXED_IEs), - (cur_network->network.IELength)); + (cur_network->network.IEs) + + sizeof(struct NDIS_802_11_FIXED_IEs), + (cur_network->network.IELength)); /*TODO: update HT_Capability*/ update_ht_cap(adapter, cur_network->network.IEs, - cur_network->network.IELength); + cur_network->network.IELength); /*indicate connect*/ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) r8712_indicate_connect(adapter); @@ -831,7 +832,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) } else { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { mod_timer(&pmlmepriv->assoc_timer, - jiffies + msecs_to_jiffies(1)); + jiffies + msecs_to_jiffies(1)); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } } From dd680522f6aefeae94107bf4106b6f2da31c5025 Mon Sep 17 00:00:00 2001 From: Shibo Li Date: Mon, 20 Feb 2023 08:40:50 +0000 Subject: [PATCH 002/185] staging: rtl8712: Fix multiple line dereference This patch fixes the following warning in rtl871x_mlme.c WARNING: Avoid multiple line dereference - prefer 'adapter->securitypriv.PrivacyAlgrthm' Signed-off-by: Shibo Li Tested-by: Philipp Hortmann AW-NU120 Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20230220084050.18459-1-zzutcyha@163.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index d42ec1053a6e..fccfa0915a02 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -773,8 +773,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) adapter->securitypriv.busetkipkey = false; adapter->securitypriv.bgrpkey_handshake = false; ptarget_sta->ieee8021x_blocked = true; - ptarget_sta->XPrivacy = adapter-> - securitypriv.PrivacyAlgrthm; + ptarget_sta->XPrivacy = + adapter->securitypriv.PrivacyAlgrthm; memset((u8 *)&ptarget_sta->x_UncstKey, 0, sizeof(union Keytype)); From 5e1209d025741d2b021d7938eca18f27332ba545 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Wed, 8 Mar 2023 14:36:53 +0800 Subject: [PATCH 003/185] staging: most: dim2: Use devm_platform_get_and_ioremap_resource() According to commit 890cc39a8799 ("drivers: provide devm_platform_get_and_ioremap_resource()"), convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Yang Li Link: https://lore.kernel.org/r/20230308063653.92879-1-yang.lee@linux.alibaba.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/dim2/dim2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c index 7a5f80e637a0..b8bd01ca1f11 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -775,8 +775,7 @@ static int dim2_probe(struct platform_device *pdev) goto err_free_dev; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dev->io_base = devm_ioremap_resource(&pdev->dev, res); + dev->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(dev->io_base)) { ret = PTR_ERR(dev->io_base); goto err_free_dev; From 81201b66b311f23c74fe6ce34d4a204c06f862df Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:15:33 +0100 Subject: [PATCH 004/185] staging: rtl8192e: Remove entry .get_eeprom_size from struct rtl819x_ops Remove entry .get_eeprom_size and replace it with function name rtl92e_get_eeprom_size. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/1323e1ae2b4f52dc42b7ce5debca5608c9c5aafd.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 104b16cfa979..73f3d0973a5a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -27,7 +27,6 @@ static char *ifname = "wlan%d"; static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, - .get_eeprom_size = rtl92e_get_eeprom_size, .init_adapter_variable = rtl92e_init_variables, .initialize_adapter = rtl92e_start_adapter, .link_change = rtl92e_link_change, @@ -974,7 +973,7 @@ static short _rtl92e_init(struct net_device *dev) _rtl92e_init_priv_variable(dev); _rtl92e_init_priv_lock(priv); _rtl92e_init_priv_task(dev); - priv->ops->get_eeprom_size(dev); + rtl92e_get_eeprom_size(dev); priv->ops->init_adapter_variable(dev); _rtl92e_get_channel_map(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index fd96eef90c7f..00e413a644d2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -205,7 +205,6 @@ struct rtl8192_tx_ring { struct rtl819x_ops { enum nic_t nic_type; - void (*get_eeprom_size)(struct net_device *dev); void (*init_adapter_variable)(struct net_device *dev); void (*init_before_adapter_start)(struct net_device *dev); bool (*initialize_adapter)(struct net_device *dev); From 379fbe28a157aa6e25c36d208080653c3613ee59 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:15:40 +0100 Subject: [PATCH 005/185] staging: rtl8192e: Remove entry .init_adapter_.. from struct rtl819x_ops Remove entry .init_adapter_variable and replace it with function name rtl92e_init_variables. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/cc6134e1cf43a8b74615f9eb4377988e3edd0bca.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 73f3d0973a5a..7b8683a9bdb1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -27,7 +27,6 @@ static char *ifname = "wlan%d"; static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, - .init_adapter_variable = rtl92e_init_variables, .initialize_adapter = rtl92e_start_adapter, .link_change = rtl92e_link_change, .tx_fill_descriptor = rtl92e_fill_tx_desc, @@ -974,7 +973,7 @@ static short _rtl92e_init(struct net_device *dev) _rtl92e_init_priv_lock(priv); _rtl92e_init_priv_task(dev); rtl92e_get_eeprom_size(dev); - priv->ops->init_adapter_variable(dev); + rtl92e_init_variables(dev); _rtl92e_get_channel_map(dev); rtl92e_dm_init(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 00e413a644d2..541b7aa366a5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -205,7 +205,6 @@ struct rtl8192_tx_ring { struct rtl819x_ops { enum nic_t nic_type; - void (*init_adapter_variable)(struct net_device *dev); void (*init_before_adapter_start)(struct net_device *dev); bool (*initialize_adapter)(struct net_device *dev); void (*link_change)(struct net_device *dev); From e42c99ead8308aa58b73bda044d2f9dd82756b15 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:15:46 +0100 Subject: [PATCH 006/185] staging: rtl8192e: Remove entry .initialize_ad.. from struct rtl819x_ops Remove entry .initialize_adapter and replace it with function name rtl92e_start_adapter. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/7457e18ea9f3b2415bf41fca8ac2b22349d2edd1.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 7b8683a9bdb1..3bebc1153572 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -27,7 +27,6 @@ static char *ifname = "wlan%d"; static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, - .initialize_adapter = rtl92e_start_adapter, .link_change = rtl92e_link_change, .tx_fill_descriptor = rtl92e_fill_tx_desc, .tx_fill_cmd_descriptor = rtl92e_fill_tx_cmd_desc, @@ -690,7 +689,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset) priv->rtllib->ieee_up = 1; priv->up_first_time = 0; - init_status = priv->ops->initialize_adapter(dev); + init_status = rtl92e_start_adapter(dev); if (!init_status) { netdev_err(dev, "%s(): Initialization failed!\n", __func__); return -1; @@ -2381,7 +2380,7 @@ bool rtl92e_enable_nic(struct net_device *dev) return false; } - init_status = priv->ops->initialize_adapter(dev); + init_status = rtl92e_start_adapter(dev); if (!init_status) { netdev_warn(dev, "%s(): Initialization failed!\n", __func__); priv->bdisable_nic = false; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 541b7aa366a5..9edadc62faa9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -206,7 +206,6 @@ struct rtl8192_tx_ring { struct rtl819x_ops { enum nic_t nic_type; void (*init_before_adapter_start)(struct net_device *dev); - bool (*initialize_adapter)(struct net_device *dev); void (*link_change)(struct net_device *dev); void (*tx_fill_descriptor)(struct net_device *dev, struct tx_desc *tx_desc, From 5de8f7b149eea9905b148cc6d7b2c0087d24c58f Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:15:52 +0100 Subject: [PATCH 007/185] staging: rtl8192e: Remove entry .tx_fill_descr.. from struct rtl819x_ops Remove entry .tx_fill_descriptor and replace it with function name rtl92e_fill_tx_desc. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/1ae7d44ef74dc6cb61ff43f670b21d702403d7fb.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 ++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 3bebc1153572..dd1f4a3c4bf9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -28,7 +28,6 @@ static char *ifname = "wlan%d"; static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, - .tx_fill_descriptor = rtl92e_fill_tx_desc, .tx_fill_cmd_descriptor = rtl92e_fill_tx_cmd_desc, .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, @@ -496,7 +495,7 @@ static void _rtl92e_prepare_beacon(struct tasklet_struct *t) skb_push(pnewskb, priv->rtllib->tx_headroom); pdesc = &ring->desc[0]; - priv->ops->tx_fill_descriptor(dev, pdesc, tcb_desc, pnewskb); + rtl92e_fill_tx_desc(dev, pdesc, tcb_desc, pnewskb); __skb_queue_tail(&ring->queue, pnewskb); pdesc->OWN = 1; } @@ -1637,7 +1636,7 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb) if (priv->rtllib->LedControlHandler) priv->rtllib->LedControlHandler(dev, LED_CTL_TX); } - priv->ops->tx_fill_descriptor(dev, pdesc, tcb_desc, skb); + rtl92e_fill_tx_desc(dev, pdesc, tcb_desc, skb); __skb_queue_tail(&ring->queue, skb); pdesc->OWN = 1; spin_unlock_irqrestore(&priv->irq_th_lock, flags); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 9edadc62faa9..0d4ae3a310da 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -207,10 +207,6 @@ struct rtl819x_ops { enum nic_t nic_type; void (*init_before_adapter_start)(struct net_device *dev); void (*link_change)(struct net_device *dev); - void (*tx_fill_descriptor)(struct net_device *dev, - struct tx_desc *tx_desc, - struct cb_desc *cb_desc, - struct sk_buff *skb); void (*tx_fill_cmd_descriptor)(struct net_device *dev, struct tx_desc_cmd *entry, struct cb_desc *cb_desc, From ec1a4fe412090c2e1574462548597e7aaa1d772f Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:00 +0100 Subject: [PATCH 008/185] staging: rtl8192e: Remove entry .tx_fill_cmd_d.. from struct rtl819x_ops Remove entry .tx_fill_cmd_descriptor and replace it with function name rtl92e_fill_tx_cmd_desc. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/713a48fcd6d56c3cc4e32aea0eeba881e0d092c5.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index dd1f4a3c4bf9..372bb4810c31 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -28,7 +28,6 @@ static char *ifname = "wlan%d"; static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, - .tx_fill_cmd_descriptor = rtl92e_fill_tx_cmd_desc, .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, .stop_adapter = rtl92e_stop_adapter, @@ -1577,7 +1576,7 @@ static void _rtl92e_tx_cmd(struct net_device *dev, struct sk_buff *skb) tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - priv->ops->tx_fill_cmd_descriptor(dev, entry, tcb_desc, skb); + rtl92e_fill_tx_cmd_desc(dev, entry, tcb_desc, skb); __skb_queue_tail(&ring->queue, skb); spin_unlock_irqrestore(&priv->irq_th_lock, flags); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 0d4ae3a310da..5af14837df31 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -207,10 +207,6 @@ struct rtl819x_ops { enum nic_t nic_type; void (*init_before_adapter_start)(struct net_device *dev); void (*link_change)(struct net_device *dev); - void (*tx_fill_cmd_descriptor)(struct net_device *dev, - struct tx_desc_cmd *entry, - struct cb_desc *cb_desc, - struct sk_buff *skb); bool (*rx_query_status_descriptor)(struct net_device *dev, struct rtllib_rx_stats *stats, struct rx_desc *pdesc, From 8fd527818fbb71b7caca2065547a5fdf96f8fc48 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:12 +0100 Subject: [PATCH 009/185] staging: rtl8192e: Remove entry .rx_query_stat.. from struct rtl819x_ops Remove entry .rx_query_status_descriptor and replace it with function name rtl92e_get_rx_stats. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/889c557f6e312645eb40173b7ffa210cabf10110.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 +--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 372bb4810c31..a4796330f86d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -28,7 +28,6 @@ static char *ifname = "wlan%d"; static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, - .rx_query_status_descriptor = rtl92e_get_rx_stats, .rx_command_packet_handler = NULL, .stop_adapter = rtl92e_stop_adapter, .update_ratr_table = rtl92e_update_ratr_table, @@ -1885,8 +1884,7 @@ static void _rtl92e_rx_normal(struct net_device *dev) if (pdesc->OWN) return; - if (!priv->ops->rx_query_status_descriptor(dev, &stats, - pdesc, skb)) + if (!rtl92e_get_rx_stats(dev, &stats, pdesc, skb)) goto done; new_skb = dev_alloc_skb(priv->rxbuffersize); /* if allocation of new skb failed - drop current packet diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 5af14837df31..d83af5f8ce82 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -207,10 +207,6 @@ 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_query_status_descriptor)(struct net_device *dev, - struct rtllib_rx_stats *stats, - struct rx_desc *pdesc, - struct sk_buff *skb); bool (*rx_command_packet_handler)(struct net_device *dev, struct sk_buff *skb, struct rx_desc *pdesc); From 7529b539899a6848e907ee914e01188c54f693ef Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:19 +0100 Subject: [PATCH 010/185] staging: rtl8192e: Remove entry .stop_adapter from struct rtl819x_ops Remove entry .stop_adapter and replace it with function name rtl92e_stop_adapter. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/87f874eae22027956b9f1140b8d460ed8b63a9f9.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 +++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a4796330f86d..566513338089 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -29,7 +29,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, - .stop_adapter = rtl92e_stop_adapter, .update_ratr_table = rtl92e_update_ratr_table, .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, @@ -756,7 +755,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf) } priv->rf_change_in_progress = true; spin_unlock_irqrestore(&priv->rf_ps_lock, flags); - priv->ops->stop_adapter(dev, false); + rtl92e_stop_adapter(dev, false); spin_lock_irqsave(&priv->rf_ps_lock, flags); priv->rf_change_in_progress = false; spin_unlock_irqrestore(&priv->rf_ps_lock, flags); @@ -2055,7 +2054,7 @@ void rtl92e_commit(struct net_device *dev) return; rtllib_softmac_stop_protocol(priv->rtllib, 0, true); rtl92e_irq_disable(dev); - priv->ops->stop_adapter(dev, true); + rtl92e_stop_adapter(dev, true); _rtl92e_up(dev, false); } @@ -2401,7 +2400,7 @@ bool rtl92e_disable_nic(struct net_device *dev) _rtl92e_cancel_deferred_work(priv); rtl92e_irq_disable(dev); - priv->ops->stop_adapter(dev, false); + rtl92e_stop_adapter(dev, false); return true; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index d83af5f8ce82..083bba3dc51b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -210,7 +210,6 @@ struct rtl819x_ops { bool (*rx_command_packet_handler)(struct net_device *dev, struct sk_buff *skb, struct rx_desc *pdesc); - void (*stop_adapter)(struct net_device *dev, bool reset); void (*update_ratr_table)(struct net_device *dev); void (*irq_enable)(struct net_device *dev); void (*irq_disable)(struct net_device *dev); From 51515f0a10c6a2127ec422d5ced9ae7fdec78c9b Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:28 +0100 Subject: [PATCH 011/185] staging: rtl8192e: Remove entry .update_ratr_t.. from struct rtl819x_ops Remove entry .update_ratr_table and replace it with function name rtl92e_update_ratr_table. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/b9557fd44fde0261acd867124aae4d318587a497.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 0b5b2ae27f9e..1e307789ee93 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -806,7 +806,7 @@ void rtl92e_link_change(struct net_device *dev) if (ieee->state == RTLLIB_LINKED) { _rtl92e_net_update(dev); - priv->ops->update_ratr_table(dev); + rtl92e_update_ratr_table(dev); if ((ieee->pairwise_key_type == KEY_TYPE_WEP40) || (ieee->pairwise_key_type == KEY_TYPE_WEP104)) rtl92e_enable_hw_security_config(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 566513338089..c7561e486359 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -29,7 +29,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, - .update_ratr_table = rtl92e_update_ratr_table, .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 083bba3dc51b..10ff4f9ec760 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -210,7 +210,6 @@ struct rtl819x_ops { bool (*rx_command_packet_handler)(struct net_device *dev, struct sk_buff *skb, struct rx_desc *pdesc); - void (*update_ratr_table)(struct net_device *dev); void (*irq_enable)(struct net_device *dev); void (*irq_disable)(struct net_device *dev); void (*irq_clear)(struct net_device *dev); From 555034bcd0afea9494cb0a87047329683bc8ed7e Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:35 +0100 Subject: [PATCH 012/185] staging: rtl8192e: Remove entry .irq_enable from struct rtl819x_ops Remove entry .irq_enable and replace it with function name rtl92e_enable_irq. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/c23a034632e06b0d9dcb98bd2311010561b6645e.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c7561e486359..0b6d3b3c6415 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -29,7 +29,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, - .irq_enable = rtl92e_enable_irq, .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, .rx_enable = rtl92e_enable_rx, @@ -247,7 +246,7 @@ void rtl92e_irq_enable(struct net_device *dev) priv->irq_enabled = 1; - priv->ops->irq_enable(dev); + rtl92e_enable_irq(dev); } void rtl92e_irq_disable(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 10ff4f9ec760..6b5761374d54 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -210,7 +210,6 @@ struct rtl819x_ops { bool (*rx_command_packet_handler)(struct net_device *dev, struct sk_buff *skb, struct rx_desc *pdesc); - void (*irq_enable)(struct net_device *dev); void (*irq_disable)(struct net_device *dev); void (*irq_clear)(struct net_device *dev); void (*rx_enable)(struct net_device *dev); From bba6744fd3ffb7ed9a1606f336e55cac36cbc4a6 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:43 +0100 Subject: [PATCH 013/185] staging: rtl8192e: Remove entry .irq_disable from struct rtl819x_ops Remove entry .irq_disable and replace it with function name rtl92e_disable_irq. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6d981b554a73ca965096e434d687b9827b0b96b2.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 0b6d3b3c6415..978088ab076c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -29,7 +29,6 @@ static const struct rtl819x_ops rtl819xp_ops = { .nic_type = NIC_8192E, .link_change = rtl92e_link_change, .rx_command_packet_handler = NULL, - .irq_disable = rtl92e_disable_irq, .irq_clear = rtl92e_clear_irq, .rx_enable = rtl92e_enable_rx, .tx_enable = rtl92e_enable_tx, @@ -253,7 +252,7 @@ void rtl92e_irq_disable(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - priv->ops->irq_disable(dev); + rtl92e_disable_irq(dev); priv->irq_enabled = 0; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 6b5761374d54..eb2b1e2ce4a6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -210,7 +210,6 @@ struct rtl819x_ops { bool (*rx_command_packet_handler)(struct net_device *dev, struct sk_buff *skb, struct rx_desc *pdesc); - void (*irq_disable)(struct net_device *dev); void (*irq_clear)(struct net_device *dev); void (*rx_enable)(struct net_device *dev); void (*tx_enable)(struct net_device *dev); From 026616a187a67d6472c61b917c300d381ccbb1cc Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 19 Feb 2023 22:16:49 +0100 Subject: [PATCH 014/185] staging: rtl8192e: Remove entry .rx_enable from struct rtl819x_ops Remove entry .rx_enable and replace it with function name rtl92e_enable_rx. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/8fd6c4b18cff8662215e27d299205646ce720a3b.1676840647.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 978088ab076c..aa0456931b09 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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_enable = rtl92e_enable_rx, .tx_enable = rtl92e_enable_tx, .interrupt_recognized = rtl92e_ack_irq, .tx_check_stuck_handler = rtl92e_is_tx_stuck, @@ -1400,9 +1399,7 @@ static void _rtl92e_watchdog_timer_cb(struct timer_list *t) ****************************************************************************/ void rtl92e_rx_enable(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); - - priv->ops->rx_enable(dev); + rtl92e_enable_rx(dev); } void rtl92e_tx_enable(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index eb2b1e2ce4a6..71958c7a4cbf 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -211,7 +211,6 @@ struct rtl819x_ops { struct sk_buff *skb, struct rx_desc *pdesc); void (*irq_clear)(struct net_device *dev); - void (*rx_enable)(struct net_device *dev); void (*tx_enable)(struct net_device *dev); void (*interrupt_recognized)(struct net_device *dev, u32 *p_inta, u32 *p_intb); From 45554ebbdad590733e9e8a0479e965feaa94abff Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:52:55 +0100 Subject: [PATCH 015/185] 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. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/76955e787fd161dea83d10e81054fafb3b334b5c.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index aa0456931b09..f1cde3fc8634 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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); } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 71958c7a4cbf..79281c077182 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -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); From 302c42c556ce29470414b66abb00b8f82c3c9bc8 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:53:03 +0100 Subject: [PATCH 016/185] staging: rtl8192e: Remove entry .interrupt_re.. from struct rtl819x_ops Remove entry .interrupt_recognized and replace it with function name rtl92e_ack_irq. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/a972ff8963b426f20651810b5161c8759ffa2d05.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f1cde3fc8634..3323bdf564ee 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 79281c077182..d3558bf6ce23 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -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); }; From e1ac4b672fd2adcfc4ae19de29ae29e07f701376 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:53:11 +0100 Subject: [PATCH 017/185] staging: rtl8192e: Remove entry .tx_check_stuc.. from struct rtl819x_ops Remove entry .tx_check_stuck_handler and replace it with function name rtl92e_is_tx_stuck. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/f58cc7b39f4a6bce0606bdd90a706b35b87d8256.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 3323bdf564ee..410c03833b9f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index d3558bf6ce23..87be8aaa7822 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -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); }; From 3caa21422f62d4dffb70949a35a9b9f0b4855f63 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:53:17 +0100 Subject: [PATCH 018/185] staging: rtl8192e: Remove entry .rx_check_stuc.. from struct rtl819x_ops Remove entry .rx_check_stuck_handler and replace it with function name rtl92e_is_rx_stuck. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6538f1e158664837f6d1e7a20583ff20fc4f1403.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 410c03833b9f..15eab612b08f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 87be8aaa7822..43e1c651e6d2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -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 { From 210b02c8f1c9c6ac672558384709f561a3aeec01 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:53:24 +0100 Subject: [PATCH 019/185] staging: rtl8192e: Remove dead code from struct rtl819x_ops Remove entry .rx_command_packet_handler, .irq_clear and .init_before_adapter_start as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/93427f1b2ad5841451d7e8cc8a621d7eff8cd916.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 ----- 2 files changed, 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 15eab612b08f..0c1eb75f37f6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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[] = { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 43e1c651e6d2..e572915c1fd2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -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 { From 5ac30dd269df943bfd37fbd72e09a07f2bf450c5 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:53:32 +0100 Subject: [PATCH 020/185] staging: rtl8192e: Remove entry .link_change from struct rtl819x_ops Remove entry .link_change and replace it with function name rtl92e_link_change. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/9b451317eb4c13db007476c30212ffb09ced2356.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 0c1eb75f37f6..2d2f9d4a0ff5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index e572915c1fd2..fa72f8891409 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -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 { From 0296ef43567a292f171708769660705385db77a6 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 21 Feb 2023 21:53:43 +0100 Subject: [PATCH 021/185] staging: rtl8192e: Remove entry .nic_type from struct rtl819x_ops Remove unchanged entry .nic_type and replace it with constant NIC_8192E. This increases readability of the code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/f1fd37a2d2b90bef8caac31a98f3eeff404b3095.1677010997.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- 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(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2d2f9d4a0ff5..044cab649ff1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -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[] = { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index fa72f8891409..f75cc96052d9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -204,7 +204,6 @@ struct rtl8192_tx_ring { }; struct rtl819x_ops { - enum nic_t nic_type; }; struct r8192_priv { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index 81e1bb856c60..0bc3e013001e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c @@ -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; From fda2093860df4812d69052a8cf4997e53853a340 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 23 Feb 2023 07:47:21 +0100 Subject: [PATCH 022/185] staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE Replace macro RTL_PCI_DEVICE with PCI_DEVICE to get rid of rtl819xp_ops which is empty. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/8b45ee783fa91196b7c9d6fc840a189496afd2f4.1677133271.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 044cab649ff1..f5a155d1a81a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -29,9 +29,9 @@ static const struct rtl819x_ops rtl819xp_ops = { }; static struct pci_device_id rtl8192_pci_id_tbl[] = { - {RTL_PCI_DEVICE(0x10ec, 0x8192, rtl819xp_ops)}, - {RTL_PCI_DEVICE(0x07aa, 0x0044, rtl819xp_ops)}, - {RTL_PCI_DEVICE(0x07aa, 0x0047, rtl819xp_ops)}, + {PCI_DEVICE(0x10ec, 0x8192)}, + {PCI_DEVICE(0x07aa, 0x0044)}, + {PCI_DEVICE(0x07aa, 0x0047)}, {} }; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index f75cc96052d9..c2a4b2ae6a81 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -55,11 +55,6 @@ #define IS_HARDWARE_TYPE_8192SE(_priv) \ (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192SE) -#define RTL_PCI_DEVICE(vend, dev, cfg) \ - .vendor = (vend), .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \ - .driver_data = (kernel_ulong_t)&(cfg) - #define TOTAL_CAM_ENTRY 32 #define CAM_CONTENT_COUNT 8 From 5e2b6593f27052ca997ecf822f62b5a301a25b78 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 23 Feb 2023 07:47:28 +0100 Subject: [PATCH 023/185] staging: rtl8192e: Remove empty struct rtl819x_ops Remove empty struct rtl819x_ops as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/31b5b0ba88d7b07b0407956d56446e8f0e62e3e7.1677133271.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ------ drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- 2 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index f5a155d1a81a..718d69b4ce16 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -25,9 +25,6 @@ int hwwep = 1; static char *ifname = "wlan%d"; -static const struct rtl819x_ops rtl819xp_ops = { -}; - static struct pci_device_id rtl8192_pci_id_tbl[] = { {PCI_DEVICE(0x10ec, 0x8192)}, {PCI_DEVICE(0x07aa, 0x0044)}, @@ -2190,7 +2187,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, unsigned long ioaddr = 0; struct net_device *dev = NULL; struct r8192_priv *priv = NULL; - struct rtl819x_ops *ops = (struct rtl819x_ops *)(id->driver_data); unsigned long pmem_start, pmem_len, pmem_flags; int err = -ENOMEM; u8 revision_id; @@ -2257,8 +2253,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, if (pdev->device == 0x8192 && revision_id == 0x10) goto err_unmap; - priv->ops = ops; - if (!rtl92e_check_adapter(pdev, dev)) goto err_unmap; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index c2a4b2ae6a81..c8816c44ca51 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -198,9 +198,6 @@ struct rtl8192_tx_ring { struct sk_buff_head queue; }; -struct rtl819x_ops { -}; - struct r8192_priv { struct pci_dev *pdev; struct pci_dev *bridge_pdev; @@ -218,7 +215,6 @@ struct r8192_priv { struct delayed_work txpower_tracking_wq; struct delayed_work rfpath_check_wq; struct delayed_work gpio_change_rf_wq; - struct rtl819x_ops *ops; struct rtllib_device *rtllib; struct work_struct reset_wq; From 237fea2f2dc618cc89b49c2713468f86cab63ed6 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Feb 2023 19:20:26 +0100 Subject: [PATCH 024/185] staging: rtl8192e: Remove checks of pointer to handle_a.. and handle_b.. Function pointers of handle_assoc_response and handle_beacon is set while executing the probe function. Therefore a NULL pointer check is not required. Remove checks as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/5c0fd114c24616bc03271ccb0a72a6bc68e45d61.1677345331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 4 +--- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 669e74a67190..35b36f7c0f28 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -2689,9 +2689,7 @@ static inline void rtllib_process_probe_response( is_same_network(&ieee->current_network, network, (network->ssid_len ? 1 : 0)) && (ieee->state == RTLLIB_LINKED)) { - if (ieee->handle_beacon != NULL) - ieee->handle_beacon(ieee->dev, beacon, - &ieee->current_network); + ieee->handle_beacon(ieee->dev, beacon, &ieee->current_network); } free_network: kfree(network); diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 2552aa089700..d697089e0cad 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2241,10 +2241,8 @@ rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, memcpy(ieee->ht_info->PeerHTInfoBuf, network->bssht.bd_ht_info_buf, network->bssht.bd_ht_info_len); - if (ieee->handle_assoc_response != NULL) - ieee->handle_assoc_response(ieee->dev, - (struct rtllib_assoc_response_frame *)header, - network); + ieee->handle_assoc_response(ieee->dev, + (struct rtllib_assoc_response_frame *)header, network); } kfree(network); From f7cc87391a203ab713877fdbce2956ced91b9ed6 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Feb 2023 19:20:33 +0100 Subject: [PATCH 025/185] staging: rtl8192e: Remove checks of pointer to LeisureP.. and start_se.. Function pointers of LeisurePSLeave and start_send_beacons is set while executing the probe function. Therefore a NULL pointer check is not required. Remove checks as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/cd828bb1c8dfbb6d2a85d770c82afbb9889e0ea2.1677345331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 3 +-- drivers/staging/rtl8192e/rtllib_softmac.c | 3 +-- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 35b36f7c0f28..c394c21beefb 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1214,8 +1214,7 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, if (((ieee->link_detect_info.NumRxUnicastOkInPeriod + ieee->link_detect_info.NumTxOkInPeriod) > 8) || (ieee->link_detect_info.NumRxUnicastOkInPeriod > 2)) { - if (ieee->LeisurePSLeave) - ieee->LeisurePSLeave(ieee->dev); + ieee->LeisurePSLeave(ieee->dev); } } } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index d697089e0cad..b06baf5ff6d4 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -669,8 +669,7 @@ EXPORT_SYMBOL(rtllib_stop_send_beacons); void rtllib_start_send_beacons(struct rtllib_device *ieee) { - if (ieee->start_send_beacons) - ieee->start_send_beacons(ieee->dev); + ieee->start_send_beacons(ieee->dev); if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) rtllib_beacons_start(ieee); } diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 06f3d75dc102..f90764d1d9ab 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -340,8 +340,7 @@ void rtllib_wx_sync_scan_wq(void *data) chan = ieee->current_network.channel; - if (ieee->LeisurePSLeave) - ieee->LeisurePSLeave(ieee->dev); + ieee->LeisurePSLeave(ieee->dev); /* notify AP to be in PS mode */ rtllib_sta_ps_send_null_frame(ieee, 1); rtllib_sta_ps_send_null_frame(ieee, 1); From 997f7f0c2c32fa7679673242eb67b970636c7aeb Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Feb 2023 19:20:41 +0100 Subject: [PATCH 026/185] staging: rtl8192e: Remove checks of pointer to stop_send.. and rtllib_.. Function pointers of stop_send_beacons and rtllib_ips_leave_wq is set while executing the probe function. Therefore a NULL pointer check is not required. Remove checks as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/f12e9167499344059f77991d2058c050bbe744d2.1677345331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index b06baf5ff6d4..7b73c5df5e2a 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -659,8 +659,7 @@ static void rtllib_beacons_stop(struct rtllib_device *ieee) void rtllib_stop_send_beacons(struct rtllib_device *ieee) { - if (ieee->stop_send_beacons) - ieee->stop_send_beacons(ieee->dev); + ieee->stop_send_beacons(ieee->dev); if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) rtllib_beacons_stop(ieee); } @@ -728,8 +727,7 @@ EXPORT_SYMBOL(rtllib_act_scanning); /* called with ieee->lock held */ static void rtllib_start_scan(struct rtllib_device *ieee) { - if (ieee->rtllib_ips_leave_wq != NULL) - ieee->rtllib_ips_leave_wq(ieee->dev); + ieee->rtllib_ips_leave_wq(ieee->dev); if (IS_DOT11D_ENABLE(ieee)) { if (IS_COUNTRY_IE_VALID(ieee)) @@ -1584,8 +1582,7 @@ static void rtllib_associate_procedure_wq(void *data) rtllib_stop_scan(ieee); HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); if (ieee->rf_power_state == rf_off) { - if (ieee->rtllib_ips_leave_wq != NULL) - ieee->rtllib_ips_leave_wq(ieee->dev); + ieee->rtllib_ips_leave_wq(ieee->dev); mutex_unlock(&ieee->wx_mutex); return; } From 4bd92a7714d19413eb477d4c02fbca4aae27abb5 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Feb 2023 19:20:50 +0100 Subject: [PATCH 027/185] staging: rtl8192e: Remove checks of pointer to rtllib.. and ScanOpera.. Function pointers of rtllib_ips_leave and ScanOperationBackupHandler is set while executing the probe function. Therefore a NULL pointer check is not required. Remove checks as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/8b01cbfaad2db4666b98bfeae29dd429d8c6cd07.1677345331.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 8 ++------ drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++---- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 6 ++---- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 718d69b4ce16..47feb4248d25 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -703,8 +703,7 @@ static int _rtl92e_sta_down(struct net_device *dev, bool shutdownrf) if (priv->up == 0) return -1; - if (priv->rtllib->rtllib_ips_leave) - priv->rtllib->rtllib_ips_leave(dev); + priv->rtllib->rtllib_ips_leave(dev); if (priv->rtllib->state == RTLLIB_LINKED) rtl92e_leisure_ps_leave(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index bf0030144e5d..cb28288a618b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -432,15 +432,11 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, if (priv->rtllib->rf_power_state != rf_off) { priv->rtllib->actscanning = true; - if (ieee->ScanOperationBackupHandler) - ieee->ScanOperationBackupHandler(ieee->dev, - SCAN_OPT_BACKUP); + ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP); rtllib_start_scan_syncro(priv->rtllib, 0); - if (ieee->ScanOperationBackupHandler) - ieee->ScanOperationBackupHandler(ieee->dev, - SCAN_OPT_RESTORE); + ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE); } ret = 0; } else { diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 7b73c5df5e2a..4923423aa85b 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1572,8 +1572,7 @@ static void rtllib_associate_procedure_wq(void *data) struct rtllib_device, associate_procedure_wq); rtllib_stop_scan_syncro(ieee); - if (ieee->rtllib_ips_leave != NULL) - ieee->rtllib_ips_leave(ieee->dev); + ieee->rtllib_ips_leave(ieee->dev); mutex_lock(&ieee->wx_mutex); if (ieee->data_hard_stop) @@ -2850,8 +2849,7 @@ void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown) if (shutdown) { ieee->proto_started = 0; ieee->proto_stoppping = 1; - if (ieee->rtllib_ips_leave != NULL) - ieee->rtllib_ips_leave(ieee->dev); + ieee->rtllib_ips_leave(ieee->dev); } rtllib_stop_send_beacons(ieee); diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index f90764d1d9ab..06f1d6de5cc7 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -355,8 +355,7 @@ void rtllib_wx_sync_scan_wq(void *data) /* wait for ps packet to be kicked out successfully */ msleep(50); - if (ieee->ScanOperationBackupHandler) - ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP); + ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_BACKUP); if (ieee->ht_info->bCurrentHTSupport && ieee->ht_info->enable_ht && ieee->ht_info->bCurBW40MHz) { @@ -381,8 +380,7 @@ void rtllib_wx_sync_scan_wq(void *data) ieee->set_chan(ieee->dev, chan); } - if (ieee->ScanOperationBackupHandler) - ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE); + ieee->ScanOperationBackupHandler(ieee->dev, SCAN_OPT_RESTORE); ieee->state = RTLLIB_LINKED; ieee->link_change(ieee->dev); From fa0dcd5909ad9168bc51ad4f577f3631803d2ab2 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Thu, 2 Mar 2023 20:14:57 +0100 Subject: [PATCH 028/185] staging: rtl8192e: Change filename r8192E_hwimg.x to table.x Change r8192E_hwimg.c to table.c and r8192E_hwimg.h to table.h to adapt filenames from drivers/net/wireless/realtek/rtlwifi rtl8192ee and rtl8192se. Task is from TODO file. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/20230302191457.GA17628@matrix-ESPRIMO-P710 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/Makefile | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/{r8192E_hwimg.c => table.c} | 2 +- drivers/staging/rtl8192e/rtl8192e/{r8192E_hwimg.h => table.h} | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename drivers/staging/rtl8192e/rtl8192e/{r8192E_hwimg.c => table.c} (99%) rename drivers/staging/rtl8192e/rtl8192e/{r8192E_hwimg.h => table.h} (100%) diff --git a/drivers/staging/rtl8192e/rtl8192e/Makefile b/drivers/staging/rtl8192e/rtl8192e/Makefile index 75e6ec510555..a442d79ea71e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/Makefile +++ b/drivers/staging/rtl8192e/rtl8192e/Makefile @@ -4,7 +4,7 @@ r8192e_pci-objs := \ r8192E_phy.o \ r8192E_firmware.o \ r8192E_cmdpkt.o \ - r8192E_hwimg.o \ + table.o \ r8190P_rtl8256.o \ rtl_cam.o \ rtl_core.o \ diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index b011ec8c8a41..ddf998cf2041 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -6,7 +6,7 @@ */ #include "rtl_core.h" #include "r8192E_hw.h" -#include "r8192E_hwimg.h" +#include "table.h" #include "r8192E_firmware.h" #include "r8192E_cmdpkt.h" #include diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index c6cbdea6d5b2..6388f1220575 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -12,7 +12,7 @@ #include "r8192E_phy.h" #include "rtl_dm.h" -#include "r8192E_hwimg.h" +#include "table.h" static u32 RF_CHANNEL_TABLE_ZEBRA[] = { 0, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c b/drivers/staging/rtl8192e/rtl8192e/table.c similarity index 99% rename from drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c rename to drivers/staging/rtl8192e/rtl8192e/table.c index e6fce749e65b..1f80dbeb17b5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -4,7 +4,7 @@ * * Contact Information: wlanfae */ -#include "r8192E_hwimg.h" +#include "table.h" u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE] = {0x0,}; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h b/drivers/staging/rtl8192e/rtl8192e/table.h similarity index 100% rename from drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h rename to drivers/staging/rtl8192e/rtl8192e/table.h From 718e16d6fb5552817ee2cdba56b2fff20e3308e1 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 4 Mar 2023 20:13:22 +0100 Subject: [PATCH 029/185] staging: rtl8192e: Remove empty Array Rtl8192PciEPHY_REGArray Remove empty array Rtl8192PciEPHY_REGArray and the code where it is used because it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/511bd239bf033dca3efcc64a640d5343c98fa897.1677955334.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 5 +---- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 2 -- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 6388f1220575..385ceb3a9636 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -334,10 +334,7 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType) AGCTAB_ArrayLen = AGCTAB_ArrayLength; Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array; - if (priv->rf_type == RF_2T4R) { - PHY_REGArrayLen = PHY_REGArrayLength; - Rtl819XPHY_REGArray_Table = Rtl819XPHY_REGArray; - } else if (priv->rf_type == RF_1T2R) { + if (priv->rf_type == RF_1T2R) { PHY_REGArrayLen = PHY_REG_1T2RArrayLength; Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 75629f5df954..561a4c874fe3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -16,7 +16,6 @@ #define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE #define RadioC_ArrayLength RadioC_ArrayLengthPciE #define RadioD_ArrayLength RadioD_ArrayLengthPciE -#define PHY_REGArrayLength PHY_REGArrayLengthPciE #define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE #define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG @@ -26,7 +25,6 @@ #define Rtl819XRadioC_Array Rtl8192PciERadioC_Array #define Rtl819XRadioD_Array Rtl8192PciERadioD_Array #define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array -#define Rtl819XPHY_REGArray Rtl8192PciEPHY_REGArray #define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray extern u32 rtl819XAGCTAB_Array[]; diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 1f80dbeb17b5..d04608d99cbf 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -6,8 +6,6 @@ */ #include "table.h" -u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE] = {0x0,}; - u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE] = { 0x800, 0x00000000, 0x804, 0x00000001, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 7d63f5a5c1b7..177fe2173430 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -11,8 +11,6 @@ #include -#define PHY_REGArrayLengthPciE 1 -extern u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE]; #define PHY_REG_1T2RArrayLengthPciE 296 extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; #define RadioA_ArrayLengthPciE 246 From 50cbec61ad7f66ecbe6786f8e03351454e17ee9e Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 4 Mar 2023 20:13:41 +0100 Subject: [PATCH 030/185] staging: rtl8192e: Remove conditions for RF_2T4R Remove conditions for RF_2T4R because hardware that uses RF_2T4R does not exist. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/af7dcd620fdad63b2f324d626f1c97601895823a.1677955334.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 +- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 21 +--- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 109 ++++-------------- drivers/staging/rtl8192e/rtllib.h | 1 - 4 files changed, 25 insertions(+), 109 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 1e307789ee93..8edfaaeda910 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -353,8 +353,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) if (tempval&0x80) priv->rf_type = RF_1T2R; - else - priv->rf_type = RF_2T4R; + } else { priv->eeprom_legacy_ht_tx_pwr_diff = 0x04; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 385ceb3a9636..35ca01ab65ff 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -52,9 +52,7 @@ u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath) u8 ret = 1; struct r8192_priv *priv = rtllib_priv(dev); - if (priv->rf_type == RF_2T4R) - ret = 0; - else if (priv->rf_type == RF_1T2R) { + if (priv->rf_type == RF_1T2R) { if (eRFPath == RF90_PATH_A || eRFPath == RF90_PATH_B) ret = 1; else if (eRFPath == RF90_PATH_C || eRFPath == RF90_PATH_D) @@ -531,12 +529,7 @@ static bool _rtl92e_bb_config_para_file(struct net_device *dev) _rtl92e_phy_config_bb(dev, BB_CONFIG_AGC_TAB); if (priv->ic_cut > VERSION_8190_BD) { - if (priv->rf_type == RF_2T4R) - dwRegValue = priv->antenna_tx_pwr_diff[2] << 8 | - priv->antenna_tx_pwr_diff[1] << 4 | - priv->antenna_tx_pwr_diff[0]; - else - dwRegValue = 0x0; + dwRegValue = 0x0; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC|bXDTxAGC), dwRegValue); @@ -587,16 +580,8 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) if (priv->epromtype == EEPROM_93C46) { powerlevel = priv->tx_pwr_level_cck[channel - 1]; powerlevelOFDM24G = priv->tx_pwr_level_ofdm_24g[channel - 1]; - } else if (priv->epromtype == EEPROM_93C56) { - if (priv->rf_type == RF_2T4R) { - priv->antenna_tx_pwr_diff[2] = 0; - priv->antenna_tx_pwr_diff[1] = 0; - priv->antenna_tx_pwr_diff[0] = 0; - - rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, - (bXBTxAGC | bXCTxAGC | bXDTxAGC), 0); - } } + switch (priv->rf_chip) { case RF_8225: break; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index d8455b23e555..a1bd119b8983 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -297,14 +297,7 @@ void rtl92e_init_adaptive_rate(struct net_device *dev) pra->ping_rssi_thresh_for_ra = 15; - if (priv->rf_type == RF_2T4R) { - pra->upper_rssi_threshold_ratr = 0x8f0f0000; - pra->middle_rssi_threshold_ratr = 0x8f0ff000; - pra->low_rssi_threshold_ratr = 0x8f0ff001; - pra->low_rssi_threshold_ratr_40M = 0x8f0ff005; - pra->low_rssi_threshold_ratr_20M = 0x8f0ff001; - pra->ping_rssi_ratr = 0x0000000d; - } else if (priv->rf_type == RF_1T2R) { + if (priv->rf_type == RF_1T2R) { pra->upper_rssi_threshold_ratr = 0x000fc000; pra->middle_rssi_threshold_ratr = 0x000ff000; pra->low_rssi_threshold_ratr = 0x000ff001; @@ -518,47 +511,18 @@ static void _rtl92e_dm_tx_update_tssi_weak_signal(struct net_device *dev, { struct r8192_priv *p = rtllib_priv(dev); - if (RF_Type == RF_2T4R) { - if ((p->rfa_txpowertrackingindex > 0) && - (p->rfc_txpowertrackingindex > 0)) { - p->rfa_txpowertrackingindex--; - if (p->rfa_txpowertrackingindex_real > 4) { - p->rfa_txpowertrackingindex_real--; - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); - } - - p->rfc_txpowertrackingindex--; - if (p->rfc_txpowertrackingindex_real > 4) { - p->rfc_txpowertrackingindex_real--; - rtl92e_set_bb_reg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); - } - } else { - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[4]); + if (p->rfa_txpowertrackingindex > 0) { + p->rfa_txpowertrackingindex--; + if (p->rfa_txpowertrackingindex_real > 4) { + p->rfa_txpowertrackingindex_real--; rtl92e_set_bb_reg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, dm_tx_bb_gain[4]); + rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); } } else { - if (p->rfa_txpowertrackingindex > 0) { - p->rfa_txpowertrackingindex--; - if (p->rfa_txpowertrackingindex_real > 4) { - p->rfa_txpowertrackingindex_real--; - rtl92e_set_bb_reg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); - } - } else { - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, dm_tx_bb_gain[4]); - } + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, dm_tx_bb_gain[4]); } } @@ -567,39 +531,16 @@ static void _rtl92e_dm_tx_update_tssi_strong_signal(struct net_device *dev, { struct r8192_priv *p = rtllib_priv(dev); - if (RF_Type == RF_2T4R) { - if ((p->rfa_txpowertrackingindex < TX_BB_GAIN_TABLE_LEN - 1) && - (p->rfc_txpowertrackingindex < TX_BB_GAIN_TABLE_LEN - 1)) { - p->rfa_txpowertrackingindex++; - p->rfa_txpowertrackingindex_real++; - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); - p->rfc_txpowertrackingindex++; - p->rfc_txpowertrackingindex_real++; - rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); - } else { - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]); - rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]); - } + if (p->rfa_txpowertrackingindex < (TX_BB_GAIN_TABLE_LEN - 1)) { + p->rfa_txpowertrackingindex++; + p->rfa_txpowertrackingindex_real++; + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); } else { - if (p->rfa_txpowertrackingindex < (TX_BB_GAIN_TABLE_LEN - 1)) { - p->rfa_txpowertrackingindex++; - p->rfa_txpowertrackingindex_real++; - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); - } else { - rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]); - } + rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]); } } @@ -705,13 +646,8 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) else _rtl92e_dm_tx_update_tssi_strong_signal(dev, RF_Type); - if (RF_Type == RF_2T4R) { - priv->cck_present_attn_diff - = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; - } else { - priv->cck_present_attn_diff - = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; - } + priv->cck_present_attn_diff + = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; if (priv->current_chnl_bw == HT_CHANNEL_WIDTH_20) priv->cck_present_attn = @@ -1765,9 +1701,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev) static u8 disabled_rf_cnt, cck_Rx_Path_initialized; u8 update_cck_rx_path; - if (priv->rf_type != RF_2T4R) - return; - if (!cck_Rx_Path_initialized) { dm_rx_path_sel_table.cck_rx_path = (rtl92e_readb(dev, 0xa07)&0xf); cck_Rx_Path_initialized = 1; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 1152fbf43383..8e5e29ce8f0d 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -451,7 +451,6 @@ enum led_ctl_mode { enum rt_rf_type_def { RF_1T2R = 0, - RF_2T4R, }; enum wireless_mode { From f5f7aaa87ffdfd1b0c57b7d35d744c4a46eebcfa Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 7 Mar 2023 22:01:06 +0100 Subject: [PATCH 031/185] staging: rtl8192e: Remove unused Array Rtl8192PciERadioC_Array The array Rtl8192PciERadioC_Array is only used in function rtl92e_config_rf_path which is only called in function rtl92e_config_rf. In function rtl92e_config_rf a termination condition for the loop is set to priv->num_total_rf_path = RTL819X_TOTAL_RF_PATH = 2. The loop is only executed with numbers 0 and 1 for eRFPath. So the function rtl92e_config_rf_path is only called with eRFPath for 0 and 1 and never with 2 that would make the "case RF90_PATH_C:" be called. Remove resulting dead code. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/ed1e0df7ed677c335340f42c1108e7b5c0f18462.1678222487.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 3 --- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 19 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 35ca01ab65ff..fe0ef52c163a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -649,18 +649,6 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) bMask12Bits, Rtl819XRadioB_Array[i+1]); - } - break; - case RF90_PATH_C: - for (i = 0; i < RadioC_ArrayLength; i += 2) { - if (Rtl819XRadioC_Array[i] == 0xfe) { - msleep(100); - continue; - } - rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioC_Array[i], - bMask12Bits, - Rtl819XRadioC_Array[i+1]); - } break; case RF90_PATH_D: diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 561a4c874fe3..6772ed300591 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -14,7 +14,6 @@ #define RadioA_ArrayLength RadioA_ArrayLengthPciE #define RadioB_ArrayLength RadioB_ArrayLengthPciE #define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE -#define RadioC_ArrayLength RadioC_ArrayLengthPciE #define RadioD_ArrayLength RadioD_ArrayLengthPciE #define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE @@ -22,7 +21,6 @@ #define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array #define Rtl819XRadioA_Array Rtl8192PciERadioA_Array #define Rtl819XRadioB_Array Rtl8192PciERadioB_Array -#define Rtl819XRadioC_Array Rtl8192PciERadioC_Array #define Rtl819XRadioD_Array Rtl8192PciERadioD_Array #define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array #define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index d04608d99cbf..4e97ad4b8fd7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -325,9 +325,6 @@ u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = { 0x007, 0x00000700, }; -u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE] = { - 0x0, }; - u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE] = { 0x0, }; diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 177fe2173430..981e8b57d3de 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -17,8 +17,6 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE]; #define RadioB_ArrayLengthPciE 78 extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; -#define RadioC_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE]; #define RadioD_ArrayLengthPciE 2 extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE]; #define MACPHY_ArrayLengthPciE 18 From 0a689b8241ae3a3d082d3ce706dfc6405fabe9d5 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 7 Mar 2023 22:01:25 +0100 Subject: [PATCH 032/185] staging: rtl8192e: Remove unused Array Rtl8192PciERadioD_Array The array Rtl8192PciERadioD_Array is only used in function rtl92e_config_rf_path which is only called in function rtl92e_config_rf. In function rtl92e_config_rf a termination condition for the loop is set to priv->num_total_rf_path = RTL819X_TOTAL_RF_PATH = 2. The loop is only executed with numbers 0 and 1 for eRFPath. So the function rtl92e_config_rf_path is only called with eRFPath for 0 and 1 and never with 3 that would make the "case RF90_PATH_D:" be called. Remove resulting dead code. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/608ced17b85ca321fdc0026c686e3c62a9d6d8cd.1678222487.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 3 --- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 19 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index fe0ef52c163a..a9e83ba811b0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -649,18 +649,6 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) bMask12Bits, Rtl819XRadioB_Array[i+1]); - } - break; - case RF90_PATH_D: - for (i = 0; i < RadioD_ArrayLength; i += 2) { - if (Rtl819XRadioD_Array[i] == 0xfe) { - msleep(100); - continue; - } - rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioD_Array[i], - bMask12Bits, - Rtl819XRadioD_Array[i+1]); - } break; default: diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 6772ed300591..ac640033e843 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -14,14 +14,12 @@ #define RadioA_ArrayLength RadioA_ArrayLengthPciE #define RadioB_ArrayLength RadioB_ArrayLengthPciE #define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE -#define RadioD_ArrayLength RadioD_ArrayLengthPciE #define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE #define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG #define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array #define Rtl819XRadioA_Array Rtl8192PciERadioA_Array #define Rtl819XRadioB_Array Rtl8192PciERadioB_Array -#define Rtl819XRadioD_Array Rtl8192PciERadioD_Array #define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array #define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 4e97ad4b8fd7..7101061e3519 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -325,9 +325,6 @@ u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = { 0x007, 0x00000700, }; -u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE] = { - 0x0, }; - u32 Rtl8192PciEMACPHY_Array[] = { 0x03c, 0xffff0000, 0x00000f0f, 0x340, 0xffffffff, 0x161a1a1a, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 981e8b57d3de..b6d4e9696452 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -17,8 +17,6 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE]; #define RadioB_ArrayLengthPciE 78 extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; -#define RadioD_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE]; #define MACPHY_ArrayLengthPciE 18 extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE]; #define MACPHY_Array_PGLengthPciE 30 From af5a5587a1d4c6c0a242f41751958f264ac3b0b2 Mon Sep 17 00:00:00 2001 From: Rohit Chavan Date: Fri, 24 Feb 2023 18:04:01 +0530 Subject: [PATCH 033/185] staging: vme: remove blank line after return statement This patch resolves a checkpatch issue by removing blank line, after return statement at end of the function. Signed-off-by: Rohit Chavan Link: https://lore.kernel.org/r/20230224123401.1365-1-roheetchavan@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/vme_fake.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c index f5d2c345978a..7c53a8a7b79b 100644 --- a/drivers/staging/vme_user/vme_fake.c +++ b/drivers/staging/vme_user/vme_fake.c @@ -329,7 +329,6 @@ err_aspace: err_dwidth: err_window: return retval; - } /* @@ -638,7 +637,6 @@ static noinline_for_stack void fake_vmewrite8(struct fake_driver *bridge, } fake_lm_check(bridge, addr, aspace, cycle); - } static noinline_for_stack void fake_vmewrite16(struct fake_driver *bridge, @@ -669,7 +667,6 @@ static noinline_for_stack void fake_vmewrite16(struct fake_driver *bridge, } fake_lm_check(bridge, addr, aspace, cycle); - } static noinline_for_stack void fake_vmewrite32(struct fake_driver *bridge, @@ -700,7 +697,6 @@ static noinline_for_stack void fake_vmewrite32(struct fake_driver *bridge, } fake_lm_check(bridge, addr, aspace, cycle); - } static ssize_t fake_master_write(struct vme_master_resource *image, void *buf, @@ -1234,7 +1230,6 @@ err_driver: kfree(fake_bridge); err_struct: return retval; - } static void __exit fake_exit(void) From 215792eda008f6a1e7ed9d77fa20d582d22bb114 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 21 Feb 2023 15:53:23 +0100 Subject: [PATCH 034/185] drivers: staging: rtl8723bs: Fix locking in _rtw_join_timeout_handler() Commit 041879b12ddb ("drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()") besides fixing the deadlock also modified _rtw_join_timeout_handler() to use spin_[un]lock_irq() instead of spin_[un]lock_bh(). _rtw_join_timeout_handler() calls rtw_do_join() which takes pmlmepriv->scanned_queue.lock using spin_[un]lock_bh(). This spin_unlock_bh() call re-enables softirqs which triggers an oops in kernel/softirq.c: __local_bh_enable_ip() when it calls lockdep_assert_irqs_enabled(): [ 244.506087] WARNING: CPU: 2 PID: 0 at kernel/softirq.c:376 __local_bh_enable_ip+0xa6/0x100 ... [ 244.509022] Call Trace: [ 244.509048] [ 244.509100] _rtw_join_timeout_handler+0x134/0x170 [r8723bs] [ 244.509468] ? __pfx__rtw_join_timeout_handler+0x10/0x10 [r8723bs] [ 244.509772] ? __pfx__rtw_join_timeout_handler+0x10/0x10 [r8723bs] [ 244.510076] call_timer_fn+0x95/0x2a0 [ 244.510200] __run_timers.part.0+0x1da/0x2d0 This oops is causd by the switch to spin_[un]lock_irq() which disables the IRQs for the entire duration of _rtw_join_timeout_handler(). Disabling the IRQs is not necessary since all code taking this lock runs from either user contexts or from softirqs, switch back to spin_[un]lock_bh() to fix this. Fixes: 041879b12ddb ("drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()") Cc: Duoming Zhou Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20230221145326.7808-1-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index c6fd6cf741ef..ea2a6566e51b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1549,7 +1549,7 @@ void _rtw_join_timeout_handler(struct timer_list *t) if (adapter->bDriverStopped || adapter->bSurpriseRemoved) return; - spin_lock_irq(&pmlmepriv->lock); + spin_lock_bh(&pmlmepriv->lock); if (rtw_to_roam(adapter) > 0) { /* join timeout caused by roaming */ while (1) { @@ -1577,7 +1577,7 @@ void _rtw_join_timeout_handler(struct timer_list *t) } - spin_unlock_irq(&pmlmepriv->lock); + spin_unlock_bh(&pmlmepriv->lock); } /* From 3f467036093fedd7e231924327455fc609b5ef02 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 21 Feb 2023 15:53:24 +0100 Subject: [PATCH 035/185] drivers: staging: rtl8723bs: Fix locking in rtw_scan_timeout_handler() Commit cc7ad0d77b51 ("drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()") besides fixing the deadlock also modified rtw_scan_timeout_handler() to use spin_[un]lock_irq() instead of spin_[un]lock_bh(). Disabling the IRQs is not necessary since all code taking this lock runs from either user contexts or from softirqs rtw_scan_timeout_handler() is the only function taking pmlmepriv->lock which uses spin_[un]lock_irq() for this. Switch back to spin_[un]lock_bh() to make it consistent with the rest of the code. Fixes: cc7ad0d77b51 ("drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()") Cc: Duoming Zhou Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20230221145326.7808-2-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index ea2a6566e51b..091842d70d48 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1590,11 +1590,11 @@ void rtw_scan_timeout_handler(struct timer_list *t) mlmepriv.scan_to_timer); struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - spin_lock_irq(&pmlmepriv->lock); + spin_lock_bh(&pmlmepriv->lock); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); - spin_unlock_irq(&pmlmepriv->lock); + spin_unlock_bh(&pmlmepriv->lock); rtw_indicate_scan_done(adapter, true); } From fea50d5fba5a03ddb5c81863533afdaa91002690 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 21 Feb 2023 15:53:25 +0100 Subject: [PATCH 036/185] drivers: staging: rtl8723bs: Remove unused clr_fwstate() function The clr_fwstate() function is not used anywhere, remove it. Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20230221145326.7808-3-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/rtw_mlme.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index 1b343b434f4d..ee748620107f 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -490,18 +490,6 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, signed int state) pmlmepriv->bScanInProcess = false; } -/* - * No Limit on the calling context, - * therefore set it to be the critical section... - */ -static inline void clr_fwstate(struct mlme_priv *pmlmepriv, signed int state) -{ - spin_lock_bh(&pmlmepriv->lock); - if (check_fwstate(pmlmepriv, state) == true) - pmlmepriv->fw_state ^= state; - spin_unlock_bh(&pmlmepriv->lock); -} - static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, signed int val) { spin_lock_bh(&pmlmepriv->lock); From 5a50c621a4513d9664c55b661400c0f04444c190 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 21 Feb 2023 15:53:26 +0100 Subject: [PATCH 037/185] drivers: staging: rtl8723bs: Remove pmlmepriv->num_of_scanned pmlmepriv->num_of_scanned is only ever set and never read, remove it. Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20230221145326.7808-4-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 9 --------- drivers/staging/rtl8723bs/include/rtw_mlme.h | 8 -------- 2 files changed, 17 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 091842d70d48..7e2c61c75150 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -32,8 +32,6 @@ int rtw_init_mlme_priv(struct adapter *padapter) INIT_LIST_HEAD(&pmlmepriv->scanned_queue.queue); spin_lock_init(&pmlmepriv->scanned_queue.lock); - set_scanned_network_val(pmlmepriv, 0); - memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid)); pbuf = vzalloc(array_size(MAX_BSS_CNT, sizeof(struct wlan_network))); @@ -161,8 +159,6 @@ struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv) pnetwork->aid = 0; pnetwork->join_res = 0; - pmlmepriv->num_of_scanned++; - exit: spin_unlock_bh(&free_queue->lock); @@ -198,8 +194,6 @@ void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwor list_add_tail(&(pnetwork->list), &(free_queue->queue)); - pmlmepriv->num_of_scanned--; - spin_unlock_bh(&free_queue->lock); } @@ -220,8 +214,6 @@ void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network * list_add_tail(&(pnetwork->list), get_list_head(free_queue)); - pmlmepriv->num_of_scanned--; - /* spin_unlock_irqrestore(&free_queue->lock, irqL); */ } @@ -863,7 +855,6 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) list_del_init(plist); list_add_tail(plist, &free_queue->queue); plist = ptemp; - pmlmepriv->num_of_scanned--; } spin_unlock_bh(&free_queue->lock); diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h index ee748620107f..fc0b43d38d9a 100644 --- a/drivers/staging/rtl8723bs/include/rtw_mlme.h +++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h @@ -303,7 +303,6 @@ struct mlme_priv { struct __queue free_bss_pool; struct __queue scanned_queue; u8 *free_bss_buf; - u32 num_of_scanned; struct ndis_802_11_ssid assoc_ssid; u8 assoc_bssid[6]; @@ -490,13 +489,6 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, signed int state) pmlmepriv->bScanInProcess = false; } -static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, signed int val) -{ - spin_lock_bh(&pmlmepriv->lock); - pmlmepriv->num_of_scanned = val; - spin_unlock_bh(&pmlmepriv->lock); -} - extern u16 rtw_get_capability(struct wlan_bssid_ex *bss); extern void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *target); extern void rtw_disconnect_hdl_under_linked(struct adapter *adapter, struct sta_info *psta, u8 free_assoc); From 466123c54f3153b77c7460e08850c385fa4fe3fc Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Thu, 9 Mar 2023 12:04:39 +0100 Subject: [PATCH 038/185] staging: rtl8192e: rtl92e_clear_irq() is not used The function rtl92e_clear_irq() is not used. Remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20230309110439.24504-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 9 --------- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h | 1 - 2 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 8edfaaeda910..db26e431f8b7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1969,15 +1969,6 @@ void rtl92e_disable_irq(struct net_device *dev) priv->irq_enabled = 0; } -void rtl92e_clear_irq(struct net_device *dev) -{ - u32 tmp; - - tmp = rtl92e_readl(dev, ISR); - rtl92e_writel(dev, ISR, tmp); -} - - void rtl92e_enable_rx(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 1713381dc2b4..fa3b71dbb091 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h @@ -18,7 +18,6 @@ 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_clear_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); From eab1fd002a4f1389496a17fe8b7bcdb510c6afed Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:50:31 +0100 Subject: [PATCH 039/185] staging: rtl8192e: Remove unused RF90_PATH_C and ..D in rtl92e_config_rf Remove unused case RF90_PATH_C and case RF90_PATH_D. The termination condition for the loop is set to priv->num_total_rf_path = RTL819X_TOTAL_RF_PATH = 2. Because of this eRFPath cannot reach the values 2 for RF90_PATH_C and 3 for RF90_PATH_D. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/3a62c8803712e7bf905886e670fe334a13d5d753.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 73a86e1d0701..ecbcf0d5bb68 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -74,12 +74,10 @@ bool rtl92e_config_rf(struct net_device *dev) switch (eRFPath) { case RF90_PATH_A: - case RF90_PATH_C: u4RegValue = rtl92e_get_bb_reg(dev, pPhyReg->rfintfs, bRFSI_RFENV); break; case RF90_PATH_B: - case RF90_PATH_D: u4RegValue = rtl92e_get_bb_reg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16); break; @@ -120,12 +118,10 @@ bool rtl92e_config_rf(struct net_device *dev) switch (eRFPath) { case RF90_PATH_A: - case RF90_PATH_C: rtl92e_set_bb_reg(dev, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); break; case RF90_PATH_B: - case RF90_PATH_D: rtl92e_set_bb_reg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); break; From 3faa16d5217b0abb5fcc1d5e0ea7b78a0d9df003 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:50:44 +0100 Subject: [PATCH 040/185] staging: rtl8192e: Remove unused RF90_PATH_C and ..D for rfintfs Remove unused priv->phy_reg_def[RF90_PATH_C].rfintfs and priv->phy_reg_def[RF90_PATH_D].rfintfs. The termination condition for the loop is set to priv->num_total_rf_path = RTL819X_TOTAL_RF_PATH = 2. Because of this pPhyReg = &priv->phy_reg_def[eRFPath]; pPhyReg cannot point to array element 2 for RF90_PATH_C and 3 for RF90_PATH_D. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/801d10f460acbf0601c78dee05c7b32f1628f3a8.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 1 - 2 files changed, 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index a9e83ba811b0..94b23cb53c36 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -358,8 +358,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; priv->phy_reg_def[RF90_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; - priv->phy_reg_def[RF90_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW; - priv->phy_reg_def[RF90_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW; priv->phy_reg_def[RF90_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; priv->phy_reg_def[RF90_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index f846f109ed98..616a4b62d4b9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -69,7 +69,6 @@ #define rFPGA0_XC_RFInterfaceOE 0x868 #define rFPGA0_XD_RFInterfaceOE 0x86c #define rFPGA0_XAB_RFInterfaceSW 0x870 -#define rFPGA0_XCD_RFInterfaceSW 0x874 #define rFPGA0_XAB_RFParameter 0x878 #define rFPGA0_XCD_RFParameter 0x87c #define rFPGA0_AnalogParameter1 0x880 From 308e4650ea173d0e337b496cd9ea67c0ae24c572 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:50:56 +0100 Subject: [PATCH 041/185] staging: rtl8192e: Remove unused variable rfintfi Remove unused variable rfintfi because it is just once set and not used. Remove unused constants as well. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/f251186fe59855eee3dd465954700a1d0ec50f53.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_def.h | 1 - drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 5 ----- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 2 -- 3 files changed, 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index ac192254a4bb..adedcea5824e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -103,7 +103,6 @@ enum rf_optype { struct bb_reg_definition { u32 rfintfs; - u32 rfintfi; u32 rfintfo; u32 rfintfe; u32 rf3wireOffset; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 94b23cb53c36..19fdf56e5e91 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -359,11 +359,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; priv->phy_reg_def[RF90_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; - priv->phy_reg_def[RF90_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; - priv->phy_reg_def[RF90_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB; - priv->phy_reg_def[RF90_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB; - priv->phy_reg_def[RF90_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB; - priv->phy_reg_def[RF90_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; priv->phy_reg_def[RF90_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; priv->phy_reg_def[RF90_PATH_C].rfintfo = rFPGA0_XC_RFInterfaceOE; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 616a4b62d4b9..5a47b232945f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -80,8 +80,6 @@ #define rFPGA0_XC_LSSIReadBack 0x8a8 #define rFPGA0_XD_LSSIReadBack 0x8ac #define rFPGA0_PSDReport 0x8b4 -#define rFPGA0_XAB_RFInterfaceRB 0x8e0 -#define rFPGA0_XCD_RFInterfaceRB 0x8e4 /* Page 9 - RF mode & OFDM TxSC */ #define rFPGA1_RFMOD 0x900 From 0b8f11cdcb3ab3e83bc5506d6e97d95f0093647b Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:51:11 +0100 Subject: [PATCH 042/185] staging: rtl8192e: Remove unused RF90_PATH_C and ..D for rfintfo and ..fe Remove unused priv->phy_reg_def[RF90_PATH_C].rfintfo and priv->phy_reg_def[RF90_PATH_D].rfintfo and remove unused priv->phy_reg_def[RF90_PATH_C].rfintfe and priv->phy_reg_def[RF90_PATH_D].rfintfe. The termination condition for the loop is set to priv->num_total_rf_path = RTL819X_TOTAL_RF_PATH = 2. Because of this pPhyReg = &priv->phy_reg_def[eRFPath]; pPhyReg cannot point to array element 2 for RF90_PATH_C and 3 for RF90_PATH_D. Remove unused constants as well. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/3c2237e2b4094129143594a5ab45691e9961e100.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 ---- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 19fdf56e5e91..a0dd628b1bf5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -361,13 +361,9 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; priv->phy_reg_def[RF90_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; - priv->phy_reg_def[RF90_PATH_C].rfintfo = rFPGA0_XC_RFInterfaceOE; - priv->phy_reg_def[RF90_PATH_D].rfintfo = rFPGA0_XD_RFInterfaceOE; priv->phy_reg_def[RF90_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; priv->phy_reg_def[RF90_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; - priv->phy_reg_def[RF90_PATH_C].rfintfe = rFPGA0_XC_RFInterfaceOE; - priv->phy_reg_def[RF90_PATH_D].rfintfe = rFPGA0_XD_RFInterfaceOE; priv->phy_reg_def[RF90_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; priv->phy_reg_def[RF90_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 5a47b232945f..ec39de9e89fe 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -66,8 +66,6 @@ #define rFPGA0_XCD_SwitchControl 0x85c #define rFPGA0_XA_RFInterfaceOE 0x860 #define rFPGA0_XB_RFInterfaceOE 0x864 -#define rFPGA0_XC_RFInterfaceOE 0x868 -#define rFPGA0_XD_RFInterfaceOE 0x86c #define rFPGA0_XAB_RFInterfaceSW 0x870 #define rFPGA0_XAB_RFParameter 0x878 #define rFPGA0_XCD_RFParameter 0x87c From 9272ddf969bc1656179c095b7fc683b08b1f6d5e Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:51:23 +0100 Subject: [PATCH 043/185] staging: rtl8192e: Remove unused RF90_PATH_C and ..D for rf3wireOffset Remove unused priv->phy_reg_def[RF90_PATH_C].rf3wireOffset and priv->phy_reg_def[RF90_PATH_D].rf3wireOffset. rf3wireOffset is used in _rtl92e_phy_rf_read and _rtl92e_phy_rf_write which are used in: rtl92e_set_rf_reg and rtl92e_get_rf_reg are used in: rtl92e_set_bandwidth (eRFPath only for 0 and 1) rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_phy_switch_channel_step (eRFPath only for 0 and 1) _rtl92e_dm_check_tx_power_tracking_thermal (eRFPath only for 0) rtl92e_check_bb_and_rf is used in: rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_bb_config_para_file (eRFPath only for 0) rtl92e_config_rf_path is used in: rtl92e_config_rf (eRFPath only for 0 and 1) Remove dead code and constants. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/180723eee77f70ffda1f8f0656c2f256f005c4ef.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index a0dd628b1bf5..1013ab95bc7b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -367,8 +367,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; priv->phy_reg_def[RF90_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; - priv->phy_reg_def[RF90_PATH_C].rf3wireOffset = rFPGA0_XC_LSSIParameter; - priv->phy_reg_def[RF90_PATH_D].rf3wireOffset = rFPGA0_XD_LSSIParameter; priv->phy_reg_def[RF90_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; priv->phy_reg_def[RF90_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index ec39de9e89fe..19acc44648e1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -58,8 +58,6 @@ #define rFPGA0_XD_HSSIParameter2 0x83c #define rFPGA0_XA_LSSIParameter 0x840 #define rFPGA0_XB_LSSIParameter 0x844 -#define rFPGA0_XC_LSSIParameter 0x848 -#define rFPGA0_XD_LSSIParameter 0x84c #define rFPGA0_RFWakeUpParameter 0x850 #define rFPGA0_RFSleepUpParameter 0x854 #define rFPGA0_XAB_SwitchControl 0x858 From 7358afd5bee314fc740d10c1de49a1038df478e0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:51:36 +0100 Subject: [PATCH 044/185] staging: rtl8192e: Remove unused variable rfLSSI_Select and rfTxGainStage Remove unused variable rfLSSI_Select and rfTxGainStage because they are just once set and not used. Remove unused constants as well. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/48f05998f4d2fe2df88ff14860cc8615dd72734d.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_def.h | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 ---------- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 2 -- 3 files changed, 14 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index adedcea5824e..2236c1aaf335 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -106,8 +106,6 @@ struct bb_reg_definition { u32 rfintfo; u32 rfintfe; u32 rf3wireOffset; - u32 rfLSSI_Select; - u32 rfTxGainStage; u32 rfHSSIPara1; u32 rfHSSIPara2; u32 rfSwitchControl; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 1013ab95bc7b..87f28718e732 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -368,16 +368,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; priv->phy_reg_def[RF90_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; - priv->phy_reg_def[RF90_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; - priv->phy_reg_def[RF90_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; - priv->phy_reg_def[RF90_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter; - priv->phy_reg_def[RF90_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter; - - priv->phy_reg_def[RF90_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; - priv->phy_reg_def[RF90_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; - priv->phy_reg_def[RF90_PATH_C].rfTxGainStage = rFPGA0_TxGainStage; - priv->phy_reg_def[RF90_PATH_D].rfTxGainStage = rFPGA0_TxGainStage; - priv->phy_reg_def[RF90_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; priv->phy_reg_def[RF90_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; priv->phy_reg_def[RF90_PATH_C].rfHSSIPara1 = rFPGA0_XC_HSSIParameter1; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 19acc44648e1..b68e84dd003f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -65,8 +65,6 @@ #define rFPGA0_XA_RFInterfaceOE 0x860 #define rFPGA0_XB_RFInterfaceOE 0x864 #define rFPGA0_XAB_RFInterfaceSW 0x870 -#define rFPGA0_XAB_RFParameter 0x878 -#define rFPGA0_XCD_RFParameter 0x87c #define rFPGA0_AnalogParameter1 0x880 #define rFPGA0_AnalogParameter2 0x884 #define rFPGA0_AnalogParameter3 0x888 From 37acdfa8beaa8669b0980e8ece6045047126469a Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:51:49 +0100 Subject: [PATCH 045/185] staging: rtl8192e: Remove unused variable rfHSSIPara1 and rfSwitchControl Remove unused variable rfHSSIPara1 and rfSwitchControl because they are just once set and not used. Remove unused constants as well. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/5f13420ce5598d447aaad0fe43b807467e0a15bb.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_def.h | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 ---------- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 6 ------ 3 files changed, 18 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index 2236c1aaf335..d42eac4b6012 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -106,9 +106,7 @@ struct bb_reg_definition { u32 rfintfo; u32 rfintfe; u32 rf3wireOffset; - u32 rfHSSIPara1; u32 rfHSSIPara2; - u32 rfSwitchControl; u32 rfAGCControl1; u32 rfAGCControl2; u32 rfRxIQImbalance; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 87f28718e732..add3de156e09 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -368,21 +368,11 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; priv->phy_reg_def[RF90_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; - priv->phy_reg_def[RF90_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; - priv->phy_reg_def[RF90_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; - priv->phy_reg_def[RF90_PATH_C].rfHSSIPara1 = rFPGA0_XC_HSSIParameter1; - priv->phy_reg_def[RF90_PATH_D].rfHSSIPara1 = rFPGA0_XD_HSSIParameter1; - priv->phy_reg_def[RF90_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; priv->phy_reg_def[RF90_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; priv->phy_reg_def[RF90_PATH_C].rfHSSIPara2 = rFPGA0_XC_HSSIParameter2; priv->phy_reg_def[RF90_PATH_D].rfHSSIPara2 = rFPGA0_XD_HSSIParameter2; - priv->phy_reg_def[RF90_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; - priv->phy_reg_def[RF90_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl; - priv->phy_reg_def[RF90_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl; - priv->phy_reg_def[RF90_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl; - priv->phy_reg_def[RF90_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; priv->phy_reg_def[RF90_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; priv->phy_reg_def[RF90_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index b68e84dd003f..5062be507a30 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -48,20 +48,14 @@ #define rFPGA0_TxGainStage 0x80c #define rFPGA0_RFTiming1 0x810 #define rFPGA0_RFTiming2 0x814 -#define rFPGA0_XA_HSSIParameter1 0x820 #define rFPGA0_XA_HSSIParameter2 0x824 -#define rFPGA0_XB_HSSIParameter1 0x828 #define rFPGA0_XB_HSSIParameter2 0x82c -#define rFPGA0_XC_HSSIParameter1 0x830 #define rFPGA0_XC_HSSIParameter2 0x834 -#define rFPGA0_XD_HSSIParameter1 0x838 #define rFPGA0_XD_HSSIParameter2 0x83c #define rFPGA0_XA_LSSIParameter 0x840 #define rFPGA0_XB_LSSIParameter 0x844 #define rFPGA0_RFWakeUpParameter 0x850 #define rFPGA0_RFSleepUpParameter 0x854 -#define rFPGA0_XAB_SwitchControl 0x858 -#define rFPGA0_XCD_SwitchControl 0x85c #define rFPGA0_XA_RFInterfaceOE 0x860 #define rFPGA0_XB_RFInterfaceOE 0x864 #define rFPGA0_XAB_RFInterfaceSW 0x870 From 76535902f6d4ab1b0e81894e770476da3e8b199e Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:52:02 +0100 Subject: [PATCH 046/185] staging: rtl8192e: Remove unused variable rfAGCControl1 and rfAGCControl2 Remove unused variable rfAGCControl1 and rfAGCControl2 because they are just once set and not used. Remove unused constants as well. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/0f191930597517cf88eb6effd4c20a46c99571ad.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_def.h | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 ---------- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 4 ---- 3 files changed, 16 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index d42eac4b6012..a5d99891688d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -107,8 +107,6 @@ struct bb_reg_definition { u32 rfintfe; u32 rf3wireOffset; u32 rfHSSIPara2; - u32 rfAGCControl1; - u32 rfAGCControl2; u32 rfRxIQImbalance; u32 rfRxAFE; u32 rfTxIQImbalance; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index add3de156e09..32806bcc953a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -373,16 +373,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_C].rfHSSIPara2 = rFPGA0_XC_HSSIParameter2; priv->phy_reg_def[RF90_PATH_D].rfHSSIPara2 = rFPGA0_XD_HSSIParameter2; - priv->phy_reg_def[RF90_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; - priv->phy_reg_def[RF90_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; - priv->phy_reg_def[RF90_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1; - priv->phy_reg_def[RF90_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1; - - priv->phy_reg_def[RF90_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2; - priv->phy_reg_def[RF90_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2; - priv->phy_reg_def[RF90_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2; - priv->phy_reg_def[RF90_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2; - priv->phy_reg_def[RF90_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; priv->phy_reg_def[RF90_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; priv->phy_reg_def[RF90_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 5062be507a30..d0ea7e06f0f7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -117,13 +117,9 @@ #define rOFDM0_CCADropThreshold 0xc48 #define rOFDM0_ECCAThreshold 0xc4c /* Energy CCA */ #define rOFDM0_XAAGCCore1 0xc50 -#define rOFDM0_XAAGCCore2 0xc54 #define rOFDM0_XBAGCCore1 0xc58 -#define rOFDM0_XBAGCCore2 0xc5c #define rOFDM0_XCAGCCore1 0xc60 -#define rOFDM0_XCAGCCore2 0xc64 #define rOFDM0_XDAGCCore1 0xc68 -#define rOFDM0_XDAGCCore2 0xc6c #define rOFDM0_AGCParameter1 0xc70 #define rOFDM0_AGCParameter2 0xc74 #define rOFDM0_AGCRSSITable 0xc78 From 6362c2acfc3a2629fdbfdc130b6f54c5e63e0532 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:52:15 +0100 Subject: [PATCH 047/185] staging: rtl8192e: Remove unused variable rfRxIQImbalance and rfRxAFE Remove unused variable rfRxIQImbalance and rfRxAFE because they are just once set and not used. Remove unused constants with commenting line. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/1d578fc962c938e76bc0df529a3c24bba7abe049.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_def.h | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 ---------- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 9 --------- 3 files changed, 21 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index a5d99891688d..a5c2ff5b4260 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -107,8 +107,6 @@ struct bb_reg_definition { u32 rfintfe; u32 rf3wireOffset; u32 rfHSSIPara2; - u32 rfRxIQImbalance; - u32 rfRxAFE; u32 rfTxIQImbalance; u32 rfTxAFE; u32 rfLSSIReadBack; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 32806bcc953a..5b63b9eac090 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -373,16 +373,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_C].rfHSSIPara2 = rFPGA0_XC_HSSIParameter2; priv->phy_reg_def[RF90_PATH_D].rfHSSIPara2 = rFPGA0_XD_HSSIParameter2; - priv->phy_reg_def[RF90_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; - priv->phy_reg_def[RF90_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; - priv->phy_reg_def[RF90_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance; - priv->phy_reg_def[RF90_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance; - - priv->phy_reg_def[RF90_PATH_A].rfRxAFE = rOFDM0_XARxAFE; - priv->phy_reg_def[RF90_PATH_B].rfRxAFE = rOFDM0_XBRxAFE; - priv->phy_reg_def[RF90_PATH_C].rfRxAFE = rOFDM0_XCRxAFE; - priv->phy_reg_def[RF90_PATH_D].rfRxAFE = rOFDM0_XDRxAFE; - priv->phy_reg_def[RF90_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; priv->phy_reg_def[RF90_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; priv->phy_reg_def[RF90_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index d0ea7e06f0f7..78e90bf5d79f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -98,15 +98,6 @@ #define rOFDM0_TRxPathEnable 0xc04 #define rOFDM0_TRMuxPar 0xc08 #define rOFDM0_TRSWIsolation 0xc0c -/* RxIQ DC offset, Rx digital filter, DC notch filter */ -#define rOFDM0_XARxAFE 0xc10 -#define rOFDM0_XARxIQImbalance 0xc14 /* RxIQ imbalance matrix */ -#define rOFDM0_XBRxAFE 0xc18 -#define rOFDM0_XBRxIQImbalance 0xc1c -#define rOFDM0_XCRxAFE 0xc20 -#define rOFDM0_XCRxIQImbalance 0xc24 -#define rOFDM0_XDRxAFE 0xc28 -#define rOFDM0_XDRxIQImbalance 0xc2c #define rOFDM0_RxDetector1 0xc30 /* PD, BW & SBD */ #define rOFDM0_RxDetector2 0xc34 /* SBD */ #define rOFDM0_RxDetector3 0xc38 /* Frame Sync */ From 5a828b61b8b6300384fad60aa2d7fe340ff4957d Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:52:31 +0100 Subject: [PATCH 048/185] staging: rtl8192e: Remove unused variable rfTxIQImbalance and rfTxAFE Remove unused variable rfTxIQImbalance and rfTxAFE because they are just once set and not used. Remove unused constants. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/62453061bcf1858c23ba57bf1f279999b37b4cc3.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8190P_def.h | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 10 ---------- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 5 ----- 3 files changed, 17 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index a5c2ff5b4260..385cca79f484 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h @@ -107,8 +107,6 @@ struct bb_reg_definition { u32 rfintfe; u32 rf3wireOffset; u32 rfHSSIPara2; - u32 rfTxIQImbalance; - u32 rfTxAFE; u32 rfLSSIReadBack; u32 rfLSSIReadBackPi; }; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 5b63b9eac090..fe12df93bc60 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -373,16 +373,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_C].rfHSSIPara2 = rFPGA0_XC_HSSIParameter2; priv->phy_reg_def[RF90_PATH_D].rfHSSIPara2 = rFPGA0_XD_HSSIParameter2; - priv->phy_reg_def[RF90_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; - priv->phy_reg_def[RF90_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; - priv->phy_reg_def[RF90_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance; - priv->phy_reg_def[RF90_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance; - - priv->phy_reg_def[RF90_PATH_A].rfTxAFE = rOFDM0_XATxAFE; - priv->phy_reg_def[RF90_PATH_B].rfTxAFE = rOFDM0_XBTxAFE; - priv->phy_reg_def[RF90_PATH_C].rfTxAFE = rOFDM0_XCTxAFE; - priv->phy_reg_def[RF90_PATH_D].rfTxAFE = rOFDM0_XDTxAFE; - priv->phy_reg_def[RF90_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; priv->phy_reg_def[RF90_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; priv->phy_reg_def[RF90_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 78e90bf5d79f..fe05a94561e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -117,12 +117,7 @@ #define rOFDM0_HTSTFAGC 0xc7c #define rOFDM0_XATxIQImbalance 0xc80 #define rOFDM0_XATxAFE 0xc84 -#define rOFDM0_XBTxIQImbalance 0xc88 -#define rOFDM0_XBTxAFE 0xc8c #define rOFDM0_XCTxIQImbalance 0xc90 -#define rOFDM0_XCTxAFE 0xc94 -#define rOFDM0_XDTxIQImbalance 0xc98 -#define rOFDM0_XDTxAFE 0xc9c #define rOFDM0_RxHPParameter 0xce0 #define rOFDM0_TxPseudoNoiseWgt 0xce4 #define rOFDM0_FrameSync 0xcf0 From 9d5e2ea45b58c5180aefdf1ef5071e9af445f11b Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:52:46 +0100 Subject: [PATCH 049/185] staging: rtl8192e: Remove unused RF90_PATH_C and ..D for rfLSSIReadBack Remove unused priv->phy_reg_def[RF90_PATH_C].rfLSSIReadBack and priv->phy_reg_def[RF90_PATH_D].rfLSSIReadBack. rfLSSIReadBack is used in: _rtl92e_phy_rf_read which is used in: rtl92e_set_rf_reg and rtl92e_get_rf_reg are used in: rtl92e_set_bandwidth (eRFPath only for 0 and 1) rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_phy_switch_channel_step (eRFPath only for 0 and 1) _rtl92e_dm_check_tx_power_tracking_thermal (eRFPath only for 0) rtl92e_check_bb_and_rf is used in: rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_bb_config_para_file (eRFPath only for 0) rtl92e_config_rf_path is used in: rtl92e_config_rf (eRFPath only for 0 and 1) Remove dead code and constants. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/622777b394a896b6db08eb7faeb455e5cbeae93f.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 3 --- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index fe12df93bc60..b26ea8dfd871 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -375,9 +375,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; priv->phy_reg_def[RF90_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; - priv->phy_reg_def[RF90_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; - priv->phy_reg_def[RF90_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack; - } bool rtl92e_check_bb_and_rf(struct net_device *dev, enum hw90_block CheckBlock, diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index fe05a94561e8..28f9af71f193 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -65,8 +65,6 @@ #define rFPGA0_AnalogParameter4 0x88c #define rFPGA0_XA_LSSIReadBack 0x8a0 #define rFPGA0_XB_LSSIReadBack 0x8a4 -#define rFPGA0_XC_LSSIReadBack 0x8a8 -#define rFPGA0_XD_LSSIReadBack 0x8ac #define rFPGA0_PSDReport 0x8b4 /* Page 9 - RF mode & OFDM TxSC */ From 3e83b45cb66a6077300bae384b59cdd2b66b00e0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 11 Mar 2023 22:52:53 +0100 Subject: [PATCH 050/185] staging: rtl8192e: Remove unused RF90_PATH_C and ..D for rfHSSIPara2 Remove unused priv->phy_reg_def[RF90_PATH_C].rfHSSIPara2 and priv->phy_reg_def[RF90_PATH_D].rfHSSIPara2. rfHSSIPara2 is used in rtl92e_set_bb_reg which is used in: rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_phy_rf_read which is used in: rtl92e_set_rf_reg and rtl92e_get_rf_reg are used in: rtl92e_set_bandwidth (eRFPath only for 0 and 1) rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_phy_switch_channel_step (eRFPath only for 0 and 1) _rtl92e_dm_check_tx_power_tracking_thermal (eRFPath only for 0) rtl92e_check_bb_and_rf is used in: rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_bb_config_para_file (eRFPath only for 0) rtl92e_config_rf_path is used in: rtl92e_config_rf (eRFPath only for 0 and 1) Remove dead code and constants. Signed-off-by: Philipp Hortmann Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/186f3e59e736de6fd2111e835cdb4b633ca41bbc.1678569965.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index b26ea8dfd871..e3886db3bfbb 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -370,8 +370,6 @@ static void _rtl92e_init_bb_rf_reg_def(struct net_device *dev) priv->phy_reg_def[RF90_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; priv->phy_reg_def[RF90_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; - priv->phy_reg_def[RF90_PATH_C].rfHSSIPara2 = rFPGA0_XC_HSSIParameter2; - priv->phy_reg_def[RF90_PATH_D].rfHSSIPara2 = rFPGA0_XD_HSSIParameter2; priv->phy_reg_def[RF90_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; priv->phy_reg_def[RF90_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 28f9af71f193..e1b30fbdf8cc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h @@ -50,8 +50,6 @@ #define rFPGA0_RFTiming2 0x814 #define rFPGA0_XA_HSSIParameter2 0x824 #define rFPGA0_XB_HSSIParameter2 0x82c -#define rFPGA0_XC_HSSIParameter2 0x834 -#define rFPGA0_XD_HSSIParameter2 0x83c #define rFPGA0_XA_LSSIParameter 0x840 #define rFPGA0_XB_LSSIParameter 0x844 #define rFPGA0_RFWakeUpParameter 0x850 From 7c4b9278d44c567f335ef3714e201e1f2074bb9d Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 13 Mar 2023 23:46:27 +0100 Subject: [PATCH 051/185] staging: rtl8192e: Replace RF90_PATH_C in test expression of for loop Replace RF90_PATH_C in test expression of the for loop with the variable that is commonly used. This avoids false hits when searching for usage of RF90_PATH_C and therefore improves readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/f9af7a3d3e608206a4aa4ba2bd377b9201111b3f.1678740713.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index db26e431f8b7..fb4eede0470a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1514,7 +1514,7 @@ static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer, return; if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { - for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++) { + for (rfpath = RF90_PATH_A; rfpath < priv->num_total_rf_path; rfpath++) { if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath)) continue; if (priv->stats.rx_rssi_percentage[rfpath] == 0) { From f933c226ceae738f5e9daeb73eab304bb7e3bfcc Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 13 Mar 2023 23:46:33 +0100 Subject: [PATCH 052/185] staging: rtl8192e: Remove function rtl92e_is_legal_rf_path Remove function rtl92e_is_legal_rf_path that will always return 1. Reason is that the eRFPath is always 0 for RF90_PATH_A or 1 for RF90_PATH_B but never 2 or 3. In most usage cases this is easy to see but for the following functions that use rtl92e_is_legal_rf_path it is more difficult: rtl92e_set_rf_reg and rtl92e_get_rf_reg are used in: rtl92e_set_bandwidth (eRFPath only for 0 and 1) rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_phy_switch_channel_step (eRFPath only for 0 and 1) _rtl92e_dm_check_tx_power_tracking_thermal (eRFPath only for 0) rtl92e_check_bb_and_rf is used in: rtl92e_config_rf (eRFPath only for 0 and 1) _rtl92e_bb_config_para_file (eRFPath only for 0) rtl92e_config_rf_path is used in: rtl92e_config_rf (eRFPath only for 0 and 1) Remove dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/b801f1f9ff3c58aedab4e3e07b2ec0a816fdf5d9.1678740713.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 6 ------ drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 -- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 18 ------------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - 4 files changed, 27 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index ecbcf0d5bb68..bb4539e337c8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -22,9 +22,6 @@ void rtl92e_set_bandwidth(struct net_device *dev, } for (eRFPath = 0; eRFPath < priv->num_total_rf_path; eRFPath++) { - if (!rtl92e_is_legal_rf_path(dev, eRFPath)) - continue; - switch (bandwidth) { case HT_CHANNEL_WIDTH_20: rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, @@ -67,9 +64,6 @@ bool rtl92e_config_rf(struct net_device *dev) for (eRFPath = (enum rf90_radio_path)RF90_PATH_A; eRFPath < priv->num_total_rf_path; eRFPath++) { - if (!rtl92e_is_legal_rf_path(dev, eRFPath)) - continue; - pPhyReg = &priv->phy_reg_def[eRFPath]; switch (eRFPath) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index fb4eede0470a..1e7be321721b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1515,8 +1515,6 @@ static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (!prev_st->bIsCCK && prev_st->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath < priv->num_total_rf_path; rfpath++) { - if (!rtl92e_is_legal_rf_path(priv->rtllib->dev, rfpath)) - continue; if (priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = prev_st->RxMIMOSignalStrength[rfpath]; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index e3886db3bfbb..51a20379dca0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -47,20 +47,6 @@ static u32 _rtl92e_calculate_bit_shift(u32 dwBitMask) return ffs(dwBitMask) - 1; } -u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath) -{ - u8 ret = 1; - struct r8192_priv *priv = rtllib_priv(dev); - - if (priv->rf_type == RF_1T2R) { - if (eRFPath == RF90_PATH_A || eRFPath == RF90_PATH_B) - ret = 1; - else if (eRFPath == RF90_PATH_C || eRFPath == RF90_PATH_D) - ret = 0; - } - return ret; -} - void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData) { @@ -196,8 +182,6 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, struct r8192_priv *priv = rtllib_priv(dev); u32 Original_Value, BitShift, New_Value; - if (!rtl92e_is_legal_rf_path(dev, eRFPath)) - return; if (priv->rtllib->rf_power_state != rf_on && !priv->being_init_adapter) return; @@ -233,8 +217,6 @@ u32 rtl92e_get_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, u32 Original_Value, Readback_Value, BitShift; struct r8192_priv *priv = rtllib_priv(dev); - if (!rtl92e_is_legal_rf_path(dev, eRFPath)) - return 0; if (priv->rtllib->rf_power_state != rf_on && !priv->being_init_adapter) return 0; mutex_lock(&priv->rf_mutex); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index ac640033e843..f1d183ed7ca4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -49,7 +49,6 @@ enum rf90_radio_path { #define bMaskLWord 0x0000ffff #define bMaskDWord 0xffffffff -u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath); void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData); u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask); From 3dcf9a25d85a0e2bb619c045a64845cccdaf9fc3 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:42:56 +0100 Subject: [PATCH 053/185] staging: rtl8192e: Join constants AGCTAB_ArrayLength with ..LengthPciE Join constants AGCTAB_ArrayLength with AGCTAB_ArrayLengthPciE to RTL8192E_AGCTAB_ARR_LEN to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/98a7553403ef95609fbcb84e4cc653628b96c56c.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 51a20379dca0..54596982bc76 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -312,7 +312,7 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType) u16 AGCTAB_ArrayLen, PHY_REGArrayLen = 0; struct r8192_priv *priv = rtllib_priv(dev); - AGCTAB_ArrayLen = AGCTAB_ArrayLength; + AGCTAB_ArrayLen = RTL8192E_AGCTAB_ARR_LEN; Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array; if (priv->rf_type == RF_1T2R) { PHY_REGArrayLen = PHY_REG_1T2RArrayLength; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index f1d183ed7ca4..d984380bcca3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define AGCTAB_ArrayLength AGCTAB_ArrayLengthPciE #define MACPHY_ArrayLength MACPHY_ArrayLengthPciE #define RadioA_ArrayLength RadioA_ArrayLengthPciE #define RadioB_ArrayLength RadioB_ArrayLengthPciE diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 7101061e3519..be6c4b7c0e0e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -347,7 +347,7 @@ u32 Rtl8192PciEMACPHY_Array_PG[] = { 0x318, 0x00000fff, 0x00000800, }; -u32 Rtl8192PciEAGCTAB_Array[AGCTAB_ArrayLengthPciE] = { +u32 Rtl8192PciEAGCTAB_Array[RTL8192E_AGCTAB_ARR_LEN] = { 0xc78, 0x7d000001, 0xc78, 0x7d010001, 0xc78, 0x7d020001, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index b6d4e9696452..439847b1f52b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -21,7 +21,7 @@ extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE]; #define MACPHY_Array_PGLengthPciE 30 extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE]; -#define AGCTAB_ArrayLengthPciE 384 -extern u32 Rtl8192PciEAGCTAB_Array[AGCTAB_ArrayLengthPciE]; +#define RTL8192E_AGCTAB_ARR_LEN 384 +extern u32 Rtl8192PciEAGCTAB_Array[RTL8192E_AGCTAB_ARR_LEN]; #endif From 27d218e343f980a252e8d08938cbebea2563e04c Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:03 +0100 Subject: [PATCH 054/185] staging: rtl8192e: Join constants MACPHY_ArrayLength with ..LengthPciE Join constants MACPHY_ArrayLength with MACPHY_ArrayLengthPciE to RTL8192E_MACPHY_ARR_LEN to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/881ce5739e4237ea9a31029acaa535422d41fa5f.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.h | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 54596982bc76..29918a529f77 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -291,7 +291,7 @@ void rtl92e_config_mac(struct net_device *dev) pdwArray = Rtl819XMACPHY_Array_PG; } else { - dwArrayLen = MACPHY_ArrayLength; + dwArrayLen = RTL8192E_MACPHY_ARR_LEN; pdwArray = Rtl819XMACPHY_Array; } for (i = 0; i < dwArrayLen; i += 3) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index d984380bcca3..611756517ce6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define MACPHY_ArrayLength MACPHY_ArrayLengthPciE #define RadioA_ArrayLength RadioA_ArrayLengthPciE #define RadioB_ArrayLength RadioB_ArrayLengthPciE #define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 439847b1f52b..cb424c8fbee0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -17,8 +17,8 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE]; #define RadioB_ArrayLengthPciE 78 extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; -#define MACPHY_ArrayLengthPciE 18 -extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE]; +#define RTL8192E_MACPHY_ARR_LEN 18 +extern u32 Rtl8192PciEMACPHY_Array[RTL8192E_MACPHY_ARR_LEN]; #define MACPHY_Array_PGLengthPciE 30 extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE]; #define RTL8192E_AGCTAB_ARR_LEN 384 From 8f214347a71e0f57d80f44e2079a282c745a4dca Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:11 +0100 Subject: [PATCH 055/185] staging: rtl8192e: Join constants RadioA_ArrayLength with ..LengthPciE Join constants RadioA_ArrayLength with RadioA_ArrayLengthPciE to RTL8192E_RADIO_A_ARR_LEN to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/a03372c15cf1489b964d48d667f39c6e231fa190.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 29918a529f77..e4d1b7ad64ac 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -542,7 +542,7 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) switch (eRFPath) { case RF90_PATH_A: - for (i = 0; i < RadioA_ArrayLength; i += 2) { + for (i = 0; i < RTL8192E_RADIO_A_ARR_LEN; i += 2) { if (Rtl819XRadioA_Array[i] == 0xfe) { msleep(100); continue; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 611756517ce6..8f9200bed456 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define RadioA_ArrayLength RadioA_ArrayLengthPciE #define RadioB_ArrayLength RadioB_ArrayLengthPciE #define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE #define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index be6c4b7c0e0e..5820c47f4e14 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -157,7 +157,7 @@ u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE] = { 0xe1c, 0x12121416, }; -u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE] = { +u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN] = { 0x019, 0x00000003, 0x000, 0x000000bf, 0x001, 0x00000ee0, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index cb424c8fbee0..d177b7b17b19 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -13,8 +13,8 @@ #define PHY_REG_1T2RArrayLengthPciE 296 extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; -#define RadioA_ArrayLengthPciE 246 -extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE]; +#define RTL8192E_RADIO_A_ARR_LEN 246 +extern u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN]; #define RadioB_ArrayLengthPciE 78 extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; #define RTL8192E_MACPHY_ARR_LEN 18 From ae9cb2196468e7e201d5a99c0a6f7fdb12719f59 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:18 +0100 Subject: [PATCH 056/185] staging: rtl8192e: Join constants RadioB_ArrayLength with ..LengthPciE Join constants RadioB_ArrayLength with RadioB_ArrayLengthPciE to RTL8192E_RADIO_B_ARR_LEN to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/1f48c0691eb4627be81fc39d08762617a6c58a08.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index e4d1b7ad64ac..e42b77f91528 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -554,7 +554,7 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) } break; case RF90_PATH_B: - for (i = 0; i < RadioB_ArrayLength; i += 2) { + for (i = 0; i < RTL8192E_RADIO_B_ARR_LEN; i += 2) { if (Rtl819XRadioB_Array[i] == 0xfe) { msleep(100); continue; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 8f9200bed456..e9ff224953f9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define RadioB_ArrayLength RadioB_ArrayLengthPciE #define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE #define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 5820c47f4e14..5c9844f4d117 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -283,7 +283,7 @@ u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN] = { 0x007, 0x00000700, }; -u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = { +u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN] = { 0x019, 0x00000003, 0x000, 0x000000bf, 0x001, 0x000006e0, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index d177b7b17b19..174a4dfb1855 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -15,8 +15,8 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; #define RTL8192E_RADIO_A_ARR_LEN 246 extern u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN]; -#define RadioB_ArrayLengthPciE 78 -extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; +#define RTL8192E_RADIO_B_ARR_LEN 78 +extern u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN]; #define RTL8192E_MACPHY_ARR_LEN 18 extern u32 Rtl8192PciEMACPHY_Array[RTL8192E_MACPHY_ARR_LEN]; #define MACPHY_Array_PGLengthPciE 30 From b89dd56751257a0aff2ed5af38945cdd6e318fdd Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:24 +0100 Subject: [PATCH 057/185] staging: rtl8192e: Join constants MACPHY_Array_PGLength with ..LengthPciE Join constants MACPHY_Array_PGLength with MACPHY_Array_PGLengthPciE to RTL8192E_MACPHY_ARR_PG_LEN to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6d86257ddf3fecbf2bb104f1eeedbf09a56e0861.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.h | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index e42b77f91528..86d51eb7af17 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -287,7 +287,7 @@ void rtl92e_config_mac(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); if (priv->tx_pwr_data_read_from_eeprom) { - dwArrayLen = MACPHY_Array_PGLength; + dwArrayLen = RTL8192E_MACPHY_ARR_PG_LEN; pdwArray = Rtl819XMACPHY_Array_PG; } else { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index e9ff224953f9..73a532b96777 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE #define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE #define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 174a4dfb1855..70c31d56ea14 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -19,8 +19,8 @@ extern u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN]; extern u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN]; #define RTL8192E_MACPHY_ARR_LEN 18 extern u32 Rtl8192PciEMACPHY_Array[RTL8192E_MACPHY_ARR_LEN]; -#define MACPHY_Array_PGLengthPciE 30 -extern u32 Rtl8192PciEMACPHY_Array_PG[MACPHY_Array_PGLengthPciE]; +#define RTL8192E_MACPHY_ARR_PG_LEN 30 +extern u32 Rtl8192PciEMACPHY_Array_PG[RTL8192E_MACPHY_ARR_PG_LEN]; #define RTL8192E_AGCTAB_ARR_LEN 384 extern u32 Rtl8192PciEAGCTAB_Array[RTL8192E_AGCTAB_ARR_LEN]; From abeb432189962c0248657a92f7b13f80febe97a2 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:32 +0100 Subject: [PATCH 058/185] staging: rtl8192e: Join constants PHY_REG_1T2RArray.. with ..LengthPciE Join constants PHY_REG_1T2RArrayLength with PHY_REG_1T2RArrayLengthPciE to RTL8192E_PHY_REG_1T2R_ARR_LEN to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/0e24d00350bd2c6d17558ea6b6667209e15073d2.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 86d51eb7af17..231bd49b8892 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -315,7 +315,7 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType) AGCTAB_ArrayLen = RTL8192E_AGCTAB_ARR_LEN; Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array; if (priv->rf_type == RF_1T2R) { - PHY_REGArrayLen = PHY_REG_1T2RArrayLength; + PHY_REGArrayLen = RTL8192E_PHY_REG_1T2R_ARR_LEN; Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 73a532b96777..96c581475ffe 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,8 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE - #define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG #define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array #define Rtl819XRadioA_Array Rtl8192PciERadioA_Array diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 5c9844f4d117..b2cf4d147c63 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -6,7 +6,7 @@ */ #include "table.h" -u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE] = { +u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN] = { 0x800, 0x00000000, 0x804, 0x00000001, 0x808, 0x0000fc00, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 70c31d56ea14..d00aa394c36a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -11,8 +11,8 @@ #include -#define PHY_REG_1T2RArrayLengthPciE 296 -extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE]; +#define RTL8192E_PHY_REG_1T2R_ARR_LEN 296 +extern u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN]; #define RTL8192E_RADIO_A_ARR_LEN 246 extern u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN]; #define RTL8192E_RADIO_B_ARR_LEN 78 From 85246543066536a352d72b53dc2852fe0d3ae6a8 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:43 +0100 Subject: [PATCH 059/185] staging: rtl8192e: Join constants Rtl819XMACPHY_..PG with Rtl8192PciE.. Join constants Rtl819XMACPHY_Array_PG with Rtl8192PciEMACPHY_Array_PG to RTL8192E_MACPHY_ARR_PG to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/c8effbad931c1f7bcdee7245bf16bd2e85c03679.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 231bd49b8892..ef33f651f018 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -288,7 +288,7 @@ void rtl92e_config_mac(struct net_device *dev) if (priv->tx_pwr_data_read_from_eeprom) { dwArrayLen = RTL8192E_MACPHY_ARR_PG_LEN; - pdwArray = Rtl819XMACPHY_Array_PG; + pdwArray = RTL8192E_MACPHY_ARR_PG; } else { dwArrayLen = RTL8192E_MACPHY_ARR_LEN; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 96c581475ffe..694528ca7910 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG #define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array #define Rtl819XRadioA_Array Rtl8192PciERadioA_Array #define Rtl819XRadioB_Array Rtl8192PciERadioB_Array diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index b2cf4d147c63..aed1c46dedf6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -334,7 +334,7 @@ u32 Rtl8192PciEMACPHY_Array[] = { 0x318, 0x00000fff, 0x00000100, }; -u32 Rtl8192PciEMACPHY_Array_PG[] = { +u32 RTL8192E_MACPHY_ARR_PG[] = { 0x03c, 0xffff0000, 0x00000f0f, 0xe00, 0xffffffff, 0x06090909, 0xe04, 0xffffffff, 0x00030306, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index d00aa394c36a..f94975b112aa 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -20,7 +20,7 @@ extern u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN]; #define RTL8192E_MACPHY_ARR_LEN 18 extern u32 Rtl8192PciEMACPHY_Array[RTL8192E_MACPHY_ARR_LEN]; #define RTL8192E_MACPHY_ARR_PG_LEN 30 -extern u32 Rtl8192PciEMACPHY_Array_PG[RTL8192E_MACPHY_ARR_PG_LEN]; +extern u32 RTL8192E_MACPHY_ARR_PG[RTL8192E_MACPHY_ARR_PG_LEN]; #define RTL8192E_AGCTAB_ARR_LEN 384 extern u32 Rtl8192PciEAGCTAB_Array[RTL8192E_AGCTAB_ARR_LEN]; From bfe890e59253f667b1ccccfa46051251ad513d51 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:52 +0100 Subject: [PATCH 060/185] staging: rtl8192e: Join constants Rtl819XMACPHY_.. with Rtl8192PciE.. Join constants Rtl819XMACPHY_Array with Rtl8192PciEMACPHY_Array to RTL8192E_MACPHY_ARR to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6e5609e6b31892671d203c9da1a947bd42b70c37.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index ef33f651f018..bf4fec83d316 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -292,7 +292,7 @@ void rtl92e_config_mac(struct net_device *dev) } else { dwArrayLen = RTL8192E_MACPHY_ARR_LEN; - pdwArray = Rtl819XMACPHY_Array; + pdwArray = RTL8192E_MACPHY_ARR; } for (i = 0; i < dwArrayLen; i += 3) { if (pdwArray[i] == 0x318) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 694528ca7910..2d2b80bc1f21 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array #define Rtl819XRadioA_Array Rtl8192PciERadioA_Array #define Rtl819XRadioB_Array Rtl8192PciERadioB_Array #define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index aed1c46dedf6..0ab786d35682 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -325,7 +325,7 @@ u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN] = { 0x007, 0x00000700, }; -u32 Rtl8192PciEMACPHY_Array[] = { +u32 RTL8192E_MACPHY_ARR[] = { 0x03c, 0xffff0000, 0x00000f0f, 0x340, 0xffffffff, 0x161a1a1a, 0x344, 0xffffffff, 0x12121416, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index f94975b112aa..c6c7d4cd313e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -18,7 +18,7 @@ extern u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN]; #define RTL8192E_RADIO_B_ARR_LEN 78 extern u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN]; #define RTL8192E_MACPHY_ARR_LEN 18 -extern u32 Rtl8192PciEMACPHY_Array[RTL8192E_MACPHY_ARR_LEN]; +extern u32 RTL8192E_MACPHY_ARR[RTL8192E_MACPHY_ARR_LEN]; #define RTL8192E_MACPHY_ARR_PG_LEN 30 extern u32 RTL8192E_MACPHY_ARR_PG[RTL8192E_MACPHY_ARR_PG_LEN]; #define RTL8192E_AGCTAB_ARR_LEN 384 From abb3551a4af8c16f2d478185b315258a62a13966 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:43:59 +0100 Subject: [PATCH 061/185] staging: rtl8192e: Join constants Rtl819XRadioA_.. with ..RadioA_.. Join constants Rtl819XRadioA_Array with Rtl8192PciERadioA_Array to RTL8192E_RADIO_A_ARR to improve readability. Fix spaces around '+' to improve coding style. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/0ce85e55fd9ddd5459590d756a951809b6a1b9ee.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index bf4fec83d316..49fdaacb788a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -543,13 +543,13 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) switch (eRFPath) { case RF90_PATH_A: for (i = 0; i < RTL8192E_RADIO_A_ARR_LEN; i += 2) { - if (Rtl819XRadioA_Array[i] == 0xfe) { + if (RTL8192E_RADIO_A_ARR[i] == 0xfe) { msleep(100); continue; } - rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioA_Array[i], + rtl92e_set_rf_reg(dev, eRFPath, RTL8192E_RADIO_A_ARR[i], bMask12Bits, - Rtl819XRadioA_Array[i+1]); + RTL8192E_RADIO_A_ARR[i + 1]); } break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 2d2b80bc1f21..74c7850e514c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define Rtl819XRadioA_Array Rtl8192PciERadioA_Array #define Rtl819XRadioB_Array Rtl8192PciERadioB_Array #define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array #define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 0ab786d35682..4f36a480f6f2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -157,7 +157,7 @@ u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN] = { 0xe1c, 0x12121416, }; -u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN] = { +u32 RTL8192E_RADIO_A_ARR[RTL8192E_RADIO_A_ARR_LEN] = { 0x019, 0x00000003, 0x000, 0x000000bf, 0x001, 0x00000ee0, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index c6c7d4cd313e..60917c95842b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -14,7 +14,7 @@ #define RTL8192E_PHY_REG_1T2R_ARR_LEN 296 extern u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN]; #define RTL8192E_RADIO_A_ARR_LEN 246 -extern u32 Rtl8192PciERadioA_Array[RTL8192E_RADIO_A_ARR_LEN]; +extern u32 RTL8192E_RADIO_A_ARR[RTL8192E_RADIO_A_ARR_LEN]; #define RTL8192E_RADIO_B_ARR_LEN 78 extern u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN]; #define RTL8192E_MACPHY_ARR_LEN 18 From 22fc1bb4750150e3b743c51e5c5b8dc78fbe7ea4 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:44:07 +0100 Subject: [PATCH 062/185] staging: rtl8192e: Join constants Rtl819XRadioB_.. with ..RadioB_.. Join constants Rtl819XRadioB_Array with Rtl8192PciERadioB_Array to RTL8192E_RADIO_B_ARR to improve readability. Fix spaces around '+' to improve coding style. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/59af481400d5f7633bcaf7fcd95b7e5f0093fd3f.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 6 +++--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 49fdaacb788a..5b9a1b78c35e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -555,13 +555,13 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) break; case RF90_PATH_B: for (i = 0; i < RTL8192E_RADIO_B_ARR_LEN; i += 2) { - if (Rtl819XRadioB_Array[i] == 0xfe) { + if (RTL8192E_RADIO_B_ARR[i] == 0xfe) { msleep(100); continue; } - rtl92e_set_rf_reg(dev, eRFPath, Rtl819XRadioB_Array[i], + rtl92e_set_rf_reg(dev, eRFPath, RTL8192E_RADIO_B_ARR[i], bMask12Bits, - Rtl819XRadioB_Array[i+1]); + RTL8192E_RADIO_B_ARR[i + 1]); } break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 74c7850e514c..ee91d687de9b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define Rtl819XRadioB_Array Rtl8192PciERadioB_Array #define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array #define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 4f36a480f6f2..eeea01681e7d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -283,7 +283,7 @@ u32 RTL8192E_RADIO_A_ARR[RTL8192E_RADIO_A_ARR_LEN] = { 0x007, 0x00000700, }; -u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN] = { +u32 RTL8192E_RADIO_B_ARR[RTL8192E_RADIO_B_ARR_LEN] = { 0x019, 0x00000003, 0x000, 0x000000bf, 0x001, 0x000006e0, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 60917c95842b..3023440db58b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -16,7 +16,7 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN]; #define RTL8192E_RADIO_A_ARR_LEN 246 extern u32 RTL8192E_RADIO_A_ARR[RTL8192E_RADIO_A_ARR_LEN]; #define RTL8192E_RADIO_B_ARR_LEN 78 -extern u32 Rtl8192PciERadioB_Array[RTL8192E_RADIO_B_ARR_LEN]; +extern u32 RTL8192E_RADIO_B_ARR[RTL8192E_RADIO_B_ARR_LEN]; #define RTL8192E_MACPHY_ARR_LEN 18 extern u32 RTL8192E_MACPHY_ARR[RTL8192E_MACPHY_ARR_LEN]; #define RTL8192E_MACPHY_ARR_PG_LEN 30 From dc756b9354b844c7a35385bf1b91cd9368feb18f Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:44:13 +0100 Subject: [PATCH 063/185] staging: rtl8192e: Join constants Rtl819XAGCTAB_.. with ..PciEAGCTAB.. Join constants Rtl819XAGCTAB_Array with Rtl8192PciEAGCTAB_Array to RTL8192E_AGCTAB_ARR to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/c7ca930adb5f72daa61b15b02001d09c4a1f8f46.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 5b9a1b78c35e..72ecdb9ea375 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -313,7 +313,7 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType) struct r8192_priv *priv = rtllib_priv(dev); AGCTAB_ArrayLen = RTL8192E_AGCTAB_ARR_LEN; - Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array; + Rtl819XAGCTAB_Array_Table = RTL8192E_AGCTAB_ARR; if (priv->rf_type == RF_1T2R) { PHY_REGArrayLen = RTL8192E_PHY_REG_1T2R_ARR_LEN; Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index ee91d687de9b..1f9bafd6d3cc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,7 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array #define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray extern u32 rtl819XAGCTAB_Array[]; diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index eeea01681e7d..3a7656facefc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -347,7 +347,7 @@ u32 RTL8192E_MACPHY_ARR_PG[] = { 0x318, 0x00000fff, 0x00000800, }; -u32 Rtl8192PciEAGCTAB_Array[RTL8192E_AGCTAB_ARR_LEN] = { +u32 RTL8192E_AGCTAB_ARR[RTL8192E_AGCTAB_ARR_LEN] = { 0xc78, 0x7d000001, 0xc78, 0x7d010001, 0xc78, 0x7d020001, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 3023440db58b..576228882c21 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -22,6 +22,6 @@ extern u32 RTL8192E_MACPHY_ARR[RTL8192E_MACPHY_ARR_LEN]; #define RTL8192E_MACPHY_ARR_PG_LEN 30 extern u32 RTL8192E_MACPHY_ARR_PG[RTL8192E_MACPHY_ARR_PG_LEN]; #define RTL8192E_AGCTAB_ARR_LEN 384 -extern u32 Rtl8192PciEAGCTAB_Array[RTL8192E_AGCTAB_ARR_LEN]; +extern u32 RTL8192E_AGCTAB_ARR[RTL8192E_AGCTAB_ARR_LEN]; #endif From 94f7d4a4641d2fc2dc4065b76914d0a37cebfd17 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 14 Mar 2023 19:44:20 +0100 Subject: [PATCH 064/185] staging: rtl8192e: Join constants Rtl819XPHY_REG_.. with ..PciEPHY_REG_.. Join constants Rtl819XPHY_REG_1T2RArray with Rtl8192PciEPHY_REG_1T2RArray to RTL8192E_PHY_REG_1T2R_ARR to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/2816a10a8a534014c58e0092b78443e01a67930a.1678814935.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 2 +- drivers/staging/rtl8192e/rtl8192e/table.h | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 72ecdb9ea375..2dbddf4ae3d6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -316,7 +316,7 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType) Rtl819XAGCTAB_Array_Table = RTL8192E_AGCTAB_ARR; if (priv->rf_type == RF_1T2R) { PHY_REGArrayLen = RTL8192E_PHY_REG_1T2R_ARR_LEN; - Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray; + Rtl819XPHY_REGArray_Table = RTL8192E_PHY_REG_1T2R_ARR; } if (ConfigType == BB_CONFIG_PHY_REG) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 1f9bafd6d3cc..6723fcce8954 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,8 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -#define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray - extern u32 rtl819XAGCTAB_Array[]; enum hw90_block { diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c index 3a7656facefc..0b5cc6049232 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.c +++ b/drivers/staging/rtl8192e/rtl8192e/table.c @@ -6,7 +6,7 @@ */ #include "table.h" -u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN] = { +u32 RTL8192E_PHY_REG_1T2R_ARR[RTL8192E_PHY_REG_1T2R_ARR_LEN] = { 0x800, 0x00000000, 0x804, 0x00000001, 0x808, 0x0000fc00, diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h index 576228882c21..82be44a9d4e8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/table.h +++ b/drivers/staging/rtl8192e/rtl8192e/table.h @@ -12,7 +12,7 @@ #include #define RTL8192E_PHY_REG_1T2R_ARR_LEN 296 -extern u32 Rtl8192PciEPHY_REG_1T2RArray[RTL8192E_PHY_REG_1T2R_ARR_LEN]; +extern u32 RTL8192E_PHY_REG_1T2R_ARR[RTL8192E_PHY_REG_1T2R_ARR_LEN]; #define RTL8192E_RADIO_A_ARR_LEN 246 extern u32 RTL8192E_RADIO_A_ARR[RTL8192E_RADIO_A_ARR_LEN]; #define RTL8192E_RADIO_B_ARR_LEN 78 From 78c0fb1ad68ce120efafe86790e4a674c2c12ef4 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 10 Mar 2023 09:34:45 +0100 Subject: [PATCH 065/185] staging: rtl8723bs: MapCharToHexDigit() is not used The function MapCharToHexDigit() is not used anywhere, remove it. Signed-off-by: Michael Straube Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230310083449.23775-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 16 ---------------- drivers/staging/rtl8723bs/include/hal_com.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index e42556d03bce..b74817fc4316 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -859,22 +859,6 @@ bool eqNByte(u8 *str1, u8 *str2, u32 num) return true; } -/* */ -/* Description: */ -/* Translate a character to hex digit. */ -/* */ -u32 MapCharToHexDigit(char chTmp) -{ - if (chTmp >= '0' && chTmp <= '9') - return chTmp - '0'; - else if (chTmp >= 'a' && chTmp <= 'f') - return 10 + (chTmp - 'a'); - else if (chTmp >= 'A' && chTmp <= 'F') - return 10 + (chTmp - 'A'); - else - return 0; -} - bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt) { u16 i = 0; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 6356b8c2ef81..8a7d31d1eaca 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -147,8 +147,6 @@ u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable, bool eqNByte(u8 *str1, u8 *str2, u32 num); -u32 MapCharToHexDigit(char chTmp); - bool ParseQualifiedString(char *In, u32 *Start, char *Out, char LeftQualifier, char RightQualifier); From e65df7f096d50200e7b6e0b545aeada510cbba63 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 10 Mar 2023 09:34:46 +0100 Subject: [PATCH 066/185] staging: rtl8723bs: ParseQualifiedString() is not used The function ParseQualifiedString() is not used anywhere, remove it. Signed-off-by: Michael Straube Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230310083449.23775-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 24 --------------------- drivers/staging/rtl8723bs/include/hal_com.h | 3 --- 2 files changed, 27 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index b74817fc4316..ff0e41bf72b0 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -877,30 +877,6 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt) return true; } -/* <20121004, Kordan> For example, - * ParseQualifiedString(inString, 0, outString, '[', ']') gets "Kordan" from - * a string "Hello [Kordan]". - * If RightQualifier does not exist, it will hang in the while loop - */ -bool ParseQualifiedString( - char *In, u32 *Start, char *Out, char LeftQualifier, char RightQualifier -) -{ - u32 i = 0, j = 0; - char c = In[(*Start)++]; - - if (c != LeftQualifier) - return false; - - i = (*Start); - while ((c = In[(*Start)++]) != RightQualifier) - ; /* find ']' */ - j = (*Start) - 2; - strncpy((char *)Out, (const char *)(In+i), j-i+1); - - return true; -} - bool isAllSpaceOrTab(u8 *data, u8 size) { u8 cnt = 0, NumOfSpaceAndTab = 0; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 8a7d31d1eaca..31fdb5c45de3 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -147,9 +147,6 @@ u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable, bool eqNByte(u8 *str1, u8 *str2, u32 num); -bool ParseQualifiedString(char *In, u32 *Start, char *Out, char LeftQualifier, - char RightQualifier); - bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in); bool isAllSpaceOrTab(u8 *data, u8 size); From f89a163f1f66a9bea1222b0e61c3171b6bd0a080 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 10 Mar 2023 09:34:47 +0100 Subject: [PATCH 067/185] staging: rtl8723bs: isAllSpaceOrTab() is not used The function isAllSpaceOrTab() is not used anywhere, remove it. Signed-off-by: Michael Straube Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230310083449.23775-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 15 --------------- drivers/staging/rtl8723bs/include/hal_com.h | 2 -- 2 files changed, 17 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index ff0e41bf72b0..da68557c5b20 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -877,21 +877,6 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt) return true; } -bool isAllSpaceOrTab(u8 *data, u8 size) -{ - u8 cnt = 0, NumOfSpaceAndTab = 0; - - while (size > cnt) { - if (data[cnt] == ' ' || data[cnt] == '\t' || data[cnt] == '\0') - ++NumOfSpaceAndTab; - - ++cnt; - } - - return size == NumOfSpaceAndTab; -} - - void rtw_hal_check_rxfifo_full(struct adapter *adapter) { struct dvobj_priv *psdpriv = adapter->dvobj; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 31fdb5c45de3..839d93d8a1df 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -149,8 +149,6 @@ bool eqNByte(u8 *str1, u8 *str2, u32 num); bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in); -bool isAllSpaceOrTab(u8 *data, u8 size); - void linked_info_dump(struct adapter *padapter, u8 benable); #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA void rtw_get_raw_rssi_info(void *sel, struct adapter *padapter); From 1558280ca955c26bf0e13f7f17750a89c201d25b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 10 Mar 2023 09:34:48 +0100 Subject: [PATCH 068/185] staging: rtl8723bs: linked_info_dump() is not used The function linked_info_dump() is not used anywhere, remove it. Signed-off-by: Michael Straube Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230310083449.23775-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 21 --------------------- drivers/staging/rtl8723bs/include/hal_com.h | 1 - 2 files changed, 22 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index da68557c5b20..792636fe3270 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -897,27 +897,6 @@ void rtw_hal_check_rxfifo_full(struct adapter *adapter) } } -void linked_info_dump(struct adapter *padapter, u8 benable) -{ - struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); - - if (padapter->bLinkInfoDump == benable) - return; - - if (benable) { - pwrctrlpriv->org_power_mgnt = pwrctrlpriv->power_mgnt;/* keep org value */ - rtw_pm_set_lps(padapter, PS_MODE_ACTIVE); - - pwrctrlpriv->ips_org_mode = pwrctrlpriv->ips_mode;/* keep org value */ - rtw_pm_set_ips(padapter, IPS_NONE); - } else { - rtw_pm_set_ips(padapter, pwrctrlpriv->ips_org_mode); - - rtw_pm_set_lps(padapter, pwrctrlpriv->ips_org_mode); - } - padapter->bLinkInfoDump = benable; -} - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA void rtw_get_raw_rssi_info(void *sel, struct adapter *padapter) { diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 839d93d8a1df..c1aa7f0a35f9 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -149,7 +149,6 @@ bool eqNByte(u8 *str1, u8 *str2, u32 num); bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in); -void linked_info_dump(struct adapter *padapter, u8 benable); #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA void rtw_get_raw_rssi_info(void *sel, struct adapter *padapter); void rtw_store_phy_info(struct adapter *padapter, union recv_frame *prframe); From 26269cbc7f2debf4cad98c74f14d0113672bb780 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 10 Mar 2023 09:34:49 +0100 Subject: [PATCH 069/185] staging: rtl8723bs: rtw_get_raw_rssi_info() is not used The function rtw_get_raw_rssi_info() is not used anywhere, remove it. Signed-off-by: Michael Straube Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230310083449.23775-6-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 32 --------------------- drivers/staging/rtl8723bs/include/hal_com.h | 1 - 2 files changed, 33 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 792636fe3270..852232102433 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -898,38 +898,6 @@ void rtw_hal_check_rxfifo_full(struct adapter *adapter) } #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA -void rtw_get_raw_rssi_info(void *sel, struct adapter *padapter) -{ - u8 isCCKrate, rf_path; - struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; - - netdev_dbg(padapter->pnetdev, - "RxRate = %s, PWDBALL = %d(%%), rx_pwr_all = %d(dBm)\n", - HDATA_RATE(psample_pkt_rssi->data_rate), - psample_pkt_rssi->pwdball, psample_pkt_rssi->pwr_all); - - isCCKrate = psample_pkt_rssi->data_rate <= DESC_RATE11M; - - if (isCCKrate) - psample_pkt_rssi->mimo_signal_strength[0] = psample_pkt_rssi->pwdball; - - for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { - netdev_dbg(padapter->pnetdev, - "RF_PATH_%d =>signal_strength:%d(%%), signal_quality:%d(%%)\n", - rf_path, - psample_pkt_rssi->mimo_signal_strength[rf_path], - psample_pkt_rssi->mimo_signal_quality[rf_path]); - - if (!isCCKrate) { - netdev_dbg(padapter->pnetdev, - "\trx_ofdm_pwr:%d(dBm), rx_ofdm_snr:%d(dB)\n", - psample_pkt_rssi->ofdm_pwr[rf_path], - psample_pkt_rssi->ofdm_snr[rf_path]); - } - } -} - void rtw_dump_raw_rssi_info(struct adapter *padapter) { u8 isCCKrate, rf_path; diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index c1aa7f0a35f9..17d5cfb66a36 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -150,7 +150,6 @@ bool eqNByte(u8 *str1, u8 *str2, u32 num); bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in); #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA -void rtw_get_raw_rssi_info(void *sel, struct adapter *padapter); void rtw_store_phy_info(struct adapter *padapter, union recv_frame *prframe); void rtw_dump_raw_rssi_info(struct adapter *padapter); #endif From a59319660b0d2c628c3eee89c6406b48aa7d1a1e Mon Sep 17 00:00:00 2001 From: Menna Mahmoud Date: Wed, 15 Mar 2023 19:00:06 +0200 Subject: [PATCH 070/185] staging: vme_user: add space around operators Add a space before and after the operator, for readability. Reported by checkpatch script: " CHECK: spaces preferred around that '+', '<<' and '>>' ". Signed-off-by: Menna Mahmoud Link: https://lore.kernel.org/r/57006c151d4d95550b987143a6650f8b3594ddea.1678899549.git.eng.mennamahmoud.mm@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/vme_tsi148.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c index 482049cfc664..bfa604043355 100644 --- a/drivers/staging/vme_user/vme_tsi148.c +++ b/drivers/staging/vme_user/vme_tsi148.c @@ -737,7 +737,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, return 0; if (!image->bus_resource.name) { - image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC); + image->bus_resource.name = kmalloc(VMENAMSIZ + 3, GFP_ATOMIC); if (!image->bus_resource.name) { retval = -ENOMEM; goto err_name; @@ -983,7 +983,7 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled, goto err_aspace; } - temp_ctl &= ~(3<<4); + temp_ctl &= ~(3 << 4); if (cycle & VME_SUPER) temp_ctl |= TSI148_LCSR_OTAT_SUP; if (cycle & VME_PROG) @@ -2187,14 +2187,14 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge, /* Ensure that the CR/CSR is configured at the correct offset */ cbar = ioread32be(bridge->base + TSI148_CBAR); - cbar = (cbar & TSI148_CRCSR_CBAR_M)>>3; + cbar = (cbar & TSI148_CRCSR_CBAR_M) >> 3; vstat = tsi148_slot_get(tsi148_bridge); if (cbar != vstat) { cbar = vstat; dev_info(tsi148_bridge->parent, "Setting CR/CSR offset\n"); - iowrite32be(cbar<<3, bridge->base + TSI148_CBAR); + iowrite32be(cbar << 3, bridge->base + TSI148_CBAR); } dev_info(tsi148_bridge->parent, "CR/CSR Offset: %d\n", cbar); From 56d098b7fff39aa91701f8612b131c174976f910 Mon Sep 17 00:00:00 2001 From: Menna Mahmoud Date: Wed, 15 Mar 2023 19:00:07 +0200 Subject: [PATCH 071/185] staging: vme_user: remove unnecessary blank lines Remove unnecessary blank lines before a close brace as reported by checkpatch script "CHECK: Blank lines aren't necessary before a close brace '}'" Signed-off-by: Menna Mahmoud Link: https://lore.kernel.org/r/c8fedfeca9a56dba26846a5bed56642cc694bcbe.1678899549.git.eng.mennamahmoud.mm@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/vme_tsi148.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c index bfa604043355..2f5eafd50934 100644 --- a/drivers/staging/vme_user/vme_tsi148.c +++ b/drivers/staging/vme_user/vme_tsi148.c @@ -1023,7 +1023,6 @@ err_gran: err_res: err_window: return retval; - } /* @@ -1741,7 +1740,6 @@ static int tsi148_dma_list_add(struct vme_dma_list *list, list); prev->descriptor.dnlau = cpu_to_be32(address_high); prev->descriptor.dnlal = cpu_to_be32(address_low); - } return 0; @@ -1773,7 +1771,6 @@ static int tsi148_dma_busy(struct vme_bridge *tsi148_bridge, int channel) return 0; else return 1; - } /* @@ -2220,7 +2217,6 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge, } return 0; - } static void tsi148_crcsr_exit(struct vme_bridge *tsi148_bridge, @@ -2530,7 +2526,6 @@ err_driver: kfree(tsi148_bridge); err_struct: return retval; - } static void tsi148_remove(struct pci_dev *pdev) From 95a4919ab7328cb9442c0f8f1cfe5c3931f007f1 Mon Sep 17 00:00:00 2001 From: Archana Date: Sat, 11 Mar 2023 12:12:52 +0000 Subject: [PATCH 072/185] staging: wlan-ng: small cleanup in writeimage() It is cleaner to use "goto free_result;" as is being followed in rest of the implementation of writeimage function, and remove unnecessary kfree statements. Signed-off-by: Archana Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20230311121253.10225-1-craechal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2fw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index 02a2191d5c4d..98ed9bb9192c 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -1008,12 +1008,11 @@ static int writeimage(struct wlandevice *wlandev, struct imgchunk *fchunk, rstmsg = kzalloc(sizeof(*rstmsg), GFP_KERNEL); rwrmsg = kzalloc(sizeof(*rwrmsg), GFP_KERNEL); if (!rstmsg || !rwrmsg) { - kfree(rstmsg); - kfree(rwrmsg); netdev_err(wlandev->netdev, "%s: no memory for firmware download, aborting download\n", __func__); - return -ENOMEM; + result = -ENOMEM; + goto free_result; } /* Initialize the messages */ From 238f55be3eaf73b161739a4a61ddb3291a42b909 Mon Sep 17 00:00:00 2001 From: Archana Date: Sat, 11 Mar 2023 12:12:53 +0000 Subject: [PATCH 073/185] staging: wlan-ng: small cleanup in plugimage() It's cleaner to set "j = -1;" before the if block and remove the else statement. Signed-off-by: Archana Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20230311121253.10225-2-craechal@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2fw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index 98ed9bb9192c..11658865ca50 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -689,6 +689,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, for (i = 0; i < ns3plug; i++) { pstart = s3plug[i].addr; pend = s3plug[i].addr + s3plug[i].len; + j = -1; /* find the matching PDR (or filename) */ if (s3plug[i].itemcode != 0xffffffffUL) { /* not filename */ for (j = 0; j < pda->nrec; j++) { @@ -696,8 +697,6 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, le16_to_cpu(pda->rec[j]->code)) break; } - } else { - j = -1; } if (j >= pda->nrec && j != -1) { /* if no matching PDR, fail */ pr_warn("warning: Failed to find PDR for plugrec 0x%04x.\n", From 00b2c0918b1ff730b756ec4944f0ca68770d5b93 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 12 Mar 2023 08:32:46 +0100 Subject: [PATCH 074/185] staging: rtl8192u: rtl8192_SetRFPowerState() is not used The function rtl8192_SetRFPowerState() is not used anywhere, remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20230312073247.9822-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 87 --------------------------- drivers/staging/rtl8192u/r819xU_phy.h | 2 - 2 files changed, 89 deletions(-) diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 97f4d89500ae..e6836eacc7aa 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1044,93 +1044,6 @@ static void rtl8192_SetTxPowerLevel(struct net_device *dev, u8 channel) } } -/****************************************************************************** - * function: This function sets RF state on or off - * input: net_device *dev - * RT_RF_POWER_STATE eRFPowerState //Power State to set - * output: none - * return: none - * notice: - *****************************************************************************/ -bool rtl8192_SetRFPowerState(struct net_device *dev, - RT_RF_POWER_STATE eRFPowerState) -{ - bool bResult = true; - struct r8192_priv *priv = ieee80211_priv(dev); - - if (eRFPowerState == priv->ieee80211->eRFPowerState) - return false; - - if (priv->SetRFPowerStateInProgress) - return false; - - priv->SetRFPowerStateInProgress = true; - - switch (priv->rf_chip) { - case RF_8256: - switch (eRFPowerState) { - case eRfOn: - /* RF-A, RF-B */ - /* enable RF-Chip A/B - 0x860[4] */ - rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT(4), - 0x1); - /* analog to digital on - 0x88c[9:8] */ - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, - 0x3); - /* digital to analog on - 0x880[4:3] */ - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x18, - 0x3); - /* rx antenna on - 0xc04[1:0] */ - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x3, 0x3); - /* rx antenna on - 0xd04[1:0] */ - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x3, 0x3); - /* analog to digital part2 on - 0x880[6:5] */ - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, - 0x3); - - break; - - case eRfSleep: - - break; - - case eRfOff: - /* RF-A, RF-B */ - /* disable RF-Chip A/B - 0x860[4] */ - rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT(4), - 0x0); - /* analog to digital off, for power save */ - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0xf00, - 0x0); /* 0x88c[11:8] */ - /* digital to analog off, for power save - 0x880[4:3] */ - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x18, - 0x0); - /* rx antenna off - 0xc04[3:0] */ - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0x0); - /* rx antenna off - 0xd04[3:0] */ - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0x0); - /* analog to digital part2 off, for power save */ - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, - 0x0); /* 0x880[6:5] */ - - break; - - default: - bResult = false; - RT_TRACE(COMP_ERR, "%s(): unknown state to set: 0x%X\n", - __func__, eRFPowerState); - break; - } - break; - default: - RT_TRACE(COMP_ERR, "Not support rf_chip(%x)\n", priv->rf_chip); - break; - } - priv->SetRFPowerStateInProgress = false; - - return bResult; -} - /****************************************************************************** * function: This function sets command table variable (struct sw_chnl_cmd). * input: sw_chnl_cmd *CmdTable //table to be set diff --git a/drivers/staging/rtl8192u/r819xU_phy.h b/drivers/staging/rtl8192u/r819xU_phy.h index 8c2933264407..bafaa6a90c50 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.h +++ b/drivers/staging/rtl8192u/r819xU_phy.h @@ -74,8 +74,6 @@ void rtl8192_SetBWMode(struct net_device *dev, enum ht_extension_chan_offset offset); void rtl8192_SwChnl_WorkItem(struct net_device *dev); void rtl8192_SetBWModeWorkItem(struct net_device *dev); -bool rtl8192_SetRFPowerState(struct net_device *dev, - RT_RF_POWER_STATE eRFPowerState); void InitialGain819xUsb(struct net_device *dev, u8 Operation); void InitialGainOperateWorkItemCallBack(struct work_struct *work); From 73633855a6b682a8cc36f581e52a3cea63393b66 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 12 Mar 2023 08:32:47 +0100 Subject: [PATCH 075/185] staging: rtl8192u: dm_shadow_init() is not used The function dm_shadow_init() is not used anywhere, remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20230312073247.9822-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 38 ---------------------------- drivers/staging/rtl8192u/r8192U_dm.h | 1 - 2 files changed, 39 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 00fc8fd344db..6a33ca02c3dc 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2859,44 +2859,6 @@ void dm_check_fsync(struct net_device *dev) } } -/*----------------------------------------------------------------------------- - * Function: dm_shadow_init() - * - * Overview: Store all NIC MAC/BB register content. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 05/29/2008 amy Create Version 0 porting from windows code. - * - *--------------------------------------------------------------------------- - */ -void dm_shadow_init(struct net_device *dev) -{ - u8 page; - u16 offset; - - for (page = 0; page < 5; page++) - for (offset = 0; offset < 256; offset++) { - read_nic_byte(dev, offset + page * 256, &dm_shadow[page][offset]); - /*DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);*/ - } - - for (page = 8; page < 11; page++) - for (offset = 0; offset < 256; offset++) - read_nic_byte(dev, offset + page * 256, &dm_shadow[page][offset]); - - for (page = 12; page < 15; page++) - for (offset = 0; offset < 256; offset++) - read_nic_byte(dev, offset + page * 256, &dm_shadow[page][offset]); - -} /* dm_shadow_init */ - /*---------------------------Define function prototype------------------------*/ /*----------------------------------------------------------------------------- * Function: DM_DynamicTxPower() diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 2159018b4e38..f4eb18216677 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -168,7 +168,6 @@ void dm_rf_operation_test_callback(unsigned long data); void dm_rf_pathcheck_workitemcallback(struct work_struct *work); void dm_fsync_work_callback(struct work_struct *work); void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); -void dm_shadow_init(struct net_device *dev); void dm_initialize_txpower_tracking(struct net_device *dev); /*--------------------------Exported Function prototype---------------------*/ From f20eed8bf6671de2e90b2f15cf6b616a72dd72cc Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Tue, 14 Mar 2023 05:11:52 -0700 Subject: [PATCH 076/185] Staging: qlge: Fix indentation in conditional statement Add tabs/spaces in conditional statements in to fix the indentation. Signed-off-by: Sumitra Sharma Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20230314121152.GA38979@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/qlge/qlge_dbg.c | 35 +++++++++++++++------------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index 66d28358342f..c7e865f515cf 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -351,26 +351,23 @@ static int qlge_get_xgmac_regs(struct qlge_adapter *qdev, u32 *buf, /* We're reading 400 xgmac registers, but we filter out * several locations that are non-responsive to reads. */ - if ((i == 0x00000114) || - (i == 0x00000118) || - (i == 0x0000013c) || - (i == 0x00000140) || - (i > 0x00000150 && i < 0x000001fc) || - (i > 0x00000278 && i < 0x000002a0) || - (i > 0x000002c0 && i < 0x000002cf) || - (i > 0x000002dc && i < 0x000002f0) || - (i > 0x000003c8 && i < 0x00000400) || - (i > 0x00000400 && i < 0x00000410) || - (i > 0x00000410 && i < 0x00000420) || - (i > 0x00000420 && i < 0x00000430) || - (i > 0x00000430 && i < 0x00000440) || - (i > 0x00000440 && i < 0x00000450) || - (i > 0x00000450 && i < 0x00000500) || - (i > 0x0000054c && i < 0x00000568) || - (i > 0x000005c8 && i < 0x00000600)) { + if ((i == 0x00000114) || (i == 0x00000118) || + (i == 0x0000013c) || (i == 0x00000140) || + (i > 0x00000150 && i < 0x000001fc) || + (i > 0x00000278 && i < 0x000002a0) || + (i > 0x000002c0 && i < 0x000002cf) || + (i > 0x000002dc && i < 0x000002f0) || + (i > 0x000003c8 && i < 0x00000400) || + (i > 0x00000400 && i < 0x00000410) || + (i > 0x00000410 && i < 0x00000420) || + (i > 0x00000420 && i < 0x00000430) || + (i > 0x00000430 && i < 0x00000440) || + (i > 0x00000440 && i < 0x00000450) || + (i > 0x00000450 && i < 0x00000500) || + (i > 0x0000054c && i < 0x00000568) || + (i > 0x000005c8 && i < 0x00000600)) { if (other_function) - status = - qlge_read_other_func_xgmac_reg(qdev, i, buf); + status = qlge_read_other_func_xgmac_reg(qdev, i, buf); else status = qlge_read_xgmac_reg(qdev, i, buf); From aae9567a74878e5bb2bc084f6dee732f8d713e6b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 17 Mar 2023 07:48:00 +0100 Subject: [PATCH 077/185] staging: vt6656: remove unused vnt_get_current_tsf() function The function vnt_get_current_tsf() is not used anywhere, remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20230317064800.12276-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/card.c | 21 --------------------- drivers/staging/vt6656/card.h | 1 - 2 files changed, 22 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 7827e579ef3d..b9dc0d13c00c 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -11,7 +11,6 @@ * vnt_add_basic_rate - Add to BasicRateSet * vnt_ofdm_min_rate - Check if any OFDM rate is in BasicRateSet * vnt_get_tsf_offset - Calculate TSFOffset - * vnt_get_current_tsf - Read Current NIC TSF counter * vnt_get_next_tbtt - Calculate Next Beacon TSF counter * vnt_reset_next_tbtt - Set NIC Beacon time * vnt_update_next_tbtt - Sync. NIC Beacon time @@ -230,26 +229,6 @@ int vnt_adjust_tsf(struct vnt_private *priv, u8 rx_rate, MESSAGE_REQUEST_TSF, 0, 8, data); } -/* - * Description: Read NIC TSF counter - * Get local TSF counter - * - * Parameters: - * In: - * priv - The adapter to be read - * Out: - * current_tsf - Current TSF counter - * - * Return Value: true if success; otherwise false - * - */ -bool vnt_get_current_tsf(struct vnt_private *priv, u64 *current_tsf) -{ - *current_tsf = priv->current_tsf; - - return true; -} - /* * Description: Clear NIC TSF counter * Clear local TSF counter diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index be32c25c95de..eb01f7cc871f 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -30,7 +30,6 @@ void vnt_update_top_rates(struct vnt_private *priv); bool vnt_ofdm_min_rate(struct vnt_private *priv); int vnt_adjust_tsf(struct vnt_private *priv, u8 rx_rate, u64 time_stamp, u64 local_tsf); -bool vnt_get_current_tsf(struct vnt_private *priv, u64 *current_tsf); bool vnt_clear_current_tsf(struct vnt_private *priv); int vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval); int vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf, From d32a62ac84c2a3169b5686715280997e76a18549 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 17 Mar 2023 07:50:40 +0100 Subject: [PATCH 078/185] staging: vt6655: remove unused bb_power_save_mode_on() function The function bb_power_save_mode_on() is not used anywhere, remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20230317065041.16635-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 22 ---------------------- drivers/staging/vt6655/baseband.h | 1 - 2 files changed, 23 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 6ce41983dcf4..d7c3e4bec560 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -2171,28 +2171,6 @@ bb_software_reset(struct vnt_private *priv) bb_write_embedded(priv, 0x9C, 0); } -/* - * Description: Baseband Power Save Mode ON - * - * Parameters: - * In: - * iobase - I/O base address - * Out: - * none - * - * Return Value: none - * - */ -void -bb_power_save_mode_on(struct vnt_private *priv) -{ - unsigned char by_org_data; - - bb_read_embedded(priv, 0x0D, &by_org_data); - by_org_data |= BIT(0); - bb_write_embedded(priv, 0x0D, by_org_data); -} - /* * Description: Baseband Power Save Mode OFF * diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h index 15b2802ed727..d1128d050ac5 100644 --- a/drivers/staging/vt6655/baseband.h +++ b/drivers/staging/vt6655/baseband.h @@ -63,7 +63,6 @@ void bb_set_vga_gain_offset(struct vnt_private *priv, unsigned char by_data); /* VT3253 Baseband */ bool bb_vt3253_init(struct vnt_private *priv); void bb_software_reset(struct vnt_private *priv); -void bb_power_save_mode_on(struct vnt_private *priv); void bb_power_save_mode_off(struct vnt_private *priv); void bb_set_tx_antenna_mode(struct vnt_private *priv, unsigned char by_antenna_mode); From 5001d664e328b4a07e2377f09d7a6871ce12bc01 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 17 Mar 2023 07:50:41 +0100 Subject: [PATCH 079/185] staging: vt6655: remove unused bb_power_save_mode_off() function The function bb_power_save_mode_off() is not used anywhere, remove it. Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20230317065041.16635-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 22 ---------------------- drivers/staging/vt6655/baseband.h | 1 - 2 files changed, 23 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index d7c3e4bec560..0e135af8316b 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -2171,28 +2171,6 @@ bb_software_reset(struct vnt_private *priv) bb_write_embedded(priv, 0x9C, 0); } -/* - * Description: Baseband Power Save Mode OFF - * - * Parameters: - * In: - * iobase - I/O base address - * Out: - * none - * - * Return Value: none - * - */ -void -bb_power_save_mode_off(struct vnt_private *priv) -{ - unsigned char by_org_data; - - bb_read_embedded(priv, 0x0D, &by_org_data); - by_org_data &= ~(BIT(0)); - bb_write_embedded(priv, 0x0D, by_org_data); -} - /* * Description: Set Tx Antenna mode * diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h index d1128d050ac5..e4a02c240a1c 100644 --- a/drivers/staging/vt6655/baseband.h +++ b/drivers/staging/vt6655/baseband.h @@ -63,7 +63,6 @@ void bb_set_vga_gain_offset(struct vnt_private *priv, unsigned char by_data); /* VT3253 Baseband */ bool bb_vt3253_init(struct vnt_private *priv); void bb_software_reset(struct vnt_private *priv); -void bb_power_save_mode_off(struct vnt_private *priv); void bb_set_tx_antenna_mode(struct vnt_private *priv, unsigned char by_antenna_mode); void bb_set_rx_antenna_mode(struct vnt_private *priv, From 752cbd8f191678e86aa754f795546b7f06b7f171 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Fri, 17 Mar 2023 01:09:00 +0500 Subject: [PATCH 080/185] staging: axis-fifo: initialize timeouts in init only Initialize the module parameters, read_timeout and write_timeout once in init(). Module parameters can only be set once and cannot be modified later, so we don't need to evaluate them again when passing the parameters to wait_event_interruptible_timeout(). Convert datatype of {read,write}_timeout from 'int' to 'long int' because implicit conversion of 'long int' to 'int' in statement '{read,write}_timeout = MAX_SCHEDULE_TIMEOUT' results in an overflow. Change format specifier for {read,write}_timeout from %i to %li. Reviewed-by: Fabio M. De Francesco Suggested-by: Greg Kroah-Hartman Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZBN3XAsItCiTk7CV@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/axis-fifo/axis-fifo.c | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index dfd2b357f484..0a85ea667a1b 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -103,17 +103,17 @@ * globals * ---------------------------- */ -static int read_timeout = 1000; /* ms to wait before read() times out */ -static int write_timeout = 1000; /* ms to wait before write() times out */ +static long read_timeout = 1000; /* ms to wait before read() times out */ +static long write_timeout = 1000; /* ms to wait before write() times out */ /* ---------------------------- * module command-line arguments * ---------------------------- */ -module_param(read_timeout, int, 0444); +module_param(read_timeout, long, 0444); MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timing out; set to -1 for no timeout"); -module_param(write_timeout, int, 0444); +module_param(write_timeout, long, 0444); MODULE_PARM_DESC(write_timeout, "ms to wait before blocking write() timing out; set to -1 for no timeout"); /* ---------------------------- @@ -384,9 +384,7 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf, mutex_lock(&fifo->read_lock); ret = wait_event_interruptible_timeout(fifo->read_queue, ioread32(fifo->base_addr + XLLF_RDFO_OFFSET), - (read_timeout >= 0) ? - msecs_to_jiffies(read_timeout) : - MAX_SCHEDULE_TIMEOUT); + read_timeout); if (ret <= 0) { if (ret == 0) { @@ -528,9 +526,7 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, ret = wait_event_interruptible_timeout(fifo->write_queue, ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write, - (write_timeout >= 0) ? - msecs_to_jiffies(write_timeout) : - MAX_SCHEDULE_TIMEOUT); + write_timeout); if (ret <= 0) { if (ret == 0) { @@ -948,7 +944,17 @@ static struct platform_driver axis_fifo_driver = { static int __init axis_fifo_init(void) { - pr_info("axis-fifo driver loaded with parameters read_timeout = %i, write_timeout = %i\n", + if (read_timeout >= 0) + read_timeout = msecs_to_jiffies(read_timeout); + else + read_timeout = MAX_SCHEDULE_TIMEOUT; + + if (write_timeout >= 0) + write_timeout = msecs_to_jiffies(write_timeout); + else + write_timeout = MAX_SCHEDULE_TIMEOUT; + + pr_info("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n", read_timeout, write_timeout); return platform_driver_register(&axis_fifo_driver); } From f4a8e711a66bd03681d61949181223c3437d5a87 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Thu, 16 Mar 2023 22:24:55 -0700 Subject: [PATCH 081/185] Staging: octeon: Fix line ending with '(' Since the coding style limited the code to 80 columns per line which caused splitting the function header into two lines resulted in the first line ending with a '('. This caused the checkpatch error. Place the function parameters immediately after '(' in a single line to align the function header. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230317052455.GA83442@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/octeon-stubs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/octeon/octeon-stubs.h b/drivers/staging/octeon/octeon-stubs.h index 7a02e59e283f..3e7b92cd2e35 100644 --- a/drivers/staging/octeon/octeon-stubs.h +++ b/drivers/staging/octeon/octeon-stubs.h @@ -1372,9 +1372,7 @@ static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr, int32_t value) { } -static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed( - int interface, - int port) +static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed(int interface, int port) { union cvmx_gmxx_rxx_rx_inbnd r; From dc467faa2305cca067d24315c71d4e12d4e2d679 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Sun, 19 Mar 2023 09:45:20 -0700 Subject: [PATCH 082/185] Staging: greybus: Fix lines ending with '(' The coding style used to limit lines to 80 characters, which led to splitting of these function headers into multiple lines and ends the first line with a '('. Such splits causes checks reported by the checkpatch. Place the function parameters of each function immediately after '(' in a single line to align the function headers. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230319164520.GA125117@sumitra.com Signed-off-by: Greg Kroah-Hartman --- .../staging/greybus/audio_manager_module.c | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c index 0a0f0a394c84..81b4ba607a0e 100644 --- a/drivers/staging/greybus/audio_manager_module.c +++ b/drivers/staging/greybus/audio_manager_module.c @@ -70,9 +70,8 @@ static void gb_audio_module_release(struct kobject *kobj) kfree(module); } -static ssize_t gb_audio_module_name_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) +static ssize_t gb_audio_module_name_show(struct gb_audio_manager_module *module, + struct gb_audio_manager_module_attribute *attr, char *buf) { return sprintf(buf, "%s", module->desc.name); } @@ -80,9 +79,8 @@ static ssize_t gb_audio_module_name_show( static struct gb_audio_manager_module_attribute gb_audio_module_name_attribute = __ATTR(name, 0664, gb_audio_module_name_show, NULL); -static ssize_t gb_audio_module_vid_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) +static ssize_t gb_audio_module_vid_show(struct gb_audio_manager_module *module, + struct gb_audio_manager_module_attribute *attr, char *buf) { return sprintf(buf, "%d", module->desc.vid); } @@ -90,9 +88,8 @@ static ssize_t gb_audio_module_vid_show( static struct gb_audio_manager_module_attribute gb_audio_module_vid_attribute = __ATTR(vid, 0664, gb_audio_module_vid_show, NULL); -static ssize_t gb_audio_module_pid_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) +static ssize_t gb_audio_module_pid_show(struct gb_audio_manager_module *module, + struct gb_audio_manager_module_attribute *attr, char *buf) { return sprintf(buf, "%d", module->desc.pid); } @@ -100,9 +97,9 @@ static ssize_t gb_audio_module_pid_show( static struct gb_audio_manager_module_attribute gb_audio_module_pid_attribute = __ATTR(pid, 0664, gb_audio_module_pid_show, NULL); -static ssize_t gb_audio_module_intf_id_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) +static ssize_t gb_audio_module_intf_id_show(struct gb_audio_manager_module *module, + struct gb_audio_manager_module_attribute *attr, + char *buf) { return sprintf(buf, "%d", module->desc.intf_id); } @@ -111,9 +108,9 @@ static struct gb_audio_manager_module_attribute gb_audio_module_intf_id_attribute = __ATTR(intf_id, 0664, gb_audio_module_intf_id_show, NULL); -static ssize_t gb_audio_module_ip_devices_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) +static ssize_t gb_audio_module_ip_devices_show(struct gb_audio_manager_module *module, + struct gb_audio_manager_module_attribute *attr, + char *buf) { return sprintf(buf, "0x%X", module->desc.ip_devices); } @@ -122,9 +119,9 @@ static struct gb_audio_manager_module_attribute gb_audio_module_ip_devices_attribute = __ATTR(ip_devices, 0664, gb_audio_module_ip_devices_show, NULL); -static ssize_t gb_audio_module_op_devices_show( - struct gb_audio_manager_module *module, - struct gb_audio_manager_module_attribute *attr, char *buf) +static ssize_t gb_audio_module_op_devices_show(struct gb_audio_manager_module *module, + struct gb_audio_manager_module_attribute *attr, + char *buf) { return sprintf(buf, "0x%X", module->desc.op_devices); } @@ -181,10 +178,9 @@ static void send_add_uevent(struct gb_audio_manager_module *module) kobject_uevent_env(&module->kobj, KOBJ_ADD, envp); } -int gb_audio_manager_module_create( - struct gb_audio_manager_module **module, - struct kset *manager_kset, - int id, struct gb_audio_manager_module_descriptor *desc) +int gb_audio_manager_module_create(struct gb_audio_manager_module **module, + struct kset *manager_kset, + int id, struct gb_audio_manager_module_descriptor *desc) { int err; struct gb_audio_manager_module *m; From ba32601bdb189c13e5fab0f060d67a46805d6e5f Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Mon, 20 Mar 2023 17:10:34 +0500 Subject: [PATCH 083/185] staging: greybus: fix line ending with '(' Splitting function header to multiple lines because of 80 characters per line limit, results in ending the function call line with '('. This leads to CHECK reported by checkpatch.pl Move the first parameter right after the '(' in the function call line. Align the rest of the parameters to the opening parenthesis. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZBhNOkQbG4ygNF98@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_topology.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index 62d7674852be..08e6a807c132 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -24,9 +24,8 @@ struct gbaudio_ctl_pvt { struct gb_audio_ctl_elem_info *info; }; -static struct gbaudio_module_info *find_gb_module( - struct gbaudio_codec_info *codec, - char const *name) +static struct gbaudio_module_info *find_gb_module(struct gbaudio_codec_info *codec, + char const *name) { int dev_id; char begin[NAME_SIZE]; From 72a456de903389aa9d484ee0127af3352f156e1c Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Fri, 17 Mar 2023 20:13:13 +0100 Subject: [PATCH 084/185] staging: rtl8192e: Remove unused variable rtl819XAGCTAB_Array Remove unused variable rtl819XAGCTAB_Array. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/0733800b195d4f63cce2ef2ac114943c8c30f587.1679077522.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 6723fcce8954..fd34756e450f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -9,8 +9,6 @@ #define MAX_DOZE_WAITING_TIMES_9x 64 -extern u32 rtl819XAGCTAB_Array[]; - enum hw90_block { HW90_BLOCK_MAC = 0, HW90_BLOCK_PHY0 = 1, From 8f51a66a629b67a11250f555b89aa8d91137ed94 Mon Sep 17 00:00:00 2001 From: Menna Mahmoud Date: Mon, 20 Mar 2023 12:33:56 +0200 Subject: [PATCH 085/185] staging: most: use inline functions for to_hdm Convert `to_hdm` macro into a static inline function. it is not great to have macro that use `container_of` macro, because from looking at the definition one cannot tell what type it applies to. One can get the same benefit from an efficiency point of view by making an inline function. Suggested-by: Julia Lawall Signed-off-by: Menna Mahmoud Link: https://lore.kernel.org/r/20230320103356.6498-1-eng.mennamahmoud.mm@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/i2c/i2c.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/i2c/i2c.c b/drivers/staging/most/i2c/i2c.c index df53a4c4f850..4e85e681922f 100644 --- a/drivers/staging/most/i2c/i2c.c +++ b/drivers/staging/most/i2c/i2c.c @@ -44,7 +44,10 @@ struct hdm_i2c { char name[64]; }; -#define to_hdm(iface) container_of(iface, struct hdm_i2c, most_iface) +static inline struct hdm_i2c *to_hdm(struct most_interface *iface) +{ + return container_of(iface, struct hdm_i2c, most_iface); +} static irqreturn_t most_irq_handler(int, void *); static void pending_rx_work(struct work_struct *); From c388adce927c302dc740a550e79236f4dc9864b7 Mon Sep 17 00:00:00 2001 From: Menna Mahmoud Date: Mon, 20 Mar 2023 23:22:39 +0200 Subject: [PATCH 086/185] staging: most: define iface_to_hdm as an inline function Convert `iface_to_hdm` macro into a static inline function. it is not great to have macro that use `container_of` macro, because from looking at the definition one cannot tell what type it applies to. One can get the same benefit from an efficiency point of view by making an inline function. Suggested-by: Julia Lawall Signed-off-by: Menna Mahmoud Link: https://lore.kernel.org/r/20230320212239.22452-1-eng.mennamahmoud.mm@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/dim2/dim2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c index b8bd01ca1f11..21d1c9f24c3d 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -108,7 +108,10 @@ struct dim2_platform_data { u8 fcnt; }; -#define iface_to_hdm(iface) container_of(iface, struct dim2_hdm, most_iface) +static inline struct dim2_hdm *iface_to_hdm(struct most_interface *iface) +{ + return container_of(iface, struct dim2_hdm, most_iface); +} /* Macro to identify a network status message */ #define PACKET_IS_NET_INFO(p) \ From 288dee556536f07f51df4b0d265c83be73991fb1 Mon Sep 17 00:00:00 2001 From: Menna Mahmoud Date: Sun, 19 Mar 2023 22:11:34 +0200 Subject: [PATCH 087/185] staging: rtl8723bs: use inline functions for dvobj_to_dev Convert `dvobj_to_dev` macro into a static inline function. it is not great to have macro that use `container_of` macro, because from looking at the definition one cannot tell what type it applies to. One can get the same benefit from an efficiency point of view by making an inline function. Suggested-by: Julia Lawall Signed-off-by: Menna Mahmoud Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230319201134.253839-1-eng.mennamahmoud.mm@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/drv_types.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h index 82159e1c7f9b..ea6bb44c5e1d 100644 --- a/drivers/staging/rtl8723bs/include/drv_types.h +++ b/drivers/staging/rtl8723bs/include/drv_types.h @@ -305,7 +305,11 @@ struct sdio_data intf_data; }; #define dvobj_to_pwrctl(dvobj) (&(dvobj->pwrctl_priv)) -#define pwrctl_to_dvobj(pwrctl) container_of(pwrctl, struct dvobj_priv, pwrctl_priv) + +static inline struct dvobj_priv *pwrctl_to_dvobj(struct pwrctrl_priv *pwrctl_priv) +{ + return container_of(pwrctl_priv, struct dvobj_priv, pwrctl_priv); +} static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj) { From 7045b31e1b8f6a3ebd3023d69834666e48a2eb9c Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Tue, 21 Mar 2023 15:01:27 -0400 Subject: [PATCH 088/185] staging: rts5208: remove unused xd_check_err_code function clang with W=1 reports drivers/staging/rts5208/xd.c:34:19: error: unused function 'xd_check_err_code' [-Werror,-Wunused-function] static inline int xd_check_err_code(struct rtsx_chip *chip, u8 err_code) ^ This function is not used, so remove it. Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20230321190127.1827703-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5208/xd.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c index 42cab93982c0..c0af378ada71 100644 --- a/drivers/staging/rts5208/xd.c +++ b/drivers/staging/rts5208/xd.c @@ -31,13 +31,6 @@ static inline void xd_set_err_code(struct rtsx_chip *chip, u8 err_code) xd_card->err_code = err_code; } -static inline int xd_check_err_code(struct rtsx_chip *chip, u8 err_code) -{ - struct xd_info *xd_card = &chip->xd_card; - - return (xd_card->err_code == err_code); -} - static int xd_set_init_para(struct rtsx_chip *chip) { struct xd_info *xd_card = &chip->xd_card; From 1bd51241bde49f134d3631ebbcc3d5ce4f8b143a Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Tue, 21 Mar 2023 22:40:51 -0700 Subject: [PATCH 089/185] Staging: nvec: Remove macro definition to_nvec_led Remove definition 'to_nvec_led' because it is only used once. Rewrite the code directly in the calling function 'nvec_led_brightness_set'. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230322054051.GA150453@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec_paz00.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c index 8b4da95081c8..55d59840fca4 100644 --- a/drivers/staging/nvec/nvec_paz00.c +++ b/drivers/staging/nvec/nvec_paz00.c @@ -14,9 +14,6 @@ #include #include "nvec.h" -#define to_nvec_led(led_cdev) \ - container_of(led_cdev, struct nvec_led, cdev) - #define NVEC_LED_REQ {'\x0d', '\x10', '\x45', '\x10', '\x00'} #define NVEC_LED_MAX 8 @@ -29,7 +26,7 @@ struct nvec_led { static void nvec_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness value) { - struct nvec_led *led = to_nvec_led(led_cdev); + struct nvec_led *led = container_of(led_cdev, struct nvec_led, cdev); unsigned char buf[] = NVEC_LED_REQ; buf[4] = value; From 1acaceb1a43b86a3a8d340c37444214f4bbf0cdd Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Wed, 22 Mar 2023 19:22:50 +0500 Subject: [PATCH 090/185] staging: most: remove extra blank line Remove extra blank line reported by checkpatch script. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZBsPOk3TgQTfNAAK@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/dim2/dim2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c index 21d1c9f24c3d..9fa665c4038f 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -989,7 +989,6 @@ static int rcar_gen2_enable(struct platform_device *pdev) writel(0x04, dev->io_base + 0x600); } - /* BBCR = 0b11 */ writel(0x03, dev->io_base + 0x500); writel(0x0002FF02, dev->io_base + 0x508); From c35cc254f34503a53d58560367a1eb4ac0a430cc Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Fri, 24 Mar 2023 00:49:44 +0500 Subject: [PATCH 091/185] staging: most: fix line ending with '(' in video/ Splitting function header to multiple lines because of 80 characters per line limit, results in ending the function call line with '('. This leads to CHECK reported by checkpatch.pl Move the function parameters right after the '(' in the function call line. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZBytWDocM7XbXkRx@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/video/video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c index ffa97ef21ea5..6254a5df2502 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -365,8 +365,7 @@ static const struct video_device comp_videodev_template = { /**************************************************************************/ -static struct most_video_dev *get_comp_dev( - struct most_interface *iface, int channel_idx) +static struct most_video_dev *get_comp_dev(struct most_interface *iface, int channel_idx) { struct most_video_dev *mdev; unsigned long flags; From bb75546bb630d2fccd39dfcf691a9cb73cfbc7d9 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Fri, 24 Mar 2023 00:56:11 +0500 Subject: [PATCH 092/185] staging: most: fix line ending with '(' in dim2/ Splitting function header to multiple lines because of 80 characters per line limit, results in ending the function call line with '('. This leads to CHECK reported by checkpatch.pl Move the function parameters right after the '(' in the function call line. Align the rest of the parameters to the opening parenthesis. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZByu29jb1mE3KOsn@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/dim2/hal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/dim2/hal.c b/drivers/staging/most/dim2/hal.c index a5d40b5b138a..6abe3ab2b2cf 100644 --- a/drivers/staging/most/dim2/hal.c +++ b/drivers/staging/most/dim2/hal.c @@ -346,9 +346,8 @@ static void dim2_clear_ctram(void) dim2_clear_ctr(ctr_addr); } -static void dim2_configure_channel( - u8 ch_addr, u8 type, u8 is_tx, u16 dbr_address, u16 hw_buffer_size, - u16 packet_length) +static void dim2_configure_channel(u8 ch_addr, u8 type, u8 is_tx, u16 dbr_address, + u16 hw_buffer_size, u16 packet_length) { dim2_configure_cdt(ch_addr, dbr_address, hw_buffer_size, packet_length); dim2_configure_cat(MLB_CAT, ch_addr, type, is_tx ? 1 : 0); From d24927f43b9f3f3994ddf075caee531391c56559 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Wed, 22 Mar 2023 18:36:03 +0500 Subject: [PATCH 093/185] staging: ks7010: fix line ending with '(' Splitting function header to multiple lines because of 80 characters per line limit, results in ending the function call line with '('. This leads to CHECK reported by checkpatch.pl Move the first parameter right after the '(' in the function call line. Align the rest of the parameters to the opening parenthesis. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZBsEQzL3Oidsmg/L@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ks7010/ks_hostif.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 9429ee155910..af3825578d85 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -75,9 +75,8 @@ static void ks_wlan_hw_wakeup_task(struct work_struct *work) if (ps_status == PS_SNOOZE) { ks_wlan_hw_wakeup_request(priv); - time_left = wait_for_completion_interruptible_timeout( - &priv->psstatus.wakeup_wait, - msecs_to_jiffies(20)); + time_left = wait_for_completion_interruptible_timeout(&priv->psstatus.wakeup_wait, + msecs_to_jiffies(20)); if (time_left <= 0) { netdev_dbg(priv->net_dev, "wake up timeout or interrupted !!!\n"); schedule_work(&priv->wakeup_work); From 09d0c43a094a9b86e1de22894f17cab38b1f12a2 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:14:48 +0100 Subject: [PATCH 094/185] staging: rtl8192e: Remove double defined constants bMaskBytex and more Remove double defined constants. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/3f31664d8751ebb8b78cbd7d019f002fb2ba4c3c.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index fd34756e450f..498da6be3e4e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -25,14 +25,6 @@ enum rf90_radio_path { RF90_PATH_MAX }; -#define bMaskByte0 0xff -#define bMaskByte1 0xff00 -#define bMaskByte2 0xff0000 -#define bMaskByte3 0xff000000 -#define bMaskHWord 0xffff0000 -#define bMaskLWord 0x0000ffff -#define bMaskDWord 0xffffffff - void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData); u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask); From f6dcdc1b1b6f9730901fb91eb742ff50b5b5211d Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:14:53 +0100 Subject: [PATCH 095/185] staging: rtl8192e: Replace macro skb_tail_pointer_rsl with standard function Replace macro skb_tail_pointer_rsl with function skb_tail_pointer to increase readablility. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6885112850b48c0f9ff16655f7d9efe085ccc001.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtllib.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 47feb4248d25..2ec47c367c5f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1653,7 +1653,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev) priv->rx_buf[rx_queue_idx][i] = skb; mapping = (dma_addr_t *)skb->cb; *mapping = dma_map_single(&priv->pdev->dev, - skb_tail_pointer_rsl(skb), + skb_tail_pointer(skb), priv->rxbuffersize, DMA_FROM_DEVICE); if (dma_mapping_error(&priv->pdev->dev, *mapping)) { dev_kfree_skb_any(skb); @@ -1909,7 +1909,7 @@ static void _rtl92e_rx_normal(struct net_device *dev) priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = skb; *((dma_addr_t *)skb->cb) = dma_map_single(&priv->pdev->dev, - skb_tail_pointer_rsl(skb), + skb_tail_pointer(skb), priv->rxbuffersize, DMA_FROM_DEVICE); if (dma_mapping_error(&priv->pdev->dev, *((dma_addr_t *)skb->cb))) { dev_kfree_skb_any(skb); diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 8e5e29ce8f0d..cb904fc4f574 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -62,8 +62,6 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb) - #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z) #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y) From 3443454f749d8663adfa46e018625c061c85efa4 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:15:00 +0100 Subject: [PATCH 096/185] staging: rtl8192e: Remove unused macro queue_delayed_work_rsl and more Remove unused macro queue_delayed_work_rsl and queue_work_rsl to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/3ed738a5d67a999ad42454fcb0d6668bfa706205.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index cb904fc4f574..8965bb605eaa 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -62,10 +62,8 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z) #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y) -#define queue_work_rsl(x, y) queue_work(x, y) #define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y) #define container_of_work_rsl(x, y, z) container_of(x, y, z) From 9c9c9f8e3e93e09e0208413d310a0b9475c561ab Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:15:06 +0100 Subject: [PATCH 097/185] staging: rtl8192e: Replace macro INIT_DELAYED_WORK_RSL with standard macro Replace macro INIT_DELAYED_WORK_RSL with standard macro INIT_DELAYED_WORK to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/61b589012a5efb4b68a76e52eb84ad19093013b3.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 18 ++++++------------ drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 3 +-- drivers/staging/rtl8192e/rtllib.h | 2 -- drivers/staging/rtl8192e/rtllib_softmac.c | 15 +++++---------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 2ec47c367c5f..a2263c41c6c8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -893,19 +893,13 @@ static void _rtl92e_init_priv_task(struct net_device *dev) INIT_WORK_RSL(&priv->reset_wq, (void *)_rtl92e_restart, dev); INIT_WORK_RSL(&priv->rtllib->ips_leave_wq, (void *)rtl92e_ips_leave_wq, dev); - INIT_DELAYED_WORK_RSL(&priv->watch_dog_wq, - (void *)_rtl92e_watchdog_wq_cb, dev); - INIT_DELAYED_WORK_RSL(&priv->txpower_tracking_wq, - (void *)rtl92e_dm_txpower_tracking_wq, dev); - INIT_DELAYED_WORK_RSL(&priv->rfpath_check_wq, - (void *)rtl92e_dm_rf_pathcheck_wq, dev); - INIT_DELAYED_WORK_RSL(&priv->update_beacon_wq, - (void *)_rtl92e_update_beacon, dev); + INIT_DELAYED_WORK(&priv->watch_dog_wq, (void *)_rtl92e_watchdog_wq_cb); + INIT_DELAYED_WORK(&priv->txpower_tracking_wq, (void *)rtl92e_dm_txpower_tracking_wq); + INIT_DELAYED_WORK(&priv->rfpath_check_wq, (void *)rtl92e_dm_rf_pathcheck_wq); + INIT_DELAYED_WORK(&priv->update_beacon_wq, (void *)_rtl92e_update_beacon); INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev); - INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_wakeup_wq, - (void *)rtl92e_hw_wakeup_wq, dev); - INIT_DELAYED_WORK_RSL(&priv->rtllib->hw_sleep_wq, - (void *)rtl92e_hw_sleep_wq, dev); + INIT_DELAYED_WORK(&priv->rtllib->hw_wakeup_wq, (void *)rtl92e_hw_wakeup_wq); + INIT_DELAYED_WORK(&priv->rtllib->hw_sleep_wq, (void *)rtl92e_hw_sleep_wq); tasklet_setup(&priv->irq_rx_tasklet, _rtl92e_irq_rx_tasklet); tasklet_setup(&priv->irq_tx_tasklet, _rtl92e_irq_tx_tasklet); tasklet_setup(&priv->irq_prepare_beacon_tasklet, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index eb54f8cbee76..b745b73eedea 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -217,8 +217,7 @@ void rtl92e_dm_init(struct net_device *dev) if (IS_HARDWARE_TYPE_8192SE(dev)) _rtl92e_dm_init_wa_broadcom_iot(dev); - INIT_DELAYED_WORK_RSL(&priv->gpio_change_rf_wq, - (void *)_rtl92e_dm_check_rf_ctrl_gpio, dev); + INIT_DELAYED_WORK(&priv->gpio_change_rf_wq, (void *)_rtl92e_dm_check_rf_ctrl_gpio); } void rtl92e_dm_deinit(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 8965bb605eaa..8cbefa6dfd6e 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -62,8 +62,6 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y) - #define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y) #define container_of_work_rsl(x, y, z) container_of(x, y, z) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 4923423aa85b..c442fc98283d 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2996,18 +2996,13 @@ int rtllib_softmac_init(struct rtllib_device *ieee) timer_setup(&ieee->beacon_timer, rtllib_send_beacon_cb, 0); - INIT_DELAYED_WORK_RSL(&ieee->link_change_wq, - (void *)rtllib_link_change_wq, ieee); - INIT_DELAYED_WORK_RSL(&ieee->start_ibss_wq, - (void *)rtllib_start_ibss_wq, ieee); + INIT_DELAYED_WORK(&ieee->link_change_wq, (void *)rtllib_link_change_wq); + INIT_DELAYED_WORK(&ieee->start_ibss_wq, (void *)rtllib_start_ibss_wq); INIT_WORK_RSL(&ieee->associate_complete_wq, (void *)rtllib_associate_complete_wq, ieee); - INIT_DELAYED_WORK_RSL(&ieee->associate_procedure_wq, - (void *)rtllib_associate_procedure_wq, ieee); - INIT_DELAYED_WORK_RSL(&ieee->softmac_scan_wq, - (void *)rtllib_softmac_scan_wq, ieee); - INIT_DELAYED_WORK_RSL(&ieee->associate_retry_wq, - (void *)rtllib_associate_retry_wq, ieee); + INIT_DELAYED_WORK(&ieee->associate_procedure_wq, (void *)rtllib_associate_procedure_wq); + INIT_DELAYED_WORK(&ieee->softmac_scan_wq, (void *)rtllib_softmac_scan_wq); + INIT_DELAYED_WORK(&ieee->associate_retry_wq, (void *)rtllib_associate_retry_wq); INIT_WORK_RSL(&ieee->wx_sync_scan_wq, (void *)rtllib_wx_sync_scan_wq, ieee); From 8c385e3f53d47b6a1e6add1b02afdb6ae70b27f3 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:15:12 +0100 Subject: [PATCH 098/185] staging: rtl8192e: Replace macro INIT_WORK_RSL with standard macro Replace macro INIT_WORK_RSL with standard macro INIT_WORK to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/71879ccda54d57078f47c70cdba90ae2234adc91.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 +++---- drivers/staging/rtl8192e/rtllib.h | 2 -- drivers/staging/rtl8192e/rtllib_softmac.c | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index a2263c41c6c8..ea07b350b62a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -890,14 +890,13 @@ static void _rtl92e_init_priv_task(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - INIT_WORK_RSL(&priv->reset_wq, (void *)_rtl92e_restart, dev); - INIT_WORK_RSL(&priv->rtllib->ips_leave_wq, (void *)rtl92e_ips_leave_wq, - dev); + INIT_WORK(&priv->reset_wq, (void *)_rtl92e_restart); + INIT_WORK(&priv->rtllib->ips_leave_wq, (void *)rtl92e_ips_leave_wq); INIT_DELAYED_WORK(&priv->watch_dog_wq, (void *)_rtl92e_watchdog_wq_cb); INIT_DELAYED_WORK(&priv->txpower_tracking_wq, (void *)rtl92e_dm_txpower_tracking_wq); INIT_DELAYED_WORK(&priv->rfpath_check_wq, (void *)rtl92e_dm_rf_pathcheck_wq); INIT_DELAYED_WORK(&priv->update_beacon_wq, (void *)_rtl92e_update_beacon); - INIT_WORK_RSL(&priv->qos_activate, (void *)_rtl92e_qos_activate, dev); + INIT_WORK(&priv->qos_activate, (void *)_rtl92e_qos_activate); INIT_DELAYED_WORK(&priv->rtllib->hw_wakeup_wq, (void *)rtl92e_hw_wakeup_wq); INIT_DELAYED_WORK(&priv->rtllib->hw_sleep_wq, (void *)rtl92e_hw_sleep_wq); tasklet_setup(&priv->irq_rx_tasklet, _rtl92e_irq_rx_tasklet); diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 8cbefa6dfd6e..aa39f8b2bf09 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -62,8 +62,6 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y) - #define container_of_work_rsl(x, y, z) container_of(x, y, z) #define container_of_dwork_rsl(x, y, z) \ container_of(to_delayed_work(x), y, z) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index c442fc98283d..91fb5f150a00 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2998,13 +2998,11 @@ int rtllib_softmac_init(struct rtllib_device *ieee) INIT_DELAYED_WORK(&ieee->link_change_wq, (void *)rtllib_link_change_wq); INIT_DELAYED_WORK(&ieee->start_ibss_wq, (void *)rtllib_start_ibss_wq); - INIT_WORK_RSL(&ieee->associate_complete_wq, - (void *)rtllib_associate_complete_wq, ieee); + INIT_WORK(&ieee->associate_complete_wq, (void *)rtllib_associate_complete_wq); INIT_DELAYED_WORK(&ieee->associate_procedure_wq, (void *)rtllib_associate_procedure_wq); INIT_DELAYED_WORK(&ieee->softmac_scan_wq, (void *)rtllib_softmac_scan_wq); INIT_DELAYED_WORK(&ieee->associate_retry_wq, (void *)rtllib_associate_retry_wq); - INIT_WORK_RSL(&ieee->wx_sync_scan_wq, (void *)rtllib_wx_sync_scan_wq, - ieee); + INIT_WORK(&ieee->wx_sync_scan_wq, (void *)rtllib_wx_sync_scan_wq); mutex_init(&ieee->wx_mutex); mutex_init(&ieee->scan_mutex); From 861a6a82b37516fbcefc60ba967c017e9f0f42fb Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:15:18 +0100 Subject: [PATCH 099/185] staging: rtl8192e: Replace macro container_of_work_rsl with standard macro Replace macro container_of_work_rsl with standard macro container_of to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/d75688b6f884c526f6046fac522b8ed87db1ca2f.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 9 +++------ drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 3 +-- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ea07b350b62a..3244aef12c05 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -311,8 +311,7 @@ static const struct rtllib_qos_parameters def_qos_parameters = { static void _rtl92e_update_beacon(void *data) { - struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, - update_beacon_wq.work); + struct r8192_priv *priv = container_of(data, struct r8192_priv, update_beacon_wq.work); struct net_device *dev = priv->rtllib->dev; struct rtllib_device *ieee = priv->rtllib; struct rtllib_network *net = &ieee->current_network; @@ -326,8 +325,7 @@ static void _rtl92e_update_beacon(void *data) static void _rtl92e_qos_activate(void *data) { - struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, - qos_activate); + struct r8192_priv *priv = container_of(data, struct r8192_priv, qos_activate); struct net_device *dev = priv->rtllib->dev; int i; @@ -2033,8 +2031,7 @@ void rtl92e_commit(struct net_device *dev) static void _rtl92e_restart(void *data) { - struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, - reset_wq); + struct r8192_priv *priv = container_of(data, struct r8192_priv, reset_wq); struct net_device *dev = priv->rtllib->dev; mutex_lock(&priv->wx_mutex); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index ef4f736ce325..5a1cd22f5e25 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -142,8 +142,7 @@ void rtl92e_ips_leave(struct net_device *dev) void rtl92e_ips_leave_wq(void *data) { - struct rtllib_device *ieee = container_of_work_rsl(data, - struct rtllib_device, ips_leave_wq); + struct rtllib_device *ieee = container_of(data, struct rtllib_device, ips_leave_wq); struct net_device *dev = ieee->dev; struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index aa39f8b2bf09..669a9d9a5d18 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -62,7 +62,6 @@ #define IW_CUSTOM_MAX 256 /* In bytes */ #endif -#define container_of_work_rsl(x, y, z) container_of(x, y, z) #define container_of_dwork_rsl(x, y, z) \ container_of(to_delayed_work(x), y, z) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 91fb5f150a00..b9886e83a6dc 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1498,7 +1498,7 @@ static void rtllib_associate_step2(struct rtllib_device *ieee) static void rtllib_associate_complete_wq(void *data) { struct rtllib_device *ieee = (struct rtllib_device *) - container_of_work_rsl(data, + container_of(data, struct rtllib_device, associate_complete_wq); struct rt_pwr_save_ctrl *psc = &ieee->pwr_save_ctrl; diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 06f1d6de5cc7..1f2fa711e60b 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -326,8 +326,7 @@ EXPORT_SYMBOL(rtllib_wx_set_mode); void rtllib_wx_sync_scan_wq(void *data) { - struct rtllib_device *ieee = container_of_work_rsl(data, - struct rtllib_device, wx_sync_scan_wq); + struct rtllib_device *ieee = container_of(data, struct rtllib_device, wx_sync_scan_wq); short chan; enum ht_extchnl_offset chan_offset = 0; enum ht_channel_width bandwidth = 0; From 27e99d0327c26edb287b28ab11d46de710a65c3e Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:15:24 +0100 Subject: [PATCH 100/185] staging: rtl8192e: Replace macro iwe_stream_add_event_rsl with standard function Replace macro iwe_stream_add_event_rsl with standard function iwe_stream_add_event to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/00a8057acc994c139530a070974694b999a8f96a.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 3 --- drivers/staging/rtl8192e/rtllib_wx.c | 16 ++++++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 669a9d9a5d18..81d630cf7e52 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -65,9 +65,6 @@ #define container_of_dwork_rsl(x, y, z) \ container_of(to_delayed_work(x), y, z) -#define iwe_stream_add_event_rsl(info, start, stop, iwe, len) \ - iwe_stream_add_event(info, start, stop, iwe, len) - #define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \ iwe_stream_add_point(info, start, stop, iwe, p) diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 217426ee2e92..e580cd01c201 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -41,8 +41,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; ether_addr_copy(iwe.u.ap_addr.sa_data, network->bssid); - start = iwe_stream_add_event_rsl(info, start, stop, - &iwe, IW_EV_ADDR_LEN); + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); /* Remaining entries will be displayed in the order we provide them */ /* Add the ESSID */ @@ -71,8 +70,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, } *pname = '\0'; snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name); - start = iwe_stream_add_event_rsl(info, start, stop, - &iwe, IW_EV_CHAR_LEN); + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); /* Add mode */ iwe.cmd = SIOCGIWMODE; if (network->capability & @@ -81,8 +79,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.u.mode = IW_MODE_MASTER; else iwe.u.mode = IW_MODE_ADHOC; - start = iwe_stream_add_event_rsl(info, start, stop, - &iwe, IW_EV_UINT_LEN); + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); } /* Add frequency/channel */ @@ -90,8 +87,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.u.freq.m = network->channel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, - IW_EV_FREQ_LEN); + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); /* Add encryption capability */ iwe.cmd = SIOCGIWENCODE; @@ -152,7 +148,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.u.bitrate.disabled = 0; iwe.u.bitrate.fixed = 0; iwe.u.bitrate.value = max_rate * 500000; - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_PARAM_LEN); + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_PARAM_LEN); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = p - custom; if (iwe.u.data.length) @@ -172,7 +168,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, if (!(network->stats.mask & RTLLIB_STATMASK_SIGNAL)) iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; iwe.u.qual.updated = 7; - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); + start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); iwe.cmd = IWEVCUSTOM; p = custom; From 4f3db2e2a97bb04e49cf2840dcde8a813b2ece2a Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Wed, 22 Mar 2023 18:15:32 +0100 Subject: [PATCH 101/185] staging: rtl8192e: Replace macro iwe_stream_add_point_rsl with standard function Replace macro iwe_stream_add_point_rsl with standard function iwe_stream_add_point to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/563af664b3186e73d99f73a6396f8ebcd3c52be2.1679504314.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 3 --- drivers/staging/rtl8192e/rtllib_wx.c | 26 ++++++++++---------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 81d630cf7e52..1ce4c29dab13 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -65,9 +65,6 @@ #define container_of_dwork_rsl(x, y, z) \ container_of(to_delayed_work(x), y, z) -#define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \ - iwe_stream_add_point(info, start, stop, iwe, p) - static inline void *netdev_priv_rsl(struct net_device *dev) { return netdev_priv(dev); diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index e580cd01c201..d6691f3c7c70 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -49,16 +49,13 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.u.data.flags = 1; if (network->ssid_len > 0) { iwe.u.data.length = min_t(u8, network->ssid_len, 32); - start = iwe_stream_add_point_rsl(info, start, stop, &iwe, - network->ssid); + start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); } else if (network->hidden_ssid_len == 0) { iwe.u.data.length = sizeof(""); - start = iwe_stream_add_point_rsl(info, start, stop, - &iwe, ""); + start = iwe_stream_add_point(info, start, stop, &iwe, ""); } else { iwe.u.data.length = min_t(u8, network->hidden_ssid_len, 32); - start = iwe_stream_add_point_rsl(info, start, stop, &iwe, - network->hidden_ssid); + start = iwe_stream_add_point(info, start, stop, &iwe, network->hidden_ssid); } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; @@ -96,8 +93,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, else iwe.u.data.flags = IW_ENCODE_DISABLED; iwe.u.data.length = 0; - start = iwe_stream_add_point_rsl(info, start, stop, - &iwe, network->ssid); + start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); /* Add basic and extended rates */ max_rate = 0; p = custom; @@ -152,8 +148,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, iwe.cmd = IWEVCUSTOM; iwe.u.data.length = p - custom; if (iwe.u.data.length) - start = iwe_stream_add_point_rsl(info, start, stop, - &iwe, custom); + start = iwe_stream_add_point(info, start, stop, &iwe, custom); /* Add quality statistics */ /* TODO: Fix these values... */ iwe.cmd = IWEVQUAL; @@ -174,7 +169,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, p = custom; iwe.u.data.length = p - custom; if (iwe.u.data.length) - start = iwe_stream_add_point_rsl(info, start, stop, &iwe, custom); + start = iwe_stream_add_point(info, start, stop, &iwe, custom); memset(&iwe, 0, sizeof(iwe)); if (network->wpa_ie_len) { @@ -183,7 +178,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, memcpy(buf, network->wpa_ie, network->wpa_ie_len); iwe.cmd = IWEVGENIE; iwe.u.data.length = network->wpa_ie_len; - start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); } memset(&iwe, 0, sizeof(iwe)); if (network->rsn_ie_len) { @@ -192,7 +187,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, memcpy(buf, network->rsn_ie, network->rsn_ie_len); iwe.cmd = IWEVGENIE; iwe.u.data.length = network->rsn_ie_len; - start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); } /* add info for WZC */ @@ -203,7 +198,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, memcpy(buf, network->wzc_ie, network->wzc_ie_len); iwe.cmd = IWEVGENIE; iwe.u.data.length = network->wzc_ie_len; - start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); } /* Add EXTRA: Age to display seconds since last beacon/probe response @@ -216,8 +211,7 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, (100 * (jiffies - network->last_scanned)) / HZ); iwe.u.data.length = p - custom; if (iwe.u.data.length) - start = iwe_stream_add_point_rsl(info, start, stop, - &iwe, custom); + start = iwe_stream_add_point(info, start, stop, &iwe, custom); return start; } From 6bfafec3faf7ab20d72bb2063058591e55b68f8e Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Thu, 23 Mar 2023 12:59:31 -0400 Subject: [PATCH 102/185] staging: rtl8192u: remove unused ieee80211_SignalStrengthTranslate function clang with W=1 reports drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1961:18: error: unused function 'ieee80211_SignalStrengthTranslate' [-Werror,-Wunused-function] static inline u8 ieee80211_SignalStrengthTranslate( ^ This function is not used so remove it. It may have been used in the past but that has been commented out. Also remove the comment. Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20230323165931.2634587-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_rx.c | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 5c73e3f8541a..ca09367005e1 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1958,43 +1958,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, return 0; } -static inline u8 ieee80211_SignalStrengthTranslate( - u8 CurrSS - ) -{ - u8 RetSS; - - // Step 1. Scale mapping. - if (CurrSS >= 71 && CurrSS <= 100) { - RetSS = 90 + ((CurrSS - 70) / 3); - } else if (CurrSS >= 41 && CurrSS <= 70) { - RetSS = 78 + ((CurrSS - 40) / 3); - } else if (CurrSS >= 31 && CurrSS <= 40) { - RetSS = 66 + (CurrSS - 30); - } else if (CurrSS >= 21 && CurrSS <= 30) { - RetSS = 54 + (CurrSS - 20); - } else if (CurrSS >= 5 && CurrSS <= 20) { - RetSS = 42 + (((CurrSS - 5) * 2) / 3); - } else if (CurrSS == 4) { - RetSS = 36; - } else if (CurrSS == 3) { - RetSS = 27; - } else if (CurrSS == 2) { - RetSS = 18; - } else if (CurrSS == 1) { - RetSS = 9; - } else { - RetSS = CurrSS; - } - //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); - - // Step 2. Smoothing. - - //RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); - - return RetSS; -} - /* 0-100 index */ static long ieee80211_translate_todbm(u8 signal_strength_index) { @@ -2095,7 +2058,6 @@ static inline int ieee80211_network_init( network->flags |= NETWORK_EMPTY_ESSID; stats->signal = 30 + (stats->SignalStrength * 70) / 100; - //stats->signal = ieee80211_SignalStrengthTranslate(stats->signal); stats->noise = ieee80211_translate_todbm((u8)(100 - stats->signal)) - 25; memcpy(&network->stats, stats, sizeof(network->stats)); From 336af4bb239a7c95657e6e83784cf3e5e4a44c3e Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sat, 25 Mar 2023 03:31:28 +0500 Subject: [PATCH 103/185] staging: rtl8192e: remove extra blank lines Remove the extra blank line in accordance with the Linux kernel coding-style regulations. These issues were reported by checkpatch.pl "CHECK: Please don't use multiple blank lines" Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/6d7388f944e8296227269c7472a462ea7c94149c.1679696777.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c394c21beefb..c6114d99829b 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -154,7 +154,6 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, return skb; } - /* Called only as a tasklet (software IRQ) */ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee, struct rtllib_hdr_4addr *hdr) @@ -318,7 +317,6 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, return res; } - /* Called only as a tasklet (software IRQ), by rtllib_rx */ static inline int rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, @@ -355,7 +353,6 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } - /* this function is stolen from ipw2200 driver*/ #define IEEE_PACKET_RETRY_TIME (5*HZ) static int is_duplicate_packet(struct rtllib_device *ieee, @@ -887,7 +884,6 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, return rxb->nr_subframes; } - static size_t rtllib_rx_get_hdrlen(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats) @@ -1569,7 +1565,6 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element return 0; } - /* Parse a QoS parameter element */ static int rtllib_read_qos_param_element( struct rtllib_qos_parameter_info *element_param, @@ -1599,7 +1594,6 @@ static int rtllib_read_qos_info_element( return rtllib_verify_qos_info(element_info, QOS_OUI_INFO_SUB_TYPE); } - /* Write QoS parameters from the ac parameters. */ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm, struct rtllib_qos_data *qos_data) @@ -1843,7 +1837,6 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, } } - if (*tmp_htinfo_len == 0) { if (info_element->len >= 4 && info_element->data[0] == 0x00 && @@ -1932,7 +1925,6 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, info_element->data[2] == 0x96) network->cisco_cap_exist = true; - if (info_element->len >= 3 && info_element->data[0] == 0x00 && info_element->data[1] == 0x0a && @@ -2142,13 +2134,11 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, network->dtim_data = RTLLIB_DTIM_VALID; - if (info_element->data[2] & 1) network->dtim_data |= RTLLIB_DTIM_MBCAST; offset = (info_element->data[2] >> 1)*2; - if (ieee->assoc_id < 8*offset || ieee->assoc_id > 8*(offset + info_element->len - 3)) break; @@ -2203,7 +2193,6 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, &tmp_htcap_len); break; - case MFIE_TYPE_HT_INFO: netdev_dbg(ieee->dev, "MFIE_TYPE_HT_INFO: %d bytes\n", info_element->len); @@ -2392,7 +2381,6 @@ static inline int is_same_network(struct rtllib_network *src, (dst->capability & WLAN_CAPABILITY_ESS))); } - static inline void update_network(struct rtllib_device *ieee, struct rtllib_network *dst, struct rtllib_network *src) @@ -2580,7 +2568,6 @@ static inline void rtllib_process_probe_response( goto free_network; } - if (!rtllib_legal_channel(ieee, network->channel)) goto free_network; From 6ca4e57aade709dd4d918c4d385330fcd0b08b11 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sat, 25 Mar 2023 03:31:29 +0500 Subject: [PATCH 104/185] staging: rtl8192e: add blank lines after declarations Add blank lines after declarations to adhere to the Linux kernel coding-style guidelines. These issues are reported by checkpatch.pl "CHECK: Please use a blank line after function/struct/union/enum declarations" Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/d8a5e738046ffdc1b257e1935eacb8e16af34d5e.1679696777.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c6114d99829b..7144a0630ea6 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -231,10 +231,12 @@ rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; + /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ static unsigned char bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; + /* No encapsulation header if EtherType < 0x600 (=length) */ /* Called by rtllib_rx_frame_decrypt */ From 2ac74cf1fc0508486d5fb7d88d24eae924eae6e9 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sat, 25 Mar 2023 03:31:30 +0500 Subject: [PATCH 105/185] staging: rtl8192e: add spaces around binary operators Use spaces around binary operators as suggested by Linux kernel coding style guidelines. Issues reported by checkpatch.pl for the following binary operators: + , - , * , | , << Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/44a545cf8e99ebfdbfc3f5bb314f3828abe98558.1679696777.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 54 ++++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 7144a0630ea6..f627dfe66d90 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -356,7 +356,7 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, } /* this function is stolen from ipw2200 driver*/ -#define IEEE_PACKET_RETRY_TIME (5*HZ) +#define IEEE_PACKET_RETRY_TIME (5 * HZ) static int is_duplicate_packet(struct rtllib_device *ieee, struct rtllib_hdr_4addr *header) { @@ -936,7 +936,7 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, if (GetTs(ieee, (struct ts_common_info **)&pRxTS, hdr->addr2, (u8)Frame_QoSTID((u8 *)(skb->data)), RX_DIR, true)) { - if ((fc & (1<<11)) && (frag == pRxTS->rx_last_frag_num) && + if ((fc & (1 << 11)) && (frag == pRxTS->rx_last_frag_num) && (WLAN_GET_SEQ_SEQ(sc) == pRxTS->rx_last_seq_num)) return -1; pRxTS->rx_last_frag_num = frag; @@ -1619,23 +1619,23 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info case 1: /* BIT(0) | BIT(3) */ if (acm) - qos_data->wmm_acm |= (0x01<<0)|(0x01<<3); + qos_data->wmm_acm |= (0x01 << 0) | (0x01 << 3); break; case 2: /* BIT(4) | BIT(5) */ if (acm) - qos_data->wmm_acm |= (0x01<<4)|(0x01<<5); + qos_data->wmm_acm |= (0x01 << 4) | (0x01 << 5); break; case 3: /* BIT(6) | BIT(7) */ if (acm) - qos_data->wmm_acm |= (0x01<<6)|(0x01<<7); + qos_data->wmm_acm |= (0x01 << 6) | (0x01 << 7); break; case 0: default: /* BIT(1) | BIT(2) */ if (acm) - qos_data->wmm_acm |= (0x01<<1)|(0x01<<2); + qos_data->wmm_acm |= (0x01 << 1) | (0x01 << 2); break; } @@ -1979,7 +1979,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, info_element->data[3] == 0x04) { netdev_dbg(ieee->dev, "MFIE_TYPE_WZC: %d bytes\n", info_element->len); - network->wzc_ie_len = min(info_element->len+2, MAX_WZC_IE_LEN); + network->wzc_ie_len = min(info_element->len + 2, MAX_WZC_IE_LEN); memcpy(network->wzc_ie, info_element, network->wzc_ie_len); } } @@ -2139,10 +2139,10 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, if (info_element->data[2] & 1) network->dtim_data |= RTLLIB_DTIM_MBCAST; - offset = (info_element->data[2] >> 1)*2; + offset = (info_element->data[2] >> 1) * 2; - if (ieee->assoc_id < 8*offset || - ieee->assoc_id > 8*(offset + info_element->len - 3)) + if (ieee->assoc_id < 8 * offset || + ieee->assoc_id > 8 * (offset + info_element->len - 3)) break; offset = (ieee->assoc_id / 8) - offset; @@ -2357,7 +2357,7 @@ static inline int rtllib_network_init( if (rtllib_is_empty_essid(network->ssid, network->ssid_len)) network->flags |= NETWORK_EMPTY_ESSID; stats->signal = 30 + (stats->SignalStrength * 70) / 100; - stats->noise = rtllib_translate_todbm((u8)(100-stats->signal)) - 25; + stats->noise = rtllib_translate_todbm((u8)(100 - stats->signal)) - 25; memcpy(&network->stats, stats, sizeof(network->stats)); @@ -2545,22 +2545,22 @@ static inline void rtllib_process_probe_response( "'%s' ( %pM ): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", escape_essid(info_element->data, info_element->len), beacon->header.addr3, - (le16_to_cpu(beacon->capability) & (1<<0xf)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0xe)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0xd)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0xc)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0xb)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0xa)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x9)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x8)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x7)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x6)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x5)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x4)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x3)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x2)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x1)) ? '1' : '0', - (le16_to_cpu(beacon->capability) & (1<<0x0)) ? '1' : '0'); + (le16_to_cpu(beacon->capability) & (1 << 0xf)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0xe)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0xd)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0xc)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0xb)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0xa)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x9)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x8)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x7)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x6)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x5)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x4)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x3)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x2)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x1)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1 << 0x0)) ? '1' : '0'); if (rtllib_network_init(ieee, beacon, network, stats)) { netdev_dbg(ieee->dev, "Dropped '%s' ( %pM) via %s.\n", From 6e1ce577876250dbbfa95caaad9e51826f452166 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sat, 25 Mar 2023 03:31:31 +0500 Subject: [PATCH 106/185] staging: rtl8192e: remove blank lines after '{' Remove unnecessary blank lines after an open brace to adhere to the Linux kernel coding-style guidelines. These issues are reported by checkpatch.pl "CHECK: Blank lines aren't necessary after an open brace '{'" Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/e7cd8152e6986d361f81289868040889224bd1bf.1679696777.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index f627dfe66d90..b649d02dc5c8 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1167,7 +1167,6 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, if (crypt && !(fc & RTLLIB_FCTL_WEP) && !ieee->open_wep) { if (/*ieee->ieee802_1x &&*/ rtllib_is_eapol_frame(ieee, skb, hdrlen)) { - /* pass unencrypted EAPOL frames even if encryption is * configured */ @@ -1207,7 +1206,6 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, u8 nr_subframes) { if (unicast) { - if (ieee->state == RTLLIB_LINKED) { if (((ieee->link_detect_info.NumRxUnicastOkInPeriod + ieee->link_detect_info.NumTxOkInPeriod) > 8) || @@ -1552,7 +1550,6 @@ static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; static int rtllib_verify_qos_info(struct rtllib_qos_information_element *info_element, int sub_type) { - if (info_element->elementID != QOS_ELEMENT_ID) return -1; if (info_element->qui_subtype != sub_type) @@ -2696,7 +2693,6 @@ static void rtllib_rx_mgt(struct rtllib_device *ieee, ieee->last_rx_ps_time = jiffies; 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))); From fe730bfda640bc7b64f458bb35007225b640bcb0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:35:13 +0100 Subject: [PATCH 107/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_read priv->rf_chip is initialized to RF_8256 and never changed. Remove conditions in function _rtl92e_phy_rf_read as those are dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/c3b2e2a41cc450c1cb9ac41b8ed19b090d9627a6.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 2dbddf4ae3d6..c4fd412cf3d6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -82,24 +82,20 @@ static u32 _rtl92e_phy_rf_read(struct net_device *dev, Offset &= 0x3f; - if (priv->rf_chip == RF_8256) { - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); - if (Offset >= 31) { - priv->rf_reg_0value[eRFPath] |= 0x140; - rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->rf_reg_0value[eRFPath] << 16)); - NewOffset = Offset - 30; - } else if (Offset >= 16) { - priv->rf_reg_0value[eRFPath] |= 0x100; - priv->rf_reg_0value[eRFPath] &= (~0x40); - rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->rf_reg_0value[eRFPath] << 16)); - - NewOffset = Offset - 15; - } else - NewOffset = Offset; + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); + if (Offset >= 31) { + priv->rf_reg_0value[eRFPath] |= 0x140; + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->rf_reg_0value[eRFPath] << 16)); + NewOffset = Offset - 30; + } else if (Offset >= 16) { + priv->rf_reg_0value[eRFPath] |= 0x100; + priv->rf_reg_0value[eRFPath] &= (~0x40); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->rf_reg_0value[eRFPath] << 16)); + NewOffset = Offset - 15; } else { NewOffset = Offset; } @@ -113,15 +109,12 @@ static u32 _rtl92e_phy_rf_read(struct net_device *dev, ret = rtl92e_get_bb_reg(dev, pPhyReg->rfLSSIReadBack, bLSSIReadBackData); - if (priv->rf_chip == RF_8256) { - priv->rf_reg_0value[eRFPath] &= 0xebf; + priv->rf_reg_0value[eRFPath] &= 0xebf; - rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, bMaskDWord, - (priv->rf_reg_0value[eRFPath] << 16)); - - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); - } + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, bMaskDWord, + (priv->rf_reg_0value[eRFPath] << 16)); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); return ret; From 1200384754b6ecce28e075efd256cfd654a91d04 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:35:28 +0100 Subject: [PATCH 108/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_rf_write priv->rf_chip is initialized to RF_8256 and never changed. Remove conditions in function _rtl92e_phy_rf_write as those are dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/77628b7ecade212401d7da5e3c0b79f8ef55b5c1.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index c4fd412cf3d6..acd1e1869d78 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -129,24 +129,22 @@ static void _rtl92e_phy_rf_write(struct net_device *dev, struct bb_reg_definition *pPhyReg = &priv->phy_reg_def[eRFPath]; Offset &= 0x3f; - if (priv->rf_chip == RF_8256) { - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); - if (Offset >= 31) { - priv->rf_reg_0value[eRFPath] |= 0x140; - rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->rf_reg_0value[eRFPath] << 16)); - NewOffset = Offset - 30; - } else if (Offset >= 16) { - priv->rf_reg_0value[eRFPath] |= 0x100; - priv->rf_reg_0value[eRFPath] &= (~0x40); - rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->rf_reg_0value[eRFPath] << 16)); - NewOffset = Offset - 15; - } else - NewOffset = Offset; + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0); + + if (Offset >= 31) { + priv->rf_reg_0value[eRFPath] |= 0x140; + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->rf_reg_0value[eRFPath] << 16)); + NewOffset = Offset - 30; + } else if (Offset >= 16) { + priv->rf_reg_0value[eRFPath] |= 0x100; + priv->rf_reg_0value[eRFPath] &= (~0x40); + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->rf_reg_0value[eRFPath] << 16)); + NewOffset = Offset - 15; } else { NewOffset = Offset; } @@ -158,15 +156,13 @@ static void _rtl92e_phy_rf_write(struct net_device *dev, if (Offset == 0x0) priv->rf_reg_0value[eRFPath] = Data; - if (priv->rf_chip == RF_8256) { - if (Offset != 0) { - priv->rf_reg_0value[eRFPath] &= 0xebf; - rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, - bMaskDWord, - (priv->rf_reg_0value[eRFPath] << 16)); - } - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); + if (Offset != 0) { + priv->rf_reg_0value[eRFPath] &= 0xebf; + rtl92e_set_bb_reg(dev, pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->rf_reg_0value[eRFPath] << 16)); } + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); } void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, From 846fc62b9c3a1d322f3d7cd988aef5c9d88aa613 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:35:45 +0100 Subject: [PATCH 109/185] staging: rtl8192e: Remove priv->rf_chip in rtl92e_set_tx_power priv->rf_chip is initialized to RF_8256 and never changed. Remove condition in function rtl92e_set_tx_power as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/190d0a77602cb89bc24512c99b72f25f4ca5d5e2.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index acd1e1869d78..6579c7b81bfd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -485,19 +485,8 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) powerlevelOFDM24G = priv->tx_pwr_level_ofdm_24g[channel - 1]; } - switch (priv->rf_chip) { - case RF_8225: - break; - case RF_8256: - rtl92e_set_cck_tx_power(dev, powerlevel); - rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); - break; - case RF_8258: - break; - default: - netdev_err(dev, "Invalid RF Chip ID.\n"); - break; - } + rtl92e_set_cck_tx_power(dev, powerlevel); + rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); } bool rtl92e_config_phy(struct net_device *dev) From ade42a46b293436433a10de77003afa205d7dde5 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:36:00 +0100 Subject: [PATCH 110/185] staging: rtl8192e: Remove priv->rf_chip in rtl92e_config_phy priv->rf_chip is initialized to RF_8256 and never changed. Remove condition in function rtl92e_config_phy as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/c0d4e98308c9198776d8d04d1c2910f089f45a90.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 6579c7b81bfd..e35085253e70 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -491,25 +491,10 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) bool rtl92e_config_phy(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); bool rtStatus = true; - switch (priv->rf_chip) { - case RF_8225: - break; - case RF_8256: - rtStatus = rtl92e_config_rf(dev); - break; + rtStatus = rtl92e_config_rf(dev); - case RF_8258: - break; - case RF_PSEUDO_11N: - break; - - default: - netdev_err(dev, "Invalid RF Chip ID.\n"); - break; - } return rtStatus; } From 592630558d93a6416987e48a56ec41233fa9bd0b Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:36:13 +0100 Subject: [PATCH 111/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_tx_power_level priv->rf_chip is initialized to RF_8256 and never changed. Remove condition in function _rtl92e_set_tx_power_level as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/465a789243287c1420fdce68f9a861784a164140.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index e35085253e70..b528b8ab4b2b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -542,21 +542,8 @@ static void _rtl92e_set_tx_power_level(struct net_device *dev, u8 channel) u8 powerlevel = priv->tx_pwr_level_cck[channel - 1]; u8 powerlevelOFDM24G = priv->tx_pwr_level_ofdm_24g[channel - 1]; - switch (priv->rf_chip) { - case RF_8225: - break; - - case RF_8256: - rtl92e_set_cck_tx_power(dev, powerlevel); - rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); - break; - - case RF_8258: - break; - default: - netdev_warn(dev, "%s(): Invalid RF Chip ID\n", __func__); - break; - } + rtl92e_set_cck_tx_power(dev, powerlevel); + rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); } static u8 _rtl92e_phy_set_sw_chnl_cmd_array(struct net_device *dev, From 0c0b33680ad2e21819786f817ed22c2bc1801601 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:36:23 +0100 Subject: [PATCH 112/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_phy_switch_channel_step priv->rf_chip is initialized to RF_8256 and never changed. Remove condition in function _rtl92e_phy_switch_channel_step as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/1b9e10de4f539aa24150275c80ec4bbd925c853d.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 83 ++++--------------- 1 file changed, 16 insertions(+), 67 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index b528b8ab4b2b..73e426e052b0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -14,24 +14,6 @@ #include "table.h" -static u32 RF_CHANNEL_TABLE_ZEBRA[] = { - 0, - 0x085c, - 0x08dc, - 0x095c, - 0x09dc, - 0x0a5c, - 0x0adc, - 0x0b5c, - 0x0bdc, - 0x0c5c, - 0x0cdc, - 0x0d5c, - 0x0ddc, - 0x0e5c, - 0x0f72, -}; - /*************************Define local function prototype**********************/ static u32 _rtl92e_phy_rf_fw_read(struct net_device *dev, @@ -608,58 +590,25 @@ static u8 _rtl92e_phy_switch_channel_step(struct net_device *dev, u8 channel, 0, 0, 0); RfDependCmdCnt = 0; - switch (priv->rf_chip) { - case RF_8225: - if (!(channel >= 1 && channel <= 14)) { - netdev_err(dev, - "Invalid channel requested for 8225: %d\n", - channel); - return false; - } - _rtl92e_phy_set_sw_chnl_cmd_array(dev, - ieee->RfDependCmd, - RfDependCmdCnt++, - MAX_RFDEPENDCMD_CNT, - CmdID_RF_WriteReg, - rZebra1_Channel, - RF_CHANNEL_TABLE_ZEBRA[channel], - 10); - _rtl92e_phy_set_sw_chnl_cmd_array(dev, - ieee->RfDependCmd, - RfDependCmdCnt++, - MAX_RFDEPENDCMD_CNT, - CmdID_End, 0, 0, 0); - break; - case RF_8256: - if (!(channel >= 1 && channel <= 14)) { - netdev_err(dev, - "Invalid channel requested for 8256: %d\n", - channel); - return false; - } - _rtl92e_phy_set_sw_chnl_cmd_array(dev, - ieee->RfDependCmd, - RfDependCmdCnt++, - MAX_RFDEPENDCMD_CNT, - CmdID_RF_WriteReg, - rZebra1_Channel, - channel, 10); - _rtl92e_phy_set_sw_chnl_cmd_array(dev, - ieee->RfDependCmd, - RfDependCmdCnt++, - MAX_RFDEPENDCMD_CNT, - CmdID_End, 0, 0, 0); - break; - - case RF_8258: - break; - - default: - netdev_warn(dev, "Unknown RF Chip ID\n"); + if (!(channel >= 1 && channel <= 14)) { + netdev_err(dev, + "Invalid channel requested for 8256: %d\n", + channel); return false; } - + _rtl92e_phy_set_sw_chnl_cmd_array(dev, + ieee->RfDependCmd, + RfDependCmdCnt++, + MAX_RFDEPENDCMD_CNT, + CmdID_RF_WriteReg, + rZebra1_Channel, + channel, 10); + _rtl92e_phy_set_sw_chnl_cmd_array(dev, + ieee->RfDependCmd, + RfDependCmdCnt++, + MAX_RFDEPENDCMD_CNT, + CmdID_End, 0, 0, 0); do { switch (*stage) { From 5d020fd58cb132c197079ab7bc1459d1e8cdfde3 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:36:34 +0100 Subject: [PATCH 113/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_bw_mode_work_item priv->rf_chip is initialized to RF_8256 and never changed. Remove conditions in function _rtl92e_set_bw_mode_work_item as those are dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/a872bb67f71b9992740d5f9b154f794604a2dbb0.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 73e426e052b0..1f0d3654c6a0 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -849,10 +849,6 @@ static void _rtl92e_set_bw_mode_work_item(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); u8 regBwOpMode; - if (priv->rf_chip == RF_PSEUDO_11N) { - priv->set_bw_mode_in_progress = false; - return; - } if (!priv->up) { netdev_err(dev, "%s(): Driver is not initialized\n", __func__); return; @@ -918,25 +914,7 @@ static void _rtl92e_set_bw_mode_work_item(struct net_device *dev) } - switch (priv->rf_chip) { - case RF_8225: - break; - - case RF_8256: - rtl92e_set_bandwidth(dev, priv->current_chnl_bw); - break; - - case RF_8258: - break; - - case RF_PSEUDO_11N: - break; - - default: - netdev_info(dev, "%s(): Unknown RFChipID: %d\n", __func__, - priv->rf_chip); - break; - } + rtl92e_set_bandwidth(dev, priv->current_chnl_bw); atomic_dec(&(priv->rtllib->atm_swbw)); priv->set_bw_mode_in_progress = false; From ec69d872eb6fccc0e271f2d7ca283796c215a776 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:36:43 +0100 Subject: [PATCH 114/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_set_rf_power_state priv->rf_chip is initialized to RF_8256 and never changed. Remove conditions in function _rtl92e_set_rf_power_state as those are dead code. Removed unnecessary blank lines to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/a83b95c68697e6eade68bfd0bf8e22a1340c1457.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 192 +++++++----------- 1 file changed, 79 insertions(+), 113 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 1f0d3654c6a0..b1c297d2ae36 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1040,129 +1040,95 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev, return false; priv->set_rf_pwr_state_in_progress = true; - switch (priv->rf_chip) { - case RF_8256: - switch (rf_power_state) { - case rf_on: - if ((priv->rtllib->rf_power_state == rf_off) && - RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) { - bool rtstatus; - u32 InitilizeCount = 3; - - do { - InitilizeCount--; - rtstatus = rtl92e_enable_nic(dev); - } while (!rtstatus && (InitilizeCount > 0)); - - if (!rtstatus) { - netdev_err(dev, - "%s(): Failed to initialize Adapter.\n", - __func__); - priv->set_rf_pwr_state_in_progress = false; - return false; - } - - RT_CLEAR_PS_LEVEL(psc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - rtl92e_writeb(dev, ANAPAR, 0x37); - mdelay(1); - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, - 0x4, 0x1); - priv->hw_rf_off_action = 0; - - rtl92e_set_bb_reg(dev, rFPGA0_XA_RFInterfaceOE, - BIT4, 0x1); - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, - 0x300, 0x3); - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, - 0x18, 0x3); - rtl92e_set_bb_reg(dev, rOFDM0_TRxPathEnable, - 0x3, 0x3); - rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable, - 0x3, 0x3); - rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, - 0x60, 0x3); + switch (rf_power_state) { + case rf_on: + if ((priv->rtllib->rf_power_state == rf_off) && + RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) { + bool rtstatus; + u32 InitilizeCount = 3; + do { + InitilizeCount--; + rtstatus = rtl92e_enable_nic(dev); + } while (!rtstatus && (InitilizeCount > 0)); + if (!rtstatus) { + netdev_err(dev, + "%s(): Failed to initialize Adapter.\n", + __func__); + priv->set_rf_pwr_state_in_progress = false; + return false; } - - break; - - case rf_sleep: - if (priv->rtllib->rf_power_state == rf_off) - break; - - - for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { - ring = &priv->tx_ring[QueueID]; - - if (skb_queue_len(&ring->queue) == 0) { - QueueID++; - continue; - } else { - udelay(10); - i++; - } - - if (i >= MAX_DOZE_WAITING_TIMES_9x) - break; - } - rtl92e_set_rf_off(dev); - break; - - case rf_off: - for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { - ring = &priv->tx_ring[QueueID]; - - if (skb_queue_len(&ring->queue) == 0) { - QueueID++; - continue; - } else { - udelay(10); - i++; - } - - if (i >= MAX_DOZE_WAITING_TIMES_9x) - break; - } - - if (psc->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC && - !RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) { - rtl92e_disable_nic(dev); - RT_SET_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC); - } else if (!(psc->RegRfPsLevel & - RT_RF_OFF_LEVL_HALT_NIC)) { - rtl92e_set_rf_off(dev); - } - - break; - - default: - bResult = false; - netdev_warn(dev, - "%s(): Unknown state requested: 0x%X.\n", - __func__, rf_power_state); - break; + RT_CLEAR_PS_LEVEL(psc, + RT_RF_OFF_LEVL_HALT_NIC); + } else { + rtl92e_writeb(dev, ANAPAR, 0x37); + mdelay(1); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, + 0x4, 0x1); + priv->hw_rf_off_action = 0; + rtl92e_set_bb_reg(dev, rFPGA0_XA_RFInterfaceOE, + BIT4, 0x1); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter4, + 0x300, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, + 0x18, 0x3); + rtl92e_set_bb_reg(dev, rOFDM0_TRxPathEnable, + 0x3, 0x3); + rtl92e_set_bb_reg(dev, rOFDM1_TRxPathEnable, + 0x3, 0x3); + rtl92e_set_bb_reg(dev, rFPGA0_AnalogParameter1, + 0x60, 0x3); + } + break; + case rf_sleep: + if (priv->rtllib->rf_power_state == rf_off) + break; + for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { + ring = &priv->tx_ring[QueueID]; + if (skb_queue_len(&ring->queue) == 0) { + QueueID++; + continue; + } else { + udelay(10); + i++; + } + if (i >= MAX_DOZE_WAITING_TIMES_9x) + break; + } + rtl92e_set_rf_off(dev); + break; + case rf_off: + for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { + ring = &priv->tx_ring[QueueID]; + if (skb_queue_len(&ring->queue) == 0) { + QueueID++; + continue; + } else { + udelay(10); + i++; + } + if (i >= MAX_DOZE_WAITING_TIMES_9x) + break; + } + if (psc->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC && + !RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) { + rtl92e_disable_nic(dev); + RT_SET_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC); + } else if (!(psc->RegRfPsLevel & + RT_RF_OFF_LEVL_HALT_NIC)) { + rtl92e_set_rf_off(dev); } - break; - default: - netdev_warn(dev, "%s(): Unknown RF type\n", __func__); + bResult = false; + netdev_warn(dev, + "%s(): Unknown state requested: 0x%X.\n", + __func__, rf_power_state); break; } if (bResult) { priv->rtllib->rf_power_state = rf_power_state; - - switch (priv->rf_chip) { - case RF_8256: - break; - - default: - netdev_warn(dev, "%s(): Unknown RF type\n", __func__); - break; - } } priv->set_rf_pwr_state_in_progress = false; From 25e99c453b6d4797be3606d4debeabc9e7f28ef9 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:36:54 +0100 Subject: [PATCH 115/185] staging: rtl8192e: Remove rf_chip in _rtl92e_get_supported_wireless_mode priv->rf_chip is initialized to RF_8256 and never changed. Remove condition in function _rtl92e_get_supported_wireless_mode as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/e2db309dea3208560337376fec26fa5cfba93848.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 3244aef12c05..8e4e939d7617 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -595,23 +595,9 @@ static void _rtl92e_refresh_support_rate(struct r8192_priv *priv) static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev) { - struct r8192_priv *priv = rtllib_priv(dev); u8 ret = 0; - switch (priv->rf_chip) { - case RF_8225: - case RF_8256: - case RF_6052: - case RF_PSEUDO_11N: - ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B); - break; - case RF_8258: - ret = (WIRELESS_MODE_A | WIRELESS_MODE_N_5G); - break; - default: - ret = WIRELESS_MODE_B; - break; - } + ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B); return ret; } From 1d907c886f1c955fe805563bd6b08c733d903eb8 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:37:02 +0100 Subject: [PATCH 116/185] staging: rtl8192e: Remove priv->rf_chip in _rtl92e_get_channel_map priv->rf_chip is initialized to RF_8256 and never changed. Remove condition in function _rtl92e_get_channel_map as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/b8c5a719c6f8930adb87a4ad9bd5d368ba5f348b.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 8e4e939d7617..ecc3f0c6c267 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -895,13 +895,6 @@ static short _rtl92e_get_channel_map(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); - if ((priv->rf_chip != RF_8225) && (priv->rf_chip != RF_8256) && - (priv->rf_chip != RF_6052)) { - netdev_err(dev, "%s: unknown rf chip, can't set channel map\n", - __func__); - return -1; - } - if (priv->chnl_plan >= COUNTRY_CODE_MAX) { netdev_info(dev, "rtl819x_init:Error channel plan! Set to default.\n"); From d6e10084a19f6a0aec81f5823514736f4a990023 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sat, 25 Mar 2023 09:37:10 +0100 Subject: [PATCH 117/185] staging: rtl8192e: Remove priv->rf_chip priv->rf_chip is initialized to RF_8256 and not used. Remove initialization, variable and enum as it is dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/2ce85c1a159ae376d82c19c61e694924f07d1093.1679732276.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 1e7be321721b..a67927f0c5e3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -432,8 +432,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) rtl92e_init_adaptive_rate(dev); - priv->rf_chip = RF_8256; - if (priv->reg_chnl_plan == 0xf) priv->chnl_plan = priv->eeprom_chnl_plan; else diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index c8816c44ca51..68ec0aeb2dd9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -129,15 +129,6 @@ enum dcmg_txcmd_op { TXCMD_XXXX_CTRL, }; -enum rt_rf_type_819xu { - RF_TYPE_MIN = 0, - RF_8225, - RF_8256, - RF_8258, - RF_6052 = 4, - RF_PSEUDO_11N = 5, -}; - enum rt_customer_id { RT_CID_DEFAULT = 0, RT_CID_819x_CAMEO = 6, @@ -221,7 +212,6 @@ struct r8192_priv { enum rt_customer_id customer_id; - enum rt_rf_type_819xu rf_chip; enum ht_channel_width current_chnl_bw; struct bb_reg_definition phy_reg_def[4]; struct rate_adaptive rate_adaptive; From f8a0457a0f8dd76a65fbdbed7175efbd3f8d0f78 Mon Sep 17 00:00:00 2001 From: Menna Mahmoud Date: Wed, 22 Mar 2023 13:37:34 +0200 Subject: [PATCH 118/185] staging: greybus: remove unnecessary blank line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary blank line before struct as reported by checkpatch: " CHECK: Please don't use multiple blank lines " Signed-off-by: Menna Mahmoud Acked-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230322113735.31214-1-eng.mennamahmoud.mm@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/greybus_authentication.h | 1 - drivers/staging/greybus/pwm.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/greybus/greybus_authentication.h b/drivers/staging/greybus/greybus_authentication.h index 7edc7295b7ab..48b4a9794d3c 100644 --- a/drivers/staging/greybus/greybus_authentication.h +++ b/drivers/staging/greybus/greybus_authentication.h @@ -41,7 +41,6 @@ #define CAP_AUTH_RESULT_CR_NO_KEY 0x03 #define CAP_AUTH_RESULT_CR_SIG_FAIL 0x04 - /* IOCTL support */ struct cap_ioc_get_endpoint_uid { __u8 uid[8]; diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c index 3fda172239d2..26d39e08c3b6 100644 --- a/drivers/staging/greybus/pwm.c +++ b/drivers/staging/greybus/pwm.c @@ -24,7 +24,6 @@ struct gb_pwm_chip { #define pwm_chip_to_gb_pwm_chip(chip) \ container_of(chip, struct gb_pwm_chip, chip) - static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc) { struct gb_pwm_count_response response; From 016227800e3b085d90638312bf79d40add8da1e4 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 24 Mar 2023 09:43:34 +0100 Subject: [PATCH 119/185] staging: rtl8723bs: remove hal_btcoex_SetChipType() Remove the function hal_btcoex_SetChipType() as it does nothing and produces the following gcc warning when compiling with W=1. drivers/staging/rtl8723bs/hal/hal_btcoex.c:1182:30: warning: variable 'pHalData' set but not used [-Wunused-but-set-variable] 1182 | struct hal_com_data *pHalData; | ^~~~~~~~ Signed-off-by: Michael Straube Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20230324084334.12183-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 -------- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 1 - drivers/staging/rtl8723bs/include/hal_btcoex.h | 1 - 3 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index e36f8c369a04..e26b789b9cdd 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -1177,14 +1177,6 @@ bool hal_btcoex_IsBtDisabled(struct adapter *padapter) return false; } -void hal_btcoex_SetChipType(struct adapter *padapter, u8 chipType) -{ - struct hal_com_data *pHalData; - - - pHalData = GET_HAL_DATA(padapter); -} - void hal_btcoex_SetPgAntNum(struct adapter *padapter, u8 antNum) { struct hal_com_data *pHalData; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 0fcae6871108..c3c1b49674d3 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -2304,7 +2304,6 @@ void Hal_EfuseParseBTCoexistInfo_8723B( } hal_btcoex_SetBTCoexist(padapter, pHalData->EEPROMBluetoothCoexist); - hal_btcoex_SetChipType(padapter, pHalData->EEPROMBluetoothType); hal_btcoex_SetPgAntNum(padapter, pHalData->EEPROMBluetoothAntNum == Ant_x2 ? 2 : 1); if (pHalData->EEPROMBluetoothAntNum == Ant_x1) hal_btcoex_SetSingleAntPath(padapter, pHalData->ant_path); diff --git a/drivers/staging/rtl8723bs/include/hal_btcoex.h b/drivers/staging/rtl8723bs/include/hal_btcoex.h index fb167642da01..525cce3574fe 100644 --- a/drivers/staging/rtl8723bs/include/hal_btcoex.h +++ b/drivers/staging/rtl8723bs/include/hal_btcoex.h @@ -23,7 +23,6 @@ struct bt_coexist { void hal_btcoex_SetBTCoexist(struct adapter *padapter, u8 bBtExist); bool hal_btcoex_IsBtExist(struct adapter *padapter); bool hal_btcoex_IsBtDisabled(struct adapter *); -void hal_btcoex_SetChipType(struct adapter *padapter, u8 chipType); void hal_btcoex_SetPgAntNum(struct adapter *padapter, u8 antNum); void hal_btcoex_SetSingleAntPath(struct adapter *padapter, u8 singleAntPath); From f48198232d605a0d29f1e11235a6f6142b074b39 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Sat, 25 Mar 2023 01:23:33 -0700 Subject: [PATCH 120/185] staging: greybus: Inline gpio_chip_to_gb_gpio_controller() Convert 'gpio_chip_to_gb_gpio_controller' from a macro to a static inline function, to make the relevant types apparent in the definition and to benefit from the type checking performed by the compiler at call sites. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/3fc5d84a99574ac4a76d26427ac544de375adeb4.1679732179.git.sumitraartsy@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/gpio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index d729b922a750..2a115a8fc263 100644 --- a/drivers/staging/greybus/gpio.c +++ b/drivers/staging/greybus/gpio.c @@ -41,8 +41,11 @@ struct gb_gpio_controller { struct irq_chip irqc; struct mutex irq_lock; }; -#define gpio_chip_to_gb_gpio_controller(chip) \ - container_of(chip, struct gb_gpio_controller, chip) + +static inline struct gb_gpio_controller *gpio_chip_to_gb_gpio_controller(struct gpio_chip *chip) +{ + return container_of(chip, struct gb_gpio_controller, chip); +} static struct gpio_chip *irq_data_to_gpio_chip(struct irq_data *d) { From f5aca1a63e83178374195d3a26790091fdf2ed05 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Sat, 25 Mar 2023 01:31:06 -0700 Subject: [PATCH 121/185] staging: greybus: Inline gb_audio_manager_module() Convert 'gb_audio_manager_module' from a macro to a static inline function, to make the relevant types apparent in the definition and to benefit from the type checking performed by the compiler at call sites. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/7470bf9d9a57e8bf27e55bd5e3791c5e0ee31385.1679732179.git.sumitraartsy@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_manager_module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c index 81b4ba607a0e..5f9dcbdbc191 100644 --- a/drivers/staging/greybus/audio_manager_module.c +++ b/drivers/staging/greybus/audio_manager_module.c @@ -12,8 +12,11 @@ #define to_gb_audio_module_attr(x) \ container_of(x, struct gb_audio_manager_module_attribute, attr) -#define to_gb_audio_module(x) \ - container_of(x, struct gb_audio_manager_module, kobj) + +static inline struct gb_audio_manager_module *to_gb_audio_module(struct kobject *kobj) +{ + return container_of(kobj, struct gb_audio_manager_module, kobj); +} struct gb_audio_manager_module_attribute { struct attribute attr; From 01bc9ff2749b1aee1eab70d98c5313361add336c Mon Sep 17 00:00:00 2001 From: Abhirup Deb Date: Tue, 21 Mar 2023 00:12:50 +0530 Subject: [PATCH 122/185] staging: vme_user: Replace "<<" with BIT macro Replace the "<<" operator with BIT macro, in accordance to the checkpatch.pl script and Linux kernel coding-style guidelines. Signed-off-by: Abhirup Deb Link: https://lore.kernel.org/r/ZBipKh/e2lK3YcQr@li-27defe4c-32e1-11b2-a85c-e202e9981075.ibm.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/vme_tsi148.h | 528 +++++++++++++------------- 1 file changed, 264 insertions(+), 264 deletions(-) diff --git a/drivers/staging/vme_user/vme_tsi148.h b/drivers/staging/vme_user/vme_tsi148.h index b3cb4a089cc8..63f726e1811a 100644 --- a/drivers/staging/vme_user/vme_tsi148.h +++ b/drivers/staging/vme_user/vme_tsi148.h @@ -536,22 +536,22 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * PFCS Register Set */ -#define TSI148_PCFS_CMMD_SERR (1<<8) /* SERR_L out pin ssys err */ -#define TSI148_PCFS_CMMD_PERR (1<<6) /* PERR_L out pin parity */ -#define TSI148_PCFS_CMMD_MSTR (1<<2) /* PCI bus master */ -#define TSI148_PCFS_CMMD_MEMSP (1<<1) /* PCI mem space access */ -#define TSI148_PCFS_CMMD_IOSP (1<<0) /* PCI I/O space enable */ +#define TSI148_PCFS_CMMD_SERR BIT(8) /* SERR_L out pin ssys err */ +#define TSI148_PCFS_CMMD_PERR BIT(6) /* PERR_L out pin parity */ +#define TSI148_PCFS_CMMD_MSTR BIT(2) /* PCI bus master */ +#define TSI148_PCFS_CMMD_MEMSP BIT(1) /* PCI mem space access */ +#define TSI148_PCFS_CMMD_IOSP BIT(0) /* PCI I/O space enable */ -#define TSI148_PCFS_STAT_RCPVE (1<<15) /* Detected Parity Error */ -#define TSI148_PCFS_STAT_SIGSE (1<<14) /* Signalled System Error */ -#define TSI148_PCFS_STAT_RCVMA (1<<13) /* Received Master Abort */ -#define TSI148_PCFS_STAT_RCVTA (1<<12) /* Received Target Abort */ -#define TSI148_PCFS_STAT_SIGTA (1<<11) /* Signalled Target Abort */ +#define TSI148_PCFS_STAT_RCPVE BIT(15) /* Detected Parity Error */ +#define TSI148_PCFS_STAT_SIGSE BIT(14) /* Signalled System Error */ +#define TSI148_PCFS_STAT_RCVMA BIT(13) /* Received Master Abort */ +#define TSI148_PCFS_STAT_RCVTA BIT(12) /* Received Target Abort */ +#define TSI148_PCFS_STAT_SIGTA BIT(11) /* Signalled Target Abort */ #define TSI148_PCFS_STAT_SELTIM (3<<9) /* DELSEL Timing */ -#define TSI148_PCFS_STAT_DPAR (1<<8) /* Data Parity Err Reported */ -#define TSI148_PCFS_STAT_FAST (1<<7) /* Fast back-to-back Cap */ -#define TSI148_PCFS_STAT_P66M (1<<5) /* 66 MHz Capable */ -#define TSI148_PCFS_STAT_CAPL (1<<4) /* Capab List - address $34 */ +#define TSI148_PCFS_STAT_DPAR BIT(8) /* Data Parity Err Reported */ +#define TSI148_PCFS_STAT_FAST BIT(7) /* Fast back-to-back Cap */ +#define TSI148_PCFS_STAT_P66M BIT(5) /* 66 MHz Capable */ +#define TSI148_PCFS_STAT_CAPL BIT(4) /* Capab List - address $34 */ /* * Revision ID/Class Code Registers (CRG +$008) @@ -572,17 +572,17 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, * Memory Base Address Lower Reg (CRG + $010) */ #define TSI148_PCFS_MBARL_BASEL_M (0xFFFFF<<12) /* Base Addr Lower Mask */ -#define TSI148_PCFS_MBARL_PRE (1<<3) /* Prefetch */ +#define TSI148_PCFS_MBARL_PRE BIT(3) /* Prefetch */ #define TSI148_PCFS_MBARL_MTYPE_M (3<<1) /* Memory Type Mask */ -#define TSI148_PCFS_MBARL_IOMEM (1<<0) /* I/O Space Indicator */ +#define TSI148_PCFS_MBARL_IOMEM BIT(0) /* I/O Space Indicator */ /* * Message Signaled Interrupt Capabilities Register (CRG + $040) */ -#define TSI148_PCFS_MSICAP_64BAC (1<<7) /* 64-bit Address Capable */ +#define TSI148_PCFS_MSICAP_64BAC BIT(7) /* 64-bit Address Capable */ #define TSI148_PCFS_MSICAP_MME_M (7<<4) /* Multiple Msg Enable Mask */ #define TSI148_PCFS_MSICAP_MMC_M (7<<1) /* Multiple Msg Capable Mask */ -#define TSI148_PCFS_MSICAP_MSIEN (1<<0) /* Msg signaled INT Enable */ +#define TSI148_PCFS_MSICAP_MSIEN BIT(0) /* Msg signaled INT Enable */ /* * Message Address Lower Register (CRG +$044) @@ -599,22 +599,22 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, */ #define TSI148_PCFS_PCIXCAP_MOST_M (7<<4) /* Max outstanding Split Tran */ #define TSI148_PCFS_PCIXCAP_MMRBC_M (3<<2) /* Max Mem Read byte cnt */ -#define TSI148_PCFS_PCIXCAP_ERO (1<<1) /* Enable Relaxed Ordering */ -#define TSI148_PCFS_PCIXCAP_DPERE (1<<0) /* Data Parity Recover Enable */ +#define TSI148_PCFS_PCIXCAP_ERO BIT(1) /* Enable Relaxed Ordering */ +#define TSI148_PCFS_PCIXCAP_DPERE BIT(0) /* Data Parity Recover Enable */ /* * PCI-X Status Register (CRG +$054) */ -#define TSI148_PCFS_PCIXSTAT_RSCEM (1<<29) /* Received Split Comp Error */ +#define TSI148_PCFS_PCIXSTAT_RSCEM BIT(29) /* Received Split Comp Error */ #define TSI148_PCFS_PCIXSTAT_DMCRS_M (7<<26) /* max Cumulative Read Size */ #define TSI148_PCFS_PCIXSTAT_DMOST_M (7<<23) /* max outstanding Split Trans */ #define TSI148_PCFS_PCIXSTAT_DMMRC_M (3<<21) /* max mem read byte count */ -#define TSI148_PCFS_PCIXSTAT_DC (1<<20) /* Device Complexity */ -#define TSI148_PCFS_PCIXSTAT_USC (1<<19) /* Unexpected Split comp */ -#define TSI148_PCFS_PCIXSTAT_SCD (1<<18) /* Split completion discard */ -#define TSI148_PCFS_PCIXSTAT_133C (1<<17) /* 133MHz capable */ -#define TSI148_PCFS_PCIXSTAT_64D (1<<16) /* 64 bit device */ +#define TSI148_PCFS_PCIXSTAT_DC BIT(20) /* Device Complexity */ +#define TSI148_PCFS_PCIXSTAT_USC BIT(19) /* Unexpected Split comp */ +#define TSI148_PCFS_PCIXSTAT_SCD BIT(18) /* Split completion discard */ +#define TSI148_PCFS_PCIXSTAT_133C BIT(17) /* 133MHz capable */ +#define TSI148_PCFS_PCIXSTAT_64D BIT(16) /* 64 bit device */ #define TSI148_PCFS_PCIXSTAT_BN_M (0xFF<<8) /* Bus number */ #define TSI148_PCFS_PCIXSTAT_DN_M (0x1F<<3) /* Device number */ #define TSI148_PCFS_PCIXSTAT_FN_M (7<<0) /* Function Number */ @@ -646,23 +646,23 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * Outbound Translation Attribute */ -#define TSI148_LCSR_OTAT_EN (1<<31) /* Window Enable */ -#define TSI148_LCSR_OTAT_MRPFD (1<<18) /* Prefetch Disable */ +#define TSI148_LCSR_OTAT_EN BIT(31) /* Window Enable */ +#define TSI148_LCSR_OTAT_MRPFD BIT(18) /* Prefetch Disable */ #define TSI148_LCSR_OTAT_PFS_M (3<<16) /* Prefetch Size Mask */ #define TSI148_LCSR_OTAT_PFS_2 (0<<16) /* 2 Cache Lines P Size */ -#define TSI148_LCSR_OTAT_PFS_4 (1<<16) /* 4 Cache Lines P Size */ +#define TSI148_LCSR_OTAT_PFS_4 BIT(16) /* 4 Cache Lines P Size */ #define TSI148_LCSR_OTAT_PFS_8 (2<<16) /* 8 Cache Lines P Size */ #define TSI148_LCSR_OTAT_PFS_16 (3<<16) /* 16 Cache Lines P Size */ #define TSI148_LCSR_OTAT_2eSSTM_M (7<<11) /* 2eSST Xfer Rate Mask */ #define TSI148_LCSR_OTAT_2eSSTM_160 (0<<11) /* 160MB/s 2eSST Xfer Rate */ -#define TSI148_LCSR_OTAT_2eSSTM_267 (1<<11) /* 267MB/s 2eSST Xfer Rate */ +#define TSI148_LCSR_OTAT_2eSSTM_267 BIT(11) /* 267MB/s 2eSST Xfer Rate */ #define TSI148_LCSR_OTAT_2eSSTM_320 (2<<11) /* 320MB/s 2eSST Xfer Rate */ #define TSI148_LCSR_OTAT_TM_M (7<<8) /* Xfer Protocol Mask */ #define TSI148_LCSR_OTAT_TM_SCT (0<<8) /* SCT Xfer Protocol */ -#define TSI148_LCSR_OTAT_TM_BLT (1<<8) /* BLT Xfer Protocol */ +#define TSI148_LCSR_OTAT_TM_BLT BIT(8) /* BLT Xfer Protocol */ #define TSI148_LCSR_OTAT_TM_MBLT (2<<8) /* MBLT Xfer Protocol */ #define TSI148_LCSR_OTAT_TM_2eVME (3<<8) /* 2eVME Xfer Protocol */ #define TSI148_LCSR_OTAT_TM_2eSST (4<<8) /* 2eSST Xfer Protocol */ @@ -670,14 +670,14 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_OTAT_DBW_M (3<<6) /* Max Data Width */ #define TSI148_LCSR_OTAT_DBW_16 (0<<6) /* 16-bit Data Width */ -#define TSI148_LCSR_OTAT_DBW_32 (1<<6) /* 32-bit Data Width */ +#define TSI148_LCSR_OTAT_DBW_32 BIT(6) /* 32-bit Data Width */ -#define TSI148_LCSR_OTAT_SUP (1<<5) /* Supervisory Access */ -#define TSI148_LCSR_OTAT_PGM (1<<4) /* Program Access */ +#define TSI148_LCSR_OTAT_SUP BIT(5) /* Supervisory Access */ +#define TSI148_LCSR_OTAT_PGM BIT(4) /* Program Access */ #define TSI148_LCSR_OTAT_AMODE_M (0xf<<0) /* Address Mode Mask */ #define TSI148_LCSR_OTAT_AMODE_A16 (0<<0) /* A16 Address Space */ -#define TSI148_LCSR_OTAT_AMODE_A24 (1<<0) /* A24 Address Space */ +#define TSI148_LCSR_OTAT_AMODE_A24 BIT(0) /* A24 Address Space */ #define TSI148_LCSR_OTAT_AMODE_A32 (2<<0) /* A32 Address Space */ #define TSI148_LCSR_OTAT_AMODE_A64 (4<<0) /* A32 Address Space */ #define TSI148_LCSR_OTAT_AMODE_CRCSR (5<<0) /* CR/CSR Address Space */ @@ -689,17 +689,17 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * VME Master Control Register CRG+$234 */ -#define TSI148_LCSR_VMCTRL_VSA (1<<27) /* VMEbus Stop Ack */ -#define TSI148_LCSR_VMCTRL_VS (1<<26) /* VMEbus Stop */ -#define TSI148_LCSR_VMCTRL_DHB (1<<25) /* Device Has Bus */ -#define TSI148_LCSR_VMCTRL_DWB (1<<24) /* Device Wants Bus */ +#define TSI148_LCSR_VMCTRL_VSA BIT(27) /* VMEbus Stop Ack */ +#define TSI148_LCSR_VMCTRL_VS BIT(26) /* VMEbus Stop */ +#define TSI148_LCSR_VMCTRL_DHB BIT(25) /* Device Has Bus */ +#define TSI148_LCSR_VMCTRL_DWB BIT(24) /* Device Wants Bus */ -#define TSI148_LCSR_VMCTRL_RMWEN (1<<20) /* RMW Enable */ +#define TSI148_LCSR_VMCTRL_RMWEN BIT(20) /* RMW Enable */ #define TSI148_LCSR_VMCTRL_ATO_M (7<<16) /* Master Access Time-out Mask */ #define TSI148_LCSR_VMCTRL_ATO_32 (0<<16) /* 32 us */ -#define TSI148_LCSR_VMCTRL_ATO_128 (1<<16) /* 128 us */ +#define TSI148_LCSR_VMCTRL_ATO_128 BIT(16) /* 128 us */ #define TSI148_LCSR_VMCTRL_ATO_512 (2<<16) /* 512 us */ #define TSI148_LCSR_VMCTRL_ATO_2M (3<<16) /* 2 ms */ #define TSI148_LCSR_VMCTRL_ATO_8M (4<<16) /* 8 ms */ @@ -709,7 +709,7 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_VMCTRL_VTOFF_M (7<<12) /* VMEbus Master Time off */ #define TSI148_LCSR_VMCTRL_VTOFF_0 (0<<12) /* 0us */ -#define TSI148_LCSR_VMCTRL_VTOFF_1 (1<<12) /* 1us */ +#define TSI148_LCSR_VMCTRL_VTOFF_1 BIT(12) /* 1us */ #define TSI148_LCSR_VMCTRL_VTOFF_2 (2<<12) /* 2us */ #define TSI148_LCSR_VMCTRL_VTOFF_4 (3<<12) /* 4us */ #define TSI148_LCSR_VMCTRL_VTOFF_8 (4<<12) /* 8us */ @@ -719,7 +719,7 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_VMCTRL_VTON_M (7<<8) /* VMEbus Master Time On */ #define TSI148_LCSR_VMCTRL_VTON_4 (0<<8) /* 8us */ -#define TSI148_LCSR_VMCTRL_VTON_8 (1<<8) /* 8us */ +#define TSI148_LCSR_VMCTRL_VTON_8 BIT(8) /* 8us */ #define TSI148_LCSR_VMCTRL_VTON_16 (2<<8) /* 16us */ #define TSI148_LCSR_VMCTRL_VTON_32 (3<<8) /* 32us */ #define TSI148_LCSR_VMCTRL_VTON_64 (4<<8) /* 64us */ @@ -730,22 +730,22 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_VMCTRL_VREL_M (3<<3) /* VMEbus Master Rel Mode Mask */ #define TSI148_LCSR_VMCTRL_VREL_T_D (0<<3) /* Time on or Done */ -#define TSI148_LCSR_VMCTRL_VREL_T_R_D (1<<3) /* Time on and REQ or Done */ +#define TSI148_LCSR_VMCTRL_VREL_T_R_D BIT(3) /* Time on and REQ or Done */ #define TSI148_LCSR_VMCTRL_VREL_T_B_D (2<<3) /* Time on and BCLR or Done */ #define TSI148_LCSR_VMCTRL_VREL_T_D_R (3<<3) /* Time on or Done and REQ */ -#define TSI148_LCSR_VMCTRL_VFAIR (1<<2) /* VMEbus Master Fair Mode */ +#define TSI148_LCSR_VMCTRL_VFAIR BIT(2) /* VMEbus Master Fair Mode */ #define TSI148_LCSR_VMCTRL_VREQL_M (3<<0) /* VMEbus Master Req Level Mask */ /* * VMEbus Control Register CRG+$238 */ -#define TSI148_LCSR_VCTRL_LRE (1<<31) /* Late Retry Enable */ +#define TSI148_LCSR_VCTRL_LRE BIT(31) /* Late Retry Enable */ #define TSI148_LCSR_VCTRL_DLT_M (0xF<<24) /* Deadlock Timer */ #define TSI148_LCSR_VCTRL_DLT_OFF (0<<24) /* Deadlock Timer Off */ -#define TSI148_LCSR_VCTRL_DLT_16 (1<<24) /* 16 VCLKS */ +#define TSI148_LCSR_VCTRL_DLT_16 BIT(24) /* 16 VCLKS */ #define TSI148_LCSR_VCTRL_DLT_32 (2<<24) /* 32 VCLKS */ #define TSI148_LCSR_VCTRL_DLT_64 (3<<24) /* 64 VCLKS */ #define TSI148_LCSR_VCTRL_DLT_128 (4<<24) /* 128 VCLKS */ @@ -758,22 +758,22 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_VCTRL_DLT_16384 (0xB<<24) /* 16384 VCLKS */ #define TSI148_LCSR_VCTRL_DLT_32768 (0xC<<24) /* 32768 VCLKS */ -#define TSI148_LCSR_VCTRL_NERBB (1<<20) /* No Early Release of Bus Busy +#define TSI148_LCSR_VCTRL_NERBB BIT(20) /* No Early Release of Bus Busy */ -#define TSI148_LCSR_VCTRL_SRESET (1<<17) /* System Reset */ -#define TSI148_LCSR_VCTRL_LRESET (1<<16) /* Local Reset */ +#define TSI148_LCSR_VCTRL_SRESET BIT(17) /* System Reset */ +#define TSI148_LCSR_VCTRL_LRESET BIT(16) /* Local Reset */ -#define TSI148_LCSR_VCTRL_SFAILAI (1<<15) /* SYSFAIL Auto Slot ID */ +#define TSI148_LCSR_VCTRL_SFAILAI BIT(15) /* SYSFAIL Auto Slot ID */ #define TSI148_LCSR_VCTRL_BID_M (0x1F<<8) /* Broadcast ID Mask */ -#define TSI148_LCSR_VCTRL_ATOEN (1<<7) /* Arbiter Time-out Enable */ -#define TSI148_LCSR_VCTRL_ROBIN (1<<6) /* VMEbus Round Robin */ +#define TSI148_LCSR_VCTRL_ATOEN BIT(7) /* Arbiter Time-out Enable */ +#define TSI148_LCSR_VCTRL_ROBIN BIT(6) /* VMEbus Round Robin */ #define TSI148_LCSR_VCTRL_GTO_M (7<<0) /* VMEbus Global Time-out Mask */ #define TSI148_LCSR_VCTRL_GTO_8 (0<<0) /* 8 us */ -#define TSI148_LCSR_VCTRL_GTO_16 (1<<0) /* 16 us */ +#define TSI148_LCSR_VCTRL_GTO_16 BIT(0) /* 16 us */ #define TSI148_LCSR_VCTRL_GTO_32 (2<<0) /* 32 us */ #define TSI148_LCSR_VCTRL_GTO_64 (3<<0) /* 64 us */ #define TSI148_LCSR_VCTRL_GTO_128 (4<<0) /* 128 us */ @@ -784,48 +784,48 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * VMEbus Status Register CRG + $23C */ -#define TSI148_LCSR_VSTAT_CPURST (1<<15) /* Clear power up reset */ -#define TSI148_LCSR_VSTAT_BRDFL (1<<14) /* Board fail */ -#define TSI148_LCSR_VSTAT_PURSTS (1<<12) /* Power up reset status */ -#define TSI148_LCSR_VSTAT_BDFAILS (1<<11) /* Board Fail Status */ -#define TSI148_LCSR_VSTAT_SYSFAILS (1<<10) /* System Fail Status */ -#define TSI148_LCSR_VSTAT_ACFAILS (1<<9) /* AC fail status */ -#define TSI148_LCSR_VSTAT_SCONS (1<<8) /* System Cont Status */ -#define TSI148_LCSR_VSTAT_GAP (1<<5) /* Geographic Addr Parity */ +#define TSI148_LCSR_VSTAT_CPURST BIT(15) /* Clear power up reset */ +#define TSI148_LCSR_VSTAT_BRDFL BIT(14) /* Board fail */ +#define TSI148_LCSR_VSTAT_PURSTS BIT(12) /* Power up reset status */ +#define TSI148_LCSR_VSTAT_BDFAILS BIT(11) /* Board Fail Status */ +#define TSI148_LCSR_VSTAT_SYSFAILS BIT(10) /* System Fail Status */ +#define TSI148_LCSR_VSTAT_ACFAILS BIT(9) /* AC fail status */ +#define TSI148_LCSR_VSTAT_SCONS BIT(8) /* System Cont Status */ +#define TSI148_LCSR_VSTAT_GAP BIT(5) /* Geographic Addr Parity */ #define TSI148_LCSR_VSTAT_GA_M (0x1F<<0) /* Geographic Addr Mask */ /* * PCI Configuration Status Register CRG+$240 */ -#define TSI148_LCSR_PSTAT_REQ64S (1<<6) /* Request 64 status set */ -#define TSI148_LCSR_PSTAT_M66ENS (1<<5) /* M66ENS 66Mhz enable */ -#define TSI148_LCSR_PSTAT_FRAMES (1<<4) /* Frame Status */ -#define TSI148_LCSR_PSTAT_IRDYS (1<<3) /* IRDY status */ -#define TSI148_LCSR_PSTAT_DEVSELS (1<<2) /* DEVL status */ -#define TSI148_LCSR_PSTAT_STOPS (1<<1) /* STOP status */ -#define TSI148_LCSR_PSTAT_TRDYS (1<<0) /* TRDY status */ +#define TSI148_LCSR_PSTAT_REQ64S BIT(6) /* Request 64 status set */ +#define TSI148_LCSR_PSTAT_M66ENS BIT(5) /* M66ENS 66Mhz enable */ +#define TSI148_LCSR_PSTAT_FRAMES BIT(4) /* Frame Status */ +#define TSI148_LCSR_PSTAT_IRDYS BIT(3) /* IRDY status */ +#define TSI148_LCSR_PSTAT_DEVSELS BIT(2) /* DEVL status */ +#define TSI148_LCSR_PSTAT_STOPS BIT(1) /* STOP status */ +#define TSI148_LCSR_PSTAT_TRDYS BIT(0) /* TRDY status */ /* * VMEbus Exception Attributes Register CRG + $268 */ -#define TSI148_LCSR_VEAT_VES (1<<31) /* Status */ -#define TSI148_LCSR_VEAT_VEOF (1<<30) /* Overflow */ -#define TSI148_LCSR_VEAT_VESCL (1<<29) /* Status Clear */ -#define TSI148_LCSR_VEAT_2EOT (1<<21) /* 2e Odd Termination */ -#define TSI148_LCSR_VEAT_2EST (1<<20) /* 2e Slave terminated */ -#define TSI148_LCSR_VEAT_BERR (1<<19) /* Bus Error */ -#define TSI148_LCSR_VEAT_LWORD (1<<18) /* LWORD_ signal state */ -#define TSI148_LCSR_VEAT_WRITE (1<<17) /* WRITE_ signal state */ -#define TSI148_LCSR_VEAT_IACK (1<<16) /* IACK_ signal state */ -#define TSI148_LCSR_VEAT_DS1 (1<<15) /* DS1_ signal state */ -#define TSI148_LCSR_VEAT_DS0 (1<<14) /* DS0_ signal state */ +#define TSI148_LCSR_VEAT_VES BIT(31) /* Status */ +#define TSI148_LCSR_VEAT_VEOF BIT(30) /* Overflow */ +#define TSI148_LCSR_VEAT_VESCL BIT(29) /* Status Clear */ +#define TSI148_LCSR_VEAT_2EOT BIT(21) /* 2e Odd Termination */ +#define TSI148_LCSR_VEAT_2EST BIT(20) /* 2e Slave terminated */ +#define TSI148_LCSR_VEAT_BERR BIT(19) /* Bus Error */ +#define TSI148_LCSR_VEAT_LWORD BIT(18) /* LWORD_ signal state */ +#define TSI148_LCSR_VEAT_WRITE BIT(17) /* WRITE_ signal state */ +#define TSI148_LCSR_VEAT_IACK BIT(16) /* IACK_ signal state */ +#define TSI148_LCSR_VEAT_DS1 BIT(15) /* DS1_ signal state */ +#define TSI148_LCSR_VEAT_DS0 BIT(14) /* DS0_ signal state */ #define TSI148_LCSR_VEAT_AM_M (0x3F<<8) /* Address Mode Mask */ #define TSI148_LCSR_VEAT_XAM_M (0xFF<<0) /* Master AMode Mask */ /* * VMEbus PCI Error Diagnostics PCI/X Attributes Register CRG + $280 */ -#define TSI148_LCSR_EDPAT_EDPCL (1<<29) +#define TSI148_LCSR_EDPAT_EDPCL BIT(29) /* * Inbound Translation Starting Address Lower @@ -851,36 +851,36 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * Inbound Translation Attribute */ -#define TSI148_LCSR_ITAT_EN (1<<31) /* Window Enable */ -#define TSI148_LCSR_ITAT_TH (1<<18) /* Prefetch Threshold */ +#define TSI148_LCSR_ITAT_EN BIT(31) /* Window Enable */ +#define TSI148_LCSR_ITAT_TH BIT(18) /* Prefetch Threshold */ #define TSI148_LCSR_ITAT_VFS_M (3<<16) /* Virtual FIFO Size Mask */ #define TSI148_LCSR_ITAT_VFS_64 (0<<16) /* 64 bytes Virtual FIFO Size */ -#define TSI148_LCSR_ITAT_VFS_128 (1<<16) /* 128 bytes Virtual FIFO Sz */ +#define TSI148_LCSR_ITAT_VFS_128 BIT(16) /* 128 bytes Virtual FIFO Sz */ #define TSI148_LCSR_ITAT_VFS_256 (2<<16) /* 256 bytes Virtual FIFO Sz */ #define TSI148_LCSR_ITAT_VFS_512 (3<<16) /* 512 bytes Virtual FIFO Sz */ #define TSI148_LCSR_ITAT_2eSSTM_M (7<<12) /* 2eSST Xfer Rate Mask */ #define TSI148_LCSR_ITAT_2eSSTM_160 (0<<12) /* 160MB/s 2eSST Xfer Rate */ -#define TSI148_LCSR_ITAT_2eSSTM_267 (1<<12) /* 267MB/s 2eSST Xfer Rate */ +#define TSI148_LCSR_ITAT_2eSSTM_267 BIT(12) /* 267MB/s 2eSST Xfer Rate */ #define TSI148_LCSR_ITAT_2eSSTM_320 (2<<12) /* 320MB/s 2eSST Xfer Rate */ -#define TSI148_LCSR_ITAT_2eSSTB (1<<11) /* 2eSST Bcast Xfer Protocol */ -#define TSI148_LCSR_ITAT_2eSST (1<<10) /* 2eSST Xfer Protocol */ -#define TSI148_LCSR_ITAT_2eVME (1<<9) /* 2eVME Xfer Protocol */ -#define TSI148_LCSR_ITAT_MBLT (1<<8) /* MBLT Xfer Protocol */ -#define TSI148_LCSR_ITAT_BLT (1<<7) /* BLT Xfer Protocol */ +#define TSI148_LCSR_ITAT_2eSSTB BIT(11) /* 2eSST Bcast Xfer Protocol */ +#define TSI148_LCSR_ITAT_2eSST BIT(10) /* 2eSST Xfer Protocol */ +#define TSI148_LCSR_ITAT_2eVME BIT(9) /* 2eVME Xfer Protocol */ +#define TSI148_LCSR_ITAT_MBLT BIT(8) /* MBLT Xfer Protocol */ +#define TSI148_LCSR_ITAT_BLT BIT(7) /* BLT Xfer Protocol */ #define TSI148_LCSR_ITAT_AS_M (7<<4) /* Address Space Mask */ #define TSI148_LCSR_ITAT_AS_A16 (0<<4) /* A16 Address Space */ -#define TSI148_LCSR_ITAT_AS_A24 (1<<4) /* A24 Address Space */ +#define TSI148_LCSR_ITAT_AS_A24 BIT(4) /* A24 Address Space */ #define TSI148_LCSR_ITAT_AS_A32 (2<<4) /* A32 Address Space */ #define TSI148_LCSR_ITAT_AS_A64 (4<<4) /* A64 Address Space */ -#define TSI148_LCSR_ITAT_SUPR (1<<3) /* Supervisor Access */ -#define TSI148_LCSR_ITAT_NPRIV (1<<2) /* Non-Priv (User) Access */ -#define TSI148_LCSR_ITAT_PGM (1<<1) /* Program Access */ -#define TSI148_LCSR_ITAT_DATA (1<<0) /* Data Access */ +#define TSI148_LCSR_ITAT_SUPR BIT(3) /* Supervisor Access */ +#define TSI148_LCSR_ITAT_NPRIV BIT(2) /* Non-Priv (User) Access */ +#define TSI148_LCSR_ITAT_PGM BIT(1) /* Program Access */ +#define TSI148_LCSR_ITAT_DATA BIT(0) /* Data Access */ /* * GCSR Base Address Lower Address CRG +$404 @@ -890,18 +890,18 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * GCSR Attribute Register CRG + $408 */ -#define TSI148_LCSR_GCSRAT_EN (1<<7) /* Enable access to GCSR */ +#define TSI148_LCSR_GCSRAT_EN BIT(7) /* Enable access to GCSR */ #define TSI148_LCSR_GCSRAT_AS_M (7<<4) /* Address Space Mask */ #define TSI148_LCSR_GCSRAT_AS_A16 (0<<4) /* Address Space 16 */ -#define TSI148_LCSR_GCSRAT_AS_A24 (1<<4) /* Address Space 24 */ +#define TSI148_LCSR_GCSRAT_AS_A24 BIT(4) /* Address Space 24 */ #define TSI148_LCSR_GCSRAT_AS_A32 (2<<4) /* Address Space 32 */ #define TSI148_LCSR_GCSRAT_AS_A64 (4<<4) /* Address Space 64 */ -#define TSI148_LCSR_GCSRAT_SUPR (1<<3) /* Sup set -GCSR decoder */ -#define TSI148_LCSR_GCSRAT_NPRIV (1<<2) /* Non-Privliged set - CGSR */ -#define TSI148_LCSR_GCSRAT_PGM (1<<1) /* Program set - GCSR decoder */ -#define TSI148_LCSR_GCSRAT_DATA (1<<0) /* DATA set GCSR decoder */ +#define TSI148_LCSR_GCSRAT_SUPR BIT(3) /* Sup set -GCSR decoder */ +#define TSI148_LCSR_GCSRAT_NPRIV BIT(2) /* Non-Privliged set - CGSR */ +#define TSI148_LCSR_GCSRAT_PGM BIT(1) /* Program set - GCSR decoder */ +#define TSI148_LCSR_GCSRAT_DATA BIT(0) /* DATA set GCSR decoder */ /* * CRG Base Address Lower Address CRG + $410 @@ -911,18 +911,18 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * CRG Attribute Register CRG + $414 */ -#define TSI148_LCSR_CRGAT_EN (1<<7) /* Enable PRG Access */ +#define TSI148_LCSR_CRGAT_EN BIT(7) /* Enable PRG Access */ #define TSI148_LCSR_CRGAT_AS_M (7<<4) /* Address Space */ #define TSI148_LCSR_CRGAT_AS_A16 (0<<4) /* Address Space 16 */ -#define TSI148_LCSR_CRGAT_AS_A24 (1<<4) /* Address Space 24 */ +#define TSI148_LCSR_CRGAT_AS_A24 BIT(4) /* Address Space 24 */ #define TSI148_LCSR_CRGAT_AS_A32 (2<<4) /* Address Space 32 */ #define TSI148_LCSR_CRGAT_AS_A64 (4<<4) /* Address Space 64 */ -#define TSI148_LCSR_CRGAT_SUPR (1<<3) /* Supervisor Access */ -#define TSI148_LCSR_CRGAT_NPRIV (1<<2) /* Non-Privliged(User) Access */ -#define TSI148_LCSR_CRGAT_PGM (1<<1) /* Program Access */ -#define TSI148_LCSR_CRGAT_DATA (1<<0) /* Data Access */ +#define TSI148_LCSR_CRGAT_SUPR BIT(3) /* Supervisor Access */ +#define TSI148_LCSR_CRGAT_NPRIV BIT(2) /* Non-Privliged(User) Access */ +#define TSI148_LCSR_CRGAT_PGM BIT(1) /* Program Access */ +#define TSI148_LCSR_CRGAT_DATA BIT(0) /* Data Access */ /* * CR/CSR Offset Lower Register CRG + $41C @@ -932,7 +932,7 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * CR/CSR Attribute register CRG + $420 */ -#define TSI148_LCSR_CRAT_EN (1<<7) /* Enable access to CR/CSR */ +#define TSI148_LCSR_CRAT_EN BIT(7) /* Enable access to CR/CSR */ /* * Location Monitor base address lower register CRG + $428 @@ -942,18 +942,18 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, /* * Location Monitor Attribute Register CRG + $42C */ -#define TSI148_LCSR_LMAT_EN (1<<7) /* Enable Location Monitor */ +#define TSI148_LCSR_LMAT_EN BIT(7) /* Enable Location Monitor */ #define TSI148_LCSR_LMAT_AS_M (7<<4) /* Address Space MASK */ #define TSI148_LCSR_LMAT_AS_A16 (0<<4) /* A16 */ -#define TSI148_LCSR_LMAT_AS_A24 (1<<4) /* A24 */ +#define TSI148_LCSR_LMAT_AS_A24 BIT(4) /* A24 */ #define TSI148_LCSR_LMAT_AS_A32 (2<<4) /* A32 */ #define TSI148_LCSR_LMAT_AS_A64 (4<<4) /* A64 */ -#define TSI148_LCSR_LMAT_SUPR (1<<3) /* Supervisor Access */ -#define TSI148_LCSR_LMAT_NPRIV (1<<2) /* Non-Priv (User) Access */ -#define TSI148_LCSR_LMAT_PGM (1<<1) /* Program Access */ -#define TSI148_LCSR_LMAT_DATA (1<<0) /* Data Access */ +#define TSI148_LCSR_LMAT_SUPR BIT(3) /* Supervisor Access */ +#define TSI148_LCSR_LMAT_NPRIV BIT(2) /* Non-Priv (User) Access */ +#define TSI148_LCSR_LMAT_PGM BIT(1) /* Program Access */ +#define TSI148_LCSR_LMAT_DATA BIT(0) /* Data Access */ /* * Broadcast Pulse Generator Timer Register CRG + $438 @@ -969,34 +969,34 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, * VMEbus Interrupt Control Register CRG + $43C */ #define TSI148_LCSR_VICR_CNTS_M (3<<22) /* Cntr Source MASK */ -#define TSI148_LCSR_VICR_CNTS_DIS (1<<22) /* Cntr Disable */ +#define TSI148_LCSR_VICR_CNTS_DIS BIT(22) /* Cntr Disable */ #define TSI148_LCSR_VICR_CNTS_IRQ1 (2<<22) /* IRQ1 to Cntr */ #define TSI148_LCSR_VICR_CNTS_IRQ2 (3<<22) /* IRQ2 to Cntr */ #define TSI148_LCSR_VICR_EDGIS_M (3<<20) /* Edge interrupt MASK */ -#define TSI148_LCSR_VICR_EDGIS_DIS (1<<20) /* Edge interrupt Disable */ +#define TSI148_LCSR_VICR_EDGIS_DIS BIT(20) /* Edge interrupt Disable */ #define TSI148_LCSR_VICR_EDGIS_IRQ1 (2<<20) /* IRQ1 to Edge */ #define TSI148_LCSR_VICR_EDGIS_IRQ2 (3<<20) /* IRQ2 to Edge */ #define TSI148_LCSR_VICR_IRQIF_M (3<<18) /* IRQ1* Function MASK */ -#define TSI148_LCSR_VICR_IRQIF_NORM (1<<18) /* Normal */ +#define TSI148_LCSR_VICR_IRQIF_NORM BIT(18) /* Normal */ #define TSI148_LCSR_VICR_IRQIF_PULSE (2<<18) /* Pulse Generator */ #define TSI148_LCSR_VICR_IRQIF_PROG (3<<18) /* Programmable Clock */ #define TSI148_LCSR_VICR_IRQIF_1U (4<<18) /* 1us Clock */ #define TSI148_LCSR_VICR_IRQ2F_M (3<<16) /* IRQ2* Function MASK */ -#define TSI148_LCSR_VICR_IRQ2F_NORM (1<<16) /* Normal */ +#define TSI148_LCSR_VICR_IRQ2F_NORM BIT(16) /* Normal */ #define TSI148_LCSR_VICR_IRQ2F_PULSE (2<<16) /* Pulse Generator */ #define TSI148_LCSR_VICR_IRQ2F_PROG (3<<16) /* Programmable Clock */ #define TSI148_LCSR_VICR_IRQ2F_1U (4<<16) /* 1us Clock */ -#define TSI148_LCSR_VICR_BIP (1<<15) /* Broadcast Interrupt Pulse */ +#define TSI148_LCSR_VICR_BIP BIT(15) /* Broadcast Interrupt Pulse */ -#define TSI148_LCSR_VICR_IRQC (1<<12) /* VMEbus IRQ Clear */ -#define TSI148_LCSR_VICR_IRQS (1<<11) /* VMEbus IRQ Status */ +#define TSI148_LCSR_VICR_IRQC BIT(12) /* VMEbus IRQ Clear */ +#define TSI148_LCSR_VICR_IRQS BIT(11) /* VMEbus IRQ Status */ #define TSI148_LCSR_VICR_IRQL_M (7<<8) /* VMEbus SW IRQ Level Mask */ -#define TSI148_LCSR_VICR_IRQL_1 (1<<8) /* VMEbus SW IRQ Level 1 */ +#define TSI148_LCSR_VICR_IRQL_1 BIT(8) /* VMEbus SW IRQ Level 1 */ #define TSI148_LCSR_VICR_IRQL_2 (2<<8) /* VMEbus SW IRQ Level 2 */ #define TSI148_LCSR_VICR_IRQL_3 (3<<8) /* VMEbus SW IRQ Level 3 */ #define TSI148_LCSR_VICR_IRQL_4 (4<<8) /* VMEbus SW IRQ Level 4 */ @@ -1014,29 +1014,29 @@ static const int TSI148_LCSR_VICR_IRQL[8] = { 0, TSI148_LCSR_VICR_IRQL_1, /* * Interrupt Enable Register CRG + $440 */ -#define TSI148_LCSR_INTEN_DMA1EN (1<<25) /* DMAC 1 */ -#define TSI148_LCSR_INTEN_DMA0EN (1<<24) /* DMAC 0 */ -#define TSI148_LCSR_INTEN_LM3EN (1<<23) /* Location Monitor 3 */ -#define TSI148_LCSR_INTEN_LM2EN (1<<22) /* Location Monitor 2 */ -#define TSI148_LCSR_INTEN_LM1EN (1<<21) /* Location Monitor 1 */ -#define TSI148_LCSR_INTEN_LM0EN (1<<20) /* Location Monitor 0 */ -#define TSI148_LCSR_INTEN_MB3EN (1<<19) /* Mail Box 3 */ -#define TSI148_LCSR_INTEN_MB2EN (1<<18) /* Mail Box 2 */ -#define TSI148_LCSR_INTEN_MB1EN (1<<17) /* Mail Box 1 */ -#define TSI148_LCSR_INTEN_MB0EN (1<<16) /* Mail Box 0 */ -#define TSI148_LCSR_INTEN_PERREN (1<<13) /* PCI/X Error */ -#define TSI148_LCSR_INTEN_VERREN (1<<12) /* VMEbus Error */ -#define TSI148_LCSR_INTEN_VIEEN (1<<11) /* VMEbus IRQ Edge */ -#define TSI148_LCSR_INTEN_IACKEN (1<<10) /* IACK */ -#define TSI148_LCSR_INTEN_SYSFLEN (1<<9) /* System Fail */ -#define TSI148_LCSR_INTEN_ACFLEN (1<<8) /* AC Fail */ -#define TSI148_LCSR_INTEN_IRQ7EN (1<<7) /* IRQ7 */ -#define TSI148_LCSR_INTEN_IRQ6EN (1<<6) /* IRQ6 */ -#define TSI148_LCSR_INTEN_IRQ5EN (1<<5) /* IRQ5 */ -#define TSI148_LCSR_INTEN_IRQ4EN (1<<4) /* IRQ4 */ -#define TSI148_LCSR_INTEN_IRQ3EN (1<<3) /* IRQ3 */ -#define TSI148_LCSR_INTEN_IRQ2EN (1<<2) /* IRQ2 */ -#define TSI148_LCSR_INTEN_IRQ1EN (1<<1) /* IRQ1 */ +#define TSI148_LCSR_INTEN_DMA1EN BIT(25) /* DMAC 1 */ +#define TSI148_LCSR_INTEN_DMA0EN BIT(24) /* DMAC 0 */ +#define TSI148_LCSR_INTEN_LM3EN BIT(23) /* Location Monitor 3 */ +#define TSI148_LCSR_INTEN_LM2EN BIT(22) /* Location Monitor 2 */ +#define TSI148_LCSR_INTEN_LM1EN BIT(21) /* Location Monitor 1 */ +#define TSI148_LCSR_INTEN_LM0EN BIT(20) /* Location Monitor 0 */ +#define TSI148_LCSR_INTEN_MB3EN BIT(19) /* Mail Box 3 */ +#define TSI148_LCSR_INTEN_MB2EN BIT(18) /* Mail Box 2 */ +#define TSI148_LCSR_INTEN_MB1EN BIT(17) /* Mail Box 1 */ +#define TSI148_LCSR_INTEN_MB0EN BIT(16) /* Mail Box 0 */ +#define TSI148_LCSR_INTEN_PERREN BIT(13) /* PCI/X Error */ +#define TSI148_LCSR_INTEN_VERREN BIT(12) /* VMEbus Error */ +#define TSI148_LCSR_INTEN_VIEEN BIT(11) /* VMEbus IRQ Edge */ +#define TSI148_LCSR_INTEN_IACKEN BIT(10) /* IACK */ +#define TSI148_LCSR_INTEN_SYSFLEN BIT(9) /* System Fail */ +#define TSI148_LCSR_INTEN_ACFLEN BIT(8) /* AC Fail */ +#define TSI148_LCSR_INTEN_IRQ7EN BIT(7) /* IRQ7 */ +#define TSI148_LCSR_INTEN_IRQ6EN BIT(6) /* IRQ6 */ +#define TSI148_LCSR_INTEN_IRQ5EN BIT(5) /* IRQ5 */ +#define TSI148_LCSR_INTEN_IRQ4EN BIT(4) /* IRQ4 */ +#define TSI148_LCSR_INTEN_IRQ3EN BIT(3) /* IRQ3 */ +#define TSI148_LCSR_INTEN_IRQ2EN BIT(2) /* IRQ2 */ +#define TSI148_LCSR_INTEN_IRQ1EN BIT(1) /* IRQ1 */ static const int TSI148_LCSR_INTEN_LMEN[4] = { TSI148_LCSR_INTEN_LM0EN, TSI148_LCSR_INTEN_LM1EN, @@ -1054,29 +1054,29 @@ static const int TSI148_LCSR_INTEN_IRQEN[7] = { TSI148_LCSR_INTEN_IRQ1EN, /* * Interrupt Enable Out Register CRG + $444 */ -#define TSI148_LCSR_INTEO_DMA1EO (1<<25) /* DMAC 1 */ -#define TSI148_LCSR_INTEO_DMA0EO (1<<24) /* DMAC 0 */ -#define TSI148_LCSR_INTEO_LM3EO (1<<23) /* Loc Monitor 3 */ -#define TSI148_LCSR_INTEO_LM2EO (1<<22) /* Loc Monitor 2 */ -#define TSI148_LCSR_INTEO_LM1EO (1<<21) /* Loc Monitor 1 */ -#define TSI148_LCSR_INTEO_LM0EO (1<<20) /* Location Monitor 0 */ -#define TSI148_LCSR_INTEO_MB3EO (1<<19) /* Mail Box 3 */ -#define TSI148_LCSR_INTEO_MB2EO (1<<18) /* Mail Box 2 */ -#define TSI148_LCSR_INTEO_MB1EO (1<<17) /* Mail Box 1 */ -#define TSI148_LCSR_INTEO_MB0EO (1<<16) /* Mail Box 0 */ -#define TSI148_LCSR_INTEO_PERREO (1<<13) /* PCI/X Error */ -#define TSI148_LCSR_INTEO_VERREO (1<<12) /* VMEbus Error */ -#define TSI148_LCSR_INTEO_VIEEO (1<<11) /* VMEbus IRQ Edge */ -#define TSI148_LCSR_INTEO_IACKEO (1<<10) /* IACK */ -#define TSI148_LCSR_INTEO_SYSFLEO (1<<9) /* System Fail */ -#define TSI148_LCSR_INTEO_ACFLEO (1<<8) /* AC Fail */ -#define TSI148_LCSR_INTEO_IRQ7EO (1<<7) /* IRQ7 */ -#define TSI148_LCSR_INTEO_IRQ6EO (1<<6) /* IRQ6 */ -#define TSI148_LCSR_INTEO_IRQ5EO (1<<5) /* IRQ5 */ -#define TSI148_LCSR_INTEO_IRQ4EO (1<<4) /* IRQ4 */ -#define TSI148_LCSR_INTEO_IRQ3EO (1<<3) /* IRQ3 */ -#define TSI148_LCSR_INTEO_IRQ2EO (1<<2) /* IRQ2 */ -#define TSI148_LCSR_INTEO_IRQ1EO (1<<1) /* IRQ1 */ +#define TSI148_LCSR_INTEO_DMA1EO BIT(25) /* DMAC 1 */ +#define TSI148_LCSR_INTEO_DMA0EO BIT(24) /* DMAC 0 */ +#define TSI148_LCSR_INTEO_LM3EO BIT(23) /* Loc Monitor 3 */ +#define TSI148_LCSR_INTEO_LM2EO BIT(22) /* Loc Monitor 2 */ +#define TSI148_LCSR_INTEO_LM1EO BIT(21) /* Loc Monitor 1 */ +#define TSI148_LCSR_INTEO_LM0EO BIT(20) /* Location Monitor 0 */ +#define TSI148_LCSR_INTEO_MB3EO BIT(19) /* Mail Box 3 */ +#define TSI148_LCSR_INTEO_MB2EO BIT(18) /* Mail Box 2 */ +#define TSI148_LCSR_INTEO_MB1EO BIT(17) /* Mail Box 1 */ +#define TSI148_LCSR_INTEO_MB0EO BIT(16) /* Mail Box 0 */ +#define TSI148_LCSR_INTEO_PERREO BIT(13) /* PCI/X Error */ +#define TSI148_LCSR_INTEO_VERREO BIT(12) /* VMEbus Error */ +#define TSI148_LCSR_INTEO_VIEEO BIT(11) /* VMEbus IRQ Edge */ +#define TSI148_LCSR_INTEO_IACKEO BIT(10) /* IACK */ +#define TSI148_LCSR_INTEO_SYSFLEO BIT(9) /* System Fail */ +#define TSI148_LCSR_INTEO_ACFLEO BIT(8) /* AC Fail */ +#define TSI148_LCSR_INTEO_IRQ7EO BIT(7) /* IRQ7 */ +#define TSI148_LCSR_INTEO_IRQ6EO BIT(6) /* IRQ6 */ +#define TSI148_LCSR_INTEO_IRQ5EO BIT(5) /* IRQ5 */ +#define TSI148_LCSR_INTEO_IRQ4EO BIT(4) /* IRQ4 */ +#define TSI148_LCSR_INTEO_IRQ3EO BIT(3) /* IRQ3 */ +#define TSI148_LCSR_INTEO_IRQ2EO BIT(2) /* IRQ2 */ +#define TSI148_LCSR_INTEO_IRQ1EO BIT(1) /* IRQ1 */ static const int TSI148_LCSR_INTEO_LMEO[4] = { TSI148_LCSR_INTEO_LM0EO, TSI148_LCSR_INTEO_LM1EO, @@ -1094,29 +1094,29 @@ static const int TSI148_LCSR_INTEO_IRQEO[7] = { TSI148_LCSR_INTEO_IRQ1EO, /* * Interrupt Status Register CRG + $448 */ -#define TSI148_LCSR_INTS_DMA1S (1<<25) /* DMA 1 */ -#define TSI148_LCSR_INTS_DMA0S (1<<24) /* DMA 0 */ -#define TSI148_LCSR_INTS_LM3S (1<<23) /* Location Monitor 3 */ -#define TSI148_LCSR_INTS_LM2S (1<<22) /* Location Monitor 2 */ -#define TSI148_LCSR_INTS_LM1S (1<<21) /* Location Monitor 1 */ -#define TSI148_LCSR_INTS_LM0S (1<<20) /* Location Monitor 0 */ -#define TSI148_LCSR_INTS_MB3S (1<<19) /* Mail Box 3 */ -#define TSI148_LCSR_INTS_MB2S (1<<18) /* Mail Box 2 */ -#define TSI148_LCSR_INTS_MB1S (1<<17) /* Mail Box 1 */ -#define TSI148_LCSR_INTS_MB0S (1<<16) /* Mail Box 0 */ -#define TSI148_LCSR_INTS_PERRS (1<<13) /* PCI/X Error */ -#define TSI148_LCSR_INTS_VERRS (1<<12) /* VMEbus Error */ -#define TSI148_LCSR_INTS_VIES (1<<11) /* VMEbus IRQ Edge */ -#define TSI148_LCSR_INTS_IACKS (1<<10) /* IACK */ -#define TSI148_LCSR_INTS_SYSFLS (1<<9) /* System Fail */ -#define TSI148_LCSR_INTS_ACFLS (1<<8) /* AC Fail */ -#define TSI148_LCSR_INTS_IRQ7S (1<<7) /* IRQ7 */ -#define TSI148_LCSR_INTS_IRQ6S (1<<6) /* IRQ6 */ -#define TSI148_LCSR_INTS_IRQ5S (1<<5) /* IRQ5 */ -#define TSI148_LCSR_INTS_IRQ4S (1<<4) /* IRQ4 */ -#define TSI148_LCSR_INTS_IRQ3S (1<<3) /* IRQ3 */ -#define TSI148_LCSR_INTS_IRQ2S (1<<2) /* IRQ2 */ -#define TSI148_LCSR_INTS_IRQ1S (1<<1) /* IRQ1 */ +#define TSI148_LCSR_INTS_DMA1S BIT(25) /* DMA 1 */ +#define TSI148_LCSR_INTS_DMA0S BIT(24) /* DMA 0 */ +#define TSI148_LCSR_INTS_LM3S BIT(23) /* Location Monitor 3 */ +#define TSI148_LCSR_INTS_LM2S BIT(22) /* Location Monitor 2 */ +#define TSI148_LCSR_INTS_LM1S BIT(21) /* Location Monitor 1 */ +#define TSI148_LCSR_INTS_LM0S BIT(20) /* Location Monitor 0 */ +#define TSI148_LCSR_INTS_MB3S BIT(19) /* Mail Box 3 */ +#define TSI148_LCSR_INTS_MB2S BIT(18) /* Mail Box 2 */ +#define TSI148_LCSR_INTS_MB1S BIT(17) /* Mail Box 1 */ +#define TSI148_LCSR_INTS_MB0S BIT(16) /* Mail Box 0 */ +#define TSI148_LCSR_INTS_PERRS BIT(13) /* PCI/X Error */ +#define TSI148_LCSR_INTS_VERRS BIT(12) /* VMEbus Error */ +#define TSI148_LCSR_INTS_VIES BIT(11) /* VMEbus IRQ Edge */ +#define TSI148_LCSR_INTS_IACKS BIT(10) /* IACK */ +#define TSI148_LCSR_INTS_SYSFLS BIT(9) /* System Fail */ +#define TSI148_LCSR_INTS_ACFLS BIT(8) /* AC Fail */ +#define TSI148_LCSR_INTS_IRQ7S BIT(7) /* IRQ7 */ +#define TSI148_LCSR_INTS_IRQ6S BIT(6) /* IRQ6 */ +#define TSI148_LCSR_INTS_IRQ5S BIT(5) /* IRQ5 */ +#define TSI148_LCSR_INTS_IRQ4S BIT(4) /* IRQ4 */ +#define TSI148_LCSR_INTS_IRQ3S BIT(3) /* IRQ3 */ +#define TSI148_LCSR_INTS_IRQ2S BIT(2) /* IRQ2 */ +#define TSI148_LCSR_INTS_IRQ1S BIT(1) /* IRQ1 */ static const int TSI148_LCSR_INTS_LMS[4] = { TSI148_LCSR_INTS_LM0S, TSI148_LCSR_INTS_LM1S, @@ -1131,22 +1131,22 @@ static const int TSI148_LCSR_INTS_MBS[4] = { TSI148_LCSR_INTS_MB0S, /* * Interrupt Clear Register CRG + $44C */ -#define TSI148_LCSR_INTC_DMA1C (1<<25) /* DMA 1 */ -#define TSI148_LCSR_INTC_DMA0C (1<<24) /* DMA 0 */ -#define TSI148_LCSR_INTC_LM3C (1<<23) /* Location Monitor 3 */ -#define TSI148_LCSR_INTC_LM2C (1<<22) /* Location Monitor 2 */ -#define TSI148_LCSR_INTC_LM1C (1<<21) /* Location Monitor 1 */ -#define TSI148_LCSR_INTC_LM0C (1<<20) /* Location Monitor 0 */ -#define TSI148_LCSR_INTC_MB3C (1<<19) /* Mail Box 3 */ -#define TSI148_LCSR_INTC_MB2C (1<<18) /* Mail Box 2 */ -#define TSI148_LCSR_INTC_MB1C (1<<17) /* Mail Box 1 */ -#define TSI148_LCSR_INTC_MB0C (1<<16) /* Mail Box 0 */ -#define TSI148_LCSR_INTC_PERRC (1<<13) /* VMEbus Error */ -#define TSI148_LCSR_INTC_VERRC (1<<12) /* VMEbus Access Time-out */ -#define TSI148_LCSR_INTC_VIEC (1<<11) /* VMEbus IRQ Edge */ -#define TSI148_LCSR_INTC_IACKC (1<<10) /* IACK */ -#define TSI148_LCSR_INTC_SYSFLC (1<<9) /* System Fail */ -#define TSI148_LCSR_INTC_ACFLC (1<<8) /* AC Fail */ +#define TSI148_LCSR_INTC_DMA1C BIT(25) /* DMA 1 */ +#define TSI148_LCSR_INTC_DMA0C BIT(24) /* DMA 0 */ +#define TSI148_LCSR_INTC_LM3C BIT(23) /* Location Monitor 3 */ +#define TSI148_LCSR_INTC_LM2C BIT(22) /* Location Monitor 2 */ +#define TSI148_LCSR_INTC_LM1C BIT(21) /* Location Monitor 1 */ +#define TSI148_LCSR_INTC_LM0C BIT(20) /* Location Monitor 0 */ +#define TSI148_LCSR_INTC_MB3C BIT(19) /* Mail Box 3 */ +#define TSI148_LCSR_INTC_MB2C BIT(18) /* Mail Box 2 */ +#define TSI148_LCSR_INTC_MB1C BIT(17) /* Mail Box 1 */ +#define TSI148_LCSR_INTC_MB0C BIT(16) /* Mail Box 0 */ +#define TSI148_LCSR_INTC_PERRC BIT(13) /* VMEbus Error */ +#define TSI148_LCSR_INTC_VERRC BIT(12) /* VMEbus Access Time-out */ +#define TSI148_LCSR_INTC_VIEC BIT(11) /* VMEbus IRQ Edge */ +#define TSI148_LCSR_INTC_IACKC BIT(10) /* IACK */ +#define TSI148_LCSR_INTC_SYSFLC BIT(9) /* System Fail */ +#define TSI148_LCSR_INTC_ACFLC BIT(8) /* AC Fail */ static const int TSI148_LCSR_INTC_LMC[4] = { TSI148_LCSR_INTC_LM0C, TSI148_LCSR_INTC_LM1C, @@ -1192,15 +1192,15 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, /* * DMA Control (0-1) Registers CRG + $500 */ -#define TSI148_LCSR_DCTL_ABT (1<<27) /* Abort */ -#define TSI148_LCSR_DCTL_PAU (1<<26) /* Pause */ -#define TSI148_LCSR_DCTL_DGO (1<<25) /* DMA Go */ +#define TSI148_LCSR_DCTL_ABT BIT(27) /* Abort */ +#define TSI148_LCSR_DCTL_PAU BIT(26) /* Pause */ +#define TSI148_LCSR_DCTL_DGO BIT(25) /* DMA Go */ -#define TSI148_LCSR_DCTL_MOD (1<<23) /* Mode */ +#define TSI148_LCSR_DCTL_MOD BIT(23) /* Mode */ #define TSI148_LCSR_DCTL_VBKS_M (7<<12) /* VMEbus block Size MASK */ #define TSI148_LCSR_DCTL_VBKS_32 (0<<12) /* VMEbus block Size 32 */ -#define TSI148_LCSR_DCTL_VBKS_64 (1<<12) /* VMEbus block Size 64 */ +#define TSI148_LCSR_DCTL_VBKS_64 BIT(12) /* VMEbus block Size 64 */ #define TSI148_LCSR_DCTL_VBKS_128 (2<<12) /* VMEbus block Size 128 */ #define TSI148_LCSR_DCTL_VBKS_256 (3<<12) /* VMEbus block Size 256 */ #define TSI148_LCSR_DCTL_VBKS_512 (4<<12) /* VMEbus block Size 512 */ @@ -1210,7 +1210,7 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, #define TSI148_LCSR_DCTL_VBOT_M (7<<8) /* VMEbus back-off MASK */ #define TSI148_LCSR_DCTL_VBOT_0 (0<<8) /* VMEbus back-off 0us */ -#define TSI148_LCSR_DCTL_VBOT_1 (1<<8) /* VMEbus back-off 1us */ +#define TSI148_LCSR_DCTL_VBOT_1 BIT(8) /* VMEbus back-off 1us */ #define TSI148_LCSR_DCTL_VBOT_2 (2<<8) /* VMEbus back-off 2us */ #define TSI148_LCSR_DCTL_VBOT_4 (3<<8) /* VMEbus back-off 4us */ #define TSI148_LCSR_DCTL_VBOT_8 (4<<8) /* VMEbus back-off 8us */ @@ -1220,7 +1220,7 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, #define TSI148_LCSR_DCTL_PBKS_M (7<<4) /* PCI block size MASK */ #define TSI148_LCSR_DCTL_PBKS_32 (0<<4) /* PCI block size 32 bytes */ -#define TSI148_LCSR_DCTL_PBKS_64 (1<<4) /* PCI block size 64 bytes */ +#define TSI148_LCSR_DCTL_PBKS_64 BIT(4) /* PCI block size 64 bytes */ #define TSI148_LCSR_DCTL_PBKS_128 (2<<4) /* PCI block size 128 bytes */ #define TSI148_LCSR_DCTL_PBKS_256 (3<<4) /* PCI block size 256 bytes */ #define TSI148_LCSR_DCTL_PBKS_512 (4<<4) /* PCI block size 512 bytes */ @@ -1230,7 +1230,7 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, #define TSI148_LCSR_DCTL_PBOT_M (7<<0) /* PCI back off MASK */ #define TSI148_LCSR_DCTL_PBOT_0 (0<<0) /* PCI back off 0us */ -#define TSI148_LCSR_DCTL_PBOT_1 (1<<0) /* PCI back off 1us */ +#define TSI148_LCSR_DCTL_PBOT_1 BIT(0) /* PCI back off 1us */ #define TSI148_LCSR_DCTL_PBOT_2 (2<<0) /* PCI back off 2us */ #define TSI148_LCSR_DCTL_PBOT_4 (3<<0) /* PCI back off 3us */ #define TSI148_LCSR_DCTL_PBOT_8 (4<<0) /* PCI back off 4us */ @@ -1241,14 +1241,14 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, /* * DMA Status Registers (0-1) CRG + $504 */ -#define TSI148_LCSR_DSTA_SMA (1<<31) /* PCI Signalled Master Abt */ -#define TSI148_LCSR_DSTA_RTA (1<<30) /* PCI Received Target Abt */ -#define TSI148_LCSR_DSTA_MRC (1<<29) /* PCI Max Retry Count */ -#define TSI148_LCSR_DSTA_VBE (1<<28) /* VMEbus error */ -#define TSI148_LCSR_DSTA_ABT (1<<27) /* Abort */ -#define TSI148_LCSR_DSTA_PAU (1<<26) /* Pause */ -#define TSI148_LCSR_DSTA_DON (1<<25) /* Done */ -#define TSI148_LCSR_DSTA_BSY (1<<24) /* Busy */ +#define TSI148_LCSR_DSTA_SMA BIT(31) /* PCI Signalled Master Abt */ +#define TSI148_LCSR_DSTA_RTA BIT(30) /* PCI Received Target Abt */ +#define TSI148_LCSR_DSTA_MRC BIT(29) /* PCI Max Retry Count */ +#define TSI148_LCSR_DSTA_VBE BIT(28) /* VMEbus error */ +#define TSI148_LCSR_DSTA_ABT BIT(27) /* Abort */ +#define TSI148_LCSR_DSTA_PAU BIT(26) /* Pause */ +#define TSI148_LCSR_DSTA_DON BIT(25) /* Done */ +#define TSI148_LCSR_DSTA_BSY BIT(24) /* Busy */ /* * DMA Current Link Address Lower (0-1) @@ -1260,20 +1260,20 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, */ #define TSI148_LCSR_DSAT_TYP_M (3<<28) /* Source Bus Type */ #define TSI148_LCSR_DSAT_TYP_PCI (0<<28) /* PCI Bus */ -#define TSI148_LCSR_DSAT_TYP_VME (1<<28) /* VMEbus */ +#define TSI148_LCSR_DSAT_TYP_VME BIT(28) /* VMEbus */ #define TSI148_LCSR_DSAT_TYP_PAT (2<<28) /* Data Pattern */ -#define TSI148_LCSR_DSAT_PSZ (1<<25) /* Pattern Size */ -#define TSI148_LCSR_DSAT_NIN (1<<24) /* No Increment */ +#define TSI148_LCSR_DSAT_PSZ BIT(25) /* Pattern Size */ +#define TSI148_LCSR_DSAT_NIN BIT(24) /* No Increment */ #define TSI148_LCSR_DSAT_2eSSTM_M (3<<11) /* 2eSST Trans Rate Mask */ #define TSI148_LCSR_DSAT_2eSSTM_160 (0<<11) /* 160 MB/s */ -#define TSI148_LCSR_DSAT_2eSSTM_267 (1<<11) /* 267 MB/s */ +#define TSI148_LCSR_DSAT_2eSSTM_267 BIT(11) /* 267 MB/s */ #define TSI148_LCSR_DSAT_2eSSTM_320 (2<<11) /* 320 MB/s */ #define TSI148_LCSR_DSAT_TM_M (7<<8) /* Bus Transfer Protocol Mask */ #define TSI148_LCSR_DSAT_TM_SCT (0<<8) /* SCT */ -#define TSI148_LCSR_DSAT_TM_BLT (1<<8) /* BLT */ +#define TSI148_LCSR_DSAT_TM_BLT BIT(8) /* BLT */ #define TSI148_LCSR_DSAT_TM_MBLT (2<<8) /* MBLT */ #define TSI148_LCSR_DSAT_TM_2eVME (3<<8) /* 2eVME */ #define TSI148_LCSR_DSAT_TM_2eSST (4<<8) /* 2eSST */ @@ -1281,14 +1281,14 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, #define TSI148_LCSR_DSAT_DBW_M (3<<6) /* Max Data Width MASK */ #define TSI148_LCSR_DSAT_DBW_16 (0<<6) /* 16 Bits */ -#define TSI148_LCSR_DSAT_DBW_32 (1<<6) /* 32 Bits */ +#define TSI148_LCSR_DSAT_DBW_32 BIT(6) /* 32 Bits */ -#define TSI148_LCSR_DSAT_SUP (1<<5) /* Supervisory Mode */ -#define TSI148_LCSR_DSAT_PGM (1<<4) /* Program Mode */ +#define TSI148_LCSR_DSAT_SUP BIT(5) /* Supervisory Mode */ +#define TSI148_LCSR_DSAT_PGM BIT(4) /* Program Mode */ #define TSI148_LCSR_DSAT_AMODE_M (0xf<<0) /* Address Space Mask */ #define TSI148_LCSR_DSAT_AMODE_A16 (0<<0) /* A16 */ -#define TSI148_LCSR_DSAT_AMODE_A24 (1<<0) /* A24 */ +#define TSI148_LCSR_DSAT_AMODE_A24 BIT(0) /* A24 */ #define TSI148_LCSR_DSAT_AMODE_A32 (2<<0) /* A32 */ #define TSI148_LCSR_DSAT_AMODE_A64 (4<<0) /* A64 */ #define TSI148_LCSR_DSAT_AMODE_CRCSR (5<<0) /* CR/CSR */ @@ -1301,16 +1301,16 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, * DMA Destination Attribute Registers (0-1) */ #define TSI148_LCSR_DDAT_TYP_PCI (0<<28) /* Destination PCI Bus */ -#define TSI148_LCSR_DDAT_TYP_VME (1<<28) /* Destination VMEbus */ +#define TSI148_LCSR_DDAT_TYP_VME BIT(28) /* Destination VMEbus */ #define TSI148_LCSR_DDAT_2eSSTM_M (3<<11) /* 2eSST Transfer Rate Mask */ #define TSI148_LCSR_DDAT_2eSSTM_160 (0<<11) /* 160 MB/s */ -#define TSI148_LCSR_DDAT_2eSSTM_267 (1<<11) /* 267 MB/s */ +#define TSI148_LCSR_DDAT_2eSSTM_267 BIT(11) /* 267 MB/s */ #define TSI148_LCSR_DDAT_2eSSTM_320 (2<<11) /* 320 MB/s */ #define TSI148_LCSR_DDAT_TM_M (7<<8) /* Bus Transfer Protocol Mask */ #define TSI148_LCSR_DDAT_TM_SCT (0<<8) /* SCT */ -#define TSI148_LCSR_DDAT_TM_BLT (1<<8) /* BLT */ +#define TSI148_LCSR_DDAT_TM_BLT BIT(8) /* BLT */ #define TSI148_LCSR_DDAT_TM_MBLT (2<<8) /* MBLT */ #define TSI148_LCSR_DDAT_TM_2eVME (3<<8) /* 2eVME */ #define TSI148_LCSR_DDAT_TM_2eSST (4<<8) /* 2eSST */ @@ -1318,14 +1318,14 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, #define TSI148_LCSR_DDAT_DBW_M (3<<6) /* Max Data Width MASK */ #define TSI148_LCSR_DDAT_DBW_16 (0<<6) /* 16 Bits */ -#define TSI148_LCSR_DDAT_DBW_32 (1<<6) /* 32 Bits */ +#define TSI148_LCSR_DDAT_DBW_32 BIT(6) /* 32 Bits */ -#define TSI148_LCSR_DDAT_SUP (1<<5) /* Supervisory/User Access */ -#define TSI148_LCSR_DDAT_PGM (1<<4) /* Program/Data Access */ +#define TSI148_LCSR_DDAT_SUP BIT(5) /* Supervisory/User Access */ +#define TSI148_LCSR_DDAT_PGM BIT(4) /* Program/Data Access */ #define TSI148_LCSR_DDAT_AMODE_M (0xf<<0) /* Address Space Mask */ #define TSI148_LCSR_DDAT_AMODE_A16 (0<<0) /* A16 */ -#define TSI148_LCSR_DDAT_AMODE_A24 (1<<0) /* A24 */ +#define TSI148_LCSR_DDAT_AMODE_A24 BIT(0) /* A24 */ #define TSI148_LCSR_DDAT_AMODE_A32 (2<<0) /* A32 */ #define TSI148_LCSR_DDAT_AMODE_A64 (4<<0) /* A64 */ #define TSI148_LCSR_DDAT_AMODE_CRCSR (5<<0) /* CRC/SR */ @@ -1338,7 +1338,7 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, * DMA Next Link Address Lower */ #define TSI148_LCSR_DNLAL_DNLAL_M (0x3FFFFFF<<6) /* Address Mask */ -#define TSI148_LCSR_DNLAL_LLA (1<<0) /* Last Link Address Indicator */ +#define TSI148_LCSR_DNLAL_LLA BIT(0) /* Last Link Address Indicator */ /* * DMA 2eSST Broadcast Select @@ -1352,22 +1352,22 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, /* * GCSR Control and Status Register CRG + $604 */ -#define TSI148_GCSR_GCTRL_LRST (1<<15) /* Local Reset */ -#define TSI148_GCSR_GCTRL_SFAILEN (1<<14) /* System Fail enable */ -#define TSI148_GCSR_GCTRL_BDFAILS (1<<13) /* Board Fail Status */ -#define TSI148_GCSR_GCTRL_SCON (1<<12) /* System Copntroller */ -#define TSI148_GCSR_GCTRL_MEN (1<<11) /* Module Enable (READY) */ +#define TSI148_GCSR_GCTRL_LRST BIT(15) /* Local Reset */ +#define TSI148_GCSR_GCTRL_SFAILEN BIT(14) /* System Fail enable */ +#define TSI148_GCSR_GCTRL_BDFAILS BIT(13) /* Board Fail Status */ +#define TSI148_GCSR_GCTRL_SCON BIT(12) /* System Copntroller */ +#define TSI148_GCSR_GCTRL_MEN BIT(11) /* Module Enable (READY) */ -#define TSI148_GCSR_GCTRL_LMI3S (1<<7) /* Loc Monitor 3 Int Status */ -#define TSI148_GCSR_GCTRL_LMI2S (1<<6) /* Loc Monitor 2 Int Status */ -#define TSI148_GCSR_GCTRL_LMI1S (1<<5) /* Loc Monitor 1 Int Status */ -#define TSI148_GCSR_GCTRL_LMI0S (1<<4) /* Loc Monitor 0 Int Status */ -#define TSI148_GCSR_GCTRL_MBI3S (1<<3) /* Mail box 3 Int Status */ -#define TSI148_GCSR_GCTRL_MBI2S (1<<2) /* Mail box 2 Int Status */ -#define TSI148_GCSR_GCTRL_MBI1S (1<<1) /* Mail box 1 Int Status */ -#define TSI148_GCSR_GCTRL_MBI0S (1<<0) /* Mail box 0 Int Status */ +#define TSI148_GCSR_GCTRL_LMI3S BIT(7) /* Loc Monitor 3 Int Status */ +#define TSI148_GCSR_GCTRL_LMI2S BIT(6) /* Loc Monitor 2 Int Status */ +#define TSI148_GCSR_GCTRL_LMI1S BIT(5) /* Loc Monitor 1 Int Status */ +#define TSI148_GCSR_GCTRL_LMI0S BIT(4) /* Loc Monitor 0 Int Status */ +#define TSI148_GCSR_GCTRL_MBI3S BIT(3) /* Mail box 3 Int Status */ +#define TSI148_GCSR_GCTRL_MBI2S BIT(2) /* Mail box 2 Int Status */ +#define TSI148_GCSR_GCTRL_MBI1S BIT(1) /* Mail box 1 Int Status */ +#define TSI148_GCSR_GCTRL_MBI0S BIT(0) /* Mail box 0 Int Status */ -#define TSI148_GCSR_GAP (1<<5) /* Geographic Addr Parity */ +#define TSI148_GCSR_GAP BIT(5) /* Geographic Addr Parity */ #define TSI148_GCSR_GA_M (0x1F<<0) /* Geographic Address Mask */ /* @@ -1377,20 +1377,20 @@ static const int TSI148_LCSR_INTC_MBC[4] = { TSI148_LCSR_INTC_MB0C, /* * CR/CSR Bit Clear Register CRG + $FF4 */ -#define TSI148_CRCSR_CSRBCR_LRSTC (1<<7) /* Local Reset Clear */ -#define TSI148_CRCSR_CSRBCR_SFAILC (1<<6) /* System Fail Enable Clear */ -#define TSI148_CRCSR_CSRBCR_BDFAILS (1<<5) /* Board Fail Status */ -#define TSI148_CRCSR_CSRBCR_MENC (1<<4) /* Module Enable Clear */ -#define TSI148_CRCSR_CSRBCR_BERRSC (1<<3) /* Bus Error Status Clear */ +#define TSI148_CRCSR_CSRBCR_LRSTC BIT(7) /* Local Reset Clear */ +#define TSI148_CRCSR_CSRBCR_SFAILC BIT(6) /* System Fail Enable Clear */ +#define TSI148_CRCSR_CSRBCR_BDFAILS BIT(5) /* Board Fail Status */ +#define TSI148_CRCSR_CSRBCR_MENC BIT(4) /* Module Enable Clear */ +#define TSI148_CRCSR_CSRBCR_BERRSC BIT(3) /* Bus Error Status Clear */ /* * CR/CSR Bit Set Register CRG+$FF8 */ -#define TSI148_CRCSR_CSRBSR_LISTS (1<<7) /* Local Reset Clear */ -#define TSI148_CRCSR_CSRBSR_SFAILS (1<<6) /* System Fail Enable Clear */ -#define TSI148_CRCSR_CSRBSR_BDFAILS (1<<5) /* Board Fail Status */ -#define TSI148_CRCSR_CSRBSR_MENS (1<<4) /* Module Enable Clear */ -#define TSI148_CRCSR_CSRBSR_BERRS (1<<3) /* Bus Error Status Clear */ +#define TSI148_CRCSR_CSRBSR_LISTS BIT(7) /* Local Reset Clear */ +#define TSI148_CRCSR_CSRBSR_SFAILS BIT(6) /* System Fail Enable Clear */ +#define TSI148_CRCSR_CSRBSR_BDFAILS BIT(5) /* Board Fail Status */ +#define TSI148_CRCSR_CSRBSR_MENS BIT(4) /* Module Enable Clear */ +#define TSI148_CRCSR_CSRBSR_BERRS BIT(3) /* Bus Error Status Clear */ /* * CR/CSR Base Address Register CRG + FFC From b4474375481fbdd6f8568aadc5ccf6acf09cf997 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 25 Mar 2023 14:28:20 +0100 Subject: [PATCH 123/185] staging: rtl8192e: remove RTL819X_DEFAULT_RF_TYPE Remove RTL819X_DEFAULT_RF_TYPE and use RF_1T2R directly to make follow up patches, which will remove priv->rf_type, easier to review. Signed-off-by: Michael Straube Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/20230325132823.22872-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index a67927f0c5e3..3027d43cb362 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -343,7 +343,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) else priv->tx_pwr_data_read_from_eeprom = false; - priv->rf_type = RTL819X_DEFAULT_RF_TYPE; + priv->rf_type = RF_1T2R; if (priv->card_8192_version > VERSION_8190_BD) { if (!priv->autoload_fail_flag) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 68ec0aeb2dd9..914cd28897a5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -61,8 +61,6 @@ #define HAL_HW_PCI_REVISION_ID_8192PCIE 0x01 #define HAL_HW_PCI_REVISION_ID_8192SE 0x10 -#define RTL819X_DEFAULT_RF_TYPE RF_1T2R - #define RTLLIB_WATCH_DOG_TIME 2000 #define MAX_DEV_ADDR_SIZE 8 /*support till 64 bit bus width OS*/ From a3ed769cc229e7d395f9c772e5db72ded643169d Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 25 Mar 2023 14:28:21 +0100 Subject: [PATCH 124/185] staging: rtl8192e: remove redundant setting of rf_type At this point the value of priv->rf_type is RF_1T2R already. Setting it again is redundant and can be removed. Signed-off-by: Michael Straube Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/20230325132823.22872-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 3027d43cb362..0e0096ef4943 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -350,10 +350,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) tempval = (rtl92e_eeprom_read(dev, (EEPROM_RFInd_PowerDiff >> 1))) & 0xff; priv->eeprom_legacy_ht_tx_pwr_diff = tempval & 0xf; - - if (tempval&0x80) - priv->rf_type = RF_1T2R; - } else { priv->eeprom_legacy_ht_tx_pwr_diff = 0x04; } From 2fd65482d923ee09a6e133dcc15f988a4a44420b Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 25 Mar 2023 14:28:22 +0100 Subject: [PATCH 125/185] staging: rtl8192e: priv->rf_type is always RF_1T2R The value of priv->rf_type is always RF_1T2R. Remove if statements that check for priv->rf_type == RF_1T2R and remove resulting dead code. Signed-off-by: Michael Straube Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/20230325132823.22872-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 13 ++++------- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 7 ++---- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 23 +++++++------------ 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 0e0096ef4943..b237970ecf85 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -540,8 +540,7 @@ static void _rtl92e_hwconfig(struct net_device *dev) u32 ratr_value; ratr_value = regRATR; - if (priv->rf_type == RF_1T2R) - ratr_value &= ~(RATE_ALL_OFDM_2SS); + ratr_value &= ~(RATE_ALL_OFDM_2SS); rtl92e_writel(dev, RATR0, ratr_value); rtl92e_writeb(dev, UFWP, 1); } @@ -1886,14 +1885,10 @@ void rtl92e_update_ratr_table(struct net_device *dev) break; case IEEE_N_24G: case IEEE_N_5G: - if (ieee->ht_info->peer_mimo_ps == 0) { + if (ieee->ht_info->peer_mimo_ps == 0) ratr_value &= 0x0007F007; - } else { - if (priv->rf_type == RF_1T2R) - ratr_value &= 0x000FF007; - else - ratr_value &= 0x0F81F007; - } + else + ratr_value &= 0x000FF007; break; default: break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index b1c297d2ae36..bd302f5cb356 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -281,14 +281,11 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType) u32 *Rtl819XPHY_REGArray_Table = NULL; u32 *Rtl819XAGCTAB_Array_Table = NULL; u16 AGCTAB_ArrayLen, PHY_REGArrayLen = 0; - struct r8192_priv *priv = rtllib_priv(dev); AGCTAB_ArrayLen = RTL8192E_AGCTAB_ARR_LEN; Rtl819XAGCTAB_Array_Table = RTL8192E_AGCTAB_ARR; - if (priv->rf_type == RF_1T2R) { - PHY_REGArrayLen = RTL8192E_PHY_REG_1T2R_ARR_LEN; - Rtl819XPHY_REGArray_Table = RTL8192E_PHY_REG_1T2R_ARR; - } + PHY_REGArrayLen = RTL8192E_PHY_REG_1T2R_ARR_LEN; + Rtl819XPHY_REGArray_Table = RTL8192E_PHY_REG_1T2R_ARR; if (ConfigType == BB_CONFIG_PHY_REG) { for (i = 0; i < PHY_REGArrayLen; i += 2) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index b745b73eedea..46be638677d9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -272,19 +272,14 @@ void rtl92e_init_adaptive_rate(struct net_device *dev) pra->ping_rssi_enable = 0; pra->ping_rssi_thresh_for_ra = 15; - - if (priv->rf_type == RF_1T2R) { - pra->upper_rssi_threshold_ratr = 0x000fc000; - pra->middle_rssi_threshold_ratr = 0x000ff000; - pra->low_rssi_threshold_ratr = 0x000ff001; - pra->low_rssi_threshold_ratr_40M = 0x000ff005; - pra->low_rssi_threshold_ratr_20M = 0x000ff001; - pra->ping_rssi_ratr = 0x0000000d; - } - + pra->upper_rssi_threshold_ratr = 0x000fc000; + pra->middle_rssi_threshold_ratr = 0x000ff000; + pra->low_rssi_threshold_ratr = 0x000ff001; + pra->low_rssi_threshold_ratr_40M = 0x000ff005; + pra->low_rssi_threshold_ratr_20M = 0x000ff001; + pra->ping_rssi_ratr = 0x0000000d; } - static void _rtl92e_dm_check_rate_adaptive(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -383,8 +378,7 @@ static void _rtl92e_dm_check_rate_adaptive(struct net_device *dev) u32 ratr_value; ratr_value = targetRATR; - if (priv->rf_type == RF_1T2R) - ratr_value &= ~(RATE_ALL_OFDM_2SS); + ratr_value &= ~(RATE_ALL_OFDM_2SS); rtl92e_writel(dev, RATR0, ratr_value); rtl92e_writeb(dev, UFWP, 1); @@ -981,8 +975,7 @@ void rtl92e_dm_restore_state(struct net_device *dev) priv->rtllib->mode == WIRELESS_MODE_N_5G)) return; ratr_value = reg_ratr; - if (priv->rf_type == RF_1T2R) - ratr_value &= ~(RATE_ALL_OFDM_2SS); + ratr_value &= ~(RATE_ALL_OFDM_2SS); rtl92e_writel(dev, RATR0, ratr_value); rtl92e_writeb(dev, UFWP, 1); if (priv->tx_pwr_tracking_init && priv->btxpower_tracking) From 91de7cdc784f28655eb97de3e66ede0ada94b6eb Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 25 Mar 2023 14:28:23 +0100 Subject: [PATCH 126/185] staging: rtl8192e: remove rf_type from struct r8192_priv The field rf_type of struct r8192_priv is always RF_1T2R and only used in one place. Use RF_1T2R directly there and remove rf_type from struct r8192_priv. Signed-off-by: Michael Straube Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/20230325132823.22872-5-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index b237970ecf85..1eb063fe660a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -343,8 +343,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) else priv->tx_pwr_data_read_from_eeprom = false; - priv->rf_type = RF_1T2R; - if (priv->card_8192_version > VERSION_8190_BD) { if (!priv->autoload_fail_flag) { tempval = (rtl92e_eeprom_read(dev, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 914cd28897a5..1e99eb833405 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -289,7 +289,6 @@ struct r8192_priv { enum nic_t card_8192; u8 card_8192_version; - u8 rf_type; u8 ic_cut; char nick[IW_ESSID_MAX_SIZE + 1]; u8 check_roaming_cnt; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 46be638677d9..d45808760638 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -532,7 +532,7 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) priv->rtllib->bdynamic_txpower_enable = false; powerlevelOFDM24G = priv->pwr_track >> 24; - RF_Type = priv->rf_type; + RF_Type = RF_1T2R; Value = (RF_Type<<8) | powerlevelOFDM24G; for (j = 0; j <= 30; j++) { From b07c8ef8c60a4714fad3d7c95a8e464ad83ca715 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Sat, 25 Mar 2023 23:45:19 -0700 Subject: [PATCH 127/185] staging: greybus: Inline pwm_chip_to_gb_pwm_chip() Convert 'pwm_chip_to_gb_pwm_chip' from a macro to a static inline function, to make the relevant types apparent in the definition and to benefit from the type checking performed by the compiler at call sites. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230326064519.GA179449@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/pwm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c index 26d39e08c3b6..88da1d796f13 100644 --- a/drivers/staging/greybus/pwm.c +++ b/drivers/staging/greybus/pwm.c @@ -21,8 +21,11 @@ struct gb_pwm_chip { struct pwm_chip chip; struct pwm_chip *pwm; }; -#define pwm_chip_to_gb_pwm_chip(chip) \ - container_of(chip, struct gb_pwm_chip, chip) + +static inline struct gb_pwm_chip *pwm_chip_to_gb_pwm_chip(struct pwm_chip *chip) +{ + return container_of(chip, struct gb_pwm_chip, chip); +} static int gb_pwm_count_operation(struct gb_pwm_chip *pwmc) { From 16313403d873ff17a587818b61f84c8cb4971cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20S=C3=A1?= Date: Mon, 27 Mar 2023 16:54:14 +0200 Subject: [PATCH 128/185] staging: iio: resolver: ads1210: fix config mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode. [1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf Fixes: b19e9ad5e2cb9 ("staging:iio:resolver:ad2s1210 general driver cleanup") Cc: stable Signed-off-by: Nuno Sá Link: https://lore.kernel.org/r/20230327145414.1505537-1-nuno.sa@analog.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/resolver/ad2s1210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index e4cf42438487..636c45b12843 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -101,7 +101,7 @@ struct ad2s1210_state { static const int ad2s1210_mode_vals[4][2] = { [MOD_POS] = { 0, 0 }, [MOD_VEL] = { 0, 1 }, - [MOD_CONFIG] = { 1, 0 }, + [MOD_CONFIG] = { 1, 1 }, }; static inline void ad2s1210_set_mode(enum ad2s1210_mode mode, From 1068d4e910cc8e8d06dc04512287a59737292f40 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Mon, 27 Mar 2023 10:13:51 -0700 Subject: [PATCH 129/185] staging: rtl8192e: fix line ending with '(' Splitting function header to multiple lines because of 80 characters per line limit, results in ending the function call line with '('. This leads to CHECK reported by checkpatch.pl Move the first parameter right after the '(' in the function call line. Align the rest of the parameters to the opening parenthesis. Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230327171351.GA188288@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 1ce4c29dab13..155b54e93b1e 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1910,10 +1910,9 @@ struct net_device *alloc_rtllib(int sizeof_priv); /* rtllib_tx.c */ -int rtllib_encrypt_fragment( - struct rtllib_device *ieee, - struct sk_buff *frag, - int hdr_len); +int rtllib_encrypt_fragment(struct rtllib_device *ieee, + struct sk_buff *frag, + int hdr_len); netdev_tx_t rtllib_xmit(struct sk_buff *skb, struct net_device *dev); void rtllib_txb_free(struct rtllib_txb *txb); From 5ceb51dae50666635d6e5dcd4cca9582e0826bf8 Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Mon, 27 Mar 2023 10:16:53 -0700 Subject: [PATCH 130/185] staging: rtl8192e: remove extra blank lines Remove the extra blank line in accordance with the Linux kernel coding-style regulations. These issues were reported by checkpatch.pl "CHECK: Please don't use multiple blank lines" Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230327171653.GA188371@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 155b54e93b1e..197c0a44ebd6 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -308,7 +308,6 @@ enum rt_op_mode { RT_OP_MODE_NO_LINK, }; - #define aSifsTime \ (((priv->rtllib->current_network.mode == IEEE_A) \ || (priv->rtllib->current_network.mode == IEEE_N_24G) \ @@ -653,7 +652,6 @@ struct rtllib_security { u16 flags; } __packed; - /* 802.11 data frame from AP * ,-------------------------------------------------------------------. * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | @@ -984,7 +982,6 @@ static inline u8 Frame_QoSTID(u8 *buf) (fc & RTLLIB_FCTL_FROMDS)) ? 30 : 24)))->field.tid; } - struct eapol { u8 snap[6]; u16 ethertype; @@ -1199,8 +1196,6 @@ struct bandwidth_autoswitch { bool bautoswitch_enable; }; - - #define REORDER_WIN_SIZE 128 #define REORDER_ENTRY_NUM 128 struct rx_reorder_entry { @@ -1372,7 +1367,6 @@ struct rt_intel_promisc_mode { bool fltr_src_sta_frame; }; - /*************** DRIVER STATUS *****/ #define STATUS_SCANNING 0 /*************** DRIVER STATUS *****/ @@ -1441,7 +1435,6 @@ struct rtllib_device { struct rx_reorder_entry RxReorderEntry[128]; struct list_head RxReorder_Unused_List; - /* Bookkeeping structures */ struct net_device_stats stats; struct rtllib_softmac_stats softmac_stats; @@ -1738,7 +1731,6 @@ struct rtllib_device { struct rtllib_assoc_response_frame *resp, struct rtllib_network *network); - /* check whether Tx hw resource available */ short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); void (*SetBWModeHandler)(struct net_device *dev, @@ -1811,7 +1803,6 @@ struct rtllib_device { */ #define IEEE_SOFTMAC_BEACONS (1<<6) - static inline void *rtllib_priv(struct net_device *dev) { return ((struct rtllib_device *)netdev_priv(dev))->priv; @@ -1903,7 +1894,6 @@ static inline int rtllib_is_cck_rate(u8 rate) return 0; } - /* rtllib.c */ void free_rtllib(struct net_device *dev); struct net_device *alloc_rtllib(int sizeof_priv); @@ -2112,7 +2102,6 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) /* fun with the built-in rtllib stack... */ bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); - /* For the function is more related to hardware setting, it's better to use the * ieee handler to refer to it. */ From bf8d1ecccb297b81bcca980dcd04fc1fb74d4209 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:02:19 +0200 Subject: [PATCH 131/185] staging: rtl8192e: Remove rtl92e_config_phy Remove rtl92e_config_phy to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/5c433417b4e8e96a70c23a03bec30d26e45791d0.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 9 --------- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 1 - 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 1eb063fe660a..f4fdaeff2917 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -691,7 +691,7 @@ start: } if (priv->rst_progress == RESET_TYPE_NORESET) { - rtStatus = rtl92e_config_phy(dev); + rtStatus = rtl92e_config_rf(dev); if (!rtStatus) { netdev_info(dev, "RF Config failed\n"); return rtStatus; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index bd302f5cb356..139d8268c8dc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -468,15 +468,6 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) rtl92e_set_ofdm_tx_power(dev, powerlevelOFDM24G); } -bool rtl92e_config_phy(struct net_device *dev) -{ - bool rtStatus = true; - - rtStatus = rtl92e_config_rf(dev); - - return rtStatus; -} - u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) { diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 498da6be3e4e..6c4c33ded6a9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h @@ -39,7 +39,6 @@ bool rtl92e_check_bb_and_rf(struct net_device *dev, bool rtl92e_config_bb(struct net_device *dev); void rtl92e_get_tx_power(struct net_device *dev); void rtl92e_set_tx_power(struct net_device *dev, u8 channel); -bool rtl92e_config_phy(struct net_device *dev); u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath); u8 rtl92e_set_channel(struct net_device *dev, u8 channel); From f57a7f1515828cb493efb0628537e98d0747da71 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:02:37 +0200 Subject: [PATCH 132/185] staging: rtl8192e: Remove _rtl92e_get_supported_wireless_mode Remove _rtl92e_get_supported_wireless_mode to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/f8470fff23d5870cbcda3d6f4978ba17016a8fe8.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ecc3f0c6c267..12e5132fa788 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -593,18 +593,10 @@ static void _rtl92e_refresh_support_rate(struct r8192_priv *priv) } } -static u8 _rtl92e_get_supported_wireless_mode(struct net_device *dev) -{ - u8 ret = 0; - - ret = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B); - return ret; -} - void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode) { struct r8192_priv *priv = rtllib_priv(dev); - u8 support_mode = _rtl92e_get_supported_wireless_mode(dev); + u8 support_mode = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B); if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode & support_mode) == 0)) { From 1b4217b400aedad80512c389c8aef4fe7bbc0119 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:02:45 +0200 Subject: [PATCH 133/185] staging: rtl8192e: Remove 5G wireless_mode in rtl92e_set_wireless_mode Remove wireless_mode == WIRELESS_MODE_N_5G as 5G is not supported by hardware and to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/693a34b187f21d9d48accd3b0b953dff2f0795eb.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 12e5132fa788..c03978353a90 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -624,12 +624,11 @@ void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode) priv->rtllib->mode = wireless_mode; - if ((wireless_mode == WIRELESS_MODE_N_24G) || - (wireless_mode == WIRELESS_MODE_N_5G)) { + if (wireless_mode == WIRELESS_MODE_N_24G) priv->rtllib->ht_info->enable_ht = 1; - } else { + else priv->rtllib->ht_info->enable_ht = 0; - } + _rtl92e_refresh_support_rate(priv); } From 4648ac046624d7d59d51122277f50fed84923629 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:02:51 +0200 Subject: [PATCH 134/185] staging: rtl8192e: Remove unused if clauses in rtl92e_set_wireless_mode Equation (support_mode & WIRELESS_MODE_N_24G) will always be true. Remove resulting dead code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/359ed203ab08afe5c2f449f40d2958868b4e55b4.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 21 ++------------------ 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index c03978353a90..689a5e16eb4d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -598,25 +598,8 @@ void rtl92e_set_wireless_mode(struct net_device *dev, u8 wireless_mode) struct r8192_priv *priv = rtllib_priv(dev); u8 support_mode = (WIRELESS_MODE_N_24G | WIRELESS_MODE_G | WIRELESS_MODE_B); - if ((wireless_mode == WIRELESS_MODE_AUTO) || - ((wireless_mode & support_mode) == 0)) { - if (support_mode & WIRELESS_MODE_N_24G) { - wireless_mode = WIRELESS_MODE_N_24G; - } else if (support_mode & WIRELESS_MODE_N_5G) { - wireless_mode = WIRELESS_MODE_N_5G; - } else if ((support_mode & WIRELESS_MODE_A)) { - wireless_mode = WIRELESS_MODE_A; - } else if ((support_mode & WIRELESS_MODE_G)) { - wireless_mode = WIRELESS_MODE_G; - } else if ((support_mode & WIRELESS_MODE_B)) { - wireless_mode = WIRELESS_MODE_B; - } else { - netdev_info(dev, - "%s(): Unsupported mode requested. Fallback to 802.11b\n", - __func__); - wireless_mode = WIRELESS_MODE_B; - } - } + if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode & support_mode) == 0)) + wireless_mode = WIRELESS_MODE_N_24G; if ((wireless_mode & (WIRELESS_MODE_B | WIRELESS_MODE_G)) == (WIRELESS_MODE_G | WIRELESS_MODE_B)) From 1bfa151cc0e10b717921630330dfd53f15b28b77 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:02:57 +0200 Subject: [PATCH 135/185] staging: rtl8192e: Remove wireless modes A, N_5G from _rtl92e_hwconfig Remove WIRELESS_MODE_N_5G and WIRELESS_MODE_A as those are not supported by hardware and to improve readability. Combine WIRELESS_MODE_G with default to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/ab96af426f090ac2fe4a2536b052fcf8a2e38aa8.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index f4fdaeff2917..1da14e737aa4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -503,16 +503,6 @@ static void _rtl92e_hwconfig(struct net_device *dev) regRATR = RATE_ALL_CCK; regRRSR = RATE_ALL_CCK; break; - case WIRELESS_MODE_A: - regBwOpMode = BW_OPMODE_5G | BW_OPMODE_20MHZ; - regRATR = RATE_ALL_OFDM_AG; - regRRSR = RATE_ALL_OFDM_AG; - break; - case WIRELESS_MODE_G: - regBwOpMode = BW_OPMODE_20MHZ; - regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - break; case WIRELESS_MODE_AUTO: case WIRELESS_MODE_N_24G: regBwOpMode = BW_OPMODE_20MHZ; @@ -520,12 +510,7 @@ static void _rtl92e_hwconfig(struct net_device *dev) RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; break; - case WIRELESS_MODE_N_5G: - regBwOpMode = BW_OPMODE_5G; - regRATR = RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | - RATE_ALL_OFDM_2SS; - regRRSR = RATE_ALL_OFDM_AG; - break; + case WIRELESS_MODE_G: default: regBwOpMode = BW_OPMODE_20MHZ; regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; From a993465cd1e3499bd1f5841dadfae354b8a95f06 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:03:06 +0200 Subject: [PATCH 136/185] staging: rtl8192e: Remove wireless modes A, N_5G from rtl92e_set_channel Remove WIRELESS_MODE_N_5G and WIRELESS_MODE_A as those are not supported by hardware and to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/aaaf832fe5f90ad2c618bef22c1bdbd5209c4359.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 139d8268c8dc..dd666701138e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -696,15 +696,6 @@ u8 rtl92e_set_channel(struct net_device *dev, u8 channel) switch (priv->rtllib->mode) { - case WIRELESS_MODE_A: - case WIRELESS_MODE_N_5G: - if (channel <= 14) { - netdev_warn(dev, - "Channel %d not available in 802.11a.\n", - channel); - return false; - } - break; case WIRELESS_MODE_B: if (channel > 14) { netdev_warn(dev, From 35c2274d3417b837097d87901705abae4e121f7a Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Mon, 27 Mar 2023 23:03:14 +0200 Subject: [PATCH 137/185] staging: rtl8192e: Remove wireless mode WIRELESS_MODE_N_5G Remove WIRELESS_MODE_N_5G from equations as it is not supported by hardware and to improve readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/fdefd4d706493fa3f080550d31eb5bea3f4e1a7e.1679949171.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 689a5e16eb4d..7506d7eb7b4c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -581,8 +581,7 @@ static void _rtl92e_refresh_support_rate(struct r8192_priv *priv) { struct rtllib_device *ieee = priv->rtllib; - if (ieee->mode == WIRELESS_MODE_N_24G || - ieee->mode == WIRELESS_MODE_N_5G) { + if (ieee->mode == WIRELESS_MODE_N_24G) { memcpy(ieee->reg_dot11ht_oper_rate_set, ieee->reg_ht_supp_rate_set, 16); memcpy(ieee->reg_dot11tx_ht_oper_rate_set, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index d45808760638..b5f4d0230da7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -296,8 +296,7 @@ static void _rtl92e_dm_check_rate_adaptive(struct net_device *dev) if (pra->rate_adaptive_disabled) return; - if (!(priv->rtllib->mode == WIRELESS_MODE_N_24G || - priv->rtllib->mode == WIRELESS_MODE_N_5G)) + if (priv->rtllib->mode != WIRELESS_MODE_N_24G) return; if (priv->rtllib->state == RTLLIB_LINKED) { @@ -971,8 +970,7 @@ void rtl92e_dm_restore_state(struct net_device *dev) if (priv->rate_adaptive.rate_adaptive_disabled) return; - if (!(priv->rtllib->mode == WIRELESS_MODE_N_24G || - priv->rtllib->mode == WIRELESS_MODE_N_5G)) + if (priv->rtllib->mode != WIRELESS_MODE_N_24G) return; ratr_value = reg_ratr; ratr_value &= ~(RATE_ALL_OFDM_2SS); From c7177ef36c743923a093d6b0ffd73f1002fc7cd6 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Tue, 28 Mar 2023 00:49:06 +0500 Subject: [PATCH 138/185] staging: rtl8192u: remove change history from comments Remove the change history information as it is not required in the comments. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/95fff39231ebb2bb683c2a8f252a93f4845fffb1.1679945728.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 45 ---------------------------- 1 file changed, 45 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 6a33ca02c3dc..b1ebb776fc42 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -7,12 +7,6 @@ Module Name: Abstract: HW dynamic mechanism. - -Major Change History: - When Who What - ---------- --------------- ------------------------------- - 2008-05-14 amy create version 0 porting from windows code. - --*/ #include "r8192U.h" #include "r8192U_dm.h" @@ -274,11 +268,6 @@ void init_rate_adaptive(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 05/26/08 amy Create version 0 porting from windows code. - * *---------------------------------------------------------------------------*/ static void dm_check_rate_adaptive(struct net_device *dev) { @@ -1589,11 +1578,6 @@ static void dm_bb_initialgain_backup(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 05/15/2008 amy Create Version 0 porting from windows code. - * *---------------------------------------------------------------------------*/ static void dm_dig_init(struct net_device *dev) { @@ -1634,10 +1618,6 @@ static void dm_dig_init(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 05/27/2008 amy Create Version 0 porting from windows code. *---------------------------------------------------------------------------*/ static void dm_ctrl_initgain_byrssi(struct net_device *dev) { @@ -1850,11 +1830,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 05/28/2008 amy Create Version 0 porting from windows code. - * *---------------------------------------------------------------------------*/ static void dm_ctrl_initgain_byrssi_highpwr( struct net_device *dev) @@ -2269,11 +2244,6 @@ static void dm_ctstoself(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 05/28/2008 amy Create Version 0 porting from windows code. - * *---------------------------------------------------------------------------*/ static void dm_check_pbc_gpio(struct net_device *dev) { @@ -2303,11 +2273,6 @@ static void dm_check_pbc_gpio(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 01/30/2008 MHC Create Version 0. - * *---------------------------------------------------------------------------*/ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) { @@ -2552,11 +2517,6 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 05/28/2008 amy Create Version 0 porting from windows code. - * *---------------------------------------------------------------------------*/ static void dm_check_rx_path_selection(struct net_device *dev) { @@ -2871,11 +2831,6 @@ void dm_check_fsync(struct net_device *dev) * Output: NONE * * Return: NONE - * - * Revised History: - * When Who Remark - * 03/06/2008 Jacken Create Version 0. - * *--------------------------------------------------------------------------- */ static void dm_init_dynamic_txpower(struct net_device *dev) From a430e7757debd2c0ac096a808e4363eace287773 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Tue, 28 Mar 2023 00:49:07 +0500 Subject: [PATCH 139/185] staging: rtl8192u: remove commented out code Remove all of the commented out code lines as they are not being used and can be brought back in the future if they are ever needed again. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/e5e2fabde70d497cc8b683ff444854299180812b.1679945728.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 123 --------------------------- 1 file changed, 123 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index b1ebb776fc42..e5c0bece4bb4 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -48,12 +48,8 @@ static void dm_init_bandwidth_autoswitch(struct net_device *dev); static void dm_bandwidth_autoswitch(struct net_device *dev); /* DM --> TX power control */ -/*static void dm_initialize_txpower_tracking(struct net_device *dev);*/ - static void dm_check_txpower_tracking(struct net_device *dev); -/*static void dm_txpower_reset_recovery(struct net_device *dev);*/ - /* DM --> Dynamic Init Gain by RSSI */ static void dm_dig_init(struct net_device *dev); static void dm_ctrl_initgain_byrssi(struct net_device *dev); @@ -68,7 +64,6 @@ static void dm_init_ctstoself(struct net_device *dev); /* DM --> EDCA turbo mode control */ static void dm_check_edca_turbo(struct net_device *dev); -/*static void dm_gpio_change_rf(struct net_device *dev);*/ /* DM --> Check PBC */ static void dm_check_pbc_gpio(struct net_device *dev); @@ -115,7 +110,6 @@ void init_hal_dm(struct net_device *dev) /* Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. */ dm_init_dynamic_txpower(dev); init_rate_adaptive(dev); - /*dm_initialize_txpower_tracking(dev);*/ dm_dig_init(dev); dm_init_edca_turbo(dev); dm_init_bandwidth_autoswitch(dev); @@ -140,21 +134,6 @@ void dm_CheckRxAggregation(struct net_device *dev) unsigned long curTxOkCnt = 0; unsigned long curRxOkCnt = 0; -/* - if (pHalData->bForcedUsbRxAggr) { - if (pHalData->ForcedUsbRxAggrInfo == 0) { - if (pHalData->bCurrentRxAggrEnable) { - Adapter->HalFunc.HalUsbRxAggrHandler(Adapter, FALSE); - } - } else { - if (!pHalData->bCurrentRxAggrEnable || (pHalData->ForcedUsbRxAggrInfo != pHalData->LastUsbRxAggrInfoSetting)) { - Adapter->HalFunc.HalUsbRxAggrHandler(Adapter, TRUE); - } - } - return; - } - -*/ curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt; curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; @@ -188,10 +167,6 @@ void dm_CheckRxAggregation(struct net_device *dev) void hal_dm_watchdog(struct net_device *dev) { - /*struct r8192_priv *priv = ieee80211_priv(dev);*/ - - /*static u8 previous_bssid[6] ={0};*/ - /*Add by amy 2008/05/15 ,porting from windows code.*/ dm_check_rate_adaptive(dev); dm_dynamic_txpower(dev); @@ -293,7 +268,6 @@ static void dm_check_rate_adaptive(struct net_device *dev) return; if (priv->ieee80211->state == IEEE80211_LINKED) { - /*RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t");*/ /* Check whether Short GI is enabled */ bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI40MHz) || @@ -340,36 +314,27 @@ static void dm_check_rate_adaptive(struct net_device *dev) (pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M); } - /*DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA);*/ if (priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA) { - /*DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB);*/ pra->ratr_state = DM_RATR_STA_HIGH; targetRATR = pra->upper_rssi_threshold_ratr; } else if (priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA) { - /*DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB);*/ pra->ratr_state = DM_RATR_STA_MIDDLE; targetRATR = pra->middle_rssi_threshold_ratr; } else { - /*DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB);*/ pra->ratr_state = DM_RATR_STA_LOW; targetRATR = pra->low_rssi_threshold_ratr; } /* cosa add for test */ if (pra->ping_rssi_enable) { - /*pHalData->UndecoratedSmoothedPWDB = 19;*/ if (priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5)) { if ((priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) || ping_rssi_state) { - /*DbgPrint("TestRSSI = %d, set RATR to 0x%x\n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);*/ pra->ratr_state = DM_RATR_STA_LOW; targetRATR = pra->ping_rssi_ratr; ping_rssi_state = 1; } - /*else - DbgPrint("TestRSSI is between the range.\n");*/ } else { - /*DbgPrint("TestRSSI Recover to 0x%x\n", targetRATR);*/ ping_rssi_state = 0; } } @@ -491,7 +456,6 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) u32 Value; u8 Pwr_Flag; u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver = 0; - /*RT_STATUS rtStatus = RT_STATUS_SUCCESS;*/ bool rtStatus = true; u32 delta = 0; @@ -513,7 +477,6 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (rtStatus == RT_STATUS_FAILURE) RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n"); usleep_range(1000, 2000); - /*DbgPrint("hi, vivi, strange\n");*/ for (i = 0; i <= 30; i++) { read_nic_byte(dev, 0x1ba, &Pwr_Flag); @@ -559,8 +522,6 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) TSSI_13dBm = priv->TSSI_13dBm; RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n", TSSI_13dBm); - /*if (abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)*/ - /* For MacOS-compatible */ if (Avg_TSSI_Meas_from_driver > TSSI_13dBm) delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm; else @@ -664,7 +625,6 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) } } priv->btxpower_trackingInit = true; - /*pHalData->TXPowercount = 0;*/ return; } @@ -708,9 +668,6 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) } tmpCCK40Mindex = 0; } - /*DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d", - ((u1Byte)tmpRegA - pHalData->ThermalMeter[0]), - tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex);*/ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) /* 40M */ tmpCCKindex = tmpCCK40Mindex; else @@ -730,7 +687,6 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) } if (CCKSwingNeedUpdate) { - /*DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index);*/ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } if (priv->OFDM_index != tmpOFDMindex) { @@ -1301,7 +1257,6 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); static u8 TM_Trigger; - /*DbgPrint("dm_CheckTXPowerTracking()\n");*/ if (!priv->btxpower_tracking) return; if (priv->txpower_count <= 2) { @@ -1321,7 +1276,6 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) TM_Trigger = 1; return; } - /*DbgPrint("Schedule TxPowerTrackingWorkItem\n");*/ queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0); TM_Trigger = 0; } @@ -1329,7 +1283,6 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) static void dm_check_txpower_tracking(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - /*static u32 tx_power_track_counter = 0;*/ #ifdef RTL8190P dm_CheckTXPowerTracking_TSSI(dev); @@ -1414,7 +1367,6 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_DebugPort, TempVal); } else { - /*priv->CCKTxPowerAdjustCntNotCh14++; cosa add for debug.*/ /* Write 0xa22 0xa23 */ TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + (CCKSwingTable_Ch14[priv->CCK_index][1]<<8); @@ -1497,10 +1449,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) ratr_value = reg_ratr; if (priv->rf_type == RF_1T2R) { /* 1T2R, Spatial Stream 2 should be disabled */ ratr_value &= ~(RATE_ALL_OFDM_2SS); - /*DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value);*/ } - /*DbgPrint("set HW_VAR_TATR_0 = 0x%x\n", ratr_value);*/ - /*cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]);*/ write_nic_dword(dev, RATR0, ratr_value); write_nic_byte(dev, UFWP, 1); } @@ -1522,7 +1471,6 @@ static void dm_bb_initialgain_restore(struct net_device *dev) return; /* Disable Initial Gain */ - /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */ rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask, (u32)priv->initgain_backup.xaagccore1); rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask, (u32)priv->initgain_backup.xbagccore1); @@ -1537,7 +1485,6 @@ static void dm_bb_initialgain_restore(struct net_device *dev) RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n", priv->initgain_backup.xdagccore1); RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n", priv->initgain_backup.cca); /* Enable Initial Gain */ - /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100);*/ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */ } /* dm_BBInitialGainRestore */ @@ -1550,7 +1497,6 @@ static void dm_bb_initialgain_backup(struct net_device *dev) if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) return; - /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */ priv->initgain_backup.xaagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, bit_mask); priv->initgain_backup.xbagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, bit_mask); @@ -1643,7 +1589,6 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi( if (!dm_digtable.dig_enable_flag) return; - /*DbgPrint("Dig by Sw Rssi\n");*/ if (dm_digtable.dig_algorithm_switch) /* if switched algorithm, we have to disable FW Dig. */ fw_dig = 0; @@ -1660,11 +1605,7 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi( else dm_digtable.cur_connect_state = DIG_DISCONNECT; - /*DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d\n", - DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);*/ - dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb; - /*DbgPrint("DM_DigTable.Rssi_val = %d\n", DM_DigTable.Rssi_val);*/ dm_initial_gain(dev); dm_pd_th(dev); dm_cs_ratio(dev); @@ -1700,11 +1641,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh)) return; - /*DbgPrint("Dig by Fw False Alarm\n");*/ - /*if (DM_DigTable.Dig_State == DM_STA_DIG_OFF)*/ - /*DbgPrint("DIG Check\n\r RSSI=%d LOW=%d HIGH=%d STATE=%d", - pHalData->UndecoratedSmoothedPWDB, DM_DigTable.RssiLowThresh, - DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/ /* 1. When RSSI decrease, We have to judge if it is smaller than a threshold * and then execute the step below. */ @@ -1737,12 +1673,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. */ write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); - /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(pAdapter, rOFDM0_RxDetector1, 0x40); - else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E) - else - PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40); - */ } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); @@ -1750,7 +1680,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( write_nic_byte(dev, 0xa0a, 0x08); /* 1.5 Higher EDCCA. */ - /*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x325);*/ return; } @@ -1771,7 +1700,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( reset_cnt = priv->reset_count; dm_digtable.dig_state = DM_STA_DIG_ON; - /*DbgPrint("DIG ON\n\r");*/ /* 2.1 Set initial gain. * 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment. @@ -1794,13 +1722,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. */ write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); - /* - else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); - else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E) - else - PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42); - */ } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); @@ -1810,7 +1731,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( /* 2.4 Lower EDCCA. * 2008/01/11 MH 90/92 series are the same. */ - /*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x346);*/ /* 2.5 DIG On. */ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */ @@ -1856,11 +1776,6 @@ static void dm_ctrl_initgain_byrssi_highpwr( /* 3.1 Higher PD_TH for OFDM for high power state. */ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); - - /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); - */ - } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); } else { @@ -1874,10 +1789,6 @@ static void dm_ctrl_initgain_byrssi_highpwr( /* 3.2 Recover PD_TH for OFDM for normal power region. */ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); - /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); - */ - } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); } @@ -1919,7 +1830,6 @@ static void dm_initial_gain( dm_digtable.cur_ig_value = priv->DefaultInitialGain[0]; dm_digtable.pre_ig_value = 0; } - /*DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue);*/ /* if silent reset happened, we should rewrite the values back */ if (priv->reset_count != reset_cnt) { @@ -1935,7 +1845,6 @@ static void dm_initial_gain( if ((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value) || !initialized || force_write) { initial_gain = (u8)dm_digtable.cur_ig_value; - /*DbgPrint("Write initial gain = 0x%x\n", initial_gain);*/ /* Set initial gain. */ write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); @@ -1987,7 +1896,6 @@ static void dm_pd_th( { if ((dm_digtable.prepd_thstate != dm_digtable.curpd_thstate) || (initialized <= 3) || force_write) { - /*DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState);*/ if (dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER) { /* Lower PD_TH for OFDM. */ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { @@ -1995,9 +1903,6 @@ static void dm_pd_th( * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. */ write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); - /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); - */ } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); } else if (dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER) { @@ -2007,18 +1912,12 @@ static void dm_pd_th( * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. */ write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); - /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); - */ } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); } else if (dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER) { /* Higher PD_TH for OFDM for high power state. */ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); - /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) - write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); - */ } else write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); } @@ -2065,7 +1964,6 @@ static void dm_cs_ratio( { if ((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) || !initialized || force_write) { - /*DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);*/ if (dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER) { /* Lower CS ratio for CCK. */ write_nic_byte(dev, 0xa0a, 0x08); @@ -2094,7 +1992,6 @@ static void dm_check_edca_turbo( { struct r8192_priv *priv = ieee80211_priv(dev); PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; - /*PSTA_QOS pStaQos = pMgntInfo->pStaQos;*/ /* Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. */ static unsigned long lastTxOkCnt; @@ -2111,20 +2008,16 @@ static void dm_check_edca_turbo( if (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO) goto dm_CheckEdcaTurbo_EXIT; - /*printk("========>%s():bis_any_nonbepkts is %d\n", __func__, priv->bis_any_nonbepkts);*/ - /* Check the status for current condition. */ if (!priv->ieee80211->bis_any_nonbepkts) { curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt; curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; /* For RT-AP, we needs to turn it on when Rx>Tx */ if (curRxOkCnt > 4*curTxOkCnt) { - /*printk("%s():curRxOkCnt > 4*curTxOkCnt\n");*/ if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { write_nic_dword(dev, EDCAPARA_BE, edca_setting_DL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = true; } } else { - /*printk("%s():curRxOkCnt < 4*curTxOkCnt\n");*/ if (priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { write_nic_dword(dev, EDCAPARA_BE, edca_setting_UL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = false; @@ -2224,7 +2117,6 @@ static void dm_ctstoself(struct net_device *dev) curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; if (curRxOkCnt > 4*curTxOkCnt) { /* downlink, disable CTS to self */ pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; - /*DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n");*/ } else { /* uplink */ pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; } @@ -2279,7 +2171,6 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, rfpath_check_wq); struct net_device *dev = priv->ieee80211->dev; - /*bool bactually_set = false;*/ u8 rfpath = 0, i; /* 2008/01/30 MH After discussing with SD3 Jerry, 0xc04/0xd04 register will @@ -2343,7 +2234,6 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev) if (priv->ieee80211->mode == WIRELESS_MODE_B) { DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2; /* pure B mode, fixed cck version2 */ - /*DbgPrint("Pure B mode, use cck rx version2\n");*/ } /* decide max/sec/min rssi index */ @@ -2496,7 +2386,6 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev) if ((DM_RxPathSelTable.disabled_rf >> i) & 0x1) { /* disabled rf */ if (tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i]) { /* enable the BB Rx path */ - /*DbgPrint("RF-%d is enabled.\n", 0x1<framesync); reg_c38_State = RegC38_Default; - /*DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x\n", pHalData->framesync);*/ } } } else { if (reg_c38_State) { write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); reg_c38_State = RegC38_Default; - /*DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x\n", pHalData->framesync);*/ } } } @@ -2808,13 +2694,11 @@ void dm_check_fsync(struct net_device *dev) write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); reg_c38_State = RegC38_Default; reset_cnt = priv->reset_count; - /*DbgPrint("reg_c38_State = 0 for silent reset.\n");*/ } } else { if (reg_c38_State) { write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); reg_c38_State = RegC38_Default; - /*DbgPrint("framesync no monitor, write 0xc38 = 0x%x\n", pHalData->framesync);*/ } } } @@ -2856,7 +2740,6 @@ static void dm_dynamic_txpower(struct net_device *dev) priv->bDynamicTxLowPower = false; return; } - /*printk("priv->ieee80211->current_network.unknown_cap_exist is %d , priv->ieee80211->current_network.broadcom_cap_exist is %d\n", priv->ieee80211->current_network.unknown_cap_exist, priv->ieee80211->current_network.broadcom_cap_exist);*/ if ((priv->ieee80211->current_network.atheros_cap_exist) && (priv->ieee80211->mode == IEEE_G)) { txhipower_threshold = TX_POWER_ATHEROAP_THRESH_HIGH; txlowpower_threshold = TX_POWER_ATHEROAP_THRESH_LOW; @@ -2865,7 +2748,6 @@ static void dm_dynamic_txpower(struct net_device *dev) txlowpower_threshold = TX_POWER_NEAR_FIELD_THRESH_LOW; } - /*printk("=======>%s(): txhipower_threshold is %d, txlowpower_threshold is %d\n", __func__, txhipower_threshold, txlowpower_threshold);*/ RT_TRACE(COMP_TXAGC, "priv->undecorated_smoothed_pwdb = %ld\n", priv->undecorated_smoothed_pwdb); if (priv->ieee80211->state == IEEE80211_LINKED) { @@ -2884,7 +2766,6 @@ static void dm_dynamic_txpower(struct net_device *dev) priv->bDynamicTxLowPower = false; } } else { - /*pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;*/ priv->bDynamicTxHighPower = false; priv->bDynamicTxLowPower = false; } @@ -2911,14 +2792,10 @@ static void dm_check_txrateandretrycount(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee80211; /* for 11n tx rate */ - /*priv->stats.CurrentShowTxate = read_nic_byte(dev, CURRENT_TX_RATE_REG);*/ read_nic_byte(dev, CURRENT_TX_RATE_REG, &ieee->softmac_stats.CurrentShowTxate); - /*printk("=============>tx_rate_reg:%x\n", ieee->softmac_stats.CurrentShowTxate);*/ /* for initial tx rate */ - /*priv->stats.last_packet_rate = read_nic_byte(dev, INITIAL_TX_RATE_REG);*/ read_nic_byte(dev, INITIAL_TX_RATE_REG, &ieee->softmac_stats.last_packet_rate); /* for tx retry count */ - /*priv->stats.txretrycount = read_nic_dword(dev, TX_RETRY_COUNT_REG);*/ read_nic_dword(dev, TX_RETRY_COUNT_REG, &ieee->softmac_stats.txretrycount); } From ba25552a58b4e463c6716aaa775936bbb66022c5 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Tue, 28 Mar 2023 00:49:08 +0500 Subject: [PATCH 140/185] staging: rtl8192u: add '*' on subsequent lines in block comment Linux kernel coding style for block comments uses a column of '*' on the left side. Fix block comment by adding '*' on subsequent lines as reported by checkatch.pl script. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/3a581aae65a152ce41fdd2db667574eba1783113.1679945728.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index e5c0bece4bb4..dd9903719c20 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -1,13 +1,14 @@ // SPDX-License-Identifier: GPL-2.0 /*++ -Copyright-c Realtek Semiconductor Corp. All rights reserved. - -Module Name: - r8192U_dm.c - -Abstract: - HW dynamic mechanism. ---*/ + * Copyright-c Realtek Semiconductor Corp. All rights reserved. + * + * Module Name: + * r8192U_dm.c + * + * Abstract: + * HW dynamic mechanism. + *-- + */ #include "r8192U.h" #include "r8192U_dm.h" #include "r8192U_hw.h" From 63ff870ce0e54f34c4c7a3b95883c30916801400 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Tue, 28 Mar 2023 00:49:09 +0500 Subject: [PATCH 141/185] staging: rtl8192u: add '*/' on separate line in block comments Linux kernel coding style uses '*/' on a separate line at the end of multi line comments. Fix block comments by moving '*/' at the end of block comments on a separate line as reported by checkpatch.pl script. Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/140e0928531e61dc7396271a5b16a6be17514c76.1679945728.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index dd9903719c20..cbae852478ea 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -244,7 +244,8 @@ void init_rate_adaptive(struct net_device *dev) * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void dm_check_rate_adaptive(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -1525,7 +1526,8 @@ static void dm_bb_initialgain_backup(struct net_device *dev) * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void dm_dig_init(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -1565,7 +1567,8 @@ static void dm_dig_init(struct net_device *dev) * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void dm_ctrl_initgain_byrssi(struct net_device *dev) { if (!dm_digtable.dig_enable_flag) @@ -1751,7 +1754,8 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void dm_ctrl_initgain_byrssi_highpwr( struct net_device *dev) { @@ -2137,7 +2141,8 @@ static void dm_ctstoself(struct net_device *dev) * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void dm_check_pbc_gpio(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -2166,7 +2171,8 @@ static void dm_check_pbc_gpio(struct net_device *dev) * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) { struct delayed_work *dwork = to_delayed_work(work); @@ -2407,7 +2413,8 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev) * Output: NONE * * Return: NONE - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void dm_check_rx_path_selection(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); From 0cda003f1d9e662e55660c657e37f6f1e66437b6 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Tue, 28 Mar 2023 03:00:57 +0500 Subject: [PATCH 142/185] staging: rtl8192e: fix unbalanced braces around else Balance if/else braces as recommended by checkpatch.pl Signed-off-by: Khadija Kamran Link: https://lore.kernel.org/r/ZCISGaFELBfDyGRT@khadija-virtual-machine Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_TSProc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 68c131afc2ba..c61fdf73c572 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -517,6 +517,7 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS) netdev_dbg(ieee->dev, "Immediately Start ADDBA\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies + 10); } - } else + } else { netdev_dbg(ieee->dev, "BA timer is already added\n"); + } } From a8a9e95243581d4f30295960f968d56a401c0eb1 Mon Sep 17 00:00:00 2001 From: Daniel Watson Date: Tue, 28 Mar 2023 17:29:58 -0700 Subject: [PATCH 143/185] staging: rtl8723bs: conform if's braces to kernel style Move the open brace of if-statements to the same line. This matches the brace placement style described in the kernel's style guide. Signed-off-by: Daniel Watson Link: https://lore.kernel.org/r/ZCOGhkLvLtBEo92Y@trent-reznor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/rtw_recv.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 44f67103503a..fef2fd0e8c84 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -398,8 +398,7 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, signed int sz) precvframe->u.hdr.rx_data += sz; - if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) - { + if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) { precvframe->u.hdr.rx_data -= sz; return NULL; } @@ -425,8 +424,7 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, signed int sz) precvframe->u.hdr.rx_tail += sz; - if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) - { + if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) { precvframe->u.hdr.rx_tail = prev_rx_tail; return NULL; } @@ -451,8 +449,7 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, signed int s precvframe->u.hdr.rx_tail -= sz; - if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) - { + if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) { precvframe->u.hdr.rx_tail += sz; return NULL; } From 63b2af49654b11b57ca1746e48c1ac63e0bd6de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:39:51 +0200 Subject: [PATCH 144/185] staging: axis-fifo: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-2-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/axis-fifo/axis-fifo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 0a85ea667a1b..7a21f2423204 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -916,15 +916,13 @@ err_initial: return rc; } -static int axis_fifo_remove(struct platform_device *pdev) +static void axis_fifo_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct axis_fifo *fifo = dev_get_drvdata(dev); misc_deregister(&fifo->miscdev); dev_set_drvdata(dev, NULL); - - return 0; } static const struct of_device_id axis_fifo_of_match[] = { @@ -939,7 +937,7 @@ static struct platform_driver axis_fifo_driver = { .of_match_table = axis_fifo_of_match, }, .probe = axis_fifo_probe, - .remove = axis_fifo_remove, + .remove_new = axis_fifo_remove, }; static int __init axis_fifo_init(void) From 68c8e9ff5d32d0ce34f972746b96d1e4a2f5b042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:39:52 +0200 Subject: [PATCH 145/185] staging: emxx_udc: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-3-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index f9765841c4aa..eb63daaca702 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -3137,7 +3137,7 @@ static void nbu2ss_drv_shutdown(struct platform_device *pdev) } /*-------------------------------------------------------------------------*/ -static int nbu2ss_drv_remove(struct platform_device *pdev) +static void nbu2ss_drv_remove(struct platform_device *pdev) { struct nbu2ss_udc *udc; struct nbu2ss_ep *ep; @@ -3154,8 +3154,6 @@ static int nbu2ss_drv_remove(struct platform_device *pdev) /* Interrupt Handler - Release */ free_irq(vbus_irq, udc); - - return 0; } /*-------------------------------------------------------------------------*/ @@ -3210,7 +3208,7 @@ static int nbu2ss_drv_resume(struct platform_device *pdev) static struct platform_driver udc_driver = { .probe = nbu2ss_drv_probe, .shutdown = nbu2ss_drv_shutdown, - .remove = nbu2ss_drv_remove, + .remove_new = nbu2ss_drv_remove, .suspend = nbu2ss_drv_suspend, .resume = nbu2ss_drv_resume, .driver = { From ba110722924c1b2c111170736278d87ee381484b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:39:53 +0200 Subject: [PATCH 146/185] staging: fieldbus: arcx-anybus: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-4-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fieldbus/anybuss/arcx-anybus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c index 9af2e63050d1..afef35bbea74 100644 --- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c +++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c @@ -321,7 +321,7 @@ out_reset: return err; } -static int controller_remove(struct platform_device *pdev) +static void controller_remove(struct platform_device *pdev) { struct controller_priv *cd = platform_get_drvdata(pdev); int id = cd->class_dev->id; @@ -329,7 +329,6 @@ static int controller_remove(struct platform_device *pdev) device_unregister(cd->class_dev); ida_simple_remove(&controller_index_ida, id); gpiod_set_value_cansleep(cd->reset_gpiod, 1); - return 0; } static const struct of_device_id controller_of_match[] = { @@ -341,7 +340,7 @@ MODULE_DEVICE_TABLE(of, controller_of_match); static struct platform_driver controller_driver = { .probe = controller_probe, - .remove = controller_remove, + .remove_new = controller_remove, .driver = { .name = "arcx-anybus-controller", .of_match_table = of_match_ptr(controller_of_match), From 9b19a31c20f1040004e4cbda4945023e2ce86ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:39:54 +0200 Subject: [PATCH 147/185] staging: greybus: arche-apb-ctrl: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-5-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/arche-apb-ctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index 45afa208d004..8541995008da 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -419,13 +419,11 @@ static int arche_apb_ctrl_probe(struct platform_device *pdev) return 0; } -static int arche_apb_ctrl_remove(struct platform_device *pdev) +static void arche_apb_ctrl_remove(struct platform_device *pdev) { device_remove_file(&pdev->dev, &dev_attr_state); poweroff_seq(pdev); platform_set_drvdata(pdev, NULL); - - return 0; } static int __maybe_unused arche_apb_ctrl_suspend(struct device *dev) @@ -471,7 +469,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = { static struct platform_driver arche_apb_ctrl_device_driver = { .probe = arche_apb_ctrl_probe, - .remove = arche_apb_ctrl_remove, + .remove_new = arche_apb_ctrl_remove, .shutdown = arche_apb_ctrl_shutdown, .driver = { .name = "arche-apb-ctrl", From 7846a2ae5ccd1d08bcfff4a6cfedbc33680cf6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:39:55 +0200 Subject: [PATCH 148/185] staging: greybus: arche: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-6-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/arche-platform.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index fcbd5f71eff2..ebe835f25d13 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -559,7 +559,7 @@ static int arche_remove_child(struct device *dev, void *unused) return 0; } -static int arche_platform_remove(struct platform_device *pdev) +static void arche_platform_remove(struct platform_device *pdev) { struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev); @@ -570,8 +570,6 @@ static int arche_platform_remove(struct platform_device *pdev) if (usb3613_hub_mode_ctrl(false)) dev_warn(arche_pdata->dev, "failed to control hub device\n"); - /* TODO: Should we do anything more here ?? */ - return 0; } static __maybe_unused int arche_platform_suspend(struct device *dev) @@ -631,7 +629,7 @@ MODULE_DEVICE_TABLE(of, arche_combined_id); static struct platform_driver arche_platform_device_driver = { .probe = arche_platform_probe, - .remove = arche_platform_remove, + .remove_new = arche_platform_remove, .shutdown = arche_platform_shutdown, .driver = { .name = "arche-platform-ctrl", From 51559b8e9bf9e3324413ab1c171df05d408dd81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:07 +0200 Subject: [PATCH 149/185] staging: most: dim2: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-18-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/dim2/dim2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c index 9fa665c4038f..44d3252d4612 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -908,13 +908,11 @@ err_free_dev: * * Unregister the interface from mostcore */ -static int dim2_remove(struct platform_device *pdev) +static void dim2_remove(struct platform_device *pdev) { struct dim2_hdm *dev = platform_get_drvdata(pdev); most_deregister_interface(&dev->most_iface); - - return 0; } /* platform specific functions [[ */ @@ -1092,7 +1090,7 @@ MODULE_DEVICE_TABLE(of, dim2_of_match); static struct platform_driver dim2_driver = { .probe = dim2_probe, - .remove = dim2_remove, + .remove_new = dim2_remove, .driver = { .name = "hdm_dim2", .of_match_table = dim2_of_match, From 398296fd509df4d36b8b09bb0c839e80ebb9a05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:08 +0200 Subject: [PATCH 150/185] staging: nvec: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-19-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index b3f114cb00dc..2823cacde130 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -882,7 +882,7 @@ static int tegra_nvec_probe(struct platform_device *pdev) return 0; } -static int tegra_nvec_remove(struct platform_device *pdev) +static void tegra_nvec_remove(struct platform_device *pdev) { struct nvec_chip *nvec = platform_get_drvdata(pdev); @@ -893,8 +893,6 @@ static int tegra_nvec_remove(struct platform_device *pdev) cancel_work_sync(&nvec->tx_work); /* FIXME: needs check whether nvec is responsible for power off */ pm_power_off = NULL; - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -942,7 +940,7 @@ MODULE_DEVICE_TABLE(of, nvidia_nvec_of_match); static struct platform_driver nvec_device_driver = { .probe = tegra_nvec_probe, - .remove = tegra_nvec_remove, + .remove_new = tegra_nvec_remove, .driver = { .name = "nvec", .pm = &nvec_pm_ops, From 46ea3230264b591dcabbceb06e87fc33236900a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:09 +0200 Subject: [PATCH 151/185] staging: nvec: nvec_kbd: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-20-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec_kbd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c index 386d619e3ee9..f9a1da952c0a 100644 --- a/drivers/staging/nvec/nvec_kbd.c +++ b/drivers/staging/nvec/nvec_kbd.c @@ -161,7 +161,7 @@ static int nvec_kbd_probe(struct platform_device *pdev) return 0; } -static int nvec_kbd_remove(struct platform_device *pdev) +static void nvec_kbd_remove(struct platform_device *pdev) { struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); char disable_kbd[] = { NVEC_KBD, DISABLE_KBD }, @@ -170,13 +170,11 @@ static int nvec_kbd_remove(struct platform_device *pdev) nvec_write_async(nvec, uncnfg_wake_key_reporting, 3); nvec_write_async(nvec, disable_kbd, 2); nvec_unregister_notifier(nvec, &keys_dev.notifier); - - return 0; } static struct platform_driver nvec_kbd_driver = { .probe = nvec_kbd_probe, - .remove = nvec_kbd_remove, + .remove_new = nvec_kbd_remove, .driver = { .name = "nvec-kbd", }, From f1e870c45be5b6262dc452b7131ab81290ad7180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:10 +0200 Subject: [PATCH 152/185] staging: nvec_power: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-21-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec_power.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index b1ef196e1cfe..9943b1fff190 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c @@ -416,7 +416,7 @@ static int nvec_power_probe(struct platform_device *pdev) return PTR_ERR_OR_ZERO(*psy); } -static int nvec_power_remove(struct platform_device *pdev) +static void nvec_power_remove(struct platform_device *pdev) { struct nvec_power *power = platform_get_drvdata(pdev); @@ -429,13 +429,11 @@ static int nvec_power_remove(struct platform_device *pdev) case BAT: power_supply_unregister(nvec_bat_psy); } - - return 0; } static struct platform_driver nvec_power_driver = { .probe = nvec_power_probe, - .remove = nvec_power_remove, + .remove_new = nvec_power_remove, .driver = { .name = "nvec-power", } From cedff4e3e23c5b26c64e901b139fe88b89678540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:11 +0200 Subject: [PATCH 153/185] staging: nvec_ps2: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-22-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec_ps2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 06041c7f7d4f..cb6d71b8dc83 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -125,7 +125,7 @@ static int nvec_mouse_probe(struct platform_device *pdev) return 0; } -static int nvec_mouse_remove(struct platform_device *pdev) +static void nvec_mouse_remove(struct platform_device *pdev) { struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); @@ -133,8 +133,6 @@ static int nvec_mouse_remove(struct platform_device *pdev) ps2_stopstreaming(ps2_dev.ser_dev); nvec_unregister_notifier(nvec, &ps2_dev.notifier); serio_unregister_port(ps2_dev.ser_dev); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -166,7 +164,7 @@ static SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend, static struct platform_driver nvec_mouse_driver = { .probe = nvec_mouse_probe, - .remove = nvec_mouse_remove, + .remove_new = nvec_mouse_remove, .driver = { .name = "nvec-mouse", .pm = &nvec_mouse_pm_ops, From c46d4073ec6871c3531fa96c49bf45c8598bf791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:12 +0200 Subject: [PATCH 154/185] staging: octeon: ethernet: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-23-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index f662739137b5..9eee28f2940c 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -924,7 +924,7 @@ static int cvm_oct_probe(struct platform_device *pdev) return 0; } -static int cvm_oct_remove(struct platform_device *pdev) +static void cvm_oct_remove(struct platform_device *pdev) { int port; @@ -965,7 +965,6 @@ static int cvm_oct_remove(struct platform_device *pdev) if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL) cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128); - return 0; } static const struct of_device_id cvm_oct_match[] = { @@ -978,7 +977,7 @@ MODULE_DEVICE_TABLE(of, cvm_oct_match); static struct platform_driver cvm_oct_driver = { .probe = cvm_oct_probe, - .remove = cvm_oct_remove, + .remove_new = cvm_oct_remove, .driver = { .name = KBUILD_MODNAME, .of_match_table = cvm_oct_match, From 360365104dca5d3f6e5f1c00dd16e7a9996406f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:13 +0200 Subject: [PATCH 155/185] staging: vc04_services: bcm2835-camera: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-24-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 4f81765912ea..346d00df815a 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1976,7 +1976,7 @@ cleanup_mmal: return ret; } -static int bcm2835_mmal_remove(struct platform_device *pdev) +static void bcm2835_mmal_remove(struct platform_device *pdev) { int camera; struct vchiq_mmal_instance *instance = gdev[0]->instance; @@ -1986,13 +1986,11 @@ static int bcm2835_mmal_remove(struct platform_device *pdev) gdev[camera] = NULL; } vchiq_mmal_finalise(instance); - - return 0; } static struct platform_driver bcm2835_camera_driver = { .probe = bcm2835_mmal_probe, - .remove = bcm2835_mmal_remove, + .remove_new = bcm2835_mmal_remove, .driver = { .name = "bcm2835-camera", }, From e3e1e149176c7c9371b04d3b96c873cca31f520e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 3 Apr 2023 17:40:14 +0200 Subject: [PATCH 156/185] staging: vc04_services: vchiq_arm: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230403154014.2564054-25-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index cddcd3c596c9..40dd62cf7399 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1849,14 +1849,12 @@ error_exit: return err; } -static int vchiq_remove(struct platform_device *pdev) +static void vchiq_remove(struct platform_device *pdev) { platform_device_unregister(bcm2835_audio); platform_device_unregister(bcm2835_camera); vchiq_debugfs_deinit(); vchiq_deregister_chrdev(); - - return 0; } static struct platform_driver vchiq_driver = { @@ -1865,7 +1863,7 @@ static struct platform_driver vchiq_driver = { .of_match_table = vchiq_of_match, }, .probe = vchiq_probe, - .remove = vchiq_remove, + .remove_new = vchiq_remove, }; static int __init vchiq_driver_init(void) From 80472350d9d1b8c4094b48a2dc8fdea172dab85b Mon Sep 17 00:00:00 2001 From: Lukas Bulwahn Date: Wed, 29 Mar 2023 09:43:42 +0200 Subject: [PATCH 157/185] staging: vme: clean up duplicate definitions of dependencies The file staging/vme_user/Kconfig is only included by the top-level staging/Kconfig if STAGING is enabled. So, there is no need to mention the dependency on STAGING within the vme_user Kconfig file. Further, the config VME_USER is already within the "if VME_BUS" block, so there is no need to mention the dependency on VME_BUS. Clean up these duplications of dependencies. No semantic change. Signed-off-by: Lukas Bulwahn Link: https://lore.kernel.org/r/20230329074342.27595-1-lukas.bulwahn@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vme_user/Kconfig b/drivers/staging/vme_user/Kconfig index c8eabf8f40f1..d65cc5510649 100644 --- a/drivers/staging/vme_user/Kconfig +++ b/drivers/staging/vme_user/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 menuconfig VME_BUS bool "VME bridge support" - depends on STAGING && PCI + depends on PCI help If you say Y here you get support for the VME bridge Framework. @@ -28,7 +28,6 @@ comment "VME Device Drivers" config VME_USER tristate "VME user space access driver" - depends on STAGING && VME_BUS help If you say Y here you want to be able to access a limited number of VME windows in a manner at least semi-compatible with the interface From 7c2455436242b1187e86e954aae4b04cfc81b14c Mon Sep 17 00:00:00 2001 From: Daniel Watson Date: Fri, 31 Mar 2023 16:00:24 -0700 Subject: [PATCH 158/185] staging: rtl8723bs: indent with tab, align with space Use tabs to indent code and spaces to align in order to make the code consistent and easier to read. Signed-off-by: Daniel Watson Link: https://lore.kernel.org/r/ZCdmCBIdabBGqm11@trent-reznor Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/include/ieee80211.h | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index 9041d8dc5fb1..1098b0209200 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h @@ -174,7 +174,7 @@ struct ieee_param { u8 reserved[32]; u8 data[]; } wpa_ie; - struct{ + struct{ int command; int reason_code; } mlme; @@ -271,10 +271,10 @@ struct eapol { #define P80211_OUI_LEN 3 struct ieee80211_snap_hdr { - u8 dsap; /* always 0xAA */ - u8 ssap; /* always 0xAA */ - u8 ctrl; /* always 0x03 */ - u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ } __attribute__ ((packed)); #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) @@ -342,12 +342,13 @@ struct ieee80211_snap_hdr { #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) -#define IEEE80211_CCK_RATES_MASK 0x0000000F +#define IEEE80211_CCK_RATES_MASK 0x0000000F #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ IEEE80211_CCK_RATE_2MB_MASK) -#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ - IEEE80211_CCK_RATE_5MB_MASK | \ - IEEE80211_CCK_RATE_11MB_MASK) +#define IEEE80211_CCK_DEFAULT_RATES_MASK \ + (IEEE80211_CCK_BASIC_RATES_MASK | \ + IEEE80211_CCK_RATE_5MB_MASK | \ + IEEE80211_CCK_RATE_11MB_MASK) #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ @@ -359,8 +360,9 @@ struct ieee80211_snap_hdr { IEEE80211_OFDM_RATE_36MB_MASK | \ IEEE80211_OFDM_RATE_48MB_MASK | \ IEEE80211_OFDM_RATE_54MB_MASK) -#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) +#define IEEE80211_DEFAULT_RATES_MASK \ + (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ + IEEE80211_CCK_DEFAULT_RATES_MASK) #define IEEE80211_NUM_OFDM_RATES 8 #define IEEE80211_NUM_CCK_RATES 4 @@ -509,7 +511,7 @@ join_res: static inline int is_multicast_mac_addr(const u8 *addr) { - return ((addr[0] != 0xff) && (0x01 & addr[0])); + return ((addr[0] != 0xff) && (0x01 & addr[0])); } static inline int is_broadcast_mac_addr(const u8 *addr) @@ -612,17 +614,18 @@ enum { * @RTW_IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel * is not permitted. */ - enum rtw_ieee80211_channel_flags { - RTW_IEEE80211_CHAN_DISABLED = 1<<0, - RTW_IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, - RTW_IEEE80211_CHAN_NO_IBSS = 1<<2, - RTW_IEEE80211_CHAN_RADAR = 1<<3, - RTW_IEEE80211_CHAN_NO_HT40PLUS = 1<<4, - RTW_IEEE80211_CHAN_NO_HT40MINUS = 1<<5, - }; +enum rtw_ieee80211_channel_flags { + RTW_IEEE80211_CHAN_DISABLED = 1<<0, + RTW_IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, + RTW_IEEE80211_CHAN_NO_IBSS = 1<<2, + RTW_IEEE80211_CHAN_RADAR = 1<<3, + RTW_IEEE80211_CHAN_NO_HT40PLUS = 1<<4, + RTW_IEEE80211_CHAN_NO_HT40MINUS = 1<<5, +}; - #define RTW_IEEE80211_CHAN_NO_HT40 \ - (RTW_IEEE80211_CHAN_NO_HT40PLUS | RTW_IEEE80211_CHAN_NO_HT40MINUS) +#define RTW_IEEE80211_CHAN_NO_HT40 \ + (RTW_IEEE80211_CHAN_NO_HT40PLUS | \ + RTW_IEEE80211_CHAN_NO_HT40MINUS) /* Represent channel details, subset of ieee80211_channel */ struct rtw_ieee80211_channel { From d8571801a61c01841ac1813e0fb97048c2505a6a Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 2 Apr 2023 11:51:42 +0200 Subject: [PATCH 159/185] staging: rtl8192e: Remove RF_Type from .._dm_tx_update_tssi_weak_signal Remove RF_Type from _rtl92e_dm_tx_update_tssi_weak_signal and _rtl92e_dm_tx_update_tssi_strong_signal as it is unused. Reported-by: kernel test robot Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/95744a9d271723b44b92465809d092f90edf9bc9.1680427945.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index b5f4d0230da7..258ea66ab2fd 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -475,8 +475,7 @@ static u8 CCKSwingTable_Ch14[CCK_TABLE_LEN][8] = { #define Tssi_Report_Value2 0x13e #define FW_Busy_Flag 0x13f -static void _rtl92e_dm_tx_update_tssi_weak_signal(struct net_device *dev, - u8 RF_Type) +static void _rtl92e_dm_tx_update_tssi_weak_signal(struct net_device *dev) { struct r8192_priv *p = rtllib_priv(dev); @@ -495,8 +494,7 @@ static void _rtl92e_dm_tx_update_tssi_weak_signal(struct net_device *dev, } } -static void _rtl92e_dm_tx_update_tssi_strong_signal(struct net_device *dev, - u8 RF_Type) +static void _rtl92e_dm_tx_update_tssi_strong_signal(struct net_device *dev) { struct r8192_priv *p = rtllib_priv(dev); @@ -610,10 +608,9 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) return; } if (Avg_TSSI_Meas_from_driver < tssi_13dBm - E_FOR_TX_POWER_TRACK) - _rtl92e_dm_tx_update_tssi_weak_signal(dev, - RF_Type); + _rtl92e_dm_tx_update_tssi_weak_signal(dev); else - _rtl92e_dm_tx_update_tssi_strong_signal(dev, RF_Type); + _rtl92e_dm_tx_update_tssi_strong_signal(dev); priv->cck_present_attn_diff = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default; From b7119698bcca83d6d755b866bcf7328314d9cde0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 2 Apr 2023 11:51:47 +0200 Subject: [PATCH 160/185] staging: rtl8192e: Remove enum RF_1T2R and RF_Type enum RF_1T2R is used to initialize a local variable RF_Type that is then shifted. The result of the shift is zero. Remove code that has always the same result to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/6c29e709f5c328703870ca8e7d61ee6338886fa7.1680427945.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 5 ++--- drivers/staging/rtl8192e/rtllib.h | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 258ea66ab2fd..a21b3798db48 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -518,7 +518,7 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) struct dcmd_txcmd tx_cmd; u8 powerlevelOFDM24G; int i = 0, j = 0, k = 0; - u8 RF_Type, tmp_report[5] = {0, 0, 0, 0, 0}; + u8 tmp_report[5] = {0, 0, 0, 0, 0}; u32 Value; u8 Pwr_Flag; u16 Avg_TSSI_Meas, tssi_13dBm, Avg_TSSI_Meas_from_driver = 0; @@ -529,8 +529,7 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) priv->rtllib->bdynamic_txpower_enable = false; powerlevelOFDM24G = priv->pwr_track >> 24; - RF_Type = RF_1T2R; - Value = (RF_Type<<8) | powerlevelOFDM24G; + Value = powerlevelOFDM24G; for (j = 0; j <= 30; j++) { diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 197c0a44ebd6..7d83a4c322cf 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -433,10 +433,6 @@ enum led_ctl_mode { LED_CTL_START_TO_LINK = 8, }; -enum rt_rf_type_def { - RF_1T2R = 0, -}; - enum wireless_mode { WIRELESS_MODE_UNKNOWN = 0x00, WIRELESS_MODE_A = 0x01, From 0be699ab84b1e796173bbc8a055f8a1b30da85a9 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 2 Apr 2023 11:51:54 +0200 Subject: [PATCH 161/185] staging: rtl8192e: Remove local variable Value and powerlevelOFDM24G powerlevelOFDM24G is set to priv->pwr_track. Then Value is set to powerlevelOFDM24G and then only once used. Remove both variables to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/2076dc2f8f5afc11cbab23bc3f5d4ace9bf33bfd.1680427945.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index a21b3798db48..cde41111012a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -516,10 +516,8 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); bool viviflag = false; struct dcmd_txcmd tx_cmd; - u8 powerlevelOFDM24G; int i = 0, j = 0, k = 0; u8 tmp_report[5] = {0, 0, 0, 0, 0}; - u32 Value; u8 Pwr_Flag; u16 Avg_TSSI_Meas, tssi_13dBm, Avg_TSSI_Meas_from_driver = 0; u32 delta = 0; @@ -528,14 +526,11 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev) rtl92e_writeb(dev, FW_Busy_Flag, 0); priv->rtllib->bdynamic_txpower_enable = false; - powerlevelOFDM24G = priv->pwr_track >> 24; - Value = powerlevelOFDM24G; - for (j = 0; j <= 30; j++) { tx_cmd.op = TXCMD_SET_TX_PWR_TRACKING; tx_cmd.length = 4; - tx_cmd.value = Value; + tx_cmd.value = priv->pwr_track >> 24; rtl92e_send_cmd_pkt(dev, DESC_PACKET_TYPE_NORMAL, (u8 *)&tx_cmd, sizeof(struct dcmd_txcmd)); mdelay(1); From 8e45222d792cf50ff17632892d4ab932a61e62f0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 2 Apr 2023 11:51:59 +0200 Subject: [PATCH 162/185] staging: rtl8192e: Remove case customer_id = RT_CID_DLINK customer_id is initialize to zero. Changing customer_id to RT_CID_DLINK would not change the program execution as there is no equation for RT_CID_DLINK. Remove useless code lines to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/e4ecef11015c32c9909cd07e0939c4de53fd501a.1680427945.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 ------ drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 3 files changed, 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 1da14e737aa4..cbe66b4a6ad9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -431,9 +431,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) else priv->chnl_plan = priv->reg_chnl_plan; - if (priv->eeprom_vid == 0x1186 && priv->eeprom_did == 0x3304) - priv->customer_id = RT_CID_DLINK; - switch (priv->eeprom_customer_id) { case EEPROM_CID_DEFAULT: priv->customer_id = RT_CID_DEFAULT; @@ -460,9 +457,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) case EEPROM_CID_Pronet: priv->customer_id = RT_CID_PRONET; break; - case EEPROM_CID_DLINK: - priv->customer_id = RT_CID_DLINK; - break; case EEPROM_CID_WHQL: break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h index 99640c4779f7..706d024bcfd1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h @@ -37,7 +37,6 @@ enum baseband_config { #define EEPROM_CID_NetCore 0x5 #define EEPROM_CID_Nettronix 0x6 #define EEPROM_CID_Pronet 0x7 -#define EEPROM_CID_DLINK 0x8 #define EEPROM_CID_WHQL 0xFE enum _RTL8192PCI_HW { MAC0 = 0x000, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 1e99eb833405..91d634f5d3e7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -134,7 +134,6 @@ enum rt_customer_id { RT_CID_TOSHIBA = 9, RT_CID_819X_NETCORE = 10, RT_CID_Nettronix = 11, - RT_CID_DLINK = 12, RT_CID_PRONET = 13, }; From 795916c1c8be85fc49bf50823343b075517fe573 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 2 Apr 2023 11:52:05 +0200 Subject: [PATCH 163/185] staging: rtl8192e: Remove case customer_id = RT_CID_819x_CAMEO, .. customer_id is initialize to zero. Changing customer_id to RT_CID_819x_CAMEO, RT_CID_819x_RUNTOP, RT_CID_Nettronix or RT_CID_PRONET would not change the program execution as there is no equation for RT_CID_819x_CAMEO, RT_CID_819x_RUNTOP, RT_CID_Nettronix or RT_CID_PRONET. Remove useless code lines to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/b546933897acc20a6ac5be2bd5ef5ad979599c66.1680427945.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h | 4 ---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 4 ---- 3 files changed, 20 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index cbe66b4a6ad9..df8de35cbe0e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -435,12 +435,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) case EEPROM_CID_DEFAULT: priv->customer_id = RT_CID_DEFAULT; break; - case EEPROM_CID_CAMEO: - priv->customer_id = RT_CID_819x_CAMEO; - break; - case EEPROM_CID_RUNTOP: - priv->customer_id = RT_CID_819x_RUNTOP; - break; case EEPROM_CID_NetCore: priv->customer_id = RT_CID_819X_NETCORE; break; @@ -451,12 +445,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) else priv->chnl_plan = 0x0; break; - case EEPROM_CID_Nettronix: - priv->customer_id = RT_CID_Nettronix; - break; - case EEPROM_CID_Pronet: - priv->customer_id = RT_CID_PRONET; - break; case EEPROM_CID_WHQL: break; diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h index 706d024bcfd1..4ee78b7a558e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h @@ -31,12 +31,8 @@ enum baseband_config { #define EEPROM_TxPwIndex_OFDM_24G 0x3A #define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_CAMEO 0x1 -#define EEPROM_CID_RUNTOP 0x2 #define EEPROM_CID_TOSHIBA 0x4 #define EEPROM_CID_NetCore 0x5 -#define EEPROM_CID_Nettronix 0x6 -#define EEPROM_CID_Pronet 0x7 #define EEPROM_CID_WHQL 0xFE enum _RTL8192PCI_HW { MAC0 = 0x000, diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 91d634f5d3e7..2b2d8af4cf6e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -129,12 +129,8 @@ enum dcmg_txcmd_op { enum rt_customer_id { RT_CID_DEFAULT = 0, - RT_CID_819x_CAMEO = 6, - RT_CID_819x_RUNTOP = 7, RT_CID_TOSHIBA = 9, RT_CID_819X_NETCORE = 10, - RT_CID_Nettronix = 11, - RT_CID_PRONET = 13, }; enum reset_type { From 3642e50acc63b92123b95bf8a63da204e44c4efb Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 2 Apr 2023 11:52:13 +0200 Subject: [PATCH 164/185] staging: rtl8192e: Remove case customer_id = RT_CID_DEFAULT, .. customer_id is initialize to zero. Changing customer_id to RT_CID_DEFAULT will not change customer_id as it is already zero. default and EEPROM_CID_WHQL contain only a break. Remove useless code lines to increase readability. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/58df9db5da84991206266e739b2a12c893d1be8e.1680427945.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 8 -------- drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index df8de35cbe0e..aed53fedeb61 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -432,9 +432,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) priv->chnl_plan = priv->reg_chnl_plan; switch (priv->eeprom_customer_id) { - case EEPROM_CID_DEFAULT: - priv->customer_id = RT_CID_DEFAULT; - break; case EEPROM_CID_NetCore: priv->customer_id = RT_CID_819X_NETCORE; break; @@ -445,11 +442,6 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev) else priv->chnl_plan = 0x0; break; - - case EEPROM_CID_WHQL: - break; - default: - break; } if (priv->chnl_plan > CHANNEL_PLAN_LEN - 1) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h index 4ee78b7a558e..f4d4b01630a2 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h @@ -30,10 +30,8 @@ enum baseband_config { #define EEPROM_TxPwIndex_CCK 0x2C #define EEPROM_TxPwIndex_OFDM_24G 0x3A -#define EEPROM_CID_DEFAULT 0x0 #define EEPROM_CID_TOSHIBA 0x4 #define EEPROM_CID_NetCore 0x5 -#define EEPROM_CID_WHQL 0xFE enum _RTL8192PCI_HW { MAC0 = 0x000, MAC4 = 0x004, From f395d3f9d2d08a8b312eab72b9094f4f9cb72636 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sun, 2 Apr 2023 19:32:42 +0500 Subject: [PATCH 165/185] staging: rtl8192e: remove extra blank lines in rtllib_crypt_ccmp.c Remove extra blank lines as suggested by the Linux kernel coding-style. These issues were reported by checkpatch. "CHECK: Please don't use multiple blank lines" Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/283265f6a5ff938f8425e14af86cee9e2da36318.1680445545.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index a8d22da8bc9a..eb7b6deb2ca7 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -74,7 +74,6 @@ fail: return NULL; } - static void rtllib_ccmp_deinit(void *priv) { struct rtllib_ccmp_data *_priv = priv; @@ -84,7 +83,6 @@ static void rtllib_ccmp_deinit(void *priv) kfree(priv); } - static int ccmp_init_iv_and_aad(struct rtllib_hdr_4addr *hdr, u8 *pn, u8 *iv, u8 *aad) { @@ -150,8 +148,6 @@ static int ccmp_init_iv_and_aad(struct rtllib_hdr_4addr *hdr, return aad_len; } - - static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct rtllib_ccmp_data *key = priv; @@ -220,7 +216,6 @@ static int rtllib_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) return 0; } - static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct rtllib_ccmp_data *key = priv; @@ -315,7 +310,6 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return keyidx; } - static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv) { struct rtllib_ccmp_data *data = priv; @@ -349,7 +343,6 @@ static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv) return 0; } - static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv) { struct rtllib_ccmp_data *data = priv; @@ -373,7 +366,6 @@ static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv) return CCMP_TK_LEN; } - static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) { struct rtllib_ccmp_data *ccmp = priv; @@ -403,13 +395,11 @@ static struct lib80211_crypto_ops rtllib_crypt_ccmp = { .owner = THIS_MODULE, }; - static int __init rtllib_crypto_ccmp_init(void) { return lib80211_register_crypto_ops(&rtllib_crypt_ccmp); } - static void __exit rtllib_crypto_ccmp_exit(void) { lib80211_unregister_crypto_ops(&rtllib_crypt_ccmp); From 7cf3f17b58e20c8a3b9266b8aa205cafb2e10d3c Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sun, 2 Apr 2023 19:32:43 +0500 Subject: [PATCH 166/185] staging: rtl8192e: fix alignment to match open parenthesis Fix alignemnt to match opening parenthesis as suggested by Linux kernel coding-style. This issue is reported by checkpatch. Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/76814f7a2a026ef195334b0c42ecd2aeb8e8ea40.1680445545.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index eb7b6deb2ca7..8d3067a6ccca 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -332,7 +332,7 @@ static int rtllib_ccmp_set_key(void *key, int len, u8 *seq, void *priv) data->rx_pn[5] = seq[0]; } if (crypto_aead_setauthsize(data->tfm, CCMP_MIC_LEN) || - crypto_aead_setkey(data->tfm, data->key, CCMP_TK_LEN)) + crypto_aead_setkey(data->tfm, data->key, CCMP_TK_LEN)) return -1; } else if (len == 0) { data->key_set = 0; From 73749c7fb4ab99eb9930ed400ce56eb18a077983 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sun, 2 Apr 2023 19:32:44 +0500 Subject: [PATCH 167/185] staging: rtl8192e: avoid CamelCase Linux kernel coding-style suggests to not use mixed-case names. Fix checkpatch issue by changing the variable name from camel case to snake case. Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/ebfd9c40400eac872b9af2a5120b0829ff71e077.1680445545.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 8d3067a6ccca..d37ca72678c8 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -34,7 +34,7 @@ struct rtllib_ccmp_data { u8 tx_pn[CCMP_PN_LEN]; u8 rx_pn[CCMP_PN_LEN]; - u32 dot11RSNAStatsCCMPFormatErrors; + u32 dot11rsna_stats_ccmp_format_errors; u32 dot11RSNAStatsCCMPReplays; u32 dot11RSNAStatsCCMPDecryptErrors; @@ -226,7 +226,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 pn[6]; if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { - key->dot11RSNAStatsCCMPFormatErrors++; + key->dot11rsna_stats_ccmp_format_errors++; return -1; } @@ -238,7 +238,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) pr_debug("CCMP: received packet without ExtIV flag from %pM\n", hdr->addr2); } - key->dot11RSNAStatsCCMPFormatErrors++; + key->dot11rsna_stats_ccmp_format_errors++; return -2; } keyidx >>= 6; @@ -374,7 +374,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) "key[%d] alg=CCMP key_set=%d tx_pn=%pM rx_pn=%pM format_errors=%d replays=%d decrypt_errors=%d\n", ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, - ccmp->dot11RSNAStatsCCMPFormatErrors, + ccmp->dot11rsna_stats_ccmp_format_errors, ccmp->dot11RSNAStatsCCMPReplays, ccmp->dot11RSNAStatsCCMPDecryptErrors); } From f60fc1311bcc7601750ec38bb215d6202c1c9461 Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sun, 2 Apr 2023 19:32:45 +0500 Subject: [PATCH 168/185] staging: rtl8192e: avoid CamelCase Linux kernel coding-style suggests to not use mixed-case names. Fix checkpatch issue by changing the variable name from camel case to snake case. Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/7166160c0face9e32dbb28c44727eb8856173f0a.1680445545.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index d37ca72678c8..448c0a931c78 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -35,7 +35,7 @@ struct rtllib_ccmp_data { u8 rx_pn[CCMP_PN_LEN]; u32 dot11rsna_stats_ccmp_format_errors; - u32 dot11RSNAStatsCCMPReplays; + u32 dot11rsna_stats_ccmp_replays; u32 dot11RSNAStatsCCMPDecryptErrors; int key_idx; @@ -263,7 +263,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) pn[5] = pos[0]; pos += 8; if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { - key->dot11RSNAStatsCCMPReplays++; + key->dot11rsna_stats_ccmp_replays++; return -4; } if (!tcb_desc->bHwSec) { @@ -375,7 +375,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, ccmp->dot11rsna_stats_ccmp_format_errors, - ccmp->dot11RSNAStatsCCMPReplays, + ccmp->dot11rsna_stats_ccmp_replays, ccmp->dot11RSNAStatsCCMPDecryptErrors); } From 85f76d9301ff439ef2c11ce0f854468285133f0e Mon Sep 17 00:00:00 2001 From: Khadija Kamran Date: Sun, 2 Apr 2023 19:32:46 +0500 Subject: [PATCH 169/185] staging: rtl8192e: avoid CamelCase Linux kernel coding-style suggests to not use mixed-case names. Fix checkpatch issue by changing the variable name from camel case to snake case. Signed-off-by: Khadija Kamran Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/d29ff5db6f19d79ee762a835db88155bee2aefba.1680445545.git.kamrankhadijadj@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 448c0a931c78..f88096bcb181 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -36,7 +36,7 @@ struct rtllib_ccmp_data { u32 dot11rsna_stats_ccmp_format_errors; u32 dot11rsna_stats_ccmp_replays; - u32 dot11RSNAStatsCCMPDecryptErrors; + u32 dot11rsna_stats_ccmp_decrypt_errors; int key_idx; @@ -296,7 +296,7 @@ static int rtllib_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) pr_debug("CCMP: decrypt failed: STA= %pM\n", hdr->addr2); } - key->dot11RSNAStatsCCMPDecryptErrors++; + key->dot11rsna_stats_ccmp_decrypt_errors++; return -5; } @@ -376,7 +376,7 @@ static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) ccmp->tx_pn, ccmp->rx_pn, ccmp->dot11rsna_stats_ccmp_format_errors, ccmp->dot11rsna_stats_ccmp_replays, - ccmp->dot11RSNAStatsCCMPDecryptErrors); + ccmp->dot11rsna_stats_ccmp_decrypt_errors); } static struct lib80211_crypto_ops rtllib_crypt_ccmp = { From 41500f45356277f20dbca6e40b33f799f3d1e72a Mon Sep 17 00:00:00 2001 From: Sumitra Sharma Date: Tue, 4 Apr 2023 23:30:03 -0700 Subject: [PATCH 170/185] staging: rtl8192e: Add blank lines after declarations Add blank lines after declarations to adhere to the Linux kernel coding-style. Check reported by checkpatch.pl "CHECK: Please use a blank line after function/struct/union/enum declarations" Signed-off-by: Sumitra Sharma Link: https://lore.kernel.org/r/20230405063003.GA218972@sumitra.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 7d83a4c322cf..1a0177cd64af 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -967,6 +967,7 @@ static inline const char *eap_get_type(int type) return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type]; } + static inline u8 Frame_QoSTID(u8 *buf) { struct rtllib_hdr_3addr *hdr; @@ -1199,6 +1200,7 @@ struct rx_reorder_entry { u16 SeqNum; struct rtllib_rxb *prxb; }; + enum fsync_state { Default_Fsync, HW_Fsync, @@ -1325,6 +1327,7 @@ struct sw_cam_table { u8 key_index; }; + #define TOTAL_CAM_ENTRY 32 struct rate_adaptive { u8 rate_adaptive_disabled; From ffc5e1f3585e31c8f3572389a6418f5149db0fad Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 6 Apr 2023 10:18:16 +0200 Subject: [PATCH 171/185] staging: greybus: drop loopback test files The greybus loopback test tool does not belong burried down in a driver-specific directory. If it is needed, it should be somewhere else, like in the testing directory. But as the loopback driver is probably never going to be merged out of the staging directory, let's just delete the test alltogether for now. If it's needed in the future, it can be brought back with a revert. Also, having an Android.mk file in the kernel source tree breaks some Android build systems when trying to build from a read-only source tree, the report of which prompted this being a good reason to remove it as well. Cc: Johan Hovold Cc: Jack Schofield Cc: Vaibhav Nagare Cc: greybus-dev@lists.linaro.org Acked-by: Alex Elder Link: https://lore.kernel.org/r/2023040613-huntsman-goldsmith-4a41@gregkh Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/tools/.gitignore | 2 - drivers/staging/greybus/tools/Android.mk | 10 - drivers/staging/greybus/tools/Makefile | 33 - drivers/staging/greybus/tools/README.loopback | 198 ---- drivers/staging/greybus/tools/lbtest | 169 --- drivers/staging/greybus/tools/loopback_test.c | 979 ------------------ 6 files changed, 1391 deletions(-) delete mode 100644 drivers/staging/greybus/tools/.gitignore delete mode 100644 drivers/staging/greybus/tools/Android.mk delete mode 100644 drivers/staging/greybus/tools/Makefile delete mode 100644 drivers/staging/greybus/tools/README.loopback delete mode 100755 drivers/staging/greybus/tools/lbtest delete mode 100644 drivers/staging/greybus/tools/loopback_test.c diff --git a/drivers/staging/greybus/tools/.gitignore b/drivers/staging/greybus/tools/.gitignore deleted file mode 100644 index 1fd364aba774..000000000000 --- a/drivers/staging/greybus/tools/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -loopback_test diff --git a/drivers/staging/greybus/tools/Android.mk b/drivers/staging/greybus/tools/Android.mk deleted file mode 100644 index fdadbf611757..000000000000 --- a/drivers/staging/greybus/tools/Android.mk +++ /dev/null @@ -1,10 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= loopback_test.c -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := gb_loopback_test - -include $(BUILD_EXECUTABLE) - diff --git a/drivers/staging/greybus/tools/Makefile b/drivers/staging/greybus/tools/Makefile deleted file mode 100644 index a3bbd73171f2..000000000000 --- a/drivers/staging/greybus/tools/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -ifeq ($(strip $(V)), 1) - Q = -else - Q = @ -endif - -CFLAGS += -std=gnu99 -Wall -Wextra -g \ - -D_GNU_SOURCE \ - -Wno-unused-parameter \ - -Wmaybe-uninitialized \ - -Wredundant-decls \ - -Wcast-align \ - -Wsign-compare \ - -Wno-missing-field-initializers \ - -Wno-shift-negative-value - -CC := $(CROSS_COMPILE)gcc - -TOOLS = loopback_test - -all: $(TOOLS) - -%.o: %.c ../greybus_protocols.h - @echo ' TARGET_CC $@' - $(Q)$(CC) $(CFLAGS) -c $< -o $@ - -loopback_%: loopback_%.o - @echo ' TARGET_LD $@' - $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ - -clean:: - rm -f *.o $(TOOLS) diff --git a/drivers/staging/greybus/tools/README.loopback b/drivers/staging/greybus/tools/README.loopback deleted file mode 100644 index 070a510cbe7c..000000000000 --- a/drivers/staging/greybus/tools/README.loopback +++ /dev/null @@ -1,198 +0,0 @@ - - - 1 - LOOPBACK DRIVER - -The driver implements the main logic of the loopback test and provides -sysfs files to configure the test and retrieve the results. -A user could run a test without the need of the test application given -that he understands the sysfs interface of the loopback driver. - -The loopback kernel driver needs to be loaded and at least one module -with the loopback feature enabled must be present for the sysfs files to be -created and for the loopback test application to be able to run. - -To load the module: -# modprobe gb-loopback - - -When the module is probed, New files are available on the sysfs -directory of the detected loopback device. -(typically under "/sys/bus/graybus/devices"). - -Here is a short summary of the sysfs interface files that should be visible: - -* Loopback Configuration Files: - async - Use asynchronous operations. - iteration_max - Number of tests iterations to perform. - size - payload size of the transfer. - timeout - The number of microseconds to give an individual - asynchronous request before timing out. - us_wait - Time to wait between 2 messages - type - By writing the test type to this file, the test starts. - Valid tests are: - 0 stop the test - 2 - ping - 3 - transfer - 4 - sink - -* Loopback feedback files: - error - number of errors that have occurred. - iteration_count - Number of iterations performed. - requests_completed - Number of requests successfully completed. - requests_timedout - Number of requests that have timed out. - timeout_max - Max allowed timeout - timeout_min - Min allowed timeout. - -* Loopback result files: - apbridge_unipro_latency_avg - apbridge_unipro_latency_max - apbridge_unipro_latency_min - gpbridge_firmware_latency_avg - gpbridge_firmware_latency_max - gpbridge_firmware_latency_min - requests_per_second_avg - requests_per_second_max - requests_per_second_min - latency_avg - latency_max - latency_min - throughput_avg - throughput_max - throughput_min - - - - 2 - LOOPBACK TEST APPLICATION - -The loopback test application manages and formats the results provided by -the loopback kernel module. The purpose of this application -is to: - - Start and manage multiple loopback device tests concurrently. - - Calculate the aggregate results for multiple devices. - - Gather and format test results (csv or human readable). - -The best way to get up to date usage information for the application is -usually to pass the "-h" parameter. -Here is the summary of the available options: - - Mandatory arguments - -t must be one of the test names - sink, transfer or ping - -i iteration count - the number of iterations to run the test over - Optional arguments - -S sysfs location - location for greybus 'endo' entries default /sys/bus/greybus/devices/ - -D debugfs location - location for loopback debugfs entries default /sys/kernel/debug/gb_loopback/ - -s size of data packet to send during test - defaults to zero - -m mask - a bit mask of connections to include example: -m 8 = 4th connection -m 9 = 1st and 4th connection etc - default is zero which means broadcast to all connections - -v verbose output - -d debug output - -r raw data output - when specified the full list of latency values are included in the output CSV - -p porcelain - when specified printout is in a user-friendly non-CSV format. This option suppresses writing to CSV file - -a aggregate - show aggregation of all enabled devies - -l list found loopback devices and exit. - -x Async - Enable async transfers. - -o Timeout - Timeout in microseconds for async operations. - - - - 3 - REAL WORLD EXAMPLE USAGES - - 3.1 - Using the driver sysfs files to run a test on a single device: - -* Run a 1000 transfers of a 100 byte packet. Each transfer is started only -after the previous one finished successfully: - echo 0 > /sys/bus/greybus/devices/1-2.17/type - echo 0 > /sys/bus/greybus/devices/1-2.17/async - echo 2000 > /sys/bus/greybus/devices/1-2.17/us_wait - echo 100 > /sys/bus/greybus/devices/1-2.17/size - echo 1000 > /sys/bus/greybus/devices/1-2.17/iteration_max - echo 0 > /sys/bus/greybus/devices/1-2.17/mask - echo 200000 > /sys/bus/greybus/devices/1-2.17/timeout - echo 3 > /sys/bus/greybus/devices/1-2.17/type - -* Run a 1000 transfers of a 100 byte packet. Transfers are started without -waiting for the previous one to finish: - echo 0 > /sys/bus/greybus/devices/1-2.17/type - echo 3 > /sys/bus/greybus/devices/1-2.17/async - echo 0 > /sys/bus/greybus/devices/1-2.17/us_wait - echo 100 > /sys/bus/greybus/devices/1-2.17/size - echo 1000 > /sys/bus/greybus/devices/1-2.17/iteration_max - echo 0 > /sys/bus/greybus/devices/1-2.17/mask - echo 200000 > /sys/bus/greybus/devices/1-2.17/timeout - echo 3 > /sys/bus/greybus/devices/1-2.17/type - -* Read the results from sysfs: - cat /sys/bus/greybus/devices/1-2.17/requests_per_second_min - cat /sys/bus/greybus/devices/1-2.17/requests_per_second_max - cat /sys/bus/greybus/devices/1-2.17/requests_per_second_avg - - cat /sys/bus/greybus/devices/1-2.17/latency_min - cat /sys/bus/greybus/devices/1-2.17/latency_max - cat /sys/bus/greybus/devices/1-2.17/latency_avg - - cat /sys/bus/greybus/devices/1-2.17/apbridge_unipro_latency_min - cat /sys/bus/greybus/devices/1-2.17/apbridge_unipro_latency_max - cat /sys/bus/greybus/devices/1-2.17/apbridge_unipro_latency_avg - - cat /sys/bus/greybus/devices/1-2.17/gpbridge_firmware_latency_min - cat /sys/bus/greybus/devices/1-2.17/gpbridge_firmware_latency_max - cat /sys/bus/greybus/devices/1-2.17/gpbridge_firmware_latency_avg - - cat /sys/bus/greybus/devices/1-2.17/error - cat /sys/bus/greybus/devices/1-2.17/requests_completed - cat /sys/bus/greybus/devices/1-2.17/requests_timedout - - -3.2 - using the test application: - -* Run a transfer test 10 iterations of size 100 bytes on all available devices - #/loopback_test -t transfer -i 10 -s 100 - 1970-1-1 0:10:7,transfer,1-4.17,100,10,0,443,509,471.700012,66,1963,2256,2124.600098,293,102776,118088,109318.898438,15312,1620,1998,1894.099976,378,56,57,56.799999,1 - 1970-1-1 0:10:7,transfer,1-5.17,100,10,0,399,542,463.399994,143,1845,2505,2175.800049,660,92568,125744,107393.296875,33176,1469,2305,1806.500000,836,56,57,56.799999,1 - - -* Show the aggregate results of both devices. ("-a") - #/loopback_test -t transfer -i 10 -s 100 -a - 1970-1-1 0:10:35,transfer,1-4.17,100,10,0,448,580,494.100006,132,1722,2230,2039.400024,508,103936,134560,114515.703125,30624,1513,1980,1806.900024,467,56,57,57.299999,1 - 1970-1-1 0:10:35,transfer,1-5.17,100,10,0,383,558,478.600006,175,1791,2606,2115.199951,815,88856,129456,110919.703125,40600,1457,2246,1773.599976,789,56,57,57.099998,1 - 1970-1-1 0:10:35,transfer,aggregate,100,10,0,383,580,486.000000,197,1722,2606,2077.000000,884,88856,134560,112717.000000,45704,1457,2246,1789.000000,789,56,57,57.000000,1 - -* Example usage of the mask option to select which devices will - run the test (1st, 2nd, or both devices): - # /loopback_test -t transfer -i 10 -s 100 -m 1 - 1970-1-1 0:11:56,transfer,1-4.17,100,10,0,514,558,544.900024,44,1791,1943,1836.599976,152,119248,129456,126301.296875,10208,1600,1001609,101613.601562,1000009,56,57,56.900002,1 - # /loopback_test -t transfer -i 10 -s 100 -m 2 - 1970-1-1 0:12:0,transfer,1-5.17,100,10,0,468,554,539.000000,86,1804,2134,1859.500000,330,108576,128528,124932.500000,19952,1606,1626,1619.300049,20,56,57,57.400002,1 - # /loopback_test -t transfer -i 10 -s 100 -m 3 - 1970-1-1 0:12:3,transfer,1-4.17,100,10,0,432,510,469.399994,78,1959,2313,2135.800049,354,100224,118320,108785.296875,18096,1610,2024,1893.500000,414,56,57,57.200001,1 - 1970-1-1 0:12:3,transfer,1-5.17,100,10,0,404,542,468.799988,138,1843,2472,2152.500000,629,93728,125744,108646.101562,32016,1504,2247,1853.099976,743,56,57,57.099998,1 - -* Show output in human readable format ("-p") - # /loopback_test -t transfer -i 10 -s 100 -m 3 -p - - 1970-1-1 0:12:37 - test: transfer - path: 1-4.17 - size: 100 - iterations: 10 - errors: 0 - async: Disabled - requests per-sec: min=390, max=547, average=469.299988, jitter=157 - ap-throughput B/s: min=90480 max=126904 average=108762.101562 jitter=36424 - ap-latency usec: min=1826 max=2560 average=2146.000000 jitter=734 - apbridge-latency usec: min=1620 max=1982 average=1882.099976 jitter=362 - gpbridge-latency usec: min=56 max=57 average=57.099998 jitter=1 - - - 1970-1-1 0:12:37 - test: transfer - path: 1-5.17 - size: 100 - iterations: 10 - errors: 0 - async: Disabled - requests per-sec: min=397, max=538, average=461.700012, jitter=141 - ap-throughput B/s: min=92104 max=124816 average=106998.898438 jitter=32712 - ap-latency usec: min=1856 max=2514 average=2185.699951 jitter=658 - apbridge-latency usec: min=1460 max=2296 average=1828.599976 jitter=836 - gpbridge-latency usec: min=56 max=57 average=57.099998 jitter=1 diff --git a/drivers/staging/greybus/tools/lbtest b/drivers/staging/greybus/tools/lbtest deleted file mode 100755 index 47c481239e98..000000000000 --- a/drivers/staging/greybus/tools/lbtest +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python -# SPDX-License-Identifier: BSD-3-Clause - -# Copyright (c) 2015 Google, Inc. -# Copyright (c) 2015 Linaro, Ltd. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from __future__ import print_function -import csv -import datetime -import sys -import time - -dict = {'ping': '2', 'transfer': '3', 'sink': '4'} -verbose = 1 - -def abort(): - sys.exit(1) - -def usage(): - print('Usage: looptest TEST SIZE ITERATIONS PATH\n\n' - ' Run TEST for a number of ITERATIONS with operation data SIZE bytes\n' - ' TEST may be \'ping\' \'transfer\' or \'sink\'\n' - ' SIZE indicates the size of transfer <= greybus max payload bytes\n' - ' ITERATIONS indicates the number of times to execute TEST at SIZE bytes\n' - ' Note if ITERATIONS is set to zero then this utility will\n' - ' initiate an infinite (non terminating) test and exit\n' - ' without logging any metrics data\n' - ' PATH indicates the sysfs path for the loopback greybus entries e.g.\n' - ' /sys/bus/greybus/devices/endo0:1:1:1:1/\n' - 'Examples:\n' - ' looptest transfer 128 10000\n' - ' looptest ping 0 128\n' - ' looptest sink 2030 32768\n' - .format(sys.argv[0]), file=sys.stderr) - - abort() - -def read_sysfs_int(path): - try: - f = open(path, "r"); - val = f.read(); - f.close() - return int(val) - except IOError as e: - print("I/O error({0}): {1}".format(e.errno, e.strerror)) - print("Invalid path %s" % path) - -def write_sysfs_val(path, val): - try: - f = open(path, "r+") - f.write(val) - f.close() - except IOError as e: - print("I/O error({0}): {1}".format(e.errno, e.strerror)) - print("Invalid path %s" % path) - -def log_csv(test_name, size, iteration_max, sys_pfx): - # file name will test_name_size_iteration_max.csv - # every time the same test with the same parameters is run we will then - # append to the same CSV with datestamp - representing each test dataset - fname = test_name + '_' + size + '_' + str(iteration_max) + '.csv' - - try: - # gather data set - date = str(datetime.datetime.now()) - error = read_sysfs_int(sys_pfx + 'error') - request_min = read_sysfs_int(sys_pfx + 'requests_per_second_min') - request_max = read_sysfs_int(sys_pfx + 'requests_per_second_max') - request_avg = read_sysfs_int(sys_pfx + 'requests_per_second_avg') - latency_min = read_sysfs_int(sys_pfx + 'latency_min') - latency_max = read_sysfs_int(sys_pfx + 'latency_max') - latency_avg = read_sysfs_int(sys_pfx + 'latency_avg') - throughput_min = read_sysfs_int(sys_pfx + 'throughput_min') - throughput_max = read_sysfs_int(sys_pfx + 'throughput_max') - throughput_avg = read_sysfs_int(sys_pfx + 'throughput_avg') - - # derive jitter - request_jitter = request_max - request_min - latency_jitter = latency_max - latency_min - throughput_jitter = throughput_max - throughput_min - - # append data set to file - with open(fname, 'a') as csvf: - row = csv.writer(csvf, delimiter=",", quotechar="'", - quoting=csv.QUOTE_MINIMAL) - row.writerow([date, test_name, size, iteration_max, error, - request_min, request_max, request_avg, request_jitter, - latency_min, latency_max, latency_avg, latency_jitter, - throughput_min, throughput_max, throughput_avg, throughput_jitter]) - except IOError as e: - print("I/O error({0}): {1}".format(e.errno, e.strerror)) - -def loopback_run(test_name, size, iteration_max, sys_pfx): - test_id = dict[test_name] - try: - # Terminate any currently running test - write_sysfs_val(sys_pfx + 'type', '0') - # Set parameter for no wait between messages - write_sysfs_val(sys_pfx + 'ms_wait', '0') - # Set operation size - write_sysfs_val(sys_pfx + 'size', size) - # Set iterations - write_sysfs_val(sys_pfx + 'iteration_max', str(iteration_max)) - # Initiate by setting loopback operation type - write_sysfs_val(sys_pfx + 'type', test_id) - time.sleep(1) - - if iteration_max == 0: - print ("Infinite test initiated CSV won't be logged\n") - return - - previous = 0 - err = 0 - while True: - # get current count bail out if it hasn't changed - iteration_count = read_sysfs_int(sys_pfx + 'iteration_count') - if previous == iteration_count: - err = 1 - break - elif iteration_count == iteration_max: - break - previous = iteration_count - if verbose: - print('%02d%% complete %d of %d ' % - (100 * iteration_count / iteration_max, - iteration_count, iteration_max)) - time.sleep(1) - if err: - print ('\nError executing test\n') - else: - log_csv(test_name, size, iteration_max, sys_pfx) - except ValueError as ve: - print("Error: %s " % format(e.strerror), file=sys.stderr) - abort() - -def main(): - if len(sys.argv) < 5: - usage() - - if sys.argv[1] in dict.keys(): - loopback_run(sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4]) - else: - usage() -if __name__ == '__main__': - main() diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c deleted file mode 100644 index d7ad51ff60c5..000000000000 --- a/drivers/staging/greybus/tools/loopback_test.c +++ /dev/null @@ -1,979 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -/* - * Loopback test application - * - * Copyright 2015 Google Inc. - * Copyright 2015 Linaro Ltd. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MAX_NUM_DEVICES 10 -#define MAX_SYSFS_PREFIX 0x80 -#define MAX_SYSFS_PATH 0x200 -#define CSV_MAX_LINE 0x1000 -#define SYSFS_MAX_INT 0x20 -#define MAX_STR_LEN 255 -#define DEFAULT_ASYNC_TIMEOUT 200000 - -struct dict { - char *name; - int type; -}; - -static struct dict dict[] = { - {"ping", 2}, - {"transfer", 3}, - {"sink", 4}, - {NULL,} /* list termination */ -}; - -struct loopback_results { - float latency_avg; - uint32_t latency_max; - uint32_t latency_min; - uint32_t latency_jitter; - - float request_avg; - uint32_t request_max; - uint32_t request_min; - uint32_t request_jitter; - - float throughput_avg; - uint32_t throughput_max; - uint32_t throughput_min; - uint32_t throughput_jitter; - - float apbridge_unipro_latency_avg; - uint32_t apbridge_unipro_latency_max; - uint32_t apbridge_unipro_latency_min; - uint32_t apbridge_unipro_latency_jitter; - - float gbphy_firmware_latency_avg; - uint32_t gbphy_firmware_latency_max; - uint32_t gbphy_firmware_latency_min; - uint32_t gbphy_firmware_latency_jitter; - - uint32_t error; -}; - -struct loopback_device { - char name[MAX_STR_LEN]; - char sysfs_entry[MAX_SYSFS_PATH]; - char debugfs_entry[MAX_SYSFS_PATH]; - struct loopback_results results; -}; - -struct loopback_test { - int verbose; - int debug; - int raw_data_dump; - int porcelain; - int mask; - int size; - int iteration_max; - int aggregate_output; - int test_id; - int device_count; - int list_devices; - int use_async; - int async_timeout; - int async_outstanding_operations; - int us_wait; - int file_output; - int stop_all; - int poll_count; - char test_name[MAX_STR_LEN]; - char sysfs_prefix[MAX_SYSFS_PREFIX]; - char debugfs_prefix[MAX_SYSFS_PREFIX]; - struct timespec poll_timeout; - struct loopback_device devices[MAX_NUM_DEVICES]; - struct loopback_results aggregate_results; - struct pollfd fds[MAX_NUM_DEVICES]; -}; - -struct loopback_test t; - -/* Helper macros to calculate the aggregate results for all devices */ -static inline int device_enabled(struct loopback_test *t, int dev_idx); - -#define GET_MAX(field) \ -static int get_##field##_aggregate(struct loopback_test *t) \ -{ \ - uint32_t max = 0; \ - int i; \ - for (i = 0; i < t->device_count; i++) { \ - if (!device_enabled(t, i)) \ - continue; \ - if (t->devices[i].results.field > max) \ - max = t->devices[i].results.field; \ - } \ - return max; \ -} \ - -#define GET_MIN(field) \ -static int get_##field##_aggregate(struct loopback_test *t) \ -{ \ - uint32_t min = ~0; \ - int i; \ - for (i = 0; i < t->device_count; i++) { \ - if (!device_enabled(t, i)) \ - continue; \ - if (t->devices[i].results.field < min) \ - min = t->devices[i].results.field; \ - } \ - return min; \ -} \ - -#define GET_AVG(field) \ -static int get_##field##_aggregate(struct loopback_test *t) \ -{ \ - uint32_t val = 0; \ - uint32_t count = 0; \ - int i; \ - for (i = 0; i < t->device_count; i++) { \ - if (!device_enabled(t, i)) \ - continue; \ - count++; \ - val += t->devices[i].results.field; \ - } \ - if (count) \ - val /= count; \ - return val; \ -} \ - -GET_MAX(throughput_max); -GET_MAX(request_max); -GET_MAX(latency_max); -GET_MAX(apbridge_unipro_latency_max); -GET_MAX(gbphy_firmware_latency_max); -GET_MIN(throughput_min); -GET_MIN(request_min); -GET_MIN(latency_min); -GET_MIN(apbridge_unipro_latency_min); -GET_MIN(gbphy_firmware_latency_min); -GET_AVG(throughput_avg); -GET_AVG(request_avg); -GET_AVG(latency_avg); -GET_AVG(apbridge_unipro_latency_avg); -GET_AVG(gbphy_firmware_latency_avg); - -void abort(void) -{ - _exit(1); -} - -void usage(void) -{ - fprintf(stderr, "Usage: loopback_test TEST [SIZE] ITERATIONS [SYSPATH] [DBGPATH]\n\n" - " Run TEST for a number of ITERATIONS with operation data SIZE bytes\n" - " TEST may be \'ping\' \'transfer\' or \'sink\'\n" - " SIZE indicates the size of transfer <= greybus max payload bytes\n" - " ITERATIONS indicates the number of times to execute TEST at SIZE bytes\n" - " Note if ITERATIONS is set to zero then this utility will\n" - " initiate an infinite (non terminating) test and exit\n" - " without logging any metrics data\n" - " SYSPATH indicates the sysfs path for the loopback greybus entries e.g.\n" - " /sys/bus/greybus/devices\n" - " DBGPATH indicates the debugfs path for the loopback greybus entries e.g.\n" - " /sys/kernel/debug/gb_loopback/\n" - " Mandatory arguments\n" - " -t must be one of the test names - sink, transfer or ping\n" - " -i iteration count - the number of iterations to run the test over\n" - " Optional arguments\n" - " -S sysfs location - location for greybus 'endo' entries default /sys/bus/greybus/devices/\n" - " -D debugfs location - location for loopback debugfs entries default /sys/kernel/debug/gb_loopback/\n" - " -s size of data packet to send during test - defaults to zero\n" - " -m mask - a bit mask of connections to include example: -m 8 = 4th connection -m 9 = 1st and 4th connection etc\n" - " default is zero which means broadcast to all connections\n" - " -v verbose output\n" - " -d debug output\n" - " -r raw data output - when specified the full list of latency values are included in the output CSV\n" - " -p porcelain - when specified printout is in a user-friendly non-CSV format. This option suppresses writing to CSV file\n" - " -a aggregate - show aggregation of all enabled devices\n" - " -l list found loopback devices and exit\n" - " -x Async - Enable async transfers\n" - " -o Async Timeout - Timeout in uSec for async operations\n" - " -O Poll loop time out in seconds(max time a test is expected to last, default: 30sec)\n" - " -c Max number of outstanding operations for async operations\n" - " -w Wait in uSec between operations\n" - " -z Enable output to a CSV file (incompatible with -p)\n" - " -f When starting new loopback test, stop currently running tests on all devices\n" - "Examples:\n" - " Send 10000 transfers with a packet size of 128 bytes to all active connections\n" - " loopback_test -t transfer -s 128 -i 10000 -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n" - " loopback_test -t transfer -s 128 -i 10000 -m 0\n" - " Send 10000 transfers with a packet size of 128 bytes to connection 1 and 4\n" - " loopback_test -t transfer -s 128 -i 10000 -m 9\n" - " loopback_test -t ping -s 0 128 -i -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n" - " loopback_test -t sink -s 2030 -i 32768 -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n"); - abort(); -} - -static inline int device_enabled(struct loopback_test *t, int dev_idx) -{ - if (!t->mask || (t->mask & (1 << dev_idx))) - return 1; - - return 0; -} - -static void show_loopback_devices(struct loopback_test *t) -{ - int i; - - if (t->device_count == 0) { - printf("No loopback devices.\n"); - return; - } - - for (i = 0; i < t->device_count; i++) - printf("device[%d] = %s\n", i, t->devices[i].name); -} - -int open_sysfs(const char *sys_pfx, const char *node, int flags) -{ - int fd; - char path[MAX_SYSFS_PATH]; - - snprintf(path, sizeof(path), "%s%s", sys_pfx, node); - fd = open(path, flags); - if (fd < 0) { - fprintf(stderr, "unable to open %s\n", path); - abort(); - } - return fd; -} - -int read_sysfs_int_fd(int fd, const char *sys_pfx, const char *node) -{ - char buf[SYSFS_MAX_INT]; - - if (read(fd, buf, sizeof(buf)) < 0) { - fprintf(stderr, "unable to read from %s%s %s\n", sys_pfx, node, - strerror(errno)); - close(fd); - abort(); - } - return atoi(buf); -} - -float read_sysfs_float_fd(int fd, const char *sys_pfx, const char *node) -{ - char buf[SYSFS_MAX_INT]; - - if (read(fd, buf, sizeof(buf)) < 0) { - fprintf(stderr, "unable to read from %s%s %s\n", sys_pfx, node, - strerror(errno)); - close(fd); - abort(); - } - return atof(buf); -} - -int read_sysfs_int(const char *sys_pfx, const char *node) -{ - int fd, val; - - fd = open_sysfs(sys_pfx, node, O_RDONLY); - val = read_sysfs_int_fd(fd, sys_pfx, node); - close(fd); - return val; -} - -float read_sysfs_float(const char *sys_pfx, const char *node) -{ - int fd; - float val; - - fd = open_sysfs(sys_pfx, node, O_RDONLY); - val = read_sysfs_float_fd(fd, sys_pfx, node); - close(fd); - return val; -} - -void write_sysfs_val(const char *sys_pfx, const char *node, int val) -{ - int fd, len; - char buf[SYSFS_MAX_INT]; - - fd = open_sysfs(sys_pfx, node, O_RDWR); - len = snprintf(buf, sizeof(buf), "%d", val); - if (write(fd, buf, len) < 0) { - fprintf(stderr, "unable to write to %s%s %s\n", sys_pfx, node, - strerror(errno)); - close(fd); - abort(); - } - close(fd); -} - -static int get_results(struct loopback_test *t) -{ - struct loopback_device *d; - struct loopback_results *r; - int i; - - for (i = 0; i < t->device_count; i++) { - if (!device_enabled(t, i)) - continue; - - d = &t->devices[i]; - r = &d->results; - - r->error = read_sysfs_int(d->sysfs_entry, "error"); - r->request_min = read_sysfs_int(d->sysfs_entry, "requests_per_second_min"); - r->request_max = read_sysfs_int(d->sysfs_entry, "requests_per_second_max"); - r->request_avg = read_sysfs_float(d->sysfs_entry, "requests_per_second_avg"); - - r->latency_min = read_sysfs_int(d->sysfs_entry, "latency_min"); - r->latency_max = read_sysfs_int(d->sysfs_entry, "latency_max"); - r->latency_avg = read_sysfs_float(d->sysfs_entry, "latency_avg"); - - r->throughput_min = read_sysfs_int(d->sysfs_entry, "throughput_min"); - r->throughput_max = read_sysfs_int(d->sysfs_entry, "throughput_max"); - r->throughput_avg = read_sysfs_float(d->sysfs_entry, "throughput_avg"); - - r->apbridge_unipro_latency_min = - read_sysfs_int(d->sysfs_entry, "apbridge_unipro_latency_min"); - r->apbridge_unipro_latency_max = - read_sysfs_int(d->sysfs_entry, "apbridge_unipro_latency_max"); - r->apbridge_unipro_latency_avg = - read_sysfs_float(d->sysfs_entry, "apbridge_unipro_latency_avg"); - - r->gbphy_firmware_latency_min = - read_sysfs_int(d->sysfs_entry, "gbphy_firmware_latency_min"); - r->gbphy_firmware_latency_max = - read_sysfs_int(d->sysfs_entry, "gbphy_firmware_latency_max"); - r->gbphy_firmware_latency_avg = - read_sysfs_float(d->sysfs_entry, "gbphy_firmware_latency_avg"); - - r->request_jitter = r->request_max - r->request_min; - r->latency_jitter = r->latency_max - r->latency_min; - r->throughput_jitter = r->throughput_max - r->throughput_min; - r->apbridge_unipro_latency_jitter = - r->apbridge_unipro_latency_max - r->apbridge_unipro_latency_min; - r->gbphy_firmware_latency_jitter = - r->gbphy_firmware_latency_max - r->gbphy_firmware_latency_min; - } - - /*calculate the aggregate results of all enabled devices */ - if (t->aggregate_output) { - r = &t->aggregate_results; - - r->request_min = get_request_min_aggregate(t); - r->request_max = get_request_max_aggregate(t); - r->request_avg = get_request_avg_aggregate(t); - - r->latency_min = get_latency_min_aggregate(t); - r->latency_max = get_latency_max_aggregate(t); - r->latency_avg = get_latency_avg_aggregate(t); - - r->throughput_min = get_throughput_min_aggregate(t); - r->throughput_max = get_throughput_max_aggregate(t); - r->throughput_avg = get_throughput_avg_aggregate(t); - - r->apbridge_unipro_latency_min = - get_apbridge_unipro_latency_min_aggregate(t); - r->apbridge_unipro_latency_max = - get_apbridge_unipro_latency_max_aggregate(t); - r->apbridge_unipro_latency_avg = - get_apbridge_unipro_latency_avg_aggregate(t); - - r->gbphy_firmware_latency_min = - get_gbphy_firmware_latency_min_aggregate(t); - r->gbphy_firmware_latency_max = - get_gbphy_firmware_latency_max_aggregate(t); - r->gbphy_firmware_latency_avg = - get_gbphy_firmware_latency_avg_aggregate(t); - - r->request_jitter = r->request_max - r->request_min; - r->latency_jitter = r->latency_max - r->latency_min; - r->throughput_jitter = r->throughput_max - r->throughput_min; - r->apbridge_unipro_latency_jitter = - r->apbridge_unipro_latency_max - r->apbridge_unipro_latency_min; - r->gbphy_firmware_latency_jitter = - r->gbphy_firmware_latency_max - r->gbphy_firmware_latency_min; - } - - return 0; -} - -int format_output(struct loopback_test *t, - struct loopback_results *r, - const char *dev_name, - char *buf, int buf_len, - struct tm *tm) -{ - int len = 0; - - memset(buf, 0x00, buf_len); - len = snprintf(buf, buf_len, "%u-%u-%u %u:%u:%u", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); - - if (t->porcelain) { - len += snprintf(&buf[len], buf_len - len, - "\n test:\t\t\t%s\n path:\t\t\t%s\n size:\t\t\t%u\n iterations:\t\t%u\n errors:\t\t%u\n async:\t\t\t%s\n", - t->test_name, - dev_name, - t->size, - t->iteration_max, - r->error, - t->use_async ? "Enabled" : "Disabled"); - - len += snprintf(&buf[len], buf_len - len, - " requests per-sec:\tmin=%u, max=%u, average=%f, jitter=%u\n", - r->request_min, - r->request_max, - r->request_avg, - r->request_jitter); - - len += snprintf(&buf[len], buf_len - len, - " ap-throughput B/s:\tmin=%u max=%u average=%f jitter=%u\n", - r->throughput_min, - r->throughput_max, - r->throughput_avg, - r->throughput_jitter); - len += snprintf(&buf[len], buf_len - len, - " ap-latency usec:\tmin=%u max=%u average=%f jitter=%u\n", - r->latency_min, - r->latency_max, - r->latency_avg, - r->latency_jitter); - len += snprintf(&buf[len], buf_len - len, - " apbridge-latency usec:\tmin=%u max=%u average=%f jitter=%u\n", - r->apbridge_unipro_latency_min, - r->apbridge_unipro_latency_max, - r->apbridge_unipro_latency_avg, - r->apbridge_unipro_latency_jitter); - - len += snprintf(&buf[len], buf_len - len, - " gbphy-latency usec:\tmin=%u max=%u average=%f jitter=%u\n", - r->gbphy_firmware_latency_min, - r->gbphy_firmware_latency_max, - r->gbphy_firmware_latency_avg, - r->gbphy_firmware_latency_jitter); - - } else { - len += snprintf(&buf[len], buf_len - len, ",%s,%s,%u,%u,%u", - t->test_name, dev_name, t->size, t->iteration_max, - r->error); - - len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u", - r->request_min, - r->request_max, - r->request_avg, - r->request_jitter); - - len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u", - r->latency_min, - r->latency_max, - r->latency_avg, - r->latency_jitter); - - len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u", - r->throughput_min, - r->throughput_max, - r->throughput_avg, - r->throughput_jitter); - - len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u", - r->apbridge_unipro_latency_min, - r->apbridge_unipro_latency_max, - r->apbridge_unipro_latency_avg, - r->apbridge_unipro_latency_jitter); - - len += snprintf(&buf[len], buf_len - len, ",%u,%u,%f,%u", - r->gbphy_firmware_latency_min, - r->gbphy_firmware_latency_max, - r->gbphy_firmware_latency_avg, - r->gbphy_firmware_latency_jitter); - } - - printf("\n%s\n", buf); - - return len; -} - -static int log_results(struct loopback_test *t) -{ - int fd, i, len, ret; - struct tm tm; - time_t local_time; - char file_name[MAX_SYSFS_PATH]; - char data[CSV_MAX_LINE]; - - local_time = time(NULL); - tm = *localtime(&local_time); - - /* - * file name will test_name_size_iteration_max.csv - * every time the same test with the same parameters is run we will then - * append to the same CSV with datestamp - representing each test - * dataset. - */ - if (t->file_output && !t->porcelain) { - snprintf(file_name, sizeof(file_name), "%s_%d_%d.csv", - t->test_name, t->size, t->iteration_max); - - fd = open(file_name, O_WRONLY | O_CREAT | O_APPEND, 0644); - if (fd < 0) { - fprintf(stderr, "unable to open %s for appending\n", file_name); - abort(); - } - } - for (i = 0; i < t->device_count; i++) { - if (!device_enabled(t, i)) - continue; - - len = format_output(t, &t->devices[i].results, - t->devices[i].name, - data, sizeof(data), &tm); - if (t->file_output && !t->porcelain) { - ret = write(fd, data, len); - if (ret == -1) - fprintf(stderr, "unable to write %d bytes to csv.\n", len); - } - } - - if (t->aggregate_output) { - len = format_output(t, &t->aggregate_results, "aggregate", - data, sizeof(data), &tm); - if (t->file_output && !t->porcelain) { - ret = write(fd, data, len); - if (ret == -1) - fprintf(stderr, "unable to write %d bytes to csv.\n", len); - } - } - - if (t->file_output && !t->porcelain) - close(fd); - - return 0; -} - -int is_loopback_device(const char *path, const char *node) -{ - char file[MAX_SYSFS_PATH]; - - snprintf(file, MAX_SYSFS_PATH, "%s%s/iteration_count", path, node); - if (access(file, F_OK) == 0) - return 1; - return 0; -} - -int find_loopback_devices(struct loopback_test *t) -{ - struct dirent **namelist; - int i, n, ret; - unsigned int dev_id; - struct loopback_device *d; - - n = scandir(t->sysfs_prefix, &namelist, NULL, alphasort); - if (n < 0) { - perror("scandir"); - ret = -ENODEV; - goto baddir; - } - - /* Don't include '.' and '..' */ - if (n <= 2) { - ret = -ENOMEM; - goto done; - } - - for (i = 0; i < n; i++) { - ret = sscanf(namelist[i]->d_name, "gb_loopback%u", &dev_id); - if (ret != 1) - continue; - - if (!is_loopback_device(t->sysfs_prefix, namelist[i]->d_name)) - continue; - - if (t->device_count == MAX_NUM_DEVICES) { - fprintf(stderr, "max number of devices reached!\n"); - break; - } - - d = &t->devices[t->device_count++]; - snprintf(d->name, MAX_STR_LEN, "gb_loopback%u", dev_id); - - snprintf(d->sysfs_entry, MAX_SYSFS_PATH, "%s%s/", - t->sysfs_prefix, d->name); - - snprintf(d->debugfs_entry, MAX_SYSFS_PATH, "%sraw_latency_%s", - t->debugfs_prefix, d->name); - - if (t->debug) - printf("add %s %s\n", d->sysfs_entry, d->debugfs_entry); - } - - ret = 0; -done: - for (i = 0; i < n; i++) - free(namelist[i]); - free(namelist); -baddir: - return ret; -} - -static int open_poll_files(struct loopback_test *t) -{ - struct loopback_device *dev; - char buf[MAX_SYSFS_PATH + MAX_STR_LEN]; - char dummy; - int fds_idx = 0; - int i; - - for (i = 0; i < t->device_count; i++) { - dev = &t->devices[i]; - - if (!device_enabled(t, i)) - continue; - - snprintf(buf, sizeof(buf), "%s%s", dev->sysfs_entry, "iteration_count"); - t->fds[fds_idx].fd = open(buf, O_RDONLY); - if (t->fds[fds_idx].fd < 0) { - fprintf(stderr, "Error opening poll file!\n"); - goto err; - } - read(t->fds[fds_idx].fd, &dummy, 1); - t->fds[fds_idx].events = POLLERR | POLLPRI; - t->fds[fds_idx].revents = 0; - fds_idx++; - } - - t->poll_count = fds_idx; - - return 0; - -err: - for (i = 0; i < fds_idx; i++) - close(t->fds[i].fd); - - return -1; -} - -static int close_poll_files(struct loopback_test *t) -{ - int i; - - for (i = 0; i < t->poll_count; i++) - close(t->fds[i].fd); - - return 0; -} -static int is_complete(struct loopback_test *t) -{ - int iteration_count; - int i; - - for (i = 0; i < t->device_count; i++) { - if (!device_enabled(t, i)) - continue; - - iteration_count = read_sysfs_int(t->devices[i].sysfs_entry, - "iteration_count"); - - /* at least one device did not finish yet */ - if (iteration_count != t->iteration_max) - return 0; - } - - return 1; -} - -static void stop_tests(struct loopback_test *t) -{ - int i; - - for (i = 0; i < t->device_count; i++) { - if (!device_enabled(t, i)) - continue; - write_sysfs_val(t->devices[i].sysfs_entry, "type", 0); - } -} - -static void handler(int sig) { /* do nothing */ } - -static int wait_for_complete(struct loopback_test *t) -{ - int number_of_events = 0; - char dummy; - int ret; - int i; - struct timespec *ts = NULL; - struct sigaction sa; - sigset_t mask_old, mask; - - sigemptyset(&mask); - sigemptyset(&mask_old); - sigaddset(&mask, SIGINT); - sigprocmask(SIG_BLOCK, &mask, &mask_old); - - sa.sa_handler = handler; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - if (sigaction(SIGINT, &sa, NULL) == -1) { - fprintf(stderr, "sigaction error\n"); - return -1; - } - - if (t->poll_timeout.tv_sec != 0) - ts = &t->poll_timeout; - - while (1) { - ret = ppoll(t->fds, t->poll_count, ts, &mask_old); - if (ret <= 0) { - stop_tests(t); - fprintf(stderr, "Poll exit with errno %d\n", errno); - return -1; - } - - for (i = 0; i < t->poll_count; i++) { - if (t->fds[i].revents & POLLPRI) { - /* Dummy read to clear the event */ - read(t->fds[i].fd, &dummy, 1); - number_of_events++; - } - } - - if (number_of_events == t->poll_count) - break; - } - - if (!is_complete(t)) { - fprintf(stderr, "Iteration count did not finish!\n"); - return -1; - } - - return 0; -} - -static void prepare_devices(struct loopback_test *t) -{ - int i; - - /* - * Cancel any running tests on enabled devices. If - * stop_all option is given, stop test on all devices. - */ - for (i = 0; i < t->device_count; i++) - if (t->stop_all || device_enabled(t, i)) - write_sysfs_val(t->devices[i].sysfs_entry, "type", 0); - - for (i = 0; i < t->device_count; i++) { - if (!device_enabled(t, i)) - continue; - - write_sysfs_val(t->devices[i].sysfs_entry, "us_wait", - t->us_wait); - - /* Set operation size */ - write_sysfs_val(t->devices[i].sysfs_entry, "size", t->size); - - /* Set iterations */ - write_sysfs_val(t->devices[i].sysfs_entry, "iteration_max", - t->iteration_max); - - if (t->use_async) { - write_sysfs_val(t->devices[i].sysfs_entry, "async", 1); - write_sysfs_val(t->devices[i].sysfs_entry, - "timeout", t->async_timeout); - write_sysfs_val(t->devices[i].sysfs_entry, - "outstanding_operations_max", - t->async_outstanding_operations); - } else { - write_sysfs_val(t->devices[i].sysfs_entry, "async", 0); - } - } -} - -static int start(struct loopback_test *t) -{ - int i; - - /* the test starts by writing test_id to the type file. */ - for (i = 0; i < t->device_count; i++) { - if (!device_enabled(t, i)) - continue; - - write_sysfs_val(t->devices[i].sysfs_entry, "type", t->test_id); - } - - return 0; -} - -void loopback_run(struct loopback_test *t) -{ - int i; - int ret; - - for (i = 0; dict[i].name != NULL; i++) { - if (strstr(dict[i].name, t->test_name)) - t->test_id = dict[i].type; - } - if (!t->test_id) { - fprintf(stderr, "invalid test %s\n", t->test_name); - usage(); - return; - } - - prepare_devices(t); - - ret = open_poll_files(t); - if (ret) - goto err; - - start(t); - - ret = wait_for_complete(t); - close_poll_files(t); - if (ret) - goto err; - - get_results(t); - - log_results(t); - - return; - -err: - printf("Error running test\n"); -} - -static int sanity_check(struct loopback_test *t) -{ - int i; - - if (t->device_count == 0) { - fprintf(stderr, "No loopback devices found\n"); - return -1; - } - - for (i = 0; i < MAX_NUM_DEVICES; i++) { - if (!device_enabled(t, i)) - continue; - - if (t->mask && !strcmp(t->devices[i].name, "")) { - fprintf(stderr, "Bad device mask %x\n", (1 << i)); - return -1; - } - } - - return 0; -} - -int main(int argc, char *argv[]) -{ - int o, ret; - char *sysfs_prefix = "/sys/class/gb_loopback/"; - char *debugfs_prefix = "/sys/kernel/debug/gb_loopback/"; - - memset(&t, 0, sizeof(t)); - - while ((o = getopt(argc, argv, - "t:s:i:S:D:m:v::d::r::p::a::l::x::o:O:c:w:z::f::")) != -1) { - switch (o) { - case 't': - snprintf(t.test_name, MAX_STR_LEN, "%s", optarg); - break; - case 's': - t.size = atoi(optarg); - break; - case 'i': - t.iteration_max = atoi(optarg); - break; - case 'S': - snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg); - break; - case 'D': - snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg); - break; - case 'm': - t.mask = atol(optarg); - break; - case 'v': - t.verbose = 1; - break; - case 'd': - t.debug = 1; - break; - case 'r': - t.raw_data_dump = 1; - break; - case 'p': - t.porcelain = 1; - break; - case 'a': - t.aggregate_output = 1; - break; - case 'l': - t.list_devices = 1; - break; - case 'x': - t.use_async = 1; - break; - case 'o': - t.async_timeout = atoi(optarg); - break; - case 'O': - t.poll_timeout.tv_sec = atoi(optarg); - break; - case 'c': - t.async_outstanding_operations = atoi(optarg); - break; - case 'w': - t.us_wait = atoi(optarg); - break; - case 'z': - t.file_output = 1; - break; - case 'f': - t.stop_all = 1; - break; - default: - usage(); - return -EINVAL; - } - } - - if (!strcmp(t.sysfs_prefix, "")) - snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix); - - if (!strcmp(t.debugfs_prefix, "")) - snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", debugfs_prefix); - - ret = find_loopback_devices(&t); - if (ret) - return ret; - ret = sanity_check(&t); - if (ret) - return ret; - - if (t.list_devices) { - show_loopback_devices(&t); - return 0; - } - - if (t.test_name[0] == '\0' || t.iteration_max == 0) - usage(); - - if (t.async_timeout == 0) - t.async_timeout = DEFAULT_ASYNC_TIMEOUT; - - loopback_run(&t); - - return 0; -} From 748b5db6a9991ba6549758a767ccecf6f3bf0096 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Fri, 7 Apr 2023 23:50:21 +0200 Subject: [PATCH 172/185] staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE Remove unused macro IS_HARDWARE_TYPE_8192SE as it is used only in code areas that are not executed when 8192SE hardware is found. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/e9b19862ace002462e870e62c6f62bab3cc81c5a.1680902603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 2b2d8af4cf6e..b0aa76574738 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -52,9 +52,6 @@ #define DRV_AUTHOR "" #define DRV_VERSION "0014.0401.2010" -#define IS_HARDWARE_TYPE_8192SE(_priv) \ - (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192SE) - #define TOTAL_CAM_ENTRY 32 #define CAM_CONTENT_COUNT 8 diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index cde41111012a..50486f2a6f3a 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -214,8 +214,6 @@ void rtl92e_dm_init(struct net_device *dev) _rtl92e_dm_init_fsync(dev); _rtl92e_dm_init_rx_path_selection(dev); _rtl92e_dm_init_cts_to_self(dev); - if (IS_HARDWARE_TYPE_8192SE(dev)) - _rtl92e_dm_init_wa_broadcom_iot(dev); INIT_DELAYED_WORK(&priv->gpio_change_rf_wq, (void *)_rtl92e_dm_check_rf_ctrl_gpio); } @@ -816,10 +814,7 @@ static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev) static u8 TM_Trigger; u8 TxPowerCheckCnt = 0; - if (IS_HARDWARE_TYPE_8192SE(dev)) - TxPowerCheckCnt = 5; - else - TxPowerCheckCnt = 2; + TxPowerCheckCnt = 2; if (!priv->btxpower_tracking) return; From edc332a9f4deac969394c1ada1918f75564867aa Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Fri, 7 Apr 2023 23:50:28 +0200 Subject: [PATCH 173/185] staging: rtl8192e: Remove unused function _rtl92e_dm_init_wa_broadcom_iot Remove unused function _rtl92e_dm_init_wa_broadcom_iot and the variables that are not any longer used. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/0e7a2a5b9edc85b7f8e3fc0f9e0e6ab7f2830d02.1680902603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 11 ----------- drivers/staging/rtl8192e/rtl819x_HT.h | 3 --- 2 files changed, 14 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 50486f2a6f3a..93504d5a8578 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -173,7 +173,6 @@ static void _rtl92e_dm_pd_th(struct net_device *dev); static void _rtl92e_dm_cs_ratio(struct net_device *dev); static void _rtl92e_dm_init_cts_to_self(struct net_device *dev); -static void _rtl92e_dm_init_wa_broadcom_iot(struct net_device *dev); static void _rtl92e_dm_check_edca_turbo(struct net_device *dev); static void _rtl92e_dm_check_rx_path_selection(struct net_device *dev); @@ -1531,16 +1530,6 @@ static void _rtl92e_dm_cts_to_self(struct net_device *dev) } } - -static void _rtl92e_dm_init_wa_broadcom_iot(struct net_device *dev) -{ - struct r8192_priv *priv = rtllib_priv((struct net_device *)dev); - struct rt_hi_throughput *ht_info = priv->rtllib->ht_info; - - ht_info->bWAIotBroadcom = false; - ht_info->WAIotTH = WA_IOT_TH_VAL; -} - static void _rtl92e_dm_check_rf_ctrl_gpio(void *data) { struct r8192_priv *priv = container_of_dwork_rsl(data, diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index 22e4f126ed56..f4e9fa849796 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -162,9 +162,6 @@ struct rt_hi_throughput { u8 IOTPeer; u32 iot_action; u8 iot_ra_func; - - u8 bWAIotBroadcom; - u8 WAIotTH; } __packed; struct bss_ht { From a273033cf466a8f078beb87ea0f4938382f90fb5 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Fri, 7 Apr 2023 23:50:34 +0200 Subject: [PATCH 174/185] staging: rtl8192e: Remove one of two checks for hardware RTL8192SE Check for hardware RTL8192SE is done in function _rtl92e_pci_probe() directly and also two lines later in function rtl92e_check_adapter(). Remove top level check to increase readability. This pci_read does not follow a pci_write to ensure data is written to the device. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/4126cca73739c75b1a0379af2ef8b0c63a705639.1680902603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 7506d7eb7b4c..45989a77a27c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2130,7 +2130,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, struct r8192_priv *priv = NULL; unsigned long pmem_start, pmem_len, pmem_flags; int err = -ENOMEM; - u8 revision_id; if (pci_enable_device(pdev)) { dev_err(&pdev->dev, "Failed to enable PCI device"); @@ -2189,11 +2188,6 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, dev->mem_start = ioaddr; dev->mem_end = ioaddr + pci_resource_len(pdev, 0); - pci_read_config_byte(pdev, 0x08, &revision_id); - /* If the revisionid is 0x10, the device uses rtl8192se. */ - if (pdev->device == 0x8192 && revision_id == 0x10) - goto err_unmap; - if (!rtl92e_check_adapter(pdev, dev)) goto err_unmap; From 1cadfcfe353dc36d3c37224047cd422264dab263 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Fri, 7 Apr 2023 23:50:41 +0200 Subject: [PATCH 175/185] staging: rtl8192e: Remove unused variable RF_Type Remove unused variable RF_Type. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/7710a87f627dcfd2d0c34f14f583625ffab10660.1680902603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 1a0177cd64af..b1729d65f67f 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1393,7 +1393,6 @@ struct rtllib_device { size_t assocreq_ies_len, assocresp_ies_len; bool bForcedBgMode; - u8 RF_Type; u8 hwsec_active; bool is_silent_reset; From 86d3ad9684562cd3cee30f28d5976cd92e702473 Mon Sep 17 00:00:00 2001 From: Srihari S Date: Sat, 8 Apr 2023 20:46:23 +0530 Subject: [PATCH 176/185] staging: rtl8172: Add blank lines after declarations Add blank lines as reported by checkpatch.pl as below CHECK: Please use a blank line after function/struct/union/enum declarations Signed-off-by: Srihari S Link: https://lore.kernel.org/r/1680966983-11609-1-git-send-email-sriharisat@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_efuse.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8712/rtl8712_efuse.h b/drivers/staging/rtl8712/rtl8712_efuse.h index 2e1ea9d7a295..7a49740212eb 100644 --- a/drivers/staging/rtl8712/rtl8712_efuse.h +++ b/drivers/staging/rtl8712/rtl8712_efuse.h @@ -23,6 +23,7 @@ struct PGPKT_STRUCT { u8 word_en; u8 data[PGPKT_DATA_SIZE]; }; + /*--------------------------------------------------------------------------*/ u8 r8712_efuse_reg_init(struct _adapter *padapter); void r8712_efuse_reg_uninit(struct _adapter *padapter); From 8020247877ebdf40416cb24bdfc47cba6c499412 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:19:37 +0200 Subject: [PATCH 177/185] staging: rtl8192e: Remove unchanged variable RegRfPsLevel Remove unchanged variable RegRfPsLevel and equations that have always the same result to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/49162b0041db33c6c43c4126839baed69c76cb89.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 9 +-------- drivers/staging/rtl8192e/rtllib.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index dd666701138e..4b0ebe96302e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -1089,14 +1089,7 @@ static bool _rtl92e_set_rf_power_state(struct net_device *dev, if (i >= MAX_DOZE_WAITING_TIMES_9x) break; } - if (psc->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC && - !RT_IN_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC)) { - rtl92e_disable_nic(dev); - RT_SET_PS_LEVEL(psc, RT_RF_OFF_LEVL_HALT_NIC); - } else if (!(psc->RegRfPsLevel & - RT_RF_OFF_LEVL_HALT_NIC)) { - rtl92e_set_rf_off(dev); - } + rtl92e_set_rf_off(dev); break; default: bResult = false; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index b1729d65f67f..1a0e7ae70ca6 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -1237,7 +1237,6 @@ struct rt_pwr_save_ctrl { u8 LPSAwakeIntvl; u32 CurPsLevel; - u32 RegRfPsLevel; }; #define RT_RF_CHANGE_SOURCE u32 From 88b81bddf1f3c2b4b23c687e27a5b6e0a6a63795 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:19:45 +0200 Subject: [PATCH 178/185] staging: rtl8192e: Remove unused function rtl92e_disable_nic Remove unused function rtl92e_disable_nic to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/5ce2ef58f66e25d7db7432c56c7b7c37a2b15fc1.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 16 ---------------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - 2 files changed, 17 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 45989a77a27c..ff650bd5441c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2301,22 +2301,6 @@ bool rtl92e_enable_nic(struct net_device *dev) return init_status; } -bool rtl92e_disable_nic(struct net_device *dev) -{ - struct r8192_priv *priv = rtllib_priv(dev); - u8 tmp_state = 0; - - priv->bdisable_nic = true; - tmp_state = priv->rtllib->state; - rtllib_softmac_stop_protocol(priv->rtllib, 0, false); - priv->rtllib->state = tmp_state; - _rtl92e_cancel_deferred_work(priv); - rtl92e_irq_disable(dev); - - rtl92e_stop_adapter(dev, false); - return true; -} - module_pci_driver(rtl8192_pci_driver); void rtl92e_check_rfctrl_gpio_timer(struct timer_list *t) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index b0aa76574738..51240cbde0d3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -433,7 +433,6 @@ u8 rtl92e_rx_db_to_percent(s8 antpower); void rtl92e_copy_mpdu_stats(struct rtllib_rx_stats *psrc_stats, struct rtllib_rx_stats *ptarget_stats); bool rtl92e_enable_nic(struct net_device *dev); -bool rtl92e_disable_nic(struct net_device *dev); bool rtl92e_set_rf_state(struct net_device *dev, enum rt_rf_power_state state_to_set, From b0e60e96afa0719afddd483d9492a11851c2d9cf Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:19:52 +0200 Subject: [PATCH 179/185] staging: rtl8192e: Remove unused macro RT_SET_PS_LEVEL Remove unused macro RT_SET_PS_LEVEL to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/0d397210830f77ad3231c3b4a0465ae89aacb962.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 1a0e7ae70ca6..6e665e866f1f 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -100,7 +100,6 @@ static inline void *netdev_priv_rsl(struct net_device *dev) ((psc->CurPsLevel & _PS_FLAG) ? true : false) #define RT_CLEAR_PS_LEVEL(psc, _PS_FLAG) \ (psc->CurPsLevel &= (~(_PS_FLAG))) -#define RT_SET_PS_LEVEL(psc, _PS_FLAG) (psc->CurPsLevel |= _PS_FLAG) /* defined for skb cb field */ /* At most 28 byte */ From bfc1bb7866f8c91ae829eadbc1bc7c81b5f6f623 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:19:58 +0200 Subject: [PATCH 180/185] staging: rtl8192e: Remove second initialization of bActuallySet Remove second initialization of bActuallySet to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/ebf51fbd56bad4f8fd7fb51fe031f376c3ab6d2c.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 93504d5a8578..7342ef591169 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1539,8 +1539,6 @@ static void _rtl92e_dm_check_rf_ctrl_gpio(void *data) enum rt_rf_power_state rf_power_state_to_set; bool bActuallySet = false; - bActuallySet = false; - if ((priv->up_first_time == 1) || (priv->being_init_adapter)) return; From 93bf41cc8afbcc2988be881c4bb569fe9a8c36e1 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:20:06 +0200 Subject: [PATCH 181/185] staging: rtl8192e: Remove set to true while true of bfirst_after_down Remove set to true while true of bfirst_after_down to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/053ab341e80909e81867e42ec4c077e76b762051.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 7342ef591169..ed8b39d3c856 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1542,10 +1542,8 @@ static void _rtl92e_dm_check_rf_ctrl_gpio(void *data) if ((priv->up_first_time == 1) || (priv->being_init_adapter)) return; - if (priv->bfirst_after_down) { - priv->bfirst_after_down = true; + if (priv->bfirst_after_down) return; - } tmp1byte = rtl92e_readb(dev, GPI); From dc8aaa4f327b17603165c0b6f8d40f297f5f94c0 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:20:12 +0200 Subject: [PATCH 182/185] staging: rtl8192e: Remove unchanged variable chan_forced Remove unchanged variable chan_forced and equations that have always the same result to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/3f218531a9d31c399d1351d3da7f9ca13d20df0c.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 --- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ff650bd5441c..60fc358cfadf 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -249,9 +249,6 @@ static void _rtl92e_set_chan(struct net_device *dev, short ch) { struct r8192_priv *priv = rtllib_priv(dev); - if (priv->chan_forced) - return; - priv->chan = ch; if (priv->rf_set_chan) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 51240cbde0d3..0eca73e4540f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -392,8 +392,6 @@ struct r8192_priv { bool reset_in_progress; bool force_reset; bool force_lps; - - bool chan_forced; }; extern const struct ethtool_ops rtl819x_ethtool_ops; From 548534d95b1dd7f9a51ac0ce06f1435be1e8ca33 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:20:19 +0200 Subject: [PATCH 183/185] staging: rtl8192e: Remove unchanged variable frame_sync_monitor Remove unchanged variable frame_sync_monitor and equations that have always the same result to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/0c4bdca5f5dbb93bb05c6b7f32136d4dfb3b0e4b.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 - drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 71 ++++++++------------ 2 files changed, 29 insertions(+), 44 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 0eca73e4540f..c97e315a9091 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -382,8 +382,6 @@ struct r8192_priv { u32 continue_diff_count; bool bswitch_fsync; u8 framesync; - u8 frame_sync_monitor; - u32 reset_count; enum reset_type rst_progress; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index ed8b39d3c856..43e335ab0733 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1826,7 +1826,6 @@ static void _rtl92e_dm_init_fsync(struct net_device *dev) priv->rtllib->fsync_firstdiff_ratethreshold = 100; priv->rtllib->fsync_seconddiff_ratethreshold = 200; priv->rtllib->fsync_state = Default_Fsync; - priv->frame_sync_monitor = 1; timer_setup(&priv->fsync_timer, _rtl92e_dm_fsync_timer_callback, 0); } @@ -2053,12 +2052,10 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev) } } - if (priv->frame_sync_monitor) { - if (reg_c38_State != RegC38_Fsync_AP_BCM) { - rtl92e_writeb(dev, rOFDM0_RxDetector3, 0x95); + if (reg_c38_State != RegC38_Fsync_AP_BCM) { + rtl92e_writeb(dev, rOFDM0_RxDetector3, 0x95); - reg_c38_State = RegC38_Fsync_AP_BCM; - } + reg_c38_State = RegC38_Fsync_AP_BCM; } } else { switch (priv->rtllib->fsync_state) { @@ -2075,50 +2072,40 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev) break; } - if (priv->frame_sync_monitor) { - if (priv->rtllib->state == RTLLIB_LINKED) { - if (priv->undecorated_smoothed_pwdb <= - RegC38_TH) { - if (reg_c38_State != - RegC38_NonFsync_Other_AP) { - rtl92e_writeb(dev, - rOFDM0_RxDetector3, - 0x90); + if (priv->rtllib->state == RTLLIB_LINKED) { + if (priv->undecorated_smoothed_pwdb <= + RegC38_TH) { + if (reg_c38_State != + RegC38_NonFsync_Other_AP) { + rtl92e_writeb(dev, + rOFDM0_RxDetector3, + 0x90); - reg_c38_State = - RegC38_NonFsync_Other_AP; - } - } else if (priv->undecorated_smoothed_pwdb >= - (RegC38_TH+5)) { - if (reg_c38_State) { - rtl92e_writeb(dev, - rOFDM0_RxDetector3, - priv->framesync); - reg_c38_State = RegC38_Default; - } + reg_c38_State = + RegC38_NonFsync_Other_AP; } - } else { + } else if (priv->undecorated_smoothed_pwdb >= + (RegC38_TH+5)) { if (reg_c38_State) { - rtl92e_writeb(dev, rOFDM0_RxDetector3, - priv->framesync); + rtl92e_writeb(dev, + rOFDM0_RxDetector3, + priv->framesync); reg_c38_State = RegC38_Default; } } + } else { + if (reg_c38_State) { + rtl92e_writeb(dev, rOFDM0_RxDetector3, + priv->framesync); + reg_c38_State = RegC38_Default; + } } } - if (priv->frame_sync_monitor) { - if (priv->reset_count != reset_cnt) { - rtl92e_writeb(dev, rOFDM0_RxDetector3, - priv->framesync); - reg_c38_State = RegC38_Default; - reset_cnt = priv->reset_count; - } - } else { - if (reg_c38_State) { - rtl92e_writeb(dev, rOFDM0_RxDetector3, - priv->framesync); - reg_c38_State = RegC38_Default; - } + if (priv->reset_count != reset_cnt) { + rtl92e_writeb(dev, rOFDM0_RxDetector3, + priv->framesync); + reg_c38_State = RegC38_Default; + reset_cnt = priv->reset_count; } } From 4de65f2b975fc0eb17629242db09e5895003edbe Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Sun, 16 Apr 2023 09:20:25 +0200 Subject: [PATCH 184/185] staging: rtl8192e: Remove unchanged variables bfsync_processing and more Remove unchanged variable bfsync_processing and rfc_txpowertrackingindex_real to shorten code. Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/cb609f904d988febaa579526514586877b1dabf7.1681627603.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 -- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 60fc358cfadf..4cf84b5666a7 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -785,7 +785,6 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->rtllib->short_slot = 1; priv->promisc = (dev->flags & IFF_PROMISC) ? 1 : 0; priv->bcck_in_ch14 = false; - priv->bfsync_processing = false; priv->cck_present_attn = 0; priv->rfa_txpowertrackingindex = 0; priv->rfc_txpowertrackingindex = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index c97e315a9091..285dac32c074 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -357,7 +357,6 @@ struct r8192_priv { u8 rfa_txpowertrackingindex_real; u8 rfa_txpowertracking_default; u8 rfc_txpowertrackingindex; - u8 rfc_txpowertrackingindex_real; bool btxpower_tracking; bool bcck_in_ch14; @@ -376,7 +375,6 @@ struct r8192_priv { bool bcurrent_turbo_EDCA; bool bis_cur_rdlstate; - bool bfsync_processing; u32 rate_record; u32 rate_count_diff_rec; u32 continue_diff_count; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 43e335ab0733..56a8ec517c06 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -998,7 +998,6 @@ void rtl92e_dm_backup_state(struct net_device *dev) u32 bit_mask = bMaskByte0; priv->bswitch_fsync = false; - priv->bfsync_processing = false; if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) return; From 3fac2397f562eb669ddc2f45867a253f3fc26184 Mon Sep 17 00:00:00 2001 From: Philipp Hortmann Date: Tue, 18 Apr 2023 22:02:01 +0200 Subject: [PATCH 185/185] staging: rtl8192e: Fix W_DISABLE# does not work after stop/start When loading the driver for rtl8192e, the W_DISABLE# switch is working as intended. But when the WLAN is turned off in software and then turned on again the W_DISABLE# does not work anymore. Reason for this is that in the function _rtl92e_dm_check_rf_ctrl_gpio() the bfirst_after_down is checked and returned when true. bfirst_after_down is set true when switching the WLAN off in software. But it is not set to false again when WLAN is turned on again. Add bfirst_after_down = false in _rtl92e_sta_up to reset bit and fix above described bug. Fixes: 94a799425eee ("From: wlanfae [PATCH 1/8] rtl8192e: Import new version of driver from realtek") Signed-off-by: Philipp Hortmann Link: https://lore.kernel.org/r/20230418200201.GA17398@matrix-ESPRIMO-P710 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4cf84b5666a7..27040d1e3230 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -645,6 +645,7 @@ static int _rtl92e_sta_up(struct net_device *dev, bool is_silent_reset) else netif_wake_queue(dev); + priv->bfirst_after_down = false; return 0; }