linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se
@ 2023-04-05 21:47 Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 1/5] staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE Philipp Hortmann
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-05 21:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Remove unused macro IS_HARDWARE_TYPE_8192SE and unused function
_rtl92e_dm_init_wa_broadcom_iot. Remove a double check for hardware
rtl8192se. Remove unused variables.

Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e

Philipp Hortmann (5):
  staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE
  staging: rtl8192e: Remove unused function
    _rtl92e_dm_init_wa_broadcom_iot
  staging: rtl8192e: Remove one of two checks for hardware RTL8192SE
  staging: rtl8192e: Remove unused local variable irq_line
  staging: rtl8192e: Remove unused variable RF_Type

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |  6 ------
 drivers/staging/rtl8192e/rtl8192e/rtl_core.h |  3 ---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c   | 18 +-----------------
 drivers/staging/rtl8192e/rtl8192e/rtl_pci.c  |  2 --
 drivers/staging/rtl8192e/rtl819x_HT.h        |  3 ---
 drivers/staging/rtl8192e/rtllib.h            |  1 -
 6 files changed, 1 insertion(+), 32 deletions(-)

-- 
2.40.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE
  2023-04-05 21:47 [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se Philipp Hortmann
@ 2023-04-05 21:48 ` Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 2/5] staging: rtl8192e: Remove unused function _rtl92e_dm_init_wa_broadcom_iot Philipp Hortmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-05 21:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

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 <philipp.g.hortmann@gmail.com>
---
 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  "<wlanfae@realtek.com>"
 #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;
 
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] staging: rtl8192e: Remove unused function _rtl92e_dm_init_wa_broadcom_iot
  2023-04-05 21:47 [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 1/5] staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE Philipp Hortmann
@ 2023-04-05 21:48 ` Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 3/5] staging: rtl8192e: Remove one of two checks for hardware RTL8192SE Philipp Hortmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-05 21:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Remove unused function _rtl92e_dm_init_wa_broadcom_iot and the variables
that are not any longer used.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 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 {
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] staging: rtl8192e: Remove one of two checks for hardware RTL8192SE
  2023-04-05 21:47 [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 1/5] staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 2/5] staging: rtl8192e: Remove unused function _rtl92e_dm_init_wa_broadcom_iot Philipp Hortmann
@ 2023-04-05 21:48 ` Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line Philipp Hortmann
  2023-04-05 21:48 ` [PATCH 5/5] staging: rtl8192e: Remove unused variable RF_Type Philipp Hortmann
  4 siblings, 0 replies; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-05 21:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

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.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 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;
 
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line
  2023-04-05 21:47 [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se Philipp Hortmann
                   ` (2 preceding siblings ...)
  2023-04-05 21:48 ` [PATCH 3/5] staging: rtl8192e: Remove one of two checks for hardware RTL8192SE Philipp Hortmann
@ 2023-04-05 21:48 ` Philipp Hortmann
  2023-04-06 19:54   ` Alison Schofield
  2023-04-06 20:06   ` Greg Kroah-Hartman
  2023-04-05 21:48 ` [PATCH 5/5] staging: rtl8192e: Remove unused variable RF_Type Philipp Hortmann
  4 siblings, 2 replies; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-05 21:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Remove unused local variable irq_line.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
index 0bc3e013001e..1c3ccd2aabc3 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
@@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
 	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
 	u16 device_id;
 	u8  revision_id;
-	u16 irq_line;
 
 	device_id = pdev->device;
 	revision_id = pdev->revision;
-	pci_read_config_word(pdev, 0x3C, &irq_line);
 
 	priv->card_8192 = NIC_8192E;
 
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] staging: rtl8192e: Remove unused variable RF_Type
  2023-04-05 21:47 [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se Philipp Hortmann
                   ` (3 preceding siblings ...)
  2023-04-05 21:48 ` [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line Philipp Hortmann
@ 2023-04-05 21:48 ` Philipp Hortmann
  4 siblings, 0 replies; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-05 21:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-staging, linux-kernel

Remove unused variable RF_Type.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
 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 7d83a4c322cf..ae7c6a5804ee 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1390,7 +1390,6 @@ struct rtllib_device {
 	size_t assocreq_ies_len, assocresp_ies_len;
 
 	bool	bForcedBgMode;
-	u8 RF_Type;
 
 	u8 hwsec_active;
 	bool is_silent_reset;
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line
  2023-04-05 21:48 ` [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line Philipp Hortmann
@ 2023-04-06 19:54   ` Alison Schofield
  2023-04-06 20:06   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 10+ messages in thread
From: Alison Schofield @ 2023-04-06 19:54 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote:
> Remove unused local variable irq_line.

This does more than just remove the unused variable.

> 
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> index 0bc3e013001e..1c3ccd2aabc3 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
>  	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
>  	u16 device_id;
>  	u8  revision_id;
> -	u16 irq_line;
>  
>  	device_id = pdev->device;
>  	revision_id = pdev->revision;
> -	pci_read_config_word(pdev, 0x3C, &irq_line);
>  
>  	priv->card_8192 = NIC_8192E;
>  
> -- 
> 2.40.0
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line
  2023-04-05 21:48 ` [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line Philipp Hortmann
  2023-04-06 19:54   ` Alison Schofield
@ 2023-04-06 20:06   ` Greg Kroah-Hartman
  2023-04-07  8:08     ` Philipp Hortmann
  1 sibling, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2023-04-06 20:06 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: linux-staging, linux-kernel

On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote:
> Remove unused local variable irq_line.
> 
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> index 0bc3e013001e..1c3ccd2aabc3 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
>  	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
>  	u16 device_id;
>  	u8  revision_id;
> -	u16 irq_line;
>  
>  	device_id = pdev->device;
>  	revision_id = pdev->revision;
> -	pci_read_config_word(pdev, 0x3C, &irq_line);

As was pointed out, that might not be "unused".

When doing a PCI write, the only way to know it has completed is to
issue a read.  Are you sure this isn't a read that is flushing out a
pending write?  Look at who calls this function and verify that this
read really is safe to remove and then document that really really well
in the changelog text when doing so.

Be careful about removing seemingly-unused PCI read/writes, they often
times are actually needed.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line
  2023-04-06 20:06   ` Greg Kroah-Hartman
@ 2023-04-07  8:08     ` Philipp Hortmann
  2023-04-07  8:20       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 10+ messages in thread
From: Philipp Hortmann @ 2023-04-07  8:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel

On 4/6/23 22:06, Greg Kroah-Hartman wrote:
> On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote:
>> Remove unused local variable irq_line.
>>
>> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
>> ---
>>   drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
>> index 0bc3e013001e..1c3ccd2aabc3 100644
>> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
>> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
>> @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
>>   	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
>>   	u16 device_id;
>>   	u8  revision_id;
>> -	u16 irq_line;
>>   
>>   	device_id = pdev->device;
>>   	revision_id = pdev->revision;
>> -	pci_read_config_word(pdev, 0x3C, &irq_line);
> 
> As was pointed out, that might not be "unused".
> 
> When doing a PCI write, the only way to know it has completed is to
> issue a read.  Are you sure this isn't a read that is flushing out a
> pending write?  Look at who calls this function and verify that this
> read really is safe to remove and then document that really really well
> in the changelog text when doing so.
> 
> Be careful about removing seemingly-unused PCI read/writes, they often
> times are actually needed.
> 
> thanks,
> 
> greg k-h

Hi,

The first function that is called of the driver is: _rtl92e_pci_probe().
66 Lines later the function rtl92e_check_adapter() is called. The line
pci_read_config_word() is the 10th line of this function.

No other pci function before in function rtl92e_check_adapter().

The following functions are used in the probe function before the
rtl92e_check_adapter():

pci_enable_device()		Does not require a pci read.
pci_set_master()		Does not require a pci read.
dma_set_mask()			Does not require a pci read.
alloc_rtllib()			Does not require a pci read.
pci_set_drvdata()		Does not require a pci read.
SET_NETDEV_DEV()		Does not require a pci read.
rtllib_priv()			Does not require a pci read.
pci_resource_start()		Does not require a pci read.
pci_resource_len()		Does not require a pci read.
pci_resource_flags()		Does not require a pci read.
request_mem_region()		Does not require a pci read.
ioremap()			Does not require a pci read.
pci_resource_len()		Does not require a pci read.
pci_read_config_byte()		Which is deleted in this
				patch series. So Gregs hint is
  				applicable for this patch as well.

I am going to issue a v2.

Thanks for your support.

Bye Philipp


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line
  2023-04-07  8:08     ` Philipp Hortmann
@ 2023-04-07  8:20       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2023-04-07  8:20 UTC (permalink / raw)
  To: Philipp Hortmann; +Cc: linux-staging, linux-kernel

On Fri, Apr 07, 2023 at 10:08:50AM +0200, Philipp Hortmann wrote:
> On 4/6/23 22:06, Greg Kroah-Hartman wrote:
> > On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote:
> > > Remove unused local variable irq_line.
> > > 
> > > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> > > ---
> > >   drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 --
> > >   1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> > > index 0bc3e013001e..1c3ccd2aabc3 100644
> > > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> > > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
> > > @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev)
> > >   	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
> > >   	u16 device_id;
> > >   	u8  revision_id;
> > > -	u16 irq_line;
> > >   	device_id = pdev->device;
> > >   	revision_id = pdev->revision;
> > > -	pci_read_config_word(pdev, 0x3C, &irq_line);
> > 
> > As was pointed out, that might not be "unused".
> > 
> > When doing a PCI write, the only way to know it has completed is to
> > issue a read.  Are you sure this isn't a read that is flushing out a
> > pending write?  Look at who calls this function and verify that this
> > read really is safe to remove and then document that really really well
> > in the changelog text when doing so.
> > 
> > Be careful about removing seemingly-unused PCI read/writes, they often
> > times are actually needed.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Hi,
> 
> The first function that is called of the driver is: _rtl92e_pci_probe().
> 66 Lines later the function rtl92e_check_adapter() is called. The line
> pci_read_config_word() is the 10th line of this function.
> 
> No other pci function before in function rtl92e_check_adapter().
> 
> The following functions are used in the probe function before the
> rtl92e_check_adapter():
> 
> pci_enable_device()		Does not require a pci read.
> pci_set_master()		Does not require a pci read.
> dma_set_mask()			Does not require a pci read.
> alloc_rtllib()			Does not require a pci read.
> pci_set_drvdata()		Does not require a pci read.
> SET_NETDEV_DEV()		Does not require a pci read.
> rtllib_priv()			Does not require a pci read.
> pci_resource_start()		Does not require a pci read.
> pci_resource_len()		Does not require a pci read.
> pci_resource_flags()		Does not require a pci read.
> request_mem_region()		Does not require a pci read.
> ioremap()			Does not require a pci read.
> pci_resource_len()		Does not require a pci read.
> pci_read_config_byte()		Which is deleted in this
> 				patch series. So Gregs hint is
>  				applicable for this patch as well.
> 
> I am going to issue a v2.

How do you know that this device does not require that register to be
read from in order to work properly?  Remember, reads can change
device's state as well as writes.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-04-07  8:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-05 21:47 [PATCH 0/5] staging: rtl8192e: Remove unused code for hardware rtl8192se Philipp Hortmann
2023-04-05 21:48 ` [PATCH 1/5] staging: rtl8192e: Remove macro IS_HARDWARE_TYPE_8192SE Philipp Hortmann
2023-04-05 21:48 ` [PATCH 2/5] staging: rtl8192e: Remove unused function _rtl92e_dm_init_wa_broadcom_iot Philipp Hortmann
2023-04-05 21:48 ` [PATCH 3/5] staging: rtl8192e: Remove one of two checks for hardware RTL8192SE Philipp Hortmann
2023-04-05 21:48 ` [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line Philipp Hortmann
2023-04-06 19:54   ` Alison Schofield
2023-04-06 20:06   ` Greg Kroah-Hartman
2023-04-07  8:08     ` Philipp Hortmann
2023-04-07  8:20       ` Greg Kroah-Hartman
2023-04-05 21:48 ` [PATCH 5/5] staging: rtl8192e: Remove unused variable RF_Type Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).