Skip to contentSkip to conversation

perf: add const qualifier to perf_pmu_register's 'name' arg

PATCH In review Mischa Jonker 5 participants 8 messages Jun 4, 2013 – Jun 19, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: add const qualifier to perf_pmu_register's 'name' arg

This allows us to use pdev->name for registering a PMU device. IMO the name is not supposed to be changed anyway.

---
 arch/metag/kernel/perf/perf_event.c |    2 +-
 include/linux/perf_event.h          |    4 ++--
 kernel/events/core.c                |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/metag/kernel/perf/perf_event.c +1 -1
index 3665694..5b18888 100644
@@ -882,7 +882,7 @@ static int __init init_hw_perf_events(void)
 	}
 
 	register_cpu_notifier(&metag_pmu_notifier);
-	ret = perf_pmu_register(&pmu, (char *)metag_pmu->name, PERF_TYPE_RAW);
+	ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW);
 out:
 	return ret;
 }
include/linux/perf_event.h +2 -2
index f463a46..65a462c 100644
@@ -188,7 +188,7 @@ struct pmu {
 
 	struct device			*dev;
 	const struct attribute_group	**attr_groups;
-	char				*name;
+	const char			*name;
 	int				type;
 
 	int * __percpu			pmu_disable_count;
@@ -518,7 +518,7 @@ struct perf_output_handle {
 
 #ifdef CONFIG_PERF_EVENTS
 
-extern int perf_pmu_register(struct pmu *pmu, char *name, int type);
+extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
 extern void perf_pmu_unregister(struct pmu *pmu);
 
 extern int perf_num_counters(void);
kernel/events/core.c +1 -1
index 9dc297f..7003d6f 100644
@@ -5952,7 +5952,7 @@ free_dev:
 static struct lock_class_key cpuctx_mutex;
 static struct lock_class_key cpuctx_lock;
 
-int perf_pmu_register(struct pmu *pmu, char *name, int type)
+int perf_pmu_register(struct pmu *pmu, const char *name, int type)
 {
 	int cpu, ret;
 
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 3 lines · Mischa Jonker

This allows us to use pdev->name for registering a PMU device. IMO the name is not supposed to be changed anyway.

Indeed, and thanks!

PS. WTH is a metag?

#2 lore raw
Quoted 7 lines · Peter Zijlstra
Quoted 3 lines · Mischa Jonker

This allows us to use pdev->name for registering a PMU device. IMO the name is not supposed to be changed anyway.

Indeed, and thanks!

PS. WTH is a metag?

It's the cpu core from Imagination Tech - their port got merged in 3.9 (along with ARC from Synopsys).

maintainer
#3 lore raw
Quoted 11 lines · Vineet Gupta
Quoted 7 lines · Peter Zijlstra
Quoted 3 lines · Mischa Jonker

This allows us to use pdev->name for registering a PMU device. IMO the name is not supposed to be changed anyway.

Indeed, and thanks!

PS. WTH is a metag?

It's the cpu core from Imagination Tech - their port got merged in 3.9 (along with ARC from Synopsys).

So its Meta-G, not me-tag :-) Google gave me the below, its not exactly clear what kind of animal it is or what the G stands for. Too much marketing speak, too little useful information.

http://www.imgtec.com/meta/meta-technology.asp

Simlar 'complaint' for the ARC stuff really, only marketing speak :-)

#4 lore raw
Quoted 1 line · Peter Zijlstra

Simlar 'complaint' for the ARC stuff really, only marketing speak :-)

You mean lack of prefix in this case (as opposed to MetaG).

Anyhow, this patch served a lot more purpose than Mischa really wanted - formally introduced you to two new architectures ;-)

-Vineet

maintainer
#5 lore raw
Quoted 4 lines · Vineet Gupta
Quoted 1 line · Peter Zijlstra

Simlar 'complaint' for the ARC stuff really, only marketing speak :-)

You mean lack of prefix in this case (as opposed to MetaG).

Nah, lack of proper (!markting speak) introduction to the arch ;-)

Is there something like the Intel SDM for these archs, if so, do we want to make it easier to find them for people?

Quoted 2 lines

Anyhow, this patch served a lot more purpose than Mischa really wanted - formally introduced you to two new architectures ;-)

Yah.. it seems archs sneak up on you these days.

#6 lore raw
Quoted 9 lines · Peter Zijlstra
Quoted 4 lines · Vineet Gupta
Quoted 1 line · Peter Zijlstra

Simlar 'complaint' for the ARC stuff really, only marketing speak :-)

You mean lack of prefix in this case (as opposed to MetaG).

Nah, lack of proper (!markting speak) introduction to the arch ;-)

Is there something like the Intel SDM for these archs,

For metag, see the patchset intro for a brief (hopefully !marketing) intro and links to documentation. Meta is the marketing name, metag is generally used in code which reduces ambiguity with the word meta - tbh I'm not certain whether metag is short for metagence or means something else, but it's been that way for years now.

http://lwn.net/Articles/534906/

Quoted 2 lines

if so, do we want
to make it easier to find them for people?

Where would you suggest?

Some other arches link to the linux-$ARCH project homepages in Kconfig help text which makes sense as that can then link to various documentation and be more easily kept up to date. Not all arches have a big project around them like that though.

Cheers
James

#7 lore raw

[tip:perf/core] perf: Add const qualifier to perf_pmu_register's 'name' arg

In reply to Mischa Jonker
perf: Add const qualifier to perf_pmu_register's 'name' arg
Commit-ID:  03d8e80beb7db78a13c192431205b9c83f7e0cd1
Gitweb:     http://git.kernel.org/tip/03d8e80beb7db78a13c192431205b9c83f7e0cd1
Author:     Mischa Jonker <[email protected]>
AuthorDate: Tue, 4 Jun 2013 11:45:48 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 19 Jun 2013 12:50:23 +0200

perf: Add const qualifier to perf_pmu_register's 'name' arg

This allows us to use pdev->name for registering a PMU device. IMO the name is not supposed to be changed anyway.

---
 arch/metag/kernel/perf/perf_event.c | 2 +-
 include/linux/perf_event.h          | 4 ++--
 kernel/events/core.c                | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/metag/kernel/perf/perf_event.c +1 -1
index 3665694..5b18888 100644
@@ -882,7 +882,7 @@ static int __init init_hw_perf_events(void)
 	}
 
 	register_cpu_notifier(&metag_pmu_notifier);
-	ret = perf_pmu_register(&pmu, (char *)metag_pmu->name, PERF_TYPE_RAW);
+	ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW);
 out:
 	return ret;
 }
include/linux/perf_event.h +2 -2
index 74a4e14..4bc57d0 100644
@@ -188,7 +188,7 @@ struct pmu {
 
 	struct device			*dev;
 	const struct attribute_group	**attr_groups;
-	char				*name;
+	const char			*name;
 	int				type;
 
 	int * __percpu			pmu_disable_count;
@@ -519,7 +519,7 @@ struct perf_output_handle {
 
 #ifdef CONFIG_PERF_EVENTS
 
-extern int perf_pmu_register(struct pmu *pmu, char *name, int type);
+extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
 extern void perf_pmu_unregister(struct pmu *pmu);
 
 extern int perf_num_counters(void);
kernel/events/core.c +1 -1
index aca95bc..9c89207 100644
@@ -6179,7 +6179,7 @@ free_dev:
 static struct lock_class_key cpuctx_mutex;
 static struct lock_class_key cpuctx_lock;
 
-int perf_pmu_register(struct pmu *pmu, char *name, int type)
+int perf_pmu_register(struct pmu *pmu, const char *name, int type)
 {
 	int cpu, ret;