From patchwork Thu Aug 29 14:16:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 13783327 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 12AEC1B1512 for ; Thu, 29 Aug 2024 14:18:56 +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=1724941138; cv=none; b=W25H7EklR8b+Bu1UesWPQQ6DX3XS8AXzki0KoxT2fddQMgU1BL7LKE8SOXj46KoONquWpZzuN2I75EEExT2uTphl0ogvdxQdFHTvikmIV2eZoYI4/N+6fBHRw1qq8Ti9p7Yk2R62BCG/AzeaKS125O8NM96Zpb6j9NsBx0qc0t0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724941138; c=relaxed/simple; bh=s4GctkYHbXn3tfM8TOsiQdy7M4dRLmQpFi1urTUZZ7M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H26jRQT7O6+bXWz2f0aMdhx1bii9mVUFL4QmQpU/465vnrD8Cg7tj8RyK176zeBb84OORgelQ3KtMl/m8CrxrT+WULyxG+/qjz2AOd3x7C20JGhvnY1f95fXMWhlQzuc1qcrTg/LVAMYgnbXeIQsYPW2I8m8EC4w70KcRDEWNqU= 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=EO7nAydQ; 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="EO7nAydQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724941135; 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=YtYR/gGTmDbAPYmIYRccbXqwblJKOZwAhQg2Y6pwqmg=; b=EO7nAydQGuS8+PH1FdrZVaVS746AZzLW4GgZHIz/ra8IgksF7ismJaK/JSY4y2Z76HnaCn hookJW9Kkun1/J10pcsOVJSYtYjPVO3ij8CLqVoa+cmQPbG+9h2ehXaBe8yp4BMnZMKRo1 TMz4pzH2tYjO9/nPwlK8J4nN7yLjx8I= 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-504-xNgu3WjUMXGPJXdoaStzUQ-1; Thu, 29 Aug 2024 10:18:54 -0400 X-MC-Unique: xNgu3WjUMXGPJXdoaStzUQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4280f233115so7099685e9.2 for ; Thu, 29 Aug 2024 07:18:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724941133; x=1725545933; 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=YtYR/gGTmDbAPYmIYRccbXqwblJKOZwAhQg2Y6pwqmg=; b=qF0sPLiqfzJr9NtLkTeIyCAiad3bB5CdjkeNr6EQ9rP54s5Q56nrjJW4gcS79iD6ki bQsAJVUgBNxgw+HQa6tWG+LwWkIJlmHzAs1riGWjwiz1LH54ye+UtzICoA83nDEoMBtd cxEiqT1wt0aNxMHl2Vh6vAvlVTAl0OFKsXSKDXUwyla5/BPwIrmWx34ybGRGdrmLGcK3 4Exkim229CecABH2qWfQMdAe3jGsm2snJFq7tDFBGJ3Og/S6NEq47ilcWTMbAF7QetUv JAZ6JNnq6BKVCXoe4r6Qm4gWUXCWCSd/OPGcEUqRPPFGcjgA0YH64JaZQIWvqXeVDmSp Df3A== X-Forwarded-Encrypted: i=1; AJvYcCV0rNU8vcliMnvQFIaSwQ2YMSFrhLDW7SNPfPi9cxO9XnW7gA/ySwUnqaHmMwhPfm5LZjRpzZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YzoLZ0NMyA615HBTWepT0Oaw0hz6WOfqj7XUyP/rC43zFNARPdH aOTOdK6/dqEUvtfmzEqFx0gWWD5MoWpfTJuSPdEsDzR8YQhFsS6dRQwIjJlhej1nDBXz9DYJdse 2JC7cZVnz0+u8o+U7AX/BbEOz3GMlrtIzjPFd+pfOhRXDZnJC3hpxww== X-Received: by 2002:a7b:c449:0:b0:42b:aecb:d280 with SMTP id 5b1f17b1804b1-42bb27a1021mr25083735e9.27.1724941133422; Thu, 29 Aug 2024 07:18:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGM4L32QAy6bG5zGi4CSR/e0PXgXREM2OUI07zkgBOIcbPjvtDeXtGrw5+r/WVKmA9y9IZ/KA== X-Received: by 2002:a7b:c449:0:b0:42b:aecb:d280 with SMTP id 5b1f17b1804b1-42bb27a1021mr25083605e9.27.1724941132945; Thu, 29 Aug 2024 07:18:52 -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-42ba63abebdsm52670425e9.27.2024.08.29.07.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 07:18:52 -0700 (PDT) From: Philipp Stanner To: 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 , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Richard Cochran , Damien Le Moal , Hannes Reinecke , John Garry , Philipp Stanner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH v5 3/7] block: mtip32xx: Replace deprecated PCI functions Date: Thu, 29 Aug 2024 16:16:22 +0200 Message-ID: <20240829141844.39064-4-pstanner@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240829141844.39064-1-pstanner@redhat.com> References: <20240829141844.39064-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: netdev@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 Reviewed-by: Andy Shevchenko Reviewed-by: Jens Axboe --- drivers/block/mtip32xx/mtip32xx.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index c6ef0546ffc9..e4331b065a5e 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); + /* Request BAR5. */ + 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);