[PATCH][next] perf: imx9_perf: make the read-only array mask static const

Colin Ian King posted 1 patch 4 months ago
drivers/perf/fsl_imx9_ddr_perf.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
[PATCH][next] perf: imx9_perf: make the read-only array mask static const
Posted by Colin Ian King 4 months ago
Don't populate the read-only array mask on the stack at run time,
instead make it static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/perf/fsl_imx9_ddr_perf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c
index 843f163e6c33..267754fdf581 100644
--- a/drivers/perf/fsl_imx9_ddr_perf.c
+++ b/drivers/perf/fsl_imx9_ddr_perf.c
@@ -461,9 +461,11 @@ static void imx93_ddr_perf_monitor_config(struct ddr_pmu *pmu, int event,
 					  int counter, int axi_id, int axi_mask)
 {
 	u32 pmcfg1, pmcfg2;
-	u32 mask[] = {  MX93_PMCFG1_RD_TRANS_FILT_EN,
-			MX93_PMCFG1_WR_TRANS_FILT_EN,
-			MX93_PMCFG1_RD_BT_FILT_EN };
+	static const u32 mask[] = {
+		MX93_PMCFG1_RD_TRANS_FILT_EN,
+		MX93_PMCFG1_WR_TRANS_FILT_EN,
+		MX93_PMCFG1_RD_BT_FILT_EN
+	};
 
 	pmcfg1 = readl_relaxed(pmu->base + PMCFG1);
 
-- 
2.49.0
Re: [PATCH][next] perf: imx9_perf: make the read-only array mask static const
Posted by Will Deacon 3 months, 1 week ago
On Wed, 11 Jun 2025 14:39:17 +0100, Colin Ian King wrote:
> Don't populate the read-only array mask on the stack at run time,
> instead make it static const.
> 
> 

Applied to will (for-next/perf), thanks!

[1/1] perf: imx9_perf: make the read-only array mask static const
      https://git.kernel.org/will/c/b6e37b27bf68

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
Re: [PATCH][next] perf: imx9_perf: make the read-only array mask static const
Posted by Frank Li 4 months ago
On Wed, Jun 11, 2025 at 02:39:17PM +0100, Colin Ian King wrote:
> Don't populate the read-only array mask on the stack at run time,
> instead make it static const.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/perf/fsl_imx9_ddr_perf.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c
> index 843f163e6c33..267754fdf581 100644
> --- a/drivers/perf/fsl_imx9_ddr_perf.c
> +++ b/drivers/perf/fsl_imx9_ddr_perf.c
> @@ -461,9 +461,11 @@ static void imx93_ddr_perf_monitor_config(struct ddr_pmu *pmu, int event,
>  					  int counter, int axi_id, int axi_mask)
>  {
>  	u32 pmcfg1, pmcfg2;
> -	u32 mask[] = {  MX93_PMCFG1_RD_TRANS_FILT_EN,
> -			MX93_PMCFG1_WR_TRANS_FILT_EN,
> -			MX93_PMCFG1_RD_BT_FILT_EN };
> +	static const u32 mask[] = {
> +		MX93_PMCFG1_RD_TRANS_FILT_EN,
> +		MX93_PMCFG1_WR_TRANS_FILT_EN,
> +		MX93_PMCFG1_RD_BT_FILT_EN
> +	};
>
>  	pmcfg1 = readl_relaxed(pmu->base + PMCFG1);
>
> --
> 2.49.0
>