linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase
@ 2022-11-06 13:18 Yogesh Hegde
  2022-11-06 16:40 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Yogesh Hegde @ 2022-11-06 13:18 UTC (permalink / raw)
  To: gregkh
  Cc: philipp.g.hortmann, dragan.m.cvetic, wjsota, linux-staging,
	linux-kernel

Rename variables
* TM_trigger to tm_trigger
* TxPowerCheckCnt to txpower_check_count
to avoid CamelCase which is not accepted by checkpatch.pl .

Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index 767c746fc73d..0652940eecc5 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -919,32 +919,32 @@ static void _rtl92e_dm_check_tx_power_tracking_tssi(struct net_device *dev)
 static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-	static u8	TM_Trigger;
-	u8		TxPowerCheckCnt = 0;
+	static u8 tm_trigger;
+	u8 txpower_check_count = 0;
 
 	if (IS_HARDWARE_TYPE_8192SE(dev))
-		TxPowerCheckCnt = 5;
+		txpower_check_count = 5;
 	else
-		TxPowerCheckCnt = 2;
+		txpower_check_count = 2;
 	if (!priv->btxpower_tracking)
 		return;
 
-	if (priv->txpower_count  <= TxPowerCheckCnt) {
+	if (priv->txpower_count  <= txpower_check_count) {
 		priv->txpower_count++;
 		return;
 	}
 
-	if (!TM_Trigger) {
+	if (!tm_trigger) {
 		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
 		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
 		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
 		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
-		TM_Trigger = 1;
+		tm_trigger = 1;
 		return;
 	}
 	netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n");
 	schedule_delayed_work(&priv->txpower_tracking_wq, 0);
-	TM_Trigger = 0;
+	tm_trigger = 0;
 
 }
 
-- 
2.25.1


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

* Re: [PATCH] staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase
  2022-11-06 13:18 [PATCH] staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase Yogesh Hegde
@ 2022-11-06 16:40 ` Greg KH
  2022-11-06 17:47   ` Yogesh Hegde
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2022-11-06 16:40 UTC (permalink / raw)
  To: Yogesh Hegde
  Cc: philipp.g.hortmann, dragan.m.cvetic, wjsota, linux-staging,
	linux-kernel

On Sun, Nov 06, 2022 at 06:48:11PM +0530, Yogesh Hegde wrote:
> Rename variables
> * TM_trigger to tm_trigger
> * TxPowerCheckCnt to txpower_check_count
> to avoid CamelCase which is not accepted by checkpatch.pl .
> 
> Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> index 767c746fc73d..0652940eecc5 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> @@ -919,32 +919,32 @@ static void _rtl92e_dm_check_tx_power_tracking_tssi(struct net_device *dev)
>  static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev)
>  {
>  	struct r8192_priv *priv = rtllib_priv(dev);
> -	static u8	TM_Trigger;
> -	u8		TxPowerCheckCnt = 0;
> +	static u8 tm_trigger;
> +	u8 txpower_check_count = 0;

While this is nice overall, I think you just found a bug in the driver.

Why is this a static variable?  That means this affects all devices that
this driver touches, which seems very wrong, right?

So shouldn't tm_trigger be a per-device attribute?

>  	if (IS_HARDWARE_TYPE_8192SE(dev))
> -		TxPowerCheckCnt = 5;
> +		txpower_check_count = 5;
>  	else
> -		TxPowerCheckCnt = 2;
> +		txpower_check_count = 2;
>  	if (!priv->btxpower_tracking)
>  		return;
>  
> -	if (priv->txpower_count  <= TxPowerCheckCnt) {
> +	if (priv->txpower_count  <= txpower_check_count) {
>  		priv->txpower_count++;
>  		return;
>  	}
>  
> -	if (!TM_Trigger) {
> +	if (!tm_trigger) {
>  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
>  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
>  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
>  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
> -		TM_Trigger = 1;
> +		tm_trigger = 1;

It also should be a boolean, right?

Can you fix this up to be a per-device attribute instead?

thanks,

greg k-h

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

* Re: [PATCH] staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase
  2022-11-06 16:40 ` Greg KH
@ 2022-11-06 17:47   ` Yogesh Hegde
  0 siblings, 0 replies; 3+ messages in thread
From: Yogesh Hegde @ 2022-11-06 17:47 UTC (permalink / raw)
  To: Greg KH
  Cc: philipp.g.hortmann, dragan.m.cvetic, wjsota, linux-staging,
	linux-kernel

On Sun, Nov 06, 2022 at 05:40:05PM +0100, Greg KH wrote:
> On Sun, Nov 06, 2022 at 06:48:11PM +0530, Yogesh Hegde wrote:
> > Rename variables
> > * TM_trigger to tm_trigger
> > * TxPowerCheckCnt to txpower_check_count
> > to avoid CamelCase which is not accepted by checkpatch.pl .
> > 
> > Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
> > ---
> >  drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> > index 767c746fc73d..0652940eecc5 100644
> > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> > @@ -919,32 +919,32 @@ static void _rtl92e_dm_check_tx_power_tracking_tssi(struct net_device *dev)
> >  static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev)
> >  {
> >  	struct r8192_priv *priv = rtllib_priv(dev);
> > -	static u8	TM_Trigger;
> > -	u8		TxPowerCheckCnt = 0;
> > +	static u8 tm_trigger;
> > +	u8 txpower_check_count = 0;
> 
> While this is nice overall, I think you just found a bug in the driver.
> 
> Why is this a static variable?  That means this affects all devices that
> this driver touches, which seems very wrong, right?
> 
> So shouldn't tm_trigger be a per-device attribute?
Yes you are right! 
> 
> >  	if (IS_HARDWARE_TYPE_8192SE(dev))
> > -		TxPowerCheckCnt = 5;
> > +		txpower_check_count = 5;
> >  	else
> > -		TxPowerCheckCnt = 2;
> > +		txpower_check_count = 2;
> >  	if (!priv->btxpower_tracking)
> >  		return;
> >  
> > -	if (priv->txpower_count  <= TxPowerCheckCnt) {
> > +	if (priv->txpower_count  <= txpower_check_count) {
> >  		priv->txpower_count++;
> >  		return;
> >  	}
> >  
> > -	if (!TM_Trigger) {
> > +	if (!tm_trigger) {
> >  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
> >  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
> >  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
> >  		rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
> > -		TM_Trigger = 1;
> > +		tm_trigger = 1;
> 
> It also should be a boolean, right?
> 
Yes, it should a boolean, But in the mainline, the maintainers have kept it u8 for some reason [1].

So I am not sure if it should be boolean. Please let me know your 
thoughts on this. 

> Can you fix this up to be a per-device attribute instead?

Sure, just to make sure that we are on the same page, you are expecting
a patch similar to this [2] right? 

Since I am new to mainline kernel development, I wanted to ensure that I am on the right track.  

Thanks 
Yogesh

[1] https://github.com/gregkh/linux/blob/30a0b95b1335e12efef89dd78518ed3e4a71a763/drivers/net/wireless/realtek/rtlwifi/wifi.h#L1812
[2] https://lore.kernel.org/all/20150615093119.2F8431407E7@smtp.codeaurora.org/T/



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

end of thread, other threads:[~2022-11-06 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-06 13:18 [PATCH] staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase Yogesh Hegde
2022-11-06 16:40 ` Greg KH
2022-11-06 17:47   ` Yogesh Hegde

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).