linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@lst.de>,
	linux-kernel@vger.kernel.org, m.szyprowski@samsung.com
Subject: Re: [PATCH 2/2] dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags
Date: Wed, 28 Jun 2017 15:41:38 +0100	[thread overview]
Message-ID: <94b09ceb-5f6e-ba85-4a07-115821b5dd2d@arm.com> (raw)
In-Reply-To: <20170627201727.9008-3-hch@lst.de>

On 27/06/17 21:17, Christoph Hellwig wrote:
> DMA_MEMORY_IO was never used in the tree, so remove it.  That means there is
> no need for the DMA_MEMORY_MAP flag either now, so remove it as well and
> change dma_declare_coherent_memory to return a normal errno value.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

[...]

> diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
> index 10e7c022e8cf..b96bfffd314e 100644
> --- a/drivers/base/dma-mapping.c
> +++ b/drivers/base/dma-mapping.c
> @@ -176,13 +176,10 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
>  
>  	rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size,
>  					 flags);
> -	if (rc) {
> +	if (rc)

if (!rc)

>  		devres_add(dev, res);
> -		rc = 0;
> -	} else {
> +	else
>  		devres_free(res);
> -		rc = -ENOMEM;
> -	}
>  
>  	return rc;
>  }

[...]

> diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
> index a8b8d8b8d9f3..21302a0f82e2 100644
> --- a/drivers/usb/host/ohci-sm501.c
> +++ b/drivers/usb/host/ohci-sm501.c
> @@ -123,11 +123,11 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
>  	 * regular memory. The HCD_LOCAL_MEM flag does just that.
>  	 */
>  
> -	if (!dma_declare_coherent_memory(dev, mem->start,
> +	retval = dma_declare_coherent_memory(dev, mem->start,
>  					 mem->start - mem->parent->start,
>  					 resource_size(mem),
> -					 DMA_MEMORY_MAP |
> -					 DMA_MEMORY_EXCLUSIVE)) {
> +					 DMA_MEMORY_EXCLUSIVE);
> +	if (retval) {
>  		dev_err(dev, "cannot declare coherent memory\n");
>  		retval = -ENXIO;

It looks like we could just let retval propagate here, rather than
rewriting it, since we're only bailing out of a probe routine.

Robin.

>  		goto err1;

  reply	other threads:[~2017-06-28 14:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 20:17 clean up dma_declare_coherent_memory calling conventions Christoph Hellwig
2017-06-27 20:17 ` [PATCH 1/2] dma-coherent: remove the DMA_MEMORY_INCLUDES_CHILDREN flag Christoph Hellwig
2017-06-28 14:34   ` Robin Murphy
2017-06-27 20:17 ` [PATCH 2/2] dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags Christoph Hellwig
2017-06-28 14:41   ` Robin Murphy [this message]
2017-08-26  7:26 clean up dma_declare_coherent_memory calling conventions V2 Christoph Hellwig
2017-08-26  7:26 ` [PATCH 2/2] dma-coherent: remove the DMA_MEMORY_MAP and DMA_MEMORY_IO flags Christoph Hellwig
2017-09-01  7:53   ` Christoph Hellwig
2017-09-01  8:19   ` Marek Szyprowski
2017-09-01  9:37     ` Christoph Hellwig

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=94b09ceb-5f6e-ba85-4a07-115821b5dd2d@arm.com \
    --to=robin.murphy@arm.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.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).