Skip to contentSkip to conversation

staging: rtl8712: Add comment to lock declaration

PATCH In review Jules Irenge 3 participants 4 messages Oct 7, 2019 – Oct 9, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: Add comment to lock declaration

Add comment to spinlock declaration to fix warning issued by checkpatch.pl "CHECK: spinlock_t definition without comment".

---
 drivers/staging/rtl8712/drv_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/drv_types.h +1 -1
index 0c4325073c63..960d8709aada 100644
@@ -160,7 +160,7 @@ struct _adapter {
 	int pid; /*process id from UI*/
 	struct work_struct wk_filter_rx_ff0;
 	u8 blnEnableRxFF0Filter;
-	spinlock_t lock_rx_ff0_filter;
+	spinlock_t lock_rx_ff0_filter; /*spinlock to protect interrupt request*/
 	const struct firmware *fw;
 	struct usb_interface *pusb_intf;
 	struct mutex mutex_start;
Signature · 1 line
2.21.0
#1 lore raw
Quoted 2 lines · Jules Irenge

Add comment to spinlock declaration to fix warning issued by checkpatch.pl "CHECK: spinlock_t definition without comment".

Since it is not apparent from the shown code, it would be helpful to describe what evidence you used to choose this comment.

thanks,
julia

Quoted 27 lines
---
 drivers/staging/rtl8712/drv_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/drv_types.h +1 -2
index 0c4325073c63..960d8709aada 100644
@@ -160,7 +160,7 @@ struct _adapter {
 	int pid; /*process id from UI*/
 	struct work_struct wk_filter_rx_ff0;
 	u8 blnEnableRxFF0Filter;
-	spinlock_t lock_rx_ff0_filter;
+	spinlock_t lock_rx_ff0_filter; /*spinlock to protect interrupt request*/
 	const struct firmware *fw;
 	struct usb_interface *pusb_intf;
 	struct mutex mutex_start;
--

2.21.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191007205248.24466-1-jbi.octave%40gmail.com.

#3 lore raw
In reply to Jules Irenge
Quoted 13 lines · Jules Irenge

Add comment to spinlock declaration to fix warning issued by checkpatch.pl "CHECK: spinlock_t definition without comment".

---
 drivers/staging/rtl8712/drv_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/drv_types.h +0 -0
index 0c4325073c63..960d8709aada 100644

drivers/staging/rtl8712/drv_types.h struct _adapter { · line 163

Quoted 5 lines
drivers/staging/rtl8712/drv_types.h +1 -1
@@ -160,7 +160,7 @@ struct _adapter {
 	int pid; /*process id from UI*/
 	struct work_struct wk_filter_rx_ff0;
 	u8 blnEnableRxFF0Filter;
-	spinlock_t lock_rx_ff0_filter;
+	spinlock_t lock_rx_ff0_filter; /*spinlock to protect interrupt request*/

This spinlock seems to be nonsense. It's only used one time:

drivers/staging/rtl8712/xmit_linux.c

    94  void r8712_SetFilter(struct work_struct *work)
    95  {
    96          struct _adapter *adapter = container_of(work, struct _adapter,
    97                                                  wk_filter_rx_ff0);
    98          u8  oldvalue = 0x00, newvalue = 0x00;
    99          unsigned long irqL;
   100  
   101          oldvalue = r8712_read8(adapter, 0x117);
   102          newvalue = oldvalue & 0xfe;
   103          r8712_write8(adapter, 0x117, newvalue);

104
105 spin_lock_irqsave(&adapter->lock_rx_ff0_filter, irqL);
106 adapter->blnEnableRxFF0Filter = 1;

It only protects writing to ->blnEnableRxFF0Filter but it doesn't protect reading so it can't possibly work.

   107          spin_unlock_irqrestore(&adapter->lock_rx_ff0_filter, irqL);
   108          do {
   109                  msleep(100);
   110          } while (adapter->blnEnableRxFF0Filter == 1);
   111          r8712_write8(adapter, 0x117, oldvalue);
   112  }

Also put a space after /* and before */ so the comment looks like:

	/* spinlock to protect interrupt request */

But in this case, the comment isn't correct so please just leave it as-is until someone can fix the locking.

regards,
dan carpenter

#2 lore raw
In reply to Julia Lawall
Quoted 4 lines · Julia Lawall

On Mon, 7 Oct 2019, Jules Irenge wrote:

Quoted 9 lines
Quoted 2 lines

Add comment to spinlock declaration to fix warning issued by checkpatch.pl "CHECK: spinlock_t definition without comment".

Since it is not apparent from the shown code, it would be helpful to describe what evidence you used to choose this comment.

thanks,
julia

Thanks for your feedback, I will leave as it is following the advice of one of the maintainer. I thought a general term of protecting interrupt might be appropriate.

Kind regards
Jules

Quoted 32 lines
Quoted 26 lines
---
 drivers/staging/rtl8712/drv_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/drv_types.h +1 -2
index 0c4325073c63..960d8709aada 100644
@@ -160,7 +160,7 @@ struct _adapter {
 	int pid; /*process id from UI*/
 	struct work_struct wk_filter_rx_ff0;
 	u8 blnEnableRxFF0Filter;
-	spinlock_t lock_rx_ff0_filter;
+	spinlock_t lock_rx_ff0_filter; /*spinlock to protect interrupt request*/
 	const struct firmware *fw;
 	struct usb_interface *pusb_intf;
 	struct mutex mutex_start;
--

2.21.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191007205248.24466-1-jbi.octave%40gmail.com.

Signature · 3 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1910072254290.2578%40hadrien.