Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-sound@vger.kernel.org
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ALSA: sis7019: Use pcim_iomap_region() for MMIO BAR
Date: Sun, 19 Jul 2026 17:09:29 -0700	[thread overview]
Message-ID: <20260720000929.1432533-1-rosenp@gmail.com> (raw)

Replace the open-coded pcim_request_all_regions() +
devm_ioremap() pair with per-BAR pcim helpers: reserve BAR0 (the
I/O port region, used via inl/outl) with pcim_request_region(), and
reserve + iomap BAR1 (MMIO) with a single pcim_iomap_region() call.

This folds the BAR1 reserve and iomap into one managed call. The
error check moves from a NULL test to IS_ERR(), since pcim_iomap_region()
returns an IOMEM_ERR_PTR on failure.

Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 sound/pci/sis7019.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 4be085d27712..55c1b11a2900 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1260,16 +1260,16 @@ static int sis_chip_create(struct snd_card *card,
 	sis->irq = -1;
 	sis->ioport = pci_resource_start(pci, 0);
 
-	rc = pcim_request_all_regions(pci, "SiS7019");
+	rc = pcim_request_region(pci, 0, "SiS7019");
 	if (rc) {
-		dev_err(&pci->dev, "unable request regions\n");
+		dev_err(&pci->dev, "unable request I/O region\n");
 		return rc;
 	}
 
-	sis->ioaddr = devm_ioremap(&pci->dev, pci_resource_start(pci, 1), 0x4000);
-	if (!sis->ioaddr) {
+	sis->ioaddr = pcim_iomap_region(pci, 1, "SiS7019");
+	if (IS_ERR(sis->ioaddr)) {
 		dev_err(&pci->dev, "unable to remap MMIO, aborting\n");
-		return -EIO;
+		return PTR_ERR(sis->ioaddr);
 	}
 
 	rc = sis_alloc_suspend(sis);
-- 
2.55.0


             reply	other threads:[~2026-07-20  0:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  0:09 Rosen Penev [this message]
2026-07-20  6:45 ` [PATCH] ALSA: sis7019: Use pcim_iomap_region() for MMIO BAR Takashi Iwai

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=20260720000929.1432533-1-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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