public inbox for chrome-platform@lists.linux.dev
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: tzungbi@kernel.org, briannorris@chromium.org,
	jwerner@chromium.org, javierm@redhat.com, samuel@sholland.org,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, simona@ffwll.ch
Cc: chrome-platform@lists.linux.dev, dri-devel@lists.freedesktop.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 03/12] firmware: google: framebuffer: Init memory resource with helper macro
Date: Thu, 15 Jan 2026 08:57:13 +0100	[thread overview]
Message-ID: <20260115082128.12460-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20260115082128.12460-1-tzimmermann@suse.de>

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>
---
 drivers/firmware/google/framebuffer-coreboot.c | 15 +++++----------
 1 file 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,
-- 
2.52.0


  parent reply	other threads:[~2026-01-15  8:21 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15  7:57 [PATCH v2 00/12] drm, coreboot: Add DRM coreboot driver Thomas Zimmermann
2026-01-15  7:57 ` [PATCH v2 01/12] firmware: google: framebuffer: Do not unregister platform device Thomas Zimmermann
2026-01-26  8:28   ` Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 02/12] firmware: google: framebuffer: Do not mark framebuffer as busy Thomas Zimmermann
2026-01-26  8:28   ` Tzung-Bi Shih
2026-01-15  7:57 ` Thomas Zimmermann [this message]
2026-01-26  8:28   ` [PATCH v2 03/12] firmware: google: framebuffer: Init memory resource with helper macro Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 04/12] firmware: google: framebuffer: Tie platform device to PCI hardware Thomas Zimmermann
2026-01-26  8:29   ` Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 05/12] firmware: google: framebuffer: Fix dependencies Thomas Zimmermann
2026-01-15 20:54   ` Julius Werner
2026-01-16  7:30     ` Thomas Zimmermann
2026-01-17  1:38       ` Julius Werner
2026-01-29 12:41         ` Thomas Zimmermann
2026-01-26 10:24   ` Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 06/12] firmware: google: Init coreboot bus with subsys_initcall() Thomas Zimmermann
2026-01-26 10:25   ` Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 07/12] firmware: google: Clean up include statements in coreboot_table.h Thomas Zimmermann
2026-01-26 10:25   ` Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 08/12] firmware: google: Export coreboot table entries Thomas Zimmermann
2026-01-26 10:25   ` Tzung-Bi Shih
2026-01-15  7:57 ` [PATCH v2 09/12] firmware: google: Pack structures for " Thomas Zimmermann
2026-01-15 20:56   ` Julius Werner
2026-01-16  7:32     ` Thomas Zimmermann
2026-01-15  7:57 ` [PATCH v2 10/12] drm/sysfb: Generalize pixel-format matching Thomas Zimmermann
2026-01-15  7:57 ` [PATCH v2 11/12] drm/sysfb: corebootdrm: Add DRM driver for coreboot framebuffers Thomas Zimmermann
2026-01-27  7:49   ` Tzung-Bi Shih
2026-01-29 14:56     ` Thomas Zimmermann
2026-01-15  7:57 ` [PATCH v2 12/12] drm/corebotdrm: Support panel orientation Thomas Zimmermann
2026-01-27  7:49   ` Tzung-Bi Shih
2026-01-27  8:04     ` Tzung-Bi Shih
2026-01-29 15:01       ` Thomas Zimmermann
2026-01-15 20:58 ` [PATCH v2 00/12] drm, coreboot: Add DRM coreboot driver Julius Werner
2026-01-16  7:33   ` Thomas Zimmermann
2026-01-16  9:13 ` Tzung-Bi Shih
2026-01-16  9:19   ` Thomas Zimmermann
2026-01-16  9:51     ` Tzung-Bi Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260115082128.12460-4-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=briannorris@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=jwerner@chromium.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=samuel@sholland.org \
    --cc=simona@ffwll.ch \
    --cc=tzungbi@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox