]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
driver core: move dev_has_sync_state() to drivers/base/base.h
authorDanilo Krummrich <dakr@kernel.org>
Mon, 20 Apr 2026 23:40:44 +0000 (01:40 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 28 Apr 2026 22:38:54 +0000 (00:38 +0200)
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.

Suggested-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Link: https://lore.kernel.org/driver-core/CAJZ5v0jkm9K9=-U_51FMsyxN2msdouRnz4sEjmxG0Btd6Hmw0w@mail.gmail.com/
Reviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260420234153.2898532-1-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/base/base.h
include/linux/device.h

index 30b416588617bbc3fb433654c999c9b533d73752..0ed1e278b957f7f1e9eea70b500aa12103140dcd 100644 (file)
@@ -188,6 +188,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)
index 56a96e41d2c90570772fba05768e2cf00f643dc9..d54c86d7776456f733ca6e44c47d032cdbab50d6 100644 (file)
@@ -1061,20 +1061,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))
 {