From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Philipp Stanner <pstanner@redhat.com>,
Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
Mikael Pettersson <mikpelinux@gmail.com>
Cc: <linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 2/3] ata: Replace deprecated PCI functions
Date: Thu, 12 Dec 2024 21:20:19 +0300 [thread overview]
Message-ID: <edf7216a-15f8-474b-95ec-84451192cd28@omp.ru> (raw)
In-Reply-To: <20241204171033.86804-4-pstanner@redhat.com>
On 12/4/24 8:10 PM, Philipp Stanner wrote:
> The ata subsystem uses the deprecated PCI devres functions
> pcim_iomap_table() and pcim_request_regions().
>
> These functions internally already use their successors, notably
> pcim_request_region(), so they are quite trivial to replace.
>
> Replace all calls to pcim_request_regions() with ones to
> pcim_request_region().
>
> Remove all calls to pcim_iomap_table().
>
> The last remaining user, libata-sff.c, is very complicated to port and
> left for future work.
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
[...]
> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
> index abe64b5f83cf..1f74666a0f37 100644
> --- a/drivers/ata/pata_sil680.c
> +++ b/drivers/ata/pata_sil680.c
> @@ -360,15 +360,17 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
> /* Try to acquire MMIO resources and fallback to PIO if
> * that fails
> */
> - rc = pcim_iomap_regions(pdev, 1 << SIL680_MMIO_BAR, DRV_NAME);
> - if (rc)
> + rc = 0;
Doesn't seem necessary...
> + mmio_base = pcim_iomap_region(pdev, SIL680_MMIO_BAR, DRV_NAME);
> + if (IS_ERR(mmio_base)) {
> + rc = PTR_ERR(mmio_base);
> goto use_ioports;
> + }
>
> /* Allocate host and set it up */
> host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
> if (!host)
> return -ENOMEM;
> - host->iomap = pcim_iomap_table(pdev);
>
> /* Setup DMA masks */
> rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
[...]
> diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
> index a482741eb181..f4644ba5f095 100644
> --- a/drivers/ata/sata_sx4.c
> +++ b/drivers/ata/sata_sx4.c
> @@ -1390,6 +1390,7 @@ static int pdc_sata_init_one(struct pci_dev *pdev,
> struct ata_host *host;
> struct pdc_host_priv *hpriv;
> int i, rc;
> + void __iomem *io_tmp;
I'd suggest a better name, like iomem here...
[...]
> diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
> index 57cbf2cef618..73b78834fa3f 100644
> --- a/drivers/ata/sata_via.c
> +++ b/drivers/ata/sata_via.c
[...]
> @@ -494,13 +497,17 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
> return -ENOMEM;
> }
>
> - rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME);
> - if (rc) {
> - dev_err(&pdev->dev, "failed to request/iomap PCI BARs (errno=%d)\n",
> - rc);
> - return rc;
> + /* Request and ioremap _all_ PCI BARs. */
> + for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> + iomem = pcim_iomap_region(pdev, i, DRV_NAME);
> + if (IS_ERR(iomem)) {
> + rc = PTR_ERR(iomem);
> + dev_err(&pdev->dev, "failed to request/iomap PCI BARs (errno=%d)\n",
> + rc);
You have a limit of 100 columns now. :-)
[...]
MBR, Sergey
next prev parent reply other threads:[~2024-12-12 18:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 17:10 [RFC PATCH 0/3] ATA: Replace deprecated PCI functions Philipp Stanner
2024-12-04 17:10 ` [RFC PATCH 1/3] ata: Allocate PCI iomap table statically Philipp Stanner
2024-12-04 17:10 ` [RFC PATCH 2/3] ata: Replace deprecated PCI functions Philipp Stanner
2024-12-12 18:20 ` Sergey Shtylyov [this message]
2024-12-04 17:10 ` [RFC PATCH 3/3] libata-sff: Simplify request of PCI resources Philipp Stanner
2024-12-12 19:26 ` Sergey Shtylyov
2024-12-09 1:14 ` [RFC PATCH 0/3] ATA: Replace deprecated PCI functions Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=edf7216a-15f8-474b-95ec-84451192cd28@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpelinux@gmail.com \
--cc=pstanner@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox