public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Amit Barzilai <amit.barzilai22@gmail.com>
To: deller@gmx.de
Cc: thomas.zimmermann@suse.de, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Amit Barzilai <amit.barzilai22@gmail.com>
Subject: [PATCH 2/3] fbdev: clps711x-fb: Request memory region for MMIO
Date: Mon, 20 Apr 2026 16:44:23 +0300	[thread overview]
Message-ID: <20260420134424.77494-3-amit.barzilai22@gmail.com> (raw)
In-Reply-To: <20260420134424.77494-1-amit.barzilai22@gmail.com>

Use devm_platform_get_and_ioremap_resource() for resource 0 (the MMIO
control register range) instead of open-coding platform_get_resource()
and devm_ioremap() separately. The helper requests the memory region
before mapping it, which registers the range in /proc/iomem and prevents
another driver from mapping the same registers.

This makes resource 0 consistent with resource 1 (the framebuffer),
which already uses devm_platform_get_and_ioremap_resource().

Assisted-by: Claude:claude-sonnet-4-6
---
 drivers/video/fbdev/clps711x-fb.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
index 5e61a349a4ab..7a7db7100499 100644
--- a/drivers/video/fbdev/clps711x-fb.c
+++ b/drivers/video/fbdev/clps711x-fb.c
@@ -216,12 +216,9 @@ static int clps711x_fb_probe(struct platform_device *pdev)
 	cfb = info->par;
 	platform_set_drvdata(pdev, info);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		goto out_fb_release;
-	cfb->base = devm_ioremap(dev, res->start, resource_size(res));
-	if (!cfb->base) {
-		ret = -ENOMEM;
+	cfb->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(cfb->base)) {
+		ret = PTR_ERR(cfb->base);
 		goto out_fb_release;
 	}
 
-- 
2.53.0


  parent reply	other threads:[~2026-04-20 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 13:44 [PATCH 0/3] fbdev: Request memory regions in platform drivers Amit Barzilai
2026-04-20 13:44 ` [PATCH 1/3] fbdev: cobalt_lcdfb: Request memory region Amit Barzilai
2026-04-22 14:50   ` Helge Deller
2026-04-22 15:29     ` Amit Barzilai
2026-04-20 13:44 ` Amit Barzilai [this message]
2026-04-20 13:44 ` [PATCH 3/3] fbdev: goldfishfb: " Amit Barzilai
2026-04-22 14:43   ` Helge Deller

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=20260420134424.77494-3-amit.barzilai22@gmail.com \
    --to=amit.barzilai22@gmail.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=thomas.zimmermann@suse.de \
    /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