Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4191774rba; Tue, 2 Apr 2024 09:47:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMWxan6eu1/GIBu65KIPKMRg73JNf7Tg1OO54b1zZglX/W7MWS2G1ponInF3hC+Z8iuaqLfdd6T/3n2a2dWp4UvqWezPqKGPk3V5mNjA== X-Google-Smtp-Source: AGHT+IG8M55wA9riBVSIWAuF8olHq8sPj5c3Ju71oiLhcSuXfF9aZUcoME7KMZ7ISjBAfY6sR7Wd X-Received: by 2002:a17:90a:740c:b0:2a2:14f1:cc with SMTP id a12-20020a17090a740c00b002a214f100ccmr214513pjg.27.1712076467592; Tue, 02 Apr 2024 09:47:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712076467; cv=pass; d=google.com; s=arc-20160816; b=wsP4OTvkCWufQXu0Sm/bM+fpPJD6WQnWh253Bjos6AVzexrh0QHBJ5x+Y0JIcDExMD 00Ot1uwwrDPqTZ0qroWIIqwS+49z0dY6KsujEjAAu+b1lwT5AhEJPYMMOuIGgyhKEDgH j77NtbmXUko6S3bq8y50z3OUq64YbnjzBzTeB2OM7oDVsXEAkBYMowMZZHcbHdt2zbbS hpsZBzGC83fmt1sNqTX9D+dCAXEgq8OohwKJiQCPi7mktCARkztOPoXP+1LNOiF0tR05 OzvkNH4HdznYgk8DOwFjF4gdYqzYUyN5p+TsBdnae2wjc3pIznXqv1O4GzaSJc6Bkvy/ woyg== ARC-Message-Signature: i=2; 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=lWbyHQKX45rMNdHdGNsZAuo4LbzVfBFJvQO257UCyxQ=; fh=Xl16ZbAUiXxGk0pJtA8bjLjKEHlNwVHrHeMkR1mMHhY=; b=clfXnMotUGiqGl+tixhh7D8tL/KkxClT3wkgUO7h2yWkx1x8WCNON9+mf8OcFyUTjl 3/tEuqlAQ3Nv/gUvKYPAw6rANJ5IHRjD3CL59lG4xhQ2KiwZPBSxgqy4VxA4oZGxdU6c KnrkgztD6rXEiW79a+NcylX+6hj3+fO6CLVoh/5Bi6BwM4bIIU+2hD/INFQSkPxZ1v0v 8QU35NrMZT52FRrhtmjQBp4qQXONYmL+I2RIuixgGUnpV8fpJdBpHbwKk65BtRV96egI R3ApYKM92m/l1ncVg1RxTIREf19b4IVgZOftRjiyED2FNeicxYbs2hsTksJ42urAQizb 3Zfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=USZU5DEX; 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-128372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128372-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 e9-20020a17090ac20900b002a2454b3625si3206005pjt.162.2024.04.02.09.47.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 09:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128372-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=USZU5DEX; 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-128372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128372-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 43C35283AC3 for ; Tue, 2 Apr 2024 16:47:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43FF615ADB9; Tue, 2 Apr 2024 16:46:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="USZU5DEX" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 9D93A15AD81; Tue, 2 Apr 2024 16:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712076382; cv=none; b=ELB4IYZIU1tjiSMRBZ14aAWEUEIsZ1Ef+vhkR7kKszwTMZkDNQjL/BoDZIterT59iWdCyjME1LAxtrY6y2tVUIOIuhbtSG4tDef6YMUqsB6d1rj9iRb81ryFebOiDlUEPpjEB82Y7T8/4F6EtPEzxJ7tQM/u008xSd7oy3W87GY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712076382; c=relaxed/simple; bh=gtV7owZRYzoOjVE9V7/zetWs7Op+tJKE99DwxPJUt8o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E7bEevUZdWLC2pmKzrGf5WJaMd2iGYgv7xU1/O8p5Yb4r94kIgRG4N6ZOSlMW6NEmGzH4pEz2Yy4on+lJTI9/jV9AZciVJ41aLWvZ7adJaKkfdNud+H+4PhBjTPkkW6+caWxSbWU0RmRxI1qfYo1oSbw7H+u2HjZRsadOgoC7fQ= 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=USZU5DEX; arc=none smtp.client-ip=209.85.167.48 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-f48.google.com with SMTP id 2adb3069b0e04-516b6e75dc3so861881e87.3; Tue, 02 Apr 2024 09:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712076378; x=1712681178; 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=lWbyHQKX45rMNdHdGNsZAuo4LbzVfBFJvQO257UCyxQ=; b=USZU5DEXjbsrLKVcxdojKUh8Q9t/i3WfYqOPFhVAug9PvElcBtN3d9FAGVdSFp0G8I j1UsIhQKbzzO0nIU4f1VpzZvcTrBfs0gudqKV/G33l+MNIHUZvRhRlDIiPbWnQHUFW5t wIUUjKpwBUNqqHANt/tEEtIpfRk94pBBjH+NqlmvXzkpucDf72Hr8BHyQc9QgIXX5WSe KFZQeEKEdZFPgkPNwd3zJxW7sUcpiq++EgxzT8+A2E86dLFOJ3YxE4yp2DRA5BODIl2T XIv5N5CjJB5UiVTdNZEi3JyJiiU8QXJWdRT8Mecxqlc7KgfbGK6KIHUaOcX1Kbo4lQ/w 1NNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712076378; x=1712681178; 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=lWbyHQKX45rMNdHdGNsZAuo4LbzVfBFJvQO257UCyxQ=; b=pIR4wXxeJ1A4bBoxpSNAMw++A3HhACvfvh3iqaEgYDcWyRotiwmdLU8vF2BLYkNFI+ CyYIdPJIK3g8MjLkH3tH+caPbuaAh6e4Ag4PWYUN/lkQcXEsQ7boI6vWCfdmELzSYz1y qezGN9nBM79hAFRaDd7kOmohPNuQ7OoJe2DsRgjjgAGdGJGRcnP+kHk1hVo6P3znpX5/ OriSe845yOyeL7MthasViGoSKHniqQDnJZFEWspxcjlA7Y5Gs8bLiYhGAXB1aMTz4+gI YRBmKYnwpxmb3mTuHKkAhe2RBf04TIjuP93EC0vVNqKEVkY4yRqgw21vv19xCoai9ckr 8ROw== X-Forwarded-Encrypted: i=1; AJvYcCWbuPG8JjP9JJFpBEq8d9iFIYnSnBH2eUiERRZFQfLlNTkpaX5utRiE4pKkXv4gmPbc6IwRnOtFJqH7Yti4wVsEDkCj1OIPm0ISojPU X-Gm-Message-State: AOJu0YwWky3euoj89NrAs0Hlf/cCAM/tTrKI1tpfiA/mSnaC6L+t6EET noV4GBlgbn7scLOPfv97BmyWIjEINnVtUkOgpoznHcsWqdesnT/BkxGz+bKUIATqwQ== X-Received: by 2002:a05:6512:752:b0:513:1a9c:ae77 with SMTP id c18-20020a056512075200b005131a9cae77mr7611340lfs.52.1712076377903; Tue, 02 Apr 2024 09:46:17 -0700 (PDT) Received: from localhost ([77.91.78.25]) by smtp.gmail.com with ESMTPSA id fc3-20020a056512138300b00516a88ea29csm734620lfb.18.2024.04.02.09.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 09:46:17 -0700 (PDT) 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 , Kieran Bingham Subject: [PATCH v4 06/20] media: i2c: ov4689: Refactor ov4689_set_ctrl Date: Tue, 2 Apr 2024 19:45:37 +0300 Message-ID: <20240402164552.19171-7-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402164552.19171-1-mike.rudenko@gmail.com> References: <20240402164552.19171-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 Introduce local variable for regmap within the ov4689_set_ctrl function. This adjustment eliminates repetition within the function. Signed-off-by: Mikhail Rudenko Reviewed-by: Kieran Bingham --- drivers/media/i2c/ov4689.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index 56bf1d964e43..1bc00404f3fb 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -580,10 +580,11 @@ 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; - int ret; + int ret = 0; /* Propagate change of current control to all related controls */ switch (ctrl->id) { @@ -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); 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); -- 2.44.0