PNP: make pnp_bus_type const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 12:51:21 +0000 (13:51 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 9 Jan 2024 14:00:09 +0000 (15:00 +0100)
Now that the driver core can properly handle constant struct bus_type,
move the pnp_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pnp/driver.c
include/linux/pnp.h

index 46c534f6b1c974c32379c3089e325439c4316847..0a5d0d8befa8408d02b3eaaf278d6a936a83e102 100644 (file)
@@ -256,7 +256,7 @@ static const struct dev_pm_ops pnp_bus_dev_pm_ops = {
        .restore = pnp_bus_resume,
 };
 
-struct bus_type pnp_bus_type = {
+const struct bus_type pnp_bus_type = {
        .name    = "pnp",
        .match   = pnp_bus_match,
        .probe   = pnp_device_probe,
index 267fb8a4fb6e081c8627c130610acca86638be7d..ddbe7c3ca4ce2a582b48bf3af305d20135889044 100644 (file)
@@ -435,7 +435,7 @@ struct pnp_protocol {
 #define protocol_for_each_dev(protocol, dev)   \
        list_for_each_entry(dev, &(protocol)->devices, protocol_list)
 
-extern struct bus_type pnp_bus_type;
+extern const struct bus_type pnp_bus_type;
 
 #if defined(CONFIG_PNP)