diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2026-02-17 18:56:13 +0300 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2026-02-20 16:38:18 +0300 |
| commit | 94918485d266ea2b578f36955c8cc88a33706e28 (patch) | |
| tree | 98db262eba05b8b73fd201bfe5c84bc276cb0bfa | |
| parent | f3850d399de3b6142b02315227ef9e772ed0c302 (diff) | |
| download | linux-94918485d266ea2b578f36955c8cc88a33706e28.tar.xz | |
firmware: google: framebuffer: Init memory resource with helper macro
Initialize framebuffer memory resource with DEFINE_RES_MEM() instead
of open-coding the setup.
While at it, drop the resource name to make the kernel use the device
name of the simple-framebuffer device for the resource. The latter
includes a device number. While the meaning of the resource name is
somewhat fuzzy and varies across entries in /proc/iomem, showing the
device name seems more helpful than showing a fixed name.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
Acked-by: Julius Werner <jwerner@chromium.org>
Link: https://patch.msgid.link/20260217155836.96267-4-tzimmermann@suse.de
| -rw-r--r-- | drivers/firmware/google/framebuffer-coreboot.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/firmware/google/framebuffer-coreboot.c b/drivers/firmware/google/framebuffer-coreboot.c index f44183476ed7..767515a30a52 100644 --- a/drivers/firmware/google/framebuffer-coreboot.c +++ b/drivers/firmware/google/framebuffer-coreboot.c @@ -26,7 +26,6 @@ static const struct simplefb_format formats[] = SIMPLEFB_FORMATS; static int framebuffer_probe(struct coreboot_device *dev) { int i; - u32 length; struct lb_framebuffer *fb = &dev->framebuffer; struct platform_device *pdev; struct resource res; @@ -53,6 +52,11 @@ static int framebuffer_probe(struct coreboot_device *dev) if (!fb->physical_address) return -ENODEV; + res = DEFINE_RES_MEM(fb->physical_address, + PAGE_ALIGN(fb->y_resolution * fb->bytes_per_line)); + if (res.end <= res.start) + return -EINVAL; + for (i = 0; i < ARRAY_SIZE(formats); ++i) { if (fb->bits_per_pixel == formats[i].bits_per_pixel && fb->red_mask_pos == formats[i].red.offset && @@ -66,15 +70,6 @@ static int framebuffer_probe(struct coreboot_device *dev) if (!pdata.format) return -ENODEV; - memset(&res, 0, sizeof(res)); - res.flags = IORESOURCE_MEM; - res.name = "Coreboot Framebuffer"; - res.start = fb->physical_address; - length = PAGE_ALIGN(fb->y_resolution * fb->bytes_per_line); - res.end = res.start + length - 1; - if (res.end <= res.start) - return -EINVAL; - pdev = platform_device_register_resndata(&dev->dev, "simple-framebuffer", 0, &res, 1, &pdata, |
