2024-02-04 14:21:48

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/4] powerpc: 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]). Specifically, this series is part of the task of
splitting one of his TODOs [2].

---
[1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=bus_cleanup&id=26105f537f0c60eacfeb430abd2e05d7ddcdd8aa

Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>

---
Ricardo B. Marliere (4):
powerpc: cell: make spu_subsys const
powerpc: ps3: make ps3_system_bus_type const
powerpc: pseries: make cmm_subsys const
powerpc: pseries: make suspend_subsys const

arch/powerpc/platforms/cell/spu_base.c | 2 +-
arch/powerpc/platforms/ps3/system-bus.c | 2 +-
arch/powerpc/platforms/pseries/cmm.c | 2 +-
arch/powerpc/platforms/pseries/suspend.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: 44a1aad2fe6c10bfe0589d8047057b10a4c18a19
change-id: 20240204-bus_cleanup-powerpc-720c27d8f15c

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



2024-02-04 14:22:10

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/4] powerpc: cell: make spu_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the spu_subsys 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/powerpc/platforms/cell/spu_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index dea6f0f25897..346e433d2706 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -465,7 +465,7 @@ void spu_init_channels(struct spu *spu)
}
EXPORT_SYMBOL_GPL(spu_init_channels);

-static struct bus_type spu_subsys = {
+static const struct bus_type spu_subsys = {
.name = "spu",
.dev_name = "spu",
};

--
2.43.0


2024-02-04 14:22:26

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/4] powerpc: ps3: make ps3_system_bus_type const

Now that the driver core can properly handle constant struct bus_type,
move the ps3_system_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/powerpc/platforms/ps3/system-bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index d6b5f5ecd515..b4298e98ffe8 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -466,7 +466,7 @@ static struct attribute *ps3_system_bus_dev_attrs[] = {
};
ATTRIBUTE_GROUPS(ps3_system_bus_dev);

-static struct bus_type ps3_system_bus_type = {
+static const struct bus_type ps3_system_bus_type = {
.name = "ps3_system_bus",
.match = ps3_system_bus_match,
.uevent = ps3_system_bus_uevent,

--
2.43.0


2024-02-04 14:23:38

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 3/4] powerpc: pseries: make cmm_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the cmm_subsys 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/powerpc/platforms/pseries/cmm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 5f4037c1d7fe..6307dacc3862 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -375,7 +375,7 @@ static struct device_attribute *cmm_attrs[] = {
static DEVICE_ULONG_ATTR(simulate_loan_target_kb, 0644,
simulate_loan_target_kb);

-static struct bus_type cmm_subsys = {
+static const struct bus_type cmm_subsys = {
.name = "cmm",
.dev_name = "cmm",
};

--
2.43.0


2024-02-04 14:23:48

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 4/4] powerpc: pseries: make suspend_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the suspend_subsys 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/powerpc/platforms/pseries/suspend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 382003dfdb9a..c51db63d3e88 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -126,7 +126,7 @@ static ssize_t show_hibernate(struct device *dev,

static DEVICE_ATTR(hibernate, 0644, show_hibernate, store_hibernate);

-static struct bus_type suspend_subsys = {
+static const struct bus_type suspend_subsys = {
.name = "power",
.dev_name = "power",
};

--
2.43.0


2024-02-04 14:38:55

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/4] powerpc: struct bus_type cleanup

On Sun, Feb 04, 2024 at 11:21:54AM -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]). Specifically, this series is part of the task of
> splitting one of his TODOs [2].
>
> ---
> [1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
> [2]: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=bus_cleanup&id=26105f537f0c60eacfeb430abd2e05d7ddcdd8aa
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>

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

2024-02-04 20:48:24

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 2/4] powerpc: ps3: make ps3_system_bus_type const

On Sun, Feb 4, 2024 at 3:23 PM Ricardo B. Marliere <[email protected]> wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the ps3_system_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]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68korg

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2024-02-05 00:04:34

by Geoff Levand

[permalink] [raw]
Subject: Re: [PATCH 2/4] powerpc: ps3: make ps3_system_bus_type const

On 2/4/24 23:21, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the ps3_system_bus_type variable to be a constant structure as
> well, placing it into read-only memory which can not be modified at
> runtime.

> -static struct bus_type ps3_system_bus_type = {
> +static const struct bus_type ps3_system_bus_type = {
> .name = "ps3_system_bus",
> .match = ps3_system_bus_match,
> .uevent = ps3_system_bus_uevent,

Seems fine.

Acked-by: Geoff Levand <[email protected]>