[6/7] driver core: make sysfs_dev_block_kobj static

Message ID 20230331093318.82288-6-gregkh@linuxfoundation.org
State New
Headers
Series [1/7] driver core: core: move to use class_to_subsys() |

Commit Message

Greg KH March 31, 2023, 9:33 a.m. UTC
  Nothing outside of drivers/base/core.c uses sysfs_dev_block_kobj, so
make it static and document what it is used for so we remember it the
next time we touch it 15 years from now.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/core.c          | 4 +++-
 include/linux/device/class.h | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Rafael J. Wysocki March 31, 2023, 2:50 p.m. UTC | #1
On Fri, Mar 31, 2023 at 11:33 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> Nothing outside of drivers/base/core.c uses sysfs_dev_block_kobj, so
> make it static and document what it is used for so we remember it the
> next time we touch it 15 years from now.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/core.c          | 4 +++-
>  include/linux/device/class.h | 2 --
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index dbc2ba6dfffc..cf6f41c2060c 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2256,7 +2256,9 @@ int (*platform_notify)(struct device *dev) = NULL;
>  int (*platform_notify_remove)(struct device *dev) = NULL;
>  static struct kobject *dev_kobj;
>  struct kobject *sysfs_dev_char_kobj;
> -struct kobject *sysfs_dev_block_kobj;
> +
> +/* /sys/dev/block */
> +static struct kobject *sysfs_dev_block_kobj;
>
>  static DEFINE_MUTEX(device_hotplug_lock);
>
> diff --git a/include/linux/device/class.h b/include/linux/device/class.h
> index e946642c314e..7e4a1a6329f4 100644
> --- a/include/linux/device/class.h
> +++ b/include/linux/device/class.h
> @@ -76,8 +76,6 @@ struct class_dev_iter {
>         const struct device_type        *type;
>  };
>
> -extern struct kobject *sysfs_dev_block_kobj;
> -
>  int __must_check class_register(struct class *class);
>  void class_unregister(const struct class *class);
>  bool class_is_registered(const struct class *class);
> --
> 2.40.0
>
  

Patch

diff --git a/drivers/base/core.c b/drivers/base/core.c
index dbc2ba6dfffc..cf6f41c2060c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2256,7 +2256,9 @@  int (*platform_notify)(struct device *dev) = NULL;
 int (*platform_notify_remove)(struct device *dev) = NULL;
 static struct kobject *dev_kobj;
 struct kobject *sysfs_dev_char_kobj;
-struct kobject *sysfs_dev_block_kobj;
+
+/* /sys/dev/block */
+static struct kobject *sysfs_dev_block_kobj;
 
 static DEFINE_MUTEX(device_hotplug_lock);
 
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index e946642c314e..7e4a1a6329f4 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -76,8 +76,6 @@  struct class_dev_iter {
 	const struct device_type	*type;
 };
 
-extern struct kobject *sysfs_dev_block_kobj;
-
 int __must_check class_register(struct class *class);
 void class_unregister(const struct class *class);
 bool class_is_registered(const struct class *class);