patch-2.4.0-test2 linux/arch/i386/kernel/cpuid.c

Next file: linux/arch/i386/kernel/entry.S
Previous file: linux/arch/i386/kernel/apm.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/arch/i386/kernel/cpuid.c linux/arch/i386/kernel/cpuid.c
@@ -64,11 +64,11 @@
   if ( cpu == smp_processor_id() ) {
     cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
   } else {
-    cmd->cpu  = cpu;
-    cmd->reg  = reg;
-    cmd->data = data;
+    cmd.cpu  = cpu;
+    cmd.reg  = reg;
+    cmd.data = data;
     
-    smp_call_function(cpuid_smp_cpuid, (void *)cmd, 1, 1);
+    smp_call_function(cpuid_smp_cpuid, &cmd, 1, 1);
   }
 }
 #else /* ! CONFIG_SMP */
@@ -120,17 +120,13 @@
 static int cpuid_open(struct inode *inode, struct file *file)
 {
   int cpu = MINOR(file->f_dentry->d_inode->i_rdev);
-  
+  struct cpuinfo_x86 *c = &(cpu_data)[cpu];
+
   if ( !(cpu_online_map & (1UL << cpu)) )
-    return -ENXIO;	/* No such CPU */
+    return -ENXIO;		/* No such CPU */
+  if ( c->cpuid_level < 0 )
+    return -EIO;		/* CPUID not supported */
   
-  MOD_INC_USE_COUNT;
-  return 0;
-}
-
-static int cpuid_release(struct inode *inode, struct file *file)
-{
-  MOD_DEC_USE_COUNT;
   return 0;
 }
 
@@ -138,10 +134,10 @@
  * File operations we support
  */
 static struct file_operations cpuid_fops = {
+  owner:	THIS_MODULE,
   llseek:	cpuid_seek,
   read:		cpuid_read,
   open:		cpuid_open,
-  release:	cpuid_release,
 };
 
 int __init cpuid_init(void)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)