Received: by 2002:ac8:6d01:0:b0:423:7e07:f8e4 with SMTP id o1csp6902149qtt; Mon, 18 Dec 2023 09:47:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaBx0FHAI6zpjOH8ziYBCjIMY1Hj+YzbU6jBeiiE+TSBn0qswdUwrsE8CPLyZ5kBiV+vNM X-Received: by 2002:a05:6e02:3a85:b0:35f:a61d:5906 with SMTP id cr5-20020a056e023a8500b0035fa61d5906mr6138478ilb.63.1702921679266; Mon, 18 Dec 2023 09:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702921679; cv=none; d=google.com; s=arc-20160816; b=wicmd1nIf6pCz71hCJQp7rdS51RzJj02RAnW/GZLlEUkm6pnbcpoBcWIWq7WXUQZiM evRdfEz7HzYr/nJ64KBGQSG6cBW4+X9s0g7S9nDLYvRYeXw3ypcvWmvQNCFPMUpB64GI peMm9hjQnSStsSxtq4Grl1FhoC3VO5uEEnYyi2yupcIz7fxNEQIsXQUpUGooIlNRvZ0l TCJ9F6TLPkSe6YKFav+c+lUbebpbiksRPBolPjagyUCgQrx/06ZzQsitPLnVrTPzHqF3 W1CZLXrlSlo6gwHuekfbtf/7FaTH7VCbdJIUmMghxZwOnHb95lHwwWHiTp8I77U+2Joq C9dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0Db9zQ/cEzdabx9SHSYCUhC/ZN+6oeRqIuZFUX0OxwU=; fh=Ft8dYvEuFIKwnehVwpL0WG7QMIrRLMi0wgN4ll940k8=; b=OESZfsyKKwGQ3m5Cxa+YjcAMs+SJ5wJwq0LLSjMGZ7HCo+D2MPvT5CQK2p2qLBhHMF YokA3I9Bwgf8OXm/W8qMn55nmoixHNGthZahUdAymxjajwKAzldHIdwLR6z8zCD5ZppL Dpz1C9XWcav5n+z9dJDvFuWm3ta40CtKUYXWL63BXblCRnHvgFz9tj0VLmcP24EPEZOu IBVtKujMLeXzD5f5amG0Nq1fhoqmSa192pDQ2r2wfBv5DbwCZuLFjQ0Rxb6zSgi6OosV HeXZra1N9CTA4I5Iucs0MpeLoqjbav4cnWbiXwCRgQbHQNdXcZgwAbwDfta5rLVcKNko zmnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PTG8rUde; spf=pass (google.com: domain of linux-kernel+bounces-4204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r69-20020a632b48000000b005ca4098bf5esi10452650pgr.613.2023.12.18.09.47.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 09:47:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PTG8rUde; spf=pass (google.com: domain of linux-kernel+bounces-4204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4204-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F04852858E2 for ; Mon, 18 Dec 2023 17:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73F767CD1C; Mon, 18 Dec 2023 17:41:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PTG8rUde" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 B23F77BF09; Mon, 18 Dec 2023 17:41:27 +0000 (UTC) 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-lj1-f171.google.com with SMTP id 38308e7fff4ca-2cc259392a6so40380091fa.2; Mon, 18 Dec 2023 09:41:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702921285; x=1703526085; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0Db9zQ/cEzdabx9SHSYCUhC/ZN+6oeRqIuZFUX0OxwU=; b=PTG8rUdeNkGfdmowl5R1KJTy3z+neKeSws7v5yD1wstCvJwJcF4spM55YveLjCSf3D mH1b207EF+Caj+ublnDu8Ap9wfmwnn09pIs85YhdpSjwtHS9Vptv9VgkkQ3fAdsvnXgV 8ZZmZq4WB+C0m+zOFpLoUnoQSDLhl9eTaYOYVNG6Am9j5/PPv4hmNOjOjLHVm8SEh7LW Y60d9OZHnOPMKwWvHdvucp9beBoNXiiKiI7JIzJJmpiViLSu16KJKvvRbdbkk3KSHgvZ 2NU83GoZlwx8G3ZkaUxFUoMj4Dh2J1cKXsEVvm+u6+S1uANnjcPNuTg6/ea0kYuW2V5x bbbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702921285; x=1703526085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Db9zQ/cEzdabx9SHSYCUhC/ZN+6oeRqIuZFUX0OxwU=; b=r1+xxZonbHKcPBZJYgXt7o5oMJfkaVL3EhCLau8E2XSp8TV7Lx+9chD7kZbSO9Xj6G oMg+T4gQU4KZwb5lGxHerRRgCXbLhIiE/CSRBRJZ+BEz3KXC4Gj0sDQd1U8BkM9tioqy CTgxDxxHbB18dmsBEx2GxoDvoj0VaPjiFIjmExxcXd17MK1qhxsoqr+vRVfVJRqlhpD4 QEKZa7j90LK6w69wbKVpgauPJmlFgmIWanuT2413aMH+ko7z1UaTbYeXx3aMgVmVoZeF TcwpWh347jK65+tCGvi3dTVIHTPjJ07Yk67oqShWg7vpv3ytZhc45MumP02ZfR1sA0ZL H4Dg== X-Gm-Message-State: AOJu0YxetExudEY1aFXulm/cWD+YnyqqbXOwCpyVMT8SUidT/+E6eldx kCxcID1VcP7dIBuDUIzGOZyMObA9EAwseA== X-Received: by 2002:a2e:8783:0:b0:2cc:5a63:3903 with SMTP id n3-20020a2e8783000000b002cc5a633903mr1994561lji.79.1702921285505; Mon, 18 Dec 2023 09:41:25 -0800 (PST) Received: from localhost ([83.149.246.185]) by smtp.gmail.com with ESMTPSA id k11-20020a2e888b000000b002cc5f5fc8cesm866940lji.63.2023.12.18.09.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 09:41:25 -0800 (PST) From: Mikhail Rudenko To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sakari Ailus , Laurent Pinchart , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab , Mikhail Rudenko Subject: [PATCH v2 19/20] media: i2c: ov4689: Refactor ov4689_s_stream Date: Mon, 18 Dec 2023 20:40:40 +0300 Message-ID: <20231218174042.794012-20-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218174042.794012-1-mike.rudenko@gmail.com> References: <20231218174042.794012-1-mike.rudenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: + 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); -- 2.43.0