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: sysfb_efi: 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
54bdafd7 b868070f

+47 -41
+39 -34
drivers/firmware/efi/sysfb_efi.c
··· 92 92 }) 93 93 94 94 #ifdef CONFIG_EFI 95 - static int __init efifb_set_system(const struct dmi_system_id *id) 95 + static int __init efifb_set_system(struct screen_info *si, const struct dmi_system_id *id) 96 96 { 97 97 struct efifb_dmi_info *info = id->driver_data; 98 98 ··· 101 101 return 0; 102 102 103 103 /* Trust the bootloader over the DMI tables */ 104 - if (screen_info.lfb_base == 0) { 104 + if (si->lfb_base == 0) { 105 105 #if defined(CONFIG_PCI) 106 106 struct pci_dev *dev = NULL; 107 107 int found_bar = 0; 108 108 #endif 109 109 if (info->base) { 110 - screen_info.lfb_base = choose_value(info->base, 111 - screen_info.lfb_base, OVERRIDE_BASE, 110 + si->lfb_base = choose_value(info->base, 111 + si->lfb_base, OVERRIDE_BASE, 112 112 info->flags); 113 113 114 114 #if defined(CONFIG_PCI) ··· 135 135 136 136 start = pci_resource_start(dev, i); 137 137 end = pci_resource_end(dev, i); 138 - if (screen_info.lfb_base >= start && 139 - screen_info.lfb_base < end) { 138 + if (si->lfb_base >= start && si->lfb_base < end) { 140 139 found_bar = 1; 141 140 break; 142 141 } 143 142 } 144 143 } 145 144 if (!found_bar) 146 - screen_info.lfb_base = 0; 145 + si->lfb_base = 0; 147 146 #endif 148 147 } 149 148 } 150 - if (screen_info.lfb_base) { 151 - screen_info.lfb_linelength = choose_value(info->stride, 152 - screen_info.lfb_linelength, OVERRIDE_STRIDE, 149 + if (si->lfb_base) { 150 + si->lfb_linelength = choose_value(info->stride, 151 + si->lfb_linelength, OVERRIDE_STRIDE, 153 152 info->flags); 154 - screen_info.lfb_width = choose_value(info->width, 155 - screen_info.lfb_width, OVERRIDE_WIDTH, 153 + si->lfb_width = choose_value(info->width, 154 + si->lfb_width, OVERRIDE_WIDTH, 156 155 info->flags); 157 - screen_info.lfb_height = choose_value(info->height, 158 - screen_info.lfb_height, OVERRIDE_HEIGHT, 156 + si->lfb_height = choose_value(info->height, 157 + si->lfb_height, OVERRIDE_HEIGHT, 159 158 info->flags); 160 - if (screen_info.orig_video_isVGA == 0) 161 - screen_info.orig_video_isVGA = VIDEO_TYPE_EFI; 159 + if (si->orig_video_isVGA == 0) 160 + si->orig_video_isVGA = VIDEO_TYPE_EFI; 162 161 } else { 163 - screen_info.lfb_linelength = 0; 164 - screen_info.lfb_width = 0; 165 - screen_info.lfb_height = 0; 166 - screen_info.orig_video_isVGA = 0; 162 + si->lfb_linelength = 0; 163 + si->lfb_width = 0; 164 + si->lfb_height = 0; 165 + si->orig_video_isVGA = 0; 167 166 return 0; 168 167 } 169 168 170 169 printk(KERN_INFO "efifb: dmi detected %s - framebuffer at 0x%08x " 171 170 "(%dx%d, stride %d)\n", id->ident, 172 - screen_info.lfb_base, screen_info.lfb_width, 173 - screen_info.lfb_height, screen_info.lfb_linelength); 171 + si->lfb_base, si->lfb_width, 172 + si->lfb_height, si->lfb_linelength); 174 173 175 174 return 1; 176 175 } 177 176 177 + static int __init efifb_set_system_callback(const struct dmi_system_id *id) 178 + { 179 + return efifb_set_system(&screen_info, id); 180 + } 181 + 178 182 #define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid) \ 179 183 { \ 180 - efifb_set_system, \ 184 + efifb_set_system_callback, \ 181 185 name, \ 182 186 { \ 183 187 DMI_MATCH(DMI_BIOS_VENDOR, vendor), \ ··· 351 347 {}, 352 348 }; 353 349 354 - static bool efifb_overlaps_pci_range(const struct of_pci_range *range) 350 + static bool efifb_overlaps_pci_range(const struct screen_info *si, 351 + const struct of_pci_range *range) 355 352 { 356 - u64 fb_base = screen_info.lfb_base; 353 + u64 fb_base = si->lfb_base; 357 354 358 - if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) 359 - fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32; 355 + if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) 356 + fb_base |= (u64)(unsigned long)si->ext_lfb_base << 32; 360 357 361 358 return fb_base >= range->cpu_addr && 362 359 fb_base < (range->cpu_addr + range->size); ··· 379 374 } 380 375 381 376 for_each_of_pci_range(&parser, &range) 382 - if (efifb_overlaps_pci_range(&range)) 377 + if (efifb_overlaps_pci_range(&screen_info, &range)) 383 378 return np; 384 379 } 385 380 return NULL; ··· 417 412 418 413 static struct fwnode_handle efifb_fwnode; 419 414 420 - __init void sysfb_apply_efi_quirks(void) 415 + __init void sysfb_apply_efi_quirks(struct screen_info *si) 421 416 { 422 - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI || 423 - !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS)) 417 + if (si->orig_video_isVGA != VIDEO_TYPE_EFI || 418 + !(si->capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS)) 424 419 dmi_check_system(efifb_dmi_system_table); 425 420 426 - if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) 421 + if (si->orig_video_isVGA == VIDEO_TYPE_EFI) 427 422 dmi_check_system(efifb_dmi_swap_width_height); 428 423 } 429 424 430 - __init void sysfb_set_efifb_fwnode(struct platform_device *pd) 425 + __init void sysfb_set_efifb_fwnode(const struct screen_info *si, struct platform_device *pd) 431 426 { 432 - if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI && IS_ENABLED(CONFIG_PCI)) { 427 + if (si->orig_video_isVGA == VIDEO_TYPE_EFI && IS_ENABLED(CONFIG_PCI)) { 433 428 fwnode_init(&efifb_fwnode, &efifb_fwnode_ops); 434 429 pd->dev.fwnode = &efifb_fwnode; 435 430 }
+2 -2
drivers/firmware/sysfb.c
··· 155 155 if (disabled) 156 156 goto unlock_mutex; 157 157 158 - sysfb_apply_efi_quirks(); 158 + sysfb_apply_efi_quirks(si); 159 159 160 160 parent = sysfb_parent_dev(si); 161 161 if (IS_ERR(parent)) { ··· 200 200 201 201 pd->dev.parent = parent; 202 202 203 - sysfb_set_efifb_fwnode(pd); 203 + sysfb_set_efifb_fwnode(si, pd); 204 204 205 205 ret = platform_device_add_data(pd, si, sizeof(*si)); 206 206 if (ret)
+1 -1
drivers/firmware/sysfb_simplefb.c
··· 117 117 118 118 pd->dev.parent = parent; 119 119 120 - sysfb_set_efifb_fwnode(pd); 120 + sysfb_set_efifb_fwnode(si, pd); 121 121 122 122 ret = platform_device_add_resources(pd, &res, 1); 123 123 if (ret)
+5 -4
include/linux/sysfb.h
··· 82 82 #ifdef CONFIG_EFI 83 83 84 84 extern struct efifb_dmi_info efifb_dmi_list[]; 85 - void sysfb_apply_efi_quirks(void); 86 - void sysfb_set_efifb_fwnode(struct platform_device *pd); 85 + void sysfb_apply_efi_quirks(struct screen_info *si); 86 + void sysfb_set_efifb_fwnode(const struct screen_info *si, struct platform_device *pd); 87 87 88 88 #else /* CONFIG_EFI */ 89 89 90 - static inline void sysfb_apply_efi_quirks(void) 90 + static inline void sysfb_apply_efi_quirks(struct screen_info *si) 91 91 { 92 92 } 93 93 94 - static inline void sysfb_set_efifb_fwnode(struct platform_device *pd) 94 + static inline void sysfb_set_efifb_fwnode(const struct screen_info *si, 95 + struct platform_device *pd) 95 96 { 96 97 } 97 98