[PATCH v2 4/5] powerpc: pmac: make macio_bus_type const

From: Ricardo B. Marliere
Date: Mon Feb 12 2024 - 15:05:44 EST


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 macio_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@xxxxxxxxxxxxxxxxxxx>
Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Ricardo B. Marliere <ricardo@xxxxxxxxxxxx>
---
arch/powerpc/include/asm/macio.h | 2 +-
drivers/macintosh/macio_asic.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index 3a07c62973aa..ab9608e63e40 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -6,7 +6,7 @@
#include <linux/of.h>
#include <linux/platform_device.h>

-extern struct bus_type macio_bus_type;
+extern const struct bus_type macio_bus_type;

/* MacIO device driver is defined later */
struct macio_driver;
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index a5ee8f736a8e..565f1e21ff7d 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -136,7 +136,7 @@ static int macio_device_modalias(const struct device *dev, struct kobj_uevent_en

extern const struct attribute_group *macio_dev_groups[];

-struct bus_type macio_bus_type = {
+const struct bus_type macio_bus_type = {
.name = "macio",
.match = macio_bus_match,
.uevent = macio_device_modalias,

--
2.43.0