public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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, 21 Aug 2024 00:33:41 +0300	[thread overview]
Message-ID: <d7f0735e-9dd4-c1db-e057-bbdbafe3887f@omp.ru> (raw)
In-Reply-To: <9c2aeec1c3f97bcebb3596b5b7c87140bc29b72e.camel@redhat.com>

On 8/16/24 11:37 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>
[...]

>>> 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?
> 
> Oh, forgot to address this.
> 
> Yes, it does ignore it, but it behaves as the existing code does. The

   You mean, by setting rc?

> existing version jumps into ata_pci_bmdma_init_one() if it cannot
> request or ioremap the BAR.

   Yep, it cannot use MMIO in this case, so falls back to the good old
I/O ports, (confusingly?) named PIO in the comment above...

> 	/* 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)
> 		goto use_ioports;
> 
> 
> Is that a bug in the existing version, too?

   I'm not sure what you're considering a bug here...

> The comment hints to me that this is fine and intended.
> 
> Otherwise we want to remain consistent with the pre-existing behavior.

    I don't see a point here, rc is correctly ignored under that label,
and gcc drops this assignment anyway when generating the code...

[...]

MBR, Sergey

      reply	other threads:[~2024-08-20 21:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  8:48 [PATCH] ata: Replace deprecated PCI devres functions Philipp Stanner
2024-08-14 17:32 ` Sergey Shtylyov
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 [this message]

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=d7f0735e-9dd4-c1db-e057-bbdbafe3887f@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