x86/platform/intel-mid: Replace deprecated PCI functions
Subsystems (2)
PATCH 1/1 x86/platform/intel-mid: Replace deprecated PCI functions
pcim_iomap_table() and pcim_request_regions() have been deprecated in commit e354bb84a4c1 ("PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all()") and commit d140f80f60358 ("PCI:
Deprecate pcim_iomap_regions() in favor of pcim_iomap_region()"), respectively.
Replace these functions with pcim_iomap_region().
Additionally, pass the actual driver name to pcim_iomap_region() instead of the previous pci_name(), since the 'name' parameter should always reflect which driver owns a region.
--- arch/x86/platform/intel-mid/pwr.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/x86/platform/intel-mid/pwr.c +4 -7
@@ -358,18 +358,15 @@ static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id)return ret; } - ret =pcim_iomap_regions (pdev,1 <<0 ,pci_name (pdev)); -if (ret) { -dev_err (&pdev->dev,"I/O memory remapping failed\n" ); -return ret; - } - pwr =devm_kzalloc (dev,sizeof (*pwr),GFP_KERNEL );if (!pwr)return -ENOMEM ; + pwr->regs =pcim_iomap_region (pdev,0 ,"intel_mid_pwr" ); +if (IS_ERR (pwr->regs)) +return PTR_ERR (pwr->regs); + pwr->dev = dev; - pwr->regs =pcim_iomap_table (pdev)[0 ]; pwr->irq = pdev->irq;mutex_init (&pwr->lock);
Signature · 1 line
2.47.0
Quoted 11 lines · Philipp Stanner
pcim_iomap_table()andpcim_request_regions()have been deprecated in commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()") and commitd140f80f60358("PCI:
Deprecatepcim_iomap_regions()in favor ofpcim_iomap_region()"), respectively.Replace these functions with
pcim_iomap_region().Additionally, pass the actual driver name to
pcim_iomap_region()instead of the previouspci_name(), since the 'name' parameter should always reflect which driver owns a region.
...
arch/x86/platform/intel-mid/pwr.c static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 363
Quoted 3 lines
arch/x86/platform/intel-mid/pwr.c +0
-3- ret =pcim_iomap_regions (pdev,1 <<0 ,pci_name (pdev)); -if (ret) { -dev_err (&pdev->dev,"I/O memory remapping failed\n" );
Btw, do we have a similar message to be printed inside the new call?
Quoted 2 lines
arch/x86/platform/intel-mid/pwr.c +0
-2-return ret; - }
...
Quoted 3 lines
arch/x86/platform/intel-mid/pwr.c +3
-0+ pwr->regs =pcim_iomap_region (pdev,0 ,"intel_mid_pwr" ); +if (IS_ERR (pwr->regs)) +return PTR_ERR (pwr->regs);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 17 lines · Andy Shevchenko
Quoted 7 lines · Philipp Stanner
pcim_iomap_table()andpcim_request_regions()have been deprecated in
commite354bb84a4c1("PCI: Deprecatepcim_iomap_table(),pcim_iomap_regions_request_all()") and commitd140f80f60358("PCI:
Deprecatepcim_iomap_regions()in favor ofpcim_iomap_region()"), respectively.Quoted 6 lines
Replace these functions with
pcim_iomap_region().Additionally, pass the actual driver name to
pcim_iomap_region()instead of the previouspci_name(), since the 'name' parameter should
always reflect which driver owns a region.Reviewed-by Andy Shevchenko <[email protected]>
Quoted 8 lines
...
Quoted 4 lines
arch/x86/platform/intel-mid/pwr.c +0
-3- ret =pcim_iomap_regions (pdev,1 <<0 ,pci_name (pdev)); -if (ret) { - dev_err(&pdev->dev, "I/O memory remappingfailed\n");
Btw, do we have a similar message to be printed inside the new call?
Hm, no, it seems I forgot. Normally I keep those messages.
In this particular case we probably want to say "I/O memory request / remapping failed\n", though.
And/or we give back the error code, which would reveal the exact issue through -ENOMEM / -EBUSY
P.
Quoted 10 lines
Quoted 3 lines
arch/x86/platform/intel-mid/pwr.c +0
-2-return ret; - }...
Quoted 3 lines
arch/x86/platform/intel-mid/pwr.c +3
-0+ pwr->regs =pcim_iomap_region (pdev,0 ,"intel_mid_pwr" ); +if (IS_ERR (pwr->regs)) +return PTR_ERR (pwr->regs);
Quoted 2 lines · Philipp Stanner
Quoted 1 line · Andy Shevchenko
On Tue, Nov 05, 2024 at 12:25:22PM +0100, Philipp Stanner wrote:
...
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
arch/x86/platform/intel-mid/pwr.c +0
-3- ret =pcim_iomap_regions (pdev,1 <<0 ,pci_name (pdev)); -if (ret) { - dev_err(&pdev->dev, "I/O memory remappingfailed\n");
Btw, do we have a similar message to be printed inside the new call?
Quoted 7 lines
Hm, no, it seems I forgot. Normally I keep those messages.
In this particular case we probably want to say "I/O memory request / remapping failed\n", though.
And/or we give back the error code, which would reveal the exact issue through
-ENOMEM/-EBUSY
I would expect this to behave in a similar way to devm_*ioremap*() which prints message(s) and returns different error codes depending on the failure.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/x86/platform/intel-mid/pwr.c +0
-2-return ret; - }
...
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
arch/x86/platform/intel-mid/pwr.c +3
-0+ pwr->regs =pcim_iomap_region (pdev,0 ,"intel_mid_pwr" ); +if (IS_ERR (pwr->regs)) +return PTR_ERR (pwr->regs);
Signature · 2 lines
With Best Regards, Andy Shevchenko