mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: xiaolei wang <xiaolei.wang@windriver.com>
To: Tarang Raval <tarang.raval@siliconsignals.io>,
	"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	"laurent.pinchart@ideasonboard.com"
	<laurent.pinchart@ideasonboard.com>,
	"dave.stevenson@raspberrypi.com" <dave.stevenson@raspberrypi.com>,
	"jacopo@jmondi.org" <jacopo@jmondi.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"prabhakar.mahadev-lad.rj@bp.renesas.com"
	<prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"hverkuil+cisco@kernel.org" <hverkuil+cisco@kernel.org>,
	"johannes.goede@oss.qualcomm.com"
	<johannes.goede@oss.qualcomm.com>,
	"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
	"jai.luthra@ideasonboard.com" <jai.luthra@ideasonboard.com>,
	"richard.leitner@linux.dev" <richard.leitner@linux.dev>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] media: i2c: ov9282: Convert to CCI register access helpers
Date: Sun, 1 Mar 2026 14:35:15 +0800	[thread overview]
Message-ID: <9df76198-073d-4958-aafe-e01bf9511925@windriver.com> (raw)
In-Reply-To: <PN3P287MB18290DAB4344D5671227E6CD8B70A@PN3P287MB1829.INDP287.PROD.OUTLOOK.COM>


On 3/1/26 02:12, Tarang Raval wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> Hi Xiaolei,
>
>> Use the new common CCI register access helpers to replace the private
>> register access helpers in the ov9282 driver. This simplifies the driver
>> by reducing the amount of code.
>>
>> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ...
>
>>   /**
>>    * ov9282_update_controls() - Update control ranges based on streaming mode
>>    * @ov9282: pointer to ov9282 device
>> @@ -639,15 +536,15 @@ static int ov9282_update_exp_gain(struct ov9282 *ov9282, u32 exposure, u32 gain)
>>          dev_dbg(ov9282->dev, "Set exp %u (~%u us), analog gain %u",
>>                  exposure, exposure_us, gain);
>>
>> -       ret = ov9282_write_reg(ov9282, OV9282_REG_HOLD, 1, 1);
>> +       ret = cci_write(ov9282->regmap, OV9282_REG_HOLD, 0x01, NULL);
>>          if (ret)
>>                  return ret;
>>
>> -       ret = ov9282_write_reg(ov9282, OV9282_REG_EXPOSURE, 3, exposure << 4);
>> +       ret = cci_write(ov9282->regmap, OV9282_REG_EXPOSURE, exposure << 4, NULL);
>>          if (ret)
>>                  goto error_release_group_hold;
>>
>> -       ret = ov9282_write_reg(ov9282, OV9282_REG_AGAIN, 1, gain);
>> +       ret = cci_write(ov9282->regmap, OV9282_REG_AGAIN, gain, NULL);
>>          if (ret)
>>                  goto error_release_group_hold;
>>
>> @@ -656,62 +553,11 @@ static int ov9282_update_exp_gain(struct ov9282 *ov9282, u32 exposure, u32 gain)
>>                                         OV9282_STROBE_FRAME_SPAN_DEFAULT);
>>
>>   error_release_group_hold:
>> -       ov9282_write_reg(ov9282, OV9282_REG_HOLD, 1, 0);
>> +       cci_write(ov9282->regmap, OV9282_REG_HOLD, 0, NULL);
> If all the operations above succeed but releasing the group hold fails,
> you still return success, which is wrong.
>
> This case is rare, but it’s better to fix the error path.
>
> I think we should do something like this:
>
> error_release_group_hold:
>       int ret_hold = cci_write(ov9282->regmap, OV9282_REG_HOLD, 0, NULL);
>
>       return ret ? ret : ret_hold;
Hi Tarang,

Thank you for catching this!

  I'll fix it in v2 with:

error_release_group_hold:
     int ret_hold = cci_write(ov9282->regmap, OV9282_REG_HOLD, 0, NULL);
     return ret ? ret : ret_hold;

Best Regards,
Xiaolei
>
>>          return ret;
>>   }
> Other than this issue, the patch looks good to me.
>
> Reviewed-by: Tarang Raval <tarang.raval@siliconsignals.io>
>
> Best Regards,
> Tarang

  reply	other threads:[~2026-03-01  6:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  8:33 [PATCH 0/3] media: i2c: ov9282: Modernize driver with CCI and streams API Xiaolei Wang
2026-02-28  8:33 ` [PATCH 1/3] media: i2c: ov9282: Convert to CCI register access helpers Xiaolei Wang
2026-02-28 18:12   ` Tarang Raval
2026-03-01  6:35     ` xiaolei wang [this message]
2026-02-28  8:34 ` [PATCH 2/3] media: i2c: ov9282: Switch to using the sub-device state lock Xiaolei Wang
2026-02-28 18:27   ` Tarang Raval
2026-03-01  6:37     ` xiaolei wang
2026-02-28  8:34 ` [PATCH 3/3] media: i2c: ov9282: switch to {enable,disable}_streams Xiaolei Wang
2026-02-28 18:45   ` Tarang Raval
2026-03-01  6:40     ` xiaolei wang

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=9df76198-073d-4958-aafe-e01bf9511925@windriver.com \
    --to=xiaolei.wang@windriver.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=jai.luthra@ideasonboard.com \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=richard.leitner@linux.dev \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tarang.raval@siliconsignals.io \
    /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

all inboxes | Powered by JetHome®