Skip to contentSkip to conversation

ARM: perf: fix prototype of release_pmu

PATCH New Mark Rutland 3 participants 5 messages Aug 10, 2011 – Aug 12, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: perf: fix prototype of release_pmu

Commit f12482c9 ("ARM: 6974/1: pmu: refactor reservation") changed the prototype of release_pmu, but missed the stub for when CONFIG_CPU_HAS_PMU is not selected by the platform.

This patch changes the prototype of the stub, preventing possible build failures when CONFIG_CPU_HAS_PMU is not selected.

---
 arch/arm/include/asm/pmu.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/include/asm/pmu.h +1 -1
index 67c70a3..8ae32ba 100644
@@ -75,7 +75,7 @@ reserve_pmu(enum arm_pmu_type device)
 }
 
 static inline int
-release_pmu(struct platform_device *pdev)
+release_pmu(enum arm_pmu_type device)
 {
 	return -ENODEV;
 }
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 ARM: perf: make name of arm_pmu_type consistent

Commit f12482c9 ("ARM: 6974/1: pmu: refactor reservation") changed {release,reserve}_pmu to take an enum arm_pmu_type as a parameter, but inconsistently named the parameter type' or device'. It would be nice if these were consistent.

This patch makes use of enum arm_pmu_type consistent, always using 'device' as this is more common in usage.

---
 arch/arm/include/asm/pmu.h |    2 +-
 arch/arm/kernel/pmu.c      |   14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/include/asm/pmu.h +1 -1
index 8ae32ba..456117c 100644
@@ -52,7 +52,7 @@ reserve_pmu(enum arm_pmu_type device);
  * a cookie.
  */
 extern int
-release_pmu(enum arm_pmu_type type);
+release_pmu(enum arm_pmu_type device);
 
 /**
  * init_pmu() - Initialise the PMU.
arch/arm/kernel/pmu.c +7 -7
index 2b70709..89cbdc5 100644
@@ -27,22 +27,22 @@ static volatile long pmu_lock;
 static struct platform_device *pmu_devices[ARM_NUM_PMU_DEVICES];
 
 static int __devinit pmu_register(struct platform_device *pdev,
-					enum arm_pmu_type type)
+					enum arm_pmu_type device)
 {
-	if (type < 0 || type >= ARM_NUM_PMU_DEVICES) {
+	if (device < 0 || device >= ARM_NUM_PMU_DEVICES) {
 		pr_warning("received registration request for unknown "
-				"device %d\n", type);
+				"device %d\n", device);
 		return -EINVAL;
 	}
 
-	if (pmu_devices[type]) {
+	if (pmu_devices[device]) {
 		pr_warning("rejecting duplicate registration of PMU device "
-			"type %d.", type);
+			"type %d.", device);
 		return -ENOSPC;
 	}
 
-	pr_info("registered new PMU device of type %d\n", type);
-	pmu_devices[type] = pdev;
+	pr_info("registered new PMU device of type %d\n", device);
+	pmu_devices[device] = pdev;
 	return 0;
 }
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 ARM: perf: make name of arm_pmu_type consistent

Mark,

Quoted 7 lines · Mark Rutland

Commit f12482c9 ("ARM: 6974/1: pmu: refactor reservation") changed {release,reserve}_pmu to take an enum arm_pmu_type as a parameter, but inconsistently named the parameter type' or device'. It would be nice if these were consistent.

This patch makes use of enum arm_pmu_type consistent, always using 'device' as this is more common in usage.

Thanks for fixing this. I'll take care of these two patches as fixes for 3.1.

Will

#3 lore raw

PATCH 2/2 ARM: perf: make name of arm_pmu_type consistent

In reply to Mark Rutland
Quoted 7 lines · Mark Rutland

Commit f12482c9 ("ARM: 6974/1: pmu: refactor reservation") changed {release,reserve}_pmu to take an enum arm_pmu_type as a parameter, but inconsistently named the parameter type' or device'. It would be nice if these were consistent.

This patch makes use of enum arm_pmu_type consistent, always using 'device' as this is more common in usage.

This is confusing. It's called arm_pmu_TYPE, and it's referred to as a type in printks. Yet you're renaming the variable to device. That just adds to the problem.

What is it, a type number or a device number?

If it's a device number, then the printks also need fixing, and maybe the enumerated type name too.

#4 lore raw

PATCH 2/2 ARM: perf: make name of arm_pmu_type consistent

Quoted 9 lines · Russell King - ARM Linux
Quoted 7 lines · Mark Rutland

Commit f12482c9 ("ARM: 6974/1: pmu: refactor reservation") changed {release,reserve}_pmu to take an enum arm_pmu_type as a parameter, but inconsistently named the parameter type' or device'. It would be nice if these were consistent.

This patch makes use of enum arm_pmu_type consistent, always using 'device' as this is more common in usage.

Quoted 8 lines

This is confusing. It's called arm_pmu_TYPE, and it's referred to as a type in printks. Yet you're renaming the variable to device. That just adds to the problem.

What is it, a type number or a device number?

If it's a device number, then the printks also need fixing, and maybe the enumerated type name too.

Yes, we should uniformly use type instead of device. The only reason device is kicking around is because the functions used to take a platform_device rather than an arm_pmu_type.

Once I've got an updated patch from Mark, I'll update my fixes branch and send a pull request to you Russell (I have a handful of other fixes that have been on the list).

Cheers,

Will