[PATCH] staging: kpc2000: Fix build failure caused by wrong include file

2019-05-30 Thread Guenter Roeck
xtensa:allmodconfig fails to build.

arch/xtensa/include/asm/uaccess.h: In function 'clear_user':
arch/xtensa/include/asm/uaccess.h:40:22: error:
implicit declaration of function 'uaccess_kernel'

uaccess_kernel() is declared in linux/uaccess.h, not asm/uaccess.h.

Fixes: 7df95299b94a ("staging: kpc2000: Add DMA driver")
Cc: Matt Sickler 
Signed-off-by: Guenter Roeck 
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index 5741d2b49a7d..e741fa753ca1 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -8,7 +8,7 @@
 #include /* error codes */
 #include /* size_t */
 #include 
-#include /* copy_*_user */
+#include /* copy_*_user */
 #include   /* aio stuff */
 #include 
 #include 
-- 
2.7.4

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


In A Nutshell

2019-05-30 Thread Emissary
Hello, 

We have a private business proposition for you,contact me for more details. 

Thank you, 

Datuk.
5.30.19/135p/28wwe.5
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723bs: core: fix warning Comparison to NULL

2019-05-30 Thread Hariprasad Kelam
this patch fixes "Comparison to NULL" warnings reported by
checkpatch

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/core/rtw_xmit.c | 54 +++
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 25409ab..53146ec 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -76,7 +76,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->pallocated_frame_buf = vzalloc(NR_XMITFRAME * sizeof(struct 
xmit_frame) + 4);
 
-   if (pxmitpriv->pallocated_frame_buf  == NULL) {
+   if (!pxmitpriv->pallocated_frame_buf) {
pxmitpriv->pxmit_frame_buf = NULL;
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_frame 
fail!\n"));
res = _FAIL;
@@ -115,7 +115,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->pallocated_xmitbuf = vzalloc(NR_XMITBUFF * sizeof(struct 
xmit_buf) + 4);
 
-   if (pxmitpriv->pallocated_xmitbuf  == NULL) {
+   if (!pxmitpriv->pallocated_xmitbuf) {
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xmit_buf 
fail!\n"));
res = _FAIL;
goto exit;
@@ -166,7 +166,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->xframe_ext_alloc_addr = vzalloc(NR_XMIT_EXTBUFF * 
sizeof(struct xmit_frame) + 4);
 
-   if (pxmitpriv->xframe_ext_alloc_addr  == NULL) {
+   if (!pxmitpriv->xframe_ext_alloc_addr) {
pxmitpriv->xframe_ext = NULL;
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc xframe_ext 
fail!\n"));
res = _FAIL;
@@ -199,7 +199,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->pallocated_xmit_extbuf = vzalloc(NR_XMIT_EXTBUFF * 
sizeof(struct xmit_buf) + 4);
 
-   if (pxmitpriv->pallocated_xmit_extbuf  == NULL) {
+   if (!pxmitpriv->pallocated_xmit_extbuf) {
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("alloc 
xmit_extbuf fail!\n"));
res = _FAIL;
goto exit;
@@ -288,7 +288,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
 
rtw_hal_free_xmit_priv(padapter);
 
-   if (pxmitpriv->pxmit_frame_buf == NULL)
+   if (!pxmitpriv->pxmit_frame_buf)
return;
 
for (i = 0; i < NR_XMITFRAME; i++) {
@@ -335,7 +335,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
 
for (i = 0; i < CMDBUF_MAX; i++) {
pxmitbuf = &pxmitpriv->pcmd_xmitbuf[i];
-   if (pxmitbuf != NULL)
+   if (pxmitbuf)
rtw_os_xmit_resource_free(padapter, pxmitbuf, 
MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, true);
}
 
@@ -774,7 +774,7 @@ static s32 update_attrib(struct adapter *padapter, _pkt 
*pkt, struct pkt_attrib
psta = rtw_get_bcmc_stainfo(padapter);
} else {
psta = rtw_get_stainfo(pstapriv, pattrib->ra);
-   if (psta == NULL)   { /*  if we cannot get psta => drop the 
pkt */
+   if (!psta)  { /*  if we cannot get psta => drop the pkt */

DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_ucast_sta);
RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, 
("\nupdate_attrib => get sta_info fail, ra:" MAC_FMT"\n", 
MAC_ARG(pattrib->ra)));
#ifdef DBG_TX_DROP_FRAME
@@ -789,7 +789,7 @@ static s32 update_attrib(struct adapter *padapter, _pkt 
*pkt, struct pkt_attrib
}
}
 
-   if (psta == NULL) {
+   if (!psta) {
/*  if we cannot get psta => drop the pkt */
DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_err_sta);
RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_, 
("\nupdate_attrib => get sta_info fail, ra:" MAC_FMT "\n", 
MAC_ARG(pattrib->ra)));
@@ -1098,7 +1098,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, 
struct pkt_attrib *pattr
return _FAIL;
}
 
-   if (psta == NULL) {
+   if (!psta) {
DBG_871X("%s, psta ==NUL\n", __func__);
return _FAIL;
}
@@ -1241,7 +1241,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, _pkt 
*pkt, struct xmit_fram
return _FAIL;
}
 */
-   if (pxmitframe->buf_addr == NULL) {
+   if (!pxmitframe->buf_addr) {
DBG_8192C("==> %s buf_addr == NULL\n", __func__);
return _FAIL;
}
@@ -1376,7 +1376,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, 
_pkt *pkt, struct xmit
tmp_buf = BIP

[PATCH] staging: media: tegra-vde: Remove variable

2019-05-30 Thread Nishka Dasgupta
Remove unnecessary variable iram_tables and use its value directly.
Issue found using Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/media/tegra-vde/tegra-vde.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c 
b/drivers/staging/media/tegra-vde/tegra-vde.c
index a5020dbf6eef..3205973218e4 100644
--- a/drivers/staging/media/tegra-vde/tegra-vde.c
+++ b/drivers/staging/media/tegra-vde/tegra-vde.c
@@ -273,12 +273,10 @@ static void tegra_vde_setup_iram_entry(struct tegra_vde 
*vde,
   unsigned int row,
   u32 value1, u32 value2)
 {
-   u32 *iram_tables = vde->iram;
-
trace_vde_setup_iram_entry(table, row, value1, value2);
 
-   iram_tables[0x20 * table + row * 2] = value1;
-   iram_tables[0x20 * table + row * 2 + 1] = value2;
+   vde->iram[0x20 * table + row * 2] = value1;
+   vde->iram[0x20 * table + row * 2 + 1] = value2;
 }
 
 static void tegra_vde_setup_iram_tables(struct tegra_vde *vde,
-- 
2.19.1

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


Re: [PATCH] staging: media: tegra-vde: Remove variable

2019-05-30 Thread Greg KH
On Fri, May 31, 2019 at 02:14:39AM +0530, Nishka Dasgupta wrote:
> Remove unnecessary variable iram_tables and use its value directly.
> Issue found using Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta 
> ---
>  drivers/staging/media/tegra-vde/tegra-vde.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c 
> b/drivers/staging/media/tegra-vde/tegra-vde.c
> index a5020dbf6eef..3205973218e4 100644
> --- a/drivers/staging/media/tegra-vde/tegra-vde.c
> +++ b/drivers/staging/media/tegra-vde/tegra-vde.c
> @@ -273,12 +273,10 @@ static void tegra_vde_setup_iram_entry(struct tegra_vde 
> *vde,
>  unsigned int row,
>  u32 value1, u32 value2)
>  {
> - u32 *iram_tables = vde->iram;
> -
>   trace_vde_setup_iram_entry(table, row, value1, value2);
>  
> - iram_tables[0x20 * table + row * 2] = value1;
> - iram_tables[0x20 * table + row * 2 + 1] = value2;
> + vde->iram[0x20 * table + row * 2] = value1;
> + vde->iram[0x20 * table + row * 2 + 1] = value2;

Ick, no, why?  why why why?

You keep sending these patches, please take a bit of time to think about
what you are doing and see if the change actually makes sense.

Again, here, no, it does not.

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


[PATCH] staging: media: davinci_vpfe: Remove variable vpfe_dev

2019-05-30 Thread Nishka Dasgupta
Remove variable vpfe_dev and replace it with its value (since the
function otherwise uses values directly instead of local variables).
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 510202a3b091..8927b744b13e 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -448,7 +448,6 @@ vpfe_video_get_next_buffer(struct vpfe_video_device *video)
 /* schedule the next buffer which is available on dma queue */
 void vpfe_video_schedule_next_buffer(struct vpfe_video_device *video)
 {
-   struct vpfe_device *vpfe_dev = video->vpfe_dev;
unsigned long addr;
 
if (list_empty(&video->dma_queue))
@@ -463,19 +462,18 @@ void vpfe_video_schedule_next_buffer(struct 
vpfe_video_device *video)
list_del(&video->next_frm->list);
video->next_frm->vb.vb2_buf.state = VB2_BUF_STATE_ACTIVE;
addr = vb2_dma_contig_plane_dma_addr(&video->next_frm->vb.vb2_buf, 0);
-   video->ops->queue(vpfe_dev, addr);
+   video->ops->queue(video->vpfe_dev, addr);
video->state = VPFE_VIDEO_BUFFER_QUEUED;
 }
 
 /* schedule the buffer for capturing bottom field */
 void vpfe_video_schedule_bottom_field(struct vpfe_video_device *video)
 {
-   struct vpfe_device *vpfe_dev = video->vpfe_dev;
unsigned long addr;
 
addr = vb2_dma_contig_plane_dma_addr(&video->cur_frm->vb.vb2_buf, 0);
addr += video->field_off;
-   video->ops->queue(vpfe_dev, addr);
+   video->ops->queue(video->vpfe_dev, addr);
 }
 
 /* make buffer available for dequeue */
-- 
2.19.1

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


[PATCH] staging: comedi: Remove variable runflags

2019-05-30 Thread Nishka Dasgupta
Remove variable runflags and use its value directly. Issue found with
checkpatch.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/comedi/comedi_fops.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index f6d1287c7b83..b84ee9293903 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -676,16 +676,12 @@ EXPORT_SYMBOL_GPL(comedi_is_subdevice_running);
 
 static bool __comedi_is_subdevice_running(struct comedi_subdevice *s)
 {
-   unsigned int runflags = __comedi_get_subdevice_runflags(s);
-
-   return comedi_is_runflags_running(runflags);
+   return comedi_is_runflags_running(__comedi_get_subdevice_runflags(s));
 }
 
 bool comedi_can_auto_free_spriv(struct comedi_subdevice *s)
 {
-   unsigned int runflags = __comedi_get_subdevice_runflags(s);
-
-   return runflags & COMEDI_SRF_FREE_SPRIV;
+   return __comedi_get_subdevice_runflags(s) & COMEDI_SRF_FREE_SPRIV;
 }
 
 /**
-- 
2.19.1

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


Re: [PATCH] staging: media: davinci_vpfe: Remove variable vpfe_dev

2019-05-30 Thread Greg KH
On Fri, May 31, 2019 at 02:17:18AM +0530, Nishka Dasgupta wrote:
> Remove variable vpfe_dev and replace it with its value (since the
> function otherwise uses values directly instead of local variables).

This says _what_ you do.  But we can see that in the patch itself.

You need to say _why_ you are doing this.

There's no need for this change at all.  Again, as I have said before,
we write code for developers to read first, the compiler second.  By
making these types of changes you are making it harder to
read/understand by a developer, and providing absolutely no benifit to
the compiler at all.

So it's actually making the code worse!

not good at all.

Please reconsider this type of change, as I keep asking you to.

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


[PATCH] staging: rtl8712: Replace function r8712_init_mlme_priv

2019-05-30 Thread Nishka Dasgupta
Delete r8712_init_mlme_priv as it does nothing except call
_init_mlme_priv, and rename _init_mlme_priv to
r8712_init_mlme_priv.
Change the type of the new r8712_init_mlme_priv (formerly _init_mlme_priv)
to (non-static) int, from static sint.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 7c7267d0fc9e..57d8e7dceef7 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -29,7 +29,7 @@
 
 static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len);
 
-static sint _init_mlme_priv(struct _adapter *padapter)
+int r8712_init_mlme_priv(struct _adapter *padapter)
 {
sinti;
u8  *pbuf;
@@ -205,11 +205,6 @@ u8 *r8712_get_capability_from_ie(u8 *ie)
return ie + 8 + 2;
 }
 
-int r8712_init_mlme_priv(struct _adapter *padapter)
-{
-   return _init_mlme_priv(padapter);
-}
-
 void r8712_free_mlme_priv(struct mlme_priv *pmlmepriv)
 {
kfree(pmlmepriv->free_bss_buf);
-- 
2.19.1

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


[PATCH] staging: rtl8712: Replace function r8712_free_network_queue

2019-05-30 Thread Nishka Dasgupta
Remove function r8712_free_network_queue as it does nothing except call
_free_network_queue.
Rename _free_network_queue to r8712_free_network_queue (and change its
type to static) for continued use of the original functionality.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 57d8e7dceef7..f6ba3e865a30 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -151,7 +151,7 @@ static struct wlan_network *_r8712_find_network(struct  
__queue *scanned_queue,
return pnetwork;
 }
 
-static void _free_network_queue(struct _adapter *padapter)
+void r8712_free_network_queue(struct _adapter *padapter)
 {
unsigned long irqL;
struct list_head *phead, *plist;
@@ -215,11 +215,6 @@ static struct  wlan_network *alloc_network(struct 
mlme_priv *pmlmepriv)
return _r8712_alloc_network(pmlmepriv);
 }
 
-void r8712_free_network_queue(struct _adapter *dev)
-{
-   _free_network_queue(dev);
-}
-
 /*
  * return the wlan_network with the matching addr
  * Shall be called under atomic context...
-- 
2.19.1

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


Re: [PATCH 2/2] staging: kpc2000: add missing dependencies for kpc2000

2019-05-30 Thread Greg KH
On Sat, May 25, 2019 at 11:24:04AM +0200, Simon Sandström wrote:
> On Sat, May 25, 2019 at 10:39:18AM +0200, Simon Sandström wrote:
> > On Sat, May 25, 2019 at 07:00:17AM +0200, Greg KH wrote:
> > > 
> > > This is already in linux-next (in a different form), are you sure you
> > > are working against the latest kernel tree?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > 
> > It's based on your staging tree. I think that I have to go back and read
> > about next trees again, because I thought it took longer time for things
> > to get from staging-next to linux-next.
> > 
> > Anyway, neither the MFD_CORE nor the typo fix is in linux-next so I
> > guess that I could just rebase this on linux-next and re-send as v2.
> > I'm not sure if MFD_CORE should be "depends on" or "select" though...
> > 
> > 
> > - Simon
> 
> Oh, it must be "select MFD_CORE" because there is no prompt for
> MFD_CORE? Should I just rebase it on linux-next and re-send as v2 then?

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


[PATCH] staging: rtl8712: Remove function alloc_network

2019-05-30 Thread Nishka Dasgupta
Remove function alloc_network as it does nothing except call
_r8712_alloc_network. Further, to maintain consistency with
the names of other functions, rename _r8712_alloc_network as
r8712_alloc_network.
Also change the corresponding calls to either function
accordingly.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl871x_cmd.c  | 2 +-
 drivers/staging/rtl8712/rtl871x_mlme.c | 9 ++---
 drivers/staging/rtl8712/rtl871x_mlme.h | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index 05a78ac24987..7c437ee9e022 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -880,7 +880,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
}
r8712_indicate_connect(padapter);
} else {
-   pwlan = _r8712_alloc_network(pmlmepriv);
+   pwlan = r8712_alloc_network(pmlmepriv);
if (!pwlan) {
pwlan = r8712_get_oldest_wlan_network(
&pmlmepriv->scanned_queue);
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c 
b/drivers/staging/rtl8712/rtl871x_mlme.c
index f6ba3e865a30..3b6846c43d72 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -70,7 +70,7 @@ int r8712_init_mlme_priv(struct _adapter *padapter)
return _SUCCESS;
 }
 
-struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv)
+struct wlan_network *r8712_alloc_network(struct mlme_priv *pmlmepriv)
 {
unsigned long irqL;
struct wlan_network *pnetwork;
@@ -210,11 +210,6 @@ void r8712_free_mlme_priv(struct mlme_priv *pmlmepriv)
kfree(pmlmepriv->free_bss_buf);
 }
 
-static struct  wlan_network *alloc_network(struct mlme_priv *pmlmepriv)
-{
-   return _r8712_alloc_network(pmlmepriv);
-}
-
 /*
  * return the wlan_network with the matching addr
  * Shall be called under atomic context...
@@ -388,7 +383,7 @@ static void update_scanned_network(struct _adapter *adapter,
} else {
/* Otherwise just pull from the free list */
/* update scan_time */
-   pnetwork = alloc_network(pmlmepriv);
+   pnetwork = r8712_alloc_network(pmlmepriv);
if (!pnetwork)
return;
bssid_ex_sz = r8712_get_wlan_bssid_ex_sz(target);
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h 
b/drivers/staging/rtl8712/rtl871x_mlme.h
index 8a54181f4816..3973a49dc32e 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.h
+++ b/drivers/staging/rtl8712/rtl871x_mlme.h
@@ -196,7 +196,7 @@ void _r8712_join_timeout_handler(struct _adapter *adapter);
 void r8712_scan_timeout_handler(struct _adapter *adapter);
 void _r8712_dhcp_timeout_handler(struct _adapter *adapter);
 void _r8712_wdg_timeout_handler(struct _adapter *adapter);
-struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv);
+struct wlan_network *r8712_alloc_network(struct mlme_priv *pmlmepriv);
 sint r8712_if_up(struct _adapter *padapter);
 void r8712_joinbss_reset(struct _adapter *padapter);
 unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
-- 
2.19.1

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


[PATCH] staging: rtl8712: ieee80211.c: Remove leading p from variable names

2019-05-30 Thread Nishka Dasgupta
Remove leading p from the names of the following pointer variables:
- pregistrypriv
- pdev_network
- pie
- pbuf.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/ieee80211.c | 50 ++---
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 4cca7390c8ef..fe94e5c15836 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -156,13 +156,13 @@ static uint r8712_get_rateset_len(u8 *rateset)
return i;
 }
 
-int r8712_generate_ie(struct registry_priv *pregistrypriv)
+int r8712_generate_ie(struct registry_priv *registrypriv)
 {
int rate_len;
uint sz = 0;
-   struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
-   u8 *ie = pdev_network->IEs;
-   u16 beaconPeriod = (u16)pdev_network->Configuration.BeaconPeriod;
+   struct wlan_bssid_ex *dev_network = ®istrypriv->dev_network;
+   u8 *ie = dev_network->IEs;
+   u16 beaconPeriod = (u16)dev_network->Configuration.BeaconPeriod;
 
/*timestamp will be inserted by hardware*/
sz += 8;
@@ -174,65 +174,65 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
/*capability info*/
*(u16 *)ie = 0;
*(__le16 *)ie |= cpu_to_le16(cap_IBSS);
-   if (pregistrypriv->preamble == PREAMBLE_SHORT)
+   if (registrypriv->preamble == PREAMBLE_SHORT)
*(__le16 *)ie |= cpu_to_le16(cap_ShortPremble);
-   if (pdev_network->Privacy)
+   if (dev_network->Privacy)
*(__le16 *)ie |= cpu_to_le16(cap_Privacy);
sz += 2;
ie += 2;
/*SSID*/
-   ie = r8712_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength,
- pdev_network->Ssid.Ssid, &sz);
+   ie = r8712_set_ie(ie, _SSID_IE_, dev_network->Ssid.SsidLength,
+ dev_network->Ssid.Ssid, &sz);
/*supported rates*/
-   set_supported_rate(pdev_network->rates, pregistrypriv->wireless_mode);
-   rate_len = r8712_get_rateset_len(pdev_network->rates);
+   set_supported_rate(dev_network->rates, registrypriv->wireless_mode);
+   rate_len = r8712_get_rateset_len(dev_network->rates);
if (rate_len > 8) {
ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, 8,
- pdev_network->rates, &sz);
+ dev_network->rates, &sz);
ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8),
- (pdev_network->rates + 8), &sz);
+ (dev_network->rates + 8), &sz);
} else {
ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_,
- rate_len, pdev_network->rates, &sz);
+ rate_len, dev_network->rates, &sz);
}
/*DS parameter set*/
ie = r8712_set_ie(ie, _DSSET_IE_, 1,
- (u8 *)&pdev_network->Configuration.DSConfig, &sz);
+ (u8 *)&dev_network->Configuration.DSConfig, &sz);
/*IBSS Parameter Set*/
ie = r8712_set_ie(ie, _IBSS_PARA_IE_, 2,
- (u8 *)&pdev_network->Configuration.ATIMWindow, &sz);
+ (u8 *)&dev_network->Configuration.ATIMWindow, &sz);
return sz;
 }
 
-unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int 
limit)
+unsigned char *r8712_get_wpa_ie(unsigned char *ie, uint *wpa_ie_len, int limit)
 {
u32 len;
u16 val16;
unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
-   u8 *pbuf = pie;
+   u8 *buf = ie;
 
while (1) {
-   pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, &len, limit);
-   if (pbuf) {
+   buf = r8712_get_ie(buf, _WPA_IE_ID_, &len, limit);
+   if (buf) {
/*check if oui matches...*/
-   if (memcmp((pbuf + 2), wpa_oui_type,
+   if (memcmp((buf + 2), wpa_oui_type,
   sizeof(wpa_oui_type)))
goto check_next_ie;
/*check version...*/
-   memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16));
+   memcpy((u8 *)&val16, (buf + 6), sizeof(val16));
le16_to_cpus(&val16);
if (val16 != 0x0001)
goto check_next_ie;
-   *wpa_ie_len = *(pbuf + 1);
-   return pbuf;
+   *wpa_ie_len = *(buf + 1);
+   return buf;
}
*wpa_ie_len = 0;
return NULL;
 check_next_ie:
-   limit = limit - (pbuf - pie) - 2 - len;
+   limit = limit - (buf - ie) - 2 - len;
if (limit <= 0)
 

Re: [PATCH 1/4] staging: kpc2000: add spaces around operators in core.c

2019-05-30 Thread Greg KH
On Fri, May 24, 2019 at 01:07:59PM +0200, Simon Sandström wrote:
> Fixes checkpatch.pl check "spaces preferred around that ".
> 
> Signed-off-by: Simon Sandström 
> ---
>  drivers/staging/kpc2000/kpc2000/core.c | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/kpc2000/kpc2000/core.c 
> b/drivers/staging/kpc2000/kpc2000/core.c
> index 4110032d0cbb..b464973d12ad 100644
> --- a/drivers/staging/kpc2000/kpc2000/core.c
> +++ b/drivers/staging/kpc2000/kpc2000/core.c
> @@ -276,18 +276,18 @@ static ssize_t kp2000_cdev_read(struct file *filp, char 
> __user *buf,
>   if (WARN(NULL == buf, "kp2000_cdev_read: buf is a NULL pointer!\n"))
>   return -EINVAL;
>  
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Card ID : 
> 0x%08x\n", pcard->card_id);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Build Version   : 
> 0x%08x\n", pcard->build_version);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Build Date  : 
> 0x%08x\n", pcard->build_datestamp);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Build Time  : 
> 0x%08x\n", pcard->build_timestamp);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Core Table Offset   : 
> 0x%08x\n", pcard->core_table_offset);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Core Table Length   : 
> 0x%08x\n", pcard->core_table_length);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Hardware Revision   : 
> 0x%08x\n", pcard->hardware_revision);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "SSID: 
> 0x%016llx\n", pcard->ssid);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "DDNA: 
> 0x%016llx\n", pcard->ddna);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "IRQ Mask: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK));
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "IRQ Active  : 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE));
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "CPLD: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG));
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Card ID : 
> 0x%08x\n", pcard->card_id);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Build Version   : 
> 0x%08x\n", pcard->build_version);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Build Date  : 
> 0x%08x\n", pcard->build_datestamp);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Build Time  : 
> 0x%08x\n", pcard->build_timestamp);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Core Table Offset   : 
> 0x%08x\n", pcard->core_table_offset);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Core Table Length   : 
> 0x%08x\n", pcard->core_table_length);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Hardware Revision   : 
> 0x%08x\n", pcard->hardware_revision);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "SSID: 
> 0x%016llx\n", pcard->ssid);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "DDNA: 
> 0x%016llx\n", pcard->ddna);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "IRQ Mask: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK));
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "IRQ Active  : 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE));
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "CPLD: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG));
>  
>   if (*f_pos >= cnt)
>   return 0;

This whole function just needs to be deleted, it's a horrible hack.

thanks,

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


[PATCH] staging: rtl8712: Change _SUCCESS/_FAIL to 0/-ENOMEM

2019-05-30 Thread Nishka Dasgupta
Change return values _SUCCESS and _FAIL to 0 and -ENOMEM respectively,
to match the convention in the drivers (and also because the return
value of this changed function is never checked anyway).
Change return type of the function to int (from u8) to allow the return
of -ENOMEM.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8712/rtl871x_cmd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index 8220829b5c82..e408b15102ce 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -773,7 +773,7 @@ u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid)
return _SUCCESS;
 }
 
-u8 r8712_wdg_timeout_handler(struct _adapter *padapter)
+int r8712_wdg_timeout_handler(struct _adapter *padapter)
 {
struct cmd_obj *ph2c;
struct drvint_cmd_parm  *pdrvintcmd_param;
@@ -781,18 +781,18 @@ u8 r8712_wdg_timeout_handler(struct _adapter *padapter)
 
ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c)
-   return _FAIL;
+   return -ENOMEM;
pdrvintcmd_param = kmalloc(sizeof(*pdrvintcmd_param), GFP_ATOMIC);
if (!pdrvintcmd_param) {
kfree(ph2c);
-   return _FAIL;
+   return -ENOMEM;
}
pdrvintcmd_param->i_cid = WDG_WK_CID;
pdrvintcmd_param->sz = 0;
pdrvintcmd_param->pbuf = NULL;
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvintcmd_param, _DRV_INT_CMD_);
r8712_enqueue_cmd_ex(pcmdpriv, ph2c);
-   return _SUCCESS;
+   return 0;
 }
 
 void r8712_survey_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd)
-- 
2.19.1

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


Re: [PATCH] staging: media: davinci_vpfe: Remove variable vpfe_dev

2019-05-30 Thread Nishka Dasgupta

On 31/05/19 2:25 AM, Greg KH wrote:

On Fri, May 31, 2019 at 02:17:18AM +0530, Nishka Dasgupta wrote:

Remove variable vpfe_dev and replace it with its value (since the
function otherwise uses values directly instead of local variables).


This says _what_ you do.  But we can see that in the patch itself.

You need to say _why_ you are doing this.

There's no need for this change at all.  Again, as I have said before,
we write code for developers to read first, the compiler second.  By
making these types of changes you are making it harder to
read/understand by a developer, and providing absolutely no benifit to
the compiler at all.

So it's actually making the code worse!

not good at all.

Please reconsider this type of change, as I keep asking you to.


Okay. In this case I thought it wouldn't make it worse since the 
function is low on local variables anyway? Clearly I was wrong, so I 
won't count this case as an exception in future.


Thanking you,
Nishka


greg k-h



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


Re: [Patch v3] staging: rtl8723bs: core: rtw_mlme_ext: fix warning Unneeded variable: "ret"

2019-05-30 Thread Greg Kroah-Hartman
On Thu, May 23, 2019 at 11:09:41PM +0530, Hariprasad Kelam wrote:
> This patch fixes below warnings reported by coccicheck
> 
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1888:14-17: Unneeded
> variable: "ret". Return "_FAIL" on line 1920
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:466:5-8: Unneeded
> variable: "res". Return "_SUCCESS" on line 494
> 
> Signed-off-by: Hariprasad Kelam 
> 
> changes in v2:
> change return type of init_mlme_ext_priv() from int to
> void
> We cant change return type of on_action_spct() it is a
> call back function from action_handler.
> So directly return _FAIL from this function.
> changes in v3:
>   Dont remove initilization of init_mlme_ext_priv
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 ++---
>  drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +-
>  drivers/staging/rtl8723bs/os_dep/os_intfs.c  | 6 +-
>  3 files changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
> b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index 65e8cba..4b0129c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -458,9 +458,8 @@ static u8 init_channel_set(struct adapter *padapter, u8 
> ChannelPlan, RT_CHANNEL_
>   return chanset_size;
>  }
>  
> -int  init_mlme_ext_priv(struct adapter *padapter)
> +void init_mlme_ext_priv(struct adapter *padapter)
>  {
> - int res = _SUCCESS;
>   struct registry_priv *pregistrypriv = &padapter->registrypriv;
>   struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
>   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> @@ -487,9 +486,6 @@ int   init_mlme_ext_priv(struct adapter *padapter)
>  #ifdef DBG_FIXED_CHAN
>   pmlmeext->fixed_chan = 0xFF;
>  #endif
> -
> - return res;
> -
>  }
>  
>  void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
> @@ -1881,7 +1877,6 @@ unsigned int OnAtim(struct adapter *padapter, union 
> recv_frame *precv_frame)
>  
>  unsigned int on_action_spct(struct adapter *padapter, union recv_frame 
> *precv_frame)
>  {
> - unsigned int ret = _FAIL;
>   struct sta_info *psta = NULL;
>   struct sta_priv *pstapriv = &padapter->stapriv;
>   u8 *pframe = precv_frame->u.hdr.rx_data;
> @@ -1913,7 +1908,7 @@ unsigned int on_action_spct(struct adapter *padapter, 
> union recv_frame *precv_fr
>   }
>  
>  exit:
> - return ret;
> + return _FAIL;
>  }
>  
>  unsigned int OnAction_back(struct adapter *padapter, union recv_frame 
> *precv_frame)
> diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
> b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> index f6eabad..0eb2da5 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
> @@ -535,7 +535,7 @@ struct mlme_ext_priv
>  };
>  
>  void init_mlme_default_rate_set(struct adapter *padapter);
> -int init_mlme_ext_priv(struct adapter *padapter);
> +void init_mlme_ext_priv(struct adapter *padapter);
>  int init_hw_mlme_ext(struct adapter *padapter);
>  void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext);
>  extern void init_mlme_ext_timer(struct adapter *padapter);
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c 
> b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 8a9d838..4afb35b 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -774,11 +774,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
>   goto exit;
>   }
>  
> - if (init_mlme_ext_priv(padapter) == _FAIL) {
> - RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init 
> mlme_ext_priv\n"));
> - ret8 = _FAIL;
> - goto exit;
> - }
> + init_mlme_ext_priv(padapter); 

Always run checkpatch.pl on your patches so you do not get grumpy
maintainers telling you to run checkpatch.pl on your patches :(


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


Re: [PATCH] staging: rtl8712: Remove unnecessary variable in rtl8712_recv.c

2019-05-30 Thread Greg KH
On Wed, May 29, 2019 at 06:50:31PM +0530, Nishka Dasgupta wrote:
> Remove unnecessary variable last_evm in rtl8712_recv.c and use its value
> directly.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta 
> ---
>  drivers/staging/rtl8712/rtl8712_recv.c | 5 ++---
>  drivers/staging/rtl8712/rtl871x_cmd.c  | 2 +-
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
> b/drivers/staging/rtl8712/rtl8712_recv.c
> index 82ddc0c3ecd4..f6f7cd5fd0f2 100644
> --- a/drivers/staging/rtl8712/rtl8712_recv.c
> +++ b/drivers/staging/rtl8712/rtl8712_recv.c
> @@ -885,7 +885,7 @@ static void query_rx_phy_status(struct _adapter *padapter,
>  static void process_link_qual(struct _adapter *padapter,
> union recv_frame *prframe)
>  {
> - u32 last_evm = 0, tmpVal;
> + u32 tmpVal;
>   struct rx_pkt_attrib *pattrib;
>   struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
>  
> @@ -898,8 +898,7 @@ static void process_link_qual(struct _adapter *padapter,
>*/
>   if (sqd->total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX) {
>   sqd->total_num = PHY_LINKQUALITY_SLID_WIN_MAX;
> - last_evm = sqd->elements[sqd->index];
> - sqd->total_val -= last_evm;
> + sqd->total_val -= sqd->elements[sqd->index];

Nope, original code is easier to understand :(

>   }
>   sqd->total_val += pattrib->signal_qual;
>   sqd->elements[sqd->index++] = pattrib->signal_qual;
> diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
> b/drivers/staging/rtl8712/rtl871x_cmd.c
> index 05a78ac24987..7c437ee9e022 100644
> --- a/drivers/staging/rtl8712/rtl871x_cmd.c
> +++ b/drivers/staging/rtl8712/rtl871x_cmd.c
> @@ -880,7 +880,7 @@ void r8712_createbss_cmd_callback(struct _adapter 
> *padapter,
>   }
>   r8712_indicate_connect(padapter);
>   } else {
> - pwlan = _r8712_alloc_network(pmlmepriv);
> + pwlan = r8712_alloc_network(pmlmepriv);

what does this change have to do with your changelog?

confused,

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


Re: [PATCH] staging: vt6655: Change return type of function and remove variable

2019-05-30 Thread Greg KH
On Wed, May 29, 2019 at 07:15:29PM +0530, Nishka Dasgupta wrote:
> As the function CARDbRadioPowerOff always returns true, and this value
> does not appear to be used anywhere, the return variable can be entirely
> removed and the function converted to type void.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta 
> ---
>  drivers/staging/vt6655/card.c | 56 ---
>  drivers/staging/vt6655/card.h |  2 +-
>  2 files changed, 27 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
> index 6ecbe925026d..2aca5b38be5c 100644
> --- a/drivers/staging/vt6655/card.c
> +++ b/drivers/staging/vt6655/card.c
> @@ -409,42 +409,38 @@ bool CARDbSetBeaconPeriod(struct vnt_private *priv,
>   *  Out:
>   *  none
>   *
> - * Return Value: true if success; otherwise false
> + * Return Value: none

That's obvious and the whole line can be removed.

>   */
> -bool CARDbRadioPowerOff(struct vnt_private *priv)
> +void CARDbRadioPowerOff(struct vnt_private *priv)
>  {
> - bool bResult = true;
> -
> - if (priv->bRadioOff)
> - return true;
> -
> - switch (priv->byRFType) {
> - case RF_RFMD2959:
> - MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
> -SOFTPWRCTL_TXPEINV);
> - MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL,
> -   SOFTPWRCTL_SWPE1);
> - break;
> + if (!priv->bRadioOff) {
> + switch (priv->byRFType) {

No, don't do that.  Leave the indentation alone and just return "early"
like the code did.

thanks,

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


Re: [PATCH] staging: pi433: cleanup to adhere with linux coding style

2019-05-30 Thread shobhit kukreti

Thank you for the feedback. I dropped the patch. 

Best,
Shobhit Kukreti


On Thursday, May 23, 2019, 12:30:20 AM PDT, Greg Kroah-Hartman 
 wrote: 


On Wed, May 22, 2019 at 06:06:22PM -0700, Shobhit Kukreti wrote:
> The linux coding style emphasizes on a limit of 80 characters
> per line. Cleaned up several over 80 character warnings in following files:
> 
> pi433_if.c
> pi433_if.h
> rf69.c
> 
> Signed-off-by: Shobhit Kukreti 
> ---
>  drivers/staging/pi433/pi433_if.c | 15 ---
>  drivers/staging/pi433/pi433_if.h | 25 +++
>  drivers/staging/pi433/rf69.c    | 89 
>  3 files changed, 78 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/staging/pi433/pi433_if.c 
> b/drivers/staging/pi433/pi433_if.c
> index c889f0b..07715c9 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -439,8 +439,7 @@ pi433_receive(void *data)
>          /* wait for RSSI level to become high */
>          dev_dbg(dev->dev, "rx: going to wait for high RSSI level");
>          retval = wait_event_interruptible(dev->rx_wait_queue,
> -                          rf69_get_flag(dev->spi,
> -                                rssi_exceeded_threshold));
> +            rf69_get_flag(dev->spi,    rssi_exceeded_threshold));

Ick, no.  The original code is fine here, this makes it much harder to
understand what is going on here, right?


>          if (retval) /* wait was interrupted */
>              goto abort;
>          dev->interrupt_rx_allowed = false;
> @@ -475,7 +474,7 @@ pi433_receive(void *data)
>      /* length byte enabled? */
>      if (dev->rx_cfg.enable_length_byte == OPTION_ON) {
>          retval = wait_event_interruptible(dev->fifo_wait_queue,
> -                          dev->free_in_fifo < FIFO_SIZE);
> +                    dev->free_in_fifo < FIFO_SIZE);


Same for this, and all the other changes you made.  The 80 column "rule"
is just a strong hint.  There are other ways to remove it instead of
just moving code to the left like you did here, if you really want to
fix these warnings up.

thanks,

greg k-h

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


[PATCH 6/7] media: cedrus: Add infra for extra buffers connected to capture buffers

2019-05-30 Thread Jernej Skrabec
H264 and HEVC engines need additional buffers for each capture buffer.
H264 engine has this currently solved by allocating fixed size pool,
which is not ideal. Most of the time pool size is much bigger than it
needs to be.

Ideally, extra buffer should be allocated at buffer initialization, but
that's not efficient. It's size in H264 depends on flags set in SPS, but
that information is not available in buffer init callback.

Signed-off-by: Jernej Skrabec 
---
 drivers/staging/media/sunxi/cedrus/cedrus.h   |  4 
 .../staging/media/sunxi/cedrus/cedrus_video.c | 19 +++
 2 files changed, 23 insertions(+)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h 
b/drivers/staging/media/sunxi/cedrus/cedrus.h
index d8e6777e5e27..16c1bdfd243a 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
@@ -81,6 +81,10 @@ struct cedrus_run {
 struct cedrus_buffer {
struct v4l2_m2m_buffer  m2m_buf;
 
+   void*extra_buf;
+   dma_addr_t  extra_buf_dma;
+   ssize_t extra_buf_size;
+
union {
struct {
unsigned intposition;
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index 681dfe3367a6..d756e0e69634 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -411,6 +411,24 @@ static void cedrus_queue_cleanup(struct vb2_queue *vq, u32 
state)
}
 }
 
+static void cedrus_buf_cleanup(struct vb2_buffer *vb)
+{
+   struct vb2_queue *vq = vb->vb2_queue;
+
+   if (!V4L2_TYPE_IS_OUTPUT(vq->type)) {
+   struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
+   struct cedrus_buffer *cedrus_buf;
+
+   cedrus_buf = vb2_to_cedrus_buffer(vq->bufs[vb->index]);
+
+   if (cedrus_buf->extra_buf_size)
+   dma_free_coherent(ctx->dev->dev,
+ cedrus_buf->extra_buf_size,
+ cedrus_buf->extra_buf,
+ cedrus_buf->extra_buf_dma);
+   }
+}
+
 static int cedrus_buf_out_validate(struct vb2_buffer *vb)
 {
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
@@ -497,6 +515,7 @@ static void cedrus_buf_request_complete(struct vb2_buffer 
*vb)
 static struct vb2_ops cedrus_qops = {
.queue_setup= cedrus_queue_setup,
.buf_prepare= cedrus_buf_prepare,
+   .buf_cleanup= cedrus_buf_cleanup,
.buf_queue  = cedrus_buf_queue,
.buf_out_validate   = cedrus_buf_out_validate,
.buf_request_complete   = cedrus_buf_request_complete,
-- 
2.21.0

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


[PATCH 1/7] media: cedrus: Disable engine after each slice decoding

2019-05-30 Thread Jernej Skrabec
libvdpau-sunxi always disables engine after each decoded slice.
Do same in Cedrus driver.

Presumably this also lowers power consumption which is always nice.

Signed-off-by: Jernej Skrabec 
---
 drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index c34aec7c6e40..9c5819def186 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -123,6 +123,7 @@ static irqreturn_t cedrus_irq(int irq, void *data)
 
dev->dec_ops[ctx->current_codec]->irq_disable(ctx);
dev->dec_ops[ctx->current_codec]->irq_clear(ctx);
+   cedrus_engine_disable(dev);
 
src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
-- 
2.21.0

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


[PATCH 5/7] media: cedrus: Don't set chroma size for scale & rotation

2019-05-30 Thread Jernej Skrabec
Scale and rotation are currently not implemented, so it makes no sense to
set chroma size for it.

Signed-off-by: Jernej Skrabec 
---
 drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index 9c5819def186..9de20ae47916 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -79,9 +79,6 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
reg = VE_PRIMARY_OUT_FMT_NV12;
cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg);
 
-   reg = VE_CHROMA_BUF_LEN_SDRT(chroma_size / 2);
-   cedrus_write(dev, VE_CHROMA_BUF_LEN, reg);
-
reg = chroma_size / 2;
cedrus_write(dev, VE_PRIMARY_CHROMA_BUF_LEN, reg);
 
-- 
2.21.0

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


[PATCH 0/7] media: cedrus: Improvements/cleanup

2019-05-30 Thread Jernej Skrabec
Here is first batch of random Cedrus improvements/cleanups. Only patch 2
has a change which raises a question about H264 controls.

Changes were tested on H3 SoC using modified ffmpeg and Kodi.

Please take a look.

Best regards,
Jernej

Jernej Skrabec (7):
  media: cedrus: Disable engine after each slice decoding
  media: cedrus: Fix H264 default reference index count
  media: cedrus: Fix decoding for some H264 videos
  media: cedrus: Remove dst_bufs from context
  media: cedrus: Don't set chroma size for scale & rotation
  media: cedrus: Add infra for extra buffers connected to capture
buffers
  media: cedrus: Improve H264 memory efficiency

 drivers/staging/media/sunxi/cedrus/cedrus.h   |  12 +-
 .../staging/media/sunxi/cedrus/cedrus_h264.c  | 115 --
 .../staging/media/sunxi/cedrus/cedrus_hw.c|   4 +-
 .../staging/media/sunxi/cedrus/cedrus_video.c |  25 ++--
 4 files changed, 68 insertions(+), 88 deletions(-)

-- 
2.21.0

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


[PATCH 2/7] media: cedrus: Fix H264 default reference index count

2019-05-30 Thread Jernej Skrabec
Reference index count in VE_H264_PPS reg should come from PPS control.
However, this is not really important because reference index count is
in our case always overridden by that from slice header.

Cc: nico...@ndufresne.ca
Cc: boris.brezil...@collabora.com
Cc: jo...@kwiboo.se

Signed-off-by: Jernej Skrabec 
---
We have to decide if we drop pps->num_ref_idx_l0_default_active_minus1
and pps->num_ref_idx_l1_default_active_minus1 fields or add
num_ref_idx_l0_active_override_flag and num_ref_idx_l0_active_override_flag
to slice control.

Current control doesn't have those two flags, so in Cedrus override flag is
always set and we rely on userspace to set slice->num_ref_idx_l0_active_minus1
and slice->num_ref_idx_l1_active_minus1 to correct values. This means that
values stored in PPS are not needed and always ignored by VPU.

If I understand correctly, algorithm is very simple:

ref_count = PPS->ref_count
if (override_flag)
ref_count = slice->ref_count

It seems that VAAPI provides only final value. In my opinion we should do the
same - get rid of PPS default ref index count fields.

 drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
index a30bb283f69f..cc8d17f211a1 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
@@ -340,12 +340,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
 
// picture parameters
reg = 0;
-   /*
-* FIXME: the kernel headers are allowing the default value to
-* be passed, but the libva doesn't give us that.
-*/
-   reg |= (slice->num_ref_idx_l0_active_minus1 & 0x1f) << 10;
-   reg |= (slice->num_ref_idx_l1_active_minus1 & 0x1f) << 5;
+   reg |= (pps->num_ref_idx_l0_default_active_minus1 & 0x1f) << 10;
+   reg |= (pps->num_ref_idx_l1_default_active_minus1 & 0x1f) << 5;
reg |= (pps->weighted_bipred_idc & 0x3) << 2;
if (pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE)
reg |= VE_H264_PPS_ENTROPY_CODING_MODE;
-- 
2.21.0

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


[PATCH 7/7] media: cedrus: Improve H264 memory efficiency

2019-05-30 Thread Jernej Skrabec
H264 decoder driver preallocated pretty big worst case mv col buffer
pool. It turns out that pool is most of the time much bigger than it
needs to be.

Solution implemented here is to allocate memory only if capture buffer
is actually used and only as much as it is really necessary.

This is also preparation for 4K video decoding support, which will be
implemented later.

Signed-off-by: Jernej Skrabec 
---
 drivers/staging/media/sunxi/cedrus/cedrus.h   |  4 -
 .../staging/media/sunxi/cedrus/cedrus_h264.c  | 81 +++
 2 files changed, 28 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h 
b/drivers/staging/media/sunxi/cedrus/cedrus.h
index 16c1bdfd243a..fcbbbef65494 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
@@ -106,10 +106,6 @@ struct cedrus_ctx {
 
union {
struct {
-   void*mv_col_buf;
-   dma_addr_t  mv_col_buf_dma;
-   ssize_t mv_col_buf_field_size;
-   ssize_t mv_col_buf_size;
void*pic_info_buf;
dma_addr_t  pic_info_buf_dma;
void*neighbor_info_buf;
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
index b2290f98d81a..758fd0049e8f 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
@@ -54,17 +54,14 @@ static void cedrus_h264_write_sram(struct cedrus_dev *dev,
cedrus_write(dev, VE_AVC_SRAM_PORT_DATA, *buffer++);
 }
 
-static dma_addr_t cedrus_h264_mv_col_buf_addr(struct cedrus_ctx *ctx,
- unsigned int position,
+static dma_addr_t cedrus_h264_mv_col_buf_addr(struct cedrus_buffer *buf,
  unsigned int field)
 {
-   dma_addr_t addr = ctx->codec.h264.mv_col_buf_dma;
-
-   /* Adjust for the position */
-   addr += position * ctx->codec.h264.mv_col_buf_field_size * 2;
+   dma_addr_t addr = buf->extra_buf_dma;
 
/* Adjust for the field */
-   addr += field * ctx->codec.h264.mv_col_buf_field_size;
+   if (field)
+   addr += buf->extra_buf_size / 2;
 
return addr;
 }
@@ -76,7 +73,6 @@ static void cedrus_fill_ref_pic(struct cedrus_ctx *ctx,
struct cedrus_h264_sram_ref_pic *pic)
 {
struct vb2_buffer *vbuf = &buf->m2m_buf.vb.vb2_buf;
-   unsigned int position = buf->codec.h264.position;
 
pic->top_field_order_cnt = cpu_to_le32(top_field_order_cnt);
pic->bottom_field_order_cnt = cpu_to_le32(bottom_field_order_cnt);
@@ -84,10 +80,8 @@ static void cedrus_fill_ref_pic(struct cedrus_ctx *ctx,
 
pic->luma_ptr = cpu_to_le32(cedrus_buf_addr(vbuf, &ctx->dst_fmt, 0));
pic->chroma_ptr = cpu_to_le32(cedrus_buf_addr(vbuf, &ctx->dst_fmt, 1));
-   pic->mv_col_top_ptr =
-   cpu_to_le32(cedrus_h264_mv_col_buf_addr(ctx, position, 0));
-   pic->mv_col_bot_ptr =
-   cpu_to_le32(cedrus_h264_mv_col_buf_addr(ctx, position, 1));
+   pic->mv_col_top_ptr = cpu_to_le32(cedrus_h264_mv_col_buf_addr(buf, 0));
+   pic->mv_col_bot_ptr = cpu_to_le32(cedrus_h264_mv_col_buf_addr(buf, 1));
 }
 
 static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
@@ -142,6 +136,28 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
output_buf = vb2_to_cedrus_buffer(&run->dst->vb2_buf);
output_buf->codec.h264.position = position;
 
+   if (!output_buf->extra_buf_size) {
+   const struct v4l2_ctrl_h264_sps *sps = run->h264.sps;
+   unsigned int field_size;
+
+   field_size = DIV_ROUND_UP(ctx->src_fmt.width, 16) *
+   DIV_ROUND_UP(ctx->src_fmt.height, 16) * 16;
+   if (!(sps->flags & V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE))
+   field_size = field_size * 2;
+   if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY))
+   field_size = field_size * 2;
+
+   output_buf->extra_buf_size = field_size * 2;
+   output_buf->extra_buf =
+   dma_alloc_coherent(dev->dev,
+  output_buf->extra_buf_size,
+  &output_buf->extra_buf_dma,
+  GFP_KERNEL);
+
+   if (!output_buf->extra_buf)
+   output_buf->extra_buf_size = 0;
+   }
+
if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)
output_buf->codec.h264.pic_type = CEDRUS_H264_PIC_TYPE_FIELD;
else if (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD)
@@ -476,8 +492,6 @@ static void cedrus_h264_setup(struct cedrus_c

[PATCH 3/7] media: cedrus: Fix decoding for some H264 videos

2019-05-30 Thread Jernej Skrabec
It seems that for some H264 videos at least one bitstream parsing
trigger must be called in order to be decoded correctly. There is no
explanation why this helps, but it was observed that two sample videos
with this fix are now decoded correctly and there is no regression with
others.

Signed-off-by: Jernej Skrabec 
---
I have two samples which are fixed by this:
http://jernej.libreelec.tv/videos/h264/test.mkv
http://jernej.libreelec.tv/videos/h264/Dredd%20%E2%80%93%20DTS%20Sound%20Check%20DTS-HD%20MA%207.1.m2ts

Although second one also needs support for multi-slice frames, which is not yet 
implemented here.

 .../staging/media/sunxi/cedrus/cedrus_h264.c  | 22 ---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
index cc8d17f211a1..d0ee3f90ff46 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
@@ -6,6 +6,7 @@
  * Copyright (c) 2018 Bootlin
  */
 
+#include 
 #include 
 
 #include 
@@ -289,6 +290,20 @@ static void cedrus_write_pred_weight_table(struct 
cedrus_ctx *ctx,
}
 }
 
+static void cedrus_skip_bits(struct cedrus_dev *dev, int num)
+{
+   for (; num > 32; num -= 32) {
+   cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (32 << 8));
+   while (cedrus_read(dev, VE_H264_STATUS) & (1 << 8))
+   udelay(1);
+   }
+   if (num > 0) {
+   cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (num << 8));
+   while (cedrus_read(dev, VE_H264_STATUS) & (1 << 8))
+   udelay(1);
+   }
+}
+
 static void cedrus_set_params(struct cedrus_ctx *ctx,
  struct cedrus_run *run)
 {
@@ -299,12 +314,11 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
struct vb2_buffer *src_buf = &run->src->vb2_buf;
struct cedrus_dev *dev = ctx->dev;
dma_addr_t src_buf_addr;
-   u32 offset = slice->header_bit_size;
-   u32 len = (slice->size * 8) - offset;
+   u32 len = slice->size * 8;
u32 reg;
 
cedrus_write(dev, VE_H264_VLD_LEN, len);
-   cedrus_write(dev, VE_H264_VLD_OFFSET, offset);
+   cedrus_write(dev, VE_H264_VLD_OFFSET, 0);
 
src_buf_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
cedrus_write(dev, VE_H264_VLD_END,
@@ -323,6 +337,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
cedrus_write(dev, VE_H264_TRIGGER_TYPE,
 VE_H264_TRIGGER_TYPE_INIT_SWDEC);
 
+   cedrus_skip_bits(dev, slice->header_bit_size);
+
if (((pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) &&
 (slice->slice_type == V4L2_H264_SLICE_TYPE_P ||
  slice->slice_type == V4L2_H264_SLICE_TYPE_SP)) ||
-- 
2.21.0

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


[PATCH 4/7] media: cedrus: Remove dst_bufs from context

2019-05-30 Thread Jernej Skrabec
This array is just duplicated capture buffer queue. Remove it and adjust
code to look into capture buffer queue instead.

Signed-off-by: Jernej Skrabec 
---
 drivers/staging/media/sunxi/cedrus/cedrus.h   |  4 +---
 .../staging/media/sunxi/cedrus/cedrus_h264.c  |  4 ++--
 .../staging/media/sunxi/cedrus/cedrus_video.c | 22 ---
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h 
b/drivers/staging/media/sunxi/cedrus/cedrus.h
index 3f476d0fd981..d8e6777e5e27 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
@@ -100,8 +100,6 @@ struct cedrus_ctx {
struct v4l2_ctrl_handlerhdl;
struct v4l2_ctrl**ctrls;
 
-   struct vb2_buffer   *dst_bufs[VIDEO_MAX_FRAME];
-
union {
struct {
void*mv_col_buf;
@@ -187,7 +185,7 @@ static inline dma_addr_t cedrus_dst_buf_addr(struct 
cedrus_ctx *ctx,
if (index < 0)
return 0;
 
-   buf = ctx->dst_bufs[index];
+   buf = ctx->fh.m2m_ctx->cap_q_ctx.q.bufs[index];
return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0;
 }
 
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
index d0ee3f90ff46..b2290f98d81a 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
@@ -119,7 +119,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
if (buf_idx < 0)
continue;
 
-   cedrus_buf = vb2_to_cedrus_buffer(ctx->dst_bufs[buf_idx]);
+   cedrus_buf = vb2_to_cedrus_buffer(cap_q->bufs[buf_idx]);
position = cedrus_buf->codec.h264.position;
used_dpbs |= BIT(position);
 
@@ -194,7 +194,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
if (buf_idx < 0)
continue;
 
-   ref_buf = to_vb2_v4l2_buffer(ctx->dst_bufs[buf_idx]);
+   ref_buf = to_vb2_v4l2_buffer(cap_q->bufs[buf_idx]);
cedrus_buf = vb2_v4l2_to_cedrus_buffer(ref_buf);
position = cedrus_buf->codec.h264.position;
 
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c 
b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
index e2b530b1a956..681dfe3367a6 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
@@ -411,26 +411,6 @@ static void cedrus_queue_cleanup(struct vb2_queue *vq, u32 
state)
}
 }
 
-static int cedrus_buf_init(struct vb2_buffer *vb)
-{
-   struct vb2_queue *vq = vb->vb2_queue;
-   struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
-
-   if (!V4L2_TYPE_IS_OUTPUT(vq->type))
-   ctx->dst_bufs[vb->index] = vb;
-
-   return 0;
-}
-
-static void cedrus_buf_cleanup(struct vb2_buffer *vb)
-{
-   struct vb2_queue *vq = vb->vb2_queue;
-   struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
-
-   if (!V4L2_TYPE_IS_OUTPUT(vq->type))
-   ctx->dst_bufs[vb->index] = NULL;
-}
-
 static int cedrus_buf_out_validate(struct vb2_buffer *vb)
 {
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
@@ -517,8 +497,6 @@ static void cedrus_buf_request_complete(struct vb2_buffer 
*vb)
 static struct vb2_ops cedrus_qops = {
.queue_setup= cedrus_queue_setup,
.buf_prepare= cedrus_buf_prepare,
-   .buf_init   = cedrus_buf_init,
-   .buf_cleanup= cedrus_buf_cleanup,
.buf_queue  = cedrus_buf_queue,
.buf_out_validate   = cedrus_buf_out_validate,
.buf_request_complete   = cedrus_buf_request_complete,
-- 
2.21.0

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


Re: [PATCH] staging: kpc2000: Fix build failure caused by wrong include file

2019-05-30 Thread Greg Kroah-Hartman
On Thu, May 30, 2019 at 04:33:42AM -0700, Guenter Roeck wrote:
> xtensa:allmodconfig fails to build.
> 
> arch/xtensa/include/asm/uaccess.h: In function 'clear_user':
> arch/xtensa/include/asm/uaccess.h:40:22: error:
>   implicit declaration of function 'uaccess_kernel'
> 
> uaccess_kernel() is declared in linux/uaccess.h, not asm/uaccess.h.
> 
> Fixes: 7df95299b94a ("staging: kpc2000: Add DMA driver")
> Cc: Matt Sickler 
> Signed-off-by: Guenter Roeck 
> ---
>  drivers/staging/kpc2000/kpc_dma/fileops.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
> b/drivers/staging/kpc2000/kpc_dma/fileops.c
> index 5741d2b49a7d..e741fa753ca1 100644
> --- a/drivers/staging/kpc2000/kpc_dma/fileops.c
> +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
> @@ -8,7 +8,7 @@
>  #include /* error codes */
>  #include /* size_t */
>  #include 
> -#include /* copy_*_user */
> +#include /* copy_*_user */
>  #include   /* aio stuff */
>  #include 
>  #include 

Already fixed by e00839f38823 ("staging: kpc2000: fix build error on
xtensa") in my staging-linus branch.

thanks,

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


Re: [PATCH] staging: media: davinci_vpfe: Remove variable vpfe_dev

2019-05-30 Thread Greg KH
On Fri, May 31, 2019 at 02:39:23AM +0530, Nishka Dasgupta wrote:
> On 31/05/19 2:25 AM, Greg KH wrote:
> > On Fri, May 31, 2019 at 02:17:18AM +0530, Nishka Dasgupta wrote:
> > > Remove variable vpfe_dev and replace it with its value (since the
> > > function otherwise uses values directly instead of local variables).
> > 
> > This says _what_ you do.  But we can see that in the patch itself.
> > 
> > You need to say _why_ you are doing this.
> > 
> > There's no need for this change at all.  Again, as I have said before,
> > we write code for developers to read first, the compiler second.  By
> > making these types of changes you are making it harder to
> > read/understand by a developer, and providing absolutely no benifit to
> > the compiler at all.
> > 
> > So it's actually making the code worse!
> > 
> > not good at all.
> > 
> > Please reconsider this type of change, as I keep asking you to.
> 
> Okay. In this case I thought it wouldn't make it worse since the function is
> low on local variables anyway? Clearly I was wrong, so I won't count this
> case as an exception in future.

Did you check the object file output to verify this?  Try it and see :)

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


Re: [PATCH 22/22] docs: fix broken documentation links

2019-05-30 Thread Michael S. Tsirkin
On Thu, May 30, 2019 at 10:17:32PM +0200, Federico Vaga wrote:
> On Thursday, May 30, 2019 1:23:53 AM CEST Mauro Carvalho Chehab wrote:
> > Mostly due to x86 and acpi conversion, several documentation
> > links are still pointing to the old file. Fix them.
> 
> For the Italian documentation I just send I patch to fix them in a dedicated 
> patch


Acked-by: Michael S. Tsirkin 

for the vhost change.

> > 
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> >  Documentation/acpi/dsd/leds.txt  |  2 +-
> >  Documentation/admin-guide/kernel-parameters.rst  |  6 +++---
> >  Documentation/admin-guide/kernel-parameters.txt  | 16 
> >  Documentation/admin-guide/ras.rst|  2 +-
> >  .../devicetree/bindings/net/fsl-enetc.txt|  7 +++
> >  .../bindings/pci/amlogic,meson-pcie.txt  |  2 +-
> >  .../bindings/regulator/qcom,rpmh-regulator.txt   |  2 +-
> >  Documentation/devicetree/booting-without-of.txt  |  2 +-
> >  Documentation/driver-api/gpio/board.rst  |  2 +-
> >  Documentation/driver-api/gpio/consumer.rst   |  2 +-
> >  .../firmware-guide/acpi/enumeration.rst  |  2 +-
> >  .../firmware-guide/acpi/method-tracing.rst   |  2 +-
> >  Documentation/i2c/instantiating-devices  |  2 +-
> >  Documentation/sysctl/kernel.txt  |  4 ++--
> >  .../translations/it_IT/process/howto.rst |  2 +-
> >  .../it_IT/process/stable-kernel-rules.rst|  4 ++--
> >  .../translations/zh_CN/process/4.Coding.rst  |  2 +-
> >  Documentation/x86/x86_64/5level-paging.rst   |  2 +-
> >  Documentation/x86/x86_64/boot-options.rst|  4 ++--
> >  .../x86/x86_64/fake-numa-for-cpusets.rst |  2 +-
> >  MAINTAINERS  |  6 +++---
> >  arch/arm/Kconfig |  2 +-
> >  arch/arm64/kernel/kexec_image.c  |  2 +-
> >  arch/powerpc/Kconfig |  2 +-
> >  arch/x86/Kconfig | 16 
> >  arch/x86/Kconfig.debug   |  2 +-
> >  arch/x86/boot/header.S   |  2 +-
> >  arch/x86/entry/entry_64.S|  2 +-
> >  arch/x86/include/asm/bootparam_utils.h   |  2 +-
> >  arch/x86/include/asm/page_64_types.h |  2 +-
> >  arch/x86/include/asm/pgtable_64_types.h  |  2 +-
> >  arch/x86/kernel/cpu/microcode/amd.c  |  2 +-
> >  arch/x86/kernel/kexec-bzimage64.c|  2 +-
> >  arch/x86/kernel/pci-dma.c|  2 +-
> >  arch/x86/mm/tlb.c|  2 +-
> >  arch/x86/platform/pvh/enlighten.c|  2 +-
> >  drivers/acpi/Kconfig | 10 +-
> >  drivers/net/ethernet/faraday/ftgmac100.c |  2 +-
> >  .../fieldbus/Documentation/fieldbus_dev.txt  |  4 ++--
> >  drivers/vhost/vhost.c|  2 +-
> >  include/acpi/acpi_drivers.h  |  2 +-
> >  include/linux/fs_context.h   |  2 +-
> >  include/linux/lsm_hooks.h|  2 +-
> >  mm/Kconfig   |  2 +-
> >  security/Kconfig |  2 +-
> >  tools/include/linux/err.h|  2 +-
> >  tools/objtool/Documentation/stack-validation.txt |  4 ++--
> >  tools/testing/selftests/x86/protection_keys.c|  2 +-
> >  48 files changed, 77 insertions(+), 78 deletions(-)
> > 
> > diff --git a/Documentation/acpi/dsd/leds.txt
> > b/Documentation/acpi/dsd/leds.txt index 81a63af42ed2..cc58b1a574c5 100644
> > --- a/Documentation/acpi/dsd/leds.txt
> > +++ b/Documentation/acpi/dsd/leds.txt
> > @@ -96,4 +96,4 @@ where
> > 
> > http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-da
> > ta-extension-UUID-v1.1.pdf>, referenced 2019-02-21.
> > 
> > -[7] Documentation/acpi/dsd/data-node-reference.txt
> > +[7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
> > diff --git a/Documentation/admin-guide/kernel-parameters.rst
> > b/Documentation/admin-guide/kernel-parameters.rst index
> > 0124980dca2d..8d3273e32eb1 100644
> > --- a/Documentation/admin-guide/kernel-parameters.rst
> > +++ b/Documentation/admin-guide/kernel-parameters.rst
> > @@ -167,7 +167,7 @@ parameter is applicable::
> > X86-32  X86-32, aka i386 architecture is enabled.
> > X86-64  X86-64 architecture is enabled.
> > More X86-64 boot options can be found in
> > -   Documentation/x86/x86_64/boot-options.txt 
> .
> > +   Documentation/x86/x86_64/boot-options.rst.
> > X86 Either 32-bit or 64-bit x86 (same as X86-32+X86-64)
> > X86_UV  SGI UV support is enabled.
> > XEN Xen support is enabled
> > @@ -181,10 +181,10 @@ In addition, the following text indicates that the
> > option:: Parameters denoted with BOOT are actually interpreted

[PATCH] staging: mt7621-dma: sizeof via pointer dereference

2019-05-30 Thread Benjamin Sherman
Pass the size of a struct into kzalloc by pointer dereference.  This
complies with the Linux kernel coding style and removes the possibility
for a bug if the pointer's type is changed.

Signed-off-by: Benjamin Sherman 
---
 drivers/staging/mt7621-dma/mtk-hsdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c 
b/drivers/staging/mt7621-dma/mtk-hsdma.c
index a58725dd2611..60db06768c8a 100644
--- a/drivers/staging/mt7621-dma/mtk-hsdma.c
+++ b/drivers/staging/mt7621-dma/mtk-hsdma.c
@@ -468,7 +468,7 @@ static struct dma_async_tx_descriptor 
*mtk_hsdma_prep_dma_memcpy(
if (len <= 0)
return NULL;
 
-   desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
+   desc = kzalloc(sizeof(*desc), GFP_ATOMIC);
if (!desc) {
dev_err(c->device->dev, "alloc memcpy decs error\n");
return NULL;
-- 
2.21.0

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


Re: [PATCH 1/4] staging: kpc2000: add spaces around operators in core.c

2019-05-30 Thread Greg KH
On Thu, May 30, 2019 at 10:57:09PM +, Matt Sickler wrote:
> >From: devel  On Behalf Of
> >Greg KH
> >On Fri, May 24, 2019 at 01:07:59PM +0200, Simon Sandström wrote:
> >> --- a/drivers/staging/kpc2000/kpc2000/core.c
> >> +++ b/drivers/staging/kpc2000/kpc2000/core.c
> >> @@ -276,18 +276,18 @@ static ssize_t kp2000_cdev_read(struct file *filp,
> >
> >This whole function just needs to be deleted, it's a horrible hack.
> 
> >From the outside, I would definitely agree with you.  On the inside though, 
> >we
> rely on this function to quickly identify what kind and version is running on
> a given piece of hardware.  Since that same information is provided by an 
> ioctl,
> I could be convinced to remove this API and write a userspace application that
> uses the ioctl to get the information and pretty prints it.

The ioctl needs to die as well, just use the sysfs entries instead, as
you already have them :)

> I'd be more inclined to agree with the deletion if it means the whole char dev
> interface can be removed from the kpc2000 driver.  That won't be 
> straightforward
> as the ioctl is exposed through this interface.  We could remove the ioctl, 
> but
> we'd need to ensure that all the same information is exposed via sysfs.

I think you are there already, what is missing?

> Our userspace side is all funneled through a single class, so changing
> it to use sysfs wouldn't be too difficult.  I'd support that change if
> someone wants to make it.

I will be glad to do that, it's always nice to delete code :)

thanks,

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


RE: [PATCH 1/4] staging: kpc2000: add spaces around operators in core.c

2019-05-30 Thread Matt Sickler
>From: devel  On Behalf Of
>Greg KH
>On Fri, May 24, 2019 at 01:07:59PM +0200, Simon Sandström wrote:
>> --- a/drivers/staging/kpc2000/kpc2000/core.c
>> +++ b/drivers/staging/kpc2000/kpc2000/core.c
>> @@ -276,18 +276,18 @@ static ssize_t kp2000_cdev_read(struct file *filp,
>
>This whole function just needs to be deleted, it's a horrible hack.

>From the outside, I would definitely agree with you.  On the inside though, we
rely on this function to quickly identify what kind and version is running on
a given piece of hardware.  Since that same information is provided by an ioctl,
I could be convinced to remove this API and write a userspace application that
uses the ioctl to get the information and pretty prints it.
I'd be more inclined to agree with the deletion if it means the whole char dev
interface can be removed from the kpc2000 driver.  That won't be straightforward
as the ioctl is exposed through this interface.  We could remove the ioctl, but
we'd need to ensure that all the same information is exposed via sysfs.  Our
userspace side is all funneled through a single class, so changing it to use
sysfs wouldn't be too difficult.  I'd support that change if someone wants to 
make it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[GIT PULL] Staging/IIO driver fixes for 5.2-rc3

2019-05-30 Thread Greg KH
The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9:

  Linux 5.2-rc1 (2019-05-19 15:47:09 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
tags/staging-5.2-rc3

for you to fetch changes up to e61ff0fba72d981449c90b5299cebb74534b6f7c:

  staging: kpc2000: Add dependency on MFD_CORE to kconfig symbol 'KPC2000' 
(2019-05-24 09:41:09 +0200)


Staging/IIO driver fixes for 5.2-rc3

Here are some Staging and IIO driver fixes to resolve some reported
problems for 5.2-rc3.

Nothing major here, just some tiny changes, full details are in the
shortlog.

All have been in linux-next for a while with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Chengguang Xu (1):
  staging: erofs: set sb->s_root to NULL when failing from __getname()

Dan Carpenter (4):
  staging: kpc2000: double unlock in error handling in kpc_dma_transfer()
  Staging: vc04_services: Fix a couple error codes
  staging: vc04_services: prevent integer overflow in create_pagelist()
  staging: wilc1000: Fix some double unlock bugs in wilc_wlan_cleanup()

Geordan Neukum (1):
  staging: kpc2000: Add dependency on MFD_CORE to kconfig symbol 'KPC2000'

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-5.2a' of git://git.kernel.org/.../jic23/iio into 
staging-linus:

Max Filippov (1):
  staging: kpc2000: fix build error on xtensa

Ruslan Babayev (1):
  iio: dac: ds4422/ds4424 fix chip verification

Sean Nyekjaer (1):
  iio: adc: ti-ads8688: fix timestamp is not updated in buffer

Steve Moskovchenko (1):
  iio: imu: mpu6050: Fix FIFO layout for ICM20602

Tim Collier (1):
  staging: wlan-ng: fix adapter initialization failure

Tomer Maimon (1):
  iio: adc: modify NPCM ADC read reference voltage

Vincent Stehlé (1):
  iio: adc: ads124: avoid buffer overflow

YueHaibing (1):
  staging: kpc2000: Fix build error without CONFIG_UIO

 drivers/iio/adc/npcm_adc.c |  2 +-
 drivers/iio/adc/ti-ads124s08.c |  2 +-
 drivers/iio/adc/ti-ads8688.c   |  2 +-
 drivers/iio/dac/ds4424.c   |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 46 --
 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h  | 20 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c |  3 ++
 drivers/staging/erofs/super.c  |  1 +
 drivers/staging/kpc2000/Kconfig|  2 +
 drivers/staging/kpc2000/kpc_dma/fileops.c  |  4 +-
 .../vc04_services/bcm2835-camera/controls.c|  4 +-
 .../interface/vchiq_arm/vchiq_2835_arm.c   |  9 +
 drivers/staging/wilc1000/wilc_wlan.c   |  8 +++-
 drivers/staging/wlan-ng/hfa384x_usb.c  |  3 +-
 14 files changed, 91 insertions(+), 17 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel