[Patch] vmbus: Simply hv_get_next_write_location() function

2018-01-23 Thread lantianyu1986
From: Tianyu Lan 

The "next" variable is redundant in hv_get_next_write_location().
This patch is to remove it and return write_index directly.

Signed-off-by: Tianyu Lan 
---
 drivers/hv/ring_buffer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 12eb8ca..71558e7 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -82,9 +82,7 @@ static void hv_signal_on_write(u32 old_write, struct 
vmbus_channel *channel)
 static inline u32
 hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
 {
-   u32 next = ring_info->ring_buffer->write_index;
-
-   return next;
+   return ring_info->ring_buffer->write_index;
 }
 
 /* Set the next write location for the specified ring buffer. */
-- 
2.7.4

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


[PATCH] staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

2018-01-23 Thread Gustavo A. R. Silva
Fix inconsistent IS_ERR and PTR_ERR in vdic_get_ipu_resources.
The proper pointer to be passed as argument is ch.

This issue was detected with the help of Coccinelle.

Fixes: 0b2e9e7947e7 ("media: staging/imx: remove confusing IS_ERR_OR_NULL 
usage")
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/staging/media/imx/imx-media-vdic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-vdic.c 
b/drivers/staging/media/imx/imx-media-vdic.c
index 433474d..ed35684 100644
--- a/drivers/staging/media/imx/imx-media-vdic.c
+++ b/drivers/staging/media/imx/imx-media-vdic.c
@@ -177,7 +177,7 @@ static int vdic_get_ipu_resources(struct vdic_priv *priv)
priv->vdi_in_ch = ch;
 
ch = ipu_idmac_get(priv->ipu, IPUV3_CHANNEL_MEM_VDI_NEXT);
-   if (IS_ERR(priv->vdi_in_ch_n)) {
+   if (IS_ERR(ch)) {
err_chan = IPUV3_CHANNEL_MEM_VDI_NEXT;
ret = PTR_ERR(ch);
goto out_err_chan;
-- 
2.7.4

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


[PATCH v4 4/4] Staging: rtl8723bs: Use !x instead of NULL comparison

2018-01-23 Thread Shreeya Patel
If "x" is compared to NULL, use "!x" instead of it, so as
to follow the kernel coding style.

Signed-off-by: Shreeya Patel 
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index cc51969..ab2ff53 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -215,7 +215,7 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr)
u8 *tmpbuf;
 
tmpbuf = rtw_malloc(8);
-   if (NULL == tmpbuf) {
+   if (!tmpbuf) {
DBG_8192C(KERN_ERR "%s: Allocate memory FAIL!(size =8) 
addr = 0x%x\n", __func__, addr);
return SDIO_ERR_VAL32;
}
@@ -264,7 +264,7 @@ static s32 sdio_readN(struct intf_hdl *intfhdl, u32 addr, 
u32 cnt, u8 *buf)
ftaddr &= ~(u16)0x3;
n = cnt + shift;
tmpbuf = rtw_malloc(n);
-   if (NULL == tmpbuf)
+   if (!tmpbuf)
return -1;
 
err = sd_read(intfhdl, ftaddr, n, tmpbuf);
@@ -367,7 +367,7 @@ static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, 
u32 cnt, u8 *buf)
ftaddr &= ~(u16)0x3;
n = cnt + shift;
tmpbuf = rtw_malloc(n);
-   if (NULL == tmpbuf)
+   if (!tmpbuf)
return -1;
err = sd_read(intfhdl, ftaddr, 4, tmpbuf);
if (err) {
@@ -730,7 +730,7 @@ static s32 ReadInterrupt8723BSdio(struct adapter *adapter, 
u32 *phisr)
u8 val8, hisr_len;
 
 
-   if (phisr == NULL)
+   if (!phisr)
return false;
 
himr = GET_HAL_DATA(adapter)->sdio_himr;
@@ -954,13 +954,13 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter 
*adapter, u32 size)
/* 3 1. alloc recvbuf */
recv_priv = >recvpriv;
recvbuf = rtw_dequeue_recvbuf(_priv->free_recv_buf_queue);
-   if (recvbuf == NULL) {
+   if (!recvbuf) {
DBG_871X_LEVEL(_drv_err_, "%s: alloc recvbuf FAIL!\n", 
__func__);
return NULL;
}
 
/* 3 2. alloc skb */
-   if (recvbuf->pskb == NULL) {
+   if (!recvbuf->pskb) {
SIZE_PTR tmpaddr = 0;
SIZE_PTR alignment = 0;
 
@@ -974,7 +974,7 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter 
*adapter, u32 size)
skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - 
alignment));
}
 
-   if (recvbuf->pskb == NULL) {
+   if (!recvbuf->pskb) {
DBG_871X("%s: alloc_skb fail! read =%d\n", __func__, 
readsize);
return NULL;
}
@@ -1232,7 +1232,7 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size)
 
DBG_871X("+%s: size: %d+\n", __func__, size);
 
-   if (adapter == NULL) {
+   if (!adapter) {
DBG_871X(KERN_ERR "%s: adapter is NULL!\n", __func__);
return false;
}
-- 
2.7.4

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


[PATCH v4 3/4] Staging: rtl8723bs: Remove dead code

2018-01-23 Thread Shreeya Patel
"oldmem==NULL;"
The above bug under the ifdef code would have caused a GCC
warning if it were ever compiled. Hence, remove the dead ifdefed
code from the file.

Signed-off-by: Shreeya Patel 
---

Changes in v3
  -Remove dead code.

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 997ebc0..cc51969 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -453,21 +453,6 @@ static u32 sdio_read_port(
cnt = _RND(cnt, psdio->block_transfer_len);
 /* cnt = sdio_align_size(cnt); */
 
-   if (oldcnt != cnt) {
-#ifdef SDIO_DYNAMIC_ALLOC_MEM
-   oldmem = mem;
-   mem = rtw_malloc(cnt);
-   if (mem == NULL) {
-   DBG_8192C(KERN_WARNING "%s: allocate memory %d bytes 
fail!\n", __func__, cnt);
-   mem = oldmem;
-   oldmem == NULL;
-   }
-#else
-   /*  in this case, caller should gurante the buffer is big 
enough */
-   /*  to receive data after alignment */
-#endif
-   }
-
err = _sd_read(intfhdl, addr, cnt, mem);
 
 #ifdef SDIO_DYNAMIC_ALLOC_MEM
-- 
2.7.4

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


[PATCH v4 2/4] Staging: rtl8723bs: Change names to conform to the kernel code

2018-01-23 Thread Shreeya Patel
Change names of some variables and functions to conform
to the kernel coding style. The changes include some removal
of CamelCase warnings and renaming the variable and field names
that encode their type (eg the pointers seem to start with p).

Signed-off-by: Shreeya Patel 
---

Changes in v3
  -Edit the commit message.

Changes in v4
  -Remove some errors found during build time.

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 714 +++
 1 file changed, 357 insertions(+), 357 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index aa52c31..997ebc0 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -28,35 +28,35 @@
 /*  Creadted by Roger, 2011.01.31. */
 /*  */
 static void HalSdioGetCmdAddr8723BSdio(
-   struct adapter *padapter,
-   u8 DeviceID,
-   u32 Addr,
-   u32 *pCmdAddr
+   struct adapter *adapter,
+   u8 device_id,
+   u32 addr,
+   u32 *cmdaddr
 )
 {
-   switch (DeviceID) {
+   switch (device_id) {
case SDIO_LOCAL_DEVICE_ID:
-   *pCmdAddr = ((SDIO_LOCAL_DEVICE_ID << 13) | (Addr & 
SDIO_LOCAL_MSK));
+   *cmdaddr = ((SDIO_LOCAL_DEVICE_ID << 13) | (addr & 
SDIO_LOCAL_MSK));
break;
 
case WLAN_IOREG_DEVICE_ID:
-   *pCmdAddr = ((WLAN_IOREG_DEVICE_ID << 13) | (Addr & 
WLAN_IOREG_MSK));
+   *cmdaddr = ((WLAN_IOREG_DEVICE_ID << 13) | (addr & 
WLAN_IOREG_MSK));
break;
 
case WLAN_TX_HIQ_DEVICE_ID:
-   *pCmdAddr = ((WLAN_TX_HIQ_DEVICE_ID << 13) | (Addr & 
WLAN_FIFO_MSK));
+   *cmdaddr = ((WLAN_TX_HIQ_DEVICE_ID << 13) | (addr & 
WLAN_FIFO_MSK));
break;
 
case WLAN_TX_MIQ_DEVICE_ID:
-   *pCmdAddr = ((WLAN_TX_MIQ_DEVICE_ID << 13) | (Addr & 
WLAN_FIFO_MSK));
+   *cmdaddr = ((WLAN_TX_MIQ_DEVICE_ID << 13) | (addr & 
WLAN_FIFO_MSK));
break;
 
case WLAN_TX_LOQ_DEVICE_ID:
-   *pCmdAddr = ((WLAN_TX_LOQ_DEVICE_ID << 13) | (Addr & 
WLAN_FIFO_MSK));
+   *cmdaddr = ((WLAN_TX_LOQ_DEVICE_ID << 13) | (addr & 
WLAN_FIFO_MSK));
break;
 
case WLAN_RX0FF_DEVICE_ID:
-   *pCmdAddr = ((WLAN_RX0FF_DEVICE_ID << 13) | (Addr & 
WLAN_RX0FF_MSK));
+   *cmdaddr = ((WLAN_RX0FF_DEVICE_ID << 13) | (addr & 
WLAN_RX0FF_MSK));
break;
 
default:
@@ -66,64 +66,64 @@ static void HalSdioGetCmdAddr8723BSdio(
 
 static u8 get_deviceid(u32 addr)
 {
-   u8 devideId;
-   u16 pseudoId;
+   u8 devide_id;
+   u16 pseudo_id;
 
 
-   pseudoId = (u16)(addr >> 16);
-   switch (pseudoId) {
+   pseudo_id = (u16)(addr >> 16);
+   switch (pseudo_id) {
case 0x1025:
-   devideId = SDIO_LOCAL_DEVICE_ID;
+   devide_id = SDIO_LOCAL_DEVICE_ID;
break;
 
case 0x1026:
-   devideId = WLAN_IOREG_DEVICE_ID;
+   devide_id = WLAN_IOREG_DEVICE_ID;
break;
 
 /* case 0x1027: */
-/* devideId = SDIO_FIRMWARE_FIFO; */
+/* devide_id = SDIO_FIRMWARE_FIFO; */
 /* break; */
 
case 0x1031:
-   devideId = WLAN_TX_HIQ_DEVICE_ID;
+   devide_id = WLAN_TX_HIQ_DEVICE_ID;
break;
 
case 0x1032:
-   devideId = WLAN_TX_MIQ_DEVICE_ID;
+   devide_id = WLAN_TX_MIQ_DEVICE_ID;
break;
 
case 0x1033:
-   devideId = WLAN_TX_LOQ_DEVICE_ID;
+   devide_id = WLAN_TX_LOQ_DEVICE_ID;
break;
 
case 0x1034:
-   devideId = WLAN_RX0FF_DEVICE_ID;
+   devide_id = WLAN_RX0FF_DEVICE_ID;
break;
 
default:
-/* devideId = (u8)((addr >> 13) & 0xF); */
-   devideId = WLAN_IOREG_DEVICE_ID;
+/* devide_id = (u8)((addr >> 13) & 0xF); */
+   devide_id = WLAN_IOREG_DEVICE_ID;
break;
}
 
-   return devideId;
+   return devide_id;
 }
 
 /*
  * Ref:
  *HalSdioGetCmdAddr8723BSdio()
  */
-static u32 _cvrt2ftaddr(const u32 addr, u8 *pdeviceId, u16 *poffset)
+static u32 _cvrt2ftaddr(const u32 addr, u8 *pdevice_id, u16 *poffset)
 {
-   u8 deviceId;
+   u8 device_id;
u16 offset;
u32 ftaddr;
 
 
-   deviceId = get_deviceid(addr);
+   device_id = get_deviceid(addr);
offset = 0;
 
-   switch (deviceId) {
+   switch (device_id) {
case SDIO_LOCAL_DEVICE_ID:
offset = addr & SDIO_LOCAL_MSK;
break;
@@ -140,44 +140,44 @@ static u32 _cvrt2ftaddr(const u32 addr, u8 *pdeviceId, 
u16 *poffset)
 
case WLAN_IOREG_DEVICE_ID:
default:
-   deviceId = 

[PATCH v4 1/4] Staging: rtl8723bs: Replace true with x and false with !x

2018-01-23 Thread Shreeya Patel
Replace true and false keywords with "x" and "!x"
respectively to follow the kernel coding style.

Signed-off-by: Shreeya Patel 
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 93ac083..aa52c31 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -191,8 +191,8 @@ static u32 sdio_read32(struct intf_hdl *pintfhdl, u32 addr)
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, );
if (
((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) ||
-   (false == bMacPwrCtrlOn) ||
-   (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
+   (!bMacPwrCtrlOn) ||
+   (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
) {
err = sd_cmd52_read(pintfhdl, ftaddr, 4, (u8 *)_tmp);
 #ifdef SDIO_DEBUG_IO
@@ -248,8 +248,8 @@ static s32 sdio_readN(struct intf_hdl *pintfhdl, u32 addr, 
u32 cnt, u8 *pbuf)
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, );
if (
((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) ||
-   (false == bMacPwrCtrlOn) ||
-   (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
+   (!bMacPwrCtrlOn) ||
+   (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
)
return sd_cmd52_read(pintfhdl, ftaddr, cnt, pbuf);
 
@@ -352,8 +352,8 @@ static s32 sdio_writeN(struct intf_hdl *pintfhdl, u32 addr, 
u32 cnt, u8 *pbuf)
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, );
if (
((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) ||
-   (false == bMacPwrCtrlOn) ||
-   (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
+   (!bMacPwrCtrlOn) ||
+   (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
)
return sd_cmd52_write(pintfhdl, ftaddr, cnt, pbuf);
 
@@ -513,7 +513,7 @@ static u32 sdio_write_port(
padapter = pintfhdl->padapter;
psdio = _to_dvobj(padapter)->intf_data;
 
-   if (padapter->hw_init_completed == false) {
+   if (!padapter->hw_init_completed) {
DBG_871X("%s [addr = 0x%x cnt =%d] padapter->hw_init_completed 
== false\n", __func__, addr, cnt);
return _FAIL;
}
@@ -577,7 +577,7 @@ static s32 _sdio_local_read(
HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, );
 
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, );
-   if (false == bMacPwrCtrlOn)
+   if (!bMacPwrCtrlOn)
return _sd_cmd52_read(pintfhdl, addr, cnt, pbuf);
 
n = RND4(cnt);
@@ -616,8 +616,8 @@ s32 sdio_local_read(
 
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, );
if (
-   (false == bMacPwrCtrlOn) ||
-   (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
+   (!bMacPwrCtrlOn) ||
+   (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
)
return sd_cmd52_read(pintfhdl, addr, cnt, pbuf);
 
@@ -662,8 +662,8 @@ s32 sdio_local_write(
 
rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, );
if (
-   (false == bMacPwrCtrlOn) ||
-   (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
+   (!bMacPwrCtrlOn) ||
+   (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)
)
return sd_cmd52_write(pintfhdl, addr, cnt, pbuf);
 
@@ -843,8 +843,7 @@ void ClearInterrupt8723BSdio(struct adapter *padapter)
struct hal_com_data *pHalData;
u8 *clear;
 
-
-   if (true == padapter->bSurpriseRemoved)
+   if (padapter->bSurpriseRemoved)
return;
 
pHalData = GET_HAL_DATA(padapter);
@@ -1161,8 +1160,7 @@ void sd_int_hdl(struct adapter *padapter)
 
 
if (
-   (padapter->bDriverStopped == true) ||
-   (padapter->bSurpriseRemoved == true)
+   (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)
)
return;
 
-- 
2.7.4

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


[PATCH v4 0/4] Remove checkpatch warnings

2018-01-23 Thread Shreeya Patel
This patchset removes some warnings generated by checkpatch
for cleanup of the rtl8723bs driver. Also some additional
cleanups are introduced in the *[1/4] and *[3/4] patches
to make the code according to the kernel coding style.

Changes in v2
  -Rebase and resend all patches.

Changes in v3
  -Edit the commit message in patch *[2/4] and remove
   dead code from the patch *[3/4].

Changes in v4
  -Remove some errors from *[2/4] found during build time.

Shreeya Patel (4):
  Staging: rtl8723bs: Replace true with x and false with !x
  Staging: rtl8723bs: Change names to conform to the kernel code
  Staging: rtl8723bs: Remove dead code
  Staging: rtl8723bs: Use !x instead of NULL comparison

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 733 +++
 1 file changed, 358 insertions(+), 375 deletions(-)

-- 
2.7.4

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


Re: [bug report] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.

2018-01-23 Thread NeilBrown
On Tue, Jan 23 2018, Dan Carpenter wrote:

> On Tue, Jan 23, 2018 at 09:25:41AM +, Zhen, Liang wrote:
>> Hi, I just realized the “free_conn” parameter is unused in kernel source, 
>> but it’s actually used in the original patch: 
>> https://review.whamcloud.com/#/c/17892  , so I think it should be fixed in 
>> the kernel.
>> 
>
> Dmitry already sent a patch for this.

Thanks - I hadn't seen that.
Though it seems Greg isn't too happy with the patch yet... unless I
failed to find the update too.

Hopefully it will get sorted soon.

And thanks for finding this bug - it validates the work of converting to
more standard interfaces :-)

Thanks,
NeilBrown


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


[PATCH] android: binder: Use true and false for boolean values

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/android/binder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 745b03a..d21040c 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -249,7 +249,7 @@ static struct binder_transaction_log_entry 
*binder_transaction_log_add(
unsigned int cur = atomic_inc_return(>cur);
 
if (cur >= ARRAY_SIZE(log->entry))
-   log->full = 1;
+   log->full = true;
e = >entry[cur % ARRAY_SIZE(log->entry)];
WRITE_ONCE(e->debug_id_done, 0);
/*
@@ -2638,7 +2638,7 @@ static bool binder_proc_transaction(struct 
binder_transaction *t,
if (node->has_async_transaction) {
pending_async = true;
} else {
-   node->has_async_transaction = 1;
+   node->has_async_transaction = true;
}
}
 
@@ -3483,7 +3483,7 @@ static int binder_thread_write(struct binder_proc *proc,
w = binder_dequeue_work_head_ilocked(
_node->async_todo);
if (!w) {
-   buf_node->has_async_transaction = 0;
+   buf_node->has_async_transaction = false;
} else {
binder_enqueue_work_ilocked(
w, >todo);
-- 
2.7.4

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


Re: [PATCH] staging: media: remove unused VIDEO_ATOMISP_OV8858 kconfig

2018-01-23 Thread Greg Kroah-Hartman
On Tue, Jan 23, 2018 at 07:31:27PM +0200, Andy Shevchenko wrote:
> On Tue, Jan 23, 2018 at 4:37 PM, Corentin Labbe  wrote:
> > Nothing in kernel use VIDEO_ATOMISP_OV8858 since commit 3a81c7660f80 
> > ("media: staging: atomisp: Remove IMX sensor support")
> > Lets remove this kconfig option.
> 
> First of all, I hardly understand how that change is related.
> Second, did you check Makefile?

I don't see it being used in any Makefile, what file do you see it:
$ git grep VIDEO_ATOMISP_OV8858
drivers/staging/media/atomisp/i2c/Kconfig:config VIDEO_ATOMISP_OV8858

So it should be removed.

thanks,

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


Re: [PATCH] staging: media: remove unused VIDEO_ATOMISP_OV8858 kconfig

2018-01-23 Thread Andy Shevchenko
On Tue, Jan 23, 2018 at 4:37 PM, Corentin Labbe  wrote:
> Nothing in kernel use VIDEO_ATOMISP_OV8858 since commit 3a81c7660f80 ("media: 
> staging: atomisp: Remove IMX sensor support")
> Lets remove this kconfig option.

First of all, I hardly understand how that change is related.
Second, did you check Makefile?
Third, the files are in the folder (for OV8858).

Taking all above into account, it seems NACK, though regression might
be made by renaming patch from Sakari (no, it's not).
So, it looks like it was never enabled in the first place.

Anyway, do you have hardware to test? This is *most* important reason
why to accept or decline a change to the driver.

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


Re: [RFC PATCH 0/2] hv_netvsc: Fix shutdown regression on Win2012 hosts

2018-01-23 Thread Stephen Hemminger
On Tue, 23 Jan 2018 10:34:03 +0100
Mohammed Gamal  wrote:

> Commit 0cf737808ae7 ("hv_netvsc: netvsc_teardown_gpadl() split") introduced
> a regression that caused VMs not to shutdown after netvsc_device_remove() is
> called. This is caused by GPADL teardown sequence change, and while that was 
> necessary to fix issues with Win2016 hosts, it did introduce a regression for
> earlier versions.
> 
> Prior to commit 0cf737808 the call sequence in netvsc_device_remove() was as 
> follows (as implemented in netvsc_destroy_buf()):
> 1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
> 2- Teardown receive buffer GPADL
> 3- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
> 4- Teardown send buffer GPADL
> 5- Close vmbus
> 
> This didn't work for WS2016 hosts. Commit 0cf737808 split netvsc_destroy_buf()
> into two functions and rearranged the order as follows
> 1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
> 2- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
> 3- Close vmbus
> 4- Teardown receive buffer GPADL
> 5- Teardown send buffer GPADL
> 
> That worked well for WS2016 hosts, but for WS2012 hosts it prevented VMs from
> shutting down. 
> 
> This patch series works around this problem. The first patch splits
> netvsc_revoke_buf() and netvsc_teardown_gpadl() into two finer grained
> functions for tearing down send and receive buffers individally. The second 
> patch
> uses the finer grained functions to implement the teardown sequence according 
> to
> the host's version. We keep the behavior introduced in 0cf737808ae7 for 
> Windows
> 2016 hosts, while we re-introduce the old sequence for earlier verions.
> 
> Mohammed Gamal (2):
>   hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl()
>   hv_netvsc: Change GPADL teardown order according to Hyper-V version
> 
>  drivers/net/hyperv/netvsc.c | 50 
> +
>  1 file changed, 42 insertions(+), 8 deletions(-)
> 

The problem the original commit was trying to solve was actions in flight
in the receive buffer on shutdown. Having different ordering for each version 
of Hyper-V
seems unnecessary. There should be a way to get a stable sequence here.

Let me see if I can shake more information out of the Windows team to see what
the handshake on the other side is. Let's not apply this until then.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [RFC PATCH 0/2] hv_netvsc: Fix shutdown regression on Win2012 hosts

2018-01-23 Thread Haiyang Zhang


> -Original Message-
> From: Mohammed Gamal [mailto:mga...@redhat.com]
> Sent: Tuesday, January 23, 2018 4:34 AM
> To: net...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; KY
> Srinivasan ; Haiyang Zhang ;
> Stephen Hemminger ; vkuzn...@redhat.com;
> cav...@redhat.com; ot...@redhat.com; Mohammed Gamal
> 
> Subject: [RFC PATCH 0/2] hv_netvsc: Fix shutdown regression on Win2012
> hosts
> 
> Commit 0cf737808ae7 ("hv_netvsc: netvsc_teardown_gpadl() split")
> introduced a regression that caused VMs not to shutdown after
> netvsc_device_remove() is called. This is caused by GPADL teardown
> sequence change, and while that was necessary to fix issues with Win2016
> hosts, it did introduce a regression for earlier versions.
> 
> Prior to commit 0cf737808 the call sequence in netvsc_device_remove() was
> as follows (as implemented in netvsc_destroy_buf()):
> 1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
> 2- Teardown receive buffer GPADL
> 3- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
> 4- Teardown send buffer GPADL
> 5- Close vmbus
> 
> This didn't work for WS2016 hosts. Commit 0cf737808 split
> netvsc_destroy_buf() into two functions and rearranged the order as follows
> 1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
> 2- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
> 3- Close vmbus
> 4- Teardown receive buffer GPADL
> 5- Teardown send buffer GPADL
> 
> That worked well for WS2016 hosts, but for WS2012 hosts it prevented VMs
> from shutting down.
> 
> This patch series works around this problem. The first patch splits
> netvsc_revoke_buf() and netvsc_teardown_gpadl() into two finer grained
> functions for tearing down send and receive buffers individally. The second
> patch uses the finer grained functions to implement the teardown sequence
> according to the host's version. We keep the behavior introduced in
> 0cf737808ae7 for Windows
> 2016 hosts, while we re-introduce the old sequence for earlier verions.
> 
> Mohammed Gamal (2):
>   hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl()
>   hv_netvsc: Change GPADL teardown order according to Hyper-V version
> 
>  drivers/net/hyperv/netvsc.c | 50
> +
>  1 file changed, 42 insertions(+), 8 deletions(-)

Thank you for the patches. We are testing them internally.

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


[PATCH] staging: fbtft: remove unused FB_TFT_SSD1325 kconfig

2018-01-23 Thread Corentin Labbe
Since nothing builds/depends on FB_TFT_SSD1325, we could remove it.

Signed-off-by: Corentin Labbe 
---
 drivers/staging/fbtft/Kconfig | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index dba676761d72..84b2e7ebc024 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -135,12 +135,6 @@ config FB_TFT_SSD1306
help
  Framebuffer support for SSD1306
 
-config FB_TFT_SSD1325
-tristate "FB driver for the SSD1325 OLED Controller"
-depends on FB_TFT
-help
-  Framebuffer support for SSD1305
-
 config FB_TFT_SSD1331
tristate "FB driver for the SSD1331 LCD Controller"
depends on FB_TFT
-- 
2.13.6

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


[PATCH] staging: media: remove unused VIDEO_ATOMISP_OV8858 kconfig

2018-01-23 Thread Corentin Labbe
Nothing in kernel use VIDEO_ATOMISP_OV8858 since commit 3a81c7660f80 ("media: 
staging: atomisp: Remove IMX sensor support")
Lets remove this kconfig option.

Signed-off-by: Corentin Labbe 
---
 drivers/staging/media/atomisp/i2c/Kconfig | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/Kconfig 
b/drivers/staging/media/atomisp/i2c/Kconfig
index db054d3c7ed6..f7f7177b9b37 100644
--- a/drivers/staging/media/atomisp/i2c/Kconfig
+++ b/drivers/staging/media/atomisp/i2c/Kconfig
@@ -28,18 +28,6 @@ config VIDEO_ATOMISP_GC2235
 
 It currently only works with the atomisp driver.
 
-config VIDEO_ATOMISP_OV8858
-   tristate "Omnivision ov8858 sensor support"
-   depends on ACPI
-   depends on I2C && VIDEO_V4L2 && VIDEO_ATOMISP
-   ---help---
-This is a Video4Linux2 sensor-level driver for the Omnivision
-ov8858 RAW sensor.
-
-OV8858 is a 8M raw sensor.
-
-It currently only works with the atomisp driver.
-
 config VIDEO_ATOMISP_MSRLIST_HELPER
tristate "Helper library to load, parse and apply large register lists."
depends on I2C
-- 
2.13.6

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


[PATCH] staging: rtlwifi: remove unused RTLHALMAC_ST and RTLPHYDM_ST

2018-01-23 Thread Corentin Labbe
Since nothing builds/depends on RTLHALMAC_ST and RTLPHYDM_ST, we could
remove them.
Furthermore, they are totally undocumented

Signed-off-by: Corentin Labbe 
---
 drivers/staging/rtlwifi/Kconfig | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/rtlwifi/Kconfig b/drivers/staging/rtlwifi/Kconfig
index 12cf4675b5fd..7b4276f5c41f 100644
--- a/drivers/staging/rtlwifi/Kconfig
+++ b/drivers/staging/rtlwifi/Kconfig
@@ -6,16 +6,6 @@ config R8822BE
This is the staging driver for Realtek RTL8822BE 802.11ac PCIe
wireless network adapters.
 
-config RTLHALMAC_ST
-   tristate
-   depends on R8822BE
-   default m
-
-config RTLPHYDM_ST
-   tristate
-   depends on R8822BE
-   default m
-
 config RTLWIFI_DEBUG_ST
bool
depends on R8822BE
-- 
2.13.6

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


Re: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-23 Thread Vitaly Kuznetsov
"Michael Kelley (EOSG)"  writes:

> Vitaly Kuznetsov  writes:
>> 
>> > "Michael Kelley (EOSG)"  writes:
>> >
>> >> On Fri, 19 Jan 2018, Thomas Gleixner wrote:
>> >>
>> >>>
>> >>> You added '#include ' to mshyperv.h which is included 
>> >>> in
>> >>> vclock_gettime.c and pulls in other stuff which fails to expand
>> >>
>> >> Is the declaration of hyperv_reenlightenment_intr() even needed in
>> >> mshyperv.h?  The '#include ' is there for the 
>> >> __irq_entry
>> >> annotation on that declaration.   There's a declaration of the parallel 
>> >> (and
>> >> unannotated) hyperv_vector_handler(), but that looks like a fossil that
>> >> isn't needed either.
>> >>
>> >
>> > True,
>> >
>> > the only need for the declaration in mshyperv.h is to silence "warning:
>> > no previous prototype for ‘hyperv_reenlightenment_intr’"; I'm not sure
>> > if this actually needs fixing.
>> 
>> It seems we can get away with dropping '__visible' and '__irq_entry'
>> qualifiers from 'hyperv_reenlightenment_intr' declaration in mshyperv.h
>> while keeping them in hv_init.c for the implementation. This way we can
>> avoid the nasty 'no previous prototype' warning and not have to add
>> '#include ' to mshyperv.h breaking vdso.
>
> Where exactly is the 'no previous prototype' warning being generated?

It is generated while compiling the implementation in hv_init.c, every
non-static function needs a previously defined prototype.

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


RE: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-23 Thread Michael Kelley (EOSG)
Vitaly Kuznetsov  writes:
> 
> > "Michael Kelley (EOSG)"  writes:
> >
> >> On Fri, 19 Jan 2018, Thomas Gleixner wrote:
> >>
> >>>
> >>> You added '#include ' to mshyperv.h which is included 
> >>> in
> >>> vclock_gettime.c and pulls in other stuff which fails to expand
> >>
> >> Is the declaration of hyperv_reenlightenment_intr() even needed in
> >> mshyperv.h?  The '#include ' is there for the 
> >> __irq_entry
> >> annotation on that declaration.   There's a declaration of the parallel 
> >> (and
> >> unannotated) hyperv_vector_handler(), but that looks like a fossil that
> >> isn't needed either.
> >>
> >
> > True,
> >
> > the only need for the declaration in mshyperv.h is to silence "warning:
> > no previous prototype for ‘hyperv_reenlightenment_intr’"; I'm not sure
> > if this actually needs fixing.
> 
> It seems we can get away with dropping '__visible' and '__irq_entry'
> qualifiers from 'hyperv_reenlightenment_intr' declaration in mshyperv.h
> while keeping them in hv_init.c for the implementation. This way we can
> avoid the nasty 'no previous prototype' warning and not have to add
> '#include ' to mshyperv.h breaking vdso.

Where exactly is the 'no previous prototype' warning being generated?
I was thinking the only references to hyperv_reenlightenment_intr()
would be in entry_32.S and entry_64.S, but maybe there's another one
I missed.

Michael

> 
> I'm inclined to go ahead with this in v4 if nobody objects.
> 
> --
>   Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-23 Thread Vitaly Kuznetsov
Vitaly Kuznetsov  writes:

> "Michael Kelley (EOSG)"  writes:
>
>> On Fri, 19 Jan 2018, Thomas Gleixner wrote:
>>
>>> 
>>> You added '#include ' to mshyperv.h which is included in
>>> vclock_gettime.c and pulls in other stuff which fails to expand
>>
>> Is the declaration of hyperv_reenlightenment_intr() even needed in
>> mshyperv.h?  The '#include ' is there for the __irq_entry
>> annotation on that declaration.   There's a declaration of the parallel (and
>> unannotated) hyperv_vector_handler(), but that looks like a fossil that
>> isn't needed either.
>>
>
> True,
>
> the only need for the declaration in mshyperv.h is to silence "warning:
> no previous prototype for ‘hyperv_reenlightenment_intr’"; I'm not sure
> if this actually needs fixing.

It seems we can get away with dropping '__visible' and '__irq_entry'
qualifiers from 'hyperv_reenlightenment_intr' declaration in mshyperv.h
while keeping them in hv_init.c for the implementation. This way we can
avoid the nasty 'no previous prototype' warning and not have to add
'#include ' to mshyperv.h breaking vdso.

I'm inclined to go ahead with this in v4 if nobody objects.

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


[PATCH] staging: rtl8188eu: remove redundant initialization of 'pwrcfgcmd'

2018-01-23 Thread Colin King
From: Colin Ian King 

Structure pwrcfgcmd is being zero'd at initialization however this
value is never read as few statements later in a loop it is being
assigned a new value, hence the initialization is redundant and
can be removed.

Cleans up clang warning:
drivers/staging/rtl8188eu/hal/pwrseqcmd.c:25:20: warning: Value stored
to 'pwrcfgcmd' during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/rtl8188eu/hal/pwrseqcmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/pwrseqcmd.c 
b/drivers/staging/rtl8188eu/hal/pwrseqcmd.c
index 2867864bbfbe..e6867eea3530 100644
--- a/drivers/staging/rtl8188eu/hal/pwrseqcmd.c
+++ b/drivers/staging/rtl8188eu/hal/pwrseqcmd.c
@@ -22,7 +22,7 @@
 u8 rtl88eu_pwrseqcmdparsing(struct adapter *padapter, u8 cut_vers,
struct wl_pwr_cfg pwrseqcmd[])
 {
-   struct wl_pwr_cfg pwrcfgcmd = {0};
+   struct wl_pwr_cfg pwrcfgcmd;
u8 poll_bit = false;
u32 aryidx = 0;
u8 value = 0;
-- 
2.15.1

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


Re: [PATCH v3 2/4] Staging: rtl8723bs: Change names to conform to the kernel code

2018-01-23 Thread Greg KH
On Sat, Jan 20, 2018 at 12:10:55AM +0530, Shreeya Patel wrote:
> Change names of some variables and functions to conform
> to the kernel coding style. The changes include some removal
> of CamelCase warnings and renaming the variable and field names
> that encode their type (eg the pointers seem to start with p).
> 
> Signed-off-by: Shreeya Patel 
> ---
> 
> Changes in v3
>   -Edit the commit message.
> 
>  drivers/staging/rtl8723bs/hal/sdio_ops.c | 714 
> +++
>  1 file changed, 357 insertions(+), 357 deletions(-)

Please always test-build your patches so you don't get grumpy emails
from kernel maintainers saying your patch breaks the build :(

This give me the following error when applied:

ERROR: "DisableInterrupt8723BSdio" [drivers/staging/rtl8723bs/r8723bs.ko] 
undefined!
ERROR: "EnableInterrupt8723BSdio" [drivers/staging/rtl8723bs/r8723bs.ko] 
undefined!
ERROR: "InitInterrupt8723BSdio" [drivers/staging/rtl8723bs/r8723bs.ko] 
undefined!
ERROR: "InitSysInterrupt8723BSdio" [drivers/staging/rtl8723bs/r8723bs.ko] 
undefined!

Please fix up and resend.

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


[PATCH] staging: comedi: dt2811: remove redundant initialization of 'ns'

2018-01-23 Thread Colin King
From: Colin Ian King 

Variable ns is being initialized with a value that is never read, ns
is being re-assigned a new value later on. Remove the redundant
initialization.

Cleans up clang warning:
drivers/staging/comedi/drivers/dt2811.c:310:21: warning: Value stored
to 'ns' during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/comedi/drivers/dt2811.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/dt2811.c 
b/drivers/staging/comedi/drivers/dt2811.c
index fea0a1baf10b..05207a519755 100644
--- a/drivers/staging/comedi/drivers/dt2811.c
+++ b/drivers/staging/comedi/drivers/dt2811.c
@@ -307,7 +307,7 @@ static int dt2811_ai_cmd(struct comedi_device *dev,
 static unsigned int dt2811_ns_to_timer(unsigned int *nanosec,
   unsigned int flags)
 {
-   unsigned long long ns = *nanosec;
+   unsigned long long ns;
unsigned int ns_lo = COMEDI_MIN_SPEED;
unsigned int ns_hi = 0;
unsigned int divisor_hi = 0;
-- 
2.15.1

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


[RFC PATCH 0/2] hv_netvsc: Fix shutdown regression on Win2012 hosts

2018-01-23 Thread Mohammed Gamal
Commit 0cf737808ae7 ("hv_netvsc: netvsc_teardown_gpadl() split") introduced
a regression that caused VMs not to shutdown after netvsc_device_remove() is
called. This is caused by GPADL teardown sequence change, and while that was 
necessary to fix issues with Win2016 hosts, it did introduce a regression for
earlier versions.

Prior to commit 0cf737808 the call sequence in netvsc_device_remove() was as 
follows (as implemented in netvsc_destroy_buf()):
1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
2- Teardown receive buffer GPADL
3- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
4- Teardown send buffer GPADL
5- Close vmbus

This didn't work for WS2016 hosts. Commit 0cf737808 split netvsc_destroy_buf()
into two functions and rearranged the order as follows
1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
2- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
3- Close vmbus
4- Teardown receive buffer GPADL
5- Teardown send buffer GPADL

That worked well for WS2016 hosts, but for WS2012 hosts it prevented VMs from
shutting down. 

This patch series works around this problem. The first patch splits
netvsc_revoke_buf() and netvsc_teardown_gpadl() into two finer grained
functions for tearing down send and receive buffers individally. The second 
patch
uses the finer grained functions to implement the teardown sequence according to
the host's version. We keep the behavior introduced in 0cf737808ae7 for Windows
2016 hosts, while we re-introduce the old sequence for earlier verions.

Mohammed Gamal (2):
  hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl()
  hv_netvsc: Change GPADL teardown order according to Hyper-V version

 drivers/net/hyperv/netvsc.c | 50 +
 1 file changed, 42 insertions(+), 8 deletions(-)

-- 
1.8.3.1

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


[RFC PATCH 2/2] hv_netvsc: Change GPADL teardown order according to Hyper-V version

2018-01-23 Thread Mohammed Gamal
Commit 0cf737808ae7 ("hv_netvsc: netvsc_teardown_gpadl() split")
introduced a regression causing VMs not to shutdown on pre-Wind2016
hosts after netvsc_remove_device() is called. This was caused as the
GPADL teardown sequence was changed.

This patch restores the old behavior for pre-Win2016 hosts, while
keeping the changes from 0cf7378 for Win2016 and higher hosts.

Signed-off-by: Mohammed Gamal 
---
 drivers/net/hyperv/netvsc.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 3982f76..d09bb3b 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -575,8 +575,17 @@ void netvsc_device_remove(struct hv_device *device)
 
cancel_work_sync(_device->subchan_work);
 
+   /*
+* Revoke receive buffer. If host is pre-Win2016 then tear down
+* receive buffer GPADL. Do the same for send buffer.
+*/
netvsc_revoke_recv_buf(device, net_device);
+   if (vmbus_proto_version < VERSION_WIN10)
+   netvsc_teardown_recv_buf_gpadl(device, net_device);
+
netvsc_revoke_send_buf(device, net_device);
+   if (vmbus_proto_version < VERSION_WIN10)
+   netvsc_teardown_send_buf_gpadl(device, net_device);
 
RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
 
@@ -589,8 +598,14 @@ void netvsc_device_remove(struct hv_device *device)
/* Now, we can close the channel safely */
vmbus_close(device->channel);
 
-   netvsc_teardown_recv_buf_gpadl(device, net_device);
-   netvsc_teardown_send_buf_gpadl(device, net_device);
+   /*
+* If host is Win2016 or higher then we do the GPADL tear down
+* here after VMBus is closed, instead of doing it earlier.
+*/
+   if (vmbus_proto_version >= VERSION_WIN10) {
+   netvsc_teardown_recv_buf_gpadl(device, net_device);
+   netvsc_teardown_send_buf_gpadl(device, net_device);
+   }
 
/* And dissassociate NAPI context from device */
for (i = 0; i < net_device->num_chn; i++)
-- 
1.8.3.1

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


[RFC PATCH 1/2] hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl()

2018-01-23 Thread Mohammed Gamal
Split each of the functions into two for each of send/recv buffers

Signed-off-by: Mohammed Gamal 
---
 drivers/net/hyperv/netvsc.c | 35 +++
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index bfc7969..3982f76 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -100,8 +100,8 @@ static void free_netvsc_device_rcu(struct netvsc_device 
*nvdev)
call_rcu(>rcu, free_netvsc_device);
 }
 
-static void netvsc_revoke_buf(struct hv_device *device,
- struct netvsc_device *net_device)
+static void netvsc_revoke_recv_buf(struct hv_device *device,
+  struct netvsc_device *net_device)
 {
struct nvsp_message *revoke_packet;
struct net_device *ndev = hv_get_drvdata(device);
@@ -146,6 +146,14 @@ static void netvsc_revoke_buf(struct hv_device *device,
}
net_device->recv_section_cnt = 0;
}
+}
+
+static void netvsc_revoke_send_buf(struct hv_device *device,
+  struct netvsc_device *net_device)
+{
+   struct nvsp_message *revoke_packet;
+   struct net_device *ndev = hv_get_drvdata(device);
+   int ret;
 
/* Deal with the send buffer we may have setup.
 * If we got a  send section size, it means we received a
@@ -189,8 +197,8 @@ static void netvsc_revoke_buf(struct hv_device *device,
}
 }
 
-static void netvsc_teardown_gpadl(struct hv_device *device,
- struct netvsc_device *net_device)
+static void netvsc_teardown_recv_buf_gpadl(struct hv_device *device,
+  struct netvsc_device *net_device)
 {
struct net_device *ndev = hv_get_drvdata(device);
int ret;
@@ -215,6 +223,13 @@ static void netvsc_teardown_gpadl(struct hv_device *device,
vfree(net_device->recv_buf);
net_device->recv_buf = NULL;
}
+}
+
+static void netvsc_teardown_send_buf_gpadl(struct hv_device *device,
+  struct netvsc_device *net_device)
+{
+   struct net_device *ndev = hv_get_drvdata(device);
+   int ret;
 
if (net_device->send_buf_gpadl_handle) {
ret = vmbus_teardown_gpadl(device->channel,
@@ -425,8 +440,10 @@ static int netvsc_init_buf(struct hv_device *device,
goto exit;
 
 cleanup:
-   netvsc_revoke_buf(device, net_device);
-   netvsc_teardown_gpadl(device, net_device);
+   netvsc_revoke_recv_buf(device, net_device);
+   netvsc_revoke_send_buf(device, net_device);
+   netvsc_teardown_recv_buf_gpadl(device, net_device);
+   netvsc_teardown_send_buf_gpadl(device, net_device);
 
 exit:
return ret;
@@ -558,7 +575,8 @@ void netvsc_device_remove(struct hv_device *device)
 
cancel_work_sync(_device->subchan_work);
 
-   netvsc_revoke_buf(device, net_device);
+   netvsc_revoke_recv_buf(device, net_device);
+   netvsc_revoke_send_buf(device, net_device);
 
RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
 
@@ -571,7 +589,8 @@ void netvsc_device_remove(struct hv_device *device)
/* Now, we can close the channel safely */
vmbus_close(device->channel);
 
-   netvsc_teardown_gpadl(device, net_device);
+   netvsc_teardown_recv_buf_gpadl(device, net_device);
+   netvsc_teardown_send_buf_gpadl(device, net_device);
 
/* And dissassociate NAPI context from device */
for (i = 0; i < net_device->num_chn; i++)
-- 
1.8.3.1

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


Re: [bug report] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.

2018-01-23 Thread Dan Carpenter
On Tue, Jan 23, 2018 at 09:25:41AM +, Zhen, Liang wrote:
> Hi, I just realized the “free_conn” parameter is unused in kernel source, but 
> it’s actually used in the original patch: 
> https://review.whamcloud.com/#/c/17892  , so I think it should be fixed in 
> the kernel.
> 

Dmitry already sent a patch for this.

regards,
dan carpenter

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


Re: [bug report] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.

2018-01-23 Thread Zhen, Liang
Hi, I just realized the “free_conn” parameter is unused in kernel source, but 
it’s actually used in the original patch: 
https://review.whamcloud.com/#/c/17892  , so I think it should be fixed in the 
kernel.

Regards
Liang

On 23/01/2018, 4:02 PM, "Zhen, Liang"  wrote:

Hi there, probably the function name is misleading, but 

L3317: kiblnd_destroy_conn(conn, !peer);

This function will NOT free the connection if peer is NULL, and…

L3320:if (!peer)
L3321  continue;

It means the connection is not freed in L3322 and later.

Regards
Liang

On 23/01/2018, 2:55 PM, "NeilBrown"  wrote:

On Mon, Jan 15 2018, Dan Carpenter wrote:

> [  This code was already buggy, it's just that Neil's change made it
>show up in static analysis.  - dan ]

Thanks!

This bug was introduced by

 Commit: 4d99b2581eff ("staging: lustre: avoid intensive reconnecting 
for ko2iblnd")

which added a "free_conn" arg to kiblnd_destroy_conn(), but never used
the arg.  Presumably it is meant to say "Don't free something", but
exactly what should be free and what shouldn't isn't immediately clear.

Liang:  do you remember what you intended for that arg to do?

Thanks,
NeilBrown

>
> Hello NeilBrown,
>
> The patch 3c88bdbbf919: "staging: lustre: replace simple cases of
> LIBCFS_ALLOC with kzalloc." from Jan 9, 2018, leads to the following
> static checker warning:
>
>   drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:3323 
kiblnd_connd()
>   error: dereferencing freed memory 'conn'
>
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>   3303  if 
(!list_empty(_data.kib_connd_zombies)) {
>   3304  struct kib_peer *peer = NULL;
>   3305  
>   3306  conn = 
list_entry(kiblnd_data.kib_connd_zombies.next,
>   3307struct kib_conn, 
ibc_list);
>   3308  list_del(>ibc_list);
>   3309  if (conn->ibc_reconnect) {
>   3310  peer = conn->ibc_peer;
>   3311  kiblnd_peer_addref(peer);
>   3312  }
>   3313  
>   3314  spin_unlock_irqrestore(lock, flags);
>   3315  dropped_lock = 1;
>   3316  
>   3317  kiblnd_destroy_conn(conn, !peer);
> 
> Freed
>
>   3318  
>   3319  spin_lock_irqsave(lock, flags);
>   3320  if (!peer)
>   3321  continue;
>   3322  
>   3323  conn->ibc_peer = peer;
> ^^
> Use after free
>
>   3324  if (peer->ibp_reconnected < 
KIB_RECONN_HIGH_RACE)
>   3325  list_add_tail(>ibc_list,
>^^
>
>   3326
_data.kib_reconn_list);
>   3327  else
>   3328  list_add_tail(>ibc_list,
>^^
>
>   3329
_data.kib_reconn_wait);
>   3330  }
>
> regards,
> dan carpenter




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


Re: [bug report] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.

2018-01-23 Thread Zhen, Liang
Hi there, probably the function name is misleading, but 

L3317: kiblnd_destroy_conn(conn, !peer);

This function will NOT free the connection if peer is NULL, and…

L3320:if (!peer)
L3321  continue;

It means the connection is not freed in L3322 and later.

Regards
Liang

On 23/01/2018, 2:55 PM, "NeilBrown"  wrote:

On Mon, Jan 15 2018, Dan Carpenter wrote:

> [  This code was already buggy, it's just that Neil's change made it
>show up in static analysis.  - dan ]

Thanks!

This bug was introduced by

 Commit: 4d99b2581eff ("staging: lustre: avoid intensive reconnecting for 
ko2iblnd")

which added a "free_conn" arg to kiblnd_destroy_conn(), but never used
the arg.  Presumably it is meant to say "Don't free something", but
exactly what should be free and what shouldn't isn't immediately clear.

Liang:  do you remember what you intended for that arg to do?

Thanks,
NeilBrown

>
> Hello NeilBrown,
>
> The patch 3c88bdbbf919: "staging: lustre: replace simple cases of
> LIBCFS_ALLOC with kzalloc." from Jan 9, 2018, leads to the following
> static checker warning:
>
>   drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:3323 
kiblnd_connd()
>   error: dereferencing freed memory 'conn'
>
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>   3303  if (!list_empty(_data.kib_connd_zombies)) {
>   3304  struct kib_peer *peer = NULL;
>   3305  
>   3306  conn = 
list_entry(kiblnd_data.kib_connd_zombies.next,
>   3307struct kib_conn, 
ibc_list);
>   3308  list_del(>ibc_list);
>   3309  if (conn->ibc_reconnect) {
>   3310  peer = conn->ibc_peer;
>   3311  kiblnd_peer_addref(peer);
>   3312  }
>   3313  
>   3314  spin_unlock_irqrestore(lock, flags);
>   3315  dropped_lock = 1;
>   3316  
>   3317  kiblnd_destroy_conn(conn, !peer);
> 
> Freed
>
>   3318  
>   3319  spin_lock_irqsave(lock, flags);
>   3320  if (!peer)
>   3321  continue;
>   3322  
>   3323  conn->ibc_peer = peer;
> ^^
> Use after free
>
>   3324  if (peer->ibp_reconnected < 
KIB_RECONN_HIGH_RACE)
>   3325  list_add_tail(>ibc_list,
>^^
>
>   3326
_data.kib_reconn_list);
>   3327  else
>   3328  list_add_tail(>ibc_list,
>^^
>
>   3329
_data.kib_reconn_wait);
>   3330  }
>
> regards,
> dan carpenter


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