All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Upadhyay <usuraj35@gmail.com>
To: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: devel@driverdev.osuosl.org, netdev@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs.
Date: Mon, 13 Jul 2020 05:56:24 +0000	[thread overview]
Message-ID: <20200713054424.GD12262@blackclown> (raw)
In-Reply-To: <20200713045959.GA7563@f3>

[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]

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
> > 
> 
> 



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Suraj Upadhyay <usuraj35@gmail.com>
To: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: netdev@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs.
Date: Mon, 13 Jul 2020 11:14:24 +0530	[thread overview]
Message-ID: <20200713054424.GD12262@blackclown> (raw)
In-Reply-To: <20200713045959.GA7563@f3>

[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]

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
> > 
> 
> 



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-07-13  5:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11 12:46 [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs Suraj Upadhyay
2020-07-11 12:58 ` Suraj Upadhyay
2020-07-13  4:59 ` Benjamin Poirier
2020-07-13  4:59   ` Benjamin Poirier
2020-07-13  5:44   ` Suraj Upadhyay [this message]
2020-07-13  5:56     ` Suraj Upadhyay
2020-07-13  6:48     ` Benjamin Poirier
2020-07-13  6:48       ` Benjamin Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200713054424.GD12262@blackclown \
    --to=usuraj35@gmail.com \
    --cc=benjamin.poirier@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.