peci: Make peci_bus_type const
authorRicardo B. Marliere <ricardo@marliere.net>
Sat, 10 Feb 2024 15:10:14 +0000 (12:10 -0300)
committerIwona Winiarska <iwona.winiarska@intel.com>
Mon, 15 Apr 2024 22:14:36 +0000 (00:14 +0200)
Now that the driver core can properly handle constant struct bus_type,
move the peci_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>
Link: https://lore.kernel.org/r/20240210-bus_cleanup-peci-v1-1-1e64bef6efc0@marliere.net
Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
drivers/peci/core.c
drivers/peci/internal.h

index 0f83a9c6093bc2b01f0f0cdd7f70772305cdafd0..b2f8db967e9b5daaacd92c7c062a35073cd9465b 100644 (file)
@@ -201,7 +201,7 @@ static void peci_bus_device_remove(struct device *dev)
                driver->remove(device);
 }
 
-struct bus_type peci_bus_type = {
+const struct bus_type peci_bus_type = {
        .name           = "peci",
        .match          = peci_bus_device_match,
        .probe          = peci_bus_device_probe,
index 9d75ea54504c3612f8588496fa8f71e39466eac5..8a896c256c5f2af8f4a326544af2346683a6d6d3 100644 (file)
@@ -81,7 +81,7 @@ extern const struct attribute_group *peci_device_groups[];
 int peci_device_create(struct peci_controller *controller, u8 addr);
 void peci_device_destroy(struct peci_device *device);
 
-extern struct bus_type peci_bus_type;
+extern const struct bus_type peci_bus_type;
 extern const struct attribute_group *peci_bus_groups[];
 
 /**