2021-02-15 18:19:26

by Dejin Zheng

[permalink] [raw]
Subject: [PATCH v1 0/4] Introduce pcim_alloc_irq_vectors()

Introduce pcim_alloc_irq_vectors(), a explicit device-managed version of
pci_alloc_irq_vectors(). and use the correct name of device-managed
function to alloc irq vectors in i2c drivers.

Dejin Zheng (4):
PCI: Introduce pcim_alloc_irq_vectors()
Documentation: devres: add pcim_alloc_irq_vectors()
i2c: designware: Use the correct name of device-managed function
i2c: thunderx: Use the correct name of device-managed function

.../driver-api/driver-model/devres.rst | 1 +
drivers/i2c/busses/i2c-designware-pcidrv.c | 2 +-
drivers/i2c/busses/i2c-thunderx-pcidrv.c | 2 +-
drivers/pci/pci.c | 19 +++++++++++++++++++
include/linux/pci.h | 3 +++
5 files changed, 25 insertions(+), 2 deletions(-)

--
2.25.0


2021-02-15 18:20:14

by Dejin Zheng

[permalink] [raw]
Subject: [PATCH v1 3/4] i2c: designware: Use the correct name of device-managed function

Use the correct name of device-managed function to alloc irq vectors,
the pcim_alloc_irq_vectors() function, a explicit device-managed version
of pci_alloc_irq_vectors().

Signed-off-by: Dejin Zheng <[email protected]>
---
drivers/i2c/busses/i2c-designware-pcidrv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 55c83a7a24f3..444533be49ee 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -219,7 +219,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
if (!dev)
return -ENOMEM;

- r = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
+ r = pcim_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
if (r < 0)
return r;

--
2.25.0

2021-02-15 18:20:24

by Dejin Zheng

[permalink] [raw]
Subject: [PATCH v1 4/4] i2c: thunderx: Use the correct name of device-managed function

Use the correct name of device-managed function to alloc irq vectors,
the pcim_alloc_irq_vectors() function, a explicit device-managed version
of pci_alloc_irq_vectors().

Signed-off-by: Dejin Zheng <[email protected]>
---
drivers/i2c/busses/i2c-thunderx-pcidrv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index 12c90aa0900e..63354e9fb726 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -192,7 +192,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
i2c->hlc_int_enable = thunder_i2c_hlc_int_enable;
i2c->hlc_int_disable = thunder_i2c_hlc_int_disable;

- ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
+ ret = pcim_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
if (ret < 0)
goto error;

--
2.25.0

2021-02-15 18:20:51

by Dejin Zheng

[permalink] [raw]
Subject: [PATCH v1 2/4] Documentation: devres: add pcim_alloc_irq_vectors()

add pcim_alloc_irq_vectors(), a explicit device-managed version of
pci_alloc_irq_vectors().

Signed-off-by: Dejin Zheng <[email protected]>
---
Documentation/driver-api/driver-model/devres.rst | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index cd8b6e657b94..cd53106fbf5e 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -380,6 +380,7 @@ PCI
devm_pci_alloc_host_bridge() : managed PCI host bridge allocation
devm_pci_remap_cfgspace() : ioremap PCI configuration space
devm_pci_remap_cfg_resource() : ioremap PCI configuration space resource
+ pcim_alloc_irq_vectors() : managed irq vectors allocation
pcim_enable_device() : after success, all PCI ops become managed
pcim_pin_device() : keep PCI device enabled after release

--
2.25.0

2021-02-15 21:20:47

by Krzysztof Wilczyński

[permalink] [raw]
Subject: Re: [PATCH v1 0/4] Introduce pcim_alloc_irq_vectors()

Hi Dejin,

Thank you for working on this series!

Do you have a link to the conversation that prompted addition of this
new function? If so, then it would be nice to include a reference to it
here (as a link to http://lore.kernel.org/) in the cover letter for
reference, if possible, of course.

Generally, it would also be nice to expand on things a little bit and
explain why do you want to add this new function, and what problems does
it solve.

[...]
> Introduce pcim_alloc_irq_vectors(), a explicit device-managed version of
> pci_alloc_irq_vectors(). and use the correct name of device-managed
> function to alloc irq vectors in i2c drivers.

Did you want to use a comma, instead of a period, in the sentence
above? You could also probably drop the word "explicit".

Krzysztof

2021-02-15 21:32:03

by Krzysztof Wilczyński

[permalink] [raw]
Subject: Re: [PATCH v1 4/4] i2c: thunderx: Use the correct name of device-managed function

Hi Dejin,

> Use the correct name of device-managed function to alloc irq vectors,
> the pcim_alloc_irq_vectors() function, a explicit device-managed version
> of pci_alloc_irq_vectors().
[...]

It would be "IRQ" in the sentence above.

Perhaps the "Use the new function pcim_alloc_irq_vectors() to allocate
IRQ vectors ..." would read a little better - generally, the above
sentence could be improved. You might also want to add a more details
about why to use this new function instead of the previous one, etc.

Krzysztof

2021-02-15 21:45:38

by Krzysztof Wilczyński

[permalink] [raw]
Subject: Re: [PATCH v1 2/4] Documentation: devres: add pcim_alloc_irq_vectors()

Hello Dejin,

[...]
> add pcim_alloc_irq_vectors(), a explicit device-managed version of
> pci_alloc_irq_vectors().

It would be "Add" at the start of the sentence. You could also drop
the "explicit" word or replace it with "an explicit", if you want to
keep it.

Generally, this commit message could be improved - you could explain
that you are updating the documentation to reflect the addition of this
new function called pcim_alloc_irq_vectors(), and also briefly explain
why it was added, etc.

[...]
> devm_pci_remap_cfg_resource() : ioremap PCI configuration space resource
> + pcim_alloc_irq_vectors() : managed irq vectors allocation
[...]

It would be "IRQ" here.

Krzysztof