[PATCH v2] staging: android: ion: Align with parenthesis

2020-04-02 Thread John B. Wyatt IV
Align two different lines of arguments with the parenthesis
of their respected function definitions. Fix style warnings
of matching alignment.

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
v2: Change comment title and summary
Suggested-by: Julia Lawall 

 drivers/staging/android/ion/ion_page_pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index f85ec5b16b65..0198b886d906 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -37,7 +37,7 @@ static void ion_page_pool_add(struct ion_page_pool *pool, 
struct page *page)
}
 
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
-   1 << pool->order);
+   1 << pool->order);
mutex_unlock(>mutex);
 }
 
@@ -57,7 +57,7 @@ static struct page *ion_page_pool_remove(struct ion_page_pool 
*pool, bool high)
 
list_del(>lru);
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
-   -(1 << pool->order));
+   -(1 << pool->order));
return page;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] staging: emxx_udc: Remove unused code

2020-04-02 Thread John B. Wyatt IV
On Fri, 2020-04-03 at 01:50 +0200, Stefano Brivio wrote:
> On Wed,  1 Apr 2020 19:17:06 -0700
> "John B. Wyatt IV"  wrote:
> 
> > Remove unused code surrounded by an #if 0 block.
> > 
> > Code has not been altered since 2014 as reported by git blame.
> > 
> > Reported by checkpatch.
> > 
> > Signed-off-by: John B. Wyatt IV 
> > ---
> >  drivers/staging/emxx_udc/emxx_udc.h | 6 --
> >  1 file changed, 6 deletions(-)
> > 
> > diff --git a/drivers/staging/emxx_udc/emxx_udc.h
> > b/drivers/staging/emxx_udc/emxx_udc.h
> > index 9c2671cb32f7..bbfebe331033 100644
> > --- a/drivers/staging/emxx_udc/emxx_udc.h
> > +++ b/drivers/staging/emxx_udc/emxx_udc.h
> > @@ -9,12 +9,6 @@
> >  #define _LINUX_EMXX_H
> >  
> >  /*--
> > -*/
> > -/*- Default undef */
> > -#if 0
> > -#define DEBUG
> > -#define UDC_DEBUG_DUMP
> > -#endif
> > -
> >  /*- Default define */
> >  #defineUSE_DMA 1
> >  #define USE_SUSPEND_WAIT   1
> 
> Formally, this is fine. But... think about it: this driver might be
> rather buggy, so the first thing one might want to do with it is to
> "enable" those two defines.
> 
> In general, that stuff has to disappear, and proper debugging
> facilities have to be used, but with a driver in this state, as long
> as
> proper debugging facilities aren't there, you might be doing more
> harm
> than good.

DEBUG is not actually used as far as I can tell (I am still new to
kernel debugging systems to please correct me). There is only a pair of
.c and .h files for this small driver.

UDC_DEBUG_DUMP is only used twice in the entire kernel-both for if
statements.

Should we just set it to:

#define UDC_DEBUG_DUMP 0

And leave the other 3 lines out? Please let me know for a v2.

> 
> -- 
> Stefano
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: gasket: Fix 4 over 80 char warnings

2020-04-01 Thread John B. Wyatt IV
Fix 4 over 80 char warnings by caching long enum values into local
variables.

All enums are only used once inside each function (and once inside
the entire file).

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/gasket/apex_driver.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c 
b/drivers/staging/gasket/apex_driver.c
index 46199c8ca441..f48209ec7d24 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -253,6 +253,8 @@ static int apex_get_status(struct gasket_dev *gasket_dev)
 /* Enter GCB reset state. */
 static int apex_enter_reset(struct gasket_dev *gasket_dev)
 {
+   int idle_gen_reg = APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER;
+
if (bypass_top_level)
return 0;
 
@@ -263,7 +265,7 @@ static int apex_enter_reset(struct gasket_dev *gasket_dev)
 *- Enable GCB idle
 */
gasket_read_modify_write_64(gasket_dev, APEX_BAR_INDEX,
-   
APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER,
+   idle_gen_reg,
0x0, 1, 32);
 
/*- Initiate DMA pause */
@@ -395,11 +397,12 @@ static int apex_device_cleanup(struct gasket_dev 
*gasket_dev)
u64 scalar_error;
u64 hib_error;
int ret = 0;
+   int status = APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS;
 
hib_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX,
   APEX_BAR2_REG_USER_HIB_ERROR_STATUS);
scalar_error = gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX,
- 
APEX_BAR2_REG_SCALAR_CORE_ERROR_STATUS);
+ status);
 
dev_dbg(gasket_dev->dev,
"%s 0x%p hib_error 0x%llx scalar_error 0x%llx\n",
@@ -584,6 +587,8 @@ static int apex_pci_probe(struct pci_dev *pci_dev,
ulong page_table_ready, msix_table_ready;
int retries = 0;
struct gasket_dev *gasket_dev;
+   int page_table_init = APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT;
+   int msix_table_init = APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT;
 
ret = pci_enable_device(pci_dev);
if (ret) {
@@ -606,10 +611,10 @@ static int apex_pci_probe(struct pci_dev *pci_dev,
while (retries < APEX_RESET_RETRY) {
page_table_ready =
gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX,
-  
APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_INIT);
+  page_table_init);
msix_table_ready =
gasket_dev_read_64(gasket_dev, APEX_BAR_INDEX,
-  
APEX_BAR2_REG_KERNEL_HIB_MSIX_TABLE_INIT);
+  msix_table_init);
if (page_table_ready && msix_table_ready)
break;
schedule_timeout(msecs_to_jiffies(APEX_RESET_DELAY));
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] staging: gasket: Fix style issues in apex_driver.c

2020-04-01 Thread John B. Wyatt IV
Cache long enums as local variables to fit under 80 characters. Fix a
comment character limit warning. The goal is to comply with the kernel
style guide. All style issues were identified by checkpatch.

John B. Wyatt IV (2):
  staging: gasket: Fix 4 over 80 char warnings
  staging: gasket: Fix comment 75 character limit warning

 drivers/staging/gasket/apex_driver.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: gasket: Fix comment 75 character limit warning

2020-04-01 Thread John B. Wyatt IV
Fix 75 character limit warning in comment reported by checkpatch.

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/gasket/apex_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c 
b/drivers/staging/gasket/apex_driver.c
index f48209ec7d24..5ad15f398893 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -50,8 +50,8 @@
 #define NUM_NODES 1
 
 /*
- * The total number of entries in the page table. Should match the value read
- * from the register APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_SIZE.
+ * The total number of entries in the page table. Should match the
+ * value read from the register APEX_BAR2_REG_KERNEL_HIB_PAGE_TABLE_SIZE.
  */
 #define APEX_PAGE_TABLE_TOTAL_ENTRIES 8192
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fsl-dpaa2: ethsw: Fix parenthesis alignment

2020-04-01 Thread John B. Wyatt IV
Fix 2 parenthesis alignment issues.

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 676d1ad1b50d..546ad376df99 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1094,7 +1094,8 @@ static int swdev_port_obj_del(struct net_device *netdev,
 
 static int
 ethsw_switchdev_port_attr_set_event(struct net_device *netdev,
-   struct switchdev_notifier_port_attr_info *port_attr_info)
+   struct switchdev_notifier_port_attr_info
+   *port_attr_info)
 {
int err;
 
@@ -1277,7 +1278,8 @@ static int port_switchdev_event(struct notifier_block 
*unused,
 
 static int
 ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev,
-   struct switchdev_notifier_port_obj_info *port_obj_info)
+  struct switchdev_notifier_port_obj_info
+  *port_obj_info)
 {
int err = -EOPNOTSUPP;
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: emxx_udc: Remove unused code

2020-04-01 Thread John B. Wyatt IV
Remove unused code surrounded by an #if 0 block.

Code has not been altered since 2014 as reported by git blame.

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/emxx_udc/emxx_udc.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.h 
b/drivers/staging/emxx_udc/emxx_udc.h
index 9c2671cb32f7..bbfebe331033 100644
--- a/drivers/staging/emxx_udc/emxx_udc.h
+++ b/drivers/staging/emxx_udc/emxx_udc.h
@@ -9,12 +9,6 @@
 #define _LINUX_EMXX_H
 
 /*---*/
-/*- Default undef */
-#if 0
-#define DEBUG
-#define UDC_DEBUG_DUMP
-#endif
-
 /*- Default define */
 #defineUSE_DMA 1
 #define USE_SUSPEND_WAIT   1
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: Fix parenthesis alignment

2020-04-01 Thread John B. Wyatt IV
Fix 2 parenthesis alignment issues.

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/android/ion/ion_page_pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index f85ec5b16b65..0198b886d906 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -37,7 +37,7 @@ static void ion_page_pool_add(struct ion_page_pool *pool, 
struct page *page)
}
 
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
-   1 << pool->order);
+   1 << pool->order);
mutex_unlock(>mutex);
 }
 
@@ -57,7 +57,7 @@ static struct page *ion_page_pool_remove(struct ion_page_pool 
*pool, bool high)
 
list_del(>lru);
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
-   -(1 << pool->order));
+   -(1 << pool->order));
return page;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: Fix parenthesis alignment

2020-04-01 Thread John B. Wyatt IV
Fix 2 parenthesis alignment issues.

Reported by checkpatch.

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/android/ion/ion_page_pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index f85ec5b16b65..0198b886d906 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -37,7 +37,7 @@ static void ion_page_pool_add(struct ion_page_pool *pool, 
struct page *page)
}
 
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
-   1 << pool->order);
+   1 << pool->order);
mutex_unlock(>mutex);
 }
 
@@ -57,7 +57,7 @@ static struct page *ion_page_pool_remove(struct ion_page_pool 
*pool, bool high)
 
list_del(>lru);
mod_node_page_state(page_pgdat(page), NR_KERNEL_MISC_RECLAIMABLE,
-   -(1 << pool->order));
+   -(1 << pool->order));
return page;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v8] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Reviewed-by: Quentin Deslandes 
Signed-off-by: John B. Wyatt IV 
---
v8: Fix trailing space reported by checkpatch
Fix alignment issue suggested by:
Stefano Brivio 

v7: Move an if check.
Suggested by Stefano Brivio 

v6: Forgot to add all the v5 code to commit.

v5: Remove Suggested-by: Julia Lawall above seperator line.
Remove break; statement in switch block.
break; removal checked by both gcc compile and checkpatch.
Suggested by Stefano Brivio 

v4: Move Suggested-by: Julia Lawall above seperator line.
Add Reviewed-by tag as requested by Quentin Deslandes.

v3: Forgot to add v2 code changes to commit.

v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..1ef1f6b22195 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   return ret;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
-   break;
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+ (SOFTPWRCTL_SWPE2 |
+  SOFTPWRCTL_SWPE3));
+   if (ret)
+   return ret;
}
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-
-   return ret;
+   return vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v7] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
On Tue, 2020-03-31 at 00:42 +0200, Stefano Brivio wrote:
> On Mon, 30 Mar 2020 15:37:18 -0700
> "John B. Wyatt IV"  wrote:
> 
> > Add error code handling to unused 'ret' variable that was never
> > used.
> > Return an error code from functions called within
> > vnt_radio_power_on.
> > 
> > Issue reported by coccinelle (coccicheck).
> > 
> > Suggested-by: Quentin Deslandes 
> > Suggested-by: Stefano Brivio 
> > Reviewed-by: Quentin Deslandes 
> > Signed-off-by: John B. Wyatt IV 
> > ---
> > v7: Move an if check.
> > Suggested by Stefano Brivio 
> > 
> > v6: Forgot to add all the v5 code to commit.
> > 
> > v5: Remove Suggested-by: Julia Lawall above seperator line.
> > Remove break; statement in switch block.
> > break; removal checked by both gcc compile and checkpatch.
> > Suggested by Stefano Brivio 
> > 
> > v4: Move Suggested-by: Julia Lawall above seperator line.
> > Add Reviewed-by tag as requested by Quentin Deslandes.
> > 
> > v3: Forgot to add v2 code changes to commit.
> > 
> > v2: Replace goto statements with return.
> > Remove last if check because it was unneeded.
> > Suggested-by: Julia Lawall 
> > 
> >  drivers/staging/vt6656/card.c | 20 
> >  1 file changed, 12 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6656/card.c
> > b/drivers/staging/vt6656/card.c
> > index dc3ab10eb630..df12c73097e0 100644
> > --- a/drivers/staging/vt6656/card.c
> > +++ b/drivers/staging/vt6656/card.c
> > @@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private
> > *priv)
> >  {
> > int ret = 0;
> >  
> > -   vnt_exit_deep_sleep(priv);
> > +   ret = vnt_exit_deep_sleep(priv);
> > +   if (ret)
> > +   return ret;
> >  
> > -   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
> > +   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
> > +   if (ret)
> > +   return ret;
> >  
> > switch (priv->rf_type) {
> > case RF_AL2230:
> > @@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private
> > *priv)
> > case RF_VT3226:
> > case RF_VT3226D0:
> > case RF_VT3342A0:
> > -   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
> > -   (SOFTPWRCTL_SWPE2 |
> > SOFTPWRCTL_SWPE3));
> > -   break;
> > +   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
> > + (SOFTPWRCTL_SWPE2 | 
> > + SOFTPWRCTL_SWPE3));
> 
> Grrr, sorry, almost there, I didn't notice this: SOFTPWRCTL_SWPE3
> needs
> to be aligned *after* the open (useless) parenthesis:
> 
> (SOFTPWRCTL_SWPE2 | 
>  SOFTPWRCTL_SWPE3));
> 
> because it's another operand of the | operation surrounded by ().
> Doesn't checkpatch warn?
> 
> The rest looks good to me.
> 

I had to switch from a VM to native and forget to put the git hook in
this repo clone.

Still, after I did, checkpatch complained about trailing white space
after SOFTPWRCTL_SWPE2 |, but not the alignment issue. Fixing the
alignment issue produced no warnings either. :(

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v7] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Reviewed-by: Quentin Deslandes 
Signed-off-by: John B. Wyatt IV 
---
v7: Move an if check.
Suggested by Stefano Brivio 

v6: Forgot to add all the v5 code to commit.

v5: Remove Suggested-by: Julia Lawall above seperator line.
Remove break; statement in switch block.
break; removal checked by both gcc compile and checkpatch.
Suggested by Stefano Brivio 

v4: Move Suggested-by: Julia Lawall above seperator line.
Add Reviewed-by tag as requested by Quentin Deslandes.

v3: Forgot to add v2 code changes to commit.

v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..df12c73097e0 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   return ret;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
-   break;
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+ (SOFTPWRCTL_SWPE2 | 
+ SOFTPWRCTL_SWPE3));
+   if (ret)
+   return ret;
}
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-
-   return ret;
+   return vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
On Tue, 2020-03-31 at 00:01 +0200, Stefano Brivio wrote:
> On Mon, 30 Mar 2020 14:46:13 -0700
> "John B. Wyatt IV"  wrote:
> 
> > Add error code handling to unused 'ret' variable that was never
> > used.
> > Return an error code from functions called within
> > vnt_radio_power_on.
> > 
> > Issue reported by coccinelle (coccicheck).
> > 
> > Suggested-by: Quentin Deslandes 
> > Suggested-by: Stefano Brivio 
> > Reviewed-by: Quentin Deslandes 
> > Signed-off-by: John B. Wyatt IV 
> > ---
> > v6: Forgot to add all the v5 code to commit.
> > 
> > v5: Remove Suggested-by: Julia Lawall above seperator line.
> > Remove break; statement in switch block.
> > break; removal checked by both gcc compile and checkpatch.
> > Suggested by Stefano Brivio 
> > 
> > v4: Move Suggested-by: Julia Lawall above seperator line.
> > Add Reviewed-by tag as requested by Quentin Deslandes.
> > 
> > v3: Forgot to add v2 code changes to commit.
> > 
> > v2: Replace goto statements with return.
> > Remove last if check because it was unneeded.
> > Suggested-by: Julia Lawall 
> > 
> >  drivers/staging/vt6656/card.c | 20 
> >  1 file changed, 12 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6656/card.c
> > b/drivers/staging/vt6656/card.c
> > index dc3ab10eb630..c947e8188384 100644
> > --- a/drivers/staging/vt6656/card.c
> > +++ b/drivers/staging/vt6656/card.c
> > @@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private
> > *priv)
> >  {
> > int ret = 0;
> >  
> > -   vnt_exit_deep_sleep(priv);
> > +   ret = vnt_exit_deep_sleep(priv);
> > +   if (ret)
> > +   return ret;
> >  
> > -   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
> > +   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
> > +   if (ret)
> > +   return ret;
> >  
> > switch (priv->rf_type) {
> > case RF_AL2230:
> > @@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private
> > *priv)
> > case RF_VT3226:
> > case RF_VT3226D0:
> > case RF_VT3342A0:
> > -   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
> > -   (SOFTPWRCTL_SWPE2 |
> > SOFTPWRCTL_SWPE3));
> > -   break;
> > +   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
> > + (SOFTPWRCTL_SWPE2 | 
> > + SOFTPWRCTL_SWPE3));
> > }
> > +   if (ret)
> > +   return ret;
> 
> Hmm, sorry, I haven't been clear enough I guess.
> 
> This is what you're doing:
> 
> if rf_type is not in that list:
> - set some bits in a register
> - did it fail? return
> - did it fail? return
> ...
> 
> if rf_type is in that list:
> - set some bits in a register
> - did it fail? return
> - set some other bits
> - did it fail? return
> ...
> 
> Now, the "set some other bits" part is already selected depending on
> rf_type. There's no need to check 'ret' otherwise, so you can move
> the
> return just after setting 'ret', in the switch case.
> 

Thank you for pointing that out Stefano. That would be a serious issue
with logic.

Just to be sure. Are you looking for this?

switch (priv->rf_type) {
case RF_AL2230:
case RF_AL2230S:
case RF_AIROHA7230:
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
  (SOFTPWRCTL_SWPE2 | 
  SOFTPWRCTL_SWPE3));
if (ret)
return ret;
}

> With a check, because you don't want to return if ret == 0.
> 

What do you mean exactly by this?

The new code should only return a 0 at the end of the function with the
vnt_mac_reg_bits_off call.


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] staging: fbtft: Replace udelay with preferred usleep_range

2020-03-30 Thread John B. Wyatt IV
On Mon, 2020-03-30 at 19:40 +0200, Stefano Brivio wrote:
> On Sun, 29 Mar 2020 12:37:18 +0200 (CEST)
> Julia Lawall  wrote:
> 
> > On Sun, 29 Mar 2020, Soumyajit Deb wrote:
> > 
> > > I had the same doubt the other day about the replacement of
> > > udelay() with
> > > usleep_range(). The corresponding range for the single argument
> > > value of
> > > udelay() is quite confusing as I couldn't decide the range. But
> > > as much as I
> > > noticed checkpatch.pl gives warning for replacing udelay() with
> > > usleep_range() by checking the argument value of udelay(). In the
> > > documentation, it is written udelay() should be used for a sleep
> > > time of at
> > > most 10 microseconds but between 10 microseconds and 20
> > > milliseconds,
> > > usleep_range() should be used. 
> > > I think the range is code specific and will depend on what range
> > > is
> > > acceptable and doesn't break the code.
> > >  Please correct me if I am wrong.  
> > 
> > The range depends on the associated hardware.
> 
> John, by the way, here you could have checked the datasheet of this
> LCD
> controller. It's a pair of those:
>   https://www.sparkfun.com/datasheets/LCD/ks0108b.pdf
> 

No I have not. This datasheet is a little over my head honestly.

What would you recommend to get familiar with datasheets like this?

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v5] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
On Mon, 2020-03-30 at 23:06 +0200, Stefano Brivio wrote:
> On Mon, 30 Mar 2020 11:45:17 -0700
> "John B. Wyatt IV"  wrote:
> 
> > Add error code handling to unused 'ret' variable that was never
> > used.
> > Return an error code from functions called within
> > vnt_radio_power_on.
> > 
> > Issue reported by coccinelle (coccicheck).
> > 
> > Suggested-by: Quentin Deslandes 
> > Suggested-by: Stefano Brivio 
> > Reviewed-by: Quentin Deslandes 
> > Signed-off-by: John B. Wyatt IV 
> > ---
> > v5: Remove Suggested-by: Julia Lawall above seperator line.
> > Remove break; statement in switch block.
> > break; removal checked by both gcc compile and checkpatch.
> > 
> > [...]
> > 
> > @@ -734,14 +738,15 @@ int vnt_radio_power_on(struct vnt_private
> > *priv)
> > case RF_VT3226:
> > case RF_VT3226D0:
> > case RF_VT3342A0:
> > -   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
> > -   (SOFTPWRCTL_SWPE2 |
> > SOFTPWRCTL_SWPE3));
> > +   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
> > + (SOFTPWRCTL_SWPE2 | 
> > + SOFTPWRCTL_SWPE3));
> > break;
> > }
> > +   if (ret)
> > +   return ret;
> 
> Did you send the wrong version perhaps?
> 

Yes. My apologies. Please see v6.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Reviewed-by: Quentin Deslandes 
Signed-off-by: John B. Wyatt IV 
---
v6: Forgot to add all the v5 code to commit.

v5: Remove Suggested-by: Julia Lawall above seperator line.
Remove break; statement in switch block.
break; removal checked by both gcc compile and checkpatch.
Suggested by Stefano Brivio 

v4: Move Suggested-by: Julia Lawall above seperator line.
Add Reviewed-by tag as requested by Quentin Deslandes.

v3: Forgot to add v2 code changes to commit.

v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..c947e8188384 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   return ret;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
-   break;
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+ (SOFTPWRCTL_SWPE2 | 
+ SOFTPWRCTL_SWPE3));
}
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-
-   return ret;
+   return vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Reviewed-by: Quentin Deslandes 
Signed-off-by: John B. Wyatt IV 
---
v5: Remove Suggested-by: Julia Lawall above seperator line.
Remove break; statement in switch block.
break; removal checked by both gcc compile and checkpatch.
Suggested by Stefano Brivio 

v4: Move Suggested-by: Julia Lawall above seperator line.
Add Reviewed-by tag as requested by Quentin Deslandes.

v3: Forgot to add v2 code changes to commit.

v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..27fc53accdfd 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   return ret;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,14 +738,15 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+ (SOFTPWRCTL_SWPE2 | 
+ SOFTPWRCTL_SWPE3));
break;
}
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-
-   return ret;
+   return vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] staging: vt6656: add error code handling to unused variable

2020-03-30 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Suggested-by: Julia Lawall 
Reviewed-by: Quentin Deslandes 
Signed-off-by: John B. Wyatt IV 
---
v4: Move Suggested-by: Julia Lawall above seperator line.
Add Reviewed-by tag as requested by Quentin Deslandes.
Suggested-by: Quentin Deslandes 

v3: Forgot to add v2 code changes to commit.

v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..239012539e73 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   return ret;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+(SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
break;
}
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-
-   return ret;
+   return vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fbtft: Replace udelay with preferred usleep_range

2020-03-29 Thread John B. Wyatt IV
Fix style issue with usleep_range being reported as preferred over
udelay.

Issue reported by checkpatch.

Please review.

As written in Documentation/timers/timers-howto.rst udelay is the
generally preferred API. hrtimers, as noted in the docs, may be too
expensive for this short timer.

Are the docs out of date, or, is this a checkpatch issue?

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index ec97ad27..019c8cce6bab 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -85,7 +85,7 @@ static void reset(struct fbtft_par *par)
dev_dbg(par->info->device, "%s()\n", __func__);
 
gpiod_set_value(par->gpio.reset, 0);
-   udelay(20);
+   usleep_range(20, 20);
gpiod_set_value(par->gpio.reset, 1);
mdelay(120);
 }
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: vt6656: add error code handling to unused variable

2020-03-29 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Signed-off-by: John B. Wyatt IV 
---
v3: Forgot to add v2 code changes to commit.

v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..239012539e73 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   return ret;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,14 +738,14 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+(SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
break;
}
+   if (ret)
+   return ret;
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-
-   return ret;
+   return vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: vt6656: add error code handling to unused variable

2020-03-29 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Signed-off-by: John B. Wyatt IV 
---
v2: Replace goto statements with return.
Remove last if check because it was unneeded.
Suggested-by: Julia Lawall 

 drivers/staging/vt6656/card.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..9d23c3ec1e60 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   goto end;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   goto end;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,13 +738,18 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+(SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
break;
}
+   if (ret)
+   goto end;
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
+   ret = vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
+   if (ret)
+   goto end;
 
+end:
return ret;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6656: add error code handling to unused variable

2020-03-28 Thread John B. Wyatt IV
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes 
Suggested-by: Stefano Brivio 
Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/vt6656/card.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..9d23c3ec1e60 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv)
 {
int ret = 0;
 
-   vnt_exit_deep_sleep(priv);
+   ret = vnt_exit_deep_sleep(priv);
+   if (ret)
+   goto end;
 
-   vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
+   if (ret)
+   goto end;
 
switch (priv->rf_type) {
case RF_AL2230:
@@ -734,13 +738,18 @@ int vnt_radio_power_on(struct vnt_private *priv)
case RF_VT3226:
case RF_VT3226D0:
case RF_VT3342A0:
-   vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
-   (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
+   ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
+(SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
break;
}
+   if (ret)
+   goto end;
 
-   vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
+   ret = vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
+   if (ret)
+   goto end;
 
+end:
return ret;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] staging: vt6656: change function from always returning 0 to void

2020-03-24 Thread John B. Wyatt IV
Change vnt_radio_power_on from always returning 0 to void.

The first patch in this series was originally submitted as a 
standalone patch. Greg Kroah-Hartman  
suggested more changes to be made into a patchset.

John B. Wyatt IV (2):
  staging: vt6656: remove unneeded variable: ret
  staging: vt6656: change unused int return value to void

 drivers/staging/vt6656/card.c | 9 ++---
 drivers/staging/vt6656/card.h | 2 +-
 drivers/staging/vt6656/main_usb.c | 4 +---
 3 files changed, 4 insertions(+), 11 deletions(-)

-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: vt6656: remove unneeded variable: ret

2020-03-24 Thread John B. Wyatt IV
Remove unneeded variable ret; replace with 0 for the return value.

Update function documentation (comment) on the return status as
suggested by Julia Lawall .

Issue reported by coccinelle (coccicheck).

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/vt6656/card.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..05b57a2489a0 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -716,13 +716,11 @@ int vnt_radio_power_off(struct vnt_private *priv)
  *  Out:
  *  none
  *
- * Return Value: true if success; otherwise false
+ * Return Value: 0
  *
  */
 int vnt_radio_power_on(struct vnt_private *priv)
 {
-   int ret = 0;
-
vnt_exit_deep_sleep(priv);
 
vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
@@ -741,7 +739,7 @@ int vnt_radio_power_on(struct vnt_private *priv)
 
vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 
-   return ret;
+   return 0;
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: vt6656: change unused int return value to void

2020-03-24 Thread John B. Wyatt IV
Change unused int function return value to void from previous patch.

Update function documentation to remove mention of return value.

Remove if statement check of the only usage of function in the
kernel. Replace with calling the function.

Suggested-by: Greg Kroah-Hartman 
Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/vt6656/card.c | 7 ++-
 drivers/staging/vt6656/card.h | 2 +-
 drivers/staging/vt6656/main_usb.c | 4 +---
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 05b57a2489a0..4be7fca32796 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -715,11 +715,8 @@ int vnt_radio_power_off(struct vnt_private *priv)
  *  priv - The adapter to be turned on
  *  Out:
  *  none
- *
- * Return Value: 0
- *
  */
-int vnt_radio_power_on(struct vnt_private *priv)
+void vnt_radio_power_on(struct vnt_private *priv)
 {
vnt_exit_deep_sleep(priv);
 
@@ -739,7 +736,7 @@ int vnt_radio_power_on(struct vnt_private *priv)
 
vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 
-   return 0;
+   return;
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h
index 75cd340c0cce..fcab6b086e71 100644
--- a/drivers/staging/vt6656/card.h
+++ b/drivers/staging/vt6656/card.h
@@ -40,7 +40,7 @@ void vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf,
 u64 vnt_get_next_tbtt(u64 tsf, u16 beacon_interval);
 u64 vnt_get_tsf_offset(u8 rx_rate, u64 tsf1, u64 tsf2);
 int vnt_radio_power_off(struct vnt_private *priv);
-int vnt_radio_power_on(struct vnt_private *priv);
+void vnt_radio_power_on(struct vnt_private *priv);
 u8 vnt_get_pkt_type(struct vnt_private *priv);
 void vnt_set_bss_mode(struct vnt_private *priv);
 
diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 8e7269c87ea9..8214427f5ee3 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -370,9 +370,7 @@ static int vnt_init_registers(struct vnt_private *priv)
if (ret)
goto end;
 
-   ret = vnt_radio_power_on(priv);
-   if (ret)
-   goto end;
+   vnt_radio_power_on(priv);
 
dev_dbg(>usb->dev, "<INIbInitAdapter Exit\n");
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6656: remove unneeded variable: ret

2020-03-22 Thread John B. Wyatt IV
Remove unneeded variable ret; replace with 0 for the return value.

Update function documentation (comment) on the return status as
suggested by Julia Lawall .

Issue reported by coccinelle (coccicheck).

Signed-off-by: John B. Wyatt IV 
---
 drivers/staging/vt6656/card.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index dc3ab10eb630..05b57a2489a0 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -716,13 +716,11 @@ int vnt_radio_power_off(struct vnt_private *priv)
  *  Out:
  *  none
  *
- * Return Value: true if success; otherwise false
+ * Return Value: 0
  *
  */
 int vnt_radio_power_on(struct vnt_private *priv)
 {
-   int ret = 0;
-
vnt_exit_deep_sleep(priv);
 
vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
@@ -741,7 +739,7 @@ int vnt_radio_power_on(struct vnt_private *priv)
 
vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
 
-   return ret;
+   return 0;
 }
 
 void vnt_set_bss_mode(struct vnt_private *priv)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel