Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp248839rdb; Tue, 5 Dec 2023 04:36:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe8Lzf2XNcLS9SkS0i0qKd/3MVdqjTez1SsZ57fPvSrDF2WtlZ2AwiGvCB3/Us2x8ZuFQs X-Received: by 2002:a17:902:c1cc:b0:1d0:b503:1ea5 with SMTP id c12-20020a170902c1cc00b001d0b5031ea5mr2438886plc.20.1701779768169; Tue, 05 Dec 2023 04:36:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701779768; cv=none; d=google.com; s=arc-20160816; b=UqRoy47n73jgk5mSxSqf18U5QX3/BIOQ85qCTyEqgeO+TNye7maGxHxrs586ecLVKR 2bmrltpMbviD7MpNI7MtvLCA1ZeVq4lmqaK89gr6qnVCCyeK1wXsbE0bCC9EVszW4iZm 6s3LOIfmj8HG14xih/1FRurnvwd2vgsY4g59vXLOiy+xNWdrhm/6ssJY1dHe1jI9MdM7 YH02NY6QmIR5aubtus+7FSlLV1Q8fVM+aa6AMtjhUhWfOwY4t/8u9uZi+QhMeyu+0yMf K3B0D5WvHQ0D8/7/HgZ2fDzQwhBGnXm9/A5HDIzHLAbHS6jOfqWHR4JPWJo6fRdkqxQi CvhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FCPNXIipBFO4e3fU1ItwsDrZJmF1i1S9KCyToMsJuPI=; fh=JgAlsAqiOrWHGJqQRxxZNoq5f6m/xZrHuhGrDUBUzO0=; b=MKocHD1swAv9a9CY0RhWuqwxdTco/FstyMpwg0byp4Z/5Ba5JYFtKFOifE10PE+drC 5z3d2H6nEiXZQUZv+OB4NM2auullqhcLX0MNDenH9xbEbA8yLQihKKLMLUYwFObuOP7P oN+v4xUWMMI7FlXJyH0r18cdn4LivKEukt1BrcWBovxWKgWZBN59iCVd+wWe/MTquFjT rqMSW7kkYpVp31dgRVDjA+3dJ+14BnsEqHqg0paP3w0k0Zoo6Gib4+18f0NfFKcR6Jyo i1XI5mojj3MPZoLVBgkrDpm5gTby4FVeaXKKkUGL+FxkC5reLpRz2y5u4mJaKG82a9Io VhmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gNXhMFIL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id p11-20020a1709028a8b00b001d0bc650573si1895189plo.225.2023.12.05.04.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 04:36:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gNXhMFIL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1FD0380A4AED; Tue, 5 Dec 2023 04:35:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345256AbjLEMfT (ORCPT + 99 others); Tue, 5 Dec 2023 07:35:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345261AbjLEMfO (ORCPT ); Tue, 5 Dec 2023 07:35:14 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D315C124; Tue, 5 Dec 2023 04:35:20 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-286dc26147dso697094a91.3; Tue, 05 Dec 2023 04:35:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701779720; x=1702384520; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FCPNXIipBFO4e3fU1ItwsDrZJmF1i1S9KCyToMsJuPI=; b=gNXhMFIL4xVxrxL+O4OtJKI6ZoLEWRBOtWBU73qtNO9SUvqN+yS964YA0MmZhb9/9U mepodb3jEKUmEMpmiYIOuf4oulhQaz7tqxRlnD+YsVvESxUmVEJR/hwOTuIjCebzMd1F 9UX+nml8X7BQw5e9ComR8MiMxWlaKvUK+crIvwPIC7YKPUgtkxPDyztmyVLM4EAsNMCE e152XwGTcHxzyz11haO8DUgSPrvhf58r8nR+rG4JGA6uoLWdxD53lSjt3FqgfBvrwJbG 2pMvesFSUkhwUhOxkdIF9qWkWOYrZTEg7vkuf2WYoJ+tQMQ7Ypj6f+TYC3RArE+KVpPT zzfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701779720; x=1702384520; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FCPNXIipBFO4e3fU1ItwsDrZJmF1i1S9KCyToMsJuPI=; b=c8Tf0kqOVKB6QMWtEqx+HD1BOHCkuw9ZGVnPeFoNu9D9b4RbwQ5bK2fZq+25erPF69 ewPawbEwhdtFxUi0PXX9JhfRxAQ4aQDHHrIB/hIf6VE16ZYrC0F7nQ23EpUsQDU7w7u/ jhuwArzMtpSJRPvemehvIfq5r8dfN8imHMxy9m9N9VW6hJQv2wGBU29q9TGwAcB29+TI 9HqZIIY/3AygkrFfxU5Rriygt76L0OPwpsqdyxNSldmvByVsjd+i6T10Vrx90+SvrNWc dVA0dreA3TfBpZj+rr70AhfiWKFjWNDWyQXXzH+hAwfD0E5kmhcRVoyi1af20+Y9BcPA p8Iw== X-Gm-Message-State: AOJu0YwC9gHoEwWGkSmcnRk/rCtY0itJWc4otGBl36DCYaC75GaUI4Pu BThRUXvyrtUKmg8S9YM25N5ByfX6vfGNuDgtBao= X-Received: by 2002:a17:90b:3b8b:b0:286:d464:686e with SMTP id pc11-20020a17090b3b8b00b00286d464686emr1048259pjb.20.1701779720100; Tue, 05 Dec 2023 04:35:20 -0800 (PST) MIME-Version: 1.0 References: <20231205-rkisp-irq-fix-v1-0-f4045c74ba45@ideasonboard.com> <20231205-rkisp-irq-fix-v1-2-f4045c74ba45@ideasonboard.com> In-Reply-To: From: Adam Ford Date: Tue, 5 Dec 2023 06:35:08 -0600 Message-ID: Subject: Re: [PATCH 2/4] media: rkisp1: Fix IRQ handler return values To: Tomi Valkeinen 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 05 Dec 2023 04:35:59 -0800 (PST) On Tue, Dec 5, 2023 at 6:02=E2=80=AFAM Tomi Valkeinen wrote: > > On 05/12/2023 13:57, Adam Ford wrote: > > On Tue, Dec 5, 2023 at 2:10=E2=80=AFAM 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/dri= vers/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 rkisp= 1_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 num= ber before > >> * it is potentially incremented by rkisp1_isp_isr() in the v= ertical > >> * sync. > >> */ > >> - rkisp1_capture_isr(irq, ctx); > >> - rkisp1_isp_isr(irq, ctx); > >> - rkisp1_csi_isr(irq, ctx); > >> > >> - return IRQ_HANDLED; > >> + ret =3D IRQ_NONE; > >> + > >> + if (rkisp1_capture_isr(irq, ctx) =3D=3D IRQ_HANDLED) > >> + ret =3D IRQ_HANDLED; > >> + > >> + if (rkisp1_isp_isr(irq, ctx) =3D=3D IRQ_HANDLED) > >> + ret =3D IRQ_HANDLED; > >> + > >> + if (rkisp1_csi_isr(irq, ctx) =3D=3D IRQ_HANDLED) > >> + ret =3D 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 =3D rkisp1_capture_isr(irq, ctx), ret > > =3D rkisp1_isp_isr(irq, ctx) and ret =3D 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. OK. I understand your explanation. I retract my comment. I'll try to test this series tonight on my imx8mp adam > > Tomi >