Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp229252rdb; Tue, 5 Dec 2023 04:03:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IG17N9UH8BgwmmxsNX9XRs9CubgXUWUe1+phKUVMDLkp184ssVcnsxJtXipnuTy7SG2unpW X-Received: by 2002:a05:6a20:c888:b0:18f:97c:ba03 with SMTP id hb8-20020a056a20c88800b0018f097cba03mr3982045pzb.93.1701777780312; Tue, 05 Dec 2023 04:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701777780; cv=none; d=google.com; s=arc-20160816; b=pa/d/7K4ftHARkEyubc7EEU1GZx82CpWDtNtcCpYgXZUTCFMCRs4NsiDEnMNIfa2Kf atx/mV/62JtskMgWyJsuCwfpUph4Z6NZwp9QWlWhdiAS2581F3+8yj5U60oLEDV6DFeX nbYIl1XnbPjoOJBFPr3mv50usNQDpGcKlcmuQo4OZndtFjRFYQAx36dgdsDlaA/eBKpm U29Lqcqv8E3Crsn4qvKT4FI07Ykkbg+Z4nJVKK8qTHvl/ze1sYu7iTgc+HkU/BX5ir/3 LEZgQ8v6ulnpjufXK6ZljPWMxes0TYZi2nUQod2zvp28DIP0WyCxkSvSdQP061lyTLbh Hv5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=f2oNlLTf6fOM8jOaUgliIo146tWHZJ+E0cCjHSPJtcs=; fh=2NFV8ifPK/e8QaorNR44v1j4lCdMEQggBIPe/yhfPiU=; b=Bfg8faxWDaqWiOK8M4gzFBASuo9XkJaG81VIA9cCx/QiASJxV3HjnQZ3NjxW8lGpkQ 5w9dx9G08IQaYxJ2c2btIcZKm4sziS1De9in+1ZwHOrwKnPTR+yR/atR7HcW18k9wrhf 9tBNVyBgja9XY3XoNqu7jz/JkRYf/UExUdoTUeLDXwxY+uM5Gex97XyB9mZMxmUfvewn sv68CQe7Y1vuYNxS5jyD5/PGpmXXopgLg+8telFcJPETAer6TpRZSTxLU1DKLMejeKqm MQ01YQqoJtSxQVdGNBT3SXsal01D4w2PWTZftL8d4IUkF6ksjyrHpMrPhpPn9Odqc7ZL iVCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=lqFB+Rrg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id j38-20020a635526000000b005b99bfe3301si4813810pgb.462.2023.12.05.04.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 04:03:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=lqFB+Rrg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E43488051A2D; Tue, 5 Dec 2023 04:02:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347038AbjLEMCo (ORCPT + 99 others); Tue, 5 Dec 2023 07:02:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347078AbjLEMCn (ORCPT ); Tue, 5 Dec 2023 07:02:43 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40DCCA8; Tue, 5 Dec 2023 04:02:49 -0800 (PST) Received: from [192.168.88.20] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8FC78844; Tue, 5 Dec 2023 13:02:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701777728; bh=sx5oWuUdn3t3qiK6cX/NTcFnWy6w1SumUl2/Cl/RrrU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=lqFB+RrgM6kWti3VP4kbZcUumh1Nvyt0ZdDoUYVwEsYxlr61/GY/1pzkKxQ9v7ZE1 5Ek1+pmTQS9HwSV1NMcfuxBxUh7lCF4Or2BhlwKQ7aYlGCMOrRSnGNXp3n09wL1ey1 aw+ViRS/sKnpj6pthqStJtDrBaWsM8hCnrsdxTPY= Message-ID: Date: Tue, 5 Dec 2023 14:02:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4] media: rkisp1: Fix IRQ handler return values Content-Language: en-US To: Adam Ford Cc: Dafna Hirschfeld , Laurent Pinchart , Mauro Carvalho Chehab , Heiko Stuebner , Paul Elder , Alexander Stein , 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 References: <20231205-rkisp-irq-fix-v1-0-f4045c74ba45@ideasonboard.com> <20231205-rkisp-irq-fix-v1-2-f4045c74ba45@ideasonboard.com> From: Tomi Valkeinen Autocrypt: addr=tomi.valkeinen@ideasonboard.com; keydata= xsFNBE6ms0cBEACyizowecZqXfMZtnBniOieTuFdErHAUyxVgtmr0f5ZfIi9Z4l+uUN4Zdw2 wCEZjx3o0Z34diXBaMRJ3rAk9yB90UJAnLtb8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dcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe 9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S suYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq xKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII m9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU CH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B CFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof 92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a ueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F yjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw 3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 04:02:58 -0800 (PST) On 05/12/2023 13:57, Adam Ford wrote: > On Tue, Dec 5, 2023 at 2:10 AM Tomi Valkeinen > 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 >> --- >> 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