From patchwork Thu Aug 22 13:47:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13773462 X-Patchwork-Delegate: bhelgaas@google.com 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 DCAC81CB13A for ; Thu, 22 Aug 2024 13:48:02 +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=1724334484; cv=none; b=QOpndwpwsbPAgDt2rfRwV1XDI9Wv2JF/mRNkwEDJeEcEShdjyomsKnyBjTI0WiC9CINVzM64ImuEJd/lAc+kaL/m75dLBxyypvMUiyHeyd8l62Eh2JEOa36cs3MVkI2OUUlNS45BQKcuPU9eInmiHhvvxypuiq4JZO4QUrda7LM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334484; c=relaxed/simple; bh=mHz+ZZWFhHEQhgF8fgLbMMsZfX1XWBKyTlte92c7V0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aCebbMljcDp3Krixi6Ic8IQsPGHI9hFOGAxU9j2uFPK23w4dl9xT8mjBh2hVBBvyy3dIxwl485tIgJ4AhdccUGaZZiyoSJ8SB3jgCauxcq2OM4B6UhBYumKCD3A/ZZWZSitKt2wyybpGrc5Y46hp2xQhlA59+AaCfj5wz13oTL0= 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=ZGRVCIgi; 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="ZGRVCIgi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334482; 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=ZGRVCIgiQtFyD2AulXGcvqUnETGmYD2qC7YSGSS2Ph9OndTEGDiLa9r7SgxgN9UMjGfzMd zic0hwFmUXJazVAGowdOc/jzSJ5PHtoRQkhIaE+dzn3htjg72kahAmDgOiRMfMlujU156H aKANf20hClrisTiFs6yk/BL3+1C/ctU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-lMtDzq9zPB2o4EqZH6PJUw-1; Thu, 22 Aug 2024 09:48:01 -0400 X-MC-Unique: lMtDzq9zPB2o4EqZH6PJUw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3718e6956bfso489353f8f.2 for ; Thu, 22 Aug 2024 06:48:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334480; x=1724939280; 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=beFKhaHVRNNLCAYKYfEhRs2RQ10cLufhQo9baxgnPGkBzoU003mpL08Y3MfmijbxNh +BwrzuHjI/PfO5M8LaqKq0v1XzrywvHS6F/e/L+Ztg+1y2PQI8QtPBzq4FcJtC/7c6Jt mjh/HPNJLWkn7h1kCxPq2PYyjJAxAJOEMZfwU0ga2gGAubIEURer7dzf0wQZnO5qS1L0 VcJIQGzmOB7YXKlevFR1EHXJTT32uN9iqVTTfVIsquqtEM9v/IbjfJ2YVR4/PGDsaa71 9In4j6EKRYbNGsPBMKt1XzlbrkoGu7hehftHDqWf1V3Ghc84Vn71dFaA/DZiRRPvm0WH S7DQ== X-Forwarded-Encrypted: i=1; AJvYcCUadzCnsfJ8+nVqoyjzXMTEBYVX/KYGSL+OAz8IqB6Etsj6AZoJFHzr8NCXJBl1ux/3yLwXnk0Olbo=@vger.kernel.org X-Gm-Message-State: AOJu0YxIIWmLpaWpqCsi1NotJKGPBlpvfZJ31DtL5MBT+nqzMLhMDIY6 oNhUxWubUyhnV6vJpfZrnX2/WX37jBNg7qxBF/alfTYIv+xg9o7Agh45hL1ERjO67QYYIOskA/e krhK1lC9/QESz8UJu3HnO2L9nY1095P9dksWLWZWfpyB3hJ/8spcPV1O32g== X-Received: by 2002:adf:a396:0:b0:367:9c12:3e64 with SMTP id ffacd0b85a97d-372fd720f34mr3836231f8f.46.1724334479707; Thu, 22 Aug 2024 06:47:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHicvTaV+jAoa2XrftQuR7HNHJhvtQLD9wOQsI8y66hbliXuVEgvDzv31xvb8+T4AYL0nh8nA== X-Received: by 2002:adf:a396:0:b0:367:9c12:3e64 with SMTP id ffacd0b85a97d-372fd720f34mr3836180f8f.46.1724334479068; Thu, 22 Aug 2024 06:47:59 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:47:58 -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 , Chaitanya Kulkarni 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 v3 1/9] PCI: Make pcim_iounmap_region() a public function Date: Thu, 22 Aug 2024 15:47:33 +0200 Message-ID: <20240822134744.44919-2-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 Thu Aug 22 13:47: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: 13773464 X-Patchwork-Delegate: bhelgaas@google.com 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 020D91CB31E for ; Thu, 22 Aug 2024 13:48:04 +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=1724334486; cv=none; b=NUZtrPlWukPSKIDswUO/ruFy/CkBetAkHZO92MkQ7xRUE8orEx4bLrRSM65Uv4y7Z0TenvkLfkdfRWM1Auq/q8KLjoGyuzXPMZZX02Phu8Strl+Y1iFuJ0w60ydRWOMJMFa6cifGsPnsFvg8bGWA6FpTHdGCNXgoSYdS6NkBD8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334486; c=relaxed/simple; bh=BQY+sUCVOv9PvRxG5I1RVfUOvj0iBXM10s/oecEnuvA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gbyGT2ceb4vQeJDk1Uy8KqKfPIEg+UzGo3W3R7hGZjr2pkgS63KVr7ssLZXJmhokKvohjVfbJ8ePyV/kv+eIwSXZO9UvfdpI2VNS/xbUnHPCdScNWyTpFW4qk9QGz3KaiozvrUIzaZmwVZpuCKSYhf/VXCXvpEqIGv43XpBVE/Y= 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=P4SoaON4; 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="P4SoaON4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334483; 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=kI8i5GY2jMRlAmQS1bSu+iftmIP5RtQVe31XoOUBz1Q=; b=P4SoaON4BPmz4wbVneDzaWkrpw8P9sbXhITVhO8eabHiqoyOvFU+06QOL02GyNbGOSSrZ6 XanuRy9GACs7harxhDREv3yFL5g5H9qex4MZhin5/H116zxUkgJzP4RSZCHwP+hsec38id /0hxoWSwhdPbUbNk++HCNFkem5TEqw0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-rfJHTljqPYOGN9ZNwcE7uQ-1; Thu, 22 Aug 2024 09:48:02 -0400 X-MC-Unique: rfJHTljqPYOGN9ZNwcE7uQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42817980766so6806025e9.3 for ; Thu, 22 Aug 2024 06:48:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334481; x=1724939281; 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=kI8i5GY2jMRlAmQS1bSu+iftmIP5RtQVe31XoOUBz1Q=; b=fODTnHKBuE5tUDEOODwv+RQnCJKHFj2dCUWliqvl2h5Hww907jERrT7dktRdcYUj7I xZ774KqdBNEKPWRGnbxzmAYNlTLGwL0rr5ww8LRG6Rkl2sk3VZ2TAy1Qfy9C8lyE2aDa dmTrHtlNqnsNqh9hKOHzKHI3DYBfn0HhivpYSSjUdYMjajr8eBaZVlscG3Jd6p612cLG 2kQ246ZqpNmrSrixGOfxCXU6uZ9ndwnQiEqPGCkKX9UD9hQ+LOInHqs1onPo8uQ5+128 qMtYu5PQ6FDNVmkFhY4UyVOvOZ1rL/gQQo1LB1UL13WuE2QXNBQvT84qDZiCsbQHd1yZ R77Q== X-Forwarded-Encrypted: i=1; AJvYcCXLal9SspXC7aw7ga0CUho1i22wfiFHkTezJgXyozkTIEkeoPk7P/sCasntfsPSnTDg+BHSfMXvVxM=@vger.kernel.org X-Gm-Message-State: AOJu0YxhZUS41IrgLmTN5AhGqFRpkOqCsUEsRwIU1mf51EEieSwPHdLl sFwMDOnBdS1KUo+o7BMiL1aBPgoWkxntJNf+Pm36i11bu77QKuL+avMRxHe/kPbPZWZa78wCZtO CYYlM2775vz4hVPjXNQGHifCWD9YEcH21M3mbUEpiraFeLU0bbxp6nk2lfQ== X-Received: by 2002:a5d:68cd:0:b0:36b:c126:fe6d with SMTP id ffacd0b85a97d-37308c16966mr1223211f8f.24.1724334481157; Thu, 22 Aug 2024 06:48:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKCJk3UamU3gY39Dgnd4livDPv6g+NgCSNYxILlIqQhW519NZZIsqmP8GHU9qtEnK9x6mFHQ== X-Received: by 2002:a5d:68cd:0:b0:36b:c126:fe6d with SMTP id ffacd0b85a97d-37308c16966mr1223157f8f.24.1724334480675; Thu, 22 Aug 2024 06:48:00 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:00 -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 , Chaitanya Kulkarni 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 v3 2/9] fpga/dfl-pci.c: Replace deprecated PCI functions Date: Thu, 22 Aug 2024 15:47:34 +0200 Message-ID: <20240822134744.44919-3-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 Acked-by: Xu Yilun --- drivers/fpga/dfl-pci.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c index 80cac3a5f976..602807d6afcc 100644 --- a/drivers/fpga/dfl-pci.c +++ b/drivers/fpga/dfl-pci.c @@ -39,14 +39,6 @@ struct cci_drvdata { struct dfl_fpga_cdev *cdev; /* container device */ }; -static void __iomem *cci_pci_ioremap_bar0(struct pci_dev *pcidev) -{ - if (pcim_iomap_regions(pcidev, BIT(0), DRV_NAME)) - return NULL; - - return pcim_iomap_table(pcidev)[0]; -} - static int cci_pci_alloc_irq(struct pci_dev *pcidev) { int ret, nvec = pci_msix_vec_count(pcidev); @@ -235,9 +227,9 @@ static int find_dfls_by_default(struct pci_dev *pcidev, u64 v; /* start to find Device Feature List from Bar 0 */ - base = cci_pci_ioremap_bar0(pcidev); - if (!base) - return -ENOMEM; + base = pcim_iomap_region(pcidev, 0, DRV_NAME); + if (IS_ERR(base)) + return PTR_ERR(base); /* * PF device has FME and Ports/AFUs, and VF device only has one @@ -296,7 +288,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 Thu Aug 22 13:47: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: 13773465 X-Patchwork-Delegate: bhelgaas@google.com 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 63DE11CBEBB for ; Thu, 22 Aug 2024 13:48:06 +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=1724334488; cv=none; b=tTeOEcPTW+xNEpujYvQQ0so5NEG52BXGrvN5t3jJAuJurZgO738rLwsYcuW0AV709nA1je6I35ednarAx7VbnAiy+Ei90OhWHIMNjCFkXLMGePBm7eKWndUhqrIc4MXhnqVp52eI4mq9rY8+Cf7R/X3f8m91kQ8qbW83+YV35sk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334488; c=relaxed/simple; bh=3VAt95zZ1Dqz3XrvM2lwpkOQg6dQGTUaYO+6pcMQK9Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AMHSyuBpS72YLeor1NSPu/UYIimM2NaGaAXQzPRH+uRa2rKBklMbFKDFADkBWeeiVFmg+bDXbSxxk2B9IbvNw5y7fCLPO0hFfbQMyXbd1tHY5wMnDGV0+EL4f0uaVJtKYGYSYEHSOncuNTZG9V5fDpQro1kALRqekj63jwbrtuI= 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=Q0zzxUMG; 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="Q0zzxUMG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334485; 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=jhs2ECxIqanvtxlvW30RxDZNTtb7z2CuQcsYq71BRfY=; b=Q0zzxUMG1EeiWu7Du2bLczWWbqhoFUwz6iQGa72dL97iIAwH93JXsxPRCXkrhwLJOS2cMd fuzTHyKbAaImyVD4nqfCAZ2hPi13LQHfDQ/D/Hz4vVDfb+V1RvGV3IZ+WY3IRXErVqbP5J 62ScPBHBEk43tSgeRw5EPt7oeU4gIqg= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-Bu33oPv6N0OlruiX7z97qg-1; Thu, 22 Aug 2024 09:48:04 -0400 X-MC-Unique: Bu33oPv6N0OlruiX7z97qg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4280ec5200cso6292335e9.0 for ; Thu, 22 Aug 2024 06:48:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334483; x=1724939283; 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=jhs2ECxIqanvtxlvW30RxDZNTtb7z2CuQcsYq71BRfY=; b=GPNfdW1KWgZl7P09Xa4UIIp/WE2BPqjdavrSRekYM/0TLCL9oVzF7kJnV70/Alp050 qpydUtjBqAPgkmA1PIQhj6dfbBW6PqU3WNohd3O8dbqxJXyqYZnc0mc/Je4+bPbEf1tU ef+3aofr++X0sHXgTBvJM8JfieQuxXdsxm4lZ3FFNF48J/Bn2iUh7p8yhYzhWHFpIyaa Om8K8cMKaHFMjQk57yPIdwjzVXet2CrCGxFQuBd6F+TjkSiNWgg2yjKFeEI1Fo1STwQx 6IX2v1nauGXzVDcmYJZLm4ObPVuWPAs+c3Icp3YPO60qJPleiRKJd5urw1LQf2D1kZoS +E8A== X-Forwarded-Encrypted: i=1; AJvYcCWzXVIn7fcwCoIobNePToVHoCsYzzgRNTFRpq6n9861HVXxMlj6lhTRfRqE0fgESVHjknhv7P8lyvw=@vger.kernel.org X-Gm-Message-State: AOJu0YwxFVp987qfmEldf3rWaz4lBv7rGG3hTCbb001v+cCxDrdXgYEn lnTrfG4u06aad6FTqSmwpwTJcHZXjd98lom0e6SMorxZy+rhHF73HYlPQU9fjbxr33/o6NWSlSS OxlZGZWuGhbNNPfjE4K3jF3suhATI7o+hXVoGpzMwt2bY68MTmz8LDZDVnw== X-Received: by 2002:a05:600c:5114:b0:426:60bc:8f4e with SMTP id 5b1f17b1804b1-42abd21f5e8mr38751195e9.5.1724334482801; Thu, 22 Aug 2024 06:48:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXx12BAf3CxTnmjhd6pOZhjB7i9I5cLSUjMGAYvwAfvdwbDB7drJJLXCP1Y+6M4I79vMkMAA== X-Received: by 2002:a05:600c:5114:b0:426:60bc:8f4e with SMTP id 5b1f17b1804b1-42abd21f5e8mr38750635e9.5.1724334482246; Thu, 22 Aug 2024 06:48:02 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:01 -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 , Chaitanya Kulkarni 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 v3 3/9] block: mtip32xx: Replace deprecated PCI functions Date: Thu, 22 Aug 2024 15:47:35 +0200 Message-ID: <20240822134744.44919-4-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index c6ef0546ffc9..bd40a06e4c0f 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) { @@ -3722,14 +3724,14 @@ static int mtip_pci_probe(struct pci_dev *pdev, rv = pcim_enable_device(pdev); if (rv < 0) { dev_err(&pdev->dev, "Unable to enable device\n"); - goto iomap_err; + goto setmask_err; } /* 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"); - goto iomap_err; + dev_err(&pdev->dev, "Unable to request regions\n"); + goto setmask_err; } rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); @@ -3849,9 +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); return rv; @@ -3925,7 +3924,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 Thu Aug 22 13:47: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: 13773466 X-Patchwork-Delegate: bhelgaas@google.com 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 CF26F1CB333 for ; Thu, 22 Aug 2024 13:48:07 +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=1724334489; cv=none; b=a+U5Jr9EuZ1nE0rH3MhwC+JOOi/YWJmY+CtqTnXCzlaD8aaTC7Ysmmf2jMzsagF7MaFrXEh7uR9Xwbl68DRlbuY354uzrUvHFo2HeDEC96RZSPCqLG/Qc4CVVkb7I3/NXfM+KGMAeZLuwzjCGLwZ1+WaO07dlZB14r93flZNv4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334489; c=relaxed/simple; bh=Fc7LqA4dsnee2e9i3xlXjC/frSEy4rrwVedoLFfxfmw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JhFtPATDEGEFPVCU0fA2V4Q9X2LMUXFiEPbTGqJAZlkO7uvHXMr/PA8YkifU9b+3VmeqC0O7dZarhpQmB9Lwl/prVgvCCTo7ylUND2cNx3UnYJO6ujXLfGKaqSNIC0NVZjf7nn5YThGFaHOWV1j12jj4BzVPuEjoKrhyeCBPgeo= 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=Zotl45c1; 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="Zotl45c1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334486; 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=Zotl45c15X0icBSVeARcTnnFrvrgBtMHS2ozyLDXsTjyPqJE7iY1JWAHkb8Blgtc6FfPVK YSMQ85LzwO16ewP+gDArdzYc6f+6tXABwh+06cpBHqOuOsV1bboa5zYHvwiPiVP2pu5Fvo bwJAg7XcNf/kXSXDYDVKgWI8/Ryi8M0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-zyjXY87ePBOEIzPKxrJMAw-1; Thu, 22 Aug 2024 09:48:05 -0400 X-MC-Unique: zyjXY87ePBOEIzPKxrJMAw-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-371881b6de3so418414f8f.2 for ; Thu, 22 Aug 2024 06:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334484; x=1724939284; 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=u1TbTGo3EaGiypQxrQ2sEAcPA/P8gzPk4wTUuispCfKwCdJSfnV3WksGx7Jq8Ol/2q D5eO5zuQdktkxNS68D3t3oJyWpAsX0sbZ/FKlLVNtGfV9HnXkNOYDHf4RKovKRH63lrr UzhDr5mFGNidrj6UOphk/ej0nSl75vSx+iAUScCpor4T/EHTIoICNHho1EihaSwhlWtU +VDZHRLaCRvO1qF+BHS9SmmVt3wCt+Pgg8eOCLpxiuZeftuR4cUqe2VnvSEzk4NyfwIf SsD8GHfLLdlTBYXy41W/zuV5kbAgOfKG/mYkMX023TEa63azf+I1hMpQ/2dHwZSZWV+J WY7Q== X-Forwarded-Encrypted: i=1; AJvYcCXBObM0eQxskxvJxFNu+O7RqMehHOJdLwqEhNkmQY990LKw+9Enoq9mgYql4GVLZ1h590OFDPTdP18=@vger.kernel.org X-Gm-Message-State: AOJu0YyF8RL98HrZmzKQEZrgfs0Al81n382k7HQW0lN3BO/F4GfELkd6 mPuEr4DRvAdYxPyXT0Lo9mHeorcpqFnoeXviihtOH9sCyFHvBUXv1m8Rgasd9zMX0AwbMbJ+DIW Rtc5lHWzLx7m/jR+a+hmwFZ/P15k0kjgGb1XpnT2wGKKlTSTXIw/G/5qadw== X-Received: by 2002:adf:f802:0:b0:371:8c06:82ee with SMTP id ffacd0b85a97d-372fd82c3dcmr3699808f8f.49.1724334484241; Thu, 22 Aug 2024 06:48:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/dGSNW4Q5J8zIjht7W8w6lm/DRlJe50ZIJE1uWbGQpR5tL77ENnUxbm6ccKv01r659J3/tA== X-Received: by 2002:adf:f802:0:b0:371:8c06:82ee with SMTP id ffacd0b85a97d-372fd82c3dcmr3699770f8f.49.1724334483816; Thu, 22 Aug 2024 06:48:03 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:03 -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 , Chaitanya Kulkarni 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 v3 4/9] gpio: Replace deprecated PCI functions Date: Thu, 22 Aug 2024 15:47:36 +0200 Message-ID: <20240822134744.44919-5-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 Thu Aug 22 13:47: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: 13773467 X-Patchwork-Delegate: bhelgaas@google.com 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 68B4A1CB339 for ; Thu, 22 Aug 2024 13:48:10 +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=1724334492; cv=none; b=hgxZejXfRFkdX4NGeplA/rJU4b79VdybzHhjl58wNCydgzdZNIbYkpsLVJq4zhftVJ8evAr3alNhy2i5hgAbVJ5oPcKQh5eMnBX08Vyx2hohfimNEgzU3R85AGiivSHttnPEw+DnG0CaFDi20UEiax/qwsqJzlM3yXsmHQaMRQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334492; c=relaxed/simple; bh=SgQa/apEnyQVxi5RGIOMYDsJA8zmcu1/aNTE/QznKio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dsa+qCiydNNuyLniPx80uZMwYHIJPmEx/qgvaDaE6TKiHmulP3ur4ZutUsKH3FwNEtsFv9Muywv9gAqbqTisuv4guwEMzFKalwm6kIqKzESIskVCoBKFExh87Z4OOHFLI3OWUabABV+EuUW4k4/EIaBnv2FryrcHdamL5nZhCbE= 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=XCSxrpT2; 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="XCSxrpT2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334489; 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=XCSxrpT2HPn8lSweHxx4GumT+UGHU8pcFAWKhL/ohUR7hgEIItBMA2DiqL4XaQu2i6vw5z FsYJTcQ5TtXcvFCtqTgXJCFNy5PI54skW3apHeDFD+ogexMA7oGpsXOuC8m/aj2xJJdvOR x/jfIqHXrT9jCGRDJeUwNKBZXg5qgUw= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-ByftqJg0ONSklXpGAAY3GQ-1; Thu, 22 Aug 2024 09:48:07 -0400 X-MC-Unique: ByftqJg0ONSklXpGAAY3GQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42809eb7b99so4693165e9.0 for ; Thu, 22 Aug 2024 06:48:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334486; x=1724939286; 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=IZpIdgFH5BtlJ2KipGnjgzHDnj6RXkWDI6OVYpBzJngVlUwsnSsRLqflqjUo1T70S0 aVj22/rEep8cyfU+f2JpSdNDnMJnVDm9kS0uaIlXMTwgmLrbowoohuyMuM71hv23mWw8 eybvBCV3WFf163SGh6tp6Tx+tTz5Ne5sbZsfIWnSS9gXekPiC2TkeEB5IzCC0OtdwfQw UNuyz7ntFY1pqX2Vur0EJ179z3SCNonYVnDlW5OsJqraElO1ywUrLMn1OxDDzRCXkiC9 HnALvvUZQ86g8Vuyth7p7KrPH1gmcQ261MByHFbAWGbSRtbeqPTjwdm/rx8cPFiXRHwd c9tw== X-Forwarded-Encrypted: i=1; AJvYcCUFc4joHAYJXnO/NF++/9ZNxB6Fvq7XfZny5v7QqVa99piCRyZxs/PIVaUZnE4+qKBEs21VJE9mtnA=@vger.kernel.org X-Gm-Message-State: AOJu0YwlOBxe+bnw/vR3v/bixs5z5UHPYRkKQ41syga/t9NysljyeyZl 7zeFjPFmRbTwuJjdGrsfUj9/17rn8EONUaA6dy1/l3G89a0UwuQTMX4/ElZZFJDUzrx85F1Xu9A UxNDl6N6+hnLeEJ6En7dUOA9slP+X/oq2CNVzPw5wpjiIBcXuKmQOIAQ1PQ== X-Received: by 2002:a05:600c:5112:b0:426:63bc:f031 with SMTP id 5b1f17b1804b1-42ac3899e09mr16337155e9.1.1724334486179; Thu, 22 Aug 2024 06:48:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRSoYjY+fRaVMhy3JkraKLBSrGHIYEYva7zoKLHV+1g1iMr3Zs/N1D05tQ7XJx0t0ZIIxXpg== X-Received: by 2002:a05:600c:5112:b0:426:63bc:f031 with SMTP id 5b1f17b1804b1-42ac3899e09mr16336835e9.1.1724334485558; Thu, 22 Aug 2024 06:48:05 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:05 -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 , Chaitanya Kulkarni 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 v3 5/9] ethernet: cavium: Replace deprecated PCI functions Date: Thu, 22 Aug 2024 15:47:37 +0200 Message-ID: <20240822134744.44919-6-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 Thu Aug 22 13:47: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: 13773468 X-Patchwork-Delegate: bhelgaas@google.com 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 6041D1CBE96 for ; Thu, 22 Aug 2024 13:48:11 +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=1724334494; cv=none; b=Qd+L03kVM9GNil67STWdPitlOS79AHB21O8NxBZ/pxogUNa+wX0gfaDjrPWKlLXPq4qXrVHkAMyPUA2riAuIG8XURKJaGv6u0dSB/6ZHNeuIEb9fmJxP1eez43VYNrpPj2gdQFfE2u5Oot3suYaALtnXvj1XlFTgHp3B9Aq8R7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334494; c=relaxed/simple; bh=kigVrUGzwAc3Gfl0QApPC++gUgBQlYDwvJKklnpQh/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iWGVScYf8a0vMJ/dR6kinYMUZuburSwblvGvnZdGe6RUeLCdBwI33diaEcf+p8iav25vwJtJe5Q6UX3ydykBC4/7jG1SLqjuaJkjIx+5FomlHvEVoyyNvGPoYFI42bK7OB5H7MBoI+SmTdI+bvO4AOlTkbAHSsq+dJw8+zoDznE= 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=X+fuxEbY; 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="X+fuxEbY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334490; 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=X+fuxEbYUfgzvl37W9dFtMA3UXqAlZMzeg/E+jeblrTeZ6qCL6wNPWv2y2+5v00ThdKNSb owPA7kpNTqVzMrcNqqCVbQcZrwV6FZ2oWWUWZBY2ILkwZPd85ioGE4DxHGSAg26P3qCebo yCUBdkL7LxhqjCDYlbdL9RUqBLpRuaQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-xPAecEMVNLmR_1Ot_Tbt5g-1; Thu, 22 Aug 2024 09:48:09 -0400 X-MC-Unique: xPAecEMVNLmR_1Ot_Tbt5g-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4281f8994adso7118455e9.0 for ; Thu, 22 Aug 2024 06:48:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334488; x=1724939288; 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=oQXv94Y2Z6tfTnsHCowna9EzrYLA/yFWl2O69Z61bazgMztMEkK8crg55vTZY59eVM xv7y5hBvv+6p6V5arFI2dt3Ust46ayo0Ae7v4OyQN9NrtzQL/s1YU4qLBl0PngVzTcKQ RuRlwQab4+t+hAD4gBlqLeq/w1XdkxtVmbAjJD+vJkrs5R5CcO9rg02/JOdKmCBO1sZk lmsBAR2fOhJEu4HjTBDzLEbmg/Ii6OwSVZGU/fezkPhimTD5UIvh4dY4lQcIA1SHGOF5 opZ8sPg4RbIetRPwGlmCnEtlFVkFZgFOn8I8jaKoeHhqxlP5Q/rK/9sdjVASV44MgXzt /azA== X-Forwarded-Encrypted: i=1; AJvYcCW3oDd+u6LntxOeykRmqkbxtL/bnoq+M8MnZ3SdNT3rAoPsnlhGgyVSSx8UpT3BYe2i7MRu7p5+OX4=@vger.kernel.org X-Gm-Message-State: AOJu0YzlMlHineyXjhs2vvSf6paW8hffYuUvW3oCGA4QY3+3hfJJOPUY Ha443SIC3Q4/mnF1bp3XClZ/cpwNTZAnosmVKOmIN+Zo6f+a4QEfsDEI3TLuhwVD9MPp3s6Y9Rj vAgZGnMtwiFPG3e84lw9YX58vFqM3jLgfE9sOmaWfgctwBwpyGyl+RK/rrQ== X-Received: by 2002:adf:e410:0:b0:367:8ff0:e022 with SMTP id ffacd0b85a97d-372fd82c514mr3475180f8f.63.1724334487682; Thu, 22 Aug 2024 06:48:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfm5IVXln66BGNZF5JJpxCZS0SFv4UM3BbHCVYBs8QYQ2NHD/YJAIrke5UaPWYY0eCv/EJGA== X-Received: by 2002:adf:e410:0:b0:367:8ff0:e022 with SMTP id ffacd0b85a97d-372fd82c514mr3475148f8f.63.1724334487230; Thu, 22 Aug 2024 06:48:07 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:06 -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 , Chaitanya Kulkarni 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 v3 6/9] ethernet: stmicro: Simplify PCI devres usage Date: Thu, 22 Aug 2024 15:47:38 +0200 Message-ID: <20240822134744.44919-7-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 Thu Aug 22 13:47: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: 13773469 X-Patchwork-Delegate: bhelgaas@google.com 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 BEEE51CCED8 for ; Thu, 22 Aug 2024 13:48: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=1724334495; cv=none; b=RYSYcslRjH6kbGLOKANlSevid5XrQFTnsmhXUm0X+nFvLeBZynI6dYuSyjO6nUnLRhmqhG0fO8rTk/udMqfsYRT6R0Kg42RKIizTOh7kMrlQQRbJRjC7O/LwqbmJKPbY4AyWAI2UTOA2NXD0oKFycrEG6o+zwuTnebynp0DZmoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334495; c=relaxed/simple; bh=KDo5b7D9c2aKWVtFHnbLLIbe9frXqS/ZEDy0EgIaE/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ne6MCkW3DmRO2RG8J5KkPU17LeHaLHysphLbPRFKCO9DtG+ShBJ/N8wh52wlIrCK1wzEBQRtIWMMIiQyX0iY647ZF/wEwoKBqs7l1KthSy0w735WH8Y+gqcoWkHJ1+5viUwqOX8QOQGBMWtuwyPog4Hcf36jRp6fMded9B4Zlzw= 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=SupTUXPg; 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="SupTUXPg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334492; 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=KRyCGGbXeIqtIB2NKAJconNCn7y+8lt1LzEGsFrZVag=; b=SupTUXPg5K6BnPlftYXgEZdrBOgv80uB8gZaRgB/ia6+QNoQsizGiGjn28Jx6vEBia0eCa ETBRH7BRrtnr9hNLFwvEoPAsevXQyFVFJds12IlsN63owBx1nU+ZqNkG1UNAVjAQ9Thius rR3VWm1TTZfVmQPyaEp2Dh+LRTOc2u4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-OlCz-9H9NPSedI5TZ_CaQA-1; Thu, 22 Aug 2024 09:48:10 -0400 X-MC-Unique: OlCz-9H9NPSedI5TZ_CaQA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-42820af1106so6265145e9.2 for ; Thu, 22 Aug 2024 06:48:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334489; x=1724939289; 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=KRyCGGbXeIqtIB2NKAJconNCn7y+8lt1LzEGsFrZVag=; b=jPN6ddRJM/haKB/a22kyGVQKEbzSu1kqkLC/nRt8gBT8X6pdOiY7ksBivLlTsCI3H1 h2Yo4RTDe1s5//O+Eub5Avyxc7GOw8WSOcCRaX/6o5KGBrYigVh6c4cCyUOVhR/n9yG/ DGgAp9ABzGtwTZoXMUYfFeaVgqDwZHwr/NR3PdPckSw0gvpu1gyWzJHp0j/xGozyGhhX /pbHKupFMQGCclvKhOjq9OzMIrsbtoXAzeJO/nysf4pNN7Ydi9MpqIK5eH8KVxkebpI1 JlpiwZYyB/DTpuAhHHCYYWaQ7nvd9j/jajMw60sNT1UGqOUIMODD0UJkQkvWLQXO8rIL rVlg== X-Forwarded-Encrypted: i=1; AJvYcCUKzoz91+dlU2LgEdeMHABcN1pwngKIDMn55BJqNR1Uqr18qfTUUx3xkBQTdH78t5pGQEUTHG4I+AU=@vger.kernel.org X-Gm-Message-State: AOJu0Yxg9O9zgmzy+jOHgqWp1ZLRqeHE5xbRy9st3HezxHuJS2dj7ins G83RjHNXht2KHEjz81JMS5qJ5Cpb5jIWiQMzaCTOZQdNSNOo5h7CbYiQ9A4OrA5WbhLhMtUn+eT ZNR8AByP2z8y3l824p4I03xNxtyZPp8WBr3JFuh3qnlWRyOBYps+2nDsZjw== X-Received: by 2002:a05:600c:1f94:b0:426:6379:3b4f with SMTP id 5b1f17b1804b1-42ac564e9a2mr14095685e9.31.1724334489393; Thu, 22 Aug 2024 06:48:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEycROzO/HBKtY3F90/mam5y1MK/8INPkts2FEZk+sZD+ocdqE8maXCLum4hgY74c7bSFdk0Q== X-Received: by 2002:a05:600c:1f94:b0:426:6379:3b4f with SMTP id 5b1f17b1804b1-42ac564e9a2mr14095275e9.31.1724334488951; Thu, 22 Aug 2024 06:48:08 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:08 -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 , Chaitanya Kulkarni 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 v3 7/9] vdpa: solidrun: Fix UB bug with devres Date: Thu, 22 Aug 2024 15:47:39 +0200 Message-ID: <20240822134744.44919-8-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In psnet_open_pf_bar() and snet_open_vf_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 strings 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 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c index 99428a04068d..67235f6190ef 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"); @@ -590,10 +593,12 @@ 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]; + char *name; int ret; - snprintf(name, sizeof(name), "snet[%s]-bar", pci_name(pdev)); + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev)); + if (!name) + return -ENOMEM; /* Request and map BAR */ ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name); if (ret) { From patchwork Thu Aug 22 13:47: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: 13773470 X-Patchwork-Delegate: bhelgaas@google.com 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 10F7B1CDFDF for ; Thu, 22 Aug 2024 13:48:17 +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=1724334500; cv=none; b=DYJD+YLMWkj0UTcajftXr4c0t2HYAR34Mnd0VML4zoT5NIVKxREPgOgz/m10+e/DfPaB1WTapDIQMhX6KzbqFlsrCyyQgtXgDjIWlDaSMEDX/syYZmaBYlK2rBmnpdNBPEqiLyXVmcc2zAaRz6Ld9VQ2zVr4JeaT4oCIvmiLqFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334500; c=relaxed/simple; bh=Me/VBGfLq2KkhHhzkti+j6tzd1UShbG7U7ve4P+FN3c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VYRiQXHRuXVfDN2Zm5nNRX0eiVTNgiweyo56wvkZmZGqLfiUm3ktAZoo4fPMSlv8Ot3A2rHNVPuQgL1scWMt4DL1y966FTIhiRs8RgXLPqdt051N57R6wb465QT6OMwZ2dl0qGfsHPEHv/AAfgeTIPOVnbwj6DpXshtZLI3qSEI= 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=B66aLWlu; 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="B66aLWlu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334497; 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=6h4v+tZpLlqIwoSAXvFUJWXM7qY2tlcI9NvuTPZYAG4=; b=B66aLWluZZQxUarZ0ZOhNgGQMCY3d1fpM+hrj3THG9QvkjJKKygOpLG/5Q22QdJIQ+rUfQ dSTQeXaePII7kVogVSXnW3USeERqD0nbQLUzphIndqTPQV6+jCQUQCuYKu0LlWUz591EeC t4jOtv5AhLJFFWQwMQa6kjwDdLrCuWU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-67-7AGzI4iJOaW4EEEKmhvLLQ-1; Thu, 22 Aug 2024 09:48:12 -0400 X-MC-Unique: 7AGzI4iJOaW4EEEKmhvLLQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-428076fef5dso6754905e9.2 for ; Thu, 22 Aug 2024 06:48:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334491; x=1724939291; 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=6h4v+tZpLlqIwoSAXvFUJWXM7qY2tlcI9NvuTPZYAG4=; b=YhdFe1XrTR0mJy2xQb9RS1uUYEcgg8c3cwszDpwilATEyxsapM2ffYCCccS+v+A9MA Nhp/Uv1P6HsUUk1aa73hSgQHVjEfJqTc/c+5EBJhk94UN5kghGwfdOM1QeD+oV2fXMML ykRz3ybOVP3IBOMJWb2y6hv85HDkmyG5OPuRQIFvYWbtG4DP3A+XQGfOPx1N/mppkNNp 3QmSpM+3drGL8Jrtv7RxEhEFzkUZ3vihIYFqzG19BTJR2o/bADhodGdkrugu07gtf/s1 xE9PT3g8OOn4K2AF27awnTg+GsrjtWrd1lyQTZceu2nz9X5HGejMTqx8vGbXmQivcsNW Q4dQ== X-Forwarded-Encrypted: i=1; AJvYcCVmmPkEKlZvp+4JC6qeLnUJ9lVNw+5Y3NAr/v5TwaxorHInXqV9yHJGYsy3A/DBXl2QpULOngvDMcE=@vger.kernel.org X-Gm-Message-State: AOJu0YxyQ0VQAz+tN8x4NhMgsW6LMp1xRsw09sNisJkEgAdRptdxu7i0 NM7Hiig/HWw02Ho9EhTw6lZufXxWuwVofKEWt5pnJmL315/4zwN4EEWBkUI4TVsEbc0kGdrC/NN HN4TTYkn7oJsfnmwgfbad4Pz7MLmRREfHGBMosnb8GA4BP/ramgvgOb3UVw== X-Received: by 2002:a05:600c:444b:b0:428:1ce0:4dfd with SMTP id 5b1f17b1804b1-42abf09ff9cmr36150035e9.34.1724334491035; Thu, 22 Aug 2024 06:48:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6akima5CtgXO6K5U8TUtsOlzD7gs9FdnvsxKJnG5gEPJ1/b/QeEPWH0oT+lxtkjuS4oHl+Q== X-Received: by 2002:a05:600c:444b:b0:428:1ce0:4dfd with SMTP id 5b1f17b1804b1-42abf09ff9cmr36149635e9.34.1724334490614; Thu, 22 Aug 2024 06:48:10 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:10 -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 , Chaitanya Kulkarni 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 v3 8/9] vdap: solidrun: Replace deprecated PCI functions Date: Thu, 22 Aug 2024 15:47:40 +0200 Message-ID: <20240822134744.44919-9-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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 pcim_iomap_region(). Signed-off-by: Philipp Stanner --- drivers/vdpa/solidrun/snet_main.c | 52 +++++++++++-------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c index 67235f6190ef..fb15e844847d 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; @@ -600,14 +589,12 @@ static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet) if (!name) return -ENOMEM; /* 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; } @@ -655,15 +642,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; + unsigned short 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 Thu Aug 22 13:47: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: 13773471 X-Patchwork-Delegate: bhelgaas@google.com 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 66D3F1CE70E for ; Thu, 22 Aug 2024 13:48:20 +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=1724334502; cv=none; b=nQjYkAE9EnTiELME3p+C0TNcQHM+MSaQXRMnBnBcMNaV0qAZo0YgKt8u0VPTi66efIyvEqPFt34P+XMj5iMeEJIjE66eie6vlKyBOhloH+TXVpgkK0zh5OroIyK79Y3A/nN0GN+eesvuWDW1QM0GXYgMJnearmIECSxLlahUFAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724334502; c=relaxed/simple; bh=xzKTSbBUCxwnUpKs8six5ekb8eTkm5n7sI9qBsfTSxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KldPq9zbDRyWwORMCduVCKhO+FU4/nkZ+xvdI/oF0lU4nA59527J/OpYFe2MNRnWqz4pPTK/dgPXsZByI5k2nAT6ajsyJFMXx3MR9OUKG4xEZk/ZycOqCjAmPfOKsnOvoJZr8+Y2wYiI6jsQC/ESZ8iWnabzyLWW6sy31SgRgnU= 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=bFurobo9; 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="bFurobo9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724334499; 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=bFurobo95VLUhde3hU0XrfTQcWPgVy4Fuienjxdq5HfFRdd65WzUaThBk91w9hF/28044T Ei+PoMAbTyT/KfrtOewmtxYJJVayw7qeUxqd2IzXIMKjjGbRutViUxhfzmvNmyYj2+nYlx Fcv4ZcwZoutZDtcm+dCJFe284Q9obzc= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-hTV_oEczPii8Fno0oq2NLw-1; Thu, 22 Aug 2024 09:48:15 -0400 X-MC-Unique: hTV_oEczPii8Fno0oq2NLw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4280ec5200cso6293345e9.0 for ; Thu, 22 Aug 2024 06:48:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724334494; x=1724939294; 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=ET3N9UG8IVUQaoYK23x7DUQC2rL0HhE+LGn7cozTtddvUfAgzfm8LNMHmNtw+e79ki B4pbLRVtWMzJOUReMSligNgCn2vKgYPjKnxeXvwXsuyvoislVijF3JG3oh4W4BHE5hLO ouAQ7t3xKGDdZq3C05wW6N4HEqLkR+rC81LmR/5HPFsDsKWwXnL0cTCgM8kuGDjgF1y+ NkAZ1MnHc2+33kdfhTtgufDN9lHJ37YWIAq8NkjqCNvFK9EPWP1EZ+UFTPmQ/Nhb66QR UjSC3/Wga86nm6pnVn1UpcwnuckW2Nu7oBSjQ6U0IL62l6pOOAJgIPUgOiZNGE5O050f Q1PA== X-Forwarded-Encrypted: i=1; AJvYcCVx0cT5sDBjYRrW5193yFJZil11ULL3KeVXSxQpDtLnm68EENCw2xFOj8O8As2Dx61Js/J75BG6xOc=@vger.kernel.org X-Gm-Message-State: AOJu0YxwzWOwrVmm2TEWPCsN6tdprwFUZ1eBApsMRCx+QtRR/kt5mhdF bQNhsfdz/Jb/3XoLgpZsh7imI2renhLPBzsHTAtSS8S/j/Rf5oWoXGBUuVZwQLCbEBVwsmsqhee yRxGcLBTfcBLY7v+Tv/dtjohplXCmnddzgJfMVxDOvU6nKnzyf9rRR+KIfA== X-Received: by 2002:a05:600c:470d:b0:426:5cee:4abc with SMTP id 5b1f17b1804b1-42abd23c42fmr42834475e9.20.1724334494014; Thu, 22 Aug 2024 06:48:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+ml6suAX3eG1pz2LPHUrAJqRTfncLpMSUbPA+Ci3dUa++3KF20e/68btOdPMgiZkBffw5eg== X-Received: by 2002:a05:600c:470d:b0:426:5cee:4abc with SMTP id 5b1f17b1804b1-42abd23c42fmr42833985e9.20.1724334493539; Thu, 22 Aug 2024 06:48:13 -0700 (PDT) Received: from eisenberg.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162322sm25057215e9.24.2024.08.22.06.48.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:48:11 -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 , Chaitanya Kulkarni 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 v3 9/9] PCI: Remove pcim_iounmap_regions() Date: Thu, 22 Aug 2024 15:47:41 +0200 Message-ID: <20240822134744.44919-10-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240822134744.44919-1-pstanner@redhat.com> References: <20240822134744.44919-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@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);