Message ID | 20240916110040.1688511-2-javierm@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6074e905023d09f64f2c896f475820a5623deb2c |
Headers | show |
Series | firmware: Avoid coreboot and sysfb to register a pdev for same framebuffer | expand |
Am 16.09.24 um 13:00 schrieb Javier Martinez Canillas: > That can be used by drivers to check if the Generic System Framebuffers > (sysfb) support can handle the data contained in the global screen_info. > > Drivers might need this information to know if have to setup the system > framebuffer, or if they have to delegate this action to sysfb instead. > > Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> > Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> > --- > > Changes in v4: > - New patch to add sysfb_handles_screen_info() helper (Thomas Zimmermann). > > drivers/firmware/sysfb.c | 19 +++++++++++++++++++ > include/linux/sysfb.h | 7 +++++++ > 2 files changed, 26 insertions(+) > > diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c > index 02a07d3d0d40..770e74be14f3 100644 > --- a/drivers/firmware/sysfb.c > +++ b/drivers/firmware/sysfb.c > @@ -77,6 +77,25 @@ void sysfb_disable(struct device *dev) > } > EXPORT_SYMBOL_GPL(sysfb_disable); > > +/** > + * sysfb_handles_screen_info() - reports if sysfb handles the global screen_info > + * > + * Callers can use sysfb_handles_screen_info() to determine whether the Generic > + * System Framebuffers (sysfb) can handle the global screen_info data structure > + * or not. Drivers might need this information to know if they have to setup the > + * system framebuffer, or if they have to delegate this action to sysfb instead. > + * > + * Returns: > + * True if sysfb handles the global screen_info data structure. > + */ > +bool sysfb_handles_screen_info(void) > +{ > + const struct screen_info *si = &screen_info; > + > + return !!screen_info_video_type(si); > +} > +EXPORT_SYMBOL_GPL(sysfb_handles_screen_info); > + > #if defined(CONFIG_PCI) > static bool sysfb_pci_dev_is_enabled(struct pci_dev *pdev) > { > diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h > index bef5f06a91de..07cbab516942 100644 > --- a/include/linux/sysfb.h > +++ b/include/linux/sysfb.h > @@ -60,12 +60,19 @@ struct efifb_dmi_info { > > void sysfb_disable(struct device *dev); > > +bool sysfb_handles_screen_info(void); > + > #else /* CONFIG_SYSFB */ > > static inline void sysfb_disable(struct device *dev) > { > } > > +static inline bool sysfb_handles_screen_info(void) > +{ > + return false; > +} > + > #endif /* CONFIG_SYSFB */ > > #ifdef CONFIG_EFI
diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 02a07d3d0d40..770e74be14f3 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -77,6 +77,25 @@ void sysfb_disable(struct device *dev) } EXPORT_SYMBOL_GPL(sysfb_disable); +/** + * sysfb_handles_screen_info() - reports if sysfb handles the global screen_info + * + * Callers can use sysfb_handles_screen_info() to determine whether the Generic + * System Framebuffers (sysfb) can handle the global screen_info data structure + * or not. Drivers might need this information to know if they have to setup the + * system framebuffer, or if they have to delegate this action to sysfb instead. + * + * Returns: + * True if sysfb handles the global screen_info data structure. + */ +bool sysfb_handles_screen_info(void) +{ + const struct screen_info *si = &screen_info; + + return !!screen_info_video_type(si); +} +EXPORT_SYMBOL_GPL(sysfb_handles_screen_info); + #if defined(CONFIG_PCI) static bool sysfb_pci_dev_is_enabled(struct pci_dev *pdev) { diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index bef5f06a91de..07cbab516942 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -60,12 +60,19 @@ struct efifb_dmi_info { void sysfb_disable(struct device *dev); +bool sysfb_handles_screen_info(void); + #else /* CONFIG_SYSFB */ static inline void sysfb_disable(struct device *dev) { } +static inline bool sysfb_handles_screen_info(void) +{ + return false; +} + #endif /* CONFIG_SYSFB */ #ifdef CONFIG_EFI
That can be used by drivers to check if the Generic System Framebuffers (sysfb) support can handle the data contained in the global screen_info. Drivers might need this information to know if have to setup the system framebuffer, or if they have to delegate this action to sysfb instead. Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> --- Changes in v4: - New patch to add sysfb_handles_screen_info() helper (Thomas Zimmermann). drivers/firmware/sysfb.c | 19 +++++++++++++++++++ include/linux/sysfb.h | 7 +++++++ 2 files changed, 26 insertions(+)