Commit 7336c54a authored by Mikhail Rudenko's avatar Mikhail Rudenko Committed by Sakari Ailus
Browse files

media: i2c: ov4689: code cleanup



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: default avatarMikhail Rudenko <mike.rudenko@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
parent 27cdfbdb
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -623,10 +623,9 @@ 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)) {
		dev_warn_ratelimited(dev, "no mapping found for gain %d\n",
@@ -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;