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: [PATCH] ata: Replace deprecated PCI devres functions
Date: Wed, 14 Aug 2024 20:32:53 +0300 [thread overview]
Message-ID: <c2d21da0-7fe1-f995-5562-7ff04e9f1b8b@omp.ru> (raw)
In-Reply-To: <20240812084839.37580-2-pstanner@redhat.com>
On 8/12/24 11:48 AM, Philipp Stanner wrote:
> The ata subsystem uses the PCI devres functions pcim_iomap_table() and
> pcim_request_regions(), which have been deprecated in commit e354bb84a4c1
> ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()").
>
> These functions internally already use their successors, notably
> pcim_request_region(), so they are quite trivial to replace.
>
> However, one thing special about ata is that it stores the iomap table
> provided by pcim_iomap_table() in struct ata_host. This can be replaced
> with a __iomem pointer table, statically allocated with size
> PCI_STD_NUM_BARS so it can house the maximum number of PCI BARs. The
> only further modification then necessary is to explicitly fill that
> table, whereas before it was filled implicitly by
> pcim_request_regions().
>
> Modify the iomap table in struct ata_host.
>
> Replace all calls to pcim_request_region() with ones to
> pcim_request_region().
Huh? :-)
Besides, I'm not seeing pcim_request_region() anywhere in this patch...
> Remove all calls to pcim_iomap_table().
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
[...]
> drivers/ata/ata_piix.c | 7 +++---
> drivers/ata/libata-sff.c | 50 ++++++++++++++++++++++++++++++-------
> drivers/ata/pata_atp867x.c | 13 ++++++----
> drivers/ata/pata_hpt3x3.c | 8 +++---
> drivers/ata/pata_ninja32.c | 10 ++++----
> drivers/ata/pata_pdc2027x.c | 11 ++++----
> drivers/ata/pata_sil680.c | 11 ++++----
> drivers/ata/pdc_adma.c | 9 +++----
> drivers/ata/sata_inic162x.c | 10 +++-----
> drivers/ata/sata_mv.c | 8 +++---
> drivers/ata/sata_nv.c | 8 +++---
> drivers/ata/sata_promise.c | 7 +++---
> drivers/ata/sata_qstor.c | 7 +++---
> drivers/ata/sata_sil.c | 7 +++---
> drivers/ata/sata_sil24.c | 20 ++++++++-------
> drivers/ata/sata_sis.c | 8 +++---
> drivers/ata/sata_svw.c | 9 ++++---
> drivers/ata/sata_sx4.c | 17 ++++++++++---
> drivers/ata/sata_via.c | 31 ++++++++++++++---------
> drivers/ata/sata_vsc.c | 7 +++---
> include/linux/libata.h | 7 +++++-
> 21 files changed, 163 insertions(+), 102 deletions(-)
I did review all the changes, not just PATA drivers.
[...]
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 250f7dae05fd..d58db8226436 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
[...]
> @@ -2172,8 +2173,41 @@ int ata_pci_sff_init_host(struct ata_host *host)
> continue;
> }
>
> - rc = pcim_iomap_regions(pdev, 0x3 << base,
> - dev_driver_string(gdev));
> + /*
> + * In a first loop run, we want to get BARs 0 and 1.
> + * In a second run, we want BARs 2 and 3.
> + */
> + if (i == 0) {
> + io_tmp = pcim_iomap_region(pdev, 0, drv_name);
> + if (IS_ERR(io_tmp)) {
> + rc = PTR_ERR(io_tmp);
> + goto err;
> + }
> + host->iomap[0] = io_tmp;
> +
> + io_tmp = pcim_iomap_region(pdev, 1, drv_name);
> + if (IS_ERR(io_tmp)) {
> + rc = PTR_ERR(io_tmp);
> + goto err;
> + }
> + host->iomap[1] = io_tmp;
> + } else {
> + io_tmp = pcim_iomap_region(pdev, 2, drv_name);
> + if (IS_ERR(io_tmp)) {
> + rc = PTR_ERR(io_tmp);
> + goto err;
> + }
> + host->iomap[2] = io_tmp;
> +
> + io_tmp = pcim_iomap_region(pdev, 3, drv_name);
> + if (IS_ERR(io_tmp)) {
> + rc = PTR_ERR(io_tmp);
> + goto err;
> + }
> + host->iomap[3] = io_tmp;
> + }
> +
Ugh... Why you couldn't keep using base (or just i * 2) and avoid
such code duplication?
[...]
> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
> index abe64b5f83cf..8a17df73412e 100644
> --- a/drivers/ata/pata_sil680.c
> +++ b/drivers/ata/pata_sil680.c
> @@ -360,15 +360,16 @@ 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)
> + mmio_base = pcim_iomap_region(pdev, SIL680_MMIO_BAR, DRV_NAME);
> + if (IS_ERR(mmio_base)) {
> + rc = PTR_ERR(mmio_base);
goto use_ioports;
The code under that label ignores rc, no?
[...]
> diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
> index a482741eb181..d115f6f66974 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 to call it base or s/th...
[...]
> 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
> @@ -457,6 +457,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
> {
> const struct ata_port_info *ppi[] = { &vt6420_port_info, NULL };
> struct ata_host *host;
> + void __iomem *iomem;
Call it base, maybe?
[...]
> @@ -486,6 +488,7 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
> const struct ata_port_info *ppi[] =
> { &vt6421_sport_info, &vt6421_sport_info, &vt6421_pport_info };
> struct ata_host *host;
> + void __iomem *iomem;
Here as well...
[...]
MBR, Sergey
next prev parent reply other threads:[~2024-08-14 17:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 8:48 Philipp Stanner
2024-08-14 17:32 ` Sergey Shtylyov [this message]
2024-08-16 7:47 ` Philipp Stanner
2024-08-21 20:49 ` Sergey Shtylyov
2024-08-16 8:37 ` Philipp Stanner
2024-08-20 21:33 ` Sergey Shtylyov
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=c2d21da0-7fe1-f995-5562-7ff04e9f1b8b@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
all inboxes | Powered by JetHome®