Skip to content

Commit 32f78ab

Browse files
committed
driver core: bus: constantify subsys_register() calls
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/2023121908-grove-genetics-f8af@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5ae8120 commit 32f78ab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/base/bus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ static void system_root_device_release(struct device *dev)
11941194
kfree(dev);
11951195
}
11961196

1197-
static int subsys_register(struct bus_type *subsys,
1197+
static int subsys_register(const struct bus_type *subsys,
11981198
const struct attribute_group **groups,
11991199
struct kobject *parent_of_root)
12001200
{
@@ -1264,7 +1264,7 @@ static int subsys_register(struct bus_type *subsys,
12641264
* directory itself and not some create fake root-device placed in
12651265
* /sys/devices/system/<name>.
12661266
*/
1267-
int subsys_system_register(struct bus_type *subsys,
1267+
int subsys_system_register(const struct bus_type *subsys,
12681268
const struct attribute_group **groups)
12691269
{
12701270
return subsys_register(subsys, groups, &system_kset->kobj);
@@ -1282,7 +1282,7 @@ EXPORT_SYMBOL_GPL(subsys_system_register);
12821282
* There's no restriction on device naming. This is for kernel software
12831283
* constructs which need sysfs interface.
12841284
*/
1285-
int subsys_virtual_register(struct bus_type *subsys,
1285+
int subsys_virtual_register(const struct bus_type *subsys,
12861286
const struct attribute_group **groups)
12871287
{
12881288
struct kobject *virtual_dir;

include/linux/device.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct msi_device_data;
6363
*/
6464
struct subsys_interface {
6565
const char *name;
66-
struct bus_type *subsys;
66+
const struct bus_type *subsys;
6767
struct list_head node;
6868
int (*add_dev)(struct device *dev, struct subsys_interface *sif);
6969
void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
@@ -72,9 +72,9 @@ struct subsys_interface {
7272
int subsys_interface_register(struct subsys_interface *sif);
7373
void subsys_interface_unregister(struct subsys_interface *sif);
7474

75-
int subsys_system_register(struct bus_type *subsys,
75+
int subsys_system_register(const struct bus_type *subsys,
7676
const struct attribute_group **groups);
77-
int subsys_virtual_register(struct bus_type *subsys,
77+
int subsys_virtual_register(const struct bus_type *subsys,
7878
const struct attribute_group **groups);
7979

8080
/*

0 commit comments

Comments
 (0)