diff options
author | Cosmin Paraschiv <csmnprschv@gmail.com> | 2013-04-29 19:53:09 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-29 19:54:30 -0400 |
commit | c2ecd51531c881c8d47d77ea30395f7f03d42da3 (patch) | |
tree | ec8e3ed24b1837abd31c777d55f0ddc0700abd0e | |
parent | 55257d72bd1c51f25106350f4983ec19f62ed1fa (diff) |
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>
-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) | |||
250 | */ | 250 | */ |
251 | static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) | 251 | static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) |
252 | { | 252 | { |
253 | /* We have a limited number the number of CPUs in the lguest struct. */ | 253 | /* We have a limited number of CPUs in the lguest struct. */ |
254 | if (id >= ARRAY_SIZE(cpu->lg->cpus)) | 254 | if (id >= ARRAY_SIZE(cpu->lg->cpus)) |
255 | return -EINVAL; | 255 | return -EINVAL; |
256 | 256 | ||
257 | /* Set up this CPU's id, and pointer back to the lguest struct. */ | 257 | /* Set up this CPU's id, and pointer back to the lguest struct. */ |
258 | cpu->id = id; | 258 | cpu->id = id; |
259 | cpu->lg = container_of((cpu - id), struct lguest, cpus[0]); | 259 | cpu->lg = container_of(cpu, struct lguest, cpus[id]); |
260 | cpu->lg->nr_cpus++; | 260 | cpu->lg->nr_cpus++; |
261 | 261 | ||
262 | /* Each CPU has a timer it can set. */ | 262 | /* 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) | |||
270 | if (!cpu->regs_page) | 270 | if (!cpu->regs_page) |
271 | return -ENOMEM; | 271 | return -ENOMEM; |
272 | 272 | ||
273 | /* We actually put the registers at the bottom of the page. */ | 273 | /* We actually put the registers at the end of the page. */ |
274 | cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs); | 274 | cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs); |
275 | 275 | ||
276 | /* | 276 | /* |