From: Thomas Zimmermann <tzimmermann@suse.de>
To: ardb@kernel.org, javierm@redhat.com, arnd@arndb.de,
richard.lyu@suse.com, helgaas@kernel.org
Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
loongarch@lists.linux.dev, linux-riscv@lists.infradead.org,
dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org,
linux-pci@vger.kernel.org, linux-fbdev@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v3 2/9] efi: sysfb_efi: Reduce number of references to global screen_info
Date: Wed, 26 Nov 2025 17:03:19 +0100 [thread overview]
Message-ID: <20251126160854.553077-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20251126160854.553077-1-tzimmermann@suse.de>
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>
---
drivers/firmware/efi/sysfb_efi.c | 81 ++++++++++++++++---------------
drivers/firmware/sysfb.c | 4 +-
drivers/firmware/sysfb_simplefb.c | 2 +-
include/linux/sysfb.h | 9 ++--
4 files changed, 51 insertions(+), 45 deletions(-)
diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index 1e509595ac03..8e0f9d08397f 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -92,7 +92,7 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
})
#ifdef CONFIG_EFI
-static int __init efifb_set_system(const struct dmi_system_id *id)
+static int __init efifb_set_system(struct screen_info *si, const struct dmi_system_id *id)
{
struct efifb_dmi_info *info = id->driver_data;
@@ -101,14 +101,14 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
return 0;
/* Trust the bootloader over the DMI tables */
- if (screen_info.lfb_base == 0) {
+ if (si->lfb_base == 0) {
#if defined(CONFIG_PCI)
struct pci_dev *dev = NULL;
int found_bar = 0;
#endif
if (info->base) {
- screen_info.lfb_base = choose_value(info->base,
- screen_info.lfb_base, OVERRIDE_BASE,
+ si->lfb_base = choose_value(info->base,
+ si->lfb_base, OVERRIDE_BASE,
info->flags);
#if defined(CONFIG_PCI)
@@ -135,49 +135,53 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
start = pci_resource_start(dev, i);
end = pci_resource_end(dev, i);
- if (screen_info.lfb_base >= start &&
- screen_info.lfb_base < end) {
+ if (si->lfb_base >= start && si->lfb_base < end) {
found_bar = 1;
break;
}
}
}
if (!found_bar)
- screen_info.lfb_base = 0;
+ si->lfb_base = 0;
#endif
}
}
- if (screen_info.lfb_base) {
- screen_info.lfb_linelength = choose_value(info->stride,
- screen_info.lfb_linelength, OVERRIDE_STRIDE,
+ if (si->lfb_base) {
+ si->lfb_linelength = choose_value(info->stride,
+ si->lfb_linelength, OVERRIDE_STRIDE,
info->flags);
- screen_info.lfb_width = choose_value(info->width,
- screen_info.lfb_width, OVERRIDE_WIDTH,
+ si->lfb_width = choose_value(info->width,
+ si->lfb_width, OVERRIDE_WIDTH,
info->flags);
- screen_info.lfb_height = choose_value(info->height,
- screen_info.lfb_height, OVERRIDE_HEIGHT,
+ si->lfb_height = choose_value(info->height,
+ si->lfb_height, OVERRIDE_HEIGHT,
info->flags);
- if (screen_info.orig_video_isVGA == 0)
- screen_info.orig_video_isVGA = VIDEO_TYPE_EFI;
+ if (si->orig_video_isVGA == 0)
+ si->orig_video_isVGA = VIDEO_TYPE_EFI;
} else {
- screen_info.lfb_linelength = 0;
- screen_info.lfb_width = 0;
- screen_info.lfb_height = 0;
- screen_info.orig_video_isVGA = 0;
+ si->lfb_linelength = 0;
+ si->lfb_width = 0;
+ si->lfb_height = 0;
+ si->orig_video_isVGA = 0;
return 0;
}
printk(KERN_INFO "efifb: dmi detected %s - framebuffer at 0x%08x "
"(%dx%d, stride %d)\n", id->ident,
- screen_info.lfb_base, screen_info.lfb_width,
- screen_info.lfb_height, screen_info.lfb_linelength);
+ si->lfb_base, si->lfb_width,
+ si->lfb_height, si->lfb_linelength);
return 1;
}
+static int __init efifb_set_system_callback(const struct dmi_system_id *id)
+{
+ return efifb_set_system(&screen_info, id);
+}
+
#define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid) \
{ \
- efifb_set_system, \
+ efifb_set_system_callback, \
name, \
{ \
DMI_MATCH(DMI_BIOS_VENDOR, vendor), \
@@ -284,12 +288,13 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
{},
};
-static bool efifb_overlaps_pci_range(const struct of_pci_range *range)
+static bool efifb_overlaps_pci_range(const struct screen_info *si,
+ const struct of_pci_range *range)
{
- u64 fb_base = screen_info.lfb_base;
+ u64 fb_base = si->lfb_base;
- if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
- fb_base |= (u64)(unsigned long)screen_info.ext_lfb_base << 32;
+ if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE)
+ fb_base |= (u64)(unsigned long)si->ext_lfb_base << 32;
return fb_base >= range->cpu_addr &&
fb_base < (range->cpu_addr + range->size);
@@ -311,7 +316,7 @@ static struct device_node *find_pci_overlap_node(void)
}
for_each_of_pci_range(&parser, &range)
- if (efifb_overlaps_pci_range(&range))
+ if (efifb_overlaps_pci_range(&screen_info, &range))
return np;
}
return NULL;
@@ -349,25 +354,25 @@ static const struct fwnode_operations efifb_fwnode_ops = {
static struct fwnode_handle efifb_fwnode;
-__init void sysfb_apply_efi_quirks(void)
+__init void sysfb_apply_efi_quirks(struct screen_info *si)
{
- if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
- !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
+ if (si->orig_video_isVGA != VIDEO_TYPE_EFI ||
+ !(si->capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
dmi_check_system(efifb_dmi_system_table);
- if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
+ if (si->orig_video_isVGA == VIDEO_TYPE_EFI &&
dmi_check_system(efifb_dmi_swap_width_height)) {
- u16 temp = screen_info.lfb_width;
+ u16 temp = si->lfb_width;
- screen_info.lfb_width = screen_info.lfb_height;
- screen_info.lfb_height = temp;
- screen_info.lfb_linelength = 4 * screen_info.lfb_width;
+ si->lfb_width = si->lfb_height;
+ si->lfb_height = temp;
+ si->lfb_linelength = 4 * si->lfb_width;
}
}
-__init void sysfb_set_efifb_fwnode(struct platform_device *pd)
+__init void sysfb_set_efifb_fwnode(const struct screen_info *si, struct platform_device *pd)
{
- if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI && IS_ENABLED(CONFIG_PCI)) {
+ if (si->orig_video_isVGA == VIDEO_TYPE_EFI && IS_ENABLED(CONFIG_PCI)) {
fwnode_init(&efifb_fwnode, &efifb_fwnode_ops);
pd->dev.fwnode = &efifb_fwnode;
}
diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
index 889e5b05c739..916b28538a29 100644
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -155,7 +155,7 @@ static __init int sysfb_init(void)
if (disabled)
goto unlock_mutex;
- sysfb_apply_efi_quirks();
+ sysfb_apply_efi_quirks(si);
parent = sysfb_parent_dev(si);
if (IS_ERR(parent)) {
@@ -200,7 +200,7 @@ static __init int sysfb_init(void)
pd->dev.parent = parent;
- sysfb_set_efifb_fwnode(pd);
+ sysfb_set_efifb_fwnode(si, pd);
ret = platform_device_add_data(pd, si, sizeof(*si));
if (ret)
diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c
index 592d8a644619..71f542e37732 100644
--- a/drivers/firmware/sysfb_simplefb.c
+++ b/drivers/firmware/sysfb_simplefb.c
@@ -117,7 +117,7 @@ __init struct platform_device *sysfb_create_simplefb(const struct screen_info *s
pd->dev.parent = parent;
- sysfb_set_efifb_fwnode(pd);
+ sysfb_set_efifb_fwnode(si, pd);
ret = platform_device_add_resources(pd, &res, 1);
if (ret)
diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
index b449665c686a..8527a50a5290 100644
--- a/include/linux/sysfb.h
+++ b/include/linux/sysfb.h
@@ -82,16 +82,17 @@ static inline bool sysfb_handles_screen_info(void)
#ifdef CONFIG_EFI
extern struct efifb_dmi_info efifb_dmi_list[];
-void sysfb_apply_efi_quirks(void);
-void sysfb_set_efifb_fwnode(struct platform_device *pd);
+void sysfb_apply_efi_quirks(struct screen_info *si);
+void sysfb_set_efifb_fwnode(const struct screen_info *si, struct platform_device *pd);
#else /* CONFIG_EFI */
-static inline void sysfb_apply_efi_quirks(void)
+static inline void sysfb_apply_efi_quirks(struct screen_info *si)
{
}
-static inline void sysfb_set_efifb_fwnode(struct platform_device *pd)
+static inline void sysfb_set_efifb_fwnode(const struct screen_info *si,
+ struct platform_device *pd)
{
}
--
2.51.1
next prev parent reply other threads:[~2025-11-26 16:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 16:03 [PATCH v3 0/9] arch,sysfb,efi: Support EDID on non-x86 EFI systems Thomas Zimmermann
2025-11-26 16:03 ` [PATCH v3 1/9] efi: earlycon: Reduce number of references to global screen_info Thomas Zimmermann
2025-11-26 16:03 ` Thomas Zimmermann [this message]
2025-11-26 16:03 ` [PATCH v3 3/9] sysfb: Add struct sysfb_display_info Thomas Zimmermann
2025-11-27 1:18 ` Richard Lyu
2025-11-26 16:03 ` [PATCH v3 4/9] sysfb: Replace screen_info with sysfb_primary_display Thomas Zimmermann
2025-11-27 1:21 ` Richard Lyu
2025-11-26 16:03 ` [PATCH v3 5/9] sysfb: Pass sysfb_primary_display to devices Thomas Zimmermann
2025-11-27 1:23 ` Richard Lyu
2025-11-26 16:03 ` [PATCH v3 6/9] sysfb: Move edid_info into sysfb_primary_display Thomas Zimmermann
2025-11-26 16:03 ` [PATCH v3 7/9] efi: Refactor init_primary_display() helpers Thomas Zimmermann
2025-12-16 13:40 ` Ard Biesheuvel
2025-11-26 16:03 ` [PATCH v3 8/9] efi: Support EDID information Thomas Zimmermann
2025-11-26 16:03 ` [PATCH v3 9/9] efi: libstub: Simplify interfaces for primary_display Thomas Zimmermann
2025-12-16 13:23 ` Ard Biesheuvel
2025-12-21 16:18 ` Thomas Zimmermann
2025-11-27 2:20 ` [PATCH v3 0/9] arch,sysfb,efi: Support EDID on non-x86 EFI systems Richard Lyu
2025-11-27 7:43 ` Thomas Zimmermann
2025-12-04 9:17 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251126160854.553077-3-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=helgaas@kernel.org \
--cc=javierm@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=richard.lyu@suse.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).