[PATCH] Staging: comedi: driver: Remove condition with no effect

2020-07-12 Thread Saurav Girepunje
Remove below warning in das1800.c
WARNING: possible condition with no effect (if == else)

Signed-off-by: Saurav Girepunje 
---
 drivers/staging/comedi/drivers/das1800.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index f16aa7e9f4f3..7ab72e83d3d0 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1299,12 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,
outb(DAC(i), dev->iobase + DAS1800_SELECT);
outw(0, dev->iobase + DAS1800_DAC);
}
-   } else if (board->id == DAS1800_ID_AO) {
-   /*
-* 'ao' boards have waveform analog outputs that are not
-* currently supported.
-*/
-   s->type = COMEDI_SUBD_UNUSED;
} else {
s->type = COMEDI_SUBD_UNUSED;
}
-- 
2.20.1

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


[PATCH] staging: r8188eu: remove unused members of struct xmit_buf

2020-07-12 Thread Ivan Safonov
Remove unused members of struct xmit_buf: alloc_sz, ff_hwaddr,
dma_transfer_addr, bpending and last.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_xmit.h  | 5 -
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 1 -
 2 files changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h 
b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index 12d16e98176a..3c03987c81a1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -193,14 +193,9 @@ struct xmit_buf {
void *priv_data;
u16 ext_tag; /*  0: Normal xmitbuf, 1: extension xmitbuf. */
u16 flags;
-   u32 alloc_sz;
u32  len;
struct submit_ctx *sctx;
-   u32 ff_hwaddr;
struct urb *pxmit_urb[8];
-   dma_addr_t dma_transfer_addr;   /* (in) dma addr for transfer_buffer */
-   u8 bpending[8];
-   int last[8];
 };
 
 struct xmit_frame {
diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c 
b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index 017e1d628461..61ced1160951 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -24,7 +24,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter,
return _FAIL;
 
pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, XMITBUF_ALIGN_SZ);
-   pxmitbuf->dma_transfer_addr = 0;
 
for (i = 0; i < 8; i++) {
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
-- 
2.26.2

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


Re: [PATCH] staging: r8188eu: remove unused members of struct xmit_buf

2020-07-12 Thread Larry Finger

On 7/12/20 7:38 AM, Ivan Safonov wrote:

Remove unused members of struct xmit_buf: alloc_sz, ff_hwaddr,
dma_transfer_addr, bpending and last.

Signed-off-by: Ivan Safonov 
---


Have you tested this change? Previously with this driver, an unused quantity was 
removed from one of the structs and the driver failed. Apparently, the alignment 
of some other quantity was affected. I do not think that this change would have 
that affect; however, you should be testing whenever the changes are more than 
cosmetic.


Larry

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


Re: [PATCH] staging: r8188eu: remove unused members of struct xmit_buf

2020-07-12 Thread Ivan Safonov

On 7/12/20 8:55 PM, Larry Finger wrote:

On 7/12/20 7:38 AM, Ivan Safonov wrote:

Remove unused members of struct xmit_buf: alloc_sz, ff_hwaddr,
dma_transfer_addr, bpending and last.

Signed-off-by: Ivan Safonov 
---


Have you tested this change? Previously with this driver, an unused 
quantity was removed from one of the structs and the driver failed. 
Apparently, the alignment of some other quantity was affected. I do not 
think that this change would have that affect; however, you should be 
testing whenever the changes are more than cosmetic.


Larry



I have not tested this patch.

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


Re: [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs.

2020-07-12 Thread Benjamin Poirier
On 2020-07-11 18:16 +0530, Suraj Upadhyay wrote:
> The legacy API wrappers in include/linux/pci-dma-compat.h
> should go away as it creates unnecessary midlayering
> for include/linux/dma-mapping.h APIs, instead use dma-mapping.h
> APIs directly.
> 
> The patch has been generated with the coccinelle script below
> and compile-tested.
> 
[...]
> 
> @@ expression E1, E2, E3, E4; @@
> - pci_dma_sync_single_for_device(E1, E2, E3, E4)
> + dma_sync_single_for_device(&E1->dev, E2, E3, (enum dma_data_direction)E4)

The qlge driver contains more usages of the deprecated pci_dma_* api
than what this diff addresses. In particular, there are some calls to
pci_dma_sync_single_for_cpu() which were not changed despite this
expression being in the semantic patch.

Dunno what happened but it should be reviewed. After converting away
from all of the old api, the TODO file should also be updated.

[...]

> 
> diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c
> index fa178fc642a6..16a9bf818346 100644
> --- a/drivers/staging/qlge/qlge_mpi.c
> +++ b/drivers/staging/qlge/qlge_mpi.c
> @@ -788,8 +788,9 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void 
> *buf,
>   char *my_buf;
>   dma_addr_t buf_dma;
>  
> - my_buf = pci_alloc_consistent(qdev->pdev, word_count * sizeof(u32),
> -   &buf_dma);
> + my_buf = dma_alloc_coherent(&qdev->pdev->dev,
> + word_count * sizeof(u32), &buf_dma,
> + GFP_ATOMIC);
>   if (!my_buf)
>   return -EIO;
>  
> @@ -797,8 +798,8 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void 
> *buf,
>   if (!status)
>   memcpy(buf, my_buf, word_count * sizeof(u32));
>  
> - pci_free_consistent(qdev->pdev, word_count * sizeof(u32), my_buf,
> - buf_dma);
> + dma_free_coherent(&qdev->pdev->dev, word_count * sizeof(u32), my_buf,
> +   buf_dma);
>   return status;
>  }
>  
> -- 
> 2.17.1
> 




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


Re: [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs.

2020-07-12 Thread Suraj Upadhyay
On Mon, Jul 13, 2020 at 01:59:59PM +0900, Benjamin Poirier wrote:
> On 2020-07-11 18:16 +0530, Suraj Upadhyay wrote:
> > The legacy API wrappers in include/linux/pci-dma-compat.h
> > should go away as it creates unnecessary midlayering
> > for include/linux/dma-mapping.h APIs, instead use dma-mapping.h
> > APIs directly.
> > 
> > The patch has been generated with the coccinelle script below
> > and compile-tested.
> > 
> [...]
> > 
> > @@ expression E1, E2, E3, E4; @@
> > - pci_dma_sync_single_for_device(E1, E2, E3, E4)
> > + dma_sync_single_for_device(&E1->dev, E2, E3, (enum dma_data_direction)E4)
> 
> The qlge driver contains more usages of the deprecated pci_dma_* api
> than what this diff addresses. In particular, there are some calls to
> pci_dma_sync_single_for_cpu() which were not changed despite this
> expression being in the semantic patch.

Hii Ben,
I couldn't find any instances of pci_dma_sync_single_for_cpu in
the drivers/staging/qlge/ driver, I ran a simple `git grep 
pci_dma_sync_single_for_cpu/device`
and got nothing.
If I am wrong, please send the line number of the usages.

> Dunno what happened but it should be reviewed. After converting away
> from all of the old api, the TODO file should also be updated.

Thanks for reminding me this, I would send a follow up patch to remove
"pci_dma_*" from "avoid legacy/deprecated apis (ex. replace pci_dma_*, replace 
pci_enable_msi,
  use pci_iomap)".


Thanks and Cheers,

Suraj Upadhyay.
> [...]
> 
> > 
> > diff --git a/drivers/staging/qlge/qlge_mpi.c 
> > b/drivers/staging/qlge/qlge_mpi.c
> > index fa178fc642a6..16a9bf818346 100644
> > --- a/drivers/staging/qlge/qlge_mpi.c
> > +++ b/drivers/staging/qlge/qlge_mpi.c
> > @@ -788,8 +788,9 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void 
> > *buf,
> > char *my_buf;
> > dma_addr_t buf_dma;
> >  
> > -   my_buf = pci_alloc_consistent(qdev->pdev, word_count * sizeof(u32),
> > - &buf_dma);
> > +   my_buf = dma_alloc_coherent(&qdev->pdev->dev,
> > +   word_count * sizeof(u32), &buf_dma,
> > +   GFP_ATOMIC);
> > if (!my_buf)
> > return -EIO;
> >  
> > @@ -797,8 +798,8 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void 
> > *buf,
> > if (!status)
> > memcpy(buf, my_buf, word_count * sizeof(u32));
> >  
> > -   pci_free_consistent(qdev->pdev, word_count * sizeof(u32), my_buf,
> > -   buf_dma);
> > +   dma_free_coherent(&qdev->pdev->dev, word_count * sizeof(u32), my_buf,
> > + buf_dma);
> > return status;
> >  }
> >  
> > -- 
> > 2.17.1
> > 
> 
> 




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


Re: [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs.

2020-07-12 Thread Benjamin Poirier
On 2020-07-13 11:14 +0530, Suraj Upadhyay wrote:
> On Mon, Jul 13, 2020 at 01:59:59PM +0900, Benjamin Poirier wrote:
> > On 2020-07-11 18:16 +0530, Suraj Upadhyay wrote:
> > > The legacy API wrappers in include/linux/pci-dma-compat.h
> > > should go away as it creates unnecessary midlayering
> > > for include/linux/dma-mapping.h APIs, instead use dma-mapping.h
> > > APIs directly.
> > > 
> > > The patch has been generated with the coccinelle script below
> > > and compile-tested.
> > > 
> > [...]
> > > 
> > > @@ expression E1, E2, E3, E4; @@
> > > - pci_dma_sync_single_for_device(E1, E2, E3, E4)
> > > + dma_sync_single_for_device(&E1->dev, E2, E3, (enum 
> > > dma_data_direction)E4)
> > 
> > The qlge driver contains more usages of the deprecated pci_dma_* api
> > than what this diff addresses. In particular, there are some calls to
> > pci_dma_sync_single_for_cpu() which were not changed despite this
> > expression being in the semantic patch.
> 
> Hii Ben,
> I couldn't find any instances of pci_dma_sync_single_for_cpu in
> the drivers/staging/qlge/ driver, I ran a simple `git grep 
> pci_dma_sync_single_for_cpu/device`
> and got nothing.
> If I am wrong, please send the line number of the usages.

You're right, sorry. I was missing commit e955a071b9b3 ("staging: qlge:
replace deprecated apis pci_dma_*") in my tree.


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