]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: bus: make acpi_bus_type const
authorRicardo B. Marliere <ricardo@marliere.net>
Sun, 11 Feb 2024 15:37:11 +0000 (12:37 -0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 12 Feb 2024 13:42:48 +0000 (14:42 +0100)
Now that the driver core can properly handle constant struct bus_type,
move the acpi_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/bus.c
include/acpi/acpi_bus.h

index 569bd15f211be9d190dc557820ffedbf5ee8a046..d9fa730416f1910b03ab07dfe7145db5acf5b0eb 100644 (file)
@@ -1097,7 +1097,7 @@ static void acpi_device_remove(struct device *dev)
        put_device(dev);
 }
 
-struct bus_type acpi_bus_type = {
+const struct bus_type acpi_bus_type = {
        .name           = "acpi",
        .match          = acpi_bus_match,
        .probe          = acpi_device_probe,
index e4d24d3f9abb5e20fcf24f3b6bf88c8d6e632108..f67aa93ba53ed656d15befa7255e42352745a46a 100644 (file)
@@ -582,7 +582,7 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
                                void (*uevent)(struct acpi_device *, u32));
 
 /* acpi_device.dev.bus == &acpi_bus_type */
-extern struct bus_type acpi_bus_type;
+extern const struct bus_type acpi_bus_type;
 
 int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
 int acpi_dev_for_each_child(struct acpi_device *adev,