kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
	Alex Dubov <oakad@yahoo.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] memstick: switch from 'pci_' to 'dma_' API
Date: Tue, 24 Aug 2021 16:56:45 +0200	[thread overview]
Message-ID: <CAPDyKFr5_MqtbXsk9JWf+oYSFW+uU+W4otq-hu+ZYKq_p+Bokw@mail.gmail.com> (raw)
In-Reply-To: <f6fe24f2372c8c627a08ace7187bfe60d35788b6.1629580314.git.christophe.jaillet@wanadoo.fr>

On Sat, 21 Aug 2021 at 23:13, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> The wrappers in include/linux/pci-dma-compat.h should go away.
>
> The patch has been generated with the coccinelle script below.
> It has been compile tested.
>
> No memory allocation in involved in this patch, so no GFP_ tweak is needed.
>
> @@ @@
> -    PCI_DMA_BIDIRECTIONAL
> +    DMA_BIDIRECTIONAL
>
> @@ @@
> -    PCI_DMA_TODEVICE
> +    DMA_TO_DEVICE
>
> @@ @@
> -    PCI_DMA_FROMDEVICE
> +    DMA_FROM_DEVICE
>
> @@ @@
> -    PCI_DMA_NONE
> +    DMA_NONE
>
> @@
> expression e1, e2, e3;
> @@
> -    pci_alloc_consistent(e1, e2, e3)
> +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
>
> @@
> expression e1, e2, e3;
> @@
> -    pci_zalloc_consistent(e1, e2, e3)
> +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_free_consistent(e1, e2, e3, e4)
> +    dma_free_coherent(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_map_single(e1, e2, e3, e4)
> +    dma_map_single(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_unmap_single(e1, e2, e3, e4)
> +    dma_unmap_single(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4, e5;
> @@
> -    pci_map_page(e1, e2, e3, e4, e5)
> +    dma_map_page(&e1->dev, e2, e3, e4, e5)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_unmap_page(e1, e2, e3, e4)
> +    dma_unmap_page(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_map_sg(e1, e2, e3, e4)
> +    dma_map_sg(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_unmap_sg(e1, e2, e3, e4)
> +    dma_unmap_sg(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
> +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
> +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
> +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2, e3, e4;
> @@
> -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
> +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
>
> @@
> expression e1, e2;
> @@
> -    pci_dma_mapping_error(e1, e2)
> +    dma_mapping_error(&e1->dev, e2)
>
> @@
> expression e1, e2;
> @@
> -    pci_set_dma_mask(e1, e2)
> +    dma_set_mask(&e1->dev, e2)
>
> @@
> expression e1, e2;
> @@
> -    pci_set_consistent_dma_mask(e1, e2)
> +    dma_set_coherent_mask(&e1->dev, e2)
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied for next, thanks!

Kind regards
Uffe


> ---
> If needed, see post from Christoph Hellwig on the kernel-janitors ML:
>    https://marc.info/?l=kernel-janitors&m=158745678307186&w=4
> ---
>  drivers/memstick/host/r592.c    |  5 ++---
>  drivers/memstick/host/tifm_ms.c | 12 ++++++------
>  2 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
> index 615a83782e55..7ed984360349 100644
> --- a/drivers/memstick/host/r592.c
> +++ b/drivers/memstick/host/r592.c
> @@ -293,7 +293,7 @@ static int r592_transfer_fifo_dma(struct r592_device *dev)
>
>         /* TODO: hidden assumption about nenth beeing always 1 */
>         sg_count = dma_map_sg(&dev->pci_dev->dev, &dev->req->sg, 1, is_write ?
> -               PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
> +                             DMA_TO_DEVICE : DMA_FROM_DEVICE);
>
>         if (sg_count != 1 || sg_dma_len(&dev->req->sg) < R592_LFIFO_SIZE) {
>                 message("problem in dma_map_sg");
> @@ -310,8 +310,7 @@ static int r592_transfer_fifo_dma(struct r592_device *dev)
>         }
>
>         dma_unmap_sg(&dev->pci_dev->dev, &dev->req->sg, 1, is_write ?
> -               PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
> -
> +                    DMA_TO_DEVICE : DMA_FROM_DEVICE);
>
>         return dev->dma_error;
>  }
> diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
> index 57145374f6ac..c272453670be 100644
> --- a/drivers/memstick/host/tifm_ms.c
> +++ b/drivers/memstick/host/tifm_ms.c
> @@ -279,8 +279,8 @@ static int tifm_ms_issue_cmd(struct tifm_ms *host)
>         if (host->use_dma) {
>                 if (1 != tifm_map_sg(sock, &host->req->sg, 1,
>                                      host->req->data_dir == READ
> -                                    ? PCI_DMA_FROMDEVICE
> -                                    : PCI_DMA_TODEVICE)) {
> +                                    ? DMA_FROM_DEVICE
> +                                    : DMA_TO_DEVICE)) {
>                         host->req->error = -ENOMEM;
>                         return host->req->error;
>                 }
> @@ -350,8 +350,8 @@ static void tifm_ms_complete_cmd(struct tifm_ms *host)
>         if (host->use_dma) {
>                 tifm_unmap_sg(sock, &host->req->sg, 1,
>                               host->req->data_dir == READ
> -                             ? PCI_DMA_FROMDEVICE
> -                             : PCI_DMA_TODEVICE);
> +                             ? DMA_FROM_DEVICE
> +                             : DMA_TO_DEVICE);
>         }
>
>         writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL),
> @@ -607,8 +607,8 @@ static void tifm_ms_remove(struct tifm_dev *sock)
>                 if (host->use_dma)
>                         tifm_unmap_sg(sock, &host->req->sg, 1,
>                                       host->req->data_dir == READ
> -                                     ? PCI_DMA_TODEVICE
> -                                     : PCI_DMA_FROMDEVICE);
> +                                     ? DMA_TO_DEVICE
> +                                     : DMA_FROM_DEVICE);
>                 host->req->error = -ETIME;
>
>                 do {
> --
> 2.30.2
>

      reply	other threads:[~2021-08-24 14:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 21:13 [PATCH] memstick: switch from 'pci_' to 'dma_' API Christophe JAILLET
2021-08-24 14:56 ` Ulf Hansson [this message]

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=CAPDyKFr5_MqtbXsk9JWf+oYSFW+uU+W4otq-hu+ZYKq_p+Bokw@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=oakad@yahoo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).