[PATCH 2/4] staging: wilc1000: linux_sdio_probe: use return value

2015-11-25 Thread Glen Lee
Return ret from wilc_netdev_init instead of -1 for proper error handling.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index e25811d..4b9cb55 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -91,7 +91,7 @@ static int linux_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
 {
struct wilc *wilc;
-   int gpio;
+   int gpio, ret;
 
gpio = -1;
if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
@@ -101,10 +101,11 @@ static int linux_sdio_probe(struct sdio_func *func,
}
 
dev_dbg(&func->dev, "Initializing netdev\n");
-   if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
-&wilc_hif_sdio)) {
+   ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
+&wilc_hif_sdio);
+   if (ret) {
dev_err(&func->dev, "Couldn't initialize netdev\n");
-   return -1;
+   return ret;
}
sdio_set_drvdata(func, wilc);
wilc->dev = &func->dev;
-- 
1.9.1

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


[PATCH 4/4] staging: wilc1000: remove unused files

2015-11-25 Thread Glen Lee
This patch removes linux_wlan_sdio.[ch] which is not used anymore.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Makefile  |  2 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c | 10 --
 drivers/staging/wilc1000/linux_wlan_sdio.h |  1 -
 3 files changed, 1 insertion(+), 12 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.c
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 2076743..09f0ddb 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -14,7 +14,7 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o 
linux_mon.o \
wilc_wlan.o
 
 obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
-wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o
+wilc1000-sdio-objs += wilc_sdio.o
 
 obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
 wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
deleted file mode 100644
index 67d99e9..000
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "wilc_wfi_netdevice.h"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "linux_wlan_sdio.h"
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h 
b/drivers/staging/wilc1000/linux_wlan_sdio.h
deleted file mode 100644
index abb2312..000
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ /dev/null
@@ -1 +0,0 @@
-#include 
-- 
1.9.1

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


[PATCH 1/4] staging: wilc1000: linux_wlan_spi.c: return linux error value

2015-11-25 Thread Glen Lee
return linux error value instead of 0 or 1 and use -EINVAL. Related codes
also changed together.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 14 +++---
 drivers/staging/wilc1000/wilc_spi.c   | 18 +-
 2 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 6111405..c7d2542 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -104,13 +104,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
dev_err(&spi->dev,
"FAILED due to NULL buffer or ZERO length check the 
following length: %d\n",
len);
-   ret = -1;
+   ret = -EINVAL;
}
 
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
-
-
return ret;
 }
 
@@ -148,10 +144,8 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
dev_err(&spi->dev,
"can't read data with the following length: %u\n",
rlen);
-   ret = -1;
+   ret = -EINVAL;
}
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
 
return ret;
 }
@@ -185,10 +179,8 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, 
u32 rlen)
dev_err(&spi->dev,
"can't read data with the following length: %u\n",
rlen);
-   ret = -1;
+   ret = -EINVAL;
}
-   /* change return value to match WILC interface */
-   (ret < 0) ? (ret = 0) : (ret = 1);
 
return ret;
 }
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index f54072b..450adc0 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
}
rix = len;
 
-   if (!wilc_spi_write_read(wilc, wb, rb, len2)) {
+   if (wilc_spi_write_read(wilc, wb, rb, len2)) {
dev_err(&spi->dev, "Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
@@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
+   if (wilc_spi_read(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block 
read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/
if (!g_spi.crc_off) {
-   if (!wilc_spi_read(wilc, crc, 2)) {
+   if (wilc_spi_read(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data 
block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 **/
retry = 10;
do {
-   if (!wilc_spi_read(wilc, &rsp, 1)) {
+   if (wilc_spi_read(wilc, &rsp, 1)) {
dev_err(&spi->dev, "Failed data 
response read, bus error...\n");
result = N_FAIL;
break;
@@ -423,7 +423,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (!wilc_spi_read(wilc, &b[ix], nbytes)) {
+   if (wilc_spi_read(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block 
read, bus error...\n");
result = N_FAIL;
break;
@@ -433,7 +433,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/

[PATCH 3/4] staging: wilc1000: linux_wlan_sdio.c: move all the codes to wilc_sdio.c

2015-11-25 Thread Glen Lee
To Combine linux_wlan_sdio.c and wilc_sdio.c as one file, move all the codes
in linux_wlan_sdio.c to wilc_sdio.c, and make functions static only.
No Modification has not been made except static, just moved them.
Function declaration in linux_wlan_sdio.h is needless, so just remove them.
linux_wlan_sdio.[ch] will be deleted in the next patch.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 160 
 drivers/staging/wilc1000/linux_wlan_sdio.h |   7 --
 drivers/staging/wilc1000/wilc_sdio.c   | 164 -
 3 files changed, 163 insertions(+), 168 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 4b9cb55..67d99e9 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -8,163 +8,3 @@
 #include 
 
 #include "linux_wlan_sdio.h"
-
-#define SDIO_MODALIAS "wilc1000_sdio"
-
-#define SDIO_VENDOR_ID_WILC 0x0296
-#define SDIO_DEVICE_ID_WILC 0x5347
-
-static const struct sdio_device_id wilc_sdio_ids[] = {
-   { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) },
-   { },
-};
-
-
-static void wilc_sdio_interrupt(struct sdio_func *func)
-{
-   sdio_release_host(func);
-   wilc_handle_isr(sdio_get_drvdata(func));
-   sdio_claim_host(func);
-}
-
-int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd)
-{
-   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
-   int ret;
-   u8 data;
-
-   sdio_claim_host(func);
-
-   func->num = cmd->function;
-   if (cmd->read_write) {  /* write */
-   if (cmd->raw) {
-   sdio_writeb(func, cmd->data, cmd->address, &ret);
-   data = sdio_readb(func, cmd->address, &ret);
-   cmd->data = data;
-   } else {
-   sdio_writeb(func, cmd->data, cmd->address, &ret);
-   }
-   } else {/* read */
-   data = sdio_readb(func, cmd->address, &ret);
-   cmd->data = data;
-   }
-
-   sdio_release_host(func);
-
-   if (ret)
-   dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret);
-   return ret;
-}
-
-
-int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd)
-{
-   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
-   int size, ret;
-
-   sdio_claim_host(func);
-
-   func->num = cmd->function;
-   func->cur_blksize = cmd->block_size;
-   if (cmd->block_mode)
-   size = cmd->count * cmd->block_size;
-   else
-   size = cmd->count;
-
-   if (cmd->read_write) {  /* write */
-   ret = sdio_memcpy_toio(func, cmd->address,
-  (void *)cmd->buffer, size);
-   } else {/* read */
-   ret = sdio_memcpy_fromio(func, (void *)cmd->buffer,
-cmd->address,  size);
-   }
-
-   sdio_release_host(func);
-
-   if (ret)
-   dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret);
-
-   return ret;
-}
-
-static int linux_sdio_probe(struct sdio_func *func,
-   const struct sdio_device_id *id)
-{
-   struct wilc *wilc;
-   int gpio, ret;
-
-   gpio = -1;
-   if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
-   gpio = of_get_gpio(func->dev.of_node, 0);
-   if (gpio < 0)
-   gpio = GPIO_NUM;
-   }
-
-   dev_dbg(&func->dev, "Initializing netdev\n");
-   ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
-&wilc_hif_sdio);
-   if (ret) {
-   dev_err(&func->dev, "Couldn't initialize netdev\n");
-   return ret;
-   }
-   sdio_set_drvdata(func, wilc);
-   wilc->dev = &func->dev;
-
-   dev_info(&func->dev, "Driver Initializing success\n");
-   return 0;
-}
-
-static void linux_sdio_remove(struct sdio_func *func)
-{
-   wilc_netdev_cleanup(sdio_get_drvdata(func));
-}
-
-static struct sdio_driver wilc1000_sdio_driver = {
-   .name   = SDIO_MODALIAS,
-   .id_table   = wilc_sdio_ids,
-   .probe  = linux_sdio_probe,
-   .remove = linux_sdio_remove,
-};
-module_driver(wilc1000_sdio_driver,
- sdio_register_driver,
- sdio_unregister_driver);
-MODULE_LICENSE("GPL");
-
-int wilc_sdio_enable_interrupt(struct wilc *dev)
-{
-   struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
-   int ret = 0;
-
-   sdio_claim_host(func);
-   ret = sdio_claim_irq(func, wilc_sdio_interrupt);
-   sdio_release_host(func);
-
-   if (ret < 0) {
-   dev_err(&func->dev, "can't claim sdio_irq, err(%d)\n", ret);
-   ret = -EIO;
-   }
-   return ret;
-}
-
-void wilc_sdio_disable_i

Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure

2015-11-25 Thread Sudip Mukherjee
On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote:
> Some error handling paths are checking for success
> instead of error on rtl871x_ioctl_rtl.c.
> 
> Signed-off-by: Mauro Dreissig 
> ---
>  drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 
> ++--
>  1 file changed, 121 insertions(+), 118 deletions(-)
> 
  
> @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv 
> *poid_par_priv)
>  
>   if (poid_par_priv->type_of_oid != QUERY_OID)
>   return RNDIS_STATUS_NOT_ACCEPTED;
> - if (poid_par_priv->information_buf_len >= sizeof(u32)) {
> - *(uint *)poid_par_priv->information_buf =
> -  adapter->recvpriv.rx_icv_err;
> - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
> - } else {
> +
> + if (poid_par_priv->information_buf_len < sizeof(u32)) 

trailing whitespace here.
Please always test your patch with checkpatch.

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


[PATCH] staging/dgap: move duplicated code from the dgap_cm.* functions

2015-11-25 Thread Alexander Kuleshov
The dgap driver contains three functions: dgap_cmdb(), dgap_cmdw()
and dgap_cmdw_exit which are contain duplicated code which waits
if necessary before updating the pointer to limit outstanding
commands. This patch introduces the wait_for_fep_cmds_limit()
function which is will be called from these functions to prevent
code duplication.
---
 drivers/staging/dgap/dgap.c | 103 
 1 file changed, 37 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index bad3551..0a20253 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -2328,6 +2328,37 @@ schedule_poller:
add_timer(&dgap_poll_timer);
 }
 
+
+/*
+ * Wait if necessary before updating the head
+ * pointer to limit the number of outstanding
+ * commands to the FEP.   If the time spent waiting
+ * is outlandish, declare the FEP dead.
+ */
+static void wait_for_fep_cmds_limit(struct channel_t *ch,
+   struct __iomem cm_t *cm_addr,
+   u16 head, u16 tail, uint ncmds)
+{
+   int n;
+   int count;
+
+   for (count = dgap_count ;;) {
+   head = readw(&cm_addr->cm_head);
+   tail = readw(&cm_addr->cm_tail);
+
+   n = (head - tail) & (CMDMAX - CMDSTART - 4);
+
+   if (n <= ncmds * sizeof(struct cm_t))
+   break;
+
+   if (--count == 0) {
+   ch->ch_bd->state = BOARD_FAILED;
+   return;
+   }
+   udelay(10);
+   }
+}
+
 /*===
  *
  *  dgap_cmdb - Sends a 2 byte command to the FEP.
@@ -2345,8 +2376,6 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 
byte1,
 {
char __iomem *vaddr;
struct __iomem cm_t *cm_addr;
-   uint count;
-   uint n;
u16 head;
u16 tail;
 
@@ -2391,27 +2420,9 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 
byte1,
 
writew(head, &cm_addr->cm_head);
 
-   /*
-* Wait if necessary before updating the head
-* pointer to limit the number of outstanding
-* commands to the FEP.   If the time spent waiting
-* is outlandish, declare the FEP dead.
-*/
-   for (count = dgap_count ;;) {
-   head = readw(&cm_addr->cm_head);
-   tail = readw(&cm_addr->cm_tail);
-
-   n = (head - tail) & (CMDMAX - CMDSTART - 4);
+   wait_for_fep_cmds_limit(ch, cm_addr, head, tail, ncmds);
 
-   if (n <= ncmds * sizeof(struct cm_t))
-   break;
-
-   if (--count == 0) {
-   ch->ch_bd->state = BOARD_FAILED;
-   return;
-   }
-   udelay(10);
-   }
+   return;
 }
 
 /*===
@@ -2429,8 +2440,6 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 
word, uint ncmds)
 {
char __iomem *vaddr;
struct __iomem cm_t *cm_addr;
-   uint count;
-   uint n;
u16 head;
u16 tail;
 
@@ -2473,27 +2482,9 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 
word, uint ncmds)
 
writew(head, &cm_addr->cm_head);
 
-   /*
-* Wait if necessary before updating the head
-* pointer to limit the number of outstanding
-* commands to the FEP.   If the time spent waiting
-* is outlandish, declare the FEP dead.
-*/
-   for (count = dgap_count ;;) {
-   head = readw(&cm_addr->cm_head);
-   tail = readw(&cm_addr->cm_tail);
-
-   n = (head - tail) & (CMDMAX - CMDSTART - 4);
+   wait_for_fep_cmds_limit(ch, cm_addr, head, tail, ncmds);
 
-   if (n <= ncmds * sizeof(struct cm_t))
-   break;
-
-   if (--count == 0) {
-   ch->ch_bd->state = BOARD_FAILED;
-   return;
-   }
-   udelay(10);
-   }
+   return;
 }
 
 /*===
@@ -2511,8 +2502,6 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, 
u16 word, uint ncmds)
 {
char __iomem *vaddr;
struct __iomem cm_t *cm_addr;
-   uint count;
-   uint n;
u16 head;
u16 tail;
 
@@ -2567,27 +2556,9 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, 
u16 word, uint ncmds)
 
writew(head, &cm_addr->cm_head);
 
-   /*
-* Wait if necessary before updating the head
-* pointer to limit the number of outstanding
-* commands to the FEP.   If the time spent waiting
-* is outlandish, declare the FEP dead.
-*/
-   for (count = dgap_count ;;) {
-   head = readw(&cm_addr->cm_head);
-   tail = 

Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure

2015-11-25 Thread Mauro Dreissig
On 25-11-2015 09:44, Sudip Mukherjee wrote:
> On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote:
>> Some error handling paths are checking for success
>> instead of error on rtl871x_ioctl_rtl.c.
>>
>> Signed-off-by: Mauro Dreissig 
>> ---
>>  drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 
>> ++--
>>  1 file changed, 121 insertions(+), 118 deletions(-)
>>
>   
>> @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv 
>> *poid_par_priv)
>>  
>>  if (poid_par_priv->type_of_oid != QUERY_OID)
>>  return RNDIS_STATUS_NOT_ACCEPTED;
>> -if (poid_par_priv->information_buf_len >= sizeof(u32)) {
>> -*(uint *)poid_par_priv->information_buf =
>> - adapter->recvpriv.rx_icv_err;
>> -*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
>> -} else {
>> +
>> +if (poid_par_priv->information_buf_len < sizeof(u32)) 
> 
> trailing whitespace here.
> Please always test your patch with checkpatch.
> 
> regards
> sudip
> 
This blank line is intentional, there is no trailing whitespace.

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


Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure

2015-11-25 Thread Mauro Dreissig
On 25-11-2015 12:56, Mauro Dreissig wrote:
> On 25-11-2015 09:44, Sudip Mukherjee wrote:
>> On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote:
>>> Some error handling paths are checking for success
>>> instead of error on rtl871x_ioctl_rtl.c.
>>>
>>> Signed-off-by: Mauro Dreissig 
>>> ---
>>>  drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 
>>> ++--
>>>  1 file changed, 121 insertions(+), 118 deletions(-)
>>>
>>   
>>> @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv 
>>> *poid_par_priv)
>>>  
>>> if (poid_par_priv->type_of_oid != QUERY_OID)
>>> return RNDIS_STATUS_NOT_ACCEPTED;
>>> -   if (poid_par_priv->information_buf_len >= sizeof(u32)) {
>>> -   *(uint *)poid_par_priv->information_buf =
>>> -adapter->recvpriv.rx_icv_err;
>>> -   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
>>> -   } else {
>>> +
>>> +   if (poid_par_priv->information_buf_len < sizeof(u32)) 
>>
>> trailing whitespace here.
>> Please always test your patch with checkpatch.
>>
>> regards
>> sudip
>>
> This blank line is intentional, there is no trailing whitespace.
> 
> thanks,
> Mauro
> 
My mistake, seems like I fixed it in the other patch in the series.

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


[PATCH] staging: gdm72xx: Replace timeval with ktime_t

2015-11-25 Thread Arnd Bergmann
struct sdu_stamp in the gdm_sdio.h is a timeval type.
'struct timeval now' is used for calculating elapsed time.

32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the gdm72xx driver to use ktime_t.

ktime_get() is  better than using do_gettimeofday(),
because it uses the monotonic clock. ktime_sub
are used to subtract two ktime variables.

Build tested this by saying Y to WIMAX_GDM72XX.

Signed-off-by: Tapasweni Pathak 
Reviewed-by: Arnd Bergmann 
Signed-off-by: Arnd Bergmann 
---
This is an old patch that I still had in my patch backlog, please apply to the
staging tree.

diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index b0521da3c793..1f5a087723ba 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -36,7 +36,7 @@
 #define RX_BUF_SIZE(25*1024)
 
 #define TX_HZ  2000
-#define TX_INTERVAL(100/TX_HZ)
+#define TX_INTERVAL(NSEC_PER_SEC/TX_HZ)
 
 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
@@ -303,7 +303,7 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt 
*tx)
put_tx_struct(t->tx_cxt, t);
}
 
-   do_gettimeofday(&tx->sdu_stamp);
+   tx->sdu_stamp = ktime_get();
spin_unlock_irqrestore(&tx->lock, flags);
 }
 
@@ -330,7 +330,7 @@ static void do_tx(struct work_struct *work)
struct sdio_func *func = sdev->func;
struct tx_cxt *tx = &sdev->tx;
struct sdio_tx *t = NULL;
-   struct timeval now, *before;
+   ktime_t now, before;
int is_sdu = 0;
long diff;
unsigned long flags;
@@ -346,11 +346,10 @@ static void do_tx(struct work_struct *work)
list_del(&t->list);
is_sdu = 0;
} else if (!tx->stop_sdu_tx && !list_empty(&tx->sdu_list)) {
-   do_gettimeofday(&now);
-   before = &tx->sdu_stamp;
+   now = ktime_get();
+   before = tx->sdu_stamp;
 
-   diff = (now.tv_sec - before->tv_sec) * 100 +
-   (now.tv_usec - before->tv_usec);
+   diff = ktime_to_ns(ktime_sub(now, before));
if (diff >= 0 && diff < TX_INTERVAL) {
schedule_work(&sdev->ws);
spin_unlock_irqrestore(&tx->lock, flags);
diff --git a/drivers/staging/gdm72xx/gdm_sdio.h 
b/drivers/staging/gdm72xx/gdm_sdio.h
index 77ad9d686f8e..aa7dad22a219 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.h
+++ b/drivers/staging/gdm72xx/gdm_sdio.h
@@ -15,7 +15,7 @@
 #define __GDM72XX_GDM_SDIO_H__
 
 #include 
-#include 
+#include 
 
 #define MAX_NR_SDU_BUF  64
 
@@ -32,7 +32,7 @@ struct tx_cxt {
struct list_headfree_list;
struct list_headsdu_list;
struct list_headhci_list;
-   struct timeval  sdu_stamp;
+   ktime_t sdu_stamp;
u8  *sdu_buf;
spinlock_t  lock;
int can_send;

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


Re: [PATCH 3/3] staging: lustre: Less function calls in class_register_type() after error detection

2015-11-25 Thread Greg Kroah-Hartman
On Thu, Nov 05, 2015 at 01:20:33PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring 
> Date: Thu, 5 Nov 2015 12:48:58 +0100
> 
> The functions "kfree" and "kobject_put" were called in a few cases by the
> function "class_register_type" during error handling even if the passed
> variable contained a null pointer.
> 
> This implementation detail could be improved by the adjustment of
> jump targets.
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/staging/lustre/lustre/obdclass/genops.c | 26 
> +++--
>  1 file changed, 16 insertions(+), 10 deletions(-)

Does not apply to my staging-next branch :(

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


[PATCH v2 1/4] staging: rtl8712: Remove casts between void * and type *

2015-11-25 Thread Mauro Dreissig
This removes unnecessary explicit pointer casts in rtl871x_ioctl_rtl.c.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 45 ++---
 1 file changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index 7c346a4..c7f2e51 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -49,8 +49,7 @@ uint oid_rt_get_signal_quality_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -66,8 +65,7 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -83,8 +81,7 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -115,8 +112,7 @@ uint oid_rt_get_rx_retry_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -147,8 +143,7 @@ uint oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
@@ -172,8 +167,7 @@ uint oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv
 
 uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
u32 preamblemode = 0;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
@@ -202,8 +196,7 @@ uint oid_rt_get_ap_ip_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
@@ -216,8 +209,7 @@ uint oid_rt_get_channelplan_hdl(struct oid_par_priv 
*poid_par_priv)
 uint oid_rt_set_channelplan_hdl(struct oid_par_priv
   *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
 
if (poid_par_priv->type_of_oid != SET_OID)
@@ -229,8 +221,7 @@ uint oid_rt_set_channelplan_hdl(struct oid_par_priv
 uint oid_rt_set_preamble_mode_hdl(struct oid_par_priv
 *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_context);
+   struct _adapter *padapter = poid_par_priv->adapter_context;
u32 preamblemode = 0;
 
if (poid_par_priv->type_of_oid != SET_OID)
@@ -267,8 +258,7 @@ uint oid_rt_dedicate_probe_hdl(struct oid_par_priv
 uint oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv
  *poid_par_priv)
 {
-   struct _adapter *padapter = (struct _adapter *)
-   (poid_par_priv->adapter_co

[PATCH v2 3/4] staging: rtl8712: Make error handling check for failure

2015-11-25 Thread Mauro Dreissig
Make all error handling paths check for failure instead of success
in rtl871x_ioctl_rtl.c, reducing indentation and avoiding else
statements.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 +++-
 1 file changed, 124 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index 97596aa..3f1fa12 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -53,13 +53,14 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_smallpacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf =
+   adapter->recvpriv.rx_smallpacket_crcerr;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -69,13 +70,14 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_middlepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf =
+   adapter->recvpriv.rx_middlepacket_crcerr;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -85,13 +87,14 @@ uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-adapter->recvpriv.rx_largepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf =
+   adapter->recvpriv.rx_largepacket_crcerr;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -116,14 +119,14 @@ uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
-   *(u32 *)poid_par_priv->information_buf =
-adapter->recvpriv.rx_pkts +
-adapter->recvpriv.rx_drop;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(u32 *)poid_par_priv->information_buf =
+   adapter->recvpriv.rx_pkts + adapter->recvpriv.rx_drop;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -147,13 +150,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   if (poid_par_priv->information_buf_len >= sizeof(u32)) {
-   *(uint *)poid_par_priv->information_buf =
-adapter->recvpriv.rx_icv_err;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-   } else {
+
+   if (poid_par_priv->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
-   }
+
+   *(uint *)poid_par_priv->information_buf = adapter->recvpriv.rx_icv_err;
+   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+
return RNDIS_STATUS_SUCCESS;
 }
 
@@ -172,18 +175,20 @@ uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv 
*poid_par_priv)
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPT

[PATCH v2 4/4] staging: rtl8712: Rename local variable

2015-11-25 Thread Mauro Dreissig
Renames all instances of struct oid_par_priv to oid in rtl871x_ioctl_rtl.c
and rtl871x_ioctl_rtl.h, making the code cleaner.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 292 +---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.h | 123 
 2 files changed, 177 insertions(+), 238 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index 3f1fa12..290e650 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -40,143 +40,139 @@
 #include "rtl871x_mp.h"
 #include "rtl871x_mp_ioctl.h"
 
-uint oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_signal_quality_hdl(struct oid_par_priv *oid)
 {
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
 
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_smallpacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *(u32 *)oid->information_buf = adapter->recvpriv.rx_smallpacket_crcerr;
+   *oid->bytes_rw = oid->information_buf_len;
 
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
 
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_middlepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *(u32 *)oid->information_buf = adapter->recvpriv.rx_middlepacket_crcerr;
+   *oid->bytes_rw = oid->information_buf_len;
 
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->information_buf_len < sizeof(u32))
+   if (oid->information_buf_len < sizeof(u32))
return RNDIS_STATUS_INVALID_LENGTH;
 
-   *(u32 *)poid_par_priv->information_buf =
-   adapter->recvpriv.rx_largepacket_crcerr;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *(u32 *)oid->information_buf = adapter->recvpriv.rx_largepacket_crcerr;
+   *oid->bytes_rw = oid->information_buf_len;
 
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_tx_retry_hdl(struct oid_par_priv *oid)
 {
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_rx_retry_hdl(struct oid_par_priv *oid)
 {
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
-   *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
+   *oid->bytes_rw = oid->information_buf_len;
return RNDIS_STATUS_SUCCESS;
 }
 
-uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
+uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *oid)
 {
-   struct _adapter *adapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = oid->adapter_context;
 
-   if (poid_par_priv->type_of_oid != QUERY_OID)
+   if (oid->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
 
-   if (poid_par_priv->inf

[PATCH v2 2/4] staging: rtl8712: Rename local variable

2015-11-25 Thread Mauro Dreissig
Renames all instances of struct _adapter to adapter in rtl871x_ioctl_rtl.c,
avoiding camel case.

Signed-off-by: Mauro Dreissig 
---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 86 ++---
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
index c7f2e51..97596aa 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c
@@ -49,13 +49,13 @@ uint oid_rt_get_signal_quality_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-   padapter->recvpriv.rx_smallpacket_crcerr;
+   adapter->recvpriv.rx_smallpacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -65,13 +65,13 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-   padapter->recvpriv.rx_middlepacket_crcerr;
+   adapter->recvpriv.rx_middlepacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -81,13 +81,13 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-padapter->recvpriv.rx_largepacket_crcerr;
+adapter->recvpriv.rx_largepacket_crcerr;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -112,14 +112,14 @@ uint oid_rt_get_rx_retry_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >=  sizeof(u32)) {
*(u32 *)poid_par_priv->information_buf =
-padapter->recvpriv.rx_pkts +
-padapter->recvpriv.rx_drop;
+adapter->recvpriv.rx_pkts +
+adapter->recvpriv.rx_drop;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -143,13 +143,13 @@ uint oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv 
*poid_par_priv)
 
 uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+   struct _adapter *adapter = poid_par_priv->adapter_context;
 
if (poid_par_priv->type_of_oid != QUERY_OID)
return RNDIS_STATUS_NOT_ACCEPTED;
if (poid_par_priv->information_buf_len >= sizeof(u32)) {
*(uint *)poid_par_priv->information_buf =
-padapter->recvpriv.rx_icv_err;
+adapter->recvpriv.rx_icv_err;
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
} else {
return RNDIS_STATUS_INVALID_LENGTH;
@@ -167,17 +167,17 @@ uint oid_rt_set_encryption_algorithm_hdl(struct 
oid_par_priv
 
 uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
 {
-   struct _adapter *padapter = poid_par_priv->adapter_context;
+ 

[PATCH v2 0/4] Cleanups for rtl871x_ioctl_rtl

2015-11-25 Thread Mauro Dreissig
This applies some janitorial work to rtl8712 driver.

Mauro Dreissig (4):
  staging: rtl8712: Remove casts between void * and type *
  staging: rtl8712: Rename local variable
  staging: rtl8712: Make error handling check for failure
  staging: rtl8712: Rename local variable

 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 492 +---
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.h | 123 +++
 2 files changed, 274 insertions(+), 341 deletions(-)

-- 
2.6.3

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


[PATCH v2] staging/dgap: move duplicated code from the dgap_cm.* functions

2015-11-25 Thread Alexander Kuleshov
The dgap driver contains three functions: dgap_cmdb(), dgap_cmdw()
and dgap_cmdw_exit which are contain duplicated code which waits
if necessary before updating the pointer to limit outstanding
commands. This patch introduces the wait_for_fep_cmds_limit()
function which is will be called from these functions to prevent
code duplication.

Signed-off-by: Alexander Kuleshov 
---
Forgot Signed-off-by line

 drivers/staging/dgap/dgap.c | 103 
 1 file changed, 37 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index bad3551..0a20253 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -2328,6 +2328,37 @@ schedule_poller:
add_timer(&dgap_poll_timer);
 }

+
+/*
+ * Wait if necessary before updating the head
+ * pointer to limit the number of outstanding
+ * commands to the FEP.   If the time spent waiting
+ * is outlandish, declare the FEP dead.
+ */
+static void wait_for_fep_cmds_limit(struct channel_t *ch,
+   struct __iomem cm_t *cm_addr,
+   u16 head, u16 tail, uint ncmds)
+{
+   int n;
+   int count;
+
+   for (count = dgap_count ;;) {
+   head = readw(&cm_addr->cm_head);
+   tail = readw(&cm_addr->cm_tail);
+
+   n = (head - tail) & (CMDMAX - CMDSTART - 4);
+
+   if (n <= ncmds * sizeof(struct cm_t))
+   break;
+
+   if (--count == 0) {
+   ch->ch_bd->state = BOARD_FAILED;
+   return;
+   }
+   udelay(10);
+   }
+}
+
 /*===
  *
  *  dgap_cmdb - Sends a 2 byte command to the FEP.
@@ -2345,8 +2376,6 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 
byte1,
 {
char __iomem *vaddr;
struct __iomem cm_t *cm_addr;
-   uint count;
-   uint n;
u16 head;
u16 tail;

@@ -2391,27 +2420,9 @@ static void dgap_cmdb(struct channel_t *ch, u8 cmd, u8 
byte1,

writew(head, &cm_addr->cm_head);

-   /*
-* Wait if necessary before updating the head
-* pointer to limit the number of outstanding
-* commands to the FEP.   If the time spent waiting
-* is outlandish, declare the FEP dead.
-*/
-   for (count = dgap_count ;;) {
-   head = readw(&cm_addr->cm_head);
-   tail = readw(&cm_addr->cm_tail);
-
-   n = (head - tail) & (CMDMAX - CMDSTART - 4);
+   wait_for_fep_cmds_limit(ch, cm_addr, head, tail, ncmds);

-   if (n <= ncmds * sizeof(struct cm_t))
-   break;
-
-   if (--count == 0) {
-   ch->ch_bd->state = BOARD_FAILED;
-   return;
-   }
-   udelay(10);
-   }
+   return;
 }

 /*===
@@ -2429,8 +2440,6 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 
word, uint ncmds)
 {
char __iomem *vaddr;
struct __iomem cm_t *cm_addr;
-   uint count;
-   uint n;
u16 head;
u16 tail;

@@ -2473,27 +2482,9 @@ static void dgap_cmdw(struct channel_t *ch, u8 cmd, u16 
word, uint ncmds)

writew(head, &cm_addr->cm_head);

-   /*
-* Wait if necessary before updating the head
-* pointer to limit the number of outstanding
-* commands to the FEP.   If the time spent waiting
-* is outlandish, declare the FEP dead.
-*/
-   for (count = dgap_count ;;) {
-   head = readw(&cm_addr->cm_head);
-   tail = readw(&cm_addr->cm_tail);
-
-   n = (head - tail) & (CMDMAX - CMDSTART - 4);
+   wait_for_fep_cmds_limit(ch, cm_addr, head, tail, ncmds);

-   if (n <= ncmds * sizeof(struct cm_t))
-   break;
-
-   if (--count == 0) {
-   ch->ch_bd->state = BOARD_FAILED;
-   return;
-   }
-   udelay(10);
-   }
+   return;
 }

 /*===
@@ -2511,8 +2502,6 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, 
u16 word, uint ncmds)
 {
char __iomem *vaddr;
struct __iomem cm_t *cm_addr;
-   uint count;
-   uint n;
u16 head;
u16 tail;

@@ -2567,27 +2556,9 @@ static void dgap_cmdw_ext(struct channel_t *ch, u16 cmd, 
u16 word, uint ncmds)

writew(head, &cm_addr->cm_head);

-   /*
-* Wait if necessary before updating the head
-* pointer to limit the number of outstanding
-* commands to the FEP.   If the time spent waiting
-* is outlandish, declare the FEP dead.
-*/
-   for (count = dgap_count ;;) {
-   head = 

Donations Award

2015-11-25 Thread Dr. ZUHAIR ALAWI SAYED.
Dear Beneficiary,

This is to inform you that you were among the lucky beneficiary selected to 
receive this donations award sum of Eur 350,000.00, 
as charity donations/aid from the Qatar Foundation held in Doha, Qatar,  to 
promote your business and personal Interest.

Kindly get back for more details on how to claims your award via email: 
loteria-primit...@consultant.com

Yours Sincerely, 

DR. ZUHAIR ALAWI SAYED.

Reply To: loteria-primit...@consultant.com

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


[PATCH 2/5] staging: wilc1000: remove unneeded function

2015-11-25 Thread Glen Lee
wilc_spi_init in linux_wlan_spi.c is unneeded. It just return true. Rename
_wilc_spi_init in wlan_spi.c to wilc_spi_init.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 5 -
 drivers/staging/wilc1000/linux_wlan_spi.h | 1 -
 drivers/staging/wilc1000/wilc_spi.c   | 9 ++---
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index e9ad33f..06935cf 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -61,11 +61,6 @@ struct spi_driver wilc1000_spi_driver = {
 module_spi_driver(wilc1000_spi_driver);
 MODULE_LICENSE("GPL");
 
-int wilc_spi_init(void)
-{
-   return 1;
-}
-
 int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index 5ff070b..d41c16a 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -4,7 +4,6 @@
 #include 
 #include "wilc_wfi_netdevice.h"
 
-int wilc_spi_init(void);
 int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len);
 int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen);
 int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index ef1ad3b..0f730cd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -676,7 +676,7 @@ static int _wilc_spi_deinit(struct wilc *wilc)
return 1;
 }
 
-static int _wilc_spi_init(struct wilc *wilc)
+static int wilc_spi_init(struct wilc *wilc)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
u32 reg;
@@ -695,11 +695,6 @@ static int _wilc_spi_init(struct wilc *wilc)
 
memset(&g_spi, 0, sizeof(wilc_spi_t));
 
-   if (!wilc_spi_init()) {
-   dev_err(&spi->dev, "Failed io init bus...\n");
-   return 0;
-   }
-
/**
 *  configure protocol
 **/
@@ -992,7 +987,7 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint)
  *
  /
 const struct wilc_hif_func wilc_hif_spi = {
-   .hif_init = _wilc_spi_init,
+   .hif_init = wilc_spi_init,
.hif_deinit = _wilc_spi_deinit,
.hif_read_reg = wilc_spi_read_reg,
.hif_write_reg = wilc_spi_write_reg,
-- 
1.9.1

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


[PATCH 4/5] staging: wilc1000: remove unused files

2015-11-25 Thread Glen Lee
This patch removes linux_wlan_spi.[ch] which are not used anymore.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/Makefile |  2 +-
 drivers/staging/wilc1000/linux_wlan_spi.c | 16 
 drivers/staging/wilc1000/linux_wlan_spi.h |  6 --
 3 files changed, 1 insertion(+), 23 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_spi.c
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_spi.h

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 09f0ddb..20a5cb9 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -17,4 +17,4 @@ obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
 wilc1000-sdio-objs += wilc_sdio.o
 
 obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
-wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
+wilc1000-spi-objs += wilc_spi.o
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
deleted file mode 100644
index c4315f5..000
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "linux_wlan_spi.h"
-#include "wilc_wfi_netdevice.h"
-#include "linux_wlan_common.h"
-#include "wilc_wlan_if.h"
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
deleted file mode 100644
index 32e3926..000
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef LINUX_WLAN_SPI_H
-#define LINUX_WLAN_SPI_H
-
-#include 
-#include "wilc_wfi_netdevice.h"
-#endif
-- 
1.9.1

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


[PATCH 3/5] staging: wilc1000: linux_wlan_spi.c: move all the codes to wilc_spi.c

2015-11-25 Thread Glen Lee
This patch moves all the codes in linux_wlan_spi.c to wilc_spi.c to make
one spi module. Make wilc_spi_tx, wilc_spi_rx and wilc_spi_tx_rx static
functions. Remove function declaration in linux_wlan_spi.h, which is unnedded
now. No modification has been made inside the codes.
linux_wlan_spi.[ch] will be remove in the next patch.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 165 ---
 drivers/staging/wilc1000/linux_wlan_spi.h |   4 -
 drivers/staging/wilc1000/wilc_spi.c   | 180 +-
 3 files changed, 178 insertions(+), 171 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 06935cf..c4315f5 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -14,168 +14,3 @@
 #include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
 #include "wilc_wlan_if.h"
-
-#define USE_SPI_DMA 0
-
-static const struct wilc1000_ops wilc1000_spi_ops;
-
-static int wilc_bus_probe(struct spi_device *spi)
-{
-   int ret, gpio;
-   struct wilc *wilc;
-
-   gpio = of_get_gpio(spi->dev.of_node, 0);
-   if (gpio < 0)
-   gpio = GPIO_NUM;
-
-   ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
-   if (ret)
-   return ret;
-
-   spi_set_drvdata(spi, wilc);
-   wilc->dev = &spi->dev;
-
-   return 0;
-}
-
-static int wilc_bus_remove(struct spi_device *spi)
-{
-   wilc_netdev_cleanup(spi_get_drvdata(spi));
-   return 0;
-}
-
-static const struct of_device_id wilc1000_of_match[] = {
-   { .compatible = "atmel,wilc_spi", },
-   {}
-};
-MODULE_DEVICE_TABLE(of, wilc1000_of_match);
-
-struct spi_driver wilc1000_spi_driver = {
-   .driver = {
-   .name = MODALIAS,
-   .of_match_table = wilc1000_of_match,
-   },
-   .probe =  wilc_bus_probe,
-   .remove = wilc_bus_remove,
-};
-module_spi_driver(wilc1000_spi_driver);
-MODULE_LICENSE("GPL");
-
-int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
-{
-   struct spi_device *spi = to_spi_device(wilc->dev);
-   int ret;
-   struct spi_message msg;
-
-   if (len > 0 && b) {
-   struct spi_transfer tr = {
-   .tx_buf = b,
-   .len = len,
-   .delay_usecs = 0,
-   };
-   char *r_buffer = kzalloc(len, GFP_KERNEL);
-
-   if (!r_buffer)
-   return -ENOMEM;
-
-   tr.rx_buf = r_buffer;
-   dev_dbg(&spi->dev, "Request writing %d bytes\n", len);
-
-   memset(&msg, 0, sizeof(msg));
-   spi_message_init(&msg);
-   msg.spi = spi;
-   msg.is_dma_mapped = USE_SPI_DMA;
-   spi_message_add_tail(&tr, &msg);
-
-   ret = spi_sync(spi, &msg);
-   if (ret < 0)
-   dev_err(&spi->dev, "SPI transaction failed\n");
-
-   kfree(r_buffer);
-   } else {
-   dev_err(&spi->dev,
-   "can't write data with the following length: %d\n",
-   len);
-   dev_err(&spi->dev,
-   "FAILED due to NULL buffer or ZERO length check the 
following length: %d\n",
-   len);
-   ret = -EINVAL;
-   }
-
-   return ret;
-}
-
-int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen)
-{
-   struct spi_device *spi = to_spi_device(wilc->dev);
-   int ret;
-
-   if (rlen > 0) {
-   struct spi_message msg;
-   struct spi_transfer tr = {
-   .rx_buf = rb,
-   .len = rlen,
-   .delay_usecs = 0,
-
-   };
-   char *t_buffer = kzalloc(rlen, GFP_KERNEL);
-
-   if (!t_buffer)
-   return -ENOMEM;
-
-   tr.tx_buf = t_buffer;
-
-   memset(&msg, 0, sizeof(msg));
-   spi_message_init(&msg);
-   msg.spi = spi;
-   msg.is_dma_mapped = USE_SPI_DMA;
-   spi_message_add_tail(&tr, &msg);
-
-   ret = spi_sync(spi, &msg);
-   if (ret < 0)
-   dev_err(&spi->dev, "SPI transaction failed\n");
-   kfree(t_buffer);
-   } else {
-   dev_err(&spi->dev,
-   "can't read data with the following length: %u\n",
-   rlen);
-   ret = -EINVAL;
-   }
-
-   return ret;
-}
-
-int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
-{
-   struct spi_device *spi = to_spi_device(wilc->dev);
-   int ret;
-
-   if (rlen > 0) {
-   struct spi_message msg;
-   struct spi_transfer tr = {
-   .rx_buf = rb,
-   .tx_buf = wb,
-   

[PATCH 5/5] staging: wilc1000: remove unneeded extern variable

2015-11-25 Thread Glen Lee
This patch removes unnedded extern variable WILC_WFI_devs[] which is not used.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 68a159f..b9961f0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -227,7 +227,6 @@ struct WILC_WFI_mon_priv {
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
 
-extern struct net_device *WILC_WFI_devs[];
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void wilc_mac_indicate(struct wilc *wilc, int flag);
 void wilc_rx_complete(struct wilc *wilc);
-- 
1.9.1

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


[PATCH 1/5] staging: wilc1000: rename spi function names

2015-11-25 Thread Glen Lee
There are several similar function names, such as wilc_spi_write and
_wilc_spi_write. It is likely to be confused after merging linux_wlan_spi.c and
wilc_spi.c, so rename following functions properly.
Rename wilc_spi_write to wilc_spi_tx, wilc_spi_read to wilc_spi_rx,
wilc_spi_write_read to wilc_spi_tx_rx, _wilc_spi_write to wilc_spi_write,
_wilc_spi_read to wilc_spi_read.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan_spi.c |  6 +++---
 drivers/staging/wilc1000/linux_wlan_spi.h |  6 +++---
 drivers/staging/wilc1000/wilc_spi.c   | 34 +++
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index c7d2542..e9ad33f 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -66,7 +66,7 @@ int wilc_spi_init(void)
return 1;
 }
 
-int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
+int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
@@ -110,7 +110,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
return ret;
 }
 
-int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
+int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
@@ -150,7 +150,7 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen)
return ret;
 }
 
-int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
+int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen)
 {
struct spi_device *spi = to_spi_device(wilc->dev);
int ret;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h 
b/drivers/staging/wilc1000/linux_wlan_spi.h
index 00733ab..5ff070b 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -5,7 +5,7 @@
 #include "wilc_wfi_netdevice.h"
 
 int wilc_spi_init(void);
-int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len);
-int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen);
-int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
+int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len);
+int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen);
+int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen);
 #endif
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 450adc0..ef1ad3b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -21,8 +21,8 @@ typedef struct {
 
 static wilc_spi_t g_spi;
 
-static int _wilc_spi_read(struct wilc *wilc, u32, u8 *, u32);
-static int _wilc_spi_write(struct wilc *wilc, u32, u8 *, u32);
+static int wilc_spi_read(struct wilc *wilc, u32, u8 *, u32);
+static int wilc_spi_write(struct wilc *wilc, u32, u8 *, u32);
 
 /
  *
@@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
}
rix = len;
 
-   if (wilc_spi_write_read(wilc, wb, rb, len2)) {
+   if (wilc_spi_tx_rx(wilc, wb, rb, len2)) {
dev_err(&spi->dev, "Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
@@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
/**
 * Read bytes
 **/
-   if (wilc_spi_read(wilc, &b[ix], nbytes)) {
+   if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block 
read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 * Read Crc
 **/
if (!g_spi.crc_off) {
-   if (wilc_spi_read(wilc, crc, 2)) {
+   if (wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data 
block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
 **/
retry = 10;
do {
-   if (wilc_spi_read(wilc, &rsp, 1)) {
+   if (wilc_spi_rx(wilc, &rsp, 1)) {
dev_err(&spi->dev, "Failed data 
res

Re: [PATCH] staging/dgap: move duplicated code from the dgap_cm.* functions

2015-11-25 Thread Sudip Mukherjee
On Wed, Nov 25, 2015 at 07:10:30PM +0600, Alexander Kuleshov wrote:
> The dgap driver contains three functions: dgap_cmdb(), dgap_cmdw()
> and dgap_cmdw_exit which are contain duplicated code which waits
> if necessary before updating the pointer to limit outstanding
> commands. This patch introduces the wait_for_fep_cmds_limit()
> function which is will be called from these functions to prevent
> code duplication.
> ---

Signed-off-by ?

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


Re: [PATCH 3/3] staging: lustre: Less function calls in class_register_type() after error detection

2015-11-25 Thread SF Markus Elfring
Am 25.11.2015 um 17:39 schrieb Greg Kroah-Hartman:
> On Thu, Nov 05, 2015 at 01:20:33PM +0100, SF Markus Elfring wrote:
>> From: Markus Elfring 
>> Date: Thu, 5 Nov 2015 12:48:58 +0100
>>
>> The functions "kfree" and "kobject_put" were called in a few cases by the
>> function "class_register_type" during error handling even if the passed
>> variable contained a null pointer.
>>
>> This implementation detail could be improved by the adjustment of
>> jump targets.
>>
>> Signed-off-by: Markus Elfring 
>> ---
>>  drivers/staging/lustre/lustre/obdclass/genops.c | 26 
>> +++--
>>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> Does not apply to my staging-next branch :(

I get also a result like the following together with the software "Linux 
next-20151126".   ;-)

elfring@Sonne:~/Projekte/Linux/next-patched> LANG=C git apply 
~/Projekte/Bau/Linux/scripts/Coccinelle/deletions1/next/20151102/Flicken/0003-staging-lustre-Less-function-calls-in-class_register.patch
error: patch failed: drivers/staging/lustre/lustre/obdclass/genops.c:214
error: drivers/staging/lustre/lustre/obdclass/genops.c: patch does not apply


Do you try this update suggestion out without integrating the corresponding 
previous
update suggestion "Delete unnecessary checks before two function calls"
where I proposed to remove extra checks before a few calls of the function 
"kobject_put"
(which seems to matter for the patch hunk in the shown error message)?
https://lkml.org/lkml/2015/11/5/276
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1013635.html

Would you like to reject the first update step from this patch series
so that I need to adapt my approach to your software design decision?

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