Commit 1af29b34 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'chrome-platform-firmware-for-6.13' of...

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
parents 78516f4a 32b0901e
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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;

+4 −2
Original line number Diff line number Diff line
@@ -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 @@ static __init int gsmi_init(void)
	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;
}

+19 −0
Original line number Diff line number Diff line
@@ -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)
{
+7 −0
Original line number Diff line number Diff line
@@ -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