Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Cosmin Paraschiv and committed by
Rusty Russell
c2ecd515 55257d72

+3 -3
+3 -3
drivers/lguest/lguest_user.c
··· 250 250 */ 251 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 254 if (id >= ARRAY_SIZE(cpu->lg->cpus)) 255 255 return -EINVAL; 256 256 257 257 /* Set up this CPU's id, and pointer back to the lguest struct. */ 258 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 260 cpu->lg->nr_cpus++; 261 261 262 262 /* Each CPU has a timer it can set. */ ··· 270 270 if (!cpu->regs_page) 271 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 274 cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs); 275 275 276 276 /*