mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
To: Helge Deller <deller@gmx.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Frank Li <Frank.Li@nxp.com>, Zi Yan <ziy@nvidia.com>,
	Donet Tom <donettom@linux.ibm.com>, Yann Dirson <ydirson@free.fr>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Vivek Kasireddy <vivek.kasireddy@intel.com>,
	Qianfeng Rong <rongqianfeng@vivo.com>,
	Kees Cook <kees@kernel.org>,
	linux-fbdev@vger.kernel.org (open list:FRAMEBUFFER LAYER),
	dri-devel@lists.freedesktop.org (open list:FRAMEBUFFER LAYER),
	linux-kernel@vger.kernel.org (open list)
Cc: skhan@linuxfoundation.org, david.hunter.linux@gmail.com,
	Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
Subject: [PATCH v2] fbdev: arkfb: Request legacy VGA I/O region
Date: Sat, 13 Dec 2025 20:22:34 +0000	[thread overview]
Message-ID: <20251213202239.8772-1-swarajgaikwad1925@gmail.com> (raw)

The arkfb driver uses the legacy VGA I/O range (0x3c0+) but does not
request it. This can cause conflicts with other drivers that try to
reserve these ports.

Fix this by using devm_request_region() during the probe function.
This ensures the region is properly reserved and automatically released
on driver detach.

v1: https://lore.kernel.org/lkml/20251213154937.104301-1-swarajgaikwad1925@gmail.com/
Signed-off-by: Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
---
v2:
 - Use resource_size(&vga_res) instead of hardcoded 64 * 1024.
 - (Feedback from Kees Cook)

Compile-tested only on x86_64.

 drivers/video/fbdev/arkfb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c
index ec084323115f..24e4c20d1a32 100644
--- a/drivers/video/fbdev/arkfb.c
+++ b/drivers/video/fbdev/arkfb.c
@@ -1018,6 +1018,12 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)

 	pcibios_bus_to_resource(dev->bus, &vga_res, &bus_reg);

+	if (!devm_request_region(&dev->dev, vga_res.start, resource_size(&vga_res), "arkfb-vga")) {
+		dev_err(info->device, "cannot reserve legacy VGA ports\n");
+		rc = -EBUSY;
+		goto err_find_mode;
+	}
+
 	par->state.vgabase = (void __iomem *) (unsigned long) vga_res.start;

 	/* FIXME get memsize */

base-commit: a859eca0e4cc96f63ff125dbe5388d961558b0e9
--
2.52.0


             reply	other threads:[~2025-12-13 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-13 20:22 Swaraj Gaikwad [this message]
2025-12-13 22:38 ` Sam Ravnborg
2025-12-14 11:19   ` Swaraj Gaikwad

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=20251213202239.8772-1-swarajgaikwad1925@gmail.com \
    --to=swarajgaikwad1925@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=david.hunter.linux@gmail.com \
    --cc=deller@gmx.de \
    --cc=donettom@linux.ibm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=kees@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=rongqianfeng@vivo.com \
    --cc=skhan@linuxfoundation.org \
    --cc=vivek.kasireddy@intel.com \
    --cc=ydirson@free.fr \
    --cc=ziy@nvidia.com \
    /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

all inboxes | Powered by JetHome®