We have a few PCI APIs that may be used instead of direct dereferencibg,
Using them will also provide better error codes.
Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/mfd/intel-lpss-pci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index ae5759200622..cf56cd3a40ee 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -37,13 +37,17 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
if (ret)
return ret;
+ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY);
+ if (ret)
+ return ret;
+
info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
- info->mem = &pdev->resource[0];
- info->irq = pdev->irq;
+ info->mem = pci_resource_n(pdev, 0);
+ info->irq = pci_irq_vector(pdev, 0);
if (pci_match_id(ignore_resource_conflicts_ids, pdev))
info->ignore_resource_conflicts = true;
--
2.40.0.1.gaa8946217a0b
On Mon, 06 Nov 2023, Andy Shevchenko wrote:
> We have a few PCI APIs that may be used instead of direct dereferencibg,
> Using them will also provide better error codes.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
> drivers/mfd/intel-lpss-pci.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Please use spell-check on your commit messages.
Let's not get complacent.
> diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
> index ae5759200622..cf56cd3a40ee 100644
> --- a/drivers/mfd/intel-lpss-pci.c
> +++ b/drivers/mfd/intel-lpss-pci.c
> @@ -37,13 +37,17 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
> if (ret)
> return ret;
>
> + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY);
> + if (ret)
> + return ret;
> +
> info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info),
> GFP_KERNEL);
> if (!info)
> return -ENOMEM;
>
> - info->mem = &pdev->resource[0];
> - info->irq = pdev->irq;
> + info->mem = pci_resource_n(pdev, 0);
> + info->irq = pci_irq_vector(pdev, 0);
>
> if (pci_match_id(ignore_resource_conflicts_ids, pdev))
> info->ignore_resource_conflicts = true;
> --
> 2.40.0.1.gaa8946217a0b
>
--
Lee Jones [李琼斯]