Commit 07e9bb8e authored by Kay Sievers's avatar Kay Sievers Committed by Greg Kroah-Hartman

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: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarJan Blunck <jblunck@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b03f38b6
...@@ -182,6 +182,11 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier = ...@@ -182,6 +182,11 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier =
.notifier_call = cpuid_class_cpu_callback, .notifier_call = cpuid_class_cpu_callback,
}; };
static char *cpuid_nodename(struct device *dev)
{
return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
}
static int __init cpuid_init(void) static int __init cpuid_init(void)
{ {
int i, err = 0; int i, err = 0;
...@@ -198,6 +203,7 @@ static int __init cpuid_init(void) ...@@ -198,6 +203,7 @@ static int __init cpuid_init(void)
err = PTR_ERR(cpuid_class); err = PTR_ERR(cpuid_class);
goto out_chrdev; goto out_chrdev;
} }
cpuid_class->nodename = cpuid_nodename;
for_each_online_cpu(i) { for_each_online_cpu(i) {
err = cpuid_device_create(i); err = cpuid_device_create(i);
if (err != 0) if (err != 0)
......
...@@ -196,6 +196,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier = { ...@@ -196,6 +196,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier = {
.notifier_call = msr_class_cpu_callback, .notifier_call = msr_class_cpu_callback,
}; };
static char *msr_nodename(struct device *dev)
{
return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
}
static int __init msr_init(void) static int __init msr_init(void)
{ {
int i, err = 0; int i, err = 0;
...@@ -212,6 +217,7 @@ static int __init msr_init(void) ...@@ -212,6 +217,7 @@ static int __init msr_init(void)
err = PTR_ERR(msr_class); err = PTR_ERR(msr_class);
goto out_chrdev; goto out_chrdev;
} }
msr_class->nodename = msr_nodename;
for_each_online_cpu(i) { for_each_online_cpu(i) {
err = msr_device_create(i); err = msr_device_create(i);
if (err != 0) if (err != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment