[PATCH v3] firmware: coreboot: Don't register a pdev if screen_info data is present

Tzung-Bi Shih tzungbi at kernel.org
Sun Sep 15 12:53:48 UTC 2024


On Fri, Sep 13, 2024 at 11:32:29PM +0200, Javier Martinez Canillas wrote:
> @@ -27,8 +28,10 @@ static int framebuffer_probe(struct coreboot_device *dev)
>  	int i;
>  	u32 length;
>  	struct lb_framebuffer *fb = &dev->framebuffer;
> +	const struct screen_info *si = &screen_info;
>  	struct platform_device *pdev;
>  	struct resource res;
> +	unsigned int type;
>  	struct simplefb_platform_data pdata = {
>  		.width = fb->x_resolution,
>  		.height = fb->y_resolution,
> @@ -36,6 +39,20 @@ 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.
> +	 */
> +	type = screen_info_video_type(si);
> +	if (type)
> +		return -ENODEV;

Given that `type` and `si` aren't used in otherwhere, the local variables can
be dropped.

I haven't had chance to see how to fix the 0-day build errors properly.  If you
have chance to send the next versions, please drop the local variables.


More information about the Intel-gfx mailing list