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

video: fbdev: controlfb.c: use container_of to resolve fb_info_control from fb_info

Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Fabian Frederick and committed by
Tomi Valkeinen
c4e42323 21f7c247

+10 -5
+10 -5
drivers/video/fbdev/controlfb.c
··· 218 218 */ 219 219 static int controlfb_set_par (struct fb_info *info) 220 220 { 221 - struct fb_info_control *p = (struct fb_info_control *) info; 221 + struct fb_info_control *p = 222 + container_of(info, struct fb_info_control, info); 222 223 struct fb_par_control par; 223 224 int err; 224 225 ··· 259 258 struct fb_info *info) 260 259 { 261 260 unsigned int xoffset, hstep; 262 - struct fb_info_control *p = (struct fb_info_control *)info; 261 + struct fb_info_control *p = 262 + container_of(info, struct fb_info_control, info); 263 263 struct fb_par_control *par = &p->par; 264 264 265 265 /* ··· 311 309 312 310 static int controlfb_blank(int blank_mode, struct fb_info *info) 313 311 { 314 - struct fb_info_control *p = (struct fb_info_control *) info; 312 + struct fb_info_control *p = 313 + container_of(info, struct fb_info_control, info); 315 314 unsigned ctrl; 316 315 317 316 ctrl = ld_le32(CNTRL_REG(p,ctrl)); ··· 345 342 static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 346 343 u_int transp, struct fb_info *info) 347 344 { 348 - struct fb_info_control *p = (struct fb_info_control *) info; 345 + struct fb_info_control *p = 346 + container_of(info, struct fb_info_control, info); 349 347 __u8 r, g, b; 350 348 351 349 if (regno > 255) ··· 837 833 unsigned hperiod, hssync, hsblank, hesync, heblank, piped, heq, hlfln, 838 834 hserr, vperiod, vssync, vesync, veblank, vsblank, vswin, vewin; 839 835 unsigned long pixclock; 840 - struct fb_info_control *p = (struct fb_info_control *) fb_info; 836 + struct fb_info_control *p = 837 + container_of(fb_info, struct fb_info_control, info); 841 838 struct control_regvals *r = &par->regvals; 842 839 843 840 switch (var->bits_per_pixel) {