2024-02-04 13:29:29

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH] perf: make pmu_bus const

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

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 59b332cce9e7..decd994bfca4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11434,7 +11434,7 @@ static const struct attribute_group *pmu_dev_groups[] = {
};

static int pmu_bus_running;
-static struct bus_type pmu_bus = {
+static const struct bus_type pmu_bus = {
.name = "event_source",
.dev_groups = pmu_dev_groups,
};

---
base-commit: fdd041028f2294228e10610b4fca6a1a83ac683d
change-id: 20240204-bus_cleanup-events-765165264090

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



2024-02-04 14:26:08

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] perf: make pmu_bus const

On Sun, Feb 04, 2024 at 10:29:39AM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pmu_bus 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/events/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

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

2024-02-05 11:00:05

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH] perf: make pmu_bus const

On Sun, Feb 04, 2024 at 10:29:39AM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pmu_bus 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: Mark Rutland <[email protected]>

Mark.

> ---
> kernel/events/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 59b332cce9e7..decd994bfca4 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -11434,7 +11434,7 @@ static const struct attribute_group *pmu_dev_groups[] = {
> };
>
> static int pmu_bus_running;
> -static struct bus_type pmu_bus = {
> +static const struct bus_type pmu_bus = {
> .name = "event_source",
> .dev_groups = pmu_dev_groups,
> };
>
> ---
> base-commit: fdd041028f2294228e10610b4fca6a1a83ac683d
> change-id: 20240204-bus_cleanup-events-765165264090
>
> Best regards,
> --
> Ricardo B. Marliere <[email protected]>
>