Skip to content

Commit

Permalink
x86, cpuid: Simplify the code in cpuid_open
Browse files Browse the repository at this point in the history
Peter picked up my patch for tip/x86/cpu that removes the bkl in
cpuid_open. Ingo subsequently merged that into tip/master.

This patch folds back in tglx's 55968ede164ae523692f00717f50cd926f1382a0
to my patch that removed the bkl.

This simplifies the code, and makes it consistent with the changes to
kill the bkl in msr.c as well.

Originally-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
John Kacur authored and H. Peter Anvin committed Oct 8, 2009
1 parent 170a0bc commit 5a94361
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions arch/x86/kernel/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,16 @@ static int cpuid_open(struct inode *inode, struct file *file)
{
unsigned int cpu;
struct cpuinfo_x86 *c;
int ret = 0;

cpu = iminor(file->f_path.dentry->d_inode);
if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
ret = -ENXIO; /* No such CPU */
goto out;
}
if (cpu >= nr_cpu_ids || !cpu_online(cpu))
return -ENXIO; /* No such CPU */

c = &cpu_data(cpu);
if (c->cpuid_level < 0)
ret = -EIO; /* CPUID not supported */
out:
return ret;
return -EIO; /* CPUID not supported */

return 0;
}

/*
Expand Down

0 comments on commit 5a94361

Please sign in to comment.