diff mbox series

[v2] drm: Merge __drm_atomic_helper_disable_all() into drm_atomic_helper_disable_all()

Message ID 20190212173245.51980-1-sean@poorly.run (mailing list archive)
State New, archived
Headers show
Series [v2] drm: Merge __drm_atomic_helper_disable_all() into drm_atomic_helper_disable_all() | expand

Commit Message

Sean Paul Feb. 12, 2019, 5:32 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

The only difference between the functions is the clean_old_fbs argument, whose
use was removed in the patch referenced below. So remove the internal
copy and drop the guts back into drm_atomic_helper_disable_all()

Changes in v2:
- Instead of just removing the unused arg, merge the functions

Fixes: e00fb8564ee9 ("drm: Stop updating plane->crtc/fb/old_fb on atomic drivers")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Sinclair Yeh <syeh@vmware.com> # This email bounces :(
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/drm_atomic_helper.c | 59 +++++++++++++----------------
 1 file changed, 26 insertions(+), 33 deletions(-)

Comments

kernel test robot via dri-devel Feb. 13, 2019, 3:35 p.m. UTC | #1
On Tue, Feb 12, 2019 at 12:32:41PM -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> The only difference between the functions is the clean_old_fbs argument, whose
> use was removed in the patch referenced below. So remove the internal
> copy and drop the guts back into drm_atomic_helper_disable_all()
> 
> Changes in v2:
> - Instead of just removing the unused arg, merge the functions
> 
> Fixes: e00fb8564ee9 ("drm: Stop updating plane->crtc/fb/old_fb on atomic drivers")
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Sinclair Yeh <syeh@vmware.com> # This email bounces :(
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 59 +++++++++++++----------------
>  1 file changed, 26 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index c53ecbd9abddd..7a7231d007792 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3030,9 +3030,31 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>  	return 0;
>  }
>  
> -static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> -					   struct drm_modeset_acquire_ctx *ctx,
> -					   bool clean_old_fbs)
> +/**
> + * drm_atomic_helper_disable_all - disable all currently active outputs
> + * @dev: DRM device
> + * @ctx: lock acquisition context
> + *
> + * Loops through all connectors, finding those that aren't turned off and then
> + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> + * that they are connected to.
> + *
> + * This is used for example in suspend/resume to disable all currently active
> + * functions when suspending. If you just want to shut down everything at e.g.
> + * driver unload, look at drm_atomic_helper_shutdown().
> + *
> + * Note that if callers haven't already acquired all modeset locks this might
> + * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> + *
> + * Returns:
> + * 0 on success or a negative error code on failure.
> + *
> + * See also:
> + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> + * drm_atomic_helper_shutdown().
> + */
> +int drm_atomic_helper_disable_all(struct drm_device *dev,
> +				  struct drm_modeset_acquire_ctx *ctx)
>  {
>  	struct drm_atomic_state *state;
>  	struct drm_connector_state *conn_state;
> @@ -3090,35 +3112,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
>  	drm_atomic_state_put(state);
>  	return ret;
>  }
> -
> -/**
> - * drm_atomic_helper_disable_all - disable all currently active outputs
> - * @dev: DRM device
> - * @ctx: lock acquisition context
> - *
> - * Loops through all connectors, finding those that aren't turned off and then
> - * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> - * that they are connected to.
> - *
> - * This is used for example in suspend/resume to disable all currently active
> - * functions when suspending. If you just want to shut down everything at e.g.
> - * driver unload, look at drm_atomic_helper_shutdown().
> - *
> - * Note that if callers haven't already acquired all modeset locks this might
> - * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> - *
> - * Returns:
> - * 0 on success or a negative error code on failure.
> - *
> - * See also:
> - * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> - * drm_atomic_helper_shutdown().
> - */
> -int drm_atomic_helper_disable_all(struct drm_device *dev,
> -				  struct drm_modeset_acquire_ctx *ctx)
> -{
> -	return __drm_atomic_helper_disable_all(dev, ctx, false);
> -}
>  EXPORT_SYMBOL(drm_atomic_helper_disable_all);
>  
>  /**
> @@ -3139,7 +3132,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
>  
>  	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
>  
> -	ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
> +	ret = drm_atomic_helper_disable_all(dev, &ctx);
>  	if (ret)
>  		DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
>  
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
Sean Paul Feb. 13, 2019, 4:28 p.m. UTC | #2
On Wed, Feb 13, 2019 at 05:35:05PM +0200, Ville Syrjälä wrote:
> On Tue, Feb 12, 2019 at 12:32:41PM -0500, Sean Paul wrote:
> > From: Sean Paul <seanpaul@chromium.org>
> > 
> > The only difference between the functions is the clean_old_fbs argument, whose
> > use was removed in the patch referenced below. So remove the internal
> > copy and drop the guts back into drm_atomic_helper_disable_all()
> > 
> > Changes in v2:
> > - Instead of just removing the unused arg, merge the functions
> > 
> > Fixes: e00fb8564ee9 ("drm: Stop updating plane->crtc/fb/old_fb on atomic drivers")
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Sinclair Yeh <syeh@vmware.com> # This email bounces :(
> > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 

Pushed to drm-misc-next-fixes, thanks for your review!

Sean

> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 59 +++++++++++++----------------
> >  1 file changed, 26 insertions(+), 33 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index c53ecbd9abddd..7a7231d007792 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -3030,9 +3030,31 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
> >  	return 0;
> >  }
> >  
> > -static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> > -					   struct drm_modeset_acquire_ctx *ctx,
> > -					   bool clean_old_fbs)
> > +/**
> > + * drm_atomic_helper_disable_all - disable all currently active outputs
> > + * @dev: DRM device
> > + * @ctx: lock acquisition context
> > + *
> > + * Loops through all connectors, finding those that aren't turned off and then
> > + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> > + * that they are connected to.
> > + *
> > + * This is used for example in suspend/resume to disable all currently active
> > + * functions when suspending. If you just want to shut down everything at e.g.
> > + * driver unload, look at drm_atomic_helper_shutdown().
> > + *
> > + * Note that if callers haven't already acquired all modeset locks this might
> > + * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> > + *
> > + * Returns:
> > + * 0 on success or a negative error code on failure.
> > + *
> > + * See also:
> > + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> > + * drm_atomic_helper_shutdown().
> > + */
> > +int drm_atomic_helper_disable_all(struct drm_device *dev,
> > +				  struct drm_modeset_acquire_ctx *ctx)
> >  {
> >  	struct drm_atomic_state *state;
> >  	struct drm_connector_state *conn_state;
> > @@ -3090,35 +3112,6 @@ static int __drm_atomic_helper_disable_all(struct drm_device *dev,
> >  	drm_atomic_state_put(state);
> >  	return ret;
> >  }
> > -
> > -/**
> > - * drm_atomic_helper_disable_all - disable all currently active outputs
> > - * @dev: DRM device
> > - * @ctx: lock acquisition context
> > - *
> > - * Loops through all connectors, finding those that aren't turned off and then
> > - * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
> > - * that they are connected to.
> > - *
> > - * This is used for example in suspend/resume to disable all currently active
> > - * functions when suspending. If you just want to shut down everything at e.g.
> > - * driver unload, look at drm_atomic_helper_shutdown().
> > - *
> > - * Note that if callers haven't already acquired all modeset locks this might
> > - * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
> > - *
> > - * Returns:
> > - * 0 on success or a negative error code on failure.
> > - *
> > - * See also:
> > - * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
> > - * drm_atomic_helper_shutdown().
> > - */
> > -int drm_atomic_helper_disable_all(struct drm_device *dev,
> > -				  struct drm_modeset_acquire_ctx *ctx)
> > -{
> > -	return __drm_atomic_helper_disable_all(dev, ctx, false);
> > -}
> >  EXPORT_SYMBOL(drm_atomic_helper_disable_all);
> >  
> >  /**
> > @@ -3139,7 +3132,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
> >  
> >  	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
> >  
> > -	ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
> > +	ret = drm_atomic_helper_disable_all(dev, &ctx);
> >  	if (ret)
> >  		DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
> >  
> > -- 
> > Sean Paul, Software Engineer, Google / Chromium OS
> 
> -- 
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c53ecbd9abddd..7a7231d007792 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3030,9 +3030,31 @@  int __drm_atomic_helper_set_config(struct drm_mode_set *set,
 	return 0;
 }
 
-static int __drm_atomic_helper_disable_all(struct drm_device *dev,
-					   struct drm_modeset_acquire_ctx *ctx,
-					   bool clean_old_fbs)
+/**
+ * drm_atomic_helper_disable_all - disable all currently active outputs
+ * @dev: DRM device
+ * @ctx: lock acquisition context
+ *
+ * Loops through all connectors, finding those that aren't turned off and then
+ * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
+ * that they are connected to.
+ *
+ * This is used for example in suspend/resume to disable all currently active
+ * functions when suspending. If you just want to shut down everything at e.g.
+ * driver unload, look at drm_atomic_helper_shutdown().
+ *
+ * Note that if callers haven't already acquired all modeset locks this might
+ * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
+ *
+ * Returns:
+ * 0 on success or a negative error code on failure.
+ *
+ * See also:
+ * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
+ * drm_atomic_helper_shutdown().
+ */
+int drm_atomic_helper_disable_all(struct drm_device *dev,
+				  struct drm_modeset_acquire_ctx *ctx)
 {
 	struct drm_atomic_state *state;
 	struct drm_connector_state *conn_state;
@@ -3090,35 +3112,6 @@  static int __drm_atomic_helper_disable_all(struct drm_device *dev,
 	drm_atomic_state_put(state);
 	return ret;
 }
-
-/**
- * drm_atomic_helper_disable_all - disable all currently active outputs
- * @dev: DRM device
- * @ctx: lock acquisition context
- *
- * Loops through all connectors, finding those that aren't turned off and then
- * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
- * that they are connected to.
- *
- * This is used for example in suspend/resume to disable all currently active
- * functions when suspending. If you just want to shut down everything at e.g.
- * driver unload, look at drm_atomic_helper_shutdown().
- *
- * Note that if callers haven't already acquired all modeset locks this might
- * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
- *
- * Returns:
- * 0 on success or a negative error code on failure.
- *
- * See also:
- * drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
- * drm_atomic_helper_shutdown().
- */
-int drm_atomic_helper_disable_all(struct drm_device *dev,
-				  struct drm_modeset_acquire_ctx *ctx)
-{
-	return __drm_atomic_helper_disable_all(dev, ctx, false);
-}
 EXPORT_SYMBOL(drm_atomic_helper_disable_all);
 
 /**
@@ -3139,7 +3132,7 @@  void drm_atomic_helper_shutdown(struct drm_device *dev)
 
 	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
 
-	ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
+	ret = drm_atomic_helper_disable_all(dev, &ctx);
 	if (ret)
 		DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);