Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1563400rdb; Mon, 8 Jan 2024 03:27:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0WHnHhohGqHVBXO/0WpfMEUogiR3c2JD8XP5QESX9GsNWW81t58rm96teMTkqfGAsqW1w X-Received: by 2002:a17:90a:c481:b0:28d:2521:4695 with SMTP id j1-20020a17090ac48100b0028d25214695mr863257pjt.33.1704713243635; Mon, 08 Jan 2024 03:27:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704713243; cv=pass; d=google.com; s=arc-20160816; b=XxHBXknhoBt2qnm+qI1qhuHkBUULeAGwZnvBjS39T5BNgogDyobqhE7iMUZtPblens uMhG6tFPQPmtVARDPs3Fn6/KrrUjZlOCDmVgdkz7YLcwviSMylq8USN16F8BidY5KwuW iLZepU9lktaJJqpuC+6NlWlZDSh4ZcZmKHRng42DWfnDTBW8XIDi/6rcf4ANjqDhOBpJ 0UIWkR9DMcoNpcxWcxvji7rjsyjjfftDXXhdkPCFwEL6IX/ajNV8etMey7aLiF3eMX7F NSck8beZ0JXD4391iOf9pCaNP74c4vIACVimioy+BNLDsBhmlRR4RtdN6HKkLcolO/YL cMLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=FRzBCMMQ3iNT4N+/PtoE+zl1cNf6xy8Jh8N7QEIPuR0=; fh=Hb5Ys/n8RkZMn5hi8ohCl9U6Vm/7/JZ0AOb8UTV9AwM=; b=lgdKswkWW1JkQL8I5/NihWP4v2Bgoxj+hVMvlmDp5cL2XS7Zx5fUTJLxXW0lliVCS1 vSP7wyjQvbX7yt6LrLkKtlDwsuN34UoqaQJnkB1iaJ8hmtWVwyVtdxITVEOq6BEAkqaC pE5S9lXTNyw6zPzqaKk3O4Zjae2z7iuAblX65pHtzDgapdIEsiKC8nugF21ZabHiQrqd 5iXBjeJApl0i7crfuBPIhF/4vMdj6cj0VaIENlY5qiGBYWgeLEm5miNuBg8l9OeVjMLJ scVnO5i9c2Re02x6jag+C8byDZWsZg0TqtqNnqX1Us5hRycafCBPfp89t6/8zEp2qRRU JfNg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iki.fi header.s=lahtoruutu header.b=Luppexhm; dkim=pass header.i=@iki.fi header.s=meesny header.b=wlzWEzml; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-19417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19417-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v20-20020a17090a899400b0028c99453374si5588167pjn.176.2024.01.08.03.27.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 03:27:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=lahtoruutu header.b=Luppexhm; dkim=pass header.i=@iki.fi header.s=meesny header.b=wlzWEzml; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-19417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19417-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 957FCB222FC for ; Mon, 8 Jan 2024 11:25:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0AD414AA9; Mon, 8 Jan 2024 11:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=iki.fi header.i=@iki.fi header.b="Luppexhm"; dkim=pass (1024-bit key) header.d=iki.fi header.i=@iki.fi header.b="wlzWEzml" X-Original-To: linux-kernel@vger.kernel.org Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 501AB14A8D; Mon, 8 Jan 2024 11:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iki.fi Received: from meesny.iki.fi (meesny.iki.fi [195.140.195.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lahtoruutu.iki.fi (Postfix) with ESMTPS id 4T7s2975kkz49Py8; Mon, 8 Jan 2024 13:16:17 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1704712578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FRzBCMMQ3iNT4N+/PtoE+zl1cNf6xy8Jh8N7QEIPuR0=; b=LuppexhmF+qLbw/oCBO6M82rgaF2MnuRfZPyAkoWzoDHEVASUB7ccsqBrVFA0rJVQUz3qW tg7/ZAScmc/wWtZrc1RJ7qnQd2knGxDe2IUGL9eY0vqkzpVmyavDCmJTuskTb4RYPZAKEx TZAd+uNT7Q9bdvgZDamY5QpP56VZGtDHBTT67ZOl53cZ7je9FZ4OOIdwcfK9ES2uy6E2M3 maytfVves+96dso5hUukg26h9YDyIAVQg0MXGBC/+ZE/y/+zpNLyyWXQnaefWWQzduW0oq Lhxe3DAMB/kTICVibgoY3hp368XbS5t18ZNZbuIXHKxjTSMJYfsE4wo5Bj8xeg== Received: from hillosipuli.retiisi.eu (2a00-1190-d1dd-0-c641-1eff-feae-163c.v6.cust.suomicom.net [IPv6:2a00:1190:d1dd:0:c641:1eff:feae:163c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sailus) by meesny.iki.fi (Postfix) with ESMTPSA id 4T7s203rwCzyVF; Mon, 8 Jan 2024 13:16:08 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1704712570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FRzBCMMQ3iNT4N+/PtoE+zl1cNf6xy8Jh8N7QEIPuR0=; b=wlzWEzmlfbjtN7EPAYxysu6dnh1OrLqhAltCHxtZNtHPfb3E+Q96GDuHP+twx271ZDm6r1 ITyttcHJS8Z9hnA0PuMESKwmbEM+MidtOwyPHDW/LhvGMy/yLPJ2gEucSG09uVhgobxjIV veG1KXvcfPpwxJevtdwd1XFA/wVrgNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1704712570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FRzBCMMQ3iNT4N+/PtoE+zl1cNf6xy8Jh8N7QEIPuR0=; b=OwaUdeirO3y0WBsvVKLnjqN9JcMnQxS2glNNDL9wjYy8tRAjhXz2AFIl5vINm/CtPLYkFd 6qGbLU7gnq7gPlelrcgx7by8kydtDGfnYM1bv+l9+EgZ0SVAJgBcZhcQKNSyQMAe6r/2Dl XbxbNzSJPQR1VnRciPmiM3SH8GMlygg= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1704712570; a=rsa-sha256; cv=none; b=QAyS2Xbkog7xn84AR3YlL+1qoyaideEeDfZXszlGKtqNDMYlkQ8JGwCRXV6h+ww1dKbgoY cJLoT8xmm7VCS1JT/ZaPHsCjT3Hxb0d5ct2eyPrJRIjTtKZsDC1D1z9jBjCEyulms55G+w O5eTf7hl7iW3AdACeWSPLi2L5edQG88= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sailus smtp.mailfrom=sakari.ailus@iki.fi Received: from valkosipuli.retiisi.eu (valkosipuli.localdomain [192.168.4.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.eu (Postfix) with ESMTPS id 01AD2634C93; Mon, 8 Jan 2024 13:16:07 +0200 (EET) Date: Mon, 8 Jan 2024 11:16:07 +0000 From: Sakari Ailus To: Mikhail Rudenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus , Laurent Pinchart , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab Subject: Re: [PATCH v2 06/20] media: i2c: ov4689: Refactor ov4689_set_ctrl Message-ID: References: <20231218174042.794012-1-mike.rudenko@gmail.com> <20231218174042.794012-7-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231218174042.794012-7-mike.rudenko@gmail.com> Hi Mikhail, On Mon, Dec 18, 2023 at 08:40:27PM +0300, Mikhail Rudenko wrote: > Introduce local variable for regmap within the ov4689_set_ctrl > function. This adjustment eliminates repetition within the function. > > Signed-off-by: Mikhail Rudenko > --- > drivers/media/i2c/ov4689.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c > index 3b20eba59c9c..d42f5d1a1ba8 100644 > --- a/drivers/media/i2c/ov4689.c > +++ b/drivers/media/i2c/ov4689.c > @@ -580,6 +580,7 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) > { > struct ov4689 *ov4689 = > container_of(ctrl->handler, struct ov4689, ctrl_handler); > + struct regmap *regmap = ov4689->regmap; > struct device *dev = ov4689->dev; > int sensor_gain; > s64 max_expo; > @@ -603,16 +604,15 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) > switch (ctrl->id) { > case V4L2_CID_EXPOSURE: > /* 4 least significant bits of exposure are fractional part */ > - ret = cci_write(ov4689->regmap, OV4689_REG_EXPOSURE, > - ctrl->val << 4, NULL); > + cci_write(regmap, OV4689_REG_EXPOSURE, ctrl->val << 4, &ret); If you do this, ret needs to have been initialised to 0, but it isn't. Same for the changes below. > break; > case V4L2_CID_ANALOGUE_GAIN: > ret = ov4689_map_gain(ov4689, ctrl->val, &sensor_gain); > - cci_write(ov4689->regmap, OV4689_REG_GAIN, sensor_gain, &ret); > + cci_write(regmap, OV4689_REG_GAIN, sensor_gain, &ret); > break; > case V4L2_CID_VBLANK: > - ret = cci_write(ov4689->regmap, OV4689_REG_VTS, > - ctrl->val + ov4689->cur_mode->height, NULL); > + cci_write(regmap, OV4689_REG_VTS, > + ctrl->val + ov4689->cur_mode->height, &ret); > break; > case V4L2_CID_TEST_PATTERN: > ret = ov4689_enable_test_pattern(ov4689, ctrl->val); > @@ -625,7 +625,6 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) > } > > pm_runtime_put(dev); > - I thought it was nice. > return ret; > } > -- Regards, Sakari Ailus