Message ID | 20180626062259.15563-5-mahesh1.kumar@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 26 Jun 2018, Mahesh Kumar <mahesh1.kumar@intel.com> wrote: > This patch implements "verify_crc_source" callback function for > rockchip drm driver. > > Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com> > Cc: dri-devel@lists.freedesktop.org > --- > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index c9222119767d..ea4884ac4cb0 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -1138,12 +1138,32 @@ static int vop_crtc_set_crc_source(struct drm_crtc *crtc, > > return ret; > } > + > +static int > +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, > + size_t *values_cnt) > +{ > + if ((source_name && strcmp(source_name, "auto") == 0) || !source_name) { Drive-by review: IOW, if (!source_name || strcmp(source_name, "auto") == 0) Better yet, reverse the logic, if (source_name && strcmp(source_name, "auto") != 0) return -EINVAL; *values_cnt = 3; return 0; BR, Jani. > + *values_cnt = 3; > + return 0; > + } > + > + return -EINVAL; > +} > + > #else > static int vop_crtc_set_crc_source(struct drm_crtc *crtc, > const char *source_name, size_t *values_cnt) > { > return -ENODEV; > } > + > +static int > +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, > + size_t *values_cnt) > +{ > + return -ENODEV; > +} > #endif > > static const struct drm_crtc_funcs vop_crtc_funcs = { > @@ -1156,6 +1176,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { > .enable_vblank = vop_crtc_enable_vblank, > .disable_vblank = vop_crtc_disable_vblank, > .set_crc_source = vop_crtc_set_crc_source, > + .verify_crc_source = vop_crtc_verify_crc_source, > }; > > static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
Hi, On 6/27/2018 5:30 PM, Jani Nikula wrote: > On Tue, 26 Jun 2018, Mahesh Kumar <mahesh1.kumar@intel.com> wrote: >> This patch implements "verify_crc_source" callback function for >> rockchip drm driver. >> >> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com> >> Cc: dri-devel@lists.freedesktop.org >> --- >> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c >> index c9222119767d..ea4884ac4cb0 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c >> @@ -1138,12 +1138,32 @@ static int vop_crtc_set_crc_source(struct drm_crtc *crtc, >> >> return ret; >> } >> + >> +static int >> +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, >> + size_t *values_cnt) >> +{ >> + if ((source_name && strcmp(source_name, "auto") == 0) || !source_name) { > Drive-by review: > > IOW, > > if (!source_name || strcmp(source_name, "auto") == 0) > > Better yet, reverse the logic, > > if (source_name && strcmp(source_name, "auto") != 0) > return -EINVAL; > > *values_cnt = 3; > > return 0; thanks for review, Will reverse the logic as suggested. -Mahesh > BR, > Jani. > >> + *values_cnt = 3; >> + return 0; >> + } >> + >> + return -EINVAL; >> +} >> + >> #else >> static int vop_crtc_set_crc_source(struct drm_crtc *crtc, >> const char *source_name, size_t *values_cnt) >> { >> return -ENODEV; >> } >> + >> +static int >> +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, >> + size_t *values_cnt) >> +{ >> + return -ENODEV; >> +} >> #endif >> >> static const struct drm_crtc_funcs vop_crtc_funcs = { >> @@ -1156,6 +1176,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { >> .enable_vblank = vop_crtc_enable_vblank, >> .disable_vblank = vop_crtc_disable_vblank, >> .set_crc_source = vop_crtc_set_crc_source, >> + .verify_crc_source = vop_crtc_verify_crc_source, >> }; >> >> static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index c9222119767d..ea4884ac4cb0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1138,12 +1138,32 @@ static int vop_crtc_set_crc_source(struct drm_crtc *crtc, return ret; } + +static int +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, + size_t *values_cnt) +{ + if ((source_name && strcmp(source_name, "auto") == 0) || !source_name) { + *values_cnt = 3; + return 0; + } + + return -EINVAL; +} + #else static int vop_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, size_t *values_cnt) { return -ENODEV; } + +static int +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, + size_t *values_cnt) +{ + return -ENODEV; +} #endif static const struct drm_crtc_funcs vop_crtc_funcs = { @@ -1156,6 +1176,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .enable_vblank = vop_crtc_enable_vblank, .disable_vblank = vop_crtc_disable_vblank, .set_crc_source = vop_crtc_set_crc_source, + .verify_crc_source = vop_crtc_verify_crc_source, }; static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
This patch implements "verify_crc_source" callback function for rockchip drm driver. Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com> Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)