Skip to contentSkip to conversation

staging: rtl8712: cleanup struct _adapter

PATCH Superseded Deepak Mishra 2 participants 10 messages Jun 8, 2019 – Jun 9, 2019 Staging

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover staging: rtl8712: cleanup struct _adapter

In process of cleaning up rtl8712 struct _adapter in drv_types.h I have tried to remove some unused variables and redundant lines of code associated with those variables. I have also fixed some CamelCase reported by checkpatch.pl

Deepak Mishra (6):
staging: rtl8712: Fixed CamelCase for EepromAddressSize
staging: rtl8712: Removed redundant code from function
oid_rt_pro_write_register_hdl
staging: rtl8712: Fixed CamelCase cmdThread rename to cmd_thread
staging: rtl8712: removed unused variables from struct _adapter
staging: rtl8712: Renamed CamelCase wkFilterRxFF0 to wk_filter_rx_ff0
staging: rtl8712: Renamed CamelCase lockRxFF0Filter to
lock_rx_ff0_filter

 drivers/staging/rtl8712/drv_types.h        | 13 ++++---------
 drivers/staging/rtl8712/os_intfs.c         |  6 +++---
 drivers/staging/rtl8712/rtl871x_eeprom.c   |  6 +++---
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c |  5 -----
 drivers/staging/rtl8712/rtl871x_xmit.c     |  2 +-
 drivers/staging/rtl8712/usb_intf.c         |  4 ++--
 drivers/staging/rtl8712/xmit_linux.c       |  6 +++---
 7 files changed, 16 insertions(+), 26 deletions(-)
Signature · 1 line
2.19.1
#1 lore raw

PATCH v4 1/6 staging: rtl8712: Fixed CamelCase for EepromAddressSize

This patch renames CamelCase EepromAddressSizefrom to eeprom_address_size in struct _adapter and in related files drv_types.h, rtl871x_eeprom.c, usb_intf.c

This was reported by checkpatch.pl

---
 drivers/staging/rtl8712/drv_types.h      | 2 +-
 drivers/staging/rtl8712/rtl871x_eeprom.c | 6 +++---
 drivers/staging/rtl8712/usb_intf.c       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/drv_types.h +1 -1
index 9ae86631fa8b..d4262a68dd4d 100644
@@ -150,7 +150,7 @@ struct _adapter {
 	bool	suspended;
 	u32	IsrContent;
 	u32	ImrContent;
-	u8	EepromAddressSize;
+	u8	eeprom_address_size;
 	u8	hw_init_completed;
 	struct task_struct *cmdThread;
 	pid_t evtThread;
drivers/staging/rtl8712/rtl871x_eeprom.c +3 -3
index 0027d8eb22fa..221bf92e1b1c 100644
@@ -150,7 +150,7 @@ void r8712_eeprom_write16(struct _adapter *padapter, u16 reg, u16 data)
 	x |= _EEM1 | _EECS;
 	r8712_write8(padapter, EE_9346CR, x);
 	shift_out_bits(padapter, EEPROM_EWEN_OPCODE, 5);
-	if (padapter->EepromAddressSize == 8)	/*CF+ and SDIO*/
+	if (padapter->eeprom_address_size == 8)	/*CF+ and SDIO*/
 		shift_out_bits(padapter, 0, 6);
 	else	/* USB */
 		shift_out_bits(padapter, 0, 4);
@@ -165,7 +165,7 @@ void r8712_eeprom_write16(struct _adapter *padapter, u16 reg, u16 data)
 	 */
 	shift_out_bits(padapter, EEPROM_WRITE_OPCODE, 3);
 	/* select which word in the EEPROM that we are writing to. */
-	shift_out_bits(padapter, reg, padapter->EepromAddressSize);
+	shift_out_bits(padapter, reg, padapter->eeprom_address_size);
 	/* write the data to the selected EEPROM word. */
 	shift_out_bits(padapter, data, 16);
 	if (wait_eeprom_cmd_done(padapter)) {
@@ -207,7 +207,7 @@ u16 r8712_eeprom_read16(struct _adapter *padapter, u16 reg) /*ReadEEprom*/
 	 * The opcode is 3bits in length, reg is 6 bits long
 	 */
 	shift_out_bits(padapter, EEPROM_READ_OPCODE, 3);
-	shift_out_bits(padapter, reg, padapter->EepromAddressSize);
+	shift_out_bits(padapter, reg, padapter->eeprom_address_size);
 	/* Now read the data (16 bits) in from the selected EEPROM word */
 	data = shift_in_bits(padapter);
 	eeprom_clean(padapter);
drivers/staging/rtl8712/usb_intf.c +1 -1
index 7478bbd3de78..200a271c28e1 100644
@@ -246,7 +246,7 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter)
 	struct usb_device *pusbd = pdvobjpriv->pusbdev;
 
 	pdvobjpriv->padapter = padapter;
-	padapter->EepromAddressSize = 6;
+	padapter->eeprom_address_size = 6;
 	phost_iface = &pintf->altsetting[0];
 	piface_desc = &phost_iface->desc;
 	pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints;
Signature · 1 line
2.19.1
#2 lore raw

PATCH v4 2/6 staging: rtl8712: Removed redundant code from function oid_rt_pro_write_register_hdl

In reply to Deepak Mishra

In function oid_rt_pro_write_register_hdl, Adapter->ImrContent is assigned with RegRWStruct->value but Adapter->ImrContent is never used anywhere else. So those lines has no impact and are removed removed.

As that was the only place where ImrContent was used, so the member variable is removed from the structure _adapter

---
 drivers/staging/rtl8712/drv_types.h        | 1 -
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 5 -----
 2 files changed, 6 deletions(-)
drivers/staging/rtl8712/drv_types.h +0 -1
index d4262a68dd4d..9fbd19f03ca9 100644
@@ -149,7 +149,6 @@ struct _adapter {
 	bool	surprise_removed;
 	bool	suspended;
 	u32	IsrContent;
-	u32	ImrContent;
 	u8	eeprom_address_size;
 	u8	hw_init_completed;
 	struct task_struct *cmdThread;
drivers/staging/rtl8712/rtl871x_mp_ioctl.c +0 -5
index 588346da1412..add6c18195d6 100644
@@ -661,11 +661,6 @@ uint oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv)
 			status = RNDIS_STATUS_NOT_ACCEPTED;
 			break;
 		}
-
-		if ((status == RNDIS_STATUS_SUCCESS) &&
-		    (RegRWStruct->offset == HIMR) &&
-		    (RegRWStruct->width == 4))
-			Adapter->ImrContent = RegRWStruct->value;
 	}
 	return status;
 }
Signature · 1 line
2.19.1
#3 lore raw

PATCH v4 3/6 staging: rtl8712: Fixed CamelCase cmdThread rename to cmd_thread

In reply to Deepak Mishra

This patch renames CamelCase cmdThread to cmd_thread in struct _adapter in drv_types.h and in os_intfs.c

This was reported by checkpatch.pl

---
 drivers/staging/rtl8712/drv_types.h | 2 +-
 drivers/staging/rtl8712/os_intfs.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8712/drv_types.h +1 -1
index 9fbd19f03ca9..0c722e9c2410 100644
@@ -151,7 +151,7 @@ struct _adapter {
 	u32	IsrContent;
 	u8	eeprom_address_size;
 	u8	hw_init_completed;
-	struct task_struct *cmdThread;
+	struct task_struct *cmd_thread;
 	pid_t evtThread;
 	struct task_struct *xmitThread;
 	pid_t recvThread;
drivers/staging/rtl8712/os_intfs.c +3 -3
index c962696c9822..1653b36c4bfd 100644
@@ -221,9 +221,9 @@ struct net_device *r8712_init_netdev(void)
 
 static u32 start_drv_threads(struct _adapter *padapter)
 {
-	padapter->cmdThread = kthread_run(r8712_cmd_thread, padapter, "%s",
+	padapter->cmd_thread = kthread_run(r8712_cmd_thread, padapter, "%s",
 					  padapter->pnetdev->name);
-	if (IS_ERR(padapter->cmdThread))
+	if (IS_ERR(padapter->cmd_thread))
 		return _FAIL;
 	return _SUCCESS;
 }
@@ -235,7 +235,7 @@ void r8712_stop_drv_threads(struct _adapter *padapter)
 
 	/*Below is to terminate r8712_cmd_thread & event_thread...*/
 	complete(&padapter->cmdpriv.cmd_queue_comp);
-	if (padapter->cmdThread)
+	if (padapter->cmd_thread)
 		wait_for_completion_interruptible(completion);
 	padapter->cmdpriv.cmd_seq = 1;
 }
Signature · 1 line
2.19.1
#4 lore raw

PATCH v4 4/6 staging: rtl8712: removed unused variables from struct _adapter

In reply to Deepak Mishra

This patch removed following unused member variables from struct _adapter

IsrContent, xmitThread, evtThread, recvThread

---
 drivers/staging/rtl8712/drv_types.h | 4 ----
 1 file changed, 4 deletions(-)
drivers/staging/rtl8712/drv_types.h +0 -4
index 0c722e9c2410..c36a5ef3ee5d 100644
@@ -148,13 +148,9 @@ struct _adapter {
 	bool	driver_stopped;
 	bool	surprise_removed;
 	bool	suspended;
-	u32	IsrContent;
 	u8	eeprom_address_size;
 	u8	hw_init_completed;
 	struct task_struct *cmd_thread;
-	pid_t evtThread;
-	struct task_struct *xmitThread;
-	pid_t recvThread;
 	uint (*dvobj_init)(struct _adapter *adapter);
 	void (*dvobj_deinit)(struct _adapter *adapter);
 	struct net_device *pnetdev;
Signature · 1 line
2.19.1
#5 lore raw

PATCH v4 5/6 staging: rtl8712: Renamed CamelCase wkFilterRxFF0 to wk_filter_rx_ff0

In reply to Deepak Mishra

This patch renames CamelCase variable wkFilterRxFF0 to wk_filter_rx_ff0 in drv_types.h, rtl871x_xmit.c and xmit_linux.c

This was reported by checkpatch.pl

---
 drivers/staging/rtl8712/drv_types.h    | 2 +-
 drivers/staging/rtl8712/rtl871x_xmit.c | 2 +-
 drivers/staging/rtl8712/xmit_linux.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/drv_types.h +1 -1
index c36a5ef3ee5d..7838c945d622 100644
@@ -158,7 +158,7 @@ struct _adapter {
 	struct net_device_stats stats;
 	struct iw_statistics iwstats;
 	int pid; /*process id from UI*/
-	struct work_struct wkFilterRxFF0;
+	struct work_struct wk_filter_rx_ff0;
 	u8 blnEnableRxFF0Filter;
 	spinlock_t lockRxFF0Filter;
 	const struct firmware *fw;
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
index bfd5538a4652..5d63d2721eb6 100644
@@ -139,7 +139,7 @@ sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
 		pxmitbuf++;
 	}
 	pxmitpriv->free_xmitbuf_cnt = NR_XMITBUFF;
-	INIT_WORK(&padapter->wkFilterRxFF0, r8712_SetFilter);
+	INIT_WORK(&padapter->wk_filter_rx_ff0, r8712_SetFilter);
 	alloc_hwxmits(padapter);
 	init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
 	tasklet_init(&pxmitpriv->xmit_tasklet,
drivers/staging/rtl8712/xmit_linux.c +1 -1
index 8bcb0775411f..e65a51c7f372 100644
@@ -94,7 +94,7 @@ void r8712_set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
 void r8712_SetFilter(struct work_struct *work)
 {
 	struct _adapter *padapter = container_of(work, struct _adapter,
-						wkFilterRxFF0);
+						wk_filter_rx_ff0);
 	u8  oldvalue = 0x00, newvalue = 0x00;
 	unsigned long irqL;
 
Signature · 1 line
2.19.1
#6 lore raw

PATCH v4 6/6 staging: rtl8712: Renamed CamelCase lockRxFF0Filter to lock_rx_ff0_filter

In reply to Deepak Mishra

This patch renames CamelCase variable lockRxFF0Filter to lock_rx_ff0_filter in drv_types.h, usb_intf.c and xmit_linux.c

This was reported by checkpatch.pl

---
 drivers/staging/rtl8712/drv_types.h  | 2 +-
 drivers/staging/rtl8712/usb_intf.c   | 2 +-
 drivers/staging/rtl8712/xmit_linux.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8712/drv_types.h +1 -1
index 7838c945d622..0c4325073c63 100644
@@ -160,7 +160,7 @@ struct _adapter {
 	int pid; /*process id from UI*/
 	struct work_struct wk_filter_rx_ff0;
 	u8 blnEnableRxFF0Filter;
-	spinlock_t lockRxFF0Filter;
+	spinlock_t lock_rx_ff0_filter;
 	const struct firmware *fw;
 	struct usb_interface *pusb_intf;
 	struct mutex mutex_start;
drivers/staging/rtl8712/usb_intf.c +1 -1
index 200a271c28e1..d0daae0b8299 100644
@@ -571,7 +571,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 	/* step 6. Load the firmware asynchronously */
 	if (rtl871x_load_fw(padapter))
 		goto error;
-	spin_lock_init(&padapter->lockRxFF0Filter);
+	spin_lock_init(&padapter->lock_rx_ff0_filter);
 	mutex_init(&padapter->mutex_start);
 	return 0;
 error:
drivers/staging/rtl8712/xmit_linux.c +2 -2
index e65a51c7f372..71100613aeb3 100644
@@ -102,9 +102,9 @@ void r8712_SetFilter(struct work_struct *work)
 	newvalue = oldvalue & 0xfe;
 	r8712_write8(padapter, 0x117, newvalue);
 
-	spin_lock_irqsave(&padapter->lockRxFF0Filter, irqL);
+	spin_lock_irqsave(&padapter->lock_rx_ff0_filter, irqL);
 	padapter->blnEnableRxFF0Filter = 1;
-	spin_unlock_irqrestore(&padapter->lockRxFF0Filter, irqL);
+	spin_unlock_irqrestore(&padapter->lock_rx_ff0_filter, irqL);
 	do {
 		msleep(100);
 	} while (padapter->blnEnableRxFF0Filter == 1);
Signature · 1 line
2.19.1
maintainer
#7 lore raw
In reply to Deepak Mishra
Quoted 5 lines · Deepak Mishra

In process of cleaning up rtl8712 struct _adapter in drv_types.h I have tried to remove some unused variables and redundant lines of code associated with those variables. I have also fixed some CamelCase reported by checkpatch.pl

Quoted 9 lines

Deepak Mishra (6):
staging: rtl8712: Fixed CamelCase for EepromAddressSize
staging: rtl8712: Removed redundant code from function
oid_rt_pro_write_register_hdl
staging: rtl8712: Fixed CamelCase cmdThread rename to cmd_thread
staging: rtl8712: removed unused variables from struct _adapter
staging: rtl8712: Renamed CamelCase wkFilterRxFF0 to wk_filter_rx_ff0
staging: rtl8712: Renamed CamelCase lockRxFF0Filter to
lock_rx_ff0_filter

If this is a "v4" series, I do not see a list of what has changed from the previous versions at all here :(

Please list it somewhere, usually in the individual patches below the --- line, or you can put it here in the 00/XX email as well.

v5 please?

thanks,

greg k-h

#8 lore raw

Hi Greg,

Quoted 15 lines · Greg KH
Quoted 5 lines · Deepak Mishra

In process of cleaning up rtl8712 struct _adapter in drv_types.h I have tried to remove some unused variables and redundant lines of code associated with those variables. I have also fixed some CamelCase reported by checkpatch.pl

Quoted 9 lines

Deepak Mishra (6):
staging: rtl8712: Fixed CamelCase for EepromAddressSize
staging: rtl8712: Removed redundant code from function
oid_rt_pro_write_register_hdl
staging: rtl8712: Fixed CamelCase cmdThread rename to cmd_thread
staging: rtl8712: removed unused variables from struct _adapter
staging: rtl8712: Renamed CamelCase wkFilterRxFF0 to wk_filter_rx_ff0
staging: rtl8712: Renamed CamelCase lockRxFF0Filter to
lock_rx_ff0_filter

Quoted 7 lines

If this is a "v4" series, I do not see a list of what has changed from the previous versions at all here :(

Please list it somewhere, usually in the individual patches below the --- line, or you can put it here in the 00/XX email as well.

v5 please?

In my previous versions I mainly tried to correct the patch submission based on your suggestion for example 1.keeping every individual task separate.
2. Not only just fix CamelCase but if those variables are unused remove those.
3. If any variable is assigned but never used then remove those.

So should I put these review comments in my 0/6 file and send you the v5 of the patch set,

or remove version number and send a new patch set again as if it is a fresh patch set ?

Please suggest.

Best regards
Deepak Mishra

Quoted 3 lines

thanks,

greg k-h

maintainer
#9 lore raw
Quoted 32 lines · Deepak Kumar Mishra

Hi Greg,

Quoted 15 lines · Greg KH
Quoted 5 lines · Deepak Mishra

In process of cleaning up rtl8712 struct _adapter in drv_types.h I have tried to remove some unused variables and redundant lines of code associated with those variables. I have also fixed some CamelCase reported by checkpatch.pl

Quoted 9 lines

Deepak Mishra (6):
staging: rtl8712: Fixed CamelCase for EepromAddressSize
staging: rtl8712: Removed redundant code from function
oid_rt_pro_write_register_hdl
staging: rtl8712: Fixed CamelCase cmdThread rename to cmd_thread
staging: rtl8712: removed unused variables from struct _adapter
staging: rtl8712: Renamed CamelCase wkFilterRxFF0 to wk_filter_rx_ff0
staging: rtl8712: Renamed CamelCase lockRxFF0Filter to
lock_rx_ff0_filter

Quoted 7 lines

If this is a "v4" series, I do not see a list of what has changed from the previous versions at all here :(

Please list it somewhere, usually in the individual patches below the --- line, or you can put it here in the 00/XX email as well.

v5 please?

In my previous versions I mainly tried to correct the patch submission based on your suggestion for example
1.keeping every individual task separate.
2. Not only just fix CamelCase but if those variables are unused remove those.
3. If any variable is assigned but never used then remove those.

Quoted 5 lines

So should I put these review comments in my 0/6 file and send you the v5 of the patch set,

or remove version number and send a new patch set again as if it is a fresh patch set ?

Put all of the information in the 00/XX email and send a new version.

thanks,

greg k-h