diff options
author | Cosmin Paraschiv <csmnprschv@gmail.com> | 2013-04-30 09:23:09 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-30 09:24:30 +0930 |
commit | c2ecd51531c881c8d47d77ea30395f7f03d42da3 (patch) | |
tree | ec8e3ed24b1837abd31c777d55f0ddc0700abd0e /drivers/lguest | |
parent | 55257d72bd1c51f25106350f4983ec19f62ed1fa (diff) | |
download | lwn-c2ecd51531c881c8d47d77ea30395f7f03d42da3.tar.gz lwn-c2ecd51531c881c8d47d77ea30395f7f03d42da3.zip |
lguest: improve code readability in lg_cpu_start.
Make the container_of call friendlier and fix some comment slip-ups.
Signed-off-by: Cosmin Paraschiv <csmnprschv@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r-- | drivers/lguest/lguest_user.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index ff4a0bc9904d..4263f4cc8c55 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c @@ -250,13 +250,13 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) */ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) { - /* We have a limited number the number of CPUs in the lguest struct. */ + /* We have a limited number of CPUs in the lguest struct. */ if (id >= ARRAY_SIZE(cpu->lg->cpus)) return -EINVAL; /* Set up this CPU's id, and pointer back to the lguest struct. */ cpu->id = id; - cpu->lg = container_of((cpu - id), struct lguest, cpus[0]); + cpu->lg = container_of(cpu, struct lguest, cpus[id]); cpu->lg->nr_cpus++; /* Each CPU has a timer it can set. */ @@ -270,7 +270,7 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) if (!cpu->regs_page) return -ENOMEM; - /* We actually put the registers at the bottom of the page. */ + /* We actually put the registers at the end of the page. */ cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs); /* |