[7/7] driver core: make sysfs_dev_char_kobj static

Message ID 20230331093318.82288-7-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_char_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/base.h | 3 ---
 drivers/base/core.c | 4 +++-
 2 files changed, 3 insertions(+), 4 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_char_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/base.h | 3 ---
>  drivers/base/core.c | 4 +++-
>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/base.h b/drivers/base/base.h
> index 4660e1159ee0..e96f3343fd7c 100644
> --- a/drivers/base/base.h
> +++ b/drivers/base/base.h
> @@ -191,9 +191,6 @@ const char *device_get_devnode(const struct device *dev, umode_t *mode,
>  extern struct kset *devices_kset;
>  void devices_kset_move_last(struct device *dev);
>
> -/* /sys/dev/char directory */
> -extern struct kobject *sysfs_dev_char_kobj;
> -
>  #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
>  void module_add_driver(struct module *mod, struct device_driver *drv);
>  void module_remove_driver(struct device_driver *drv);
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index cf6f41c2060c..47e16c088e77 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2255,7 +2255,9 @@ static void fw_devlink_link_device(struct device *dev)
>  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;
> +
> +/* /sys/dev/char */
> +static struct kobject *sysfs_dev_char_kobj;
>
>  /* /sys/dev/block */
>  static struct kobject *sysfs_dev_block_kobj;
> --
> 2.40.0
>
  

Patch

diff --git a/drivers/base/base.h b/drivers/base/base.h
index 4660e1159ee0..e96f3343fd7c 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -191,9 +191,6 @@  const char *device_get_devnode(const struct device *dev, umode_t *mode,
 extern struct kset *devices_kset;
 void devices_kset_move_last(struct device *dev);
 
-/* /sys/dev/char directory */
-extern struct kobject *sysfs_dev_char_kobj;
-
 #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
 void module_add_driver(struct module *mod, struct device_driver *drv);
 void module_remove_driver(struct device_driver *drv);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index cf6f41c2060c..47e16c088e77 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2255,7 +2255,9 @@  static void fw_devlink_link_device(struct device *dev)
 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;
+
+/* /sys/dev/char */
+static struct kobject *sysfs_dev_char_kobj;
 
 /* /sys/dev/block */
 static struct kobject *sysfs_dev_block_kobj;