[PATCH] driver: move some inline getters for struct device into device.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The purpose of device.h is to contain only the device related
definitions and have as few header dependencies as possible.

dev_of_node() and dev_is_dma_coherent() are accessors for struct device
and have no other dependencies, so move them into this header as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/device.h | 21 +++++++++++++++++++++
 include/driver.h | 21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/device.h b/include/device.h
index 8c3561e5a2f6..ad1bc7ca1eea 100644
--- a/include/device.h
+++ b/include/device.h
@@ -108,4 +108,25 @@ struct device_alias {
 	char name[];
 };
 
+static inline struct device_node *dev_of_node(struct device *dev)
+{
+	return IS_ENABLED(CONFIG_OFDEVICE) ? dev->of_node : NULL;
+}
+
+static inline bool dev_is_dma_coherent(struct device *dev)
+{
+	if (dev) {
+		switch (dev->dma_coherent) {
+		case DEV_DMA_NON_COHERENT:
+			return false;
+		case DEV_DMA_COHERENT:
+			return true;
+		case DEV_DMA_COHERENCE_DEFAULT:
+			break;
+		}
+	}
+
+	return IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT);
+}
+
 #endif
diff --git a/include/driver.h b/include/driver.h
index 3401ab4f07f4..100761c7657e 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -677,27 +677,6 @@ int device_match_of_modalias(struct device *dev, struct driver *drv);
 struct device *device_find_child(struct device *parent, void *data,
 				 int (*match)(struct device *dev, void *data));
 
-static inline struct device_node *dev_of_node(struct device *dev)
-{
-	return IS_ENABLED(CONFIG_OFDEVICE) ? dev->of_node : NULL;
-}
-
-static inline bool dev_is_dma_coherent(struct device *dev)
-{
-	if (dev) {
-		switch (dev->dma_coherent) {
-		case DEV_DMA_NON_COHERENT:
-			return false;
-		case DEV_DMA_COHERENT:
-			return true;
-		case DEV_DMA_COHERENCE_DEFAULT:
-			break;
-		}
-	}
-
-	return IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT);
-}
-
 static inline void *dev_get_priv(const struct device *dev)
 {
 	return dev->priv;
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux