arm_pmu: Drop redundant armpmu->map_event() in armpmu_event_init()

Message ID 20221130083350.264583-1-anshuman.khandual@arm.com
State New
Headers
Series arm_pmu: Drop redundant armpmu->map_event() in armpmu_event_init() |

Commit Message

Anshuman Khandual Nov. 30, 2022, 8:33 a.m. UTC
  __hw_perf_event_init() already calls armpmu->map_event() callback, and also
returns its error code including -ENOENT, along with a debug callout. Hence
an additional armpmu->map_event() check for -ENOENT is redundant.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.1-rc6

 drivers/perf/arm_pmu.c | 4 ----
 1 file changed, 4 deletions(-)
  

Comments

Mark Rutland Dec. 1, 2022, 12:24 p.m. UTC | #1
On Wed, Nov 30, 2022 at 02:03:50PM +0530, Anshuman Khandual wrote:
> __hw_perf_event_init() already calls armpmu->map_event() callback, and also
> returns its error code including -ENOENT, along with a debug callout. Hence
> an additional armpmu->map_event() check for -ENOENT is redundant.

Hmm; it looks like this has been redundant since commit:

  e1f431b57ef9e4a6 ("ARM: perf: refactor event mapping")

... and was an oversight on my behalf.

This looks fine to me, so FWIW:

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

Mark.

> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v6.1-rc6
> 
>  drivers/perf/arm_pmu.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 6538cec1a601..4be6869005f1 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -529,10 +529,6 @@ static int armpmu_event_init(struct perf_event *event)
>  			return -EOPNOTSUPP;
>  		}
>  	}
> -
> -	if (armpmu->map_event(event) == -ENOENT)
> -		return -ENOENT;
> -
>  	return __hw_perf_event_init(event);
>  }
>  
> -- 
> 2.25.1
>
  
Will Deacon Dec. 1, 2022, 5:45 p.m. UTC | #2
On Wed, Nov 30, 2022 at 02:03:50PM +0530, Anshuman Khandual wrote:
> __hw_perf_event_init() already calls armpmu->map_event() callback, and also
> returns its error code including -ENOENT, along with a debug callout. Hence
> an additional armpmu->map_event() check for -ENOENT is redundant.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v6.1-rc6

Doesn't apply against for-next/perf

Will
  

Patch

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 6538cec1a601..4be6869005f1 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -529,10 +529,6 @@  static int armpmu_event_init(struct perf_event *event)
 			return -EOPNOTSUPP;
 		}
 	}
-
-	if (armpmu->map_event(event) == -ENOENT)
-		return -ENOENT;
-
 	return __hw_perf_event_init(event);
 }