public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@kernel.org>
To: "Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Jaya Kumar" <jayakumar.alsa@gmail.com>,
	"Clemens Ladisch" <clemens@ladisch.de>,
	"Cezary Rojewski" <cezary.rojewski@intel.com>,
	"Liam Girdwood" <liam.r.girdwood@linux.intel.com>,
	"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.dev>,
	"Mark Brown" <broonie@kernel.org>,
	"Daniel Baluta" <daniel.baluta@nxp.com>,
	"Colin Ian King" <colin.i.king@gmail.com>,
	"Philipp Stanner" <phasta@kernel.org>,
	"David Rhodes" <drhodes@opensource.cirrus.com>,
	liujing <liujing@cmss.chinamobile.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Andres Urian Florez" <andres.emb.sys@gmail.com>,
	"Oswald Buddenhagen" <oswald.buddenhagen@gmx.de>,
	"Thorsten Blum" <thorsten.blum@linux.dev>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Charles Keepax" <ckeepax@opensource.cirrus.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	sound-open-firmware@alsa-project.org
Subject: [PATCH 03/31] AsoC: intel/atom: Use pure devres PCI
Date: Wed, 16 Apr 2025 15:12:13 +0200	[thread overview]
Message-ID: <20250416131241.107903-4-phasta@kernel.org> (raw)
In-Reply-To: <20250416131241.107903-1-phasta@kernel.org>

pci_request_regions() is a hybrid function which becomes managed if
pcim_enable_device() was called before. This hybrid nature is deprecated
and should not be used anymore.

Replace pci_request_regions() with the always-managed function
pcim_request_all_regions().

Remove the call to pci_release_regions(), since pcim_ functions do
cleanup automatically.

Pass 0 as length parameter to pcim_iomap(), which is the standard way
for ioremapping an entire BAR.

Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
 sound/soc/intel/atom/sst/sst_pci.c | 56 ++++++++++++------------------
 1 file changed, 23 insertions(+), 33 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c
index d1e64c3500be..102d4b0e6125 100644
--- a/sound/soc/intel/atom/sst/sst_pci.c
+++ b/sound/soc/intel/atom/sst/sst_pci.c
@@ -26,7 +26,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
 	int ddr_base, ret = 0;
 	struct pci_dev *pci = ctx->pci;
 
-	ret = pci_request_regions(pci, SST_DRV_NAME);
+	ret = pcim_request_all_regions(pci, SST_DRV_NAME);
 	if (ret)
 		return ret;
 
@@ -38,66 +38,56 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
 		ddr_base = relocate_imr_addr_mrfld(ctx->ddr_base);
 		if (!ctx->pdata->lib_info) {
 			dev_err(ctx->dev, "lib_info pointer NULL\n");
-			ret = -EINVAL;
-			goto do_release_regions;
+			return -EINVAL;
 		}
 		if (ddr_base != ctx->pdata->lib_info->mod_base) {
 			dev_err(ctx->dev,
 					"FW LSP DDR BASE does not match with IFWI\n");
-			ret = -EINVAL;
-			goto do_release_regions;
+			return -EINVAL;
 		}
 		ctx->ddr_end = pci_resource_end(pci, 0);
 
-		ctx->ddr = pcim_iomap(pci, 0,
-					pci_resource_len(pci, 0));
-		if (!ctx->ddr) {
-			ret = -EINVAL;
-			goto do_release_regions;
-		}
+		ctx->ddr = pcim_iomap(pci, 0, 0);
+		if (!ctx->ddr)
+			return -EINVAL;
+
 		dev_dbg(ctx->dev, "sst: DDR Ptr %p\n", ctx->ddr);
 	} else {
 		ctx->ddr = NULL;
 	}
 	/* SHIM */
 	ctx->shim_phy_add = pci_resource_start(pci, 1);
-	ctx->shim = pcim_iomap(pci, 1, pci_resource_len(pci, 1));
-	if (!ctx->shim) {
-		ret = -EINVAL;
-		goto do_release_regions;
-	}
+	ctx->shim = pcim_iomap(pci, 1, 0);
+	if (!ctx->shim)
+		return -EINVAL;
+
 	dev_dbg(ctx->dev, "SST Shim Ptr %p\n", ctx->shim);
 
 	/* Shared SRAM */
 	ctx->mailbox_add = pci_resource_start(pci, 2);
-	ctx->mailbox = pcim_iomap(pci, 2, pci_resource_len(pci, 2));
-	if (!ctx->mailbox) {
-		ret = -EINVAL;
-		goto do_release_regions;
-	}
+	ctx->mailbox = pcim_iomap(pci, 2, 0);
+	if (!ctx->mailbox)
+		return -EINVAL;
+
 	dev_dbg(ctx->dev, "SRAM Ptr %p\n", ctx->mailbox);
 
 	/* IRAM */
 	ctx->iram_end = pci_resource_end(pci, 3);
 	ctx->iram_base = pci_resource_start(pci, 3);
-	ctx->iram = pcim_iomap(pci, 3, pci_resource_len(pci, 3));
-	if (!ctx->iram) {
-		ret = -EINVAL;
-		goto do_release_regions;
-	}
+	ctx->iram = pcim_iomap(pci, 3, 0);
+	if (!ctx->iram)
+		return -EINVAL;
+
 	dev_dbg(ctx->dev, "IRAM Ptr %p\n", ctx->iram);
 
 	/* DRAM */
 	ctx->dram_end = pci_resource_end(pci, 4);
 	ctx->dram_base = pci_resource_start(pci, 4);
-	ctx->dram = pcim_iomap(pci, 4, pci_resource_len(pci, 4));
-	if (!ctx->dram) {
-		ret = -EINVAL;
-		goto do_release_regions;
-	}
+	ctx->dram = pcim_iomap(pci, 4, 0);
+	if (!ctx->dram)
+		return -EINVAL;
+
 	dev_dbg(ctx->dev, "DRAM Ptr %p\n", ctx->dram);
-do_release_regions:
-	pci_release_regions(pci);
 	return ret;
 }
 
-- 
2.48.1


  parent reply	other threads:[~2025-04-16 13:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16 13:12 [PATCH 00/31] sound: Phase out hybrid PCI devres API Philipp Stanner
2025-04-16 13:12 ` [PATCH 01/31] ASoC: sof: Use pure devres PCI Philipp Stanner
2025-04-16 15:36   ` Andy Shevchenko
2025-04-16 13:12 ` [PATCH 02/31] ASoC: intel/avs: " Philipp Stanner
2025-04-16 15:39   ` Andy Shevchenko
2025-04-16 16:25     ` Philipp Stanner
2025-04-16 18:03       ` Andy Shevchenko
2025-04-16 13:12 ` Philipp Stanner [this message]
2025-04-16 15:41   ` [PATCH 03/31] AsoC: intel/atom: " Andy Shevchenko
2025-04-16 13:12 ` [PATCH 04/31] ALSA: sonicvibes: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 05/31] ALSA: rme96: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 06/31] ALSA: rme32: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 07/31] ALSA: ens1370: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 08/31] ALSA: cmipci: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 09/31] ALSA: via82: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 10/31] ALSA: sis7019: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 11/31] ALSA: intel8x: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 12/31] ALSA: fm801: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 13/31] ALSA: es19x8: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 14/31] ALSA: azt3328: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 15/31] ALSA: als: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 16/31] ALSA: oxygen: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 17/31] ALSA: lx6464es: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 18/31] ALSA: vx222: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 19/31] ALSA: trident: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 20/31] ALSA: rme9652: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 21/31] ALSA: ymfpci: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 22/31] ALSA: riptide: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 23/31] ALSA: nm256: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 24/31] ALSA: ice: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 25/31] ALSA: emu10k1: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 26/31] ALSA: echoaudio: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 27/31] ALSA: cs5535: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 28/31] ALSA: cs46xx: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 29/31] ALSA: ca0106: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 30/31] ALSA: ali5451: " Philipp Stanner
2025-04-16 13:12 ` [PATCH 31/31] ALSA: maestro3: " Philipp Stanner
2025-04-16 15:34 ` [PATCH 00/31] sound: Phase out hybrid PCI devres API Andy Shevchenko
2025-04-16 15:43   ` Andy Shevchenko

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=20250416131241.107903-4-phasta@kernel.org \
    --to=phasta@kernel.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=andres.emb.sys@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=clemens@ladisch.de \
    --cc=colin.i.king@gmail.com \
    --cc=daniel.baluta@nxp.com \
    --cc=drhodes@opensource.cirrus.com \
    --cc=jayakumar.alsa@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=liujing@cmss.chinamobile.com \
    --cc=mingo@kernel.org \
    --cc=oswald.buddenhagen@gmx.de \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tglx@linutronix.de \
    --cc=thorsten.blum@linux.dev \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.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