Re: [PATCH v2 1/3] media: i2c: imx412: Convert to CCI register access helpers
From: Elgin Perumbilly
Date: Tue Jul 14 2026 - 06:23:22 EST
Hi Sakari,
>Hi Elgin,
>
>On Mon, Mar 16, 2026 at 02:30:54PM +0530, Elgin Perumbilly wrote:
>> @@ -543,29 +445,25 @@ static int imx412_update_controls(struct imx412 *imx412,
>> static int imx412_update_exp_gain(struct imx412 *imx412, u32 exposure, u32 gain)
>> {
>> u32 lpfr;
>> - int ret;
>> + int ret = 0;
>> + int ret_hold;
>>
>> lpfr = imx412->vblank + imx412->cur_mode->height;
>>
>> dev_dbg(imx412->dev, "Set exp %u, analog gain %u, lpfr %u\n",
>> exposure, gain, lpfr);
>>
>> - ret = imx412_write_reg(imx412, IMX412_REG_HOLD, 1, 1);
>> - if (ret)
>> - return ret;
>> + cci_write(imx412->cci, IMX412_REG_HOLD, 1, &ret);
>>
>> - ret = imx412_write_reg(imx412, IMX412_REG_LPFR, 2, lpfr);
>> - if (ret)
>> - goto error_release_group_hold;
>> + cci_write(imx412->cci, IMX412_REG_LPFR, lpfr, &ret);
>>
>> - ret = imx412_write_reg(imx412, IMX412_REG_EXPOSURE_CIT, 2, exposure);
>> - if (ret)
>> - goto error_release_group_hold;
>> + cci_write(imx412->cci, IMX412_REG_EXPOSURE_CIT, exposure, &ret);
>>
>> - ret = imx412_write_reg(imx412, IMX412_REG_AGAIN, 2, gain);
>> + cci_write(imx412->cci, IMX412_REG_AGAIN, gain, &ret);
>>
>> -error_release_group_hold:
>> - imx412_write_reg(imx412, IMX412_REG_HOLD, 1, 0);
>> + ret_hold = cci_write(imx412->cci, IMX412_REG_HOLD, 0, NULL);
>
> return cci_write(...);
>
>I'll fix it while applying.
>
Thanks for the review.
>> + if (ret_hold)
>> + return ret_hold;
>>
>> return ret;
>> }
>
>--
>Regards,
>
>Sakari Ailus
Best Regards,
Elgin