Re: [PATCH v2 2/3] media: i2c: Add IMX290 CMOS image sensor driver

From: Sakari Ailus
Date: Thu Aug 29 2019 - 16:17:28 EST


Hi Manivannan,

On Thu, Aug 29, 2019 at 10:34:15PM +0530, Manivannan Sadhasivam wrote:

...

> > > +static int imx290_set_fmt(struct v4l2_subdev *sd,
> > > + struct v4l2_subdev_pad_config *cfg,
> > > + struct v4l2_subdev_format *fmt)
> > > +{
> > > + struct imx290 *imx290 = to_imx290(sd);
> > > + const struct imx290_mode *mode;
> > > + struct v4l2_mbus_framefmt *format;
> > > + int i, ret = 0;
> >
> > Note that sub-device drivers need to serialise access through the uAPI to
> > their own data.
> >
>
> You mean guarding with mutex?

Yes, please.

...

> > > +static int imx290_get_regulators(struct device *dev, struct imx290 *imx290)
> > > +{
> > > + unsigned int i;
> > > +
> > > + for (i = 0; i < IMX290_NUM_SUPPLIES; i++)
> > > + imx290->supplies[i].supply = imx290_supply_name[i];
> > > +
> > > + return devm_regulator_bulk_get(dev, IMX290_NUM_SUPPLIES,
> > > + imx290->supplies);
> > > +}
> > > +

...

> > > + ret = imx290_get_regulators(dev, imx290);
> > > + if (ret < 0) {
> > > + dev_err(dev, "Cannot get regulators\n");
> > > + return ret;
> > > + }
> > > +
> > > + imx290->rst_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS);
> > > + if (IS_ERR(imx290->rst_gpio)) {
> > > + dev_err(dev, "Cannot get reset gpio\n");
> >
> > Remember to put the regulators from now on. Or grab them later.
> >
>
> Shouldn't that happen by default with devm_regulator* APIs?

Ah, I missed you were using the devm variant. Please ignore the comment
then.

--
Regards,

Sakari Ailus