From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3BEB2931C0 for ; Tue, 11 Aug 2026 04:21:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786422087; cv=none; b=V0fy8u8fZPd0ESIG7Bm4Ew/LdTX++cw45xUaoBjszXmA7UIJurLlZ3xlrZFyEC4ZycqA7MHbd5YKc8W7xXXy/dZP0EEoqvTuoie8U+Vd2YJenw9oYU2PDxYP2LuKUeiMHvfDVUpznY/+fJdmhXNgaTgRhoztd3ffEWwSXUqfeFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786422087; c=relaxed/simple; bh=UsMZNAyOu94pnIuYwaTgqfFMzgFNsEBuDeurzlzhPv4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kA5pJb+E9Ebphikq9httqm3/ml1kIEvt6Hpur6e3XZBgWicDYmtTDC4swWxgDKPJOd9FIVmtK+2lrU1GkJFSlaIk70a5PLUF7EPMoULYm2VBwhs9j7uLrpTPkR2D/dHAWi6bkTF8h86Vui1uTF/29KEAmUKj5Lq0tT4DvmcZp3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U+80P/0D; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U+80P/0D" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-51a868b6962so26188061cf.2 for ; Mon, 10 Aug 2026 21:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786422085; x=1787026885; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=trArl9+tT/ayTAiZfIgCD45Cj7fZExgNzjQorjwPpZw=; b=U+80P/0DOP22P7j/r8XKp9FkJ7FN50dAdKTiFfXuwIKAu9SqMjef3qSztVKOQ3O1Qo hP88ifzMP8ZSj6WApT+nTxPbGMH/TkY3weicmYCPFutu6sxJp1G8XKNVobgZG3Vb4D6J vyYLi5BoRjH8TKsVEJafUZh+BG7euPOve0ZgOrUtdwlcMiseDO52Dni+Ys6cM6id1xN5 AiDfwJ0+OCkpIJV/KLSkCL4oDiJQtHnBS8GVNuC6osUddBvvBUlSlpLQH6YDud+D2NvZ pS+raQlg89h3x9vp1gqF4M1g30e7+uOjMJhj88e5TcMIFl8C1HmsCF8GOovKZ1GAU06J zcaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786422085; x=1787026885; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=trArl9+tT/ayTAiZfIgCD45Cj7fZExgNzjQorjwPpZw=; b=OcK1R9YRo4Jfi0Kk0V0gOfwmVv4vZo23G81mNaNuJeslrzHgPur/cHyrxQj08OXZkX xHhYfaN+QpV03IH0osLvBeeTKC0u88kA4adUy18p7Ju0yk0oA6cCP0AzNX+ATQ/iw9Bn iIR7vVW/TuHrA5gOhYGo098torNVU6ggzvtECuVEbIKwWHX96T03+pp4kwncCu7/5rXr P9OqVothECh43FT0uGiZZQyj/0Myzqn6WGErl8/jK9GDioN5kAGWK8wpHL+PMK/FONzL OdMoP6iryvIuVq3GQRuESo9futme8Qw9THDcSEjVwQN7qn7QhJGSiBoRrgPF/yZTaHpB 0uqA== X-Forwarded-Encrypted: i=1; AHgh+RrCNppLmNHrw/nBCf+SqOVTG/NkFK+TwVH290x5PhqaG1ZaZJovMCS4XowuyuR8ruS++Nwi93LJjJdzUXw=@vger.kernel.org X-Gm-Message-State: AOJu0YyLXnYWwrNwhbreldmGRi76k90uWUtK9BKgn2qdRCTIVAXPmp5r jnLlFJyOpnVsWUN1u3s15chZjCu/FwJpGILTqPeQ8v4BL501F8vn54+F X-Gm-Gg: AR+sD10pO/dJHcJYh/RmN68FpkXxuvFCZ67dCbPT72k6mUlS0vYCIo63JI2IrwOPXI1 KzN1lZPxpZWCuOVoo/Wto02kLoEOtsy92iPTlyZlT99zQu0qDJlBH4cVyiaoQw9ShSNS2S7TBK3 7di9YL82YxFQ1cVfjXsMpGFvKY0hzEjoU7GLiYkd5oCuoyv4dghZKyvXc14x/fOAXetSSMx7fnt XL8GSqIiD7dzljQcRtKotmDVcXu5TMadZs9IW+JUZ7K1EFj8I7vmK0X1ckg/38So5mRBR0wVXuS rOiP8C1vW0hXebxUrdNjNaUyYEh+idxYzcUbaZ75fRaPPoI8NdK/FYUYYylLaTsjZ1zpk9sqa2P GifYu3pJ/ttzTQMKlKl+kXTRzPge6YTsFquuH7YhluC4My5x1KyMEq6SuwtSAU06jn/raWnQAHk 4qGa9bu97mOMXlXMXQWEb/3SKEF9Y63NmgrsmbyGOtf0xtWPyPZa43vTQ9f0c9WPotO+KGZ952A 28Q9CamKwV+eEigVqx5G5ws6sOf8XeMoIDznKUpMN63CVh+uXYS9NubvcG2868saykdaj/RdpFi WtwhjywHmV1nQ9wvbC2v6LAuigVBjzvQXTGXxw== X-Received: by 2002:a05:622a:53c6:b0:528:3142:d466 with SMTP id d75a77b69052e-52d586c8d67mr5003471cf.41.1786422084924; Mon, 10 Aug 2026 21:21:24 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e35]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-90a6646ef03sm1745596d6.4.2026.08.10.21.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 21:21:24 -0700 (PDT) From: Rosen Penev To: linux-sound@vger.kernel.org Cc: Jaroslav Kysela , Takashi Iwai , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] sound: pci: asihpi: use pcim_iomap for managed PCI memory mapping Date: Mon, 10 Aug 2026 21:21:22 -0700 Message-ID: <20260811042122.44923-1-rosenp@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Replace manual ioremap() calls with pcim_iomap() which uses devres for automatic cleanup. This eliminates the need for manual iounmap() in both the error path of asihpi_adapter_probe() and the asihpi_adapter_remove() function. The pcim_iomap() helper is cleaner and less error-prone since it handles unmapping automatically when the PCI device is released. Assisted-by: opencode/big-pickle Signed-off-by: Rosen Penev --- sound/pci/asihpi/hpioctl.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 9de9ae7032b8..ec2da792e1c8 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -385,8 +385,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev, if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) { memlen = pci_resource_len(pci_dev, idx); pci.ap_mem_base[idx] = - ioremap(pci_resource_start(pci_dev, idx), - memlen); + pcim_iomap(pci_dev, idx, memlen); if (!pci.ap_mem_base[idx]) { HPI_DEBUG_LOG(ERROR, "ioremap failed, aborting\n"); @@ -509,13 +508,6 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev, return 0; err: - while (--idx >= 0) { - if (pci.ap_mem_base[idx]) { - iounmap(pci.ap_mem_base[idx]); - pci.ap_mem_base[idx] = NULL; - } - } - if (adapter.p_buffer) { adapter.buffer_size = 0; vfree(adapter.p_buffer); @@ -527,14 +519,11 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev, void asihpi_adapter_remove(struct pci_dev *pci_dev) { - int idx; struct hpi_message hm; struct hpi_response hr; struct hpi_adapter *pa; - struct hpi_pci pci; pa = pci_get_drvdata(pci_dev); - pci = pa->adapter->pci; /* Disable IRQ generation on DSP side */ hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, @@ -550,10 +539,6 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev) hm.adapter_index = pa->adapter->index; hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); - /* unmap PCI memory space, mapped during device init. */ - for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx) - iounmap(pci.ap_mem_base[idx]); - if (pa->irq) free_irq(pa->irq, pa); -- 2.55.0