From patchwork Wed Aug 21 07:18:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770916 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 742BB15749E for ; Wed, 21 Aug 2024 07:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224750; cv=none; b=BX1i5gbdKORlyhWZ9ZAcpdalBP2lLE6HCHnR2wqXOBujIRjfK1U0d5TzHk9bkzmr1mwAIalzAaspatc+oqtHsZStKW2WblX6+Y0jz0hnKKaCsrNFUMwPwnZPDdPqv+I0YDgC1L+CUOK6obO/uOXnlwqVuB+u0zaZ1y5jzwz0YXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224750; c=relaxed/simple; bh=mHz+ZZWFhHEQhgF8fgLbMMsZfX1XWBKyTlte92c7V0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m7ONlOqGtXGFA0XaQslBSOCTnzhUurvoM67STq6ZulF9mMdLr3PFwzuQ3/57CIDGlOUyOjn4U0Ocsh3A+SGAo427HTZXiFDLS+hzAdGYWxoXjK5ANWPw2xxLEg0hQpXui2VdXY+uKAUJQoy6EtGWIXfqc620uXbL5t+Z3qvKRjY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=A4FBG1v4; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="A4FBG1v4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6ch4IaqQVqf4n7EviAoZPVdER6FOrpbjt4F1+Z0pU5Q=; b=A4FBG1v4rT4nIVkYLbmVRkwX773yMrrMLJeZUTgGvg9S3z0ZHdmv2zI5jQS8VlBb5yK1iz 2+gH3WBS+pQ3s4k7eOjzBXKbCB4F8ekzwU+RCQUKNaMhkf9IekhCzq+oqc3Vb8IaXx2ZZS Owo8nASkLQN34QmgvhXWrTmOsMomHR8= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-318-q3GfTSflMyW3q_N_761aNA-1; Wed, 21 Aug 2024 03:19:05 -0400 X-MC-Unique: q3GfTSflMyW3q_N_761aNA-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7a1d4335cceso92368885a.1 for ; Wed, 21 Aug 2024 00:19:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224745; x=1724829545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ch4IaqQVqf4n7EviAoZPVdER6FOrpbjt4F1+Z0pU5Q=; b=MsNLwb9yzEQXnYfE0t3yxtYupm5dkR6H+TC7KLFj7Hp3bGoA+rjB0QLjchumMXsq6J JR0BqyUBVDqYJ+yUINBoeZfxx1NST6rrdDAqsrsZNJOIi0YST8PbVMlmpv/hPvlpo9Ty ONHqckhVitOhWDnWHsW3DYEdlibsiofm912wa0T489mUsEn0+QqzEzHXmJYH70t8OcbN JrWfEWsx8JS+zejMV6yOTLYRUYNXJ94NvK13HgMFGuBa/twDFdE0XP33GCi2Q46jVXRS x8pO3gSQK8/gOd4B0mMqJzGzneSbAo6CMQjzSzQD139eRa9ZhseXAIb4Z5jCKgBrF6BY 2kHA== X-Forwarded-Encrypted: i=1; AJvYcCUL6l0fCpqKCG7i2JbeRojWt0MK8NnTSxmV8hvmIJb+lWCq55xlc1QahpQi1WFYtor7BraJe2OAYAJNsg==@vger.kernel.org X-Gm-Message-State: AOJu0YzYiFeLM4VlFfCWEKdiyira/y0W3bnB5apwJ6Hd8V34JQdkupsx 1pehz2apFqAaEWvaC3DAV1c0BfMlKWDv3X2YdGUiF/Fm4be1PpRKKq4P8VTq5gLMQ1Jw4nfKBdy QDLTG/vWeih2BaolE/cMY+QEqFR6er2Rb7DB8Thzq18lMGwmQbgoZaNb8CMwk X-Received: by 2002:a05:620a:28d2:b0:79e:fec7:d6e9 with SMTP id af79cd13be357-7a6753141cfmr220358085a.32.1724224744793; Wed, 21 Aug 2024 00:19:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVEMCIqqzymRUElFBuqPlu9emFwxQQrGNHV6b0BSUinl1kKKpb11Nr3ppWIzVNMM5PBVDB+w== X-Received: by 2002:a05:620a:28d2:b0:79e:fec7:d6e9 with SMTP id af79cd13be357-7a6753141cfmr220355985a.32.1724224744387; Wed, 21 Aug 2024 00:19:04 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:04 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 1/9] PCI: Make pcim_iounmap_region() a public function Date: Wed, 21 Aug 2024 09:18:34 +0200 Message-ID: <20240821071842.8591-3-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The function pcim_iounmap_regions() is problematic because it uses a bitmask mechanism to release / iounmap multiple BARs at once. It, thus, prevents getting rid of the problematic iomap table mechanism which was deprecated in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). Make pcim_iounmap_region() public as the successor of pcim_iounmap_regions(). Signed-off-by: Philipp Stanner Reviewed-by: Damien Le Moal --- drivers/pci/devres.c | 3 ++- include/linux/pci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index b97589e99fad..4dbba385e6b4 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -771,7 +771,7 @@ EXPORT_SYMBOL(pcim_iomap_region); * Unmap a BAR and release its region manually. Only pass BARs that were * previously mapped by pcim_iomap_region(). */ -static void pcim_iounmap_region(struct pci_dev *pdev, int bar) +void pcim_iounmap_region(struct pci_dev *pdev, int bar) { struct pcim_addr_devres res_searched; @@ -782,6 +782,7 @@ static void pcim_iounmap_region(struct pci_dev *pdev, int bar) devres_release(&pdev->dev, pcim_addr_resource_release, pcim_addr_resources_match, &res_searched); } +EXPORT_SYMBOL(pcim_iounmap_region); /** * pcim_iomap_regions - Request and iomap PCI BARs (DEPRECATED) diff --git a/include/linux/pci.h b/include/linux/pci.h index 01b9f1a351be..9625d8a7b655 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2297,6 +2297,7 @@ void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); int pcim_request_region(struct pci_dev *pdev, int bar, const char *name); void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar, const char *name); +void pcim_iounmap_region(struct pci_dev *pdev, int bar); int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name); int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, const char *name); From patchwork Wed Aug 21 07:18:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770917 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAB28199FB5 for ; Wed, 21 Aug 2024 07:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224755; cv=none; b=rZmuNoNIf2+P+NZO6BQ4ZFLRWKVHaM0j3Dq1pgYqwTr2pAZ8Pbcq1o+HFetw5AzVlH3AfE2Fy+9CgcLXLVAmquuFG2iMNwq7DvKdimrxLdVhEli5xKPn+zAqJDRxCQFxGhVr3d1DmA9N4cWcI2ngXX67rj1BDxvHXAddQ2UuEcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224755; c=relaxed/simple; bh=mXOGVudfLi+KidU2SAFK83EWun0K/ZT4Bj7/UEKpbBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bbTwVfUa4mINUPJKtzhyPEmQAdwy0Gm0oDG7I0D91b3ctZo7j+t5JK5XP8OtvVySVzTQAxs5aW7BBdSkVvEvakPwCSPIay/tbVgzyI3AugT3eThT7M3gwj6hOHIsrdzRBzbgAhOcxjeAM7+q9eoVNFScUjGtQCBEa53Py5/MqhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HPIU3LQz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HPIU3LQz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tC041gyCjeykzm80lE0q63CM17fX2IeQcUJmRWOoBEs=; b=HPIU3LQzMxKLXERU55mlD70y/CJZfHgUfdtZTApJK5dx+xM9rljYRFDrs6xmirlFoEBAJR ANrKX4y1SAG9qK0SExfKdogvD3XfhmjaKNNZv4qDZlzYKLK4T9k1aCo4lthPF9ZLj089C/ J6Ssgw2yv32kBFRr52IOox/aOid3oLs= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-81-teR3SAK2PBCxdVI0NFsK-w-1; Wed, 21 Aug 2024 03:19:10 -0400 X-MC-Unique: teR3SAK2PBCxdVI0NFsK-w-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7a1dab8a2eeso775373085a.1 for ; Wed, 21 Aug 2024 00:19:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224750; x=1724829550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tC041gyCjeykzm80lE0q63CM17fX2IeQcUJmRWOoBEs=; b=SDlREtfcEgAhIMnkJb1CcP99Mp4a6glIL5IAVJhKuRou3WxiBGfVTolNo9OoXY9pAD KZfzY0M1S7cbhAh59rfK/nL2LTAYte4xhrgElr6gS4XRt2cf4yiXm6dkSgQFTkYQscd8 1YUjP+OTIiix+gpg0GnZ3MYrDboCRW9Jui1t45lNS3KyXVfZNaIF9ZKAnnZjtRYkXxOk xMxhYgnV4Kbg8gNLdslxk/JdD0hIR01cIBgKRJqgVyzgwjZGL3O3ibm66es1z/N/wZLc /cglYgtnQPi4JjzbGHoKEW4k8Odd4YJIKYECC0xjhIyf7RCTTJCVX+U3Zg9havaO9BV0 M9Tg== X-Forwarded-Encrypted: i=1; AJvYcCXljJt5V8c9/xbwIInksVNgyB3jOTkNBr5xlm4ht1j5lJVafzscxwvkXM2cOEIsXzo3YaMSUSrUDdGjQQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yx4LbToGK5JT2WSHxdtOM1jZBK0RAhXxoqFoD0kAaNOmaB51kfs WBA4UHateyUUMM7vXKZ6Ef5E2hmn8ZuMu5/VseyTP2EKLER8+S+hKl5RX8GK6KmsmoepdPK7hQ3 KXq8icJGNMqc0OoQx401ugz6PXf3zoqr9BMi1tvVNFEULGLoW4l3l6uQzp8SU X-Received: by 2002:a05:620a:3726:b0:7a1:e9a3:7ed5 with SMTP id af79cd13be357-7a674028608mr225744985a.21.1724224749837; Wed, 21 Aug 2024 00:19:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDcpjkeN2s+Pkah8lNRsAeGJCiY8h2x/UjZoGAkEUi08MzdlRaM+ySap03gvKQjNGS0t9n+w== X-Received: by 2002:a05:620a:3726:b0:7a1:e9a3:7ed5 with SMTP id af79cd13be357-7a674028608mr225743585a.21.1724224749534; Wed, 21 Aug 2024 00:19:09 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:09 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions Date: Wed, 21 Aug 2024 09:18:35 +0200 Message-ID: <20240821071842.8591-4-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). Port dfl-pci.c to the successor, pcim_iomap_region(). Consistently, replace pcim_iounmap_regions() with pcim_iounmap_region(). Signed-off-by: Philipp Stanner --- drivers/fpga/dfl-pci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c index 80cac3a5f976..2099c497feec 100644 --- a/drivers/fpga/dfl-pci.c +++ b/drivers/fpga/dfl-pci.c @@ -41,10 +41,13 @@ struct cci_drvdata { static void __iomem *cci_pci_ioremap_bar0(struct pci_dev *pcidev) { - if (pcim_iomap_regions(pcidev, BIT(0), DRV_NAME)) + void __iomem *bar0; + + bar0 = pcim_iomap_region(pcidev, 0, DRV_NAME); + if (IS_ERR(bar0)) return NULL; - return pcim_iomap_table(pcidev)[0]; + return bar0; } static int cci_pci_alloc_irq(struct pci_dev *pcidev) @@ -296,7 +299,7 @@ static int find_dfls_by_default(struct pci_dev *pcidev, } /* release I/O mappings for next step enumeration */ - pcim_iounmap_regions(pcidev, BIT(0)); + pcim_iounmap_region(pcidev, 0); return ret; } From patchwork Wed Aug 21 07:18:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770918 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70C0A1A7AC7 for ; Wed, 21 Aug 2024 07:19:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224759; cv=none; b=hX2nahyB8L09bBplK1g5j8raRH/KuFKANvRpKesXpXEzZucW1FNALMaocwSnthGbbDV8be0dpw3cxkWB0NpJSQnhlfDA1365dbA4kArnnHrvZu9rDQ77k+/llP+W88TFdpNCc18KzKWf1arzcsHfQQQqmAFMqPQzGDnpXlaFe64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224759; c=relaxed/simple; bh=X1zz/TunuR2PG93iDywgu0fR0ZIioix5D5qvFJsuS9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PbQfVn6eypC8T2C3npcp8l9HGKLjv9woSYZiOwba8bjoQUea2JT5SQISZYewIq2pQUh9O+yyFdSMTS/J8Jv6G1JDB0yQl4EuZuQzuswo1rdWe5Kk4AeOLbdAy/KatGxYMlcjYB5xe9aISlUUNh+9Ws+tn3Gwby28NMQATza8qp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XkSy2Bnz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XkSy2Bnz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CLI8bZjR6OdWE6SPmBhjzuWJVjW15O9K3MBwEhWkwDY=; b=XkSy2BnziZJXpVkMxTN9FO94Ab7wAE3C+LYUdlXuYrcziRRk2765K1tHNy7SsK0MJFmTtT IRx1FGi18hPKPLmnX+kNMqVlk3BKoM49d6P6QWvRb/x0LwtVYWbCv6qB3uirzP8san+Mcf GUM3Qrc2wyW+XVl0CIHCKozS31SIL2U= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-Z1Xto38WOxOTGrG-cWEUhQ-1; Wed, 21 Aug 2024 03:19:16 -0400 X-MC-Unique: Z1Xto38WOxOTGrG-cWEUhQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7a34e9c8945so657226785a.2 for ; Wed, 21 Aug 2024 00:19:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224755; x=1724829555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CLI8bZjR6OdWE6SPmBhjzuWJVjW15O9K3MBwEhWkwDY=; b=cwxzkmjjnm5y2RZ0MIYSLVuIdVTa85qrlNoy8c2gA7Af9AMFFt7aNJsuxYA1pXZHJC PvAFy3ySLqxR/jQarEDwZwmwQoEwmVc4/ehqyBUt/w3RQDk8DvoZp9vB2NaPNPVhOZI0 w2eIwaE/Cs+fRYLQNhm6XHDt6nEqR0RPxgW8Q7vQwbL+oWY9uReikeUydfyJiJZpqAmm RlGRE34tb9UObJ6uga3Aa0WF7HesgSoA44yg34Rl6AmUXLiNihXRXO0kuMyJGKydlmeB Xx9SjrfYdOzIvZxjKJ2mWrzTTmZRNokhIq8MaKHtU0ONFbP7iu5pxjp212kuOuaht6KH r8CA== X-Forwarded-Encrypted: i=1; AJvYcCVC6wDcynM46CHajfiVqjsGPjWYCsF2RWvJq1A26Qo3F9Q0xu2CfMSE84gQfPicFLXax1Rg6turAks6yw==@vger.kernel.org X-Gm-Message-State: AOJu0Ywrukj/26jo2a1buv6TfbQIw1kPizT4hoiZKImZ9xRL+18zvIJq UkujLUFv+tVTh6Rpy26rptIWZ1N4+8ztmIH8NGYAVcxJlgpWdm8xdvyPaitQzmEFmBYTX6hD082 X6JHMWCCH15+S5jBlOJbJqMxva184urmy8+47LgAqLyWxW7aTpZu61TpEQvFS X-Received: by 2002:a05:620a:1906:b0:79e:f8b7:5c73 with SMTP id af79cd13be357-7a6740c5e31mr226529085a.55.1724224755568; Wed, 21 Aug 2024 00:19:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtpkoHy3cS2PdzwF01k905nXUdsELS2xvQjiGeTjNuWZ60d5TFnGqma74hup77Ia1MJryw5Q== X-Received: by 2002:a05:620a:1906:b0:79e:f8b7:5c73 with SMTP id af79cd13be357-7a6740c5e31mr226522685a.55.1724224755041; Wed, 21 Aug 2024 00:19:15 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:14 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 3/9] block: mtip32xx: Replace deprecated PCI functions Date: Wed, 21 Aug 2024 09:18:36 +0200 Message-ID: <20240821071842.8591-5-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). In mtip32xx, these functions can easily be replaced by their respective successors, pcim_request_region() and pcim_iomap(). Moreover, the driver's calls to pcim_iounmap_regions() in probe()'s error path and in remove() are not necessary. Cleanup can be performed by PCI devres automatically. Replace pcim_iomap_regions() and pcim_iomap_table(). Remove the calls to pcim_iounmap_regions(). Signed-off-by: Philipp Stanner --- drivers/block/mtip32xx/mtip32xx.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index c6ef0546ffc9..fcd5806621c7 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -2716,7 +2716,9 @@ static int mtip_hw_init(struct driver_data *dd) int rv; unsigned long timeout, timetaken; - dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR]; + dd->mmio = pcim_iomap(dd->pdev, MTIP_ABAR, 0); + if (!dd->mmio) + return -ENOMEM; mtip_detect_product(dd); if (dd->product_type == MTIP_PRODUCT_UNKNOWN) { @@ -3726,9 +3728,9 @@ static int mtip_pci_probe(struct pci_dev *pdev, } /* Map BAR5 to memory. */ - rv = pcim_iomap_regions(pdev, 1 << MTIP_ABAR, MTIP_DRV_NAME); + rv = pcim_request_region(pdev, MTIP_ABAR, MTIP_DRV_NAME); if (rv < 0) { - dev_err(&pdev->dev, "Unable to map regions\n"); + dev_err(&pdev->dev, "Unable to request regions\n"); goto iomap_err; } @@ -3849,8 +3851,6 @@ static int mtip_pci_probe(struct pci_dev *pdev, drop_cpu(dd->work[2].cpu_binding); } setmask_err: - pcim_iounmap_regions(pdev, 1 << MTIP_ABAR); - iomap_err: kfree(dd); pci_set_drvdata(pdev, NULL); @@ -3925,7 +3925,6 @@ static void mtip_pci_remove(struct pci_dev *pdev) pci_disable_msi(pdev); - pcim_iounmap_regions(pdev, 1 << MTIP_ABAR); pci_set_drvdata(pdev, NULL); put_disk(dd->disk); From patchwork Wed Aug 21 07:18:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770919 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAF5A188A3F for ; Wed, 21 Aug 2024 07:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224765; cv=none; b=LnQoOmEszwQTiZGKfNHRiEDRTJkn6JAmC0c5xLKxaDHCA1juEeHtpU/SShFefca9DDTSf+mU4x97ce2JFK0rbyyQHOVeECCm7j/5sti9FnzFRyzg0Q2mlDdIamamjaEvKNRz3EqQfRtfAt+IGkcXvpu0YlicC0x32ExQdDGavhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224765; c=relaxed/simple; bh=Fc7LqA4dsnee2e9i3xlXjC/frSEy4rrwVedoLFfxfmw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qghXgPlqFrilB9tUlHTuWaWroEX2DsDD0DNgusja0RQKc/QEkJVG1DI7KClQ/AEy0AToeX8dNO/+nHrvZtmKWQ+9XC6cjZHNUbrI/9KKvNp9GH+gdE6yNO8qH/krn/TcyzwIlld8Jxx1srukX4eGnehHxrmg7ixSZuqkGm+oRfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NVes4Cqk; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NVes4Cqk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/H9qQSvRoJEHuC9fzeIRZ7nyD5NIc+bT7koxtRIZd8A=; b=NVes4Cqkil6a+XbyDVCLr2zUTtopT97cN6EKiUaawi2sRFqa3elI2sjUosoVlwC/R97/+d AcsB0em+FhZcplS0yp41zgW3rOp36ENWb3SfAktYy2i11ZEOvJqrYPl5UINHvzSEZeuq08 fvDf6dxOHwQoZKNDrtk7zEDkMdCwBlA= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-OVpy3DfjONix_8RqWowAMg-1; Wed, 21 Aug 2024 03:19:21 -0400 X-MC-Unique: OVpy3DfjONix_8RqWowAMg-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7a1dbbe6d6fso715108885a.3 for ; Wed, 21 Aug 2024 00:19:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224761; x=1724829561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/H9qQSvRoJEHuC9fzeIRZ7nyD5NIc+bT7koxtRIZd8A=; b=eC5lYlzCbceWXNh8Ai8Q7Gn8gzSpwDebSOO5iRnsezAo9+OOenlFshVrMUkkCwBmIr BPSqYy5NkRvIqzy+wjaQJdHm+arKqOWxDV0C3EKWO8DBbZZOqsfm/XdUXYLJj66TqD+S 31HwsChR5sZAKGZZ7sPrF8HRcj42Vqx+O2mjGcdVH1x1esqS7FCfTxocjwte92O5O2Hd uS1yeO661pKKDDKSxq/YbohwRC5QLHVEiunCCsbXukVPHNy0uXtmeOut6ldJyG7QvB99 2JsHWU+ZRX/0ai7GKH2Ycz3GZ1arW9s55zFUyw4x31Tl7OhG4xSLFJtUPBdBMs0BAVHF R4eQ== X-Forwarded-Encrypted: i=1; AJvYcCVf0uxcBCeQRVDiEsLCO/TJqjWLQrMHZuY49CRFJXoLp59Gy8AqiR5b5ZVwytRnqXfeyBFpb/9wI5Y6+w==@vger.kernel.org X-Gm-Message-State: AOJu0YxjgDW3jfAO5GXCx21xJPQmJg611L6k81PLqFjyrTZKA0N6E7dX prhsWCvLTH+HTx1aSNG+to+G69RbUKiwNB74ZEiRtLk7HI600jKO/u0PCTP3uZGXSaCkVNCVD5x vByg3udbJtiQ17x2Twe+fNImKlWr2ohYAn96nHX4BJkocwLUb+3cfPfxE0VZu X-Received: by 2002:a05:620a:1a23:b0:79c:130:452b with SMTP id af79cd13be357-7a6740bf833mr201730385a.47.1724224760981; Wed, 21 Aug 2024 00:19:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlHEduRbx+7oLWq2FWdoqLifqFviA1Dz0/eZWADNmQ+nKTULVnIfuczZLElQLlBGhubXgMag== X-Received: by 2002:a05:620a:1a23:b0:79c:130:452b with SMTP id af79cd13be357-7a6740bf833mr201726085a.47.1724224760509; Wed, 21 Aug 2024 00:19:20 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:20 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, Bartosz Golaszewski Subject: [PATCH v2 4/9] gpio: Replace deprecated PCI functions Date: Wed, 21 Aug 2024 09:18:37 +0200 Message-ID: <20240821071842.8591-6-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). Replace those functions with calls to pcim_iomap_region(). Signed-off-by: Philipp Stanner Reviewed-by: Andy Shevchenko Acked-by: Bartosz Golaszewski --- drivers/gpio/gpio-merrifield.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c index 421d7e3a6c66..274afcba31e6 100644 --- a/drivers/gpio/gpio-merrifield.c +++ b/drivers/gpio/gpio-merrifield.c @@ -78,24 +78,24 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id if (retval) return retval; - retval = pcim_iomap_regions(pdev, BIT(1) | BIT(0), pci_name(pdev)); - if (retval) - return dev_err_probe(dev, retval, "I/O memory mapping error\n"); - - base = pcim_iomap_table(pdev)[1]; + base = pcim_iomap_region(pdev, 1, pci_name(pdev)); + if (IS_ERR(base)) + return dev_err_probe(dev, PTR_ERR(base), "I/O memory mapping error\n"); irq_base = readl(base + 0 * sizeof(u32)); gpio_base = readl(base + 1 * sizeof(u32)); /* Release the IO mapping, since we already get the info from BAR1 */ - pcim_iounmap_regions(pdev, BIT(1)); + pcim_iounmap_region(pdev, 1); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->dev = dev; - priv->reg_base = pcim_iomap_table(pdev)[0]; + priv->reg_base = pcim_iomap_region(pdev, 0, pci_name(pdev)); + if (IS_ERR(priv->reg_base)) + return dev_err_probe(dev, PTR_ERR(base), "I/O memory mapping error\n"); priv->pin_info.pin_ranges = mrfld_gpio_ranges; priv->pin_info.nranges = ARRAY_SIZE(mrfld_gpio_ranges); From patchwork Wed Aug 21 07:18:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770920 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0798E1ACDFF for ; Wed, 21 Aug 2024 07:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224770; cv=none; b=CFBOqe2SJuO5BzLwubNbi/AMcpbYSz7eyTbHx+t0bRcv2ZNIgEVnek/dqTogU3sToWx1sEuZcfISfqRks4GtSvscwVR5zxvJCrfNhXj6/ftv668vM07UegirEbTo2R51UKFiAIlVdmqgzdmLNFoFxjPZsPRptJ1S7ZZ56hSb7pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224770; c=relaxed/simple; bh=SgQa/apEnyQVxi5RGIOMYDsJA8zmcu1/aNTE/QznKio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b6qubRxM5LmfIsXtDBWApsdTIMZf6swD60R00ccjmWKk9l9QBVDinaYxFLBgGrdICRGEYbVyg1whzc/m9nB1gGkCLeTH1DxmfLLbaRrAPCDcmNLeiqta5tgLoLflqjsX5dELqZF8TCjrIkOgfJcWAnKU5hBVJ2nhZRvfEF/+HFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fcCh/7jo; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fcCh/7jo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AJtm3uYD4inmsDECmrMxkvS6gTo4VXXtBuq4LxNQ/Aw=; b=fcCh/7jo0riPzCQUAmhkfJZJvqPI02w5NbxxpiZjE8OlP7zAbi1yHtGPIxp3I1PISwdcAZ u5164758EYitm+nQKkWki5s2UuqxhmRB4ez5LjxKcZgwPBEPPdl4yavuj/qn4UEkPHzWVe Nfz+pPu1/ASxjgrrdhNTD5+zgn+XclA= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-172-Ctu8CAdCOg-QT07O9ealww-1; Wed, 21 Aug 2024 03:19:26 -0400 X-MC-Unique: Ctu8CAdCOg-QT07O9ealww-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7a1d40f49f5so711504685a.3 for ; Wed, 21 Aug 2024 00:19:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224766; x=1724829566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AJtm3uYD4inmsDECmrMxkvS6gTo4VXXtBuq4LxNQ/Aw=; b=e3IOzOkAsnDAoJgm9W6N5jqb8uNH4BnjWW2WlwFMuQtUru+X/Z8N9mUyJYstoqr9rv bJ3jxFNrMxk2dU9qHQBS4CwLUA0LjqzrkCS2vMakXj67dEVBfQrcl3aNfFnWn5yb1IIa ugaYkYeyGQnjD2b/VRxIawZtV2cL4IONzroGdQWfG7hI+/GvWUCNYhC/Tl8zZhRSY1Ev XU0VB66gV6aDmxce6m5KpcRZ7Pc+XayBM+E5qNaL9kIWE6u/So4a1W/TekRxVEzAngFF IRI0e6/uqvGOPyupA6WlU7++orH3lv75hOBOEAlppvV1U7j/Gapunn0YlCaZSaQ1t0Xx OUrw== X-Forwarded-Encrypted: i=1; AJvYcCXBepJUJkczyFBlHhu1+J6ZOvW5FKGScLCdXNovvM+oyXjzzJkWVCzC87By+JPm4I1On7/CkMO8HUOBTw==@vger.kernel.org X-Gm-Message-State: AOJu0Yy3o1yMVBbygiQXDSexJzSPunrhN/3jRjy2IMCr9ud6UkpQg6kz 2XDvLX+Yhz7NV558ykSUKrVbtIZrYPdf3E83l2j0IETrxTc2j4L4NLHTaSET+aMgLWNWlXNOeah GnAB5kzy+yWiYbuR/TvDYAQyi4p89kDmA37nm60R6L5c3qtvW4cJjjWkZSGDR X-Received: by 2002:a05:620a:4447:b0:7a6:6b98:8e36 with SMTP id af79cd13be357-7a6748f3e18mr161732085a.16.1724224766180; Wed, 21 Aug 2024 00:19:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmBWfs7G37gw0gXLs+jJ1ak3VoPRzhFXnnqGnvalRJy1Z9qU/iCGfIEx/5sYtw8Qbb8DqgNA== X-Received: by 2002:a05:620a:4447:b0:7a6:6b98:8e36 with SMTP id af79cd13be357-7a6748f3e18mr161728685a.16.1724224765719; Wed, 21 Aug 2024 00:19:25 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:25 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 5/9] ethernet: cavium: Replace deprecated PCI functions Date: Wed, 21 Aug 2024 09:18:38 +0200 Message-ID: <20240821071842.8591-7-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). Replace these functions with the function pcim_iomap_region(). Signed-off-by: Philipp Stanner --- drivers/net/ethernet/cavium/common/cavium_ptp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/cavium/common/cavium_ptp.c b/drivers/net/ethernet/cavium/common/cavium_ptp.c index 9fd717b9cf69..1849c62cde1d 100644 --- a/drivers/net/ethernet/cavium/common/cavium_ptp.c +++ b/drivers/net/ethernet/cavium/common/cavium_ptp.c @@ -239,11 +239,11 @@ static int cavium_ptp_probe(struct pci_dev *pdev, if (err) goto error_free; - err = pcim_iomap_regions(pdev, 1 << PCI_PTP_BAR_NO, pci_name(pdev)); - if (err) + clock->reg_base = pcim_iomap_region(pdev, PCI_PTP_BAR_NO, pci_name(pdev)); + if (IS_ERR(clock->reg_base)) { + err = PTR_ERR(clock->reg_base); goto error_free; - - clock->reg_base = pcim_iomap_table(pdev)[PCI_PTP_BAR_NO]; + } spin_lock_init(&clock->spin_lock); @@ -292,7 +292,7 @@ static int cavium_ptp_probe(struct pci_dev *pdev, clock_cfg = readq(clock->reg_base + PTP_CLOCK_CFG); clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN; writeq(clock_cfg, clock->reg_base + PTP_CLOCK_CFG); - pcim_iounmap_regions(pdev, 1 << PCI_PTP_BAR_NO); + pcim_iounmap_region(pdev, PCI_PTP_BAR_NO); error_free: devm_kfree(dev, clock); From patchwork Wed Aug 21 07:18:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770921 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8B8919259F for ; Wed, 21 Aug 2024 07:19:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224775; cv=none; b=CFDdxgmUB+IFC5jFEwiMqAwE+opQuhVzY77UMrwOoCwvtx1RnATwO1KicgcRseiOeU4r6ak82aUwVkSR5wqXQ8JojTkP+VquOPhEH8vU5sdS37rMtO+J/Fa001XbHwIEhmcs8pGY0l7G4XbniDgirxP7ND4kCWnIgkZIfq+j+04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224775; c=relaxed/simple; bh=kigVrUGzwAc3Gfl0QApPC++gUgBQlYDwvJKklnpQh/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i1arsTHdVLeZdR34Ho69pDmZcNrrp0+UFncVBqi05qOhQdAaGDY88zktZAJ8Nliw+W3v2xnFHJiGwQaaNqcBVjOz0UPaM+j8N6eBTg888nrLNA1ofJx2xbGLjq9zosEKMg/gwPIFxDUJ6NRjbV3GCllt5qcarl3owUAhmYSFTXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NOwDeYA8; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NOwDeYA8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEnCsYi4V2PnChy33tc28SWivSiMlK/Z32Tet3XvGFE=; b=NOwDeYA8n8EUITz8/l3S9e1zr2pqDXXDbpxrO3eBq5GG9drgNzUwVJnoaCg6ImwpwTe2Dt WvRYXL6Xd3F4/vgbic5XS5BpqnG/PoHhLufZQ9iYvvQgrOrjzd6Ge/BWGAMH2AsSgAS1oT rsPReVoCVmFLifFJultAgTf8LPcR0zs= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-Flhk9qJgNkuGNAxv0hn-pg-1; Wed, 21 Aug 2024 03:19:31 -0400 X-MC-Unique: Flhk9qJgNkuGNAxv0hn-pg-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7a6497b1e88so417797785a.2 for ; Wed, 21 Aug 2024 00:19:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224771; x=1724829571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FEnCsYi4V2PnChy33tc28SWivSiMlK/Z32Tet3XvGFE=; b=U2GhwBfvze5UD9CaijZwCGFS7yEvjcqsOsEbUuqd+vXKQONXBJffWW+sq0i6bCrsd0 BUNfjWVas6gjYweTii9G738I0h4zZPC0nBgL3atuLrUB7VI6ibOSJLeN6V3/sy2uoexd i7iYEt3i2m8Mx4snWBLAoLpzhN9QOL/OgcziXdPcB3l/oUvSqlLfCtlYbbj20FarPIGD pauzn9bTgC6pgXK4GQAURcQPV2VZxrTSerU/1a8yNoWphVg46mOO+DIrxtpR3uKnI6lt M1Y6Ewz+k8oNEoPar0na8cGltF4Ne/Cmjjz0DqZmzDsHG3QnKke6MEz+3IFYOYrb6pDX pUwA== X-Forwarded-Encrypted: i=1; AJvYcCV5egUmtdyQZu9dj3g85C8zNyzoG59tiTJMyMd7usSc+j6lNra46YOeiZ5kmeidR/TL4ByoJrb6FgTHSA==@vger.kernel.org X-Gm-Message-State: AOJu0Ywycm/KXSAJr3zJatGy593eu7/8Y2RnpF/jzwWrwdJll8VB4JZZ IOIkdYqm+iiD/FrdSYn+gFC8JPbQOhov7D8Vz/fniq9XBY+xF/T6+wliFmlX2iIggcqHzpH/UN0 2aUTDeV1Yth05Tx8dq2a7h2ChxsLjRL9aGy5XmggxCAmljzuh72GQOt8nZ7Dj X-Received: by 2002:a05:620a:bcb:b0:79e:f821:aae4 with SMTP id af79cd13be357-7a67404c462mr211951685a.37.1724224771402; Wed, 21 Aug 2024 00:19:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLoW1uWJUMYC+jXOMYEg+1mtX/so2VDO80oVrajYa3fYbYG1AcKfTlZLCcLcpq57M5A2EQTQ== X-Received: by 2002:a05:620a:bcb:b0:79e:f821:aae4 with SMTP id af79cd13be357-7a67404c462mr211947085a.37.1724224770943; Wed, 21 Aug 2024 00:19:30 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:30 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 6/9] ethernet: stmicro: Simplify PCI devres usage Date: Wed, 21 Aug 2024 09:18:39 +0200 Message-ID: <20240821071842.8591-8-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 stmicro uses PCI devres in the wrong way. Resources requested through pcim_* functions don't need to be cleaned up manually in the remove() callback or in the error unwind path of a probe() function. Moreover, there is an unnecessary loop which only requests and ioremaps BAR 0, but iterates over all BARs nevertheless. Furthermore, pcim_iomap_regions() and pcim_iomap_table() have been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"). Replace these functions with pcim_iomap_region(). Remove the unnecessary manual pcim_* cleanup calls. Remove the unnecessary loop over all BARs. Signed-off-by: Philipp Stanner --- .../ethernet/stmicro/stmmac/dwmac-loongson.c | 25 +++++-------------- .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 18 +++++-------- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c index 9e40c28d453a..5d42a9fad672 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -50,7 +50,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id struct plat_stmmacenet_data *plat; struct stmmac_resources res; struct device_node *np; - int ret, i, phy_mode; + int ret, phy_mode; np = dev_of_node(&pdev->dev); @@ -88,14 +88,11 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id goto err_put_node; } - /* Get the base address of device */ - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (pci_resource_len(pdev, i) == 0) - continue; - ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); - if (ret) - goto err_disable_device; - break; + memset(&res, 0, sizeof(res)); + res.addr = pcim_iomap_region(pdev, 0, pci_name(pdev)); + if (IS_ERR(res.addr)) { + ret = PTR_ERR(res.addr); + goto err_disable_device; } plat->bus_id = of_alias_get_id(np, "ethernet"); @@ -116,8 +113,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id loongson_default_data(plat); pci_enable_msi(pdev); - memset(&res, 0, sizeof(res)); - res.addr = pcim_iomap_table(pdev)[0]; res.irq = of_irq_get_byname(np, "macirq"); if (res.irq < 0) { @@ -158,18 +153,10 @@ static void loongson_dwmac_remove(struct pci_dev *pdev) { struct net_device *ndev = dev_get_drvdata(&pdev->dev); struct stmmac_priv *priv = netdev_priv(ndev); - int i; of_node_put(priv->plat->mdio_node); stmmac_dvr_remove(&pdev->dev); - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (pci_resource_len(pdev, i) == 0) - continue; - pcim_iounmap_regions(pdev, BIT(i)); - break; - } - pci_disable_msi(pdev); pci_disable_device(pdev); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 352b01678c22..f89a8a54c4e8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -188,11 +188,11 @@ static int stmmac_pci_probe(struct pci_dev *pdev, return ret; } - /* Get the base address of device */ + /* Request the base address BAR of device */ for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue; - ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev)); + ret = pcim_request_region(pdev, i, pci_name(pdev)); if (ret) return ret; break; @@ -205,7 +205,10 @@ static int stmmac_pci_probe(struct pci_dev *pdev, return ret; memset(&res, 0, sizeof(res)); - res.addr = pcim_iomap_table(pdev)[i]; + /* Get the base address of device */ + res.addr = pcim_iomap(pdev, i, 0); + if (!res.addr) + return -ENOMEM; res.wol_irq = pdev->irq; res.irq = pdev->irq; @@ -231,16 +234,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, */ static void stmmac_pci_remove(struct pci_dev *pdev) { - int i; - stmmac_dvr_remove(&pdev->dev); - - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (pci_resource_len(pdev, i) == 0) - continue; - pcim_iounmap_regions(pdev, BIT(i)); - break; - } } static int __maybe_unused stmmac_pci_suspend(struct device *dev) From patchwork Wed Aug 21 07:18:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770922 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5F52192D89 for ; Wed, 21 Aug 2024 07:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224782; cv=none; b=t/At6blI9Layd/H0OF6iHB0d+SywH+vImfXXhmrh5qKHs6Ub4laUq2KdW94ag8TvfcRBnua1hUy1UJesMxmuUrWR/cxsM8NbfRSA0fQt7tjPY7N9QuPoPFlsExwxOL5yZiAzuY6hfCRw0fFToWxF3Ab9v3wf92n4buFWF7mkx0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224782; c=relaxed/simple; bh=Z/uFtZxMenV3NzQdDiVoUzUWJpKJL91lmHSWEqlwU88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fewjPlANvYGEKgZ+XnKE6aFwDwE6diMXg/B7f/yFK4i75CLJvF7wZRgZGyZ37CRetAblAZRS7qJns/OReJ/ApmYhMWggX6GwcqBKe7rB8DDlLPfArgku+TO+fpBdhnhsPK8V6MVOtpmztAEWIxCx1907Ybft3uIUSPtEl7c42yA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dOX/GWOL; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dOX/GWOL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kqXkRiyUxqSbliwQmHVEASu4D/RYGtBd8mGoyCxVF1o=; b=dOX/GWOLOMKpUTwLweBt7mlevj7EY1Z3vnSFS7jo0iKI1xua283E0yUFv5gBIS5BSYZxvI FWceMEXLqnBs18qPwiLXGC1rq09He03WzeNJRdoaxy54HEYXktLK66mED4YxrTSeTlD6S6 xEZ1jYjeRMUFXFuscJ6b7k/zKwhh970= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-158-s9QxYTLyPzeMNegPcpbW2g-1; Wed, 21 Aug 2024 03:19:37 -0400 X-MC-Unique: s9QxYTLyPzeMNegPcpbW2g-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a1dab8a2eeso775445985a.1 for ; Wed, 21 Aug 2024 00:19:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224777; x=1724829577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kqXkRiyUxqSbliwQmHVEASu4D/RYGtBd8mGoyCxVF1o=; b=Dp35YtEfY59/iPxKjK5fbWyaLOawnzPEHtwfyTYXaZj1AU/7n+Crkul9cgRCiO+vip nsDR+RBAs5LyXzi6Fcv4O5ofco9tsZn/Gp9WTsaGzBgwsHwWmtJRna0Zmw35tRSHoJGC 2WRXDIjNG018R/GlvXL42klcU0+WNig0mVrJ15yjw08zjULhqnmuT3kN6SvP92JM3gdI OglfR7xmxQe+SzvUyfHXEobavx87e9fB+oVnRlMyzvHsRKvnwJdm5EDLOzxPiQXG1Zkm vyLH7n+ryPsglEvYad47mNYROfHyHALUrsuoqGial0agkdh+YK5AokhqlR2G6MAQHagp LRHg== X-Forwarded-Encrypted: i=1; AJvYcCWfBaYyR1UlAqlmnw3VINQq6fUZArNnKHxlXVZMMlfEsABunaBcn3G5udb05fO2ai++PuRyU8PcPgUQ3Q==@vger.kernel.org X-Gm-Message-State: AOJu0Yz+lRJnqWbMFVYAURJKQEQLg8e/jTkOKsXcrwNo7BfaLfFZli2K N4X4MyLL9F4youS9ERMADGFEsDLa2ckoZhvpCIvGh9lnbwVp3Ahl+mX0aeF/55jZJpPs8u2/qt2 IiZ1VWlUm8yglf31V8eMQpP4K5g2JYEl60pFgN8dmapOXIAsmsxmwtq4IfLZ8 X-Received: by 2002:a05:620a:4723:b0:795:5672:9298 with SMTP id af79cd13be357-7a674057cddmr157582585a.41.1724224776883; Wed, 21 Aug 2024 00:19:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzvsJUVRLWmc58Q7QaiuvVDQhxagsdXHOmahNlcC4bwy6acZdi9NrIfC29BkE+CkLUyoCrrg== X-Received: by 2002:a05:620a:4723:b0:795:5672:9298 with SMTP id af79cd13be357-7a674057cddmr157580485a.41.1724224776363; Wed, 21 Aug 2024 00:19:36 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:36 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev, stable@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2 7/9] vdpa: solidrun: Fix potential UB bug with devres Date: Wed, 21 Aug 2024 09:18:40 +0200 Message-ID: <20240821071842.8591-9-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In psnet_open_pf_bar() a string later passed to pcim_iomap_regions() is placed on the stack. Neither pcim_iomap_regions() nor the functions it calls copy that string. Should the string later ever be used, this, consequently, causes undefined behavior since the stack frame will by then have disappeared. Fix the bug by allocating the string on the heap through devm_kasprintf(). Cc: stable@vger.kernel.org # v6.3 Fixes: 51a8f9d7f587 ("virtio: vdpa: new SolidNET DPU driver.") Reported-by: Christophe JAILLET Closes: https://lore.kernel.org/all/74e9109a-ac59-49e2-9b1d-d825c9c9f891@wanadoo.fr/ Suggested-by: Andy Shevchenko Signed-off-by: Philipp Stanner --- drivers/vdpa/solidrun/snet_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c index 99428a04068d..4d42a05d70fc 100644 --- a/drivers/vdpa/solidrun/snet_main.c +++ b/drivers/vdpa/solidrun/snet_main.c @@ -555,7 +555,7 @@ static const struct vdpa_config_ops snet_config_ops = { static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet) { - char name[50]; + char *name; int ret, i, mask = 0; /* We don't know which BAR will be used to communicate.. * We will map every bar with len > 0. @@ -573,7 +573,10 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet) return -ENODEV; } - snprintf(name, sizeof(name), "psnet[%s]-bars", pci_name(pdev)); + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev)); + if (!name) + return -ENOMEM; + ret = pcim_iomap_regions(pdev, mask, name); if (ret) { SNET_ERR(pdev, "Failed to request and map PCI BARs\n"); From patchwork Wed Aug 21 07:18:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770923 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0085E19ABC6 for ; Wed, 21 Aug 2024 07:19:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224786; cv=none; b=RCSBjPrHc3p7HX+OC3zOCFvs0M/S5DGc+YEnCthevq5h3EKec/wRbTXkK2hP0XuGN6YIKjlw0uv5NZuCg9V4XqEaZgpRIQkZ8DDGGGW+Z+TuY9W0ECt0zuSC6By7TwxlP9WsvZypqe6N9649FbTATFvoZe/tTZA6ZzF8pWMmoyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224786; c=relaxed/simple; bh=zz4g00AyrOlGbCFQ8xrM/DS+BcOL9w71mmIBYnsZsuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oRuWrapHAxB1ZHod2iQyRkGnjHCoess2zw/X3zcTJYuUXAOFvYG+sBqyPpt8ePAWS0nWVTzMC2D0kZUkdvQc/9xrCZOUfz4UYaNsS4tcqqy65SznMGnKuct5jfEfBSSUB1fLA9T7UUUE2wjhVYx7GCvNolBFF0Y0Rpgz6nbDz0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NLOl/nX/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NLOl/nX/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2jtoMc9tojKKL8iwWeM5ToAOyUwxh+I3f+1WrHk/fN0=; b=NLOl/nX/ElgXyVElrf0w0feJUkRZ90e71eQH1Zh+k1joxBUY0jD1LILOXXt5jBpN7L+wFR TW42B6RH5OZyoqA5Vob5oa4MxLvr9eKoTPiTZZ/HB327mmifd45CaofyiuJqXW/gMUYRV4 bR7RfKyb/Jp1b2afP62PscIOaZ6YKNE= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-179-IR3y-h5FMEqI-RZeBwL-nw-1; Wed, 21 Aug 2024 03:19:42 -0400 X-MC-Unique: IR3y-h5FMEqI-RZeBwL-nw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7a1d0b29198so637701985a.2 for ; Wed, 21 Aug 2024 00:19:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224782; x=1724829582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2jtoMc9tojKKL8iwWeM5ToAOyUwxh+I3f+1WrHk/fN0=; b=Y0+sujWTe83Sl9V90NZ16OXFVb3DYXAlTOi5UkAI427deTec9l6QeGIIoUfmIACw0t 1C0cBiZAqo1MK13eCZ9jUIG32O+/6+UMsY/SGlU0P69D4+q/nkbG3ZoGhtyTSCTqZOtP o4xkbctIUN+IzRHFMWK8BqX3R4Ylfof81D6ynPOAa9jghTM8UvLGNsfTbwCp7foyBMe6 woFHMGMMWWZ2gxlii173USW6szYJVhdVZRDNGN+wahWP1RevD+hrTq7ys0mWBlqIEabn 83V7OORTJID5/TB4+O0BneU9iN9ZE4iE3ufLYPsqExB9L2vYJrgEB1kv3EHm6Se2ZGF9 4Agg== X-Forwarded-Encrypted: i=1; AJvYcCUgQT2bf9iVp0iWPH5rx7eew3stjPtZSdreuHeOb+ruqQ78pj62yGv2731KJerNqv5JDto+XHRU6q2bJQ==@vger.kernel.org X-Gm-Message-State: AOJu0YxbgtydLTtJKv+fMaFeonZBboFxhC0d8aI1JmGju1kN10X7T9m8 4sWE9Wk38m7ELgP+k1fJMcYLEfQP36IiH41KWfXQoCjGSGgh1q4C9KGE62fRC0QZUHOF+kWYz2R /gVrDiOTgmXNNCxdGdmcoMdeAY/sWQIX10Qu2f+WFYMDaSikTGohdG9nYVmBd X-Received: by 2002:a05:620a:3953:b0:79e:e302:7392 with SMTP id af79cd13be357-7a674047d68mr175950785a.32.1724224781979; Wed, 21 Aug 2024 00:19:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEujbivdy0X82ZZM2IZtk3pa0uY+R6FAaLiHcgNfg5GEA0wo0Jm6V+lDWsOUg8+jqkxdP5bpA== X-Received: by 2002:a05:620a:3953:b0:79e:e302:7392 with SMTP id af79cd13be357-7a674047d68mr175949285a.32.1724224781630; Wed, 21 Aug 2024 00:19:41 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:41 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 8/9] vdap: solidrun: Replace deprecated PCI functions Date: Wed, 21 Aug 2024 09:18:41 +0200 Message-ID: <20240821071842.8591-10-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 solidrun utilizes pcim_iomap_regions(), which has been deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()"), among other things because it forces usage of quite a complicated bitmask mechanism. The bitmask handling code can entirely be removed by replacing pcim_iomap_regions() and pcim_iomap_table(). Replace pcim_iomap_regions() and pcim_iomap_table() with pci_iomap_region(). Signed-off-by: Philipp Stanner --- drivers/vdpa/solidrun/snet_main.c | 53 +++++++++++-------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c index 4d42a05d70fc..ce336f261649 100644 --- a/drivers/vdpa/solidrun/snet_main.c +++ b/drivers/vdpa/solidrun/snet_main.c @@ -556,36 +556,25 @@ static const struct vdpa_config_ops snet_config_ops = { static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet) { char *name; - int ret, i, mask = 0; - /* We don't know which BAR will be used to communicate.. - * We will map every bar with len > 0. - * - * Later, we will discover the BAR and unmap all other BARs. - */ - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (pci_resource_len(pdev, i)) - mask |= (1 << i); - } - - /* No BAR can be used.. */ - if (!mask) { - SNET_ERR(pdev, "Failed to find a PCI BAR\n"); - return -ENODEV; - } + unsigned short i; name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev)); if (!name) return -ENOMEM; - ret = pcim_iomap_regions(pdev, mask, name); - if (ret) { - SNET_ERR(pdev, "Failed to request and map PCI BARs\n"); - return ret; - } - + /* We don't know which BAR will be used to communicate.. + * We will map every bar with len > 0. + * + * Later, we will discover the BAR and unmap all other BARs. + */ for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (mask & (1 << i)) - psnet->bars[i] = pcim_iomap_table(pdev)[i]; + if (!pci_resource_len(pdev, i)) + continue; + psnet->bars[i] = pcim_iomap_region(pdev, i, name); + if (IS_ERR(psnet->bars[i])) { + SNET_ERR(pdev, "Failed to request and map PCI BARs\n"); + return PTR_ERR(psnet->bars[i]); + } } return 0; @@ -594,18 +583,15 @@ static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet) static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet) { char name[50]; - int ret; snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev)); /* Request and map BAR */ - ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name); - if (ret) { + snet->bar = pcim_iomap_region(pdev, snet->psnet->cfg.vf_bar, name); + if (IS_ERR(snet->bar)) { SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n"); - return ret; + return PTR_ERR(snet->bar); } - snet->bar = pcim_iomap_table(pdev)[snet->psnet->cfg.vf_bar]; - return 0; } @@ -653,15 +639,12 @@ static int psnet_detect_bar(struct psnet *psnet, u32 off) static void psnet_unmap_unused_bars(struct pci_dev *pdev, struct psnet *psnet) { - int i, mask = 0; + int i; for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (psnet->bars[i] && i != psnet->barno) - mask |= (1 << i); + pcim_iounmap_region(pdev, i); } - - if (mask) - pcim_iounmap_regions(pdev, mask); } /* Read SNET config from PCI BAR */ From patchwork Wed Aug 21 07:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13770924 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D16BA1B653D for ; Wed, 21 Aug 2024 07:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224793; cv=none; b=J/DouHp6ZKKl0zkgqQ90BrPXTj3H05zFFSNyBhOn0lmWqlnkRshd0fG1XI+iY/GlqWU73Yg98QakTezIKNP3iFeK76bNrVLQ/9Ot7cAahL8B0atoiWMkIaKgxnvRQLacnfrJ27m7yR+qJD39arhT7HXCshfMPFuDOs+JxFcorrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224793; c=relaxed/simple; bh=xzKTSbBUCxwnUpKs8six5ekb8eTkm5n7sI9qBsfTSxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vD8SWspYVHKeBNh962LOVQv7+TUk6uadr9Odz9Y2VMULSfQ3Dg0Aw8StX5edrQseH2FCUW+J3+rdG1ujIqQe4xQzf8sYiLdCX7OLO8u59tXnw/33+OAkLtk46Fpy1O8glm9bm7Ec9QeUzaoHAfdw8U6elTdbosYxaJIIp28jFaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XmraETh4; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XmraETh4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724224790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=stErXlsn4bG59ZiuP1S49NzWKfcbkIn79Ht3IKYskFI=; b=XmraETh4x3xAdX4PDbfhaXxgfcLzttGz90OasGhW3/qcOAF47Cjs2ihXV+Kh6Ijp/bivBA tT9cR/3bzmv5ywrD/QxCCFUbgaYvKLF7VLOARvmleKi8gXMkDncJX8JHn4WLlc0uuQBhEe 36EQjc69ieSIcfTZooCqC7FH4F9tsQA= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-yI9y3i9xO8ifU8Q5vJn9HQ-1; Wed, 21 Aug 2024 03:19:48 -0400 X-MC-Unique: yI9y3i9xO8ifU8Q5vJn9HQ-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a66b52c944so134588885a.1 for ; Wed, 21 Aug 2024 00:19:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724224788; x=1724829588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=stErXlsn4bG59ZiuP1S49NzWKfcbkIn79Ht3IKYskFI=; b=lGyoadLSD/4pvnLXgsv2t4Udr/nZ50gLVLT31BS9nKY9GhWAiEFelZs7S+9mQdJSTo hoxbCMT45P9/3uRAZ1VaPaXqSBPcr1RHzsuWs7gGDBGkgi7mqKWcVraDbXhIZ2k+toNd QR4UD5zpad9dOh84Bx80o3XmfMGZT2eM9kqmapx24HKVRrO7oB+trZ+cLeg+xMOGF0eK zGrAbGELg1t9b42G01XnJz9pNyCRHoPBnUrrIiyCVcxhOv92W52ZnQPudaLRWiTzh1Yu 2QViT12dmJTXFEjjQYHfM8rJywbbbLnceLVERWH9NYIwtTnXb+Ld1B+RONCZwZXEa+Nt Uavg== X-Forwarded-Encrypted: i=1; AJvYcCWKRazHSsw62uYwR6IffLOyeuf1aqHUDSH4dMl3wfuy75OBt6N5OpM8CrOXa67BUOfBXrcZmYrc3lXG0A==@vger.kernel.org X-Gm-Message-State: AOJu0YzNtpQWB9Et/bkBFeebJBA12NNMBmpoUEoDEfpBnt8U/dg7tsTb 9Kq0z39eSh8Immz4SAktjlVo+2WCRBSAWNraAGkIqwTkcOLthdtxQIfXTXQDVb9Q4zFxR1PY+FR mLUbzD+JCscp1YXWqTt6nybVKqzwDmD1Py4ClZCQ3/kDDHRg6DIy1drhMnR8o X-Received: by 2002:a05:620a:17a1:b0:7a1:ccfb:faf with SMTP id af79cd13be357-7a674048908mr211361385a.38.1724224788359; Wed, 21 Aug 2024 00:19:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUvUNVPoVPY0IqYI+9FyKN/j3iG1JNGhE8e2W6Pqxb+HWSkXXSyWApzCMJK3GHPcsNkvlKfQ== X-Received: by 2002:a05:620a:17a1:b0:7a1:ccfb:faf with SMTP id af79cd13be357-7a674048908mr211356885a.38.1724224787793; Wed, 21 Aug 2024 00:19:47 -0700 (PDT) Received: from eisenberg.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a4ff013ef2sm596207885a.11.2024.08.21.00.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 00:19:46 -0700 (PDT) From: Philipp Stanner To: Jonathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Mark Brown , David Lechner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Philipp Stanner , Damien Le Moal , Hannes Reinecke , Keith Busch Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v2 9/9] PCI: Remove pcim_iounmap_regions() Date: Wed, 21 Aug 2024 09:18:42 +0200 Message-ID: <20240821071842.8591-11-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240821071842.8591-2-pstanner@redhat.com> References: <20240821071842.8591-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All users of pcim_iounmap_regions() have been removed by now. Remove pcim_iounmap_regions(). Signed-off-by: Philipp Stanner Reviewed-by: Andy Shevchenko Reviewed-by: Damien Le Moal --- .../driver-api/driver-model/devres.rst | 1 - drivers/pci/devres.c | 21 ------------------- include/linux/pci.h | 1 - 3 files changed, 23 deletions(-) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index ac9ee7441887..525f08694984 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -397,7 +397,6 @@ PCI pcim_iomap_regions_request_all() : do request_region() on all and iomap() on multiple BARs pcim_iomap_table() : array of mapped addresses indexed by BAR pcim_iounmap() : do iounmap() on a single BAR - pcim_iounmap_regions() : do iounmap() and release_region() on multiple BARs pcim_pin_device() : keep PCI device enabled after release pcim_set_mwi() : enable Memory-Write-Invalidate PCI transaction diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 4dbba385e6b4..022c0bb243ad 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -1013,27 +1013,6 @@ int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, } EXPORT_SYMBOL(pcim_iomap_regions_request_all); -/** - * pcim_iounmap_regions - Unmap and release PCI BARs - * @pdev: PCI device to map IO resources for - * @mask: Mask of BARs to unmap and release - * - * Unmap and release regions specified by @mask. - */ -void pcim_iounmap_regions(struct pci_dev *pdev, int mask) -{ - int i; - - for (i = 0; i < PCI_STD_NUM_BARS; i++) { - if (!mask_contains_bar(mask, i)) - continue; - - pcim_iounmap_region(pdev, i); - pcim_remove_bar_from_legacy_table(pdev, i); - } -} -EXPORT_SYMBOL(pcim_iounmap_regions); - /** * pcim_iomap_range - Create a ranged __iomap mapping within a PCI BAR * @pdev: PCI device to map IO resources for diff --git a/include/linux/pci.h b/include/linux/pci.h index 9625d8a7b655..6c60f063c672 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2301,7 +2301,6 @@ void pcim_iounmap_region(struct pci_dev *pdev, int bar); int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name); int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask, const char *name); -void pcim_iounmap_regions(struct pci_dev *pdev, int mask); void __iomem *pcim_iomap_range(struct pci_dev *pdev, int bar, unsigned long offset, unsigned long len);