public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mikhail Rudenko <mike.rudenko@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mikhail Rudenko <mike.rudenko@gmail.com>
Subject: [PATCH] media: i2c: ov4689: code cleanup
Date: Wed, 26 Oct 2022 15:45:51 +0300	[thread overview]
Message-ID: <20221026124552.163172-1-mike.rudenko@gmail.com> (raw)
In-Reply-To: <Y1gl1FMAjhXCfCmk@paasikivi.fi.intel.com>

Fix minor nits from the last review round: extra {}, temporary
variables for ARRAYS_SIZE(), redundant check in ov4689_check_hwcfg.
No functional change intended.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
 drivers/media/i2c/ov4689.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c
index 419ff7371ba8..c602e507d42b 100644
--- a/drivers/media/i2c/ov4689.c
+++ b/drivers/media/i2c/ov4689.c
@@ -623,9 +623,8 @@ static int ov4689_map_gain(struct ov4689 *ov4689, int logical_gain, int *result)
 
 	for (n = 0; n < ARRAY_SIZE(ov4689_gain_ranges); n++) {
 		if (logical_gain >= ov4689_gain_ranges[n].logical_min &&
-		    logical_gain <= ov4689_gain_ranges[n].logical_max) {
+		    logical_gain <= ov4689_gain_ranges[n].logical_max)
 			break;
-		}
 	}
 
 	if (n == ARRAY_SIZE(ov4689_gain_ranges)) {
@@ -815,23 +814,22 @@ static int ov4689_check_sensor_id(struct ov4689 *ov4689,
 
 static int ov4689_configure_regulators(struct ov4689 *ov4689)
 {
-	unsigned int supplies_count = ARRAY_SIZE(ov4689_supply_names);
 	unsigned int i;
 
-	for (i = 0; i < supplies_count; i++)
+	for (i = 0; i < ARRAY_SIZE(ov4689_supply_names); i++)
 		ov4689->supplies[i].supply = ov4689_supply_names[i];
 
-	return devm_regulator_bulk_get(&ov4689->client->dev, supplies_count,
+	return devm_regulator_bulk_get(&ov4689->client->dev,
+				       ARRAY_SIZE(ov4689_supply_names),
 				       ov4689->supplies);
 }
 
 static u64 ov4689_check_link_frequency(struct v4l2_fwnode_endpoint *ep)
 {
-	unsigned int freqs_count = ARRAY_SIZE(link_freq_menu_items);
 	const u64 *freqs = link_freq_menu_items;
 	unsigned int i, j;
 
-	for (i = 0; i < freqs_count; i++) {
+	for (i = 0; i < ARRAY_SIZE(link_freq_menu_items); i++) {
 		for (j = 0; j < ep->nr_of_link_frequencies; j++)
 			if (freqs[i] == ep->link_frequencies[j])
 				return freqs[i];
@@ -864,12 +862,6 @@ static int ov4689_check_hwcfg(struct device *dev)
 		goto out_free_bus_cfg;
 	}
 
-	if (!bus_cfg.nr_of_link_frequencies) {
-		dev_err(dev, "No link frequencies defined\n");
-		ret = -EINVAL;
-		goto out_free_bus_cfg;
-	}
-
 	if (!ov4689_check_link_frequency(&bus_cfg)) {
 		dev_err(dev, "No supported link frequency found\n");
 		ret = -EINVAL;
-- 
2.38.1


      reply	other threads:[~2022-10-26 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 16:20 [PATCH v4 0/2] Add Omnivision OV4689 image sensor driver Mikhail Rudenko
2022-10-22 16:20 ` [PATCH v4 1/2] media: dt-bindings: i2c: document OV4689 Mikhail Rudenko
2022-10-22 16:20 ` [PATCH v4 2/2] media: i2c: add support for OV4689 Mikhail Rudenko
2022-10-25 13:09   ` Jacopo Mondi
2022-10-25 13:51     ` Mikhail Rudenko
2022-10-27  7:07       ` Jacopo Mondi
2022-10-25 18:07     ` Sakari Ailus
2022-10-26 12:45       ` Mikhail Rudenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221026124552.163172-1-mike.rudenko@gmail.com \
    --to=mike.rudenko@gmail.com \
    --cc=jacopo@jmondi.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox