From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbdEJH7M (ORCPT ); Wed, 10 May 2017 03:59:12 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34564 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752311AbdEJH7K (ORCPT ); Wed, 10 May 2017 03:59:10 -0400 Date: Wed, 10 May 2017 09:59:06 +0200 From: Daniel Vetter To: Jose Abreu Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Carlos Palminha , Alexey Brodkin , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Daniel Vetter , Dave Airlie , Andrzej Hajda , Archit Taneja Subject: Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Message-ID: <20170510075906.h67prtmveosrmgb2@phenom.ffwll.local> Mail-Followup-To: Jose Abreu , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Carlos Palminha , Alexey Brodkin , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Dave Airlie , Andrzej Hajda , Archit Taneja References: <9fa7d9826e3793989fb52a2911d37b41ddfc0580.1494347165.git.joabreu@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9fa7d9826e3793989fb52a2911d37b41ddfc0580.1494347165.git.joabreu@synopsys.com> X-Operating-System: Linux phenom 4.9.0-2-amd64 User-Agent: NeoMutt/20170306 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 09, 2017 at 06:00:09PM +0100, Jose Abreu wrote: > Add a new helper to call crtc->mode_valid callback. > > Suggested-by: Ville Syrjälä > Signed-off-by: Jose Abreu > Cc: Carlos Palminha > Cc: Alexey Brodkin > Cc: Ville Syrjälä > Cc: Daniel Vetter > Cc: Dave Airlie > Cc: Andrzej Hajda > Cc: Archit Taneja > --- > drivers/gpu/drm/drm_crtc.c | 22 ++++++++++++++++++++++ > drivers/gpu/drm/drm_crtc_internal.h | 3 +++ > 2 files changed, 25 insertions(+) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 5af25ce..07ae705 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -741,3 +742,24 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj, > > return ret; > } > + > +/** > + * drm_crtc_mode_valid - call crtc->mode_valid callback, if any. > + * @crtc: crtc > + * @mode: mode to be validated > + * > + * If no mode_valid callback is available this will return MODE_OK. > + * > + * Returns: drm_mode_status Enum > + */ > +enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc, > + const struct drm_display_mode *mode) > +{ > + const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; This is clearly a helper func, but you place it into the core and EXPORT_SYMBOL it. Imo this should be entirely internal to the helpers, perhaps just stuff them all into drm_probe_helpers.c? Header file would be drm_crtc_helper_internal.h. That also means no need for kernel-doc (only the driver api is formally documented) and then these 3 patches are so tiny it's better to squash them into the patch that adds their users. Thanks, Daniel > + > + if (!crtc_funcs || !crtc_funcs->mode_valid) > + return MODE_OK; > + > + return crtc_funcs->mode_valid(crtc, mode); > +} > +EXPORT_SYMBOL(drm_crtc_mode_valid); > diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h > index d077c54..3800abd 100644 > --- a/drivers/gpu/drm/drm_crtc_internal.h > +++ b/drivers/gpu/drm/drm_crtc_internal.h > @@ -45,6 +45,9 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc, > > struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc); > > +enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc, > + const struct drm_display_mode *mode); > + > /* IOCTLs */ > int drm_mode_getcrtc(struct drm_device *dev, > void *data, struct drm_file *file_priv); > -- > 1.9.1 > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch