driver core: move sysfs_dev_char_kobj out of class.h

Message ID 20230327160319.513974-1-gregkh@linuxfoundation.org
State New
Headers
Series driver core: move sysfs_dev_char_kobj out of class.h |

Commit Message

Greg KH March 27, 2023, 4:03 p.m. UTC
  The structure sysfs_dev_char_kobj is local only to the driver core code,
so move it out of the global class.h file and into the internal base.h
file as no one else should be touching this symbol.

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

Comments

Rafael J. Wysocki March 27, 2023, 4:18 p.m. UTC | #1
On Mon, Mar 27, 2023 at 6:03 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> The structure sysfs_dev_char_kobj is local only to the driver core code,
> so move it out of the global class.h file and into the internal base.h
> file as no one else should be touching this symbol.

Good idea.

> 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 +++
>  include/linux/device/class.h | 1 -
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/base.h b/drivers/base/base.h
> index 6659cf1d3a44..6296164bb7f3 100644
> --- a/drivers/base/base.h
> +++ b/drivers/base/base.h
> @@ -191,6 +191,9 @@ 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/include/linux/device/class.h b/include/linux/device/class.h
> index af7fefc39364..f7aad64e256a 100644
> --- a/include/linux/device/class.h
> +++ b/include/linux/device/class.h
> @@ -79,7 +79,6 @@ struct class_dev_iter {
>  };
>
>  extern struct kobject *sysfs_dev_block_kobj;
> -extern struct kobject *sysfs_dev_char_kobj;
>
>  int __must_check class_register(struct class *class);
>  void class_unregister(const struct class *class);
> --
> 2.40.0
>
  

Patch

diff --git a/drivers/base/base.h b/drivers/base/base.h
index 6659cf1d3a44..6296164bb7f3 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -191,6 +191,9 @@  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/include/linux/device/class.h b/include/linux/device/class.h
index af7fefc39364..f7aad64e256a 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -79,7 +79,6 @@  struct class_dev_iter {
 };
 
 extern struct kobject *sysfs_dev_block_kobj;
-extern struct kobject *sysfs_dev_char_kobj;
 
 int __must_check class_register(struct class *class);
 void class_unregister(const struct class *class);