From: Sam Ravnborg <sam@ravnborg.org>
To: Swaraj Gaikwad <swarajgaikwad1925@gmail.com>
Cc: 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>,
"open list:FRAMEBUFFER LAYER" <linux-fbdev@vger.kernel.org>,
"open list:FRAMEBUFFER LAYER" <dri-devel@lists.freedesktop.org>,
open list <linux-kernel@vger.kernel.org>,
skhan@linuxfoundation.org, david.hunter.linux@gmail.com
Subject: Re: [PATCH v2] fbdev: arkfb: Request legacy VGA I/O region
Date: Sat, 13 Dec 2025 23:38:50 +0100 [thread overview]
Message-ID: <20251213223850.GA419250@ravnborg.org> (raw)
In-Reply-To: <20251213202239.8772-1-swarajgaikwad1925@gmail.com>
Hi Swaraj,
On Sat, Dec 13, 2025 at 08:22:34PM +0000, Swaraj Gaikwad wrote:
> 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;
Any explanation why devm_request_region() is the right choice here?
As per the line above vga_res.start is iomem, and I had expected to see
devm_request_mem_region() used.
I looked only briefly, so I may be wrong.
Sam
next prev parent reply other threads:[~2025-12-13 22:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-13 20:22 [PATCH v2] fbdev: arkfb: Request legacy VGA I/O region Swaraj Gaikwad
2025-12-13 22:38 ` Sam Ravnborg [this message]
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=20251213223850.GA419250@ravnborg.org \
--to=sam@ravnborg.org \
--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=swarajgaikwad1925@gmail.com \
--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