Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfio: mdev: make mdev_bus_type const

Now that the driver core can properly handle constant struct bus_type,
move the mdev_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Link: https://lore.kernel.org/r/20240208-bus_cleanup-vfio-v1-1-ed5da3019949@marliere.net
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

authored by

Ricardo B. Marliere and committed by
Alex Williamson
77943f4d 05f3a0bd

+2 -2
+1 -1
drivers/vfio/mdev/mdev_driver.c
··· 40 40 return 0; 41 41 } 42 42 43 - struct bus_type mdev_bus_type = { 43 + const struct bus_type mdev_bus_type = { 44 44 .name = "mdev", 45 45 .probe = mdev_probe, 46 46 .remove = mdev_remove,
+1 -1
drivers/vfio/mdev/mdev_private.h
··· 13 13 int mdev_bus_register(void); 14 14 void mdev_bus_unregister(void); 15 15 16 - extern struct bus_type mdev_bus_type; 16 + extern const struct bus_type mdev_bus_type; 17 17 extern const struct attribute_group *mdev_device_groups[]; 18 18 19 19 #define to_mdev_type_attr(_attr) \