staging: ks7010: ks7010_sdio.c: Fix multiple checkpatch warnings
cover staging: ks7010: ks7010_sdio.c: Fix multiple checkpatch warnings
This patchset fixes several checkpatch issues detected in the ks7010_sdio.c file of the ks7010 driver.
sayli karnik (6):
Use <linux/atomic.h> instead of <asm/atomic.h>
Remove braces following single statement blocks
Remove space after '(' and before ')'
Remove unnecessary blank lines
Remove the space after a type cast
Remove the null check before kfree
drivers/staging/ks7010/ks7010_sdio.c | 75 +++++++++++++++--------------------- 1 file changed, 32 insertions(+), 43 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/6 staging: ks7010: ks7010_sdio.c: Use <linux/atomic.h> instead of <asm/atomic.h>
The patch replaces #include <asm/atomic.h> with #include <linux/atomic.h> as suggested by checkpatch.pl.
--- drivers/staging/ks7010/ks7010_sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ks7010/ks7010_sdio.c +1 -1
@@ -14,7 +14,7 @@#include <linux/mmc/card.h> #include <linux/mmc/sdio_func.h> #include <linux/workqueue.h> -#include <asm/atomic.h> +#include <linux/atomic.h> #include "ks_wlan.h" #include "ks_wlan_ioctl.h"
Signature · 1 line
2.7.4
PATCH 2/6 staging: ks7010: ks7010_sdio.c: Remove braces following single statement blocks
In reply to sayli karnikThe patch removes braces {} for single statement blocks, as suggested by checkpatch.pl.
--- drivers/staging/ks7010/ks7010_sdio.c | 41 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 22 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +19 -22
@@ -159,9 +159,9 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv) rw_data =WAKEUP_REQ ; retval =ks7010_sdio_write (priv,WAKEUP , &rw_data,sizeof (rw_data)); -if (retval) { +if (retval)DPRINTK (1 ," error : WAKEUP=%02X\n" , rw_data); - } +DPRINTK (4 ,"wake up : WAKEUP=%02X\n" , rw_data); priv->last_wakeup = jiffies; ++priv->wakeup_count;
@@ -402,9 +402,8 @@ static void rx_event_task(unsigned long dev)hostif_receive (priv, rp->data, rp->size);inc_rxqhead (priv); -if (cnt_rxqbody (priv) >0 ) { +if (cnt_rxqbody (priv) >0 )tasklet_schedule (&priv->ks_wlan_hw.rx_bh_task); - } }return ;
@@ -432,9 +431,8 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size) retval =ks7010_sdio_read (priv,DATA_WINDOW , &rx_buffer->data[0 ],hif_align_size (size)); -if (retval) { +if (retval) goto error_out; - }/* length check */ if (size >2046 || size ==0 ) {
@@ -449,9 +447,9 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size) retval =ks7010_sdio_write (priv,READ_STATUS , &read_status,sizeof (read_status)); -if (retval) { +if (retval)DPRINTK (1 ," error : READ_STATUS=%02X\n" , read_status); - } + goto error_out; }
@@ -465,9 +463,9 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size) retval =ks7010_sdio_write (priv,READ_STATUS , &read_status,sizeof (read_status)); -if (retval) { +if (retval)DPRINTK (1 ," error : READ_STATUS=%02X\n" , read_status); - } +DPRINTK (4 ,"READ_STATUS=%02X\n" , read_status);if (atomic_read (&priv->psstatus.confirm_wait)) {
@@ -551,9 +549,9 @@ static void ks7010_rw_function(struct work_struct *work)ks_wlan_hw_rx ((void *)priv, (uint16_t ) (((rw_data &RSIZE_MASK ) <<4 ))); } -if ((rw_data &WSTATUS_MASK )) { +if ((rw_data &WSTATUS_MASK ))tx_device_task ((void *)priv); - } +_ks_wlan_hw_power_save (priv); err_out:
@@ -903,9 +901,8 @@ static void ks7010_card_init(struct ks_wlan_private *priv)DPRINTK (1 ,"wait time out!! SME_START\n" ); } -if (priv->mac_address_valid && priv->version_size) { +if (priv->mac_address_valid && priv->version_size) priv->dev_state =DEVICE_STATE_PREINIT ; - }hostif_sme_enqueue (priv,SME_GET_EEPROM_CKSUM );
@@ -1048,9 +1045,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,init_completion (&priv->ks_wlan_hw.ks7010_sdio_wait); priv->ks_wlan_hw.read_buf =NULL ; priv->ks_wlan_hw.read_buf =kmalloc (RX_DATA_SIZE ,GFP_KERNEL ); -if (!priv->ks_wlan_hw.read_buf) { +if (!priv->ks_wlan_hw.read_buf) goto error_free_netdev; - } + priv->dev_state =DEVICE_STATE_PREBOOT ; priv->net_dev = netdev; priv->firmware_version[0 ] ='\0' ;
@@ -1086,9 +1083,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,sdio_claim_host (func); ret =ks7010_sdio_write (priv,INT_PENDING , &rw_data,sizeof (rw_data));sdio_release_host (func); -if (ret) { +if (ret)DPRINTK (1 ," error : INT_PENDING=%02X\n" , rw_data); - } +DPRINTK (4 ," clear Interrupt : INT_PENDING=%02X\n" , rw_data);/* enable ks7010sdio interrupt (INT_GCR_B|INT_READ_STATUS|INT_WRITE_STATUS) */
@@ -1096,9 +1093,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,sdio_claim_host (func); ret =ks7010_sdio_write (priv,INT_ENABLE , &rw_data,sizeof (rw_data));sdio_release_host (func); -if (ret) { +if (ret)DPRINTK (1 ," error : INT_ENABLE=%02X\n" , rw_data); - } +DPRINTK (4 ," enable Interrupt : INT_ENABLE=%02X\n" , rw_data); priv->dev_state =DEVICE_STATE_BOOT ;
@@ -1199,9 +1196,9 @@ static void ks7010_sdio_remove(struct sdio_func *func)unregister_netdev (netdev);trx_device_exit (priv); -if (priv->ks_wlan_hw.read_buf) { +if (priv->ks_wlan_hw.read_buf)kfree (priv->ks_wlan_hw.read_buf); - } +free_netdev (priv->net_dev); card->priv =NULL ; }
Signature · 1 line
2.7.4
PATCH 3/6 staging: ks7010: ks7010_sdio.c: Remove space after '(' and before ')'
In reply to sayli karnikThe patch fixes the following errors detected by checkpatch.pl:
ERROR: space prohibited before that close parenthesis ')'
ERROR: space prohibited after that open parenthesis '('
--- drivers/staging/ks7010/ks7010_sdio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +6 -6
@@ -35,18 +35,18 @@ MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);/* macro */ #define inc_txqhead (priv) \ - ( priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE ) + (priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)#define inc_txqtail (priv) \ - ( priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE ) + (priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)#define cnt_txqbody (priv) \ - (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE ) + (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE)#define inc_rxqhead (priv) \ - ( priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE ) + (priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)#define inc_rxqtail (priv) \ - ( priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE ) + (priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)#define cnt_rxqbody (priv) \ - (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE ) + (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE)static int ks7010_sdio_read (struct ks_wlan_private *priv,unsigned int address,unsigned char *buffer,int length)
Signature · 1 line
2.7.4
PATCH 4/6 staging: ks7010: ks7010_sdio.c: Remove unnecessary blank lines
In reply to sayli karnikThe patch removes unnecessary blank lines as detected by checkpatch.pl.
--- drivers/staging/ks7010/ks7010_sdio.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +0 -4
@@ -182,7 +182,6 @@ int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)if (priv->reg.operation_mode ==MODE_INFRASTRUCTURE && (priv->connect_status &CONNECT_STATUS_MASK ) ==CONNECT_STATUS ) { -//DPRINTK(1,"psstatus.status=%d\n",atomic_read(&priv->psstatus.status)); if (priv->dev_state ==DEVICE_STATE_SLEEP ) {switch (atomic_read (&priv->psstatus.status)) {
@@ -246,7 +245,6 @@ int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)break ; } } - }return rc;
@@ -346,7 +344,6 @@ static void tx_device_task(void *dev) &priv->ks_wlan_hw.rw_wq, 1);return ; } - }kfree (sp->sendp);/* allocated memory free */ if (sp->complete_handler)/* TX Complete */
@@ -605,7 +602,6 @@ static void ks_sdio_interrupt(struct sdio_func *func) }complete (&priv->psstatus.wakeup_wait); } - } do {
Signature · 1 line
2.7.4
Re: [Outreachy kernel] [PATCH 4/6] staging: ks7010: ks7010_sdio.c: Remove unnecessary blank lines
Quoted 12 lines · sayli karnik
The patch removes unnecessary blank lines as detected by checkpatch.pl.
Signed-off-by sayli karnik <[email protected]>--- drivers/staging/ks7010/ks7010_sdio.c | 4 ---- 1 file changed, 4 deletions(-)drivers/staging/ks7010/ks7010_sdio.c +0
-0
drivers/staging/ks7010/ks7010_sdio.c int _ks_wlan_hw_power_save(struct ks_wlan_private *priv) · line 185
Quoted 5 lines
drivers/staging/ks7010/ks7010_sdio.c +0
-1@@ -182,7 +182,6 @@ int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)if (priv->reg.operation_mode ==MODE_INFRASTRUCTURE && (priv->connect_status &CONNECT_STATUS_MASK ) ==CONNECT_STATUS ) { -//DPRINTK(1,"psstatus.status=%d\n",atomic_read(&priv->psstatus.status));
Code under comments can also be removed.
julia
Quoted 36 lines
drivers/staging/ks7010/ks7010_sdio.c +0
-4if (priv->dev_state ==DEVICE_STATE_SLEEP ) {switch (atomic_read (&priv->psstatus.status)) {@@ -246,7 +245,6 @@ int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)break ; } } - }return rc;@@ -346,7 +344,6 @@ static void tx_device_task(void *dev) &priv->ks_wlan_hw.rw_wq, 1);return ; } - }kfree (sp->sendp);/* allocated memory free */ if (sp->complete_handler)/* TX Complete */ @@ -605,7 +602,6 @@ static void ks_sdio_interrupt(struct sdio_func *func) }complete (&priv->psstatus.wakeup_wait); } - } do { --2.7.4
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/ef5c8c6f3229b6052e053974768a5c0b87549246.1473877138.git.karniksayli1995%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 5/6 staging: ks7010: ks7010_sdio.c: Remove the space after a type cast
In reply to sayli karnikThe patch removes an unnecessary space after a cast, as detected by checkpatch.pl.
--- drivers/staging/ks7010/ks7010_sdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +3 -3
@@ -544,7 +544,7 @@ static void ks7010_rw_function(struct work_struct *work)if (rw_data &RSIZE_MASK ) {/* Read schedule */ ks_wlan_hw_rx ((void *)priv, - (uint16_t ) (((rw_data &RSIZE_MASK ) <<4 ))); + (uint16_t )(((rw_data &RSIZE_MASK ) <<4 ))); }if ((rw_data &WSTATUS_MASK ))tx_device_task ((void *)priv);
@@ -618,7 +618,7 @@ static void ks_sdio_interrupt(struct sdio_func *func) rsize = rw_data &RSIZE_MASK ;if (rsize) {/* Read schedule */ ks_wlan_hw_rx ((void *)priv, - (uint16_t ) (((rsize) <<4 ))); + (uint16_t )(((rsize) <<4 ))); }if (rw_data &WSTATUS_MASK ) {#if 0
@@ -1169,7 +1169,7 @@ static void ks7010_sdio_remove(struct sdio_func *func)cpu_to_le16 ((uint16_t ) (sizeof (*pp) -sizeof (pp->header.size))); - pp->header.event =cpu_to_le16 ((uint16_t )HIF_STOP_REQ ); + pp->header.event =cpu_to_le16 ((uint16_t )HIF_STOP_REQ );sdio_claim_host (func); write_to_device(priv, (unsigned char *)pp,
Signature · 1 line
2.7.4
Re: [Outreachy kernel] [PATCH 5/6] staging: ks7010: ks7010_sdio.c: Remove the space after a type cast
For the subject line, you should use git log --oneline filename to see what others have done, rather than making up your own strategy. In particular, normally one doesn't put the full file name, with the .c. In this case, all of the patches have just staging: ks7010:
Quoted 13 lines · sayli karnik
The patch removes an unnecessary space after a cast, as detected by checkpatch.pl.
Signed-off-by sayli karnik <[email protected]>--- drivers/staging/ks7010/ks7010_sdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/ks7010/ks7010_sdio.c +0
-0
drivers/staging/ks7010/ks7010_sdio.c static void ks7010_rw_function(struct work_struct *work) · line 547
Quoted 5 lines
drivers/staging/ks7010/ks7010_sdio.c +1
-1@@ -544,7 +544,7 @@ static void ks7010_rw_function(struct work_struct *work)if (rw_data &RSIZE_MASK ) {/* Read schedule */ ks_wlan_hw_rx ((void *)priv, - (uint16_t ) (((rw_data &RSIZE_MASK ) <<4 ))); + (uint16_t )(((rw_data &RSIZE_MASK ) <<4 )));
There are a lot of parentheses here. I have the impression that there are double parentheses, (( )).
drivers/staging/ks7010/ks7010_sdio.c static void ks_sdio_interrupt(struct sdio_func *func) · line 621
Quoted 9 lines
drivers/staging/ks7010/ks7010_sdio.c +1
-1}if ((rw_data &WSTATUS_MASK ))tx_device_task ((void *)priv);@@ -618,7 +618,7 @@ static void ks_sdio_interrupt(struct sdio_func *func) rsize = rw_data &RSIZE_MASK ;if (rsize) {/* Read schedule */ ks_wlan_hw_rx ((void *)priv, - (uint16_t ) (((rsize) <<4 ))); + (uint16_t )(((rsize) <<4 )));
rsize is just a variable. It doesn't need parentheses.
This parenthesis removal would be for another patch in the series.
julia
Quoted 22 lines
drivers/staging/ks7010/ks7010_sdio.c +1
-2}if (rw_data &WSTATUS_MASK ) {#if 0 @@ -1169,7 +1169,7 @@ static void ks7010_sdio_remove(struct sdio_func *func)cpu_to_le16 ((uint16_t ) (sizeof (*pp) -sizeof (pp->header.size))); - pp->header.event =cpu_to_le16 ((uint16_t )HIF_STOP_REQ ); + pp->header.event =cpu_to_le16 ((uint16_t )HIF_STOP_REQ );sdio_claim_host (func); write_to_device(priv, (unsigned char *)pp, --2.7.4
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/6811cb8e9856bf3e5a06637d70e13608894f84b9.1473877138.git.karniksayli1995%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 6/6 staging: ks7010: ks7010_sdio.c: Remove the null check before kfree
In reply to sayli karnikThe patch fixes the following warning by checkpatch.pl:
WARNING: kfree(NULL) is safe and this check is probably not required
--- drivers/staging/ks7010/ks7010_sdio.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +4 -8
@@ -726,8 +726,7 @@ static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index) goto error_out; } error_out: -if (data_buf) -kfree (data_buf); +kfree (data_buf);return rc; }
@@ -757,8 +756,7 @@ static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address, goto error_out; } error_out: -if (read_buf) -kfree (read_buf); +kfree (read_buf);return rc; }
@@ -873,8 +871,7 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,release_firmware (fw_entry); error_out0:sdio_release_host (card->func); -if (rom_buf) -kfree (rom_buf); +kfree (rom_buf);return rc; }
@@ -1192,8 +1189,7 @@ static void ks7010_sdio_remove(struct sdio_func *func)unregister_netdev (netdev);trx_device_exit (priv); -if (priv->ks_wlan_hw.read_buf) -kfree (priv->ks_wlan_hw.read_buf); +kfree (priv->ks_wlan_hw.read_buf);free_netdev (priv->net_dev); card->priv =NULL ;
Signature · 1 line
2.7.4