Skip to contentSkip to conversation

driver core: move dev_has_sync_state() to drivers/base/base.h

PATCH Applied Danilo Krummrich 3 participants 4 messages Apr 20 – Apr 28 Driver core

lore
Share & tools
lore

Danilo Krummrich

author maintainer
#0 lore raw

PATCH 1/1 driver core: move dev_has_sync_state() to drivers/base/base.h

All callers of dev_has_sync_state() are in drivers/base/ and any attempt to use it outside of driver-core should require good justification, so there is no need to have it defined in include/linux/device.h.

Thus, move it to drivers/base/base.h.

---
Goes on top of [1].

[1] https://lore.kernel.org/driver-core/[email protected]/

---
 drivers/base/base.h    | 14 ++++++++++++++
 include/linux/device.h | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/base/base.h +14 -0
index 1af95ac68b77..f3c615c9198b 100644
@@ -185,6 +185,20 @@ static inline int driver_match_device(const struct device_driver *drv,
 	return drv->bus->match ? drv->bus->match(dev, drv) : 1;
 }
 
+static inline bool dev_has_sync_state(struct device *dev)
+{
+	struct device_driver *drv;
+
+	if (!dev)
+		return false;
+	drv = READ_ONCE(dev->driver);
+	if (drv && drv->sync_state)
+		return true;
+	if (dev->bus && dev->bus->sync_state)
+		return true;
+	return false;
+}
+
 static inline void dev_sync_state(struct device *dev)
 {
 	if (dev->bus->sync_state)
include/linux/device.h +0 -14
index 4c1c9cb8570a..82823f807f56 100644
@@ -1016,20 +1016,6 @@ static inline void device_lock_assert(struct device *dev)
 	lockdep_assert_held(&dev->mutex);
 }
 
-static inline bool dev_has_sync_state(struct device *dev)
-{
-	struct device_driver *drv;
-
-	if (!dev)
-		return false;
-	drv = READ_ONCE(dev->driver);
-	if (drv && drv->sync_state)
-		return true;
-	if (dev->bus && dev->bus->sync_state)
-		return true;
-	return false;
-}
-
 static inline int dev_set_drv_sync_state(struct device *dev,
 					 void (*fn)(struct device *dev))
 {
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Danilo Krummrich

All callers of dev_has_sync_state() are in drivers/base/ and any attempt to use it outside of driver-core should require good justification, so there is no need to have it defined in include/linux/device.h.

Thus, move it to drivers/base/base.h.

Quoted 8 lines

---
Goes on top of [1].

[1] https://lore.kernel.org/driver-core/[email protected]/

---
 drivers/base/base.h    | 14 ++++++++++++++
 include/linux/device.h | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Danilo Krummrich
Quoted 10 lines · Danilo Krummrich

All callers of dev_has_sync_state() are in drivers/base/ and any attempt to use it outside of driver-core should require good justification, so there is no need to have it defined in include/linux/device.h.

Thus, move it to drivers/base/base.h.

Quoted 62 lines

---
Goes on top of [1].

[1] https://lore.kernel.org/driver-core/[email protected]/

---
 drivers/base/base.h    | 14 ++++++++++++++
 include/linux/device.h | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/base/base.h +14 -0
index 1af95ac68b77..f3c615c9198b 100644
@@ -185,6 +185,20 @@ static inline int driver_match_device(const struct device_driver *drv,
        return drv->bus->match ? drv->bus->match(dev, drv) : 1;
 }
 
+static inline bool dev_has_sync_state(struct device *dev)
+{
+       struct device_driver *drv;
+
+       if (!dev)
+               return false;
+       drv = READ_ONCE(dev->driver);
+       if (drv && drv->sync_state)
+               return true;
+       if (dev->bus && dev->bus->sync_state)
+               return true;
+       return false;
+}
+
 static inline void dev_sync_state(struct device *dev)
 {
        if (dev->bus->sync_state)
include/linux/device.h +0 -15
index 4c1c9cb8570a..82823f807f56 100644
@@ -1016,20 +1016,6 @@ static inline void device_lock_assert(struct device *dev)
        lockdep_assert_held(&dev->mutex);
 }
 
-static inline bool dev_has_sync_state(struct device *dev)
-{
-       struct device_driver *drv;
-
-       if (!dev)
-               return false;
-       drv = READ_ONCE(dev->driver);
-       if (drv && drv->sync_state)
-               return true;
-       if (dev->bus && dev->bus->sync_state)
-               return true;
-       return false;
-}
-
 static inline int dev_set_drv_sync_state(struct device *dev,
                                         void (*fn)(struct device *dev))
 {
--

2.53.0

author maintainer Applied
#3 lore raw
In reply to Danilo Krummrich
Quoted 1 line · Danilo Krummrich

[PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h

Applied, thanks!

Branch: driver-core-testing
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/1] driver core: move dev_has_sync_state() to drivers/base/base.h

      commit: 9db268212e0d

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is in the driver-core-testing branch and will be promoted to driver-core-next after validation.