diff mbox series

[v2,21/29] media: ipu3-cio2: Request IRQ earlier

Message ID 20231220103713.113386-22-sakari.ailus@linux.intel.com (mailing list archive)
State New
Headers show
Series Media device lifetime management | expand

Commit Message

Sakari Ailus Dec. 20, 2023, 10:37 a.m. UTC
Call devm_request_irq() before registering the async notifier, as otherwise
it would be possible to use the device before the interrupts could be
deliveted to the driver.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Hans Verkuil Feb. 5, 2024, 2:58 p.m. UTC | #1
On 20/12/2023 11:37, Sakari Ailus wrote:
> Call devm_request_irq() before registering the async notifier, as otherwise
> it would be possible to use the device before the interrupts could be
> deliveted to the driver.

deliveted -> delivered

Isn't this a regular fix? Ditto for the previous patch (20/29).

I'd just queue this up in the next PR.

Regards,

	Hans

> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index da82d09b46ab..3222ec5b8345 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -1789,11 +1789,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
>  
>  	v4l2_async_nf_init(&cio2->notifier, &cio2->v4l2_dev);
>  
> -	/* Register notifier for subdevices we care */
> -	r = cio2_parse_firmware(cio2);
> -	if (r)
> -		goto fail_clean_notifier;
> -
>  	r = devm_request_irq(dev, pci_dev->irq, cio2_irq, IRQF_SHARED,
>  			     CIO2_NAME, cio2);
>  	if (r) {
> @@ -1801,6 +1796,11 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
>  		goto fail_clean_notifier;
>  	}
>  
> +	/* Register notifier for subdevices we care */
> +	r = cio2_parse_firmware(cio2);
> +	if (r)
> +		goto fail_clean_notifier;
> +
>  	pm_runtime_put_noidle(dev);
>  	pm_runtime_allow(dev);
>
Laurent Pinchart Feb. 7, 2024, 2:34 p.m. UTC | #2
On Mon, Feb 05, 2024 at 03:58:45PM +0100, Hans Verkuil wrote:
> On 20/12/2023 11:37, Sakari Ailus wrote:
> > Call devm_request_irq() before registering the async notifier, as otherwise
> > it would be possible to use the device before the interrupts could be
> > deliveted to the driver.
> 
> deliveted -> delivered
> 
> Isn't this a regular fix? Ditto for the previous patch (20/29).
> 
> I'd just queue this up in the next PR.

Fixes: tags would then be nice.

> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > index da82d09b46ab..3222ec5b8345 100644
> > --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > @@ -1789,11 +1789,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
> >  
> >  	v4l2_async_nf_init(&cio2->notifier, &cio2->v4l2_dev);
> >  
> > -	/* Register notifier for subdevices we care */
> > -	r = cio2_parse_firmware(cio2);
> > -	if (r)
> > -		goto fail_clean_notifier;
> > -
> >  	r = devm_request_irq(dev, pci_dev->irq, cio2_irq, IRQF_SHARED,
> >  			     CIO2_NAME, cio2);
> >  	if (r) {
> > @@ -1801,6 +1796,11 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
> >  		goto fail_clean_notifier;
> >  	}
> >  
> > +	/* Register notifier for subdevices we care */
> > +	r = cio2_parse_firmware(cio2);
> > +	if (r)
> > +		goto fail_clean_notifier;
> > +
> >  	pm_runtime_put_noidle(dev);
> >  	pm_runtime_allow(dev);
> >
Sakari Ailus Feb. 21, 2024, 10:51 a.m. UTC | #3
Hi Laurent, Hans,

On Wed, Feb 07, 2024 at 04:34:18PM +0200, Laurent Pinchart wrote:
> On Mon, Feb 05, 2024 at 03:58:45PM +0100, Hans Verkuil wrote:
> > On 20/12/2023 11:37, Sakari Ailus wrote:
> > > Call devm_request_irq() before registering the async notifier, as otherwise
> > > it would be possible to use the device before the interrupts could be
> > > deliveted to the driver.
> > 
> > deliveted -> delivered
> > 
> > Isn't this a regular fix? Ditto for the previous patch (20/29).
> > 
> > I'd just queue this up in the next PR.

Yeah, I wrote it as part of the set but missed there are no further
dependencies. I'll post a new version of this separately.

> 
> Fixes: tags would then be nice.

It was in the patch adding the driver. I'll add Fixes: line.
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index da82d09b46ab..3222ec5b8345 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1789,11 +1789,6 @@  static int cio2_pci_probe(struct pci_dev *pci_dev,
 
 	v4l2_async_nf_init(&cio2->notifier, &cio2->v4l2_dev);
 
-	/* Register notifier for subdevices we care */
-	r = cio2_parse_firmware(cio2);
-	if (r)
-		goto fail_clean_notifier;
-
 	r = devm_request_irq(dev, pci_dev->irq, cio2_irq, IRQF_SHARED,
 			     CIO2_NAME, cio2);
 	if (r) {
@@ -1801,6 +1796,11 @@  static int cio2_pci_probe(struct pci_dev *pci_dev,
 		goto fail_clean_notifier;
 	}
 
+	/* Register notifier for subdevices we care */
+	r = cio2_parse_firmware(cio2);
+	if (r)
+		goto fail_clean_notifier;
+
 	pm_runtime_put_noidle(dev);
 	pm_runtime_allow(dev);