public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h
@ 2026-04-20 23:40 Danilo Krummrich
  2026-04-21  6:30 ` Greg KH
  2026-04-21 13:15 ` Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Danilo Krummrich @ 2026-04-20 23:40 UTC (permalink / raw)
  To: gregkh, rafael; +Cc: driver-core, linux-kernel, 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.

Suggested-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Link: https://lore.kernel.org/driver-core/CAJZ5v0jkm9K9=-U_51FMsyxN2msdouRnz4sEjmxG0Btd6Hmw0w@mail.gmail.com/
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
Goes on top of [1].

[1] https://lore.kernel.org/driver-core/20260418162221.1121873-1-dakr@kernel.org/
---
 drivers/base/base.h    | 14 ++++++++++++++
 include/linux/device.h | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index 1af95ac68b77..f3c615c9198b 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -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)
diff --git a/include/linux/device.h b/include/linux/device.h
index 4c1c9cb8570a..82823f807f56 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h
  2026-04-20 23:40 [PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h Danilo Krummrich
@ 2026-04-21  6:30 ` Greg KH
  2026-04-21 13:15 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-04-21  6:30 UTC (permalink / raw)
  To: Danilo Krummrich; +Cc: rafael, driver-core, linux-kernel

On Tue, Apr 21, 2026 at 01:40:44AM +0200, Danilo Krummrich wrote:
> 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/
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
> Goes on top of [1].
> 
> [1] https://lore.kernel.org/driver-core/20260418162221.1121873-1-dakr@kernel.org/
> ---
>  drivers/base/base.h    | 14 ++++++++++++++
>  include/linux/device.h | 14 --------------
>  2 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h
  2026-04-20 23:40 [PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h Danilo Krummrich
  2026-04-21  6:30 ` Greg KH
@ 2026-04-21 13:15 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2026-04-21 13:15 UTC (permalink / raw)
  To: Danilo Krummrich; +Cc: gregkh, rafael, driver-core, linux-kernel

On Tue, Apr 21, 2026 at 1:41 AM Danilo Krummrich <dakr@kernel.org> wrote:
>
> 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/
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>

Reviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>

> ---
> Goes on top of [1].
>
> [1] https://lore.kernel.org/driver-core/20260418162221.1121873-1-dakr@kernel.org/
> ---
>  drivers/base/base.h    | 14 ++++++++++++++
>  include/linux/device.h | 14 --------------
>  2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/base/base.h b/drivers/base/base.h
> index 1af95ac68b77..f3c615c9198b 100644
> --- a/drivers/base/base.h
> +++ b/drivers/base/base.h
> @@ -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)
> diff --git a/include/linux/device.h b/include/linux/device.h
> index 4c1c9cb8570a..82823f807f56 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-21 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 23:40 [PATCH] driver core: move dev_has_sync_state() to drivers/base/base.h Danilo Krummrich
2026-04-21  6:30 ` Greg KH
2026-04-21 13:15 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox