[PATCH v1 03/10] media: platform: mediatek: add isp_7x seninf unit

CK Hu (胡俊光) ck.hu at mediatek.com
Tue Nov 19 22:35:52 PST 2024


Hi, Shu-hsiang:

On Wed, 2024-10-09 at 19:15 +0800, Shu-hsiang Yang wrote:
> Introduces the driver of the MediaTek Sensor Interface,
> focusing on integration with the MediaTek ISP CAMSYS. The
> seninf device bridges camera sensors and the ISP system,
> providing management for sensor data routing and processing.
> Key features include V4L2 framework control, and dynamic
> handling of stream configurations and virtual channels.
> 
> Signed-off-by: Shu-hsiang Yang <Shu-hsiang.Yang at mediatek.com>
> ---

[snip]

> +struct seninf_mux *mtk_cam_seninf_mux_get_pref(struct seninf_ctx *ctx,
> +					       int *pref_idx, int pref_cnt)
> +{
> +	int i;
> +	struct seninf_core *core = ctx->core;
> +	struct seninf_mux *ent = NULL;
> +
> +	mutex_lock(&core->mutex);
> +
> +	list_for_each_entry(ent, &core->list_mux, list) {
> +		for (i = 0; i < pref_cnt; i++) {
> +			if (ent->idx == pref_idx[i]) {

There is only two place to call mtk_cam_seninf_mux_get_pref(), and both place just make sure that pref_idx[i] = i.
So it's not necessary to pass an array as parameter. This code could be

if (ent->idx == i) {
   ...
}

Regards,
CK

> +				list_move_tail(&ent->list, &ctx->list_mux);
> +				mutex_unlock(&core->mutex);
> +				return ent;
> +			}
> +		}
> +	}
> +
> +	mutex_unlock(&core->mutex);
> +
> +	return mtk_cam_seninf_mux_get(ctx);
> +}
> +



More information about the linux-arm-kernel mailing list