staging: rtl8712: Fix CamelCase warnings
PATCH v2 1/1 staging: rtl8712: Fix CamelCase warnings
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;
---
Changes in v2:
- Remove the "bln" prefix
--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8712/drv_types.h +1 -1
@@ -157,7 +157,7 @@ struct _adapter {struct iw_statistics iwstats;int pid;/*process id from UI*/ struct work_struct wk_filter_rx_ff0; -u8 blnEnableRxFF0Filter; +u8 enable_rx_ff0_filter;spinlock_t lock_rx_ff0_filter;const struct firmware *fw;struct usb_interface *pusb_intf;
drivers/staging/rtl8712/rtl871x_cmd.c +1 -1
@@ -202,7 +202,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,mod_timer (&pmlmepriv->scan_to_timer, jiffies +msecs_to_jiffies (SCANNING_TIMEOUT )); padapter->ledpriv.LedControlHandler (padapter,LED_CTL_SITE_SURVEY ); - padapter->blnEnableRxFF0Filter =0 ; + padapter->enable_rx_ff0_filter =0 ;return _SUCCESS; }
drivers/staging/rtl8712/xmit_linux.c +2 -2
@@ -102,11 +102,11 @@ void r8712_SetFilter(struct work_struct *work)r8712_write8 (adapter,0x117 , newvalue);spin_lock_irqsave (&adapter->lock_rx_ff0_filter, irqL); - adapter->blnEnableRxFF0Filter =1 ; + adapter->enable_rx_ff0_filter =1 ;spin_unlock_irqrestore (&adapter->lock_rx_ff0_filter, irqL);do {msleep (100 ); - }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );r8712_write8 (adapter,0x117 , oldvalue); }
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 19 lines · Sathish Kumar
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;Signed-off-by Sathish Kumar <[email protected]>---
Changes in v2:
- Remove the "bln" prefix--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)drivers/staging/rtl8712/drv_types.h +0
-0
drivers/staging/rtl8712/drv_types.h struct _adapter { · line 160
Quoted 5 lines
drivers/staging/rtl8712/drv_types.h +1
-1@@ -157,7 +157,7 @@ struct _adapter {struct iw_statistics iwstats;int pid;/*process id from UI*/ struct work_struct wk_filter_rx_ff0; -u8 blnEnableRxFF0Filter; +u8 enable_rx_ff0_filter;
Shouldn't this be a boolean?
Quoted 21 lines
drivers/staging/rtl8712/drv_types.h +0
-0spinlock_t lock_rx_ff0_filter;const struct firmware *fw;struct usb_interface *pusb_intf;drivers/staging/rtl8712/rtl871x_cmd.c +1
-1@@ -202,7 +202,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,mod_timer (&pmlmepriv->scan_to_timer, jiffies +msecs_to_jiffies (SCANNING_TIMEOUT )); padapter->ledpriv.LedControlHandler (padapter,LED_CTL_SITE_SURVEY ); - padapter->blnEnableRxFF0Filter =0 ; + padapter->enable_rx_ff0_filter =0 ;return _SUCCESS; }drivers/staging/rtl8712/xmit_linux.c +0
-0
drivers/staging/rtl8712/xmit_linux.c void r8712_SetFilter(struct work_struct *work) · line 109
Quoted 10 lines
drivers/staging/rtl8712/xmit_linux.c +2
-2@@ -102,11 +102,11 @@ void r8712_SetFilter(struct work_struct *work)r8712_write8 (adapter,0x117 , newvalue);spin_lock_irqsave (&adapter->lock_rx_ff0_filter, irqL); - adapter->blnEnableRxFF0Filter =1 ; + adapter->enable_rx_ff0_filter =1 ;spin_unlock_irqrestore (&adapter->lock_rx_ff0_filter, irqL);do {msleep (100 ); - }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );
Ah, that's funny. It's amazing it works at all and that the compiler doesn't optimize this away. This isn't a good pattern to use in kernel code. I know it's not caused by your change here, but perhaps you might want to fix this up to work properly?
thanks,
greg k-h
Quoted 15 lines · Greg KH
Quoted 14 lines · Sathish Kumar
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;Signed-off-by Sathish Kumar <[email protected]>---
Changes in v2:
- Remove the "bln" prefix--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
Quoted 11 lines
drivers/staging/rtl8712/drv_types.h struct _adapter { · line 160
Quoted 10 lines
drivers/staging/rtl8712/drv_types.h +1
-1@@ -157,7 +157,7 @@ struct _adapter {struct iw_statistics iwstats;int pid;/*process id from UI*/ struct work_struct wk_filter_rx_ff0; -u8 blnEnableRxFF0Filter; +u8 enable_rx_ff0_filter;Shouldn't this be a boolean?
Yes. It should be boolean(dealing only with either 0 or 1). Will fix this.
Quoted 24 lines
Quoted 24 lines
drivers/staging/rtl8712/drv_types.h +0
-0spinlock_t lock_rx_ff0_filter;const struct firmware *fw;struct usb_interface *pusb_intf;drivers/staging/rtl8712/rtl871x_cmd.c +1
-1@@ -202,7 +202,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,mod_timer (&pmlmepriv->scan_to_timer, jiffies +msecs_to_jiffies (SCANNING_TIMEOUT )); padapter->ledpriv.LedControlHandler (padapter,LED_CTL_SITE_SURVEY ); - padapter->blnEnableRxFF0Filter =0 ; + padapter->enable_rx_ff0_filter =0 ;return _SUCCESS; }drivers/staging/rtl8712/xmit_linux.c +0
-0@@ -102,11 +102,11 @@ void r8712_SetFilter(struct work_struct *work)r8712_write8 (adapter,0x117 , newvalue);
Quoted 10 lines
drivers/staging/rtl8712/xmit_linux.c void r8712_SetFilter(struct work_struct *work) · line 109
Quoted 8 lines
drivers/staging/rtl8712/xmit_linux.c +2
-2spin_lock_irqsave (&adapter->lock_rx_ff0_filter, irqL); - adapter->blnEnableRxFF0Filter =1 ; + adapter->enable_rx_ff0_filter =1 ;spin_unlock_irqrestore (&adapter->lock_rx_ff0_filter, irqL);do {msleep (100 ); - }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );Ah, that's funny. It's amazing it works at all and that the compiler doesn't optimize this away. This isn't a good pattern to use in kernel
Do you mean "do { msleep(); } while()" here?
Quoted 6 lines
code. I know it's not caused by your change here, but perhaps you might want to fix this up to work properly?
thanks,
greg k-h
Sure. Will fix this up to work properly.
Thanks,
Sathish
Quoted 50 lines · Greg KH
Quoted 19 lines · Sathish Kumar
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;Signed-off-by Sathish Kumar <[email protected]>---
Changes in v2:
- Remove the "bln" prefix--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)drivers/staging/rtl8712/drv_types.h +0
-0drivers/staging/rtl8712/drv_types.h struct _adapter { · line 160
Quoted 5 lines
drivers/staging/rtl8712/drv_types.h +1
-1@@ -157,7 +157,7 @@ struct _adapter {struct iw_statistics iwstats;int pid;/*process id from UI*/ struct work_struct wk_filter_rx_ff0; -u8 blnEnableRxFF0Filter; +u8 enable_rx_ff0_filter;Shouldn't this be a boolean?
Quoted 23 lines
drivers/staging/rtl8712/drv_types.h +0
-0spinlock_t lock_rx_ff0_filter;const struct firmware *fw;struct usb_interface *pusb_intf;drivers/staging/rtl8712/rtl871x_cmd.c +1
-1@@ -202,7 +202,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,mod_timer (&pmlmepriv->scan_to_timer, jiffies +msecs_to_jiffies (SCANNING_TIMEOUT )); padapter->ledpriv.LedControlHandler (padapter,LED_CTL_SITE_SURVEY ); - padapter->blnEnableRxFF0Filter =0 ; + padapter->enable_rx_ff0_filter =0 ;return _SUCCESS; }drivers/staging/rtl8712/xmit_linux.c +0
-0@@ -102,11 +102,11 @@ void r8712_SetFilter(struct work_struct *work)r8712_write8 (adapter,0x117 , newvalue);
Quoted 10 lines
drivers/staging/rtl8712/xmit_linux.c void r8712_SetFilter(struct work_struct *work) · line 109
Quoted 8 lines
drivers/staging/rtl8712/xmit_linux.c +2
-2spin_lock_irqsave (&adapter->lock_rx_ff0_filter, irqL); - adapter->blnEnableRxFF0Filter =1 ; + adapter->enable_rx_ff0_filter =1 ;spin_unlock_irqrestore (&adapter->lock_rx_ff0_filter, irqL);do {msleep (100 ); - }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );Ah, that's funny. It's amazing it works at all and that the compiler doesn't optimize this away. This isn't a good pattern to use in kernel
Do you mean the following code is not a good pattern in kernel? do {msleep();
} while(condition);
Quoted 6 lines
code. I know it's not caused by your change here, but perhaps you might want to fix this up to work properly?
thanks,
greg k-h
Do i need to replace the above code with some other mechanism?
If yes, please let me know which mechanism i should use? Or what should I do here?
Note : I am new to Linux kernel development and looking forward to learn and contribute.
Thanks,
Sathish
Quoted 24 lines · On martedì 22 marzo 2022 05:30:29 CET Sathish Kumar wrote:
Quoted 15 lines · Greg KH
Quoted 14 lines · Sathish Kumar
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;Signed-off-by Sathish Kumar <[email protected]>---
Changes in v2:
- Remove the "bln" prefix--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)Quoted 8 lines
drivers/staging/rtl8712/xmit_linux.c void r8712_SetFilter(struct work_struct *work) · line 109
Quoted 6 lines
[...]
do { msleep(100);drivers/staging/rtl8712/xmit_linux.c +1
-1- }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );Ah, that's funny. It's amazing it works at all and that the compiler doesn't optimize this away. This isn't a good pattern to use in kernel
Quoted 4 lines
Do you mean the following code is not a good pattern in kernel? do {
msleep();
} while(condition);
Exactly, this is not a pattern that works as you expect :)
I was waiting for Greg to detail something more about this subject but, since it looks like he has no time yet to respond, I'll try to interpret his words.
(@Greg, please forgive me if I saying something different from what you intended to convey :)).
The reason why this pattern does not work as expected is too long to be explained here. However, I think that Greg is suggesting to you to research and use what are called "Condition variables".
Take some time to research and understand what the Linuc kernel uses for waiting for completion or state changes: struct completion, wait_for_completion(), complete(), and others.
Another related mechanism are the Linux kernel "Wait Queues". Do some research and understand how to use wait_event{,_interruptible,timeout} and wake_up{,all,interruptible,interruptible_all}.
If I recall correctly you may find one or more of my own patches to r8188eu where I use those API (git-log is your friend).
I hope that all the above will be sufficient to start with.
Again, Greg please correct my words if I'm misinterpreting what you requested to Sathish.
Thanks,
Fabio M. De Francesco
Quoted 19 lines
Quoted 6 lines
I know it's not caused by your change here, but perhaps you might want to fix this up to work properly?
thanks,
greg k-h
Do i need to replace the above code with some other mechanism?
If yes, please let me know which mechanism i should use? Or what should I do here?
Note : I am new to Linux kernel development and looking forward to learn and contribute.
Thanks,
Sathish
Quoted 3 lines · On martedì 22 marzo 2022 11:42:21 CET Fabio M. De Francesco wrote:
The reason why this pattern does not work as expected is too long to be explained here. However, I think that Greg is suggesting to you to research and use what are called "Condition variables".
Sorry, "Condition" -> "Completion".
Fabio
Greg KH
maintainerQuoted 36 lines · Fabio M. De Francesco
Quoted 24 lines · On martedì 22 marzo 2022 05:30:29 CET Sathish Kumar wrote:
Quoted 15 lines · Greg KH
Quoted 14 lines · Sathish Kumar
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;Signed-off-by Sathish Kumar <[email protected]>---
Changes in v2:
- Remove the "bln" prefix--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)Quoted 8 lines
drivers/staging/rtl8712/xmit_linux.c void r8712_SetFilter(struct work_struct *work) · line 109
Quoted 6 lines
[...]
do { msleep(100);drivers/staging/rtl8712/xmit_linux.c +1
-1- }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );Ah, that's funny. It's amazing it works at all and that the compiler doesn't optimize this away. This isn't a good pattern to use in kernel
Quoted 4 lines
Do you mean the following code is not a good pattern in kernel? do {
msleep();
} while(condition);Exactly, this is not a pattern that works as you expect :)
I was waiting for Greg to detail something more about this subject but, since it looks like he has no time yet to respond, I'll try to interpret his words.
Quoted 6 lines
(@Greg, please forgive me if I saying something different from what you intended to convey :)).
The reason why this pattern does not work as expected is too long to be explained here. However, I think that Greg is suggesting to you to research and use what are called "Condition variables".
Kind of. The problem is that "condition" here is just looking at a random variable. There is no sort of assurance that the variable will actually change or that that compiler even has to read from memory for it. It could cache the value the first time it is read and then never update it for the whole loop logic.
Please read Documentation/memory-barriers.txt for how to fix this all up and do it properly.
Again, it's amazing that the current code even works at all. So maybe it doesn't! :)
thansks,
greg k-h
Quoted 51 lines · Greg KH
Quoted 35 lines · Fabio M. De Francesco
Quoted 24 lines · On martedì 22 marzo 2022 05:30:29 CET Sathish Kumar wrote:
Quoted 15 lines · Greg KH
Quoted 14 lines · Sathish Kumar
This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+ u8 blnEnableRxFF0Filter;Signed-off-by Sathish Kumar <[email protected]>---
Changes in v2:
- Remove the "bln" prefix--- drivers/staging/rtl8712/drv_types.h | 2 +- drivers/staging/rtl8712/rtl871x_cmd.c | 2 +- drivers/staging/rtl8712/xmit_linux.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)Quoted 8 lines
drivers/staging/rtl8712/xmit_linux.c void r8712_SetFilter(struct work_struct *work) · line 109
Quoted 6 lines
[...]
do { msleep(100);drivers/staging/rtl8712/xmit_linux.c +1
-1- }while (adapter->blnEnableRxFF0Filter ==1 ); + }while (adapter->enable_rx_ff0_filter ==1 );Ah, that's funny. It's amazing it works at all and that the compiler doesn't optimize this away. This isn't a good pattern to use in kernel
Quoted 4 lines
Do you mean the following code is not a good pattern in kernel? do {
msleep();
} while(condition);Exactly, this is not a pattern that works as you expect :)
I was waiting for Greg to detail something more about this subject but, since it looks like he has no time yet to respond, I'll try to interpret his words.
Quoted 6 lines
(@Greg, please forgive me if I saying something different from what you intended to convey :)).
The reason why this pattern does not work as expected is too long to be explained here. However, I think that Greg is suggesting to you to research and use what are called "Condition variables".
Kind of. The problem is that "condition" here is just looking at a random variable. There is no sort of assurance that the variable will actually change or that that compiler even has to read from memory for it. It could cache the value the first time it is read and then never update it for the whole loop logic.
Please read
Documentation/memory-barriers.txtfor how to fix this all up and do it properly.
Quoted 6 lines
Again, it's amazing that the current code even works at all. So maybe it doesn't! :)
thansks,
greg k-h
Thank you Greg and Fabio for your inputs. Will check and fix this up.
Regards,
Sathish