From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Hao Yao <hao.yao@intel.com>
Cc: Arec Kao <arec.kao@intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, Bingbu Cao <bingbu.cao@intel.com>
Subject: Re: [PATCH 2/2] media: i2c: ov13b10: Support 2 lane mode
Date: Mon, 10 Mar 2025 07:14:16 +0000 [thread overview]
Message-ID: <Z86RSEg3BL0uiWlX@kekkonen.localdomain> (raw)
In-Reply-To: <f24a1543-9a8f-4e42-8cf7-40644f6d706d@intel.com>
Hi Hao,
On Mon, Mar 10, 2025 at 12:06:04PM +0800, Hao Yao wrote:
> > > @@ -1459,12 +1539,25 @@ static int ov13b10_check_hwcfg(struct device *dev)
> > > if (ret)
> > > return ret;
> > > - if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV13B10_DATA_LANES) {
> > > + dlane = bus_cfg.bus.mipi_csi2.num_data_lanes;
> > > + if (dlane != OV13B10_4_DATA_LANES && dlane != OV13B10_2_DATA_LANES) {
> > > dev_err(dev, "number of CSI2 data lanes %d is not supported",
> > > - bus_cfg.bus.mipi_csi2.num_data_lanes);
> > > + dlane);
> > > ret = -EINVAL;
> > > goto out_err;
> > > }
> > > + ov13b->data_lanes = dlane;
> > > + ov13b->supported_modes = supported_4_lanes_modes;
> > > + ov13b->supported_modes_num = ARRAY_SIZE(supported_4_lanes_modes);
> > > + if (dlane == OV13B10_2_DATA_LANES) {
> > > + ov13b->supported_modes = supported_2_lanes_modes;
> > > + ov13b->supported_modes_num =
> > > + ARRAY_SIZE(supported_2_lanes_modes);
> >
> > How about using switch() here?
>
> How about:
> ov13b->data_lanes = bus_cfg.bus.mipi_csi2.num_data_lanes;
> switch (ov13b->data_lanes) {
> case OV13B10_4_DATA_LANES:
> ov13b->supported_modes = supported_4_lanes_modes;
> ov13b->supported_modes_num =
> ARRAY_SIZE(supported_4_lanes_modes);
> break;
>
> case OV13B10_2_DATA_LANES:
> ov13b->supported_modes = supported_2_lanes_modes;
> ov13b->supported_modes_num =
> ARRAY_SIZE(supported_2_lanes_modes);
> break;
>
> default:
> dev_err(dev, "number of CSI2 data lanes %d is not supported",
> ov13b->data_lanes);
> ret = -EINVAL;
> goto out_err;
> }
Looks good to me. I'd do the assignment to ov13b->data_lanes after checking
the value though.
--
Regards,
Sakari Ailus
next prev parent reply other threads:[~2025-03-10 7:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 9:31 [PATCH 1/2] media: i2c: ov13b10: Fix h_blank calculation Hao Yao
2025-03-07 9:31 ` [PATCH 2/2] media: i2c: ov13b10: Support 2 lane mode Hao Yao
2025-03-07 9:43 ` Sakari Ailus
2025-03-10 4:06 ` Hao Yao
2025-03-10 7:14 ` Sakari Ailus [this message]
2025-03-11 6:42 ` Hao Yao
2025-03-11 8:17 ` Sakari Ailus
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=Z86RSEg3BL0uiWlX@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=arec.kao@intel.com \
--cc=bingbu.cao@intel.com \
--cc=hao.yao@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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