2024-02-04 13:39:57

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/2] time: 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 (2):
clocksource: make clocksource_subsys const
clockevents: make clockevents_subsys const

kernel/time/clockevents.c | 2 +-
kernel/time/clocksource.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 71fee48fb772ac4f6cfa63dbebc5629de8b4cc09
change-id: 20240204-bus_cleanup-time-9586b102d5e4

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



2024-02-04 13:40:35

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/2] clockevents: make clockevents_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the clockevents_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]>
---
kernel/time/clockevents.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 960143b183cd..a7ca458cdd9c 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -659,7 +659,7 @@ void tick_cleanup_dead_cpu(int cpu)
#endif

#ifdef CONFIG_SYSFS
-static struct bus_type clockevents_subsys = {
+static const struct bus_type clockevents_subsys = {
.name = "clockevents",
.dev_name = "clockevent",
};

--
2.43.0


2024-02-04 13:40:49

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/2] clocksource: make clocksource_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the clocksource_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]>
---
kernel/time/clocksource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c108ed8a9804..4f0932f0a0f6 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -1445,7 +1445,7 @@ static struct attribute *clocksource_attrs[] = {
};
ATTRIBUTE_GROUPS(clocksource);

-static struct bus_type clocksource_subsys = {
+static const struct bus_type clocksource_subsys = {
.name = "clocksource",
.dev_name = "clocksource",
};

--
2.43.0


2024-02-04 14:25:27

by Greg Kroah-Hartman

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

On Sun, Feb 04, 2024 at 10:40:14AM -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]>
>
> ---
> Ricardo B. Marliere (2):
> clocksource: make clocksource_subsys const
> clockevents: make clockevents_subsys const

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

2024-02-05 18:11:36

by John Stultz

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: make clocksource_subsys const

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


Acked-by: John Stultz <[email protected]>

2024-02-07 14:20:34

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [tip: timers/core] clockevents: Make clockevents_subsys const

The following commit has been merged into the timers/core branch of tip:

Commit-ID: 49f1ff50d49fb8b40bc0271177de8092226396e9
Gitweb: https://git.kernel.org/tip/49f1ff50d49fb8b40bc0271177de8092226396e9
Author: Ricardo B. Marliere <[email protected]>
AuthorDate: Sun, 04 Feb 2024 10:40:16 -03:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Wed, 07 Feb 2024 15:11:24 +01:00

clockevents: Make clockevents_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the clockevents_subsys variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
kernel/time/clockevents.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 960143b..a7ca458 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -659,7 +659,7 @@ void tick_cleanup_dead_cpu(int cpu)
#endif

#ifdef CONFIG_SYSFS
-static struct bus_type clockevents_subsys = {
+static const struct bus_type clockevents_subsys = {
.name = "clockevents",
.dev_name = "clockevent",
};

2024-02-07 14:23:13

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [tip: timers/core] clocksource: Make clocksource_subsys const

The following commit has been merged into the timers/core branch of tip:

Commit-ID: 2bc7fc24f9a85cb6b7335354b2733615727689f6
Gitweb: https://git.kernel.org/tip/2bc7fc24f9a85cb6b7335354b2733615727689f6
Author: Ricardo B. Marliere <[email protected]>
AuthorDate: Sun, 04 Feb 2024 10:40:15 -03:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Wed, 07 Feb 2024 15:11:24 +01:00

clocksource: Make clocksource_subsys const

Now that the driver core can properly handle constant struct bus_type,
move the clocksource_subsys variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Acked-by: John Stultz <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
kernel/time/clocksource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 3052b1f..4ef0665 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -1468,7 +1468,7 @@ static struct attribute *clocksource_attrs[] = {
};
ATTRIBUTE_GROUPS(clocksource);

-static struct bus_type clocksource_subsys = {
+static const struct bus_type clocksource_subsys = {
.name = "clocksource",
.dev_name = "clocksource",
};