2024-02-11 15:44:41

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/2] ARM: struct bus_type cleanup

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 <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>

---
Ricardo B. Marliere (2):
ARM: sa1111: make sa1111_bus_type const
ARM: ecard: make ecard_bus_type const

arch/arm/common/sa1111.c | 2 +-
arch/arm/include/asm/ecard.h | 2 +-
arch/arm/include/asm/hardware/sa1111.h | 2 +-
arch/arm/mach-rpc/ecard.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: 8790fade1a19caf714ba1d91ce1fdceb9f2067f2
change-id: 20240211-bus_cleanup-rmk-7fcb4be84c26

Best regards,
--
Ricardo B. Marliere <[email protected]>



2024-02-11 15:44:53

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/2] ARM: sa1111: make sa1111_bus_type const

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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
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


2024-02-11 15:45:07

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/2] ARM: ecard: make ecard_bus_type const

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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
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


2024-02-12 11:09:45

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/2] ARM: struct bus_type cleanup

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 <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>
>

Reviewed-by: Greg Kroah-Hartman <[email protected]>