Re: [PATCH v2 4/4] media: platform: Add Renesas RZ/G2L CRU driver
From: Lad, Prabhakar
Date: Sat Sep 24 2022 - 07:38:39 EST
Hi Sakari,
Thank you for the review.
On Fri, Sep 23, 2022 at 9:14 PM Sakari Ailus
<sakari.ailus@xxxxxxxxxxxxxxx> wrote:
>
> Hi Prabhakar,
>
> On Tue, Sep 06, 2022 at 12:04:06AM +0100, Lad Prabhakar wrote:
> ...
>
> > +#define to_buf_list(vb2_buffer) (&container_of(vb2_buffer, \
> > + struct rzg2l_cru_buffer, \
> > + vb)->list)
>
> #define to_buf_list(vb2_buffer) \
> (&container_of(vb2_buffer, struct rzg2l_cru_buffer, vb)->list)
>
OK.
>
> ...
>
> > +static int rzg2l_cru_open(struct file *file)
> > +{
> > + struct rzg2l_cru_dev *cru = video_drvdata(file);
> > + int ret;
> > +
> > + ret = clk_prepare_enable(cru->pclk);
> > + if (ret)
> > + return ret;
> > +
> > + ret = clk_prepare_enable(cru->vclk);
> > + if (ret)
> > + goto disable_pclk;
> > +
> > + ret = clk_prepare_enable(cru->aclk);
> > + if (ret)
> > + goto disable_vclk;
> > +
> > + ret = mutex_lock_interruptible(&cru->lock);
> > + if (ret)
> > + goto disable_aclk;
> > +
> > + file->private_data = cru;
> > + ret = v4l2_fh_open(file);
> > + if (ret)
> > + goto err_unlock;
> > +
> > + ret = v4l2_pipeline_pm_get(&cru->vdev.entity);
>
> Please use runtime PM instead in sensor drivers, we're trying to get rid of
> this function.
>
OK.
> It'd be nice to have it in this one as well.
>
I'll will switch to runtime PM.
> > + if (ret < 0)
> > + goto err_open;
> > +
> > + mutex_unlock(&cru->lock);
> > +
> > + return 0;
> > +err_open:
> > + v4l2_fh_release(file);
> > +err_unlock:
> > + mutex_unlock(&cru->lock);
> > +disable_aclk:
> > + clk_disable_unprepare(cru->aclk);
> > +disable_vclk:
> > + clk_disable_unprepare(cru->vclk);
> > +disable_pclk:
> > + clk_disable_unprepare(cru->pclk);
> > +
> > + return ret;
> > +}
>
> ...
>
> > +void rzg2l_cru_v4l2_unregister(struct rzg2l_cru_dev *cru)
> > +{
> > + if (!video_is_registered(&cru->vdev))
> > + return;
> > +
> > + v4l2_info(&cru->v4l2_dev, "Removed %s\n",
> > + video_device_node_name(&cru->vdev));
>
> I'd just leave this out. Same for the similar message on registration.
>
OK, I'll drop both the messages.
Cheers,
Prabhakar