Skip to content

Commit 77943f4

Browse files
rbmarliereawilliam
authored andcommitted
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>
1 parent 05f3a0b commit 77943f4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/vfio/mdev/mdev_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static int mdev_match(struct device *dev, struct device_driver *drv)
4040
return 0;
4141
}
4242

43-
struct bus_type mdev_bus_type = {
43+
const struct bus_type mdev_bus_type = {
4444
.name = "mdev",
4545
.probe = mdev_probe,
4646
.remove = mdev_remove,

drivers/vfio/mdev/mdev_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
int mdev_bus_register(void);
1414
void mdev_bus_unregister(void);
1515

16-
extern struct bus_type mdev_bus_type;
16+
extern const struct bus_type mdev_bus_type;
1717
extern const struct attribute_group *mdev_device_groups[];
1818

1919
#define to_mdev_type_attr(_attr) \

0 commit comments

Comments
 (0)