Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65b4021e authored by David Herrmann's avatar David Herrmann Committed by Tomi Valkeinen
Browse files

fbdev: efifb: add dev->remove() callback



If x86-sysfb platform-devices are removed from a system, we should
properly unload efifb. Otherwise, we end up releasing the parent while our
efi framebuffer is still running. This currently works just fine, but will
cause problems on handover to real hw. So add the ->remove() callback and
unregister efifb.

Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent a9b47c7f
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ static void efifb_destroy(struct fb_info *info)
		release_mem_region(info->apertures->ranges[0].base,
				   info->apertures->ranges[0].size);
	fb_dealloc_cmap(&info->cmap);
	framebuffer_release(info);
}

static struct fb_ops efifb_ops = {
@@ -244,6 +243,7 @@ static int efifb_probe(struct platform_device *dev)
		err = -ENOMEM;
		goto err_release_mem;
	}
	platform_set_drvdata(dev, info);
	info->pseudo_palette = info->par;
	info->par = NULL;

@@ -337,12 +337,23 @@ static int efifb_probe(struct platform_device *dev)
	return err;
}

static int efifb_remove(struct platform_device *pdev)
{
	struct fb_info *info = platform_get_drvdata(pdev);

	unregister_framebuffer(info);
	framebuffer_release(info);

	return 0;
}

static struct platform_driver efifb_driver = {
	.driver = {
		.name = "efi-framebuffer",
		.owner = THIS_MODULE,
	},
	.probe = efifb_probe,
	.remove = efifb_remove,
};

module_platform_driver(efifb_driver);