public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Adam Ford <aford173@gmail.com>
Cc: Dafna Hirschfeld <dafna@fastmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Alexander Stein <alexander.stein@ew.tq-group.com>,
	kieran.bingham@ideasonboard.com, umang.jain@ideasonboard.com,
	linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] media: rkisp1: Fix IRQ handler return values
Date: Tue, 5 Dec 2023 14:02:44 +0200	[thread overview]
Message-ID: <b61d7adb-5b45-4366-a98c-d0de91d409c8@ideasonboard.com> (raw)
In-Reply-To: <CAHCN7xJqw-hSD7rWfxFq5NWnF+=RrpCWR+js9358jAL0_WzVFw@mail.gmail.com>

On 05/12/2023 13:57, Adam Ford wrote:
> On Tue, Dec 5, 2023 at 2:10 AM Tomi Valkeinen
> <tomi.valkeinen@ideasonboard.com> wrote:
>>
>> The IRQ handler rkisp1_isr() calls sub-handlers, all of which returns an
>> irqreturn_t value, but rkisp1_isr() ignores those values and always
>> returns IRQ_HANDLED.
>>
>> Fix this by collecting the return values, and returning IRQ_HANDLED or
>> IRQ_NONE as appropriate.
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
>> ---
>>   drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 18 ++++++++++++++----
>>   1 file changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
>> index 76f93614b4cf..1d60f4b8bd09 100644
>> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
>> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
>> @@ -445,17 +445,27 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
>>
>>   static irqreturn_t rkisp1_isr(int irq, void *ctx)
>>   {
>> +       irqreturn_t ret;
>> +
>>          /*
>>           * Call rkisp1_capture_isr() first to handle the frame that
>>           * potentially completed using the current frame_sequence number before
>>           * it is potentially incremented by rkisp1_isp_isr() in the vertical
>>           * sync.
>>           */
>> -       rkisp1_capture_isr(irq, ctx);
>> -       rkisp1_isp_isr(irq, ctx);
>> -       rkisp1_csi_isr(irq, ctx);
>>
>> -       return IRQ_HANDLED;
>> +       ret = IRQ_NONE;
>> +
>> +       if (rkisp1_capture_isr(irq, ctx) == IRQ_HANDLED)
>> +               ret = IRQ_HANDLED;
>> +
>> +       if (rkisp1_isp_isr(irq, ctx) == IRQ_HANDLED)
>> +               ret = IRQ_HANDLED;
>> +
>> +       if (rkisp1_csi_isr(irq, ctx) == IRQ_HANDLED)
>> +               ret = IRQ_HANDLED;
>> +
> 
> It seems like we're throwing away the value of ret each time the
> subsequent if statement is evaluated.  Whether or not they return
> didn't matter before, and the only one that seems using the return
> code is the last one.
> 
> Wouldn't it be simpler to use ret = rkisp1_capture_isr(irq, ctx), ret
> = rkisp1_isp_isr(irq, ctx) and ret = rkisp1_csi_isr(irq, ctx) if we
> care about the return code?
> 
> How do you expect this to return if one of the first two don't return
> IRQ_HANDLED?

I'm sorry, I don't quite follow what you mean. Can you elaborate a bit?

We want the rkisp1_isr() to return IRQ_NONE if none of the sub-handlers 
handled the interrupt. Otherwise, if any of the sub-handlers return 
IRQ_HANDLED, rkisp1_isr() returns IRQ_HANDLED.

  Tomi


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2023-12-05 12:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05  8:09 [PATCH 0/4] media: rkisp1: Fix IRQ related issues Tomi Valkeinen
2023-12-05  8:09 ` [PATCH 1/4] media: rkisp1: Store IRQ lines Tomi Valkeinen
2023-12-05  8:09 ` [PATCH 2/4] media: rkisp1: Fix IRQ handler return values Tomi Valkeinen
2023-12-05 11:57   ` Adam Ford
2023-12-05 12:02     ` Tomi Valkeinen [this message]
2023-12-05 12:35       ` Adam Ford
2023-12-05 12:04   ` Laurent Pinchart
2023-12-05  8:09 ` [PATCH 3/4] media: rkisp1: Fix IRQ handling due to shared interrupts Tomi Valkeinen
2023-12-05  8:20   ` Laurent Pinchart
2023-12-05  8:27     ` Tomi Valkeinen
2023-12-05 11:49       ` Adam Ford
2023-12-05 12:02         ` Laurent Pinchart
2023-12-05  8:09 ` [PATCH 4/4] media: rkisp1: Fix IRQ disable race issue Tomi Valkeinen
2023-12-05 12:13   ` Laurent Pinchart
2023-12-06 10:08     ` Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b61d7adb-5b45-4366-a98c-d0de91d409c8@ideasonboard.com \
    --to=tomi.valkeinen@ideasonboard.com \
    --cc=aford173@gmail.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=dafna@fastmail.com \
    --cc=heiko@sntech.de \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox