diff mbox series

[3/8] parisc: turn GET_IOC into an inline function

Message ID 20190129181310.5557-4-hch@lst.de (mailing list archive)
State Accepted, archived
Headers show
Series [1/8] parisc: don't include <asm/cacheflush.h> in <asm/dma-mapping.h> | expand

Commit Message

Christoph Hellwig Jan. 29, 2019, 6:13 p.m. UTC
This makes the function both more readable and more typesafe.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/parisc/iommu.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/parisc/iommu.h b/drivers/parisc/iommu.h
index 5a38b635e963..d6fd3ab899ac 100644
--- a/drivers/parisc/iommu.h
+++ b/drivers/parisc/iommu.h
@@ -26,10 +26,14 @@  static inline void *parisc_walk_tree(struct device *dev)
 	return dev->platform_data;
 }
 
-#define GET_IOC(dev) ({					\
-	void *__pdata = parisc_walk_tree(dev);		\
-	__pdata ? HBA_DATA(__pdata)->iommu : NULL;	\
-})
+static inline struct ioc *GET_IOC(struct device *dev)
+{
+	struct pci_hba_data *pdata = parisc_walk_tree(dev);
+
+	if (!pdata)
+		return NULL;
+	return pdata->iommu;
+}
 
 #ifdef CONFIG_IOMMU_CCIO
 void *ccio_get_iommu(const struct parisc_device *dev);