diff options
| author | Kay Sievers <kay.sievers@vrfy.org> | 2009-04-30 09:23:42 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:30:25 -0400 |
| commit | 07e9bb8eebb04c81323cbd3eabf07a3f6f05b204 (patch) | |
| tree | 45054dee75c6b6c3fab5eb6be1f14c6f720995ce | |
| parent | b03f38b685e2e1db174fb8982930e789a516f414 (diff) | |
Driver Core: x86: add nodename for cpuid and msr drivers.
This adds support to the x86 cpuid and msr drivers to report the proper
device name to userspace for their devices.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | arch/x86/kernel/cpuid.c | 6 | ||||
| -rw-r--r-- | arch/x86/kernel/msr.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 2ac1f0c2beb3..b07af8861244 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
| @@ -182,6 +182,11 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier = | |||
| 182 | .notifier_call = cpuid_class_cpu_callback, | 182 | .notifier_call = cpuid_class_cpu_callback, |
| 183 | }; | 183 | }; |
| 184 | 184 | ||
| 185 | static char *cpuid_nodename(struct device *dev) | ||
| 186 | { | ||
| 187 | return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt)); | ||
| 188 | } | ||
| 189 | |||
| 185 | static int __init cpuid_init(void) | 190 | static int __init cpuid_init(void) |
| 186 | { | 191 | { |
| 187 | int i, err = 0; | 192 | int i, err = 0; |
| @@ -198,6 +203,7 @@ static int __init cpuid_init(void) | |||
| 198 | err = PTR_ERR(cpuid_class); | 203 | err = PTR_ERR(cpuid_class); |
| 199 | goto out_chrdev; | 204 | goto out_chrdev; |
| 200 | } | 205 | } |
| 206 | cpuid_class->nodename = cpuid_nodename; | ||
| 201 | for_each_online_cpu(i) { | 207 | for_each_online_cpu(i) { |
| 202 | err = cpuid_device_create(i); | 208 | err = cpuid_device_create(i); |
| 203 | if (err != 0) | 209 | if (err != 0) |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 3cf3413ec626..98fd6cd4e3a4 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
| @@ -196,6 +196,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier = { | |||
| 196 | .notifier_call = msr_class_cpu_callback, | 196 | .notifier_call = msr_class_cpu_callback, |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | static char *msr_nodename(struct device *dev) | ||
| 200 | { | ||
| 201 | return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt)); | ||
| 202 | } | ||
| 203 | |||
| 199 | static int __init msr_init(void) | 204 | static int __init msr_init(void) |
| 200 | { | 205 | { |
| 201 | int i, err = 0; | 206 | int i, err = 0; |
| @@ -212,6 +217,7 @@ static int __init msr_init(void) | |||
| 212 | err = PTR_ERR(msr_class); | 217 | err = PTR_ERR(msr_class); |
| 213 | goto out_chrdev; | 218 | goto out_chrdev; |
| 214 | } | 219 | } |
| 220 | msr_class->nodename = msr_nodename; | ||
| 215 | for_each_online_cpu(i) { | 221 | for_each_online_cpu(i) { |
| 216 | err = msr_device_create(i); | 222 | err = msr_device_create(i); |
| 217 | if (err != 0) | 223 | if (err != 0) |
