linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: media: atomisp: Replace depracated MSI APIs
@ 2020-07-19 14:26 Suraj Upadhyay
  2020-07-20  8:34 ` Dan Carpenter
  2020-07-20  8:40 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Suraj Upadhyay @ 2020-07-19 14:26 UTC (permalink / raw)
  To: mchehab, sakari.ailus, gregkh; +Cc: linux-media, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

Replace depracated MSI IRQ enabler and disabler
with pci_alloc_irq_vectors and pci_free_irq_vectors respectively.
And as a result handle the returned error as appropriate.
Compile tested.

Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
---
Change:
	v2: Replace the MSI IRQ disabler too.
---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index d36809a0182c..a5dea5521b36 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1735,8 +1735,8 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	pci_set_master(dev);
 	pci_set_drvdata(dev, isp);
 
-	err = pci_enable_msi(dev);
-	if (err) {
+	err = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSI);
+	if (err < 0) {
 		dev_err(&dev->dev, "Failed to enable msi (%d)\n", err);
 		goto enable_msi_fail;
 	}
@@ -1857,7 +1857,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 initialize_modules_fail:
 	cpu_latency_qos_remove_request(&isp->pm_qos);
 	atomisp_msi_irq_uninit(isp, dev);
-	pci_disable_msi(dev);
+	pci_free_irq_vectors(dev);
 enable_msi_fail:
 fw_validation_fail:
 	release_firmware(isp->firmware);
-- 
2.17.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2] staging: media: atomisp: Replace depracated MSI APIs
  2020-07-19 14:26 [PATCH v2] staging: media: atomisp: Replace depracated MSI APIs Suraj Upadhyay
@ 2020-07-20  8:34 ` Dan Carpenter
  2020-07-20  8:40 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-07-20  8:34 UTC (permalink / raw)
  To: Suraj Upadhyay
  Cc: mchehab, sakari.ailus, gregkh, devel, linux-kernel, linux-media

Sorry, this is still not correct.  See comments on other thread.  There
are other msi related code which needs to be updated.

regards,
dan carpenter


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

* Re: [PATCH v2] staging: media: atomisp: Replace depracated MSI APIs
  2020-07-19 14:26 [PATCH v2] staging: media: atomisp: Replace depracated MSI APIs Suraj Upadhyay
  2020-07-20  8:34 ` Dan Carpenter
@ 2020-07-20  8:40 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-07-20  8:40 UTC (permalink / raw)
  To: Suraj Upadhyay
  Cc: mchehab, sakari.ailus, gregkh, devel, linux-kernel, linux-media

On Sun, Jul 19, 2020 at 07:56:23PM +0530, Suraj Upadhyay wrote:
> Replace depracated MSI IRQ enabler and disabler
> with pci_alloc_irq_vectors and pci_free_irq_vectors respectively.
> And as a result handle the returned error as appropriate.
> Compile tested.
> 
> Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
> ---
> Change:
> 	v2: Replace the MSI IRQ disabler too.
> ---
>  drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> index d36809a0182c..a5dea5521b36 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> @@ -1735,8 +1735,8 @@ static int atomisp_pci_probe(struct pci_dev *dev,
>  	pci_set_master(dev);
>  	pci_set_drvdata(dev, isp);
>  
> -	err = pci_enable_msi(dev);
> -	if (err) {
> +	err = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSI);
> +	if (err < 0) {
>  		dev_err(&dev->dev, "Failed to enable msi (%d)\n", err);
>  		goto enable_msi_fail;
>  	}
> @@ -1857,7 +1857,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
>  initialize_modules_fail:
>  	cpu_latency_qos_remove_request(&isp->pm_qos);
>  	atomisp_msi_irq_uninit(isp, dev);
> -	pci_disable_msi(dev);
> +	pci_free_irq_vectors(dev);

Actually, my initial complaint was that I was just looking for to see if
the remove function was updated...  It turns out the remove function
never freed the IRQs to begin with so it was buggy from square one.

Anyway, the remove function should call pci_free_irq_vectors().  We may
as well fix it now that we have seen the bug.

regards,
dan carpenter


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

end of thread, other threads:[~2020-07-20  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-19 14:26 [PATCH v2] staging: media: atomisp: Replace depracated MSI APIs Suraj Upadhyay
2020-07-20  8:34 ` Dan Carpenter
2020-07-20  8:40 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).