chrome platform firmware changes for 6.13

* Fixes
 
   - Do not double register "simple-framebuffer" platform device if
     Generic System Framebuffers (sysfb) already did that.
   - Fix a missing of unregistering platform driver in error handling
     path.
 -----BEGIN PGP SIGNATURE-----
 
 iIkEABYIADEWIQS0yQeDP3cjLyifNRUrxTEGBto89AUCZzqHexMcdHp1bmdiaUBr
 ZXJuZWwub3JnAAoJECvFMQYG2jz0DQsA/imlFXX/ZcRTwN/bdg/cs0OqXsUJAfsz
 vPTktLrhrGnkAQD+pFThq4Ql5bSv26tQmaHDME884j3a8pcRXUhbtG7XAw==
 =s5c3
 -----END PGP SIGNATURE-----

Merge tag 'chrome-platform-firmware-for-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform firmware updates from Tzung-Bi Shih:

 - Do not double register "simple-framebuffer" platform device if
   Generic System Framebuffers (sysfb) already did that

 - Fix a missing of unregistering platform driver in error handling path

* tag 'chrome-platform-firmware-for-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  firmware: google: Unregister driver_info on failure
  firmware: coreboot: Don't register a pdev if screen_info data is present
  firmware: sysfb: Add a sysfb_handles_screen_info() helper function
This commit is contained in:
Linus Torvalds 2024-11-19 10:25:47 -08:00
commit 1af29b34ea
4 changed files with 44 additions and 2 deletions

View File

@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/platform_data/simplefb.h>
#include <linux/platform_device.h>
#include <linux/sysfb.h>
#include "coreboot_table.h"
@ -36,6 +37,19 @@ static int framebuffer_probe(struct coreboot_device *dev)
.format = NULL,
};
/*
* On coreboot systems, the advertised LB_TAG_FRAMEBUFFER entry
* in the coreboot table should only be used if the payload did
* not pass a framebuffer information to the Linux kernel.
*
* If the global screen_info data has been filled, the Generic
* System Framebuffers (sysfb) will already register a platform
* device and pass that screen_info as platform_data to a driver
* that can scan-out using the system provided framebuffer.
*/
if (sysfb_handles_screen_info())
return -ENODEV;
if (!fb->physical_address)
return -ENODEV;

View File

@ -918,7 +918,8 @@ static __init int gsmi_init(void)
gsmi_dev.pdev = platform_device_register_full(&gsmi_dev_info);
if (IS_ERR(gsmi_dev.pdev)) {
printk(KERN_ERR "gsmi: unable to register platform device\n");
return PTR_ERR(gsmi_dev.pdev);
ret = PTR_ERR(gsmi_dev.pdev);
goto out_unregister;
}
/* SMI access needs to be serialized */
@ -1056,10 +1057,11 @@ out_err:
gsmi_buf_free(gsmi_dev.name_buf);
kmem_cache_destroy(gsmi_dev.mem_pool);
platform_device_unregister(gsmi_dev.pdev);
pr_info("gsmi: failed to load: %d\n", ret);
out_unregister:
#ifdef CONFIG_PM
platform_driver_unregister(&gsmi_driver_info);
#endif
pr_info("gsmi: failed to load: %d\n", ret);
return ret;
}

View File

@ -79,6 +79,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)
{

View File

@ -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