* [PATCH 1/2] ARM: sa1111: make sa1111_bus_type const
2024-02-11 15:45 [PATCH 0/2] ARM: struct bus_type cleanup Ricardo B. Marliere
@ 2024-02-11 15:45 ` Ricardo B. Marliere
2024-02-11 15:45 ` [PATCH 2/2] ARM: ecard: make ecard_bus_type const Ricardo B. Marliere
2024-02-12 10:45 ` [PATCH 0/2] ARM: struct bus_type cleanup Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Ricardo B. Marliere @ 2024-02-11 15:45 UTC (permalink / raw)
To: Russell King
Cc: linux-arm-kernel, linux-kernel, Greg Kroah-Hartman,
Ricardo B. Marliere
Now that the driver core can properly handle constant struct bus_type,
move the sa1111_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>
---
arch/arm/common/sa1111.c | 2 +-
arch/arm/include/asm/hardware/sa1111.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 1fbd7363cf11..de5eba0a11f6 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -1367,7 +1367,7 @@ static void sa1111_bus_remove(struct device *dev)
drv->remove(sadev);
}
-struct bus_type sa1111_bus_type = {
+const struct bus_type sa1111_bus_type = {
.name = "sa1111-rab",
.match = sa1111_match,
.probe = sa1111_bus_probe,
diff --git a/arch/arm/include/asm/hardware/sa1111.h b/arch/arm/include/asm/hardware/sa1111.h
index d8c6f8a99dfa..02f3f9ca8582 100644
--- a/arch/arm/include/asm/hardware/sa1111.h
+++ b/arch/arm/include/asm/hardware/sa1111.h
@@ -368,7 +368,7 @@
-extern struct bus_type sa1111_bus_type;
+extern const struct bus_type sa1111_bus_type;
#define SA1111_DEVID_SBI (1 << 0)
#define SA1111_DEVID_SK (1 << 1)
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] ARM: ecard: make ecard_bus_type const
2024-02-11 15:45 [PATCH 0/2] ARM: struct bus_type cleanup Ricardo B. Marliere
2024-02-11 15:45 ` [PATCH 1/2] ARM: sa1111: make sa1111_bus_type const Ricardo B. Marliere
@ 2024-02-11 15:45 ` Ricardo B. Marliere
2024-02-12 10:45 ` [PATCH 0/2] ARM: struct bus_type cleanup Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Ricardo B. Marliere @ 2024-02-11 15:45 UTC (permalink / raw)
To: Russell King
Cc: linux-arm-kernel, linux-kernel, Greg Kroah-Hartman,
Ricardo B. Marliere
Now that the driver core can properly handle constant struct bus_type,
move the ecard_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>
---
arch/arm/include/asm/ecard.h | 2 +-
arch/arm/mach-rpc/ecard.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/ecard.h b/arch/arm/include/asm/ecard.h
index 4befe8d2ae19..7cbe001bf9cc 100644
--- a/arch/arm/include/asm/ecard.h
+++ b/arch/arm/include/asm/ecard.h
@@ -195,7 +195,7 @@ void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
unsigned long offset, unsigned long maxsize);
#define ecardm_iounmap(__ec, __addr) devm_iounmap(&(__ec)->dev, __addr)
-extern struct bus_type ecard_bus_type;
+extern const struct bus_type ecard_bus_type;
#define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev)
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index c30df1097c52..4b843cffcac2 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -1124,7 +1124,7 @@ static int ecard_match(struct device *_dev, struct device_driver *_drv)
return ret;
}
-struct bus_type ecard_bus_type = {
+const struct bus_type ecard_bus_type = {
.name = "ecard",
.dev_groups = ecard_dev_groups,
.match = ecard_match,
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] ARM: struct bus_type cleanup
2024-02-11 15:45 [PATCH 0/2] ARM: struct bus_type cleanup Ricardo B. Marliere
2024-02-11 15:45 ` [PATCH 1/2] ARM: sa1111: make sa1111_bus_type const Ricardo B. Marliere
2024-02-11 15:45 ` [PATCH 2/2] ARM: ecard: make ecard_bus_type const Ricardo B. Marliere
@ 2024-02-12 10:45 ` Greg Kroah-Hartman
2 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2024-02-12 10:45 UTC (permalink / raw)
To: Ricardo B. Marliere; +Cc: Russell King, linux-arm-kernel, linux-kernel
On Sun, Feb 11, 2024 at 12:45:06PM -0300, Ricardo B. Marliere wrote:
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]).
>
> ---
> [1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread