恶魔法术石

2016-02-16 Thread 恶魔法术石
你的老朋友邀你来Q群:343257759
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/7] staging: wilc1000: handle_set_mac_address: fix kmalloc return error code

2016-02-16 Thread Chaehyun Lim
This patch fix return error code of kmalloc as -ENOMEM instead of
-EFAULT.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 579b90a..4d50b38 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -432,7 +432,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
 
if (!mac_buf)
-   return -EFAULT;
+   return -ENOMEM;
 
memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
 
-- 
2.7.1

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


[PATCH 4/7] staging: wilc1000: handle_set_mac_address: change return type to void

2016-02-16 Thread Chaehyun Lim
When handle_set_mac_address is called in hostIFthread that is a kernel
thread, it is not checked return type of this function. This patch
changes return type to void and removes a brace of if statement due to
have a single statement.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 65d2393..c671f05 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -424,15 +424,15 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
return result;
 }
 
-static s32 handle_set_mac_address(struct wilc_vif *vif,
- struct set_mac_addr *set_mac_addr)
+static void handle_set_mac_address(struct wilc_vif *vif,
+  struct set_mac_addr *set_mac_addr)
 {
s32 result = 0;
struct wid wid;
 
u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
if (!mac_buf)
-   return -ENOMEM;
+   return;
 
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
@@ -441,13 +441,10 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
 
result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
  wilc_get_vif_idx(vif));
-   if (result) {
+   if (result)
PRINT_ER("Failed to set mac address\n");
-   result = -EFAULT;
-   }
 
kfree(mac_buf);
-   return result;
 }
 
 static s32 handle_get_mac_address(struct wilc_vif *vif,
-- 
2.7.1

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


[PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure

2016-02-16 Thread Chaehyun Lim
There is no need to print debug message when kmalloc is failed. This
message is redundant. The code already show us that kmalloc is failed.
The brace of if statement is remove as well due to have a single
statement.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d1eedfb..579b90a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -431,10 +431,9 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
struct wid wid;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
 
-   if (!mac_buf) {
-   PRINT_ER("No buffer to send mac address\n");
+   if (!mac_buf)
return -EFAULT;
-   }
+
memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
 
wid.id = (u16)WID_MAC_ADDR;
-- 
2.7.1

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


[PATCH 3/7] staging: wilc1000: handle_set_mac_address: use kmemdup

2016-02-16 Thread Chaehyun Lim
This patch replaces kmalloc followed by memcpy with kmemdup.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4d50b38..65d2393 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -429,13 +429,11 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
 {
s32 result = 0;
struct wid wid;
-   u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
 
+   u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
if (!mac_buf)
return -ENOMEM;
 
-   memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
-
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = mac_buf;
-- 
2.7.1

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


[PATCH 5/7] staging: wilc1000: handle_set_mac_address: change data type of result

2016-02-16 Thread Chaehyun Lim
result variable gets value from wilc_send_config_pkt that has return
value of int. This patch changes data type of result variable to int.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c671f05..90321a3 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -427,7 +427,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
 static void handle_set_mac_address(struct wilc_vif *vif,
   struct set_mac_addr *set_mac_addr)
 {
-   s32 result = 0;
+   int result = 0;
struct wid wid;
 
u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
-- 
2.7.1

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


[PATCH 7/7] staging: wilc1000: handle_set_mac_address: use netdev_err

2016-02-16 Thread Chaehyun Lim
This patch uses netdev_err instead of PRINT_ER that is a custom debug
print.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index bfca0b4..d5859c5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -442,7 +442,7 @@ static void handle_set_mac_address(struct wilc_vif *vif,
ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
   wilc_get_vif_idx(vif));
if (ret)
-   PRINT_ER("Failed to set mac address\n");
+   netdev_err(vif->ndev, "Failed to set mac address\n");
 
kfree(mac_buf);
 }
-- 
2.7.1

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


[PATCH 6/7] staging: wilc1000: handle_set_mac_address: rename result

2016-02-16 Thread Chaehyun Lim
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. It will be changed until all handle_*() function
has same variable name as ret.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 90321a3..bfca0b4 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -427,7 +427,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
 static void handle_set_mac_address(struct wilc_vif *vif,
   struct set_mac_addr *set_mac_addr)
 {
-   int result = 0;
+   int ret = 0;
struct wid wid;
 
u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
@@ -439,9 +439,9 @@ static void handle_set_mac_address(struct wilc_vif *vif,
wid.val = mac_buf;
wid.size = ETH_ALEN;
 
-   result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-   if (result)
+   ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+  wilc_get_vif_idx(vif));
+   if (ret)
PRINT_ER("Failed to set mac address\n");
 
kfree(mac_buf);
-- 
2.7.1

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


Re: staging: unisys: fix else statement in visornic_main.c

2016-02-16 Thread Joe Perches
On Tue, 2016-02-16 at 10:31 +0300, Dan Carpenter wrote:
> [ checkpatch.pl told someone to introduce a bug and they did...  ]

Yeah, it happens.

People should not take a message like "generally" as
an absolute.

"else is not generally useful after a break or return"

checkpatch isn't a flow control analysis tool.
coccinelle might be able to do this better.

There isn't a coccinelle rule for this as far as I know.

> Hello Erik Arfvidson,
> 
> The patch 05f1b17ec7aa: "staging: unisys: fix else statement in
> visornic_main.c" from Feb 8, 2016, leads to the following static
> checker warning:
> 
>   drivers/staging/unisys/visornic/visornic_main.c:381 
> visornic_serverdown()
>   error: double unlock 'spin_lock:&devdata->priv_lock'
> 
> drivers/staging/unisys/visornic/visornic_main.c
>    356  static int
>    357  visornic_serverdown(struct visornic_devdata *devdata,
>    358  visorbus_state_complete_func complete_func)
>    359  {
>    360  unsigned long flags;
>    361  
>    362  spin_lock_irqsave(&devdata->priv_lock, flags);
>    363  if (!devdata->server_down && !devdata->server_change_state) {
>    364  if (devdata->going_away) {
>    365  spin_unlock_irqrestore(&devdata->priv_lock, 
> flags);
>    366  dev_dbg(&devdata->dev->device,
>    367  "%s aborting because device removal 
> pending\n",
>    368  __func__);
>    369  return -ENODEV;
>    370  }
>    371  devdata->server_change_state = true;
>    372  devdata->server_down_complete_func = complete_func;
>    373  spin_unlock_irqrestore(&devdata->priv_lock, flags);
> ^^
>    374  visornic_serverdown_complete(devdata);
>    375  } else if (devdata->server_change_state) {
>    376  dev_dbg(&devdata->dev->device, "%s changing state\n",
>    377  __func__);
>    378  spin_unlock_irqrestore(&devdata->priv_lock, flags);
>    379  return -EINVAL;
>    380  }
>    381  spin_unlock_irqrestore(&devdata->priv_lock, flags);
> ^^^
>    382  return 0;
>    383  }
> 
> regards,
> dan carpenter

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


[PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan()

2016-02-16 Thread Xishi Qiu
Currently tasksize in lowmem_scan() only calculate rss, and not include swap.
But usually smart phones enable zram, so swap space actually use ram.

Signed-off-by: Xishi Qiu 
---
 drivers/staging/android/lowmemorykiller.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 8b5a4a8..718ab8e 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -139,7 +139,10 @@ static unsigned long lowmem_scan(struct shrinker *s, 
struct shrink_control *sc)
task_unlock(p);
continue;
}
-   tasksize = get_mm_rss(p->mm);
+   tasksize = get_mm_rss(p->mm) +
+  get_mm_counter(p->mm, MM_SWAPENTS) +
+  atomic_long_read(&p->mm->nr_ptes) +
+  mm_nr_pmds(p->mm);
task_unlock(p);
if (tasksize <= 0)
continue;
-- 
1.8.3.1


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


[PATCH] staging: wilc1000: Remove trailing whitespace errors

2016-02-16 Thread Janani Ravichandran
Remove trailing whitespace checkpatch errors.

Signed-off-by: Janani Ravichandran 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_mon.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d1eedfb..04337c7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3352,7 +3352,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif 
*vif,
PRINT_ER("Failed to send association response config packet\n");
return -EINVAL;
}
-   
+
*pu32RcvdAssocRespInfoLen = wid.size;
return result;
 }
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 21f35d7..9fcb497 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -302,7 +302,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char 
*name, struct net_devi
struct WILC_WFI_mon_priv *priv;
 
/*If monitor interface is already initialized, return it*/
-   if (wilc_wfi_mon) 
+   if (wilc_wfi_mon)
return wilc_wfi_mon;
 
wilc_wfi_mon = alloc_etherdev(sizeof(struct WILC_WFI_mon_priv));
-- 
2.5.0

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


[PATCH 1/2] staging: wilc1000: Whitespaces removed from function call

2016-02-16 Thread Roger H. Newell
This patch corrects errors generated by checkpatch.pl by
removing whitespace between parameters passed to dev_err()

Signed-off-by: Roger H. Newell 
---
 drivers/staging/wilc1000/wilc_spi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 2928712..d03e03a 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -514,7 +514,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
crc[0] = rb[rix++];
crc[1] = rb[rix++];
} else {
-   dev_err(&spi->dev,"buffer overrun when 
reading crc.\n");
+   dev_err(&spi->dev, "buffer overrun when 
reading crc.\n");
result = N_FAIL;
return result;
}
@@ -680,7 +680,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
 **/
if (!g_spi.crc_off) {
if (wilc_spi_tx(wilc, crc, 2)) {
-   dev_err(&spi->dev,"Failed data block crc write, 
bus error...\n");
+   dev_err(&spi->dev, "Failed data block crc 
write, bus error...\n");
result = N_FAIL;
break;
}
@@ -1074,7 +1074,7 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 
val)
ret = wilc_spi_write_reg(wilc,
 WILC_VMM_CORE_CTL, 1);
if (!ret) {
-   dev_err(&spi->dev,"fail write reg 
vmm_core_ctl...\n");
+   dev_err(&spi->dev, "fail write reg 
vmm_core_ctl...\n");
goto _fail_;
}
}
-- 
2.5.0

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


[PATCH 2/2] staging: wilc1000: Removed braces from single block statements

2016-02-16 Thread Roger H. Newell
This patch corrects warnings generated by checkpatch.pl by
removing braces from single block statements.

Signed-off-by: Roger H. Newell 
---
 drivers/staging/wilc1000/wilc_spi.c | 25 +
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index d03e03a..cfec982 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -380,9 +380,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
break;
}
 
-   if (result != N_OK) {
+   if (result != N_OK)
return result;
-   }
 
if (!g_spi.crc_off)
wb[len - 1] = (crc7(0x7f, (const u8 *)&wb[0], len - 1)) << 1;
@@ -419,9 +418,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
return result;
}
/* zero spi write buffers. */
-   for (wix = len; wix < len2; wix++) {
+   for (wix = len; wix < len2; wix++)
wb[wix] = 0;
-   }
rix = len;
 
if (wilc_spi_tx_rx(wilc, wb, rb, len2)) {
@@ -523,9 +521,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 
adr, u8 *b, u32 sz,
int ix;
 
/* some data may be read in response to dummy bytes. */
-   for (ix = 0; (rix < len2) && (ix < sz); ) {
+   for (ix = 0; (rix < len2) && (ix < sz); )
b[ix++] = rb[rix++];
-   }
 
sz -= ix;
 
@@ -711,9 +708,8 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, 
u32 dat)
dat = cpu_to_le32(dat);
result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4,
  0);
-   if (result != N_OK) {
+   if (result != N_OK)
dev_err(&spi->dev, "Failed internal write cmd...\n");
-   }
 
return result;
 }
@@ -756,9 +752,8 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, 
u32 data)
}
 
result = spi_cmd_complete(wilc, cmd, addr, (u8 *)&data, 4, clockless);
-   if (result != N_OK) {
+   if (result != N_OK)
dev_err(&spi->dev, "Failed cmd, write reg (%08x)...\n", addr);
-   }
 
return result;
 }
@@ -786,9 +781,8 @@ static int wilc_spi_write(struct wilc *wilc, u32 addr, u8 
*buf, u32 size)
 *  Data
 **/
result = spi_data_write(wilc, buf, size);
-   if (result != N_OK) {
+   if (result != N_OK)
dev_err(&spi->dev, "Failed block data write...\n");
-   }
 
return 1;
 }
@@ -1124,9 +1118,9 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint)
return 0;
}
 
-   for (i = 0; (i < 5) && (nint > 0); i++, nint--) {
+   for (i = 0; (i < 5) && (nint > 0); i++, nint--)
reg |= (BIT((27 + i)));
-   }
+
ret = wilc_spi_write_reg(wilc, WILC_INTR_ENABLE, reg);
if (!ret) {
dev_err(&spi->dev, "Failed write reg (%08x)...\n",
@@ -1141,9 +1135,8 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint)
return 0;
}
 
-   for (i = 0; (i < 3) && (nint > 0); i++, nint--) {
+   for (i = 0; (i < 3) && (nint > 0); i++, nint--)
reg |= BIT(i);
-   }
 
ret = wilc_spi_read_reg(wilc, WILC_INTR2_ENABLE, ®);
if (!ret) {
-- 
2.5.0

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


Re: staging: unisys: fix else statement in visornic_main.c

2016-02-16 Thread Arfvidson, Erik
On 2/16/2016 4:02 AM, Joe Perches wrote:
> On Tue, 2016-02-16 at 10:31 +0300, Dan Carpenter wrote:
> > [ checkpatch.pl told someone to introduce a bug and they did...  ]
>
> Yeah, it happens.
>
> People should not take a message like "generally" as
> an absolute.
>
> "else is not generally useful after a break or return"
>
> checkpatch isn't a flow control analysis tool.
> coccinelle might be able to do this better.
>
> There isn't a coccinelle rule for this as far as I know.
>
> > Hello Erik Arfvidson,
> >
> > The patch 05f1b17ec7aa: "staging: unisys: fix else statement in
> > visornic_main.c" from Feb 8, 2016, leads to the following static
> > checker warning:
> >
> > drivers/staging/unisys/visornic/visornic_main.c:381 
> > visornic_serverdown()
> > error: double unlock 'spin_lock:&devdata->priv_lock'
> >
> > drivers/staging/unisys/visornic/visornic_main.c
> >356  static int
> >357  visornic_serverdown(struct visornic_devdata *devdata,
> >358  visorbus_state_complete_func complete_func)
> >359  {
> >360  unsigned long flags;
> >361  
> >362  spin_lock_irqsave(&devdata->priv_lock, flags);
> >363  if (!devdata->server_down && !devdata->server_change_state) 
> > {
> >364  if (devdata->going_away) {
> >365  spin_unlock_irqrestore(&devdata->priv_lock, 
> > flags);
> >366  dev_dbg(&devdata->dev->device,
> >367  "%s aborting because device removal 
> > pending\n",
> >368  __func__);
> >369  return -ENODEV;
> >370  }
> >371  devdata->server_change_state = true;
> >372  devdata->server_down_complete_func = complete_func;
> >373  spin_unlock_irqrestore(&devdata->priv_lock, flags);
> > ^^
> >374  visornic_serverdown_complete(devdata);
> >375  } else if (devdata->server_change_state) {
> >376  dev_dbg(&devdata->dev->device, "%s changing 
> > state\n",
> >377  __func__);
> >378  spin_unlock_irqrestore(&devdata->priv_lock, flags);
> >379  return -EINVAL;
> >380  }
> >381  spin_unlock_irqrestore(&devdata->priv_lock, flags);
> > ^^^
> >382  return 0;
> >383  }
> >
> > regards,
> > dan carpenter
>
>
Thanks for letting me know!
-Erik Arfvidson
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] rtlwifi: Change long delays to sleeps

2016-02-16 Thread Larry Finger

On 02/16/2016 12:17 AM, Souptick Joarder wrote:

On Tue, Feb 16, 2016 at 3:42 AM, Larry Finger  wrote:

--snip--


 else if (addr == 0xf9)
-   udelay(1);
+   usleep_range(1, 2);


  why udelay is replaced by usleep_range?


I'm not sure of your level of sophistication, but here goes.

All delay statements cause a processor to stay in control and make the system 
wait for that amount of time. A sleep statement allows a context switch, and the 
processor is able to run some other job. For that reason, sleeps are always 
preferred over delays as long as the code is not running in atomic context.


There used to be a usleep() function, but as the system cannot promise to return 
from sleep after a specific delay, it was replaced with usleep_range().


It is true that the difference between delaying and sleeping for 1 usec would 
not be too destructive to the system, but I decided to convert every branch of 
that if structure to sleep statements.


Larry

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


Re: Time for a code audit?

2016-02-16 Thread Ben Romer
On Sat, 2016-02-13 at 01:01 +0300, Dan Carpenter wrote:
> I looked at the Smatch warnings, plus some bonus stuff I'm still
> working
> on.
> 
> drivers/staging/unisys/include/iochannel.h:592 add_physinfo_entries()
> warn: inconsistent indenting
> drivers/staging/unisys/include/iochannel.h:596 add_physinfo_entries()
> warn: inconsistent indenting
> drivers/staging/unisys/include/iochannel.h:600 add_physinfo_entries()
> warn: XXX should 'inp_pfn + i' be a 64 bit type?
> 

Hi Dan,

Thank you for this list! We'll get started on fixing these issues
immediately. I've run Smatch using the make options 

O=../builds/testbuild CC=gcc-4.9 CHECK="smatch -p=kernel" C=1

but when I use it this way, I don't get that line where it complains
about the variable's size. What settings do you use?

If I can generate a list of problems that way across the whole driver
set, we can just resolve them all without having to bother you or Greg
until we have patches for them.

Thanks a ton for the review. :) 

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


Re: [PATCH 43/45] staging/lustre/libcfs: Replace use of printk with pr_

2016-02-16 Thread Oleg Drokin

On Feb 16, 2016, at 12:55 AM, Joe Perches wrote:

> On Tue, 2016-02-16 at 00:47 -0500, gr...@linuxhacker.ru wrote:
>> From: Oleg Drokin 
>> 
>> This pacifies checkpatch amongst other things, also is shorter to write
>> and avoiding calls to printk_ratelimit() is also good.
> []
>> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
>> b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
> []
>> @@ -244,11 +244,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, 
>> int mask,
>>  }
>>  
>>  if ((mask & D_CONSOLE) != 0) {
>> -printk("%s%s: %.*s", ptype, prefix, len, buf);
>> +pr_err("%s%s: %.*s", ptype, prefix, len, buf);
>>  } else {
>> -printk("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix,
>> -   hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num,
>> -   fn, len, buf);
>> +pr_warn("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix,
>> +hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num,
>> +fn, len, buf);
>>  }
>>  }
> 
> This breaks the currently correct output.

Hm, you are right. Thanks!
I guess this patch just needs some redoing.

Greg, if you can skip this patch but still apply the rest of the series, that 
would be great.
I just tested that the whole thing builds and runs fine with this patch omitted.

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


Re: whitespace error in some of commits

2016-02-16 Thread Greg KH
On Tue, Feb 16, 2016 at 03:47:00PM +0900, Tony Cho wrote:
> Hi Janani,
> 
> I can find the whitespace errors in your commits which is already accepted in 
> staging-testing branch.

Ick, my fault, I should have caught them before they were merged, sorry
about that.

> The commit number is c611d48e65e25af2dc0176e9ac135116095ed03d and 
> c611d48e65e25af2dc0176e9ac135116095ed03d.
> 
> I don't know why I couldn't find your patch emails from the community. Please 
> cc the linux-wireless and devel.

That's not how the Outreachy application process works, sorry.

> Would you fix these patch or I can make it if you don't mind.

They will be fixed later today, sorry about that.

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


Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs

2016-02-16 Thread Bjorn Helgaas
Hi Jake,

Looks good to me overall; I marked a few nits below.

The only real question I have is about domain number allocation.  See
the note below.

On Tue, Feb 09, 2016 at 07:24:28PM +, ja...@microsoft.com wrote:
> From: Jake Oshins 
> 
> This patch introduces a new driver which exposes a root PCI bus whenever a
> PCI Express device is passed through to a guest VM under Hyper-V. The
> device can be single- or multi-function. The interrupts for the devices
> are managed by an IRQ domain, implemented within the driver.
> 
> Signed-off-by: Jake Oshins 
> ---
>  MAINTAINERS   |1 +
>  drivers/pci/Kconfig   |7 +
>  drivers/pci/host/Makefile |1 +
>  drivers/pci/host/pci-hyperv.c | 2373 
> +
>  4 files changed, 2382 insertions(+)
>  create mode 100644 drivers/pci/host/pci-hyperv.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 30aca4a..b68c015 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5193,6 +5193,7 @@ F:  arch/x86/kernel/cpu/mshyperv.c
>  F:   drivers/hid/hid-hyperv.c
>  F:   drivers/hv/
>  F:   drivers/input/serio/hyperv-keyboard.c
> +F:   drivers/pci/host/pci-hyperv.c
>  F:   drivers/net/hyperv/
>  F:   drivers/scsi/storvsc_drv.c
>  F:   drivers/video/fbdev/hyperv_fb.c
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index 73de4ef..54a5441 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -118,4 +118,11 @@ config PCI_LABEL
>   def_bool y if (DMI || ACPI)
>   select NLS
>  
> +config PCI_HYPERV
> +tristate "Hyper-V PCI Frontend"
> +depends on PCI && X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && 
> X86_64
> +help
> +  The PCI device frontend driver allows the kernel to import 
> arbitrary
> +  PCI devices from a PCI backend to support PCI driver domains.
> +
>  source "drivers/pci/host/Kconfig"
> diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
> index 7b2f20c..152daf9 100644
> --- a/drivers/pci/host/Makefile
> +++ b/drivers/pci/host/Makefile
> @@ -2,6 +2,7 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o
>  obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o
>  obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
>  obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
> +obj-$(CONFIG_PCI_HYPERV) += pci-hyperv.o
>  obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
>  obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o
>  obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> new file mode 100644
> index 000..2ca43f1
> --- /dev/null
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -0,0 +1,2373 @@
> +/*
> + * Copyright (c) Microsoft Corporation.
> + *
> + * Author:
> + *   Jake Oshins 
> + *
> + * This driver acts as a paravirtual front-end for PCI Express root buses.
> + * When a PCI Express function (either an entire device or an SR-IOV
> + * Virtual Function) is being passed through to the VM, this driver exposes
> + * a new bus to the guest VM.  This is modeled as a root PCI bus because
> + * no bridges are being exposed to the VM.  In fact, with a "Generation 2"
> + * VM within Hyper-V, there may seem to be no PCI bus at all in the VM
> + * until a device as been exposed using this driver.
> + *
> + * Each root PCI bus has its own PCI domain, which is called "Segment" in
> + * the PCI Firmware Specifications.  Thus while each device passed through
> + * to the VM using this front-end will appear at "device 0", the domain will
> + * be unique.  Typically, each bus will have one PCI function on it, though
> + * this driver does support more than one.
> + *
> + * In order to map the interrupts from the device through to the guest VM,
> + * this driver also implements an IRQ Domain, which handles interrupts 
> (either
> + * MSI or MSI-X) associated with the functions on the bus.  As interrupts are
> + * set up, torn down, or reaffined, this driver communicates with the
> + * underlying hypervisor to adjust the mappings in the I/O MMU so that each
> + * interrupt will be delivered to the correct virtual processor at the right
> + * vector.  This driver does not support level-triggered (line-based)
> + * interrupts, and will report that the Interrupt Line register in the
> + * function's configuration space is zero.
> + *
> + * The rest of this driver mostly maps PCI concepts onto underlying Hyper-V
> + * facilities.  For instance, the configuration space of a function exposed
> + * by Hyper-V is mapped into a single page of memory space, and the
> + * read and write handlers for config space must be aware of this mechanism.
> + * Similarly, device setup and teardown involves messages sent to and from
> + * the PCI back-end driver in Hyper-V.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be usef

Good Day

2016-02-16 Thread Ms.Ella Golan
I am Ms.Ella Golan, I am the Executive Vice President Banking Division with 
FIRST INTERNATIONAL BANK OF ISRAEL LTD (FIBI). I am getting in touch with you 
regarding an extremely important and urgent matter. If you would oblige me the 
opportunity, I shall provide you with details upon your response.
Faithfully,
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan()

2016-02-16 Thread Greg Kroah-Hartman
On Tue, Feb 16, 2016 at 05:37:05PM +0800, Xishi Qiu wrote:
> Currently tasksize in lowmem_scan() only calculate rss, and not include swap.
> But usually smart phones enable zram, so swap space actually use ram.

Yes, but does that matter for this type of calculation?  I need an ack
from the android team before I could ever take such a core change to
this code...

thanks,

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


[PATCH 0/5] Staging: gdm72xx: Checkpatch cleanups

2016-02-16 Thread Shraddha Barke
This patch series fixes last of checkpatch warnings in gdm72xx.

Shraddha Barke (5):
  Staging: gdm72xx: Add space around that "+", "&" and "|"
  Staging: gdm72xx: Add space around that "+", "&" and "|"
  Staging: gdm72xx: Remove unnecessary parenthesis around function
pointer
  Staging: gdm72xx: Replace BUG_ON with WARN_ON
  Staging: gdm72xx: Fix line over 80 characters

 drivers/staging/gdm72xx/gdm_qos.c   | 12 ++--
 drivers/staging/gdm72xx/gdm_sdio.c  |  4 ++--
 drivers/staging/gdm72xx/gdm_usb.c   |  2 +-
 drivers/staging/gdm72xx/gdm_wimax.c | 27 ++-
 drivers/staging/gdm72xx/hci.h   |  2 +-
 drivers/staging/gdm72xx/netlink_k.c |  6 +++---
 drivers/staging/gdm72xx/sdio_boot.c |  2 +-
 drivers/staging/gdm72xx/usb_boot.c  | 10 +-
 8 files changed, 33 insertions(+), 32 deletions(-)

-- 
2.1.4

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


[PATCH 1/5] Staging: gdm72xx: Add space around that "+", "&" and "|"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "|" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/hci.h   |  2 +-
 drivers/staging/gdm72xx/netlink_k.c |  6 +++---
 drivers/staging/gdm72xx/sdio_boot.c |  2 +-
 drivers/staging/gdm72xx/usb_boot.c  | 10 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gdm72xx/hci.h b/drivers/staging/gdm72xx/hci.h
index ab903d4..b40d5c3 100644
--- a/drivers/staging/gdm72xx/hci.h
+++ b/drivers/staging/gdm72xx/hci.h
@@ -17,7 +17,7 @@
 #define HCI_HEADER_SIZE4
 #define HCI_VALUE_OFFS (HCI_HEADER_SIZE)
 #define HCI_MAX_PACKET 2048
-#define HCI_MAX_PARAM  (HCI_MAX_PACKET-HCI_HEADER_SIZE)
+#define HCI_MAX_PARAM  (HCI_MAX_PACKET - HCI_HEADER_SIZE)
 #define HCI_MAX_TLV32
 
 /* CMD-EVT */
diff --git a/drivers/staging/gdm72xx/netlink_k.c 
b/drivers/staging/gdm72xx/netlink_k.c
index cf0b47c..783770b 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -29,8 +29,8 @@
 #define ND_NLMSG_SPACE(len)(nlmsg_total_size(len) + ND_IFINDEX_LEN)
 #define ND_NLMSG_DATA(nlh) \
((void *)((char *)nlmsg_data(nlh) + ND_IFINDEX_LEN))
-#define ND_NLMSG_S_LEN(len)(len+ND_IFINDEX_LEN)
-#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len-ND_IFINDEX_LEN)
+#define ND_NLMSG_S_LEN(len)(len + ND_IFINDEX_LEN)
+#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len - ND_IFINDEX_LEN)
 #define ND_NLMSG_IFIDX(nlh)nlmsg_data(nlh)
 #define ND_MAX_MSG_LEN 8096
 
@@ -143,7 +143,7 @@ int netlink_send(struct sock *sock, int group, u16 type, 
void *msg, int len)
NETLINK_CB(skb).portid = 0;
NETLINK_CB(skb).dst_group = 0;
 
-   ret = netlink_broadcast(sock, skb, 0, group+1, GFP_ATOMIC);
+   ret = netlink_broadcast(sock, skb, 0, group + 1, GFP_ATOMIC);
 
if (!ret)
return len;
diff --git a/drivers/staging/gdm72xx/sdio_boot.c 
b/drivers/staging/gdm72xx/sdio_boot.c
index ba94b5f..5e9b38f 100644
--- a/drivers/staging/gdm72xx/sdio_boot.c
+++ b/drivers/staging/gdm72xx/sdio_boot.c
@@ -96,7 +96,7 @@ static int download_image(struct sdio_func *func, const char 
*img_name)
buf[1] = (len >> 8) & 0xff;
buf[2] = (len >> 16) & 0xff;
 
-   memcpy(buf+TYPE_A_HEADER_SIZE, firm->data + pos, len);
+   memcpy(buf + TYPE_A_HEADER_SIZE, firm->data + pos, len);
ret = sdio_memcpy_toio(func, 0, buf, len + TYPE_A_HEADER_SIZE);
if (ret < 0) {
dev_err(&func->dev,
diff --git a/drivers/staging/gdm72xx/usb_boot.c 
b/drivers/staging/gdm72xx/usb_boot.c
index 3082987..99a5c07 100644
--- a/drivers/staging/gdm72xx/usb_boot.c
+++ b/drivers/staging/gdm72xx/usb_boot.c
@@ -292,8 +292,8 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
return -ENOMEM;
}
 
-   strcpy(buf+pad_size, type_string);
-   ret = gdm_wibro_send(usbdev, buf, strlen(type_string)+pad_size);
+   strcpy(buf + pad_size, type_string);
+   ret = gdm_wibro_send(usbdev, buf, strlen(type_string) + pad_size);
if (ret < 0)
goto out;
 
@@ -310,8 +310,8 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
else
len = img_len; /* the last chunk of data */
 
-   memcpy(buf+pad_size, firm->data + pos, len);
-   ret = gdm_wibro_send(usbdev, buf, len+pad_size);
+   memcpy(buf + pad_size, firm->data + pos, len);
+   ret = gdm_wibro_send(usbdev, buf, len + pad_size);
 
if (ret < 0)
goto out;
@@ -319,7 +319,7 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
img_len -= DOWNLOAD_CHUCK;
pos += DOWNLOAD_CHUCK;
 
-   ret = em_wait_ack(usbdev, ((len+pad_size) % 512 == 0));
+   ret = em_wait_ack(usbdev, ((len + pad_size) % 512 == 0));
if (ret < 0)
goto out;
}
-- 
2.1.4

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


[PATCH 2/5] Staging: gdm72xx: Add space around that "+", "&" and "|"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "|" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/gdm_qos.c   | 12 ++--
 drivers/staging/gdm72xx/gdm_sdio.c  |  4 ++--
 drivers/staging/gdm72xx/gdm_usb.c   |  2 +-
 drivers/staging/gdm72xx/gdm_wimax.c | 18 +-
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c 
b/drivers/staging/gdm72xx/gdm_qos.c
index 8c99f91..9fc476f 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -261,7 +261,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct 
net_device *dev)
struct list_head send_list;
int ret = 0;
 
-   tcph = (struct tcphdr *)iph + iph->ihl*4;
+   tcph = (struct tcphdr *)iph + iph->ihl * 4;
 
if (ethh->h_proto == cpu_to_be16(ETH_P_IP)) {
if (qcb->qos_list_cnt && !qos_free_list.cnt) {
@@ -342,17 +342,17 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int 
size)
if (sub_cmd_evt == QOS_REPORT) {
spin_lock_irqsave(&qcb->qos_lock, flags);
for (i = 0; i < qcb->qos_list_cnt; i++) {
-   sfid = ((buf[(i*5) + 6] << 24) & 0xff00);
-   sfid += ((buf[(i*5) + 7] << 16) & 0xff);
-   sfid += ((buf[(i*5) + 8] << 8) & 0xff00);
-   sfid += (buf[(i*5) + 9]);
+   sfid = ((buf[(i * 5) + 6] << 24) & 0xff00);
+   sfid += ((buf[(i * 5) + 7] << 16) & 0xff);
+   sfid += ((buf[(i * 5) + 8] << 8) & 0xff00);
+   sfid += (buf[(i * 5) + 9]);
index = get_csr(qcb, sfid, 0);
if (index == -1) {
spin_unlock_irqrestore(&qcb->qos_lock, flags);
netdev_err(nic->netdev, "QoS ERROR: No SF\n");
return;
}
-   qcb->csr[index].qos_buf_count = buf[(i*5) + 10];
+   qcb->csr[index].qos_buf_count = buf[(i * 5) + 10];
}
 
extract_qos_list(nic, &send_list);
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index 1f5a087..9449418 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -33,10 +33,10 @@
 #define SDU_TX_BUF_SIZE2048
 #define TX_BUF_SIZE2048
 #define TX_CHUNK_SIZE  (2048 - TYPE_A_HEADER_SIZE)
-#define RX_BUF_SIZE(25*1024)
+#define RX_BUF_SIZE(25 * 1024)
 
 #define TX_HZ  2000
-#define TX_INTERVAL(NSEC_PER_SEC/TX_HZ)
+#define TX_INTERVAL(NSEC_PER_SEC / TX_HZ)
 
 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 7f035b1..f81129d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -29,7 +29,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define TX_BUF_SIZE2048
 
 #if defined(CONFIG_WIMAX_GDM72XX_WIMAX2)
-#define RX_BUF_SIZE(128*1024)  /* For packet aggregation */
+#define RX_BUF_SIZE(128 * 1024)/* For packet aggregation */
 #else
 #define RX_BUF_SIZE2048
 #endif
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 1b3da2b..c498a41 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -111,8 +111,8 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 
type, void *msg,
struct nic *nic = netdev_priv(dev);
 
u8 *buf = msg;
-   u16 hci_cmd =  (buf[0]<<8) | buf[1];
-   u16 hci_len = (buf[2]<<8) | buf[3];
+   u16 hci_cmd =  (buf[0] << 8) | buf[1];
+   u16 hci_len = (buf[2] << 8) | buf[3];
 
netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -193,8 +193,8 @@ static int gdm_wimax_event_send(struct net_device *dev, 
char *buf, int size)
struct evt_entry *e;
unsigned long flags;
 
-   u16 hci_cmd =  ((u8)buf[0]<<8) | (u8)buf[1];
-   u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3];
+   u16 hci_cmd =  ((u8)buf[0] << 8) | (u8)buf[1];
+   u16 hci_len = ((u8)buf[2] << 8) | (u8)buf[3];
 
netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -328,7 +328,7 @@ static void gdm_wimax_ind_if_updown(struct net_device *dev, 
int if_up)
hci->length = cpu_to_be16(sizeof(up_down));
hci->data[0] = up_down;
 
-   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE+sizeof(up_down));
+   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE + 
sizeof(up_down));
 }
 
 static int gdm_wimax_open(struct net_device *dev)
@@ -512,7 +512,7 @@ static void gdm_wimax_prepare_device(struct net_device *dev)
hci->cmd_evt = cpu_to_be16(WIMAX_GET_INFO);

[PATCH 3/5] Staging: gdm72xx: Remove unnecessary parenthesis around function pointer

2016-02-16 Thread Shraddha Barke
No need for the parentheses around any function pointer.
Detected using checkpatch.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/gdm_wimax.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index c498a41..2fa86ad 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -26,11 +26,11 @@
 #include "netlink_k.h"
 
 #define gdm_wimax_send(n, d, l)\
-   (n->phy_dev->send_func)(n->phy_dev->priv_dev, d, l, NULL, NULL)
+   n->phy_dev->send_func(n->phy_dev->priv_dev, d, l, NULL, NULL)
 #define gdm_wimax_send_with_cb(n, d, l, c, b)  \
-   (n->phy_dev->send_func)(n->phy_dev->priv_dev, d, l, c, b)
+   n->phy_dev->send_func(n->phy_dev->priv_dev, d, l, c, b)
 #define gdm_wimax_rcv_with_cb(n, c, b) \
-   (n->phy_dev->rcv_func)(n->phy_dev->priv_dev, c, b)
+   n->phy_dev->rcv_func(n->phy_dev->priv_dev, c, b)
 
 #define EVT_MAX_SIZE   2048
 
-- 
2.1.4

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


[PATCH 5/5] Staging: gdm72xx: Fix line over 80 characters

2016-02-16 Thread Shraddha Barke
This patch fixes the checkpatch.pl warning of line over 80 characters.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/gdm_wimax.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 8861750..0543b58 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -328,7 +328,8 @@ static void gdm_wimax_ind_if_updown(struct net_device *dev, 
int if_up)
hci->length = cpu_to_be16(sizeof(up_down));
hci->data[0] = up_down;
 
-   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE + 
sizeof(up_down));
+   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE +
+sizeof(up_down));
 }
 
 static int gdm_wimax_open(struct net_device *dev)
-- 
2.1.4

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


[PATCH 4/5] Staging: gdm72xx: Replace BUG_ON with WARN_ON

2016-02-16 Thread Shraddha Barke
Replace the usage of BUG_ON with WARN_ON.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/gdm_wimax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 2fa86ad..8861750 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -100,7 +100,7 @@ static struct evt_entry *get_event_entry(void)
 
 static void put_event_entry(struct evt_entry *e)
 {
-   BUG_ON(!e);
+   WARN_ON(!e);
 
list_add_tail(&e->list, &wm_event.freeq);
 }
-- 
2.1.4

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


[PATCH 2/5] Staging: gdm72xx: Add space around that "+", "&" and "/"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "|" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/gdm_qos.c   | 12 ++--
 drivers/staging/gdm72xx/gdm_sdio.c  |  4 ++--
 drivers/staging/gdm72xx/gdm_usb.c   |  2 +-
 drivers/staging/gdm72xx/gdm_wimax.c | 18 +-
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c 
b/drivers/staging/gdm72xx/gdm_qos.c
index 8c99f91..9fc476f 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -261,7 +261,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct 
net_device *dev)
struct list_head send_list;
int ret = 0;
 
-   tcph = (struct tcphdr *)iph + iph->ihl*4;
+   tcph = (struct tcphdr *)iph + iph->ihl * 4;
 
if (ethh->h_proto == cpu_to_be16(ETH_P_IP)) {
if (qcb->qos_list_cnt && !qos_free_list.cnt) {
@@ -342,17 +342,17 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int 
size)
if (sub_cmd_evt == QOS_REPORT) {
spin_lock_irqsave(&qcb->qos_lock, flags);
for (i = 0; i < qcb->qos_list_cnt; i++) {
-   sfid = ((buf[(i*5) + 6] << 24) & 0xff00);
-   sfid += ((buf[(i*5) + 7] << 16) & 0xff);
-   sfid += ((buf[(i*5) + 8] << 8) & 0xff00);
-   sfid += (buf[(i*5) + 9]);
+   sfid = ((buf[(i * 5) + 6] << 24) & 0xff00);
+   sfid += ((buf[(i * 5) + 7] << 16) & 0xff);
+   sfid += ((buf[(i * 5) + 8] << 8) & 0xff00);
+   sfid += (buf[(i * 5) + 9]);
index = get_csr(qcb, sfid, 0);
if (index == -1) {
spin_unlock_irqrestore(&qcb->qos_lock, flags);
netdev_err(nic->netdev, "QoS ERROR: No SF\n");
return;
}
-   qcb->csr[index].qos_buf_count = buf[(i*5) + 10];
+   qcb->csr[index].qos_buf_count = buf[(i * 5) + 10];
}
 
extract_qos_list(nic, &send_list);
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index 1f5a087..9449418 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -33,10 +33,10 @@
 #define SDU_TX_BUF_SIZE2048
 #define TX_BUF_SIZE2048
 #define TX_CHUNK_SIZE  (2048 - TYPE_A_HEADER_SIZE)
-#define RX_BUF_SIZE(25*1024)
+#define RX_BUF_SIZE(25 * 1024)
 
 #define TX_HZ  2000
-#define TX_INTERVAL(NSEC_PER_SEC/TX_HZ)
+#define TX_INTERVAL(NSEC_PER_SEC / TX_HZ)
 
 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 7f035b1..f81129d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -29,7 +29,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define TX_BUF_SIZE2048
 
 #if defined(CONFIG_WIMAX_GDM72XX_WIMAX2)
-#define RX_BUF_SIZE(128*1024)  /* For packet aggregation */
+#define RX_BUF_SIZE(128 * 1024)/* For packet aggregation */
 #else
 #define RX_BUF_SIZE2048
 #endif
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 1b3da2b..c498a41 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -111,8 +111,8 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 
type, void *msg,
struct nic *nic = netdev_priv(dev);
 
u8 *buf = msg;
-   u16 hci_cmd =  (buf[0]<<8) | buf[1];
-   u16 hci_len = (buf[2]<<8) | buf[3];
+   u16 hci_cmd =  (buf[0] << 8) | buf[1];
+   u16 hci_len = (buf[2] << 8) | buf[3];
 
netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -193,8 +193,8 @@ static int gdm_wimax_event_send(struct net_device *dev, 
char *buf, int size)
struct evt_entry *e;
unsigned long flags;
 
-   u16 hci_cmd =  ((u8)buf[0]<<8) | (u8)buf[1];
-   u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3];
+   u16 hci_cmd =  ((u8)buf[0] << 8) | (u8)buf[1];
+   u16 hci_len = ((u8)buf[2] << 8) | (u8)buf[3];
 
netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -328,7 +328,7 @@ static void gdm_wimax_ind_if_updown(struct net_device *dev, 
int if_up)
hci->length = cpu_to_be16(sizeof(up_down));
hci->data[0] = up_down;
 
-   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE+sizeof(up_down));
+   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE + 
sizeof(up_down));
 }
 
 static int gdm_wimax_open(struct net_device *dev)
@@ -512,7 +512,7 @@ static void gdm_wimax_prepare_device(struct net_device *dev)
hci->cmd_evt = cpu_to_be16(WIMAX_GET_INFO);

[PATCH v2 1/5] Staging: gdm72xx: Add space around that "+", "&" and "|"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "|" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
Changes in v2-
 Nothing

 drivers/staging/gdm72xx/hci.h   |  2 +-
 drivers/staging/gdm72xx/netlink_k.c |  6 +++---
 drivers/staging/gdm72xx/sdio_boot.c |  2 +-
 drivers/staging/gdm72xx/usb_boot.c  | 10 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gdm72xx/hci.h b/drivers/staging/gdm72xx/hci.h
index ab903d4..b40d5c3 100644
--- a/drivers/staging/gdm72xx/hci.h
+++ b/drivers/staging/gdm72xx/hci.h
@@ -17,7 +17,7 @@
 #define HCI_HEADER_SIZE4
 #define HCI_VALUE_OFFS (HCI_HEADER_SIZE)
 #define HCI_MAX_PACKET 2048
-#define HCI_MAX_PARAM  (HCI_MAX_PACKET-HCI_HEADER_SIZE)
+#define HCI_MAX_PARAM  (HCI_MAX_PACKET - HCI_HEADER_SIZE)
 #define HCI_MAX_TLV32
 
 /* CMD-EVT */
diff --git a/drivers/staging/gdm72xx/netlink_k.c 
b/drivers/staging/gdm72xx/netlink_k.c
index cf0b47c..783770b 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -29,8 +29,8 @@
 #define ND_NLMSG_SPACE(len)(nlmsg_total_size(len) + ND_IFINDEX_LEN)
 #define ND_NLMSG_DATA(nlh) \
((void *)((char *)nlmsg_data(nlh) + ND_IFINDEX_LEN))
-#define ND_NLMSG_S_LEN(len)(len+ND_IFINDEX_LEN)
-#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len-ND_IFINDEX_LEN)
+#define ND_NLMSG_S_LEN(len)(len + ND_IFINDEX_LEN)
+#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len - ND_IFINDEX_LEN)
 #define ND_NLMSG_IFIDX(nlh)nlmsg_data(nlh)
 #define ND_MAX_MSG_LEN 8096
 
@@ -143,7 +143,7 @@ int netlink_send(struct sock *sock, int group, u16 type, 
void *msg, int len)
NETLINK_CB(skb).portid = 0;
NETLINK_CB(skb).dst_group = 0;
 
-   ret = netlink_broadcast(sock, skb, 0, group+1, GFP_ATOMIC);
+   ret = netlink_broadcast(sock, skb, 0, group + 1, GFP_ATOMIC);
 
if (!ret)
return len;
diff --git a/drivers/staging/gdm72xx/sdio_boot.c 
b/drivers/staging/gdm72xx/sdio_boot.c
index ba94b5f..5e9b38f 100644
--- a/drivers/staging/gdm72xx/sdio_boot.c
+++ b/drivers/staging/gdm72xx/sdio_boot.c
@@ -96,7 +96,7 @@ static int download_image(struct sdio_func *func, const char 
*img_name)
buf[1] = (len >> 8) & 0xff;
buf[2] = (len >> 16) & 0xff;
 
-   memcpy(buf+TYPE_A_HEADER_SIZE, firm->data + pos, len);
+   memcpy(buf + TYPE_A_HEADER_SIZE, firm->data + pos, len);
ret = sdio_memcpy_toio(func, 0, buf, len + TYPE_A_HEADER_SIZE);
if (ret < 0) {
dev_err(&func->dev,
diff --git a/drivers/staging/gdm72xx/usb_boot.c 
b/drivers/staging/gdm72xx/usb_boot.c
index 3082987..99a5c07 100644
--- a/drivers/staging/gdm72xx/usb_boot.c
+++ b/drivers/staging/gdm72xx/usb_boot.c
@@ -292,8 +292,8 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
return -ENOMEM;
}
 
-   strcpy(buf+pad_size, type_string);
-   ret = gdm_wibro_send(usbdev, buf, strlen(type_string)+pad_size);
+   strcpy(buf + pad_size, type_string);
+   ret = gdm_wibro_send(usbdev, buf, strlen(type_string) + pad_size);
if (ret < 0)
goto out;
 
@@ -310,8 +310,8 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
else
len = img_len; /* the last chunk of data */
 
-   memcpy(buf+pad_size, firm->data + pos, len);
-   ret = gdm_wibro_send(usbdev, buf, len+pad_size);
+   memcpy(buf + pad_size, firm->data + pos, len);
+   ret = gdm_wibro_send(usbdev, buf, len + pad_size);
 
if (ret < 0)
goto out;
@@ -319,7 +319,7 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
img_len -= DOWNLOAD_CHUCK;
pos += DOWNLOAD_CHUCK;
 
-   ret = em_wait_ack(usbdev, ((len+pad_size) % 512 == 0));
+   ret = em_wait_ack(usbdev, ((len + pad_size) % 512 == 0));
if (ret < 0)
goto out;
}
-- 
2.1.4

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


[PATCH v2 2/5] Staging: gdm72xx: Add space around that "+", "&" and "/"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "|" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
Changes in v2-
 Subject changed

 drivers/staging/gdm72xx/gdm_qos.c   | 12 ++--
 drivers/staging/gdm72xx/gdm_sdio.c  |  4 ++--
 drivers/staging/gdm72xx/gdm_usb.c   |  2 +-
 drivers/staging/gdm72xx/gdm_wimax.c | 18 +-
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c 
b/drivers/staging/gdm72xx/gdm_qos.c
index 8c99f91..9fc476f 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -261,7 +261,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct 
net_device *dev)
struct list_head send_list;
int ret = 0;
 
-   tcph = (struct tcphdr *)iph + iph->ihl*4;
+   tcph = (struct tcphdr *)iph + iph->ihl * 4;
 
if (ethh->h_proto == cpu_to_be16(ETH_P_IP)) {
if (qcb->qos_list_cnt && !qos_free_list.cnt) {
@@ -342,17 +342,17 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int 
size)
if (sub_cmd_evt == QOS_REPORT) {
spin_lock_irqsave(&qcb->qos_lock, flags);
for (i = 0; i < qcb->qos_list_cnt; i++) {
-   sfid = ((buf[(i*5) + 6] << 24) & 0xff00);
-   sfid += ((buf[(i*5) + 7] << 16) & 0xff);
-   sfid += ((buf[(i*5) + 8] << 8) & 0xff00);
-   sfid += (buf[(i*5) + 9]);
+   sfid = ((buf[(i * 5) + 6] << 24) & 0xff00);
+   sfid += ((buf[(i * 5) + 7] << 16) & 0xff);
+   sfid += ((buf[(i * 5) + 8] << 8) & 0xff00);
+   sfid += (buf[(i * 5) + 9]);
index = get_csr(qcb, sfid, 0);
if (index == -1) {
spin_unlock_irqrestore(&qcb->qos_lock, flags);
netdev_err(nic->netdev, "QoS ERROR: No SF\n");
return;
}
-   qcb->csr[index].qos_buf_count = buf[(i*5) + 10];
+   qcb->csr[index].qos_buf_count = buf[(i * 5) + 10];
}
 
extract_qos_list(nic, &send_list);
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index 1f5a087..9449418 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -33,10 +33,10 @@
 #define SDU_TX_BUF_SIZE2048
 #define TX_BUF_SIZE2048
 #define TX_CHUNK_SIZE  (2048 - TYPE_A_HEADER_SIZE)
-#define RX_BUF_SIZE(25*1024)
+#define RX_BUF_SIZE(25 * 1024)
 
 #define TX_HZ  2000
-#define TX_INTERVAL(NSEC_PER_SEC/TX_HZ)
+#define TX_INTERVAL(NSEC_PER_SEC / TX_HZ)
 
 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 7f035b1..f81129d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -29,7 +29,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define TX_BUF_SIZE2048
 
 #if defined(CONFIG_WIMAX_GDM72XX_WIMAX2)
-#define RX_BUF_SIZE(128*1024)  /* For packet aggregation */
+#define RX_BUF_SIZE(128 * 1024)/* For packet aggregation */
 #else
 #define RX_BUF_SIZE2048
 #endif
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 1b3da2b..c498a41 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -111,8 +111,8 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 
type, void *msg,
struct nic *nic = netdev_priv(dev);
 
u8 *buf = msg;
-   u16 hci_cmd =  (buf[0]<<8) | buf[1];
-   u16 hci_len = (buf[2]<<8) | buf[3];
+   u16 hci_cmd =  (buf[0] << 8) | buf[1];
+   u16 hci_len = (buf[2] << 8) | buf[3];
 
netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -193,8 +193,8 @@ static int gdm_wimax_event_send(struct net_device *dev, 
char *buf, int size)
struct evt_entry *e;
unsigned long flags;
 
-   u16 hci_cmd =  ((u8)buf[0]<<8) | (u8)buf[1];
-   u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3];
+   u16 hci_cmd =  ((u8)buf[0] << 8) | (u8)buf[1];
+   u16 hci_len = ((u8)buf[2] << 8) | (u8)buf[3];
 
netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -328,7 +328,7 @@ static void gdm_wimax_ind_if_updown(struct net_device *dev, 
int if_up)
hci->length = cpu_to_be16(sizeof(up_down));
hci->data[0] = up_down;
 
-   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE+sizeof(up_down));
+   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE + 
sizeof(up_down));
 }
 
 static int gdm_wimax_open(struct net_device *dev)
@@ -512,7 +512,7 @@ static void gdm_wimax_prepare_device(struct net_device *dev)
hci->cmd_evt = cpu_

[PATCH v2 3/5] Staging: gdm72xx: Remove unnecessary parenthesis around function pointer

2016-02-16 Thread Shraddha Barke
No need for the parentheses around any function pointer.
Detected using checkpatch.

Signed-off-by: Shraddha Barke 
---
Changes in v2-
 Nothing

 drivers/staging/gdm72xx/gdm_wimax.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index c498a41..2fa86ad 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -26,11 +26,11 @@
 #include "netlink_k.h"
 
 #define gdm_wimax_send(n, d, l)\
-   (n->phy_dev->send_func)(n->phy_dev->priv_dev, d, l, NULL, NULL)
+   n->phy_dev->send_func(n->phy_dev->priv_dev, d, l, NULL, NULL)
 #define gdm_wimax_send_with_cb(n, d, l, c, b)  \
-   (n->phy_dev->send_func)(n->phy_dev->priv_dev, d, l, c, b)
+   n->phy_dev->send_func(n->phy_dev->priv_dev, d, l, c, b)
 #define gdm_wimax_rcv_with_cb(n, c, b) \
-   (n->phy_dev->rcv_func)(n->phy_dev->priv_dev, c, b)
+   n->phy_dev->rcv_func(n->phy_dev->priv_dev, c, b)
 
 #define EVT_MAX_SIZE   2048
 
-- 
2.1.4

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


Re: [PATCH 4/5] Staging: gdm72xx: Replace BUG_ON with WARN_ON

2016-02-16 Thread Dan Carpenter
On Wed, Feb 17, 2016 at 12:55:47AM +0530, Shraddha Barke wrote:
> Replace the usage of BUG_ON with WARN_ON.
> 
> Signed-off-by: Shraddha Barke 
> ---
>  drivers/staging/gdm72xx/gdm_wimax.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
> b/drivers/staging/gdm72xx/gdm_wimax.c
> index 2fa86ad..8861750 100644
> --- a/drivers/staging/gdm72xx/gdm_wimax.c
> +++ b/drivers/staging/gdm72xx/gdm_wimax.c
> @@ -100,7 +100,7 @@ static struct evt_entry *get_event_entry(void)
>  
>  static void put_event_entry(struct evt_entry *e)
>  {
> - BUG_ON(!e);
> + WARN_ON(!e);
>  
>   list_add_tail(&e->list, &wm_event.freeq);

You may was well delete the check.  There is only one caller so we know
e is not NULL.  It's going to oops on the next line anyway and that
would give us a pretty decent stack trace.

regards,
dan carpenter

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


[PATCH v2 4/5] Staging: gdm72xx: Replace BUG_ON with WARN_ON

2016-02-16 Thread Shraddha Barke
Replace the usage of BUG_ON with WARN_ON.

Signed-off-by: Shraddha Barke 
---
Changes in v2-
 No change

 drivers/staging/gdm72xx/gdm_wimax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 2fa86ad..8861750 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -100,7 +100,7 @@ static struct evt_entry *get_event_entry(void)
 
 static void put_event_entry(struct evt_entry *e)
 {
-   BUG_ON(!e);
+   WARN_ON(!e);
 
list_add_tail(&e->list, &wm_event.freeq);
 }
-- 
2.1.4

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


Re: [PATCH net-next] hv_netvsc: Increase delay for RNDIS_STATUS_NETWORK_CHANGE

2016-02-16 Thread David Miller
From: Haiyang Zhang 
Date: Tue, 9 Feb 2016 15:31:34 +

> 1) I share your concern as well. Is there a universal way to immediately 
> trigger 
> DHCP renew of all current and future daemons with a single event from kernel? 
> If not, can we put the delay (RNDIS_STATUS_NETWORK_CHANGE only) into a 
> tunable variable of this driver?
> 
> 2) We used to have the call_usermodehelper "/etc/init.d/network restart" to 
> trigger DHCP renew. In commit 27a70af3f4, Vitaly has replaced it with the 
> current 
> code that updates the link status with at least 2 seconds interval, so that 
> the 
> "link_watch infrastructure" can send notification out. link_watch 
> infrastructure 
> only sends one notification per second.

If the daemon is waiting for the link state change properly, there should be
no delay necessary at all.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 0/4] Staging: gdm72xx: Checkpatch cleanups.

2016-02-16 Thread Shraddha Barke
This patch series fixes last of checkpatch warnings in gdm72xx.

Shraddha Barke (4):
  Staging: gdm72xx: Add space around that "+", "&" and "|"
  Staging: gdm72xx: Add space around that "+", "&" and "/"
  Staging: gdm72xx: Remove unnecessary parenthesis around function
pointer
  Staging: gdm72xx: Remove BUG_ON

 drivers/staging/gdm72xx/gdm_qos.c   | 12 ++--
 drivers/staging/gdm72xx/gdm_sdio.c  |  4 ++--
 drivers/staging/gdm72xx/gdm_usb.c   |  2 +-
 drivers/staging/gdm72xx/gdm_wimax.c | 27 +--
 drivers/staging/gdm72xx/hci.h   |  2 +-
 drivers/staging/gdm72xx/netlink_k.c |  6 +++---
 drivers/staging/gdm72xx/sdio_boot.c |  2 +-
 drivers/staging/gdm72xx/usb_boot.c  | 10 +-
 8 files changed, 32 insertions(+), 33 deletions(-)

-- 
2.1.4

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


[PATCH v3 1/4] Staging: gdm72xx: Add space around that "+", "&" and "|"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "|" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
Changes in v2 and v3-
 No change.

 drivers/staging/gdm72xx/hci.h   |  2 +-
 drivers/staging/gdm72xx/netlink_k.c |  6 +++---
 drivers/staging/gdm72xx/sdio_boot.c |  2 +-
 drivers/staging/gdm72xx/usb_boot.c  | 10 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gdm72xx/hci.h b/drivers/staging/gdm72xx/hci.h
index ab903d4..b40d5c3 100644
--- a/drivers/staging/gdm72xx/hci.h
+++ b/drivers/staging/gdm72xx/hci.h
@@ -17,7 +17,7 @@
 #define HCI_HEADER_SIZE4
 #define HCI_VALUE_OFFS (HCI_HEADER_SIZE)
 #define HCI_MAX_PACKET 2048
-#define HCI_MAX_PARAM  (HCI_MAX_PACKET-HCI_HEADER_SIZE)
+#define HCI_MAX_PARAM  (HCI_MAX_PACKET - HCI_HEADER_SIZE)
 #define HCI_MAX_TLV32
 
 /* CMD-EVT */
diff --git a/drivers/staging/gdm72xx/netlink_k.c 
b/drivers/staging/gdm72xx/netlink_k.c
index cf0b47c..783770b 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -29,8 +29,8 @@
 #define ND_NLMSG_SPACE(len)(nlmsg_total_size(len) + ND_IFINDEX_LEN)
 #define ND_NLMSG_DATA(nlh) \
((void *)((char *)nlmsg_data(nlh) + ND_IFINDEX_LEN))
-#define ND_NLMSG_S_LEN(len)(len+ND_IFINDEX_LEN)
-#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len-ND_IFINDEX_LEN)
+#define ND_NLMSG_S_LEN(len)(len + ND_IFINDEX_LEN)
+#define ND_NLMSG_R_LEN(nlh)(nlh->nlmsg_len - ND_IFINDEX_LEN)
 #define ND_NLMSG_IFIDX(nlh)nlmsg_data(nlh)
 #define ND_MAX_MSG_LEN 8096
 
@@ -143,7 +143,7 @@ int netlink_send(struct sock *sock, int group, u16 type, 
void *msg, int len)
NETLINK_CB(skb).portid = 0;
NETLINK_CB(skb).dst_group = 0;
 
-   ret = netlink_broadcast(sock, skb, 0, group+1, GFP_ATOMIC);
+   ret = netlink_broadcast(sock, skb, 0, group + 1, GFP_ATOMIC);
 
if (!ret)
return len;
diff --git a/drivers/staging/gdm72xx/sdio_boot.c 
b/drivers/staging/gdm72xx/sdio_boot.c
index ba94b5f..5e9b38f 100644
--- a/drivers/staging/gdm72xx/sdio_boot.c
+++ b/drivers/staging/gdm72xx/sdio_boot.c
@@ -96,7 +96,7 @@ static int download_image(struct sdio_func *func, const char 
*img_name)
buf[1] = (len >> 8) & 0xff;
buf[2] = (len >> 16) & 0xff;
 
-   memcpy(buf+TYPE_A_HEADER_SIZE, firm->data + pos, len);
+   memcpy(buf + TYPE_A_HEADER_SIZE, firm->data + pos, len);
ret = sdio_memcpy_toio(func, 0, buf, len + TYPE_A_HEADER_SIZE);
if (ret < 0) {
dev_err(&func->dev,
diff --git a/drivers/staging/gdm72xx/usb_boot.c 
b/drivers/staging/gdm72xx/usb_boot.c
index 3082987..99a5c07 100644
--- a/drivers/staging/gdm72xx/usb_boot.c
+++ b/drivers/staging/gdm72xx/usb_boot.c
@@ -292,8 +292,8 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
return -ENOMEM;
}
 
-   strcpy(buf+pad_size, type_string);
-   ret = gdm_wibro_send(usbdev, buf, strlen(type_string)+pad_size);
+   strcpy(buf + pad_size, type_string);
+   ret = gdm_wibro_send(usbdev, buf, strlen(type_string) + pad_size);
if (ret < 0)
goto out;
 
@@ -310,8 +310,8 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
else
len = img_len; /* the last chunk of data */
 
-   memcpy(buf+pad_size, firm->data + pos, len);
-   ret = gdm_wibro_send(usbdev, buf, len+pad_size);
+   memcpy(buf + pad_size, firm->data + pos, len);
+   ret = gdm_wibro_send(usbdev, buf, len + pad_size);
 
if (ret < 0)
goto out;
@@ -319,7 +319,7 @@ static int em_download_image(struct usb_device *usbdev, 
const char *img_name,
img_len -= DOWNLOAD_CHUCK;
pos += DOWNLOAD_CHUCK;
 
-   ret = em_wait_ack(usbdev, ((len+pad_size) % 512 == 0));
+   ret = em_wait_ack(usbdev, ((len + pad_size) % 512 == 0));
if (ret < 0)
goto out;
}
-- 
2.1.4

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


[PATCH v3 3/4] Staging: gdm72xx: Remove unnecessary parenthesis around function pointer

2016-02-16 Thread Shraddha Barke
No need for the parentheses around any function pointer.
Detected using checkpatch.

Signed-off-by: Shraddha Barke 
---
Changes in v2 and v3-
 Nothing.

 drivers/staging/gdm72xx/gdm_wimax.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 988d71a..859880c 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -26,11 +26,11 @@
 #include "netlink_k.h"
 
 #define gdm_wimax_send(n, d, l)\
-   (n->phy_dev->send_func)(n->phy_dev->priv_dev, d, l, NULL, NULL)
+   n->phy_dev->send_func(n->phy_dev->priv_dev, d, l, NULL, NULL)
 #define gdm_wimax_send_with_cb(n, d, l, c, b)  \
-   (n->phy_dev->send_func)(n->phy_dev->priv_dev, d, l, c, b)
+   n->phy_dev->send_func(n->phy_dev->priv_dev, d, l, c, b)
 #define gdm_wimax_rcv_with_cb(n, c, b) \
-   (n->phy_dev->rcv_func)(n->phy_dev->priv_dev, c, b)
+   n->phy_dev->rcv_func(n->phy_dev->priv_dev, c, b)
 
 #define EVT_MAX_SIZE   2048
 
-- 
2.1.4

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


[PATCH v3 2/4] Staging: gdm72xx: Add space around that "+", "&" and "/"

2016-02-16 Thread Shraddha Barke
Add missing spaces around "+", "&" and "/" to follow kernel coding
style. Warning detected by checkpatch.

Signed-off-by: Shraddha Barke 
---
Changes in v2-
 Subject
Changes in v3-
 Fix 80 line. 

 drivers/staging/gdm72xx/gdm_qos.c   | 12 ++--
 drivers/staging/gdm72xx/gdm_sdio.c  |  4 ++--
 drivers/staging/gdm72xx/gdm_usb.c   |  2 +-
 drivers/staging/gdm72xx/gdm_wimax.c | 19 ++-
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_qos.c 
b/drivers/staging/gdm72xx/gdm_qos.c
index 8c99f91..9fc476f 100644
--- a/drivers/staging/gdm72xx/gdm_qos.c
+++ b/drivers/staging/gdm72xx/gdm_qos.c
@@ -261,7 +261,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct 
net_device *dev)
struct list_head send_list;
int ret = 0;
 
-   tcph = (struct tcphdr *)iph + iph->ihl*4;
+   tcph = (struct tcphdr *)iph + iph->ihl * 4;
 
if (ethh->h_proto == cpu_to_be16(ETH_P_IP)) {
if (qcb->qos_list_cnt && !qos_free_list.cnt) {
@@ -342,17 +342,17 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int 
size)
if (sub_cmd_evt == QOS_REPORT) {
spin_lock_irqsave(&qcb->qos_lock, flags);
for (i = 0; i < qcb->qos_list_cnt; i++) {
-   sfid = ((buf[(i*5) + 6] << 24) & 0xff00);
-   sfid += ((buf[(i*5) + 7] << 16) & 0xff);
-   sfid += ((buf[(i*5) + 8] << 8) & 0xff00);
-   sfid += (buf[(i*5) + 9]);
+   sfid = ((buf[(i * 5) + 6] << 24) & 0xff00);
+   sfid += ((buf[(i * 5) + 7] << 16) & 0xff);
+   sfid += ((buf[(i * 5) + 8] << 8) & 0xff00);
+   sfid += (buf[(i * 5) + 9]);
index = get_csr(qcb, sfid, 0);
if (index == -1) {
spin_unlock_irqrestore(&qcb->qos_lock, flags);
netdev_err(nic->netdev, "QoS ERROR: No SF\n");
return;
}
-   qcb->csr[index].qos_buf_count = buf[(i*5) + 10];
+   qcb->csr[index].qos_buf_count = buf[(i * 5) + 10];
}
 
extract_qos_list(nic, &send_list);
diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index 1f5a087..9449418 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -33,10 +33,10 @@
 #define SDU_TX_BUF_SIZE2048
 #define TX_BUF_SIZE2048
 #define TX_CHUNK_SIZE  (2048 - TYPE_A_HEADER_SIZE)
-#define RX_BUF_SIZE(25*1024)
+#define RX_BUF_SIZE(25 * 1024)
 
 #define TX_HZ  2000
-#define TX_INTERVAL(NSEC_PER_SEC/TX_HZ)
+#define TX_INTERVAL(NSEC_PER_SEC / TX_HZ)
 
 static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
 {
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 7f035b1..f81129d 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -29,7 +29,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define TX_BUF_SIZE2048
 
 #if defined(CONFIG_WIMAX_GDM72XX_WIMAX2)
-#define RX_BUF_SIZE(128*1024)  /* For packet aggregation */
+#define RX_BUF_SIZE(128 * 1024)/* For packet aggregation */
 #else
 #define RX_BUF_SIZE2048
 #endif
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 1b3da2b..988d71a 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -111,8 +111,8 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 
type, void *msg,
struct nic *nic = netdev_priv(dev);
 
u8 *buf = msg;
-   u16 hci_cmd =  (buf[0]<<8) | buf[1];
-   u16 hci_len = (buf[2]<<8) | buf[3];
+   u16 hci_cmd =  (buf[0] << 8) | buf[1];
+   u16 hci_len = (buf[2] << 8) | buf[3];
 
netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -193,8 +193,8 @@ static int gdm_wimax_event_send(struct net_device *dev, 
char *buf, int size)
struct evt_entry *e;
unsigned long flags;
 
-   u16 hci_cmd =  ((u8)buf[0]<<8) | (u8)buf[1];
-   u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3];
+   u16 hci_cmd =  ((u8)buf[0] << 8) | (u8)buf[1];
+   u16 hci_len = ((u8)buf[2] << 8) | (u8)buf[3];
 
netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len);
 
@@ -328,7 +328,8 @@ static void gdm_wimax_ind_if_updown(struct net_device *dev, 
int if_up)
hci->length = cpu_to_be16(sizeof(up_down));
hci->data[0] = up_down;
 
-   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE+sizeof(up_down));
+   gdm_wimax_event_send(dev, (char *)hci, HCI_HEADER_SIZE +
+sizeof(up_down));
 }
 
 static int gdm_wimax_open(struct net_device *dev)
@@ -512,7 +513,7 @@ static void gdm_wimax_prepare_device(

[PATCH v3 4/4] Staging: gdm72xx: Remove BUG_ON

2016-02-16 Thread Shraddha Barke
Delete the BUG_ON check.

Signed-off-by: Shraddha Barke 
---
Changes in v3-
 Deleted BUG_ON
Changes in v2-
 Nothing

 drivers/staging/gdm72xx/gdm_wimax.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index 859880c..5db0b46 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -100,8 +100,6 @@ static struct evt_entry *get_event_entry(void)
 
 static void put_event_entry(struct evt_entry *e)
 {
-   BUG_ON(!e);
-
list_add_tail(&e->list, &wm_event.freeq);
 }
 
-- 
2.1.4

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


[PATCH] staging: rtl8712: Improve suspend/resume functionality.

2016-02-16 Thread Hemmo Nieminen
Fix a driver hang caused by earlier suspend/resume cycles. By handling a
ENODEV error during suspend as a real error we eventually end up stopping
the whole driver.

Fix this by handling the ENODEV error (during suspend) essentially by
retrying.

Signed-off-by: Hemmo Nieminen 
---
 drivers/staging/rtl8712/usb_ops_linux.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/usb_ops_linux.c 
b/drivers/staging/rtl8712/usb_ops_linux.c
index e77be2a..03aac59 100644
--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -228,16 +228,19 @@ static void r8712_usb_read_port_complete(struct urb *purb)
}
} else {
switch (purb->status) {
-   case -ENOENT:
-   if (padapter->bSuspended)
-   break;
-   /* Fall through. */
case -EINVAL:
case -EPIPE:
case -ENODEV:
case -ESHUTDOWN:
padapter->bDriverStopped = true;
break;
+   case -ENOENT:
+   if (!padapter->bSuspended)
+   {
+   padapter->bDriverStopped = true;
+   break;
+   }
+   /* Fall through. */
case -EPROTO:
precvbuf->reuse = true;
r8712_read_port(padapter, precvpriv->ff_hwaddr, 0,
-- 
2.7.1

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


Re: [PATCH v2 4/5] Staging: gdm72xx: Replace BUG_ON with WARN_ON

2016-02-16 Thread Greg Kroah-Hartman
On Wed, Feb 17, 2016 at 01:11:26AM +0530, Shraddha Barke wrote:
> Replace the usage of BUG_ON with WARN_ON.
> 
> Signed-off-by: Shraddha Barke 
> ---
> Changes in v2-
>  No change
> 
>  drivers/staging/gdm72xx/gdm_wimax.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
> b/drivers/staging/gdm72xx/gdm_wimax.c
> index 2fa86ad..8861750 100644
> --- a/drivers/staging/gdm72xx/gdm_wimax.c
> +++ b/drivers/staging/gdm72xx/gdm_wimax.c
> @@ -100,7 +100,7 @@ static struct evt_entry *get_event_entry(void)
>  
>  static void put_event_entry(struct evt_entry *e)
>  {
> - BUG_ON(!e);
> + WARN_ON(!e);

How can !e ever happen?  Just unwind this and remove the function
entirely, it's only called in one place.

thanks,

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


RE: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs

2016-02-16 Thread Jake Oshins
> -Original Message-
> From: Bjorn Helgaas [mailto:helg...@kernel.org]
> Sent: Tuesday, February 16, 2016 8:46 AM
> To: Jake Oshins 
> Cc: bhelg...@google.com; linux-...@vger.kernel.org;
> gre...@linuxfoundation.org; KY Srinivasan ; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; vkuzn...@redhat.com; t...@linutronix.de; Haiyang
> Zhang ; marc.zyng...@arm.com; Hadden
> Hoppert 
> Subject: Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end
> for Hyper-V VMs
> 
> Hi Jake,
> 
> Looks good to me overall; I marked a few nits below.
> 
> The only real question I have is about domain number allocation.  See
> the note below.
> 
[snip]
> > +
> > +   /*
> > +* The PCI bus "domain" is what is called "segment" in
> > +* ACPI and other specs.  Pull it from the instance ID,
> > +* to get something unique.  Bytes 8 and 9 are what is used
> > +* in Windows guests, so do the same thing for consistency.
> > +*/
> > +
> > +   hbus->sysdata.domain = hdev->dev_instance.b[9] |
> > +  hdev->dev_instance.b[8] << 8;
> 
> How do we know this is unique?  We don't have any idea what the
> platform will put in _SEG, so I think there's a potential conflict
> here.  The Intel VMD driver (arch/x86/pci/vmd.c) has a similar
> problem, and it looks for unused domain numbers starting at 0x1
> (see vmd_find_free_domain()).
> 

Bjorn, thank you for your very thorough reviews.  I deeply appreciate it.  I 
checked the Hyper-V code and it currently does guarantee that these values are 
unique.  When I resend the series, I'll add a comment to that effect.  I'll 
also add a comment to Hyper-V that says that it has to stay that way.

I'll resend shortly.

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


[PATCH RESEND v3 0/3] PCI: hv: New paravirtual PCI front-end driver

2016-02-16 Thread jakeo
From: Jake Oshins 

This version incorporates more feedback from Bjorn Helgaas.  Most notably,
I removed some debugging code and I consistently used architectural
means for getting the PCI domain instead of just reaching into the sysdata.

This is a resend of patches that enable PCI pass-through within Hyper-V
VMs.  This patch series only includes those which were deemed appropriate
for being incorportated via the PCI tree.  All other patches in previous
patch series have gone through other trees and are now in mainline.

The first two patches modify PCI so that new root PCI buses can be marked with
an associated fwnode_handle, and so that root PCI buses can look up their
associated IRQ domain by that handle.

The last patch, introduces a new driver, hv_pcifront, which exposes root PCI
buses in a Hyper-V VM.  These root PCI buses expose real PCIe devices, or PCI
Virtual Functions.

Jake Oshins (3):
  PCI: Add fwnode_handle to pci_sysdata
  PCI: irqdomain: Look up IRQ domain by fwnode_handle
  PCI: hv: New paravirtual PCI front-end for Hyper-V VMs

 MAINTAINERS   |1 +
 arch/x86/include/asm/pci.h|   15 +
 drivers/pci/Kconfig   |7 +
 drivers/pci/host/Makefile |1 +
 drivers/pci/host/pci-hyperv.c | 2359 +
 drivers/pci/probe.c   |   15 +
 include/linux/pci.h   |4 +
 7 files changed, 2402 insertions(+)
 create mode 100644 drivers/pci/host/pci-hyperv.c

--
1.9.1

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


[PATCH RESEND v3 1/3] PCI: Add fwnode_handle to pci_sysdata

2016-02-16 Thread jakeo
From: Jake Oshins 

This patch adds an fwnode_handle to struct pci_sysdata, which is
used by the next patch in the series when trying to locate an
IRQ domain associated with a root PCI bus.

Signed-off-by: Jake Oshins 
---
 arch/x86/include/asm/pci.h | 15 +++
 include/linux/pci.h|  4 
 2 files changed, 19 insertions(+)

diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 4625943..6fc3c7c 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -20,6 +20,9 @@ struct pci_sysdata {
 #ifdef CONFIG_X86_64
void*iommu; /* IOMMU private data */
 #endif
+#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
+   void*fwnode;/* IRQ domain for MSI assignment */
+#endif
 };
 
 extern int pci_routeirq;
@@ -32,6 +35,7 @@ extern int noioapicreroute;
 static inline int pci_domain_nr(struct pci_bus *bus)
 {
struct pci_sysdata *sd = bus->sysdata;
+
return sd->domain;
 }
 
@@ -41,6 +45,17 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 }
 #endif
 
+#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
+static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
+{
+   struct pci_sysdata *sd = bus->sysdata;
+
+   return sd->fwnode;
+}
+
+#define pci_root_bus_fwnode_pci_root_bus_fwnode
+#endif
+
 /* Can be used to override the logic in pci_scan_bus for skipping
already-configured bus numbers - to be used for buggy BIOSes
or architectures with incomplete PCI setup by the loader */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 27df4a6..1bb44af 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1515,6 +1515,10 @@ static inline int pci_get_new_domain_nr(void) { return 
-ENOSYS; }
 
 #include 
 
+#ifndef pci_root_bus_fwnode
+#define pci_root_bus_fwnode(bus)   NULL
+#endif
+
 /* these helpers provide future and backwards compatibility
  * for accessing popular PCI BAR info */
 #define pci_resource_start(dev, bar)   ((dev)->resource[(bar)].start)
-- 
1.9.1

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


[PATCH RESEND v3 2/3] PCI: irqdomain: Look up IRQ domain by fwnode_handle

2016-02-16 Thread jakeo
From: Jake Oshins 

This patch adds a second way of finding an IRQ domain associated with
a root PCI bus.  After looking to see if one can be found through
the OF tree, it attempts to look up the IRQ domain through an
fwnode_handle stored in the pci_sysdata struct.

Signed-off-by: Jake Oshins 
---
 drivers/pci/probe.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 6d7ab9b..1e34d21 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "pci.h"
 
@@ -675,6 +676,20 @@ static struct irq_domain 
*pci_host_bridge_msi_domain(struct pci_bus *bus)
if (!d)
d = pci_host_bridge_acpi_msi_domain(bus);
 
+#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
+   /*
+* If no IRQ domain was found via the OF tree, try looking it up
+* directly through the fwnode_handle.
+*/
+   if (!d) {
+   struct fwnode_handle *fwnode = pci_root_bus_fwnode(bus);
+
+   if (fwnode)
+   d = irq_find_matching_fwnode(fwnode,
+DOMAIN_BUS_PCI_MSI);
+   }
+#endif
+
return d;
 }
 
-- 
1.9.1

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


[PATCH RESEND v3 3/3] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs

2016-02-16 Thread jakeo
From: Jake Oshins 

This patch introduces a new driver which exposes a root PCI bus whenever a
PCI Express device is passed through to a guest VM under Hyper-V. The
device can be single- or multi-function. The interrupts for the devices
are managed by an IRQ domain, implemented within the driver.

Signed-off-by: Jake Oshins 
---
 MAINTAINERS   |1 +
 drivers/pci/Kconfig   |7 +
 drivers/pci/host/Makefile |1 +
 drivers/pci/host/pci-hyperv.c | 2359 +
 4 files changed, 2368 insertions(+)
 create mode 100644 drivers/pci/host/pci-hyperv.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 30aca4a..b68c015 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5193,6 +5193,7 @@ F:arch/x86/kernel/cpu/mshyperv.c
 F: drivers/hid/hid-hyperv.c
 F: drivers/hv/
 F: drivers/input/serio/hyperv-keyboard.c
+F: drivers/pci/host/pci-hyperv.c
 F: drivers/net/hyperv/
 F: drivers/scsi/storvsc_drv.c
 F: drivers/video/fbdev/hyperv_fb.c
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 73de4ef..54a5441 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -118,4 +118,11 @@ config PCI_LABEL
def_bool y if (DMI || ACPI)
select NLS
 
+config PCI_HYPERV
+tristate "Hyper-V PCI Frontend"
+depends on PCI && X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && 
X86_64
+help
+  The PCI device frontend driver allows the kernel to import arbitrary
+  PCI devices from a PCI backend to support PCI driver domains.
+
 source "drivers/pci/host/Kconfig"
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
index 7b2f20c..152daf9 100644
--- a/drivers/pci/host/Makefile
+++ b/drivers/pci/host/Makefile
@@ -2,6 +2,7 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o
 obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o
 obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
 obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
+obj-$(CONFIG_PCI_HYPERV) += pci-hyperv.o
 obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
 obj-$(CONFIG_PCI_TEGRA) += pci-tegra.o
 obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
new file mode 100644
index 000..ba1e4c2
--- /dev/null
+++ b/drivers/pci/host/pci-hyperv.c
@@ -0,0 +1,2359 @@
+/*
+ * Copyright (c) Microsoft Corporation.
+ *
+ * Author:
+ *   Jake Oshins 
+ *
+ * This driver acts as a paravirtual front-end for PCI Express root buses.
+ * When a PCI Express function (either an entire device or an SR-IOV
+ * Virtual Function) is being passed through to the VM, this driver exposes
+ * a new bus to the guest VM.  This is modeled as a root PCI bus because
+ * no bridges are being exposed to the VM.  In fact, with a "Generation 2"
+ * VM within Hyper-V, there may seem to be no PCI bus at all in the VM
+ * until a device as been exposed using this driver.
+ *
+ * Each root PCI bus has its own PCI domain, which is called "Segment" in
+ * the PCI Firmware Specifications.  Thus while each device passed through
+ * to the VM using this front-end will appear at "device 0", the domain will
+ * be unique.  Typically, each bus will have one PCI function on it, though
+ * this driver does support more than one.
+ *
+ * In order to map the interrupts from the device through to the guest VM,
+ * this driver also implements an IRQ Domain, which handles interrupts (either
+ * MSI or MSI-X) associated with the functions on the bus.  As interrupts are
+ * set up, torn down, or reaffined, this driver communicates with the
+ * underlying hypervisor to adjust the mappings in the I/O MMU so that each
+ * interrupt will be delivered to the correct virtual processor at the right
+ * vector.  This driver does not support level-triggered (line-based)
+ * interrupts, and will report that the Interrupt Line register in the
+ * function's configuration space is zero.
+ *
+ * The rest of this driver mostly maps PCI concepts onto underlying Hyper-V
+ * facilities.  For instance, the configuration space of a function exposed
+ * by Hyper-V is mapped into a single page of memory space, and the
+ * read and write handlers for config space must be aware of this mechanism.
+ * Similarly, device setup and teardown involves messages sent to and from
+ * the PCI back-end driver in Hyper-V.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT.  See the GNU General Public License for more
+ * details.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Protocol versions. The low word is the minor version, the high wor

Re: [PATCH v3 4/4] Staging: gdm72xx: Remove BUG_ON

2016-02-16 Thread Greg Kroah-Hartman
On Wed, Feb 17, 2016 at 02:00:58AM +0530, Shraddha Barke wrote:
> Delete the BUG_ON check.
> 
> Signed-off-by: Shraddha Barke 
> ---
> Changes in v3-
>  Deleted BUG_ON
> Changes in v2-
>  Nothing
> 
>  drivers/staging/gdm72xx/gdm_wimax.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
> b/drivers/staging/gdm72xx/gdm_wimax.c
> index 859880c..5db0b46 100644
> --- a/drivers/staging/gdm72xx/gdm_wimax.c
> +++ b/drivers/staging/gdm72xx/gdm_wimax.c
> @@ -100,8 +100,6 @@ static struct evt_entry *get_event_entry(void)
>  
>  static void put_event_entry(struct evt_entry *e)
>  {
> - BUG_ON(!e);
> -
>   list_add_tail(&e->list, &wm_event.freeq);

Sorry for the confusion, but I meant that put_event_entry() can be
removed, just replace the one place that calls it with the call to
list_add_tail() instead and then delete it entirely.

thanks,

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


[PATCH v4 1/4] Staging: rtl8188eu/core: remove paragraph which mention FSF address in comment header

2016-02-16 Thread Colin Vidal
As FSF address changed in the past, and can change in the future,
remove the address paragraph in the comment header, and avoid a warning
of checkpatch.

Signed-off-by: Colin Vidal 
---
 drivers/staging/rtl8188eu/core/rtw_iol.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c 
b/drivers/staging/rtl8188eu/core/rtw_iol.c
index cdcf0ea..000a81c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -11,10 +11,6 @@
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  * more details.
  *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
  *
  
**/
 
-- 
2.5.0

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


[PATCH v4 3/4] Staging: rtl8188eu/core: Coding style fix, set constant operand on right in tests

2016-02-16 Thread Colin Vidal
Remove a checkpatch warning, putting constant operant on right of two tests.

Signed-off-by: Colin Vidal 
---
 drivers/staging/rtl8188eu/core/rtw_iol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c 
b/drivers/staging/rtl8188eu/core/rtw_iol.c
index 7642c22..3dd1a9a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -18,10 +18,10 @@
 
 bool rtw_IOL_applied(struct adapter *adapter)
 {
-   if (1 == adapter->registrypriv.fw_iol)
+   if (adapter->registrypriv.fw_iol == 1)
return true;
 
-   if ((2 == adapter->registrypriv.fw_iol) && 
(!adapter_to_dvobj(adapter)->ishighspeed))
+   if ((adapter->registrypriv.fw_iol == 2) && 
(!adapter_to_dvobj(adapter)->ishighspeed))
return true;
return false;
 }
-- 
2.5.0

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


[PATCH v4 4/4] Staging: rtl8188eu/core: Coding style fix, avoid line over 80 characters

2016-02-16 Thread Colin Vidal
Jump a new line after and operator of the test. It avoids to exceed 80
chars line, and remove a checkpatch warning.

Signed-off-by: Colin Vidal 
---
 drivers/staging/rtl8188eu/core/rtw_iol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c 
b/drivers/staging/rtl8188eu/core/rtw_iol.c
index 3dd1a9a..2e2145c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -21,7 +21,8 @@ bool rtw_IOL_applied(struct adapter *adapter)
if (adapter->registrypriv.fw_iol == 1)
return true;
 
-   if ((adapter->registrypriv.fw_iol == 2) && 
(!adapter_to_dvobj(adapter)->ishighspeed))
+   if ((adapter->registrypriv.fw_iol == 2) &&
+   (!adapter_to_dvobj(adapter)->ishighspeed))
return true;
return false;
 }
-- 
2.5.0

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


[PATCH v4 2/4] Staging: rtl8188eu/core: Coding style fix, set conform spaces between identifiers

2016-02-16 Thread Colin Vidal
And a space after include keyword, making the preprocessor more
readable, and remove an unexpected space between a type and variable
name.

Signed-off-by: Colin Vidal 
---
 drivers/staging/rtl8188eu/core/rtw_iol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c 
b/drivers/staging/rtl8188eu/core/rtw_iol.c
index 000a81c..7642c22 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -14,9 +14,9 @@
  *
  
**/
 
-#include
+#include 
 
-bool rtw_IOL_applied(struct adapter  *adapter)
+bool rtw_IOL_applied(struct adapter *adapter)
 {
if (1 == adapter->registrypriv.fw_iol)
return true;
-- 
2.5.0

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


[PATCH 2/7] staging: octeon-usb: add missing braces

2016-02-16 Thread Aaro Koskinen
Some if branches are missing braces as required by coding style.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 91fce2c..2872653 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -1480,9 +1480,9 @@ static void cvmx_usb_start_channel_control(struct 
cvmx_usb_state *usb,
 */
packets_to_transfer = DIV_ROUND_UP(bytes_to_transfer,
   pipe->max_packet);
-   if (packets_to_transfer == 0)
+   if (packets_to_transfer == 0) {
packets_to_transfer = 1;
-   else if ((packets_to_transfer > 1) &&
+   } else if ((packets_to_transfer > 1) &&
(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
/*
 * Limit to one packet when not using DMA. Channels must be
@@ -1634,8 +1634,9 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state 
*usb, int channel,
else
pipe->split_sc_frame =
(usb->frame_number + 2) & 0x7f;
-   } else
+   } else {
pipe->split_sc_frame = -1;
+   }
 
usbc_hcsplt.s.spltena = 1;
usbc_hcsplt.s.hubaddr = pipe->hub_device_addr;
@@ -1723,9 +1724,9 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state 
*usb, int channel,
 */
packets_to_transfer =
DIV_ROUND_UP(bytes_to_transfer, pipe->max_packet);
-   if (packets_to_transfer == 0)
+   if (packets_to_transfer == 0) {
packets_to_transfer = 1;
-   else if ((packets_to_transfer > 1) &&
+   } else if ((packets_to_transfer > 1) &&
(usb->init_flags &
 CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
/*
-- 
2.4.0

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


[PATCH 5/7] staging: octeon-usb: switch to use kernel types

2016-02-16 Thread Aaro Koskinen
Switch to use kernel types:

uint64_t -> u64
uint32_t -> u32
uint16_t -> u16
uint8_t  -> u8
int8_t   -> s8

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c |  75 +++--
 drivers/staging/octeon-usb/octeon-hcd.h | 536 
 2 files changed, 305 insertions(+), 306 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 3165849..7c299e9 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -146,13 +146,13 @@ enum cvmx_usb_complete {
  * status call.
  */
 struct cvmx_usb_port_status {
-   uint32_t reserved   : 25;
-   uint32_t port_enabled   : 1;
-   uint32_t port_over_current  : 1;
-   uint32_t port_powered   : 1;
+   u32 reserved: 25;
+   u32 port_enabled: 1;
+   u32 port_over_current   : 1;
+   u32 port_powered: 1;
enum cvmx_usb_speed port_speed  : 2;
-   uint32_t connected  : 1;
-   uint32_t connect_change : 1;
+   u32 connected   : 1;
+   u32 connect_change  : 1;
 };
 
 /**
@@ -270,9 +270,9 @@ enum cvmx_usb_stage {
 struct cvmx_usb_transaction {
struct list_head node;
enum cvmx_usb_transfer type;
-   uint64_t buffer;
+   u64 buffer;
int buffer_length;
-   uint64_t control_header;
+   u64 control_header;
int iso_start_frame;
int iso_number_packets;
struct cvmx_usb_iso_packet *iso_packets;
@@ -314,28 +314,28 @@ struct cvmx_usb_transaction {
 struct cvmx_usb_pipe {
struct list_head node;
struct list_head transactions;
-   uint64_t interval;
-   uint64_t next_tx_frame;
+   u64 interval;
+   u64 next_tx_frame;
enum cvmx_usb_pipe_flags flags;
enum cvmx_usb_speed device_speed;
enum cvmx_usb_transfer transfer_type;
enum cvmx_usb_direction transfer_dir;
int multi_count;
-   uint16_t max_packet;
-   uint8_t device_addr;
-   uint8_t endpoint_num;
-   uint8_t hub_device_addr;
-   uint8_t hub_port;
-   uint8_t pid_toggle;
-   uint8_t channel;
-   int8_t split_sc_frame;
+   u16 max_packet;
+   u8 device_addr;
+   u8 endpoint_num;
+   u8 hub_device_addr;
+   u8 hub_port;
+   u8 pid_toggle;
+   u8 channel;
+   s8 split_sc_frame;
 };
 
 struct cvmx_usb_tx_fifo {
struct {
int channel;
int size;
-   uint64_t address;
+   u64 address;
} entry[MAX_CHANNELS+1];
int head;
int tail;
@@ -368,7 +368,7 @@ struct cvmx_usb_state {
struct cvmx_usb_port_status port_status;
struct list_head idle_pipes;
struct list_head active_pipes[4];
-   uint64_t frame_number;
+   u64 frame_number;
struct cvmx_usb_transaction *active_split;
struct cvmx_usb_tx_fifo periodic;
struct cvmx_usb_tx_fifo nonperiodic;
@@ -383,8 +383,8 @@ struct octeon_hcd {
 #define CVMX_WAIT_FOR_FIELD32(address, _union, cond, timeout_usec) \
({int result;   \
do {\
-   uint64_t done = cvmx_get_cycle() + (uint64_t)timeout_usec * \
-   octeon_get_clock_rate() / 100;  \
+   u64 done = cvmx_get_cycle() + (u64)timeout_usec *   \
+  octeon_get_clock_rate() / 100;   \
union _union c; \
\
while (1) { \
@@ -548,10 +548,9 @@ static void octeon_unmap_urb_for_dma(struct usb_hcd *hcd, 
struct urb *urb)
  *
  * Returns: Result of the read
  */
-static inline uint32_t cvmx_usb_read_csr32(struct cvmx_usb_state *usb,
-  uint64_t address)
+static inline u32 cvmx_usb_read_csr32(struct cvmx_usb_state *usb, u64 address)
 {
-   uint32_t result = cvmx_read64_uint32(address ^ 4);
+   u32 result = cvmx_read64_uint32(address ^ 4);
return result;
 }
 
@@ -565,7 +564,7 @@ static inline uint32_t cvmx_usb_read_csr32(struct 
cvmx_usb_state *usb,
  * @value:   Value to write
  */
 static inline void cvmx_usb_write_csr32(struct cvmx_usb_state *usb,
-   uint64_t address, uint32_t value)
+   u64 address, u32 value)
 {
cvmx_write64_uint32(address ^ 4, value);
cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
@@ -1160,8 +1159,8 @@ static void cvmx_usb_poll_rx_fifo(struct 

[PATCH 3/7] staging: octeon-usb: delete space after cast

2016-02-16 Thread Aaro Koskinen
Delete space after cast.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 2872653..010b861 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -2005,7 +2005,7 @@ static void octeon_usb_urb_complete_callback(struct 
cvmx_usb_state *usb,
 * field.
 */
struct cvmx_usb_iso_packet *iso_packet =
-   (struct cvmx_usb_iso_packet *) urb->setup_packet;
+   (struct cvmx_usb_iso_packet *)urb->setup_packet;
/* Recalculate the transfer size by adding up each packet */
urb->actual_length = 0;
for (i = 0; i < urb->number_of_packets; i++) {
@@ -2294,7 +2294,7 @@ static struct cvmx_usb_transaction 
*cvmx_usb_submit_isochronous(
 {
struct cvmx_usb_iso_packet *packets;
 
-   packets = (struct cvmx_usb_iso_packet *) urb->setup_packet;
+   packets = (struct cvmx_usb_iso_packet *)urb->setup_packet;
return cvmx_usb_submit_transaction(usb, pipe,
   CVMX_USB_TRANSFER_ISOCHRONOUS,
   urb->transfer_dma,
@@ -3433,7 +3433,7 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, 
u16 typeReq, u16 wValue,
break;
case GetHubStatus:
dev_dbg(dev, "GetHubStatus\n");
-   *(__le32 *) buf = 0;
+   *(__le32 *)buf = 0;
break;
case GetPortStatus:
dev_dbg(dev, "GetPortStatus\n");
@@ -3485,7 +3485,7 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, 
u16 typeReq, u16 wValue,
dev_dbg(dev, " LOWSPEED\n");
}
 
-   *((__le32 *) buf) = cpu_to_le32(port_status);
+   *((__le32 *)buf) = cpu_to_le32(port_status);
break;
case SetHubFeature:
dev_dbg(dev, "SetHubFeature\n");
-- 
2.4.0

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


[PATCH 7/7] staging: octeon-usb: make driver name to match the file name

2016-02-16 Thread Aaro Koskinen
Make driver name to match the file name.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 68e42fe..1ec8906 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -3719,7 +3719,7 @@ MODULE_DEVICE_TABLE(of, octeon_usb_match);
 
 static struct platform_driver octeon_usb_driver = {
.driver = {
-   .name   = "OcteonUSB",
+   .name   = "octeon-hcd",
.of_match_table = octeon_usb_match,
},
.probe  = octeon_usb_probe,
-- 
2.4.0

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


[PATCH 6/7] staging: octeon-usb: add spaces around operator

2016-02-16 Thread Aaro Koskinen
Add spaces around operator to improve readability.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 7c299e9..68e42fe 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -220,13 +220,13 @@ enum cvmx_usb_pipe_flags {
  * The low level hardware can transfer a maximum of this number of bytes in 
each
  * transfer. The field is 19 bits wide
  */
-#define MAX_TRANSFER_BYTES ((1<<19)-1)
+#define MAX_TRANSFER_BYTES ((1 << 19) - 1)
 
 /*
  * The low level hardware can transfer a maximum of this number of packets in
  * each transfer. The field is 10 bits wide
  */
-#define MAX_TRANSFER_PACKETS   ((1<<10)-1)
+#define MAX_TRANSFER_PACKETS   ((1 << 10) - 1)
 
 /**
  * Logical transactions may take numerous low level
@@ -336,7 +336,7 @@ struct cvmx_usb_tx_fifo {
int channel;
int size;
u64 address;
-   } entry[MAX_CHANNELS+1];
+   } entry[MAX_CHANNELS + 1];
int head;
int tail;
 };
@@ -417,7 +417,7 @@ struct octeon_hcd {
 
 /* Returns the IO address to push/pop stuff data from the FIFOs */
 #define USB_FIFO_ADDRESS(channel, usb_index) \
-   (CVMX_USBCX_GOTGCTL(usb_index) + ((channel)+1)*0x1000)
+   (CVMX_USBCX_GOTGCTL(usb_index) + ((channel) + 1) * 0x1000)
 
 /**
  * struct octeon_temp_buffer - a bounce buffer for USB transfers
@@ -1124,9 +1124,9 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct 
cvmx_usb_state *usb,
if (!interval)
interval = 1;
if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-   pipe->interval = interval*8;
+   pipe->interval = interval * 8;
/* Force start splits to be schedule on uFrame 0 */
-   pipe->next_tx_frame = ((usb->frame_number+7)&~7) +
+   pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) +
pipe->interval;
} else {
pipe->interval = interval;
@@ -1334,7 +1334,7 @@ static void cvmx_usb_fill_tx_fifo(struct cvmx_usb_state 
*usb, int channel)
fifo->entry[fifo->head].address =
cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
   channel * 8);
-   fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize+3)>>2;
+   fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize + 3) >> 2;
fifo->head++;
if (fifo->head > MAX_CHANNELS)
fifo->head = 0;
@@ -1515,7 +1515,7 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state 
*usb, int channel,
pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED;
 
/* Mark this channel as in use */
-   usb->idle_hardware_channels &= ~(1index));
-   usbc_haintmsk.s.haintmsk |= 1stage&1) == 0) {
+   if ((transaction->stage & 1) == 0) {
if (transaction->type == CVMX_USB_TRANSFER_BULK)
pipe->split_sc_frame =
(usb->frame_number + 1) & 0x7f;
@@ -1760,7 +1760,7 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state 
*usb, int channel,
 * Set the startframe odd/even properly. This is only used for
 * periodic
 */
-   usbc_hcchar.s.oddfrm = usb->frame_number&1;
+   usbc_hcchar.s.oddfrm = usb->frame_number & 1;
 
/*
 * Set the number of back to back packets allowed by this
@@ -1897,7 +1897,7 @@ static void cvmx_usb_schedule(struct cvmx_usb_state *usb, 
int is_sof)
CVMX_USBCX_HFIR(usb->index))
};
 
-   if (hfnum.s.frrem < hfir.s.frint/4)
+   if (hfnum.s.frrem < hfir.s.frint / 4)
goto done;
}
 
@@ -2490,7 +2490,7 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state 
*usb, int channel)
 
/* Disable the channel interrupts 

[PATCH 1/7] staging: octeon-usb: delete redundant blank lines

2016-02-16 Thread Aaro Koskinen
Delete redundant blank lines.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index eaf6ded..91fce2c 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -569,7 +569,6 @@ static inline uint32_t cvmx_usb_read_csr32(struct 
cvmx_usb_state *usb,
return result;
 }
 
-
 /**
  * Write a USB 32bit CSR. It performs the necessary address
  * swizzle for 32bit CSRs and logs the value in a readable format
@@ -602,7 +601,6 @@ static inline int cvmx_usb_pipe_needs_split(struct 
cvmx_usb_state *usb,
   usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH;
 }
 
-
 /**
  * Trivial utility function to return the correct PID for a pipe
  *
@@ -1002,7 +1000,6 @@ static void cvmx_usb_reset_port(struct cvmx_usb_state 
*usb)
  CVMX_USBCX_HPRT(usb->index));
 }
 
-
 /**
  * Disable a USB port. After this call the USB port will not
  * generate data transfers and will not generate events.
@@ -1021,7 +1018,6 @@ static int cvmx_usb_disable(struct cvmx_usb_state *usb)
return 0;
 }
 
-
 /**
  * Get the current state of the USB port. Use this call to
  * determine if the usb port has anything connected, is enabled,
@@ -1166,7 +1162,6 @@ static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct 
cvmx_usb_state *usb,
return pipe;
 }
 
-
 /**
  * Poll the RX FIFOs and remove data as needed. This function is only used
  * in non DMA mode. It is very important that this function be called quickly
@@ -1213,7 +1208,6 @@ static void cvmx_usb_poll_rx_fifo(struct cvmx_usb_state 
*usb)
CVMX_SYNCW;
 }
 
-
 /**
  * Fill the TX hardware fifo with data out of the software
  * fifos
@@ -1275,7 +1269,6 @@ static int cvmx_usb_fill_tx_hw(struct cvmx_usb_state *usb,
return fifo->head != fifo->tail;
 }
 
-
 /**
  * Check the hardware FIFOs and fill them as needed
  *
@@ -1312,7 +1305,6 @@ static void cvmx_usb_poll_tx_fifo(struct cvmx_usb_state 
*usb)
}
 }
 
-
 /**
  * Fill the TX FIFO with an outgoing packet
  *
@@ -1515,7 +1507,6 @@ static void cvmx_usb_start_channel_control(struct 
cvmx_usb_state *usb,
 usbc_hctsiz.u32);
 }
 
-
 /**
  * Start a channel to perform the pipe's head transaction
  *
@@ -1858,7 +1849,6 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state 
*usb, int channel,
cvmx_usb_fill_tx_fifo(usb, channel);
 }
 
-
 /**
  * Find a pipe that is ready to be scheduled to hardware.
  * @usb:USB device state populated by cvmx_usb_initialize().
@@ -1892,7 +1882,6 @@ static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(
return NULL;
 }
 
-
 /**
  * Called whenever a pipe might need to be scheduled to the
  * hardware.
@@ -2134,7 +2123,6 @@ static void cvmx_usb_perform_complete(struct 
cvmx_usb_state *usb,
kfree(transaction);
 }
 
-
 /**
  * Submit a usb transaction to a pipe. Called for all types
  * of transactions.
@@ -2209,7 +2197,6 @@ static struct cvmx_usb_transaction 
*cvmx_usb_submit_transaction(
return transaction;
 }
 
-
 /**
  * Call to submit a USB Bulk transfer to a pipe.
  *
@@ -2234,7 +2221,6 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
   urb);
 }
 
-
 /**
  * Call to submit a USB Interrupt transfer to a pipe.
  *
@@ -2260,7 +2246,6 @@ static struct cvmx_usb_transaction 
*cvmx_usb_submit_interrupt(
   urb);
 }
 
-
 /**
  * Call to submit a USB Control transfer to a pipe.
  *
@@ -2292,7 +2277,6 @@ static struct cvmx_usb_transaction 
*cvmx_usb_submit_control(
   urb);
 }
 
-
 /**
  * Call to submit a USB Isochronous transfer to a pipe.
  *
@@ -2320,7 +2304,6 @@ static struct cvmx_usb_transaction 
*cvmx_usb_submit_isochronous(
   packets, urb);
 }
 
-
 /**
  * Cancel one outstanding request in a pipe. Canceling a request
  * can fail if the transaction has already completed before cancel
@@ -2370,7 +2353,6 @@ static int cvmx_usb_cancel(struct cvmx_usb_state *usb,
return 0;
 }
 
-
 /**
  * Cancel all outstanding requests in a pipe. Logically all this
  * does is call cvmx_usb_cancel() in a loop.
@@ -2395,7 +2377,6 @@ static int cvmx_usb_cancel_all(struct cvmx_usb_state *usb,
return 0;
 }
 
-
 /**
  * Close a pipe created with cvmx_usb_open_pipe().
  *
@@ -2437,7 +2418,6 @@ static int cvmx_usb_get_frame_number(struct 
cvmx_usb_state *usb)
return frame_number;
 }
 
-
 /**
  * Poll a channel for status
  *
@@ -3616,7 +3596,6 @@ static int octeon_usb_probe(struct platform_device *pdev)
dev_err(dev, "Illegal USBN \"clock-frequency\" %u\n",
clock_rate);
return -ENXIO;
-

[PATCH 4/7] staging: octeon-usb: clean up includes

2016-02-16 Thread Aaro Koskinen
Clean up includes.

Signed-off-by: Aaro Koskinen 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 22 --
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index 010b861..3165849 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -43,29 +43,15 @@
  * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
  * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
  */
-#include 
+
+#include 
+#include 
 #include 
-#include 
-#include 
+#include 
 #include 
-#include 
 #include 
-#include 
-
-#include 
-#include 
-
-#include 
-#include 
-
-#include 
-
-#include 
 
 #include 
-#include 
-#include 
-#include 
 
 #include "octeon-hcd.h"
 
-- 
2.4.0

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


Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs

2016-02-16 Thread Bjorn Helgaas
On Tue, Feb 16, 2016 at 09:46:55PM +, Jake Oshins wrote:
> > -Original Message-
> > From: Bjorn Helgaas [mailto:helg...@kernel.org]
> > Sent: Tuesday, February 16, 2016 8:46 AM
> > To: Jake Oshins 
> > Cc: bhelg...@google.com; linux-...@vger.kernel.org;
> > gre...@linuxfoundation.org; KY Srinivasan ; linux-
> > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> > a...@canonical.com; vkuzn...@redhat.com; t...@linutronix.de; Haiyang
> > Zhang ; marc.zyng...@arm.com; Hadden
> > Hoppert 
> > Subject: Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end
> > for Hyper-V VMs
> > 
> > Hi Jake,
> > 
> > Looks good to me overall; I marked a few nits below.
> > 
> > The only real question I have is about domain number allocation.  See
> > the note below.
> > 
> [snip]
> > > +
> > > + /*
> > > +  * The PCI bus "domain" is what is called "segment" in
> > > +  * ACPI and other specs.  Pull it from the instance ID,
> > > +  * to get something unique.  Bytes 8 and 9 are what is used
> > > +  * in Windows guests, so do the same thing for consistency.
> > > +  */
> > > +
> > > + hbus->sysdata.domain = hdev->dev_instance.b[9] |
> > > +hdev->dev_instance.b[8] << 8;
> > 
> > How do we know this is unique?  We don't have any idea what the
> > platform will put in _SEG, so I think there's a potential conflict
> > here.  The Intel VMD driver (arch/x86/pci/vmd.c) has a similar
> > problem, and it looks for unused domain numbers starting at 0x1
> > (see vmd_find_free_domain()).
> > 
> 
> Bjorn, thank you for your very thorough reviews.  I deeply appreciate it.  I 
> checked the Hyper-V code and it currently does guarantee that these values 
> are unique.  When I resend the series, I'll add a comment to that effect.  
> I'll also add a comment to Hyper-V that says that it has to stay that way.

I'm not familiar with how Hyper-V works, but I guess you're saying
that Hyper-V controls what the guest sees via _SEG as well as what it
sees via the instance ID.

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


RE: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs

2016-02-16 Thread Jake Oshins
> -Original Message-
> From: Bjorn Helgaas [mailto:helg...@kernel.org]
> Sent: Tuesday, February 16, 2016 2:44 PM
> To: Jake Oshins 
> Cc: bhelg...@google.com; linux-...@vger.kernel.org;
> gre...@linuxfoundation.org; KY Srinivasan ; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; vkuzn...@redhat.com; t...@linutronix.de; Haiyang
> Zhang ; marc.zyng...@arm.com; Hadden
> Hoppert 
> Subject: Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end
> for Hyper-V VMs
> 
> On Tue, Feb 16, 2016 at 09:46:55PM +, Jake Oshins wrote:
> > > -Original Message-
> > > From: Bjorn Helgaas [mailto:helg...@kernel.org]
> > > Sent: Tuesday, February 16, 2016 8:46 AM
> > > To: Jake Oshins 
> > > Cc: bhelg...@google.com; linux-...@vger.kernel.org;
> > > gre...@linuxfoundation.org; KY Srinivasan ;
> > > linux- ker...@vger.kernel.org; de...@linuxdriverproject.org;
> > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com;
> > > t...@linutronix.de; Haiyang Zhang ;
> > > marc.zyng...@arm.com; Hadden Hoppert 
> > > Subject: Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI
> > > front-end for Hyper-V VMs
> > >
> > > Hi Jake,
> > >
> > > Looks good to me overall; I marked a few nits below.
> > >
> > > The only real question I have is about domain number allocation.
> > > See the note below.
> > >
> > [snip]
> > > > +
> > > > +   /*
> > > > +* The PCI bus "domain" is what is called "segment" in
> > > > +* ACPI and other specs.  Pull it from the instance ID,
> > > > +* to get something unique.  Bytes 8 and 9 are what is used
> > > > +* in Windows guests, so do the same thing for consistency.
> > > > +*/
> > > > +
> > > > +   hbus->sysdata.domain = hdev->dev_instance.b[9] |
> > > > +  hdev->dev_instance.b[8] << 8;
> > >
> > > How do we know this is unique?  We don't have any idea what the
> > > platform will put in _SEG, so I think there's a potential conflict
> > > here.  The Intel VMD driver (arch/x86/pci/vmd.c) has a similar
> > > problem, and it looks for unused domain numbers starting at 0x1
> > > (see vmd_find_free_domain()).
> > >
> >
> > Bjorn, thank you for your very thorough reviews.  I deeply appreciate it.  I
> checked the Hyper-V code and it currently does guarantee that these values
> are unique.  When I resend the series, I'll add a comment to that effect.  
> I'll
> also add a comment to Hyper-V that says that it has to stay that way.
> 
> I'm not familiar with how Hyper-V works, but I guess you're saying that
> Hyper-V controls what the guest sees via _SEG as well as what it sees via the
> instance ID.
> 
> Bjorn

Yes, exactly.  To the point, the Hyper-V Generation 1 VM (which is an emulation 
of a 440BX/PIIX4 platform) has one root PCI bus with no _SEG object at all, 
which implies a value of zero.  The Hyper-V Generation 2 VM (which doesn't 
emulate any existing machine) doesn't have any root PCI bus at all until a 
device is passed through and this driver is loaded.

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


Re: [PATCH] mm: add MM_SWAPENTS and page table when calculate tasksize in lowmem_scan()

2016-02-16 Thread David Rientjes
On Tue, 16 Feb 2016, Greg Kroah-Hartman wrote:

> On Tue, Feb 16, 2016 at 05:37:05PM +0800, Xishi Qiu wrote:
> > Currently tasksize in lowmem_scan() only calculate rss, and not include 
> > swap.
> > But usually smart phones enable zram, so swap space actually use ram.
> 
> Yes, but does that matter for this type of calculation?  I need an ack
> from the android team before I could ever take such a core change to
> this code...
> 

The calculation proposed in this patch is the same as the generic oom 
killer, it's an estimate of the amount of memory that will be freed if it 
is killed and can exit.  This is better than simply get_mm_rss().

However, I think we seriously need to re-consider the implementation of 
the lowmem killer entirely.  It currently abuses the use of TIF_MEMDIE, 
which should ideally only be set for one thread on the system since it 
allows unbounded access to global memory reserves.

It also abuses the user-visible /proc/self/oom_score_adj tunable: this 
tunable is used by the generic oom killer to bias or discount a proportion 
of memory from a process's usage.  This is the only supported semantic of 
the tunable.  The lowmem killer uses it as a strict prioritization, so any 
process with oom_score_adj higher than another process is preferred for 
kill, REGARDLESS of memory usage.  This leads to priority inversion, the 
user is unable to always define the same process to be killed by the 
generic oom killer and the lowmem killer.  This is what happens when a 
tunable with a very clear and defined purpose is used for other reasons.

I'd seriously consider not accepting any additional hacks on top of this 
code until the implementation is rewritten.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RESEND PATCH] drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONE

2016-02-16 Thread Nicolas Boichat
From: Lisa Du 

There's one point was missed in the patch commit da49889deb34 ("staging:
binder: Support concurrent 32 bit and 64 bit processes."). When configure
BINDER_IPC_32BIT, the size of binder_uintptr_t was 32bits, but size of
void * is 64bit on 64bit system. Correct it here.

Signed-off-by: Lisa Du 
Signed-off-by: Nicolas Boichat 
---

This patch was first sent upstream here: https://lkml.org/lkml/2015/5/28/747,
but was not picked up (probably because it was part of a bigger series that
refactored binder).

This patch fixes issues when using 64-bit binder API on 32-bit kernels.

 drivers/android/binder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 796301a..16288e7 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2081,7 +2081,7 @@ static int binder_thread_write(struct binder_proc *proc,
if (get_user(cookie, (binder_uintptr_t __user *)ptr))
return -EFAULT;
 
-   ptr += sizeof(void *);
+   ptr += sizeof(cookie);
list_for_each_entry(w, &proc->delivered_death, entry) {
struct binder_ref_death *tmp_death = 
container_of(w, struct binder_ref_death, work);
 
-- 
2.7.0.rc3.207.g0ac5344

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


Good Day

2016-02-16 Thread Ms.Ella Golan
I am Ms.Ella Golan, I am the Executive Vice President Banking Division with 
FIRST INTERNATIONAL BANK OF ISRAEL LTD (FIBI). I am getting in touch with you 
regarding an extremely important and urgent matter. If you would oblige me the 
opportunity, I shall provide you with details upon your response.
Faithfully,
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH] staging/android/ion : fix a race condition in the ion driver

2016-02-16 Thread EunTaik Lee
There was a use-after-free problem in the ion driver.

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a unaligned access to the
next free pointer.(thus the kmalloc function returns 
a pointer like c0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee 
---
 drivers/staging/android/ion/ion.c | 102 ++
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e237e9f..cb03b59 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -385,13 +385,22 @@ static void ion_handle_get(struct ion_handle *handle)
kref_get(&handle->ref);
 }
 
+static int ion_handle_put_nolock(struct ion_handle *handle)
+{
+   int ret;
+
+   ret = kref_put(&handle->ref, ion_handle_destroy);
+
+   return ret;
+}
+
 static int ion_handle_put(struct ion_handle *handle)
 {
struct ion_client *client = handle->client;
int ret;
 
mutex_lock(&client->lock);
-   ret = kref_put(&handle->ref, ion_handle_destroy);
+   ret = ion_handle_put_nolock(handle);
mutex_unlock(&client->lock);
 
return ret;
@@ -415,20 +424,30 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
return ERR_PTR(-EINVAL);
 }
 
-static struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
-   int id)
+static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
*client,
+ int id)
 {
struct ion_handle *handle;
 
-   mutex_lock(&client->lock);
handle = idr_find(&client->idr, id);
if (handle)
ion_handle_get(handle);
-   mutex_unlock(&client->lock);
 
return handle ? handle : ERR_PTR(-EINVAL);
 }
 
+struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
+   int id)
+{
+   struct ion_handle *handle;
+
+   mutex_lock(&client->lock);
+   handle = ion_handle_get_by_id_nolock(client, id);
+   mutex_unlock(&client->lock);
+
+   return handle;
+}
+
 static bool ion_handle_validate(struct ion_client *client,
struct ion_handle *handle)
 {
@@ -530,7 +549,8 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
 }
 EXPORT_SYMBOL(ion_alloc);
 
-void ion_free(struct ion_client *client, struct ion_handle *handle)
+static void ion_free_nolock(struct ion_client *client,
+   struct ion_handle *handle)
 {
bool valid_handle;
 
@@ -538,15 +558,24 @@ void ion_free(struct ion_client *client, struct 
ion_handle *handle)
 
mutex_lock(&client->lock);
valid_handle = ion_handle_validate(client, handle);
-
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
mutex_unlock(&client->lock);
return;
}
+   ion_handle_put_nolock(handle);
+}
+
+void ion_free(struct ion_client *client, struct ion_handle *handle)
+{
+   BUG_ON(client != handle->client);
+
+   mutex_lock(&client->lock);
+   ion_free_nolock(client, handle);
mutex_unlock(&client->lock);
ion_handle_put(handle);
 }
+
 EXPORT_SYMBOL(ion_free);
 
 int ion_phys(struct ion_client *client, struct ion_handle *handle,
@@ -830,6 +859,7 @@ void ion_client_destroy(struct ion_client *client)
struct rb_node *n;
 
pr_debug("%s: %d\n", __func__, __LINE__);
+   mutex_lock(&client->lock);
while ((n = rb_first(&client->handles))) {
struct ion_handle *handle = rb_entry(n, struct ion_handle,
 node);
@@ -837,6 +867,7 @@ void ion_client_destroy(struct ion_client *client)
}
 
idr_destroy(&client->idr);
+   mutex_unlock(&client->lock);
 
down_write(&dev->lock);
if (client->task)
@@ -1100,7 +1131,7 @@ static struct dma_buf_ops dma_buf_ops = {
.kunmap = ion_dma_buf_kunmap,
 };
 
-struct dma_buf *ion_share_dma_buf(struct ion_client *client,
+static struct dma_buf *ion_share_dma_buf_nolock(struct ion_client *client,
struct ion_handle *handle)
 {
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
@@ -1108,7 +1139,6 @@ struct dma_buf *ion_share_dma_buf(struct ion_client 
*client,
struct dma_buf *dmabuf;
bool valid_handle;
 
-   mutex_lock(&client->lock

Re: [lustre-devel] [PATCH] staging: lustre: Fixed the parenthesis

2016-02-16 Thread shalin mehta
Hello,

Should I send this patch again due the spelling mistake in the patch
description?

Thanks,
Shalin

On Mon, Feb 15, 2016 at 6:51 PM, Drokin, Oleg  wrote:
>
> On Feb 14, 2016, at 10:37 PM, Shalin Mehta wrote:
>
>> The parentehsis are fixed in the macro for the ldlm lock to set and
>> clear the flags.
>>
>> Signed-off-by: Shalin Mehta 
>> ---
>> drivers/staging/lustre/lustre/include/lustre_dlm_flags.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h 
>> b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h
>> index 0d3ed87..4f9e9ad 100644
>> --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h
>> +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h
>> @@ -365,10 +365,10 @@
>> #define LDLM_TEST_FLAG(_l, _b)(((_l)->l_flags & (_b)) != 0)
>>
>> /** set a ldlm_lock flag bit */
>> -#define LDLM_SET_FLAG(_l, _b) (((_l)->l_flags |= (_b))
>> +#define LDLM_SET_FLAG(_l, _b) ((_l)->l_flags |= (_b))
>>
>> /** clear a ldlm_lock flag bit */
>> -#define LDLM_CLEAR_FLAG(_l, _b)   (((_l)->l_flags &= ~(_b))
>> +#define LDLM_CLEAR_FLAG(_l, _b)   ((_l)->l_flags &= ~(_b))
>>
>> /** Mask of flags inherited from parent lock when doing intents. */
>> #define LDLM_INHERIT_FLAGSLDLM_FL_INHERIT_MASK
>
> Acked-by: Oleg Drokin 
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: xgifb: Fix comment style

2016-02-16 Thread Bo YU
Fix comments to use trailing */ on separate lines.

Signed-off-by: YU BO 
---
  drivers/staging/xgifb/vb_init.c |   10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 26b539b..c7f02c7 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -699,11 +699,11 @@ static void XGINew_CheckChannel(struct
xgi_hw_device_info *HwDeviceExtension,
  break;
  case XG42:
  /*
- XG42 SR14 D[3] Reserve
- D[2] = 1, Dual Channel
- = 0, Single Channel
-
- It's Different from Other XG40 Series.
+ * XG42 SR14 D[3] Reserve
+ * D[2] = 1, Dual Channel
+ * = 0, Single Channel
+ *
+ * It's Different from Other XG40 Series.
  */
  if (XGINew_CheckFrequence(pVBInfo) == 1) { /* DDRII, DDR2x */
  pVBInfo->ram_bus = 32; /* 32 bits */
--
1.7.10.4


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