On Do, 2022-03-10 at 16:28 +0000, Biju Das wrote: > As the resets DT property is mandatory, and is present in all .dtsi > in mainline, add support to perform deassert/assert using reference > counted reset handle. > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> > --- > v1->v2: > * Used reference counted reset handle to perform deassert/assert > RFC->v1: > * Added reset support as separate patch > * Moved rstc just after the bus_master field in struct vsp1_device > RFC: > * > https://patchwork.kernel.org/project/linux-renesas-soc/patch/20220112174612.10773-21-biju.das.jz@xxxxxxxxxxxxxx/ > --- > drivers/media/platform/vsp1/vsp1.h | 1 + > drivers/media/platform/vsp1/vsp1_drv.c | 21 ++++++++++++++++++++- > 2 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/vsp1/vsp1.h > b/drivers/media/platform/vsp1/vsp1.h > index 37cf33c7e6ca..c5da829c79b5 100644 > --- a/drivers/media/platform/vsp1/vsp1.h > +++ b/drivers/media/platform/vsp1/vsp1.h > @@ -79,6 +79,7 @@ struct vsp1_device { > void __iomem *mmio; > struct rcar_fcp_device *fcp; > struct device *bus_master; > + struct reset_control *rstc; > > struct vsp1_brx *brs; > struct vsp1_brx *bru; > diff --git a/drivers/media/platform/vsp1/vsp1_drv.c > b/drivers/media/platform/vsp1/vsp1_drv.c > index 502c7d9d6890..dbe90ceec327 100644 > --- a/drivers/media/platform/vsp1/vsp1_drv.c > +++ b/drivers/media/platform/vsp1/vsp1_drv.c > @@ -16,6 +16,7 @@ > #include <linux/of_device.h> > #include <linux/platform_device.h> > #include <linux/pm_runtime.h> > +#include <linux/reset.h> > #include <linux/videodev2.h> > > #include <media/rcar-fcp.h> > @@ -569,7 +570,19 @@ static void vsp1_mask_all_interrupts(struct > vsp1_device *vsp1) > */ > int vsp1_device_get(struct vsp1_device *vsp1) > { > - return pm_runtime_resume_and_get(vsp1->dev); > + int ret = reset_control_deassert(vsp1->rstc); > + > + if (ret < 0) > + goto err; If reset_control_deassert() failed, return ret directly, do not jump to err: to call reset_control_assert(). > + > + ret = pm_runtime_resume_and_get(vsp1->dev); > + if (ret < 0) > + goto err; > + > + return 0; > +err: > + reset_control_assert(vsp1->rstc); > + return ret; > } With that fixed, Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> regards Philipp