perf: make pmu_bus const

Message ID 20240204-bus_cleanup-events-v1-1-c779d1639c3a@marliere.net
State New
Headers
Series perf: make pmu_bus const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 1:29 p.m. UTC
  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 <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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

Best regards,
  

Comments

Greg KH Feb. 4, 2024, 2:25 p.m. UTC | #1
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 <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  kernel/events/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
Mark Rutland Feb. 5, 2024, 10:59 a.m. UTC | #2
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 <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Acked-by: Mark Rutland <mark.rutland@arm.com>

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 <ricardo@marliere.net>
>
  

Patch

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,
 };