diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-08 01:19:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:52:00 -0500 |
commit | 07accdc18e014cad945013886ee34e09f859f88a (patch) | |
tree | 2602152c60f6f09aca2880fc2a80970586da4439 | |
parent | a271aaf15f492d202def1b34e447107b60fe4ece (diff) |
Driver core: convert cpuid code to use struct device
Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | arch/i386/kernel/cpuid.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c index fde8bea85cee..ab0c327e79dc 100644 --- a/arch/i386/kernel/cpuid.c +++ b/arch/i386/kernel/cpuid.c | |||
@@ -156,14 +156,14 @@ static struct file_operations cpuid_fops = { | |||
156 | .open = cpuid_open, | 156 | .open = cpuid_open, |
157 | }; | 157 | }; |
158 | 158 | ||
159 | static int cpuid_class_device_create(int i) | 159 | static int cpuid_device_create(int i) |
160 | { | 160 | { |
161 | int err = 0; | 161 | int err = 0; |
162 | struct class_device *class_err; | 162 | struct device *dev; |
163 | 163 | ||
164 | class_err = class_device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), NULL, "cpu%d",i); | 164 | dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), "cpu%d",i); |
165 | if (IS_ERR(class_err)) | 165 | if (IS_ERR(dev)) |
166 | err = PTR_ERR(class_err); | 166 | err = PTR_ERR(dev); |
167 | return err; | 167 | return err; |
168 | } | 168 | } |
169 | 169 | ||
@@ -174,10 +174,10 @@ static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long ac | |||
174 | 174 | ||
175 | switch (action) { | 175 | switch (action) { |
176 | case CPU_ONLINE: | 176 | case CPU_ONLINE: |
177 | cpuid_class_device_create(cpu); | 177 | cpuid_device_create(cpu); |
178 | break; | 178 | break; |
179 | case CPU_DEAD: | 179 | case CPU_DEAD: |
180 | class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); | 180 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | return NOTIFY_OK; | 183 | return NOTIFY_OK; |
@@ -206,7 +206,7 @@ static int __init cpuid_init(void) | |||
206 | goto out_chrdev; | 206 | goto out_chrdev; |
207 | } | 207 | } |
208 | for_each_online_cpu(i) { | 208 | for_each_online_cpu(i) { |
209 | err = cpuid_class_device_create(i); | 209 | err = cpuid_device_create(i); |
210 | if (err != 0) | 210 | if (err != 0) |
211 | goto out_class; | 211 | goto out_class; |
212 | } | 212 | } |
@@ -218,7 +218,7 @@ static int __init cpuid_init(void) | |||
218 | out_class: | 218 | out_class: |
219 | i = 0; | 219 | i = 0; |
220 | for_each_online_cpu(i) { | 220 | for_each_online_cpu(i) { |
221 | class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); | 221 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); |
222 | } | 222 | } |
223 | class_destroy(cpuid_class); | 223 | class_destroy(cpuid_class); |
224 | out_chrdev: | 224 | out_chrdev: |
@@ -232,7 +232,7 @@ static void __exit cpuid_exit(void) | |||
232 | int cpu = 0; | 232 | int cpu = 0; |
233 | 233 | ||
234 | for_each_online_cpu(cpu) | 234 | for_each_online_cpu(cpu) |
235 | class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); | 235 | device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); |
236 | class_destroy(cpuid_class); | 236 | class_destroy(cpuid_class); |
237 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); | 237 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); |
238 | unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); | 238 | unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); |