Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH v2] ata: pata_macio: Fix PCI region leak
@ 2025-06-10 13:54 Philipp Stanner
  2025-06-10 14:01 ` Philipp Stanner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philipp Stanner @ 2025-06-10 13:54 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Krzysztof Wilczyński,
	Philipp Stanner, Andy Shevchenko, Kuppuswamy Sathyanarayanan
  Cc: linux-ide, linux-kernel

pci_request_regions() became a managed devres functions if the PCI
device was enabled with pcim_enable_device(), which is the case for
pata_macio.

The PCI subsystem recently removed this hybrid feature from
pci_request_region(). When doing so, pata_macio was forgotten to be
ported to use pcim_request_all_regions(). If that function is not used,
pata_macio will fail on driver-reload because the PCI regions will
remain blocked.

Fix the region leak by replacing pci_request_regions() with its managed
counterpart, pcim_request_all_regions().

Fixes: 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request functions")
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
Changes in v2:
  - Add Fixes: tag and rephrase commit message, since the merge window
    closed already. (Niklas)
---
 drivers/ata/pata_macio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index fbf5f07ea357..f7a933eefe05 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
 	priv->dev = &pdev->dev;
 
 	/* Get MMIO regions */
-	if (pci_request_regions(pdev, "pata-macio")) {
+	if (pcim_request_all_regions(pdev, "pata-macio")) {
 		dev_err(&pdev->dev,
 			"Cannot obtain PCI resources\n");
 		return -EBUSY;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ata: pata_macio: Fix PCI region leak
  2025-06-10 13:54 [PATCH v2] ata: pata_macio: Fix PCI region leak Philipp Stanner
@ 2025-06-10 14:01 ` Philipp Stanner
  2025-06-10 20:15   ` Andy Shevchenko
  2025-06-10 14:18 ` Sathyanarayanan Kuppuswamy
  2025-06-11 10:31 ` Niklas Cassel
  2 siblings, 1 reply; 5+ messages in thread
From: Philipp Stanner @ 2025-06-10 14:01 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel,
	Krzysztof Wilczyński, Andy Shevchenko,
	Kuppuswamy Sathyanarayanan
  Cc: linux-ide, linux-kernel

On Tue, 2025-06-10 at 15:54 +0200, Philipp Stanner wrote:
> pci_request_regions() became a managed devres functions if the PCI
> device was enabled with pcim_enable_device(), which is the case for
> pata_macio.
> 
> The PCI subsystem recently removed this hybrid feature from
> pci_request_region(). When doing so, pata_macio was forgotten to be
> ported to use pcim_request_all_regions(). If that function is not
> used,
> pata_macio will fail on driver-reload because the PCI regions will
> remain blocked.
> 
> Fix the region leak by replacing pci_request_regions() with its
> managed
> counterpart, pcim_request_all_regions().
> 
> Fixes: 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request
> functions")
> Signed-off-by: Philipp Stanner <phasta@kernel.org>

Forgot Damien's Reviewed-by.

P.

> ---
> Changes in v2:
>   - Add Fixes: tag and rephrase commit message, since the merge
> window
>     closed already. (Niklas)
> ---
>  drivers/ata/pata_macio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
> index fbf5f07ea357..f7a933eefe05 100644
> --- a/drivers/ata/pata_macio.c
> +++ b/drivers/ata/pata_macio.c
> @@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev
> *pdev,
>  	priv->dev = &pdev->dev;
>  
>  	/* Get MMIO regions */
> -	if (pci_request_regions(pdev, "pata-macio")) {
> +	if (pcim_request_all_regions(pdev, "pata-macio")) {
>  		dev_err(&pdev->dev,
>  			"Cannot obtain PCI resources\n");
>  		return -EBUSY;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ata: pata_macio: Fix PCI region leak
  2025-06-10 13:54 [PATCH v2] ata: pata_macio: Fix PCI region leak Philipp Stanner
  2025-06-10 14:01 ` Philipp Stanner
@ 2025-06-10 14:18 ` Sathyanarayanan Kuppuswamy
  2025-06-11 10:31 ` Niklas Cassel
  2 siblings, 0 replies; 5+ messages in thread
From: Sathyanarayanan Kuppuswamy @ 2025-06-10 14:18 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel,
	Krzysztof Wilczyński, Andy Shevchenko
  Cc: linux-ide, linux-kernel


On 6/10/25 6:54 AM, Philipp Stanner wrote:
> pci_request_regions() became a managed devres functions if the PCI
> device was enabled with pcim_enable_device(), which is the case for
> pata_macio.
>
> The PCI subsystem recently removed this hybrid feature from
> pci_request_region(). When doing so, pata_macio was forgotten to be
> ported to use pcim_request_all_regions(). If that function is not used,
> pata_macio will fail on driver-reload because the PCI regions will
> remain blocked.
>
> Fix the region leak by replacing pci_request_regions() with its managed
> counterpart, pcim_request_all_regions().
>
> Fixes: 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request functions")
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

> Changes in v2:
>    - Add Fixes: tag and rephrase commit message, since the merge window
>      closed already. (Niklas)
> ---
>   drivers/ata/pata_macio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
> index fbf5f07ea357..f7a933eefe05 100644
> --- a/drivers/ata/pata_macio.c
> +++ b/drivers/ata/pata_macio.c
> @@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
>   	priv->dev = &pdev->dev;
>   
>   	/* Get MMIO regions */
> -	if (pci_request_regions(pdev, "pata-macio")) {
> +	if (pcim_request_all_regions(pdev, "pata-macio")) {
>   		dev_err(&pdev->dev,
>   			"Cannot obtain PCI resources\n");
>   		return -EBUSY;

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ata: pata_macio: Fix PCI region leak
  2025-06-10 14:01 ` Philipp Stanner
@ 2025-06-10 20:15   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-06-10 20:15 UTC (permalink / raw)
  To: phasta
  Cc: Damien Le Moal, Niklas Cassel, Krzysztof Wilczyński,
	Kuppuswamy Sathyanarayanan, linux-ide, linux-kernel

On Tue, Jun 10, 2025 at 04:01:43PM +0200, Philipp Stanner wrote:
> On Tue, 2025-06-10 at 15:54 +0200, Philipp Stanner wrote:
> > pci_request_regions() became a managed devres functions if the PCI
> > device was enabled with pcim_enable_device(), which is the case for
> > pata_macio.
> > 
> > The PCI subsystem recently removed this hybrid feature from
> > pci_request_region(). When doing so, pata_macio was forgotten to be
> > ported to use pcim_request_all_regions(). If that function is not
> > used,
> > pata_macio will fail on driver-reload because the PCI regions will
> > remain blocked.
> > 
> > Fix the region leak by replacing pci_request_regions() with its
> > managed
> > counterpart, pcim_request_all_regions().
> > 
> > Fixes: 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request
> > functions")
> > Signed-off-by: Philipp Stanner <phasta@kernel.org>
> 
> Forgot Damien's Reviewed-by.

Then put it here, if maintainers use `b4`, it will automatically harvest them.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ata: pata_macio: Fix PCI region leak
  2025-06-10 13:54 [PATCH v2] ata: pata_macio: Fix PCI region leak Philipp Stanner
  2025-06-10 14:01 ` Philipp Stanner
  2025-06-10 14:18 ` Sathyanarayanan Kuppuswamy
@ 2025-06-11 10:31 ` Niklas Cassel
  2 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2025-06-11 10:31 UTC (permalink / raw)
  To: Damien Le Moal, Krzysztof Wilczyński, Andy Shevchenko,
	Kuppuswamy Sathyanarayanan, Philipp Stanner
  Cc: linux-ide, linux-kernel

On Tue, 10 Jun 2025 15:54:14 +0200, Philipp Stanner wrote:
> pci_request_regions() became a managed devres functions if the PCI
> device was enabled with pcim_enable_device(), which is the case for
> pata_macio.
> 
> The PCI subsystem recently removed this hybrid feature from
> pci_request_region(). When doing so, pata_macio was forgotten to be
> ported to use pcim_request_all_regions(). If that function is not used,
> pata_macio will fail on driver-reload because the PCI regions will
> remain blocked.
> 
> [...]

Applied to libata/linux.git (for-6.16-fixes), thanks!

[1/1] ata: pata_macio: Fix PCI region leak
      https://git.kernel.org/libata/linux/c/3e537877

Kind regards,
Niklas


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-11 10:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 13:54 [PATCH v2] ata: pata_macio: Fix PCI region leak Philipp Stanner
2025-06-10 14:01 ` Philipp Stanner
2025-06-10 20:15   ` Andy Shevchenko
2025-06-10 14:18 ` Sathyanarayanan Kuppuswamy
2025-06-11 10:31 ` Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox