Re: [PATCH 06/12] media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 27, 2023 at 07:56:36PM +0200, Hans de Goede wrote:
> The code to go from ACPI sensor info to a fwnode-tree with connector
> nodes and endpoint properties is 99% the same for the atomisp2 and
> the IPU3.
> 
> The main difference is that atomisp2 devices do not have a SSDB table
> with various info.
> 
> Abstract out the parsing of the sensor's ACPI fwnode into a helper
> function and store the parsed results, rather then the raw SSDB
> in struct cio2_sensor.
> 
> This is a preparation patch for making the cio2-bridge code more generic
> so that it can be shared with the atomisp driver.

...

> +	if (ssdb.vcmtype > ARRAY_SIZE(cio2_vcm_types)) {
> +		dev_warn(&adev->dev, "Unknown VCM type %d\n", ssdb.vcmtype);
> +		ssdb.vcmtype = 0;
> +	}

I'm wondering if we actually can add the first entry in the types as UNKNOWN or
so, and hence

	if (ssdb.vcmtype >= ARRAY_SIZE(cio2_vcm_types)) {
		...
	}


> +	if (ssdb.vcmtype)
> +		sensor->vcm_type = cio2_vcm_types[ssdb.vcmtype - 1];

...and here the conditional can be dropped.

	sensor->vcm_type = cio2_vcm_types[ssdb.vcmtype];

Maybe it's a material for a separate change... Dunno.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux