iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Russell King <linux@armlinux.org.uk>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
	Tony Lindgren <tony@atomide.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, linux-omap@vger.kernel.org,
	Robin Murphy <robin.murphy@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] ARM/dma-mapping: don't handle NULL devices in dma-direct.h
Date: Thu, 17 Sep 2020 19:32:28 +0200	[thread overview]
Message-ID: <20200917173229.3311382-4-hch@lst.de> (raw)
In-Reply-To: <20200917173229.3311382-1-hch@lst.de>

The DMA API removed support for not passing in a device a long time
ago, so remove the NULL checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/include/asm/dma-direct.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/dma-direct.h b/arch/arm/include/asm/dma-direct.h
index 1f04a5e1c615de..84cb4e30658891 100644
--- a/arch/arm/include/asm/dma-direct.h
+++ b/arch/arm/include/asm/dma-direct.h
@@ -11,7 +11,7 @@
  */
 static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn)
 {
-	if (dev && dev->dma_range_map)
+	if (dev->dma_range_map)
 		pfn = PFN_DOWN(translate_phys_to_dma(dev, PFN_PHYS(pfn)));
 	return (dma_addr_t)__pfn_to_phys(pfn);
 }
@@ -20,16 +20,13 @@ static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr)
 {
 	unsigned long pfn = __phys_to_pfn(addr);
 
-	if (dev && dev->dma_range_map)
+	if (dev->dma_range_map)
 		pfn = PFN_DOWN(translate_dma_to_phys(dev, PFN_PHYS(pfn)));
 	return pfn;
 }
 
 static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
 {
-	if (dev)
-		return pfn_to_dma(dev, virt_to_pfn(addr));
-
 	return (dma_addr_t)__virt_to_bus((unsigned long)(addr));
 }
 
-- 
2.28.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2020-09-17 17:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 17:32 RFC: remove the need for <asm/dma-direct.h> on ARM Christoph Hellwig
2020-09-17 17:32 ` [PATCH 1/4] ARM/omap1: switch to use dma_direct_set_offset for lbus DMA offsets Christoph Hellwig
2020-09-18  5:49   ` Tony Lindgren
2020-09-19 22:29     ` Janusz Krzysztofik
2020-09-21  6:44       ` Tony Lindgren
2020-09-21  6:47         ` Christoph Hellwig
2020-09-23 10:05           ` Russell King - ARM Linux admin
2020-09-25  4:16         ` Christoph Hellwig
2020-09-17 17:32 ` [PATCH 2/4] ARM/footbridge: " Christoph Hellwig
2020-09-17 18:53   ` Russell King - ARM Linux admin
2020-09-17 17:32 ` Christoph Hellwig [this message]
2020-09-17 18:50   ` [PATCH 3/4] ARM/dma-mapping: don't handle NULL devices in dma-direct.h Russell King - ARM Linux admin
2020-09-18  5:10     ` Christoph Hellwig
2020-09-17 17:32 ` [PATCH 4/4] ARM/dma-mapping: remove the arm specific phys to dma translation helpers 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=20200917173229.3311382-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=aaro.koskinen@iki.fi \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robin.murphy@arm.com \
    --cc=tony@atomide.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).