Re: [PATCH v2 4/4] media: platform: Add Renesas RZ/G2L CRU driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)


...

> +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.

It'd be nice to have it in this one as well.

> +	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.

-- 
Kind regards,

Sakari Ailus



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux