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

Configure Feed

Select the types of activity you want to include in your feed.

efi: earlycon: Reduce number of references to global screen_info

Replace usage of global screen_info with local pointers. This will
later reduce churn when screen_info is being moved.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Richard Lyu <richard.lyu@suse.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

authored by

Thomas Zimmermann and committed by
Ard Biesheuvel
b868070f c7c7eb5e

+20 -20
+20 -20
drivers/firmware/efi/earlycon.c
··· 32 32 */ 33 33 static int __init efi_earlycon_remap_fb(void) 34 34 { 35 + const struct screen_info *si = &screen_info; 36 + 35 37 /* bail if there is no bootconsole or it was unregistered already */ 36 38 if (!earlycon_console || !console_is_registered(earlycon_console)) 37 39 return 0; 38 40 39 - efi_fb = memremap(fb_base, screen_info.lfb_size, 40 - fb_wb ? MEMREMAP_WB : MEMREMAP_WC); 41 + efi_fb = memremap(fb_base, si->lfb_size, fb_wb ? MEMREMAP_WB : MEMREMAP_WC); 41 42 42 43 return efi_fb ? 0 : -ENOMEM; 43 44 } ··· 72 71 early_memunmap(addr, len); 73 72 } 74 73 75 - static void efi_earlycon_clear_scanline(unsigned int y) 74 + static void efi_earlycon_clear_scanline(unsigned int y, const struct screen_info *si) 76 75 { 77 76 unsigned long *dst; 78 77 u16 len; 79 78 80 - len = screen_info.lfb_linelength; 79 + len = si->lfb_linelength; 81 80 dst = efi_earlycon_map(y*len, len); 82 81 if (!dst) 83 82 return; ··· 86 85 efi_earlycon_unmap(dst, len); 87 86 } 88 87 89 - static void efi_earlycon_scroll_up(void) 88 + static void efi_earlycon_scroll_up(const struct screen_info *si) 90 89 { 91 90 unsigned long *dst, *src; 92 91 u16 maxlen = 0; ··· 100 99 } 101 100 maxlen *= 4; 102 101 103 - len = screen_info.lfb_linelength; 104 - height = screen_info.lfb_height; 102 + len = si->lfb_linelength; 103 + height = si->lfb_height; 105 104 106 105 for (i = 0; i < height - font->height; i++) { 107 106 dst = efi_earlycon_map(i*len, len); ··· 121 120 } 122 121 } 123 122 124 - static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h) 123 + static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h, 124 + const struct screen_info *si) 125 125 { 126 126 const u32 color_black = 0x00000000; 127 127 const u32 color_white = 0x00ffffff; ··· 147 145 static void 148 146 efi_earlycon_write(struct console *con, const char *str, unsigned int num) 149 147 { 150 - struct screen_info *si; 148 + const struct screen_info *si = &screen_info; 151 149 u32 cur_efi_x = efi_x; 152 150 unsigned int len; 153 151 const char *s; 154 152 void *dst; 155 153 156 - si = &screen_info; 157 154 len = si->lfb_linelength; 158 155 159 156 while (num) { ··· 175 174 x = efi_x; 176 175 177 176 while (n-- > 0) { 178 - efi_earlycon_write_char(dst + x*4, *s, h); 177 + efi_earlycon_write_char(dst + x * 4, *s, h, si); 179 178 x += font->width; 180 179 s++; 181 180 } ··· 208 207 cur_line_y = (cur_line_y + 1) % max_line_y; 209 208 210 209 efi_y -= font->height; 211 - efi_earlycon_scroll_up(); 210 + efi_earlycon_scroll_up(si); 212 211 213 212 for (i = 0; i < font->height; i++) 214 - efi_earlycon_clear_scanline(efi_y + i); 213 + efi_earlycon_clear_scanline(efi_y + i, si); 215 214 } 216 215 } 217 216 } ··· 227 226 static int __init efi_earlycon_setup(struct earlycon_device *device, 228 227 const char *opt) 229 228 { 230 - struct screen_info *si; 229 + const struct screen_info *si = &screen_info; 231 230 u16 xres, yres; 232 231 u32 i; 233 232 234 233 fb_wb = opt && !strcmp(opt, "ram"); 235 234 236 - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) { 235 + if (si->orig_video_isVGA != VIDEO_TYPE_EFI) { 237 236 fb_probed = true; 238 237 return -ENODEV; 239 238 } 240 239 241 - fb_base = screen_info.lfb_base; 242 - if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) 243 - fb_base |= (u64)screen_info.ext_lfb_base << 32; 240 + fb_base = si->lfb_base; 241 + if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) 242 + fb_base |= (u64)si->ext_lfb_base << 32; 244 243 245 - si = &screen_info; 246 244 xres = si->lfb_width; 247 245 yres = si->lfb_height; 248 246 ··· 266 266 267 267 efi_y -= font->height; 268 268 for (i = 0; i < (yres - efi_y) / font->height; i++) 269 - efi_earlycon_scroll_up(); 269 + efi_earlycon_scroll_up(si); 270 270 271 271 device->con->write = efi_earlycon_write; 272 272 earlycon_console = device->con;