Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp972969rbd; Fri, 23 Feb 2024 09:05:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUFqhe5PmWCAR70JYZW8TzyNDadlkVURF8mF0o5+ntoCebNlLP8exYdQYOJ80FbU908optXYZXoEuzG4Mq4NaNtVafadARv9FgzUlu1iQ== X-Google-Smtp-Source: AGHT+IHEz+T+wVUVbWZWeJaTtPhZPDaFHDnFAYhjJ4M08ejUgGXbR6E/Ct5Mc9+dhUz7BgzX7Vpi X-Received: by 2002:aa7:d7d4:0:b0:565:6f16:4dab with SMTP id e20-20020aa7d7d4000000b005656f164dabmr300851eds.16.1708707933209; Fri, 23 Feb 2024 09:05:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708707933; cv=pass; d=google.com; s=arc-20160816; b=xhbjBC8YwISoWAzj2eQ+dqV1hwMoUlpLNiCVyAKPWk9qR5Nltn2g1wLYuW/hgeoYam c4CZQDGQw06MJGyzi+EIEi56e0R5K+/7VC0PPGfnLOjO0EmuOwFK1AAeaKZcTVJDHVrj lFxexbX7pdaWiz629YILOBGhEpjq1sEgi+PmnhpWBexWIzQbNNtCItHeui0yVV/Wd1o7 FS2T+HNdFTbWrsoV+4ShuO9serISRpAB4JcL7lqDCKVFac/qQZ0P1NERrbJZf1p8xctD rRZ+j3Cno4HxeQBqspcUHW3QcxKbmHD30Qv9bcmlpGTxXfKAhYImIXeptKLI5ytgtwup T8hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:in-reply-to:date:subject:cc:to:from:user-agent :references:dkim-signature; bh=A3Impbxiv5EAmL/2ihqY+6YaD1b8yH8gygmWJaN5vZ4=; fh=gCSjHTfxG+FVovOcVE207xznG9NivPIJvaJwfrRUrIk=; b=u7xinSQP2GMiJokHbsFzeHk36w3ZV9d8R/p3h8NsdUMnaB0/rse8hQ8ljTl/tbwicg RZyqQKmqjrBjq9aEjuFfe3wXStQJIckn8ISmzsbEpQI6oDo/OTD3L+HCrtkU4Sq6jtGC U2UgxTq2aVx0NMvMLODT8TsRFQj4F78YoANEvocbuc+SCmyU50Bgr8/hhn1foOv6kp1d TaVmNviKCfruMOIOO+wJ//zmStDhwEEQ6tR6se4L74c0LadIk6r8R75fpk2nROccfaIl uQ0qom2d6qEiZtOKGM8mGHIDtVRPSWfUgua/rpCMlFvUiI6/kjs32M1ZW27RAtWh1b+r U+yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SP8EePZm; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-78786-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h3-20020a056402280300b00564b90ae27dsi3893006ede.538.2024.02.23.09.05.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:05:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78786-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SP8EePZm; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-78786-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78786-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F412C1F2609A for ; Fri, 23 Feb 2024 17:05:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0C5112D1E1; Fri, 23 Feb 2024 17:05:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SP8EePZm" Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 372FF1292DB; Fri, 23 Feb 2024 17:05:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708707917; cv=none; b=FLA05cQlobIZEmbzyJLqYiKGImIsuPEFJgvvBOSl0BcwGeZJK4yuNH0WGIFgNrYW8u6oVjKG9n0Xq9NWDMuRGKf6KW0Rr9Mnpv8KmlnnV57kQgz6FtYwkj2vEXoCjBH7CdA4d+Q/q4YrUZiAwLfSrdKlqcBF+VPQaJ31dbe6ZFI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708707917; c=relaxed/simple; bh=nTfCHSUZrHylYc95TlvswfvwIsbie0LjLmnPN9Nb4E8=; h=References:From:To:Cc:Subject:Date:In-reply-to:Message-ID: MIME-Version:Content-Type; b=HUh60EA0JFuXXL4n6+Kgcy9bO0uJkpDYPbv+VmVS/2Hg1NLie6U2bfd9Ls976SqkRvTS2CKkdb+zsa6f8Y7dtXm9ed/9eRKzG9AG5dTnr/Tx0kI769QlViPeoKS3UWdw70kTRMF7omU5iFqXfpNG14mtGckteh39oUY7dNEPcd4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SP8EePZm; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-512e01b3da3so1418119e87.3; Fri, 23 Feb 2024 09:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708707914; x=1709312714; darn=vger.kernel.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=A3Impbxiv5EAmL/2ihqY+6YaD1b8yH8gygmWJaN5vZ4=; b=SP8EePZmV8DLbOzmFuPuOLuQRfUzcsoRTI9QPluFNw4CMNlrwmQmyS+5cmw1m+5fTR qRXg/XeOP7KeU2iLy0jg3Y8H0CxCSKjZWRD37vD7iOZsjdz59peGLdQce7EntxHVWvmy Zyqj34N9rKo9Ly9tS85GVtX0tXVYDYsZN22arHuj0x64Rbwv153klsskoLbzFNdoH0vv uamVIBcSjO7ehILGGcqTG4V5zDjORnmO5hJfvlBECRAovpbdJpJ3is1ULun5MvNfYKd/ M3XfIudCvmT2CYPJFBSPk9SKvmtPcsAwMuG2tgL9GZDdDIZV1aYxPFdKnaiU8ra9AzAW /7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708707914; x=1709312714; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=A3Impbxiv5EAmL/2ihqY+6YaD1b8yH8gygmWJaN5vZ4=; b=HUno2vYHUoE+T8aFecYZLlykfKylMx0iP0qCgH6UfdwmAkLBbuJs6wcBI2opD6tW26 fcVhJkvQsahsxo/o/jwq2f9RPFqufHpYadGnqTTAtEy1bmd0Vjnfq/sjlmxh/sbP6XKX ZTNR9mPHhIAyWLkxNi3oUTLpkAmOdZp2w39GifQ7r06b3qoGQZfGT0v+Gd0Zsj4jquCW RKZEKCIM963VJFqMB5xoxjGdRdeWTU+i21/doip1Y8Pgh7IBN3NbiwncV5bgS3Wcimia vXjeOQOWLKVmco6AoqSkMuA+QgP22tFS6fYj8hy3t1KXcQXeANdS2NeAsTBChTiZhOcN nBaw== X-Forwarded-Encrypted: i=1; AJvYcCUyHaYBbEbzPRGWpPTSUUzJGtn3beacr7MDGNS2Mofir4z8KAaXJoa72RMErMXMoKvBdVseq9o7+4Vv2GUJbrpXS9NjajZI4A81FMT2 X-Gm-Message-State: AOJu0Yyb8V0hPIVMyvxHCdPqw8QP7ZraOSbK9vC+3m4vPsDWbTitZ4gw +upViVELzQbiv8FXy3n86CJQQXMMyO/zQgEUlfg86aVvxXX66dkj X-Received: by 2002:a05:6512:2523:b0:512:d8ad:b454 with SMTP id be35-20020a056512252300b00512d8adb454mr282175lfb.61.1708707914145; Fri, 23 Feb 2024 09:05:14 -0800 (PST) Received: from razdolb ([37.1.50.248]) by smtp.gmail.com with ESMTPSA id w8-20020a05651204c800b005128c3561b4sm323246lfq.13.2024.02.23.09.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:05:13 -0800 (PST) References: <20231218174042.794012-1-mike.rudenko@gmail.com> <20231218174042.794012-20-mike.rudenko@gmail.com> <20240223114849.GU31348@pendragon.ideasonboard.com> User-agent: mu4e 1.10.8; emacs 29.2.50 From: Mikhail Rudenko To: Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab Subject: Re: [PATCH v2 19/20] media: i2c: ov4689: Refactor ov4689_s_stream Date: Fri, 23 Feb 2024 19:47:18 +0300 In-reply-to: <20240223114849.GU31348@pendragon.ideasonboard.com> Message-ID: <87msrrcdrq.fsf@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Hi Laurent, and thanks for the review! On 2024-02-23 at 13:48 +02, Laurent Pinchart wrote: > Hi Mikhail, > > Thank you for the patch. > > On Mon, Dec 18, 2023 at 08:40:40PM +0300, Mikhail Rudenko wrote: >> Remove repetitive pm_runtime_put calls in ov4689_s_stream function, >> and call pm_runtime_put once at the end of the "on" branch if any >> error occurred. >> >> Signed-off-by: Mikhail Rudenko >> --- >> drivers/media/i2c/ov4689.c | 29 ++++++++++------------------- >> 1 file changed, 10 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c >> index e997c3231e85..884761d02119 100644 >> --- a/drivers/media/i2c/ov4689.c >> +++ b/drivers/media/i2c/ov4689.c >> @@ -555,35 +555,26 @@ static int ov4689_s_stream(struct v4l2_subdev *sd, int on) >> ov4689_common_regs, >> ARRAY_SIZE(ov4689_common_regs), >> NULL); >> - if (ret) { >> - pm_runtime_put_sync(dev); >> - goto unlock_and_return; >> - } >> + if (ret) >> + goto cleanup_pm; >> >> ret = ov4689_setup_timings(ov4689, sd_state); >> - if (ret) { >> - pm_runtime_put(dev); >> - goto unlock_and_return; >> - } >> + if (ret) >> + goto cleanup_pm; >> >> ret = ov4689_setup_blc_anchors(ov4689, sd_state); >> - if (ret) { >> - pm_runtime_put(dev); >> - goto unlock_and_return; >> - } >> + if (ret) >> + goto cleanup_pm; >> >> ret = __v4l2_ctrl_handler_setup(&ov4689->ctrl_handler); >> - if (ret) { >> - pm_runtime_put_sync(dev); >> - goto unlock_and_return; >> - } >> + if (ret) >> + goto cleanup_pm; >> >> ret = cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE, >> OV4689_MODE_STREAMING, NULL); >> - if (ret) { >> +cleanup_pm: > > A label within an if branch isn't great, readability-wise :-S Could we > maybe split the ov4687_s_stream() function in two (streamon and > streamoff, or similar names) ? You would then have a single > pm_runtime_put_sync() call in ov4689_s_stream(), in the error handling > path for the streamon function call. Okay, will split it in v3. >> + if (ret) >> pm_runtime_put_sync(dev); >> - goto unlock_and_return; >> - } >> } else { >> cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE, >> OV4689_MODE_SW_STANDBY, NULL); -- Best regards, Mikhail Rudenko