dmaengine: idxd: make dsa_bus_type const
authorRicardo B. Marliere <ricardo@marliere.net>
Tue, 13 Feb 2024 14:43:15 +0000 (11:43 -0300)
committerVinod Koul <vkoul@kernel.org>
Fri, 16 Feb 2024 12:17:37 +0000 (17:47 +0530)
Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the dsa_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: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240213-bus_cleanup-idxd-v1-1-c3e703675387@marliere.net
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/idxd/bus.c
drivers/dma/idxd/idxd.h

index 0c9e689a2e77dbdfdc3cd807869ec5bef957de5d..b83b27e04f2a410e6ce14db8d398df17c84a1c02 100644 (file)
@@ -72,7 +72,7 @@ static int idxd_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
        return add_uevent_var(env, "MODALIAS=" IDXD_DEVICES_MODALIAS_FMT, 0);
 }
 
-struct bus_type dsa_bus_type = {
+const struct bus_type dsa_bus_type = {
        .name = "dsa",
        .match = idxd_config_bus_match,
        .probe = idxd_config_bus_probe,
index 47de3f93ff1e9a72eb718b07c05213d19ec1d23b..f14a660a2a3458ee6b918eafe3f2b1283404b3e7 100644 (file)
@@ -516,7 +516,7 @@ static inline void idxd_set_user_intr(struct idxd_device *idxd, bool enable)
        iowrite32(reg.bits, idxd->reg_base + IDXD_GENCFG_OFFSET);
 }
 
-extern struct bus_type dsa_bus_type;
+extern const struct bus_type dsa_bus_type;
 
 extern bool support_enqcmd;
 extern struct ida idxd_ida;