Skip to content

Commit

Permalink
driver core: bus: constantify subsys_register() calls
Browse files Browse the repository at this point in the history
The functions subsys_register() and subsys_virtual_register() should be
taking a constant pointer to a struct bus_type, as they do not actually
modify anything in it, so fix up the function definitions to do so
properly.

This also changes the pointer type in struct subsys_interface to be
constant as well, as again, that's the proper signature of it.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/2023121908-grove-genetics-f8af@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Greg Kroah-Hartman committed Dec 21, 2023
1 parent 5ae8120 commit 32f78ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions drivers/base/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ static void system_root_device_release(struct device *dev)
kfree(dev);
}

static int subsys_register(struct bus_type *subsys,
static int subsys_register(const struct bus_type *subsys,
const struct attribute_group **groups,
struct kobject *parent_of_root)
{
Expand Down Expand Up @@ -1264,7 +1264,7 @@ static int subsys_register(struct bus_type *subsys,
* directory itself and not some create fake root-device placed in
* /sys/devices/system/<name>.
*/
int subsys_system_register(struct bus_type *subsys,
int subsys_system_register(const struct bus_type *subsys,
const struct attribute_group **groups)
{
return subsys_register(subsys, groups, &system_kset->kobj);
Expand All @@ -1282,7 +1282,7 @@ EXPORT_SYMBOL_GPL(subsys_system_register);
* There's no restriction on device naming. This is for kernel software
* constructs which need sysfs interface.
*/
int subsys_virtual_register(struct bus_type *subsys,
int subsys_virtual_register(const struct bus_type *subsys,
const struct attribute_group **groups)
{
struct kobject *virtual_dir;
Expand Down
6 changes: 3 additions & 3 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct msi_device_data;
*/
struct subsys_interface {
const char *name;
struct bus_type *subsys;
const struct bus_type *subsys;
struct list_head node;
int (*add_dev)(struct device *dev, struct subsys_interface *sif);
void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
Expand All @@ -72,9 +72,9 @@ struct subsys_interface {
int subsys_interface_register(struct subsys_interface *sif);
void subsys_interface_unregister(struct subsys_interface *sif);

int subsys_system_register(struct bus_type *subsys,
int subsys_system_register(const struct bus_type *subsys,
const struct attribute_group **groups);
int subsys_virtual_register(struct bus_type *subsys,
int subsys_virtual_register(const struct bus_type *subsys,
const struct attribute_group **groups);

/*
Expand Down

0 comments on commit 32f78ab

Please sign in to comment.