diff mbox series

[4/5] drm/i915/display: stop returning errors from debugfs registration

Message ID 346562ccef2282ccdbdea54409fab1d2b48f313c.1630327990.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: debugfs cleanups | expand

Commit Message

Jani Nikula Aug. 30, 2021, 12:53 p.m. UTC
Failures to register debugfs should be ignored anyway, so stop
propagating errors altogether for clarity and simplicity. No functional
changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../drm/i915/display/intel_display_debugfs.c  | 19 +++++--------------
 .../drm/i915/display/intel_display_debugfs.h  |  8 ++++----
 2 files changed, 9 insertions(+), 18 deletions(-)

Comments

Rodrigo Vivi Sept. 1, 2021, 4:20 p.m. UTC | #1
On Mon, Aug 30, 2021 at 03:53:43PM +0300, Jani Nikula wrote:
> Failures to register debugfs should be ignored anyway, so stop
> propagating errors altogether for clarity and simplicity. No functional
> changes.

not even a drm_debug if that fails?

> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  .../drm/i915/display/intel_display_debugfs.c  | 19 +++++--------------
>  .../drm/i915/display/intel_display_debugfs.h  |  8 ++++----
>  2 files changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index c1cd5d005e08..845e2dc76f87 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -2443,17 +2443,15 @@ static const struct file_operations i915_dsc_bpp_fops = {
>   *
>   * Cleanup will be done by drm_connector_unregister() through a call to
>   * drm_debugfs_connector_remove().
> - *
> - * Returns 0 on success, negative error codes on error.
>   */
> -int intel_connector_debugfs_add(struct drm_connector *connector)
> +void intel_connector_debugfs_add(struct drm_connector *connector)
>  {
>  	struct dentry *root = connector->debugfs_entry;
>  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
>  
>  	/* The connector must have been registered beforehands. */
>  	if (!root)
> -		return -ENODEV;
> +		return;
>  
>  	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
>  		debugfs_create_file("i915_panel_timings", S_IRUGO, root,
> @@ -2493,23 +2491,16 @@ int intel_connector_debugfs_add(struct drm_connector *connector)
>  	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)
>  		debugfs_create_file("i915_lpsp_capability", 0444, root,
>  				    connector, &i915_lpsp_capability_fops);
> -
> -	return 0;
>  }
>  
>  /**
>   * intel_crtc_debugfs_add - add i915 specific crtc debugfs files
>   * @crtc: pointer to a drm_crtc
>   *
> - * Returns 0 on success, negative error codes on error.
> - *
>   * Failure to add debugfs entries should generally be ignored.
>   */
> -int intel_crtc_debugfs_add(struct drm_crtc *crtc)
> +void intel_crtc_debugfs_add(struct drm_crtc *crtc)
>  {
> -	if (!crtc->debugfs_entry)
> -		return -ENODEV;
> -
> -	crtc_updates_add(crtc);
> -	return 0;
> +	if (crtc->debugfs_entry)
> +		crtc_updates_add(crtc);
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.h b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> index 557901f3eb90..c72e35ecba1f 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> @@ -12,12 +12,12 @@ struct drm_i915_private;
>  
>  #ifdef CONFIG_DEBUG_FS
>  void intel_display_debugfs_register(struct drm_i915_private *i915);
> -int intel_connector_debugfs_add(struct drm_connector *connector);
> -int intel_crtc_debugfs_add(struct drm_crtc *crtc);
> +void intel_connector_debugfs_add(struct drm_connector *connector);
> +void intel_crtc_debugfs_add(struct drm_crtc *crtc);
>  #else
>  static inline void intel_display_debugfs_register(struct drm_i915_private *i915) {}
> -static inline int intel_connector_debugfs_add(struct drm_connector *connector) { return 0; }
> -static inline int intel_crtc_debugfs_add(struct drm_crtc *crtc) { return 0; }
> +static inline void intel_connector_debugfs_add(struct drm_connector *connector) {}
> +static inline void intel_crtc_debugfs_add(struct drm_crtc *crtc) {}
>  #endif
>  
>  #endif /* __INTEL_DISPLAY_DEBUGFS_H__ */
> -- 
> 2.20.1
>
Jani Nikula Sept. 1, 2021, 5:02 p.m. UTC | #2
On Wed, 01 Sep 2021, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Mon, Aug 30, 2021 at 03:53:43PM +0300, Jani Nikula wrote:
>> Failures to register debugfs should be ignored anyway, so stop
>> propagating errors altogether for clarity and simplicity. No functional
>> changes.
>
> not even a drm_debug if that fails?

*shrug* the only error we were returning anyway was if debugfs hadn't
been added at the drm level.

BR,
Jani.

>
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  .../drm/i915/display/intel_display_debugfs.c  | 19 +++++--------------
>>  .../drm/i915/display/intel_display_debugfs.h  |  8 ++++----
>>  2 files changed, 9 insertions(+), 18 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
>> index c1cd5d005e08..845e2dc76f87 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
>> @@ -2443,17 +2443,15 @@ static const struct file_operations i915_dsc_bpp_fops = {
>>   *
>>   * Cleanup will be done by drm_connector_unregister() through a call to
>>   * drm_debugfs_connector_remove().
>> - *
>> - * Returns 0 on success, negative error codes on error.
>>   */
>> -int intel_connector_debugfs_add(struct drm_connector *connector)
>> +void intel_connector_debugfs_add(struct drm_connector *connector)
>>  {
>>  	struct dentry *root = connector->debugfs_entry;
>>  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
>>  
>>  	/* The connector must have been registered beforehands. */
>>  	if (!root)
>> -		return -ENODEV;
>> +		return;
>>  
>>  	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
>>  		debugfs_create_file("i915_panel_timings", S_IRUGO, root,
>> @@ -2493,23 +2491,16 @@ int intel_connector_debugfs_add(struct drm_connector *connector)
>>  	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)
>>  		debugfs_create_file("i915_lpsp_capability", 0444, root,
>>  				    connector, &i915_lpsp_capability_fops);
>> -
>> -	return 0;
>>  }
>>  
>>  /**
>>   * intel_crtc_debugfs_add - add i915 specific crtc debugfs files
>>   * @crtc: pointer to a drm_crtc
>>   *
>> - * Returns 0 on success, negative error codes on error.
>> - *
>>   * Failure to add debugfs entries should generally be ignored.
>>   */
>> -int intel_crtc_debugfs_add(struct drm_crtc *crtc)
>> +void intel_crtc_debugfs_add(struct drm_crtc *crtc)
>>  {
>> -	if (!crtc->debugfs_entry)
>> -		return -ENODEV;
>> -
>> -	crtc_updates_add(crtc);
>> -	return 0;
>> +	if (crtc->debugfs_entry)
>> +		crtc_updates_add(crtc);
>>  }
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.h b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
>> index 557901f3eb90..c72e35ecba1f 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
>> @@ -12,12 +12,12 @@ struct drm_i915_private;
>>  
>>  #ifdef CONFIG_DEBUG_FS
>>  void intel_display_debugfs_register(struct drm_i915_private *i915);
>> -int intel_connector_debugfs_add(struct drm_connector *connector);
>> -int intel_crtc_debugfs_add(struct drm_crtc *crtc);
>> +void intel_connector_debugfs_add(struct drm_connector *connector);
>> +void intel_crtc_debugfs_add(struct drm_crtc *crtc);
>>  #else
>>  static inline void intel_display_debugfs_register(struct drm_i915_private *i915) {}
>> -static inline int intel_connector_debugfs_add(struct drm_connector *connector) { return 0; }
>> -static inline int intel_crtc_debugfs_add(struct drm_crtc *crtc) { return 0; }
>> +static inline void intel_connector_debugfs_add(struct drm_connector *connector) {}
>> +static inline void intel_crtc_debugfs_add(struct drm_crtc *crtc) {}
>>  #endif
>>  
>>  #endif /* __INTEL_DISPLAY_DEBUGFS_H__ */
>> -- 
>> 2.20.1
>>
Rodrigo Vivi Sept. 2, 2021, 12:15 p.m. UTC | #3
On Wed, 2021-09-01 at 20:02 +0300, Jani Nikula wrote:
> On Wed, 01 Sep 2021, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > On Mon, Aug 30, 2021 at 03:53:43PM +0300, Jani Nikula wrote:
> > > Failures to register debugfs should be ignored anyway, so stop
> > > propagating errors altogether for clarity and simplicity. No
> > > functional
> > > changes.
> > 
> > not even a drm_debug if that fails?
> 
> *shrug* the only error we were returning anyway was if debugfs hadn't
> been added at the drm level.

oh, indeed...
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 
> BR,
> Jani.
> 
> > 
> > > 
> > > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> > > ---
> > >  .../drm/i915/display/intel_display_debugfs.c  | 19 +++++--------
> > > ------
> > >  .../drm/i915/display/intel_display_debugfs.h  |  8 ++++----
> > >  2 files changed, 9 insertions(+), 18 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > index c1cd5d005e08..845e2dc76f87 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > > @@ -2443,17 +2443,15 @@ static const struct file_operations
> > > i915_dsc_bpp_fops = {
> > >   *
> > >   * Cleanup will be done by drm_connector_unregister() through a
> > > call to
> > >   * drm_debugfs_connector_remove().
> > > - *
> > > - * Returns 0 on success, negative error codes on error.
> > >   */
> > > -int intel_connector_debugfs_add(struct drm_connector *connector)
> > > +void intel_connector_debugfs_add(struct drm_connector
> > > *connector)
> > >  {
> > >         struct dentry *root = connector->debugfs_entry;
> > >         struct drm_i915_private *dev_priv = to_i915(connector-
> > > >dev);
> > >  
> > >         /* The connector must have been registered beforehands.
> > > */
> > >         if (!root)
> > > -               return -ENODEV;
> > > +               return;
> > >  
> > >         if (connector->connector_type == DRM_MODE_CONNECTOR_eDP)
> > > {
> > >                 debugfs_create_file("i915_panel_timings",
> > > S_IRUGO, root,
> > > @@ -2493,23 +2491,16 @@ int intel_connector_debugfs_add(struct
> > > drm_connector *connector)
> > >             connector->connector_type ==
> > > DRM_MODE_CONNECTOR_HDMIB)
> > >                 debugfs_create_file("i915_lpsp_capability", 0444,
> > > root,
> > >                                     connector,
> > > &i915_lpsp_capability_fops);
> > > -
> > > -       return 0;
> > >  }
> > >  
> > >  /**
> > >   * intel_crtc_debugfs_add - add i915 specific crtc debugfs files
> > >   * @crtc: pointer to a drm_crtc
> > >   *
> > > - * Returns 0 on success, negative error codes on error.
> > > - *
> > >   * Failure to add debugfs entries should generally be ignored.
> > >   */
> > > -int intel_crtc_debugfs_add(struct drm_crtc *crtc)
> > > +void intel_crtc_debugfs_add(struct drm_crtc *crtc)
> > >  {
> > > -       if (!crtc->debugfs_entry)
> > > -               return -ENODEV;
> > > -
> > > -       crtc_updates_add(crtc);
> > > -       return 0;
> > > +       if (crtc->debugfs_entry)
> > > +               crtc_updates_add(crtc);
> > >  }
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> > > b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> > > index 557901f3eb90..c72e35ecba1f 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> > > @@ -12,12 +12,12 @@ struct drm_i915_private;
> > >  
> > >  #ifdef CONFIG_DEBUG_FS
> > >  void intel_display_debugfs_register(struct drm_i915_private
> > > *i915);
> > > -int intel_connector_debugfs_add(struct drm_connector
> > > *connector);
> > > -int intel_crtc_debugfs_add(struct drm_crtc *crtc);
> > > +void intel_connector_debugfs_add(struct drm_connector
> > > *connector);
> > > +void intel_crtc_debugfs_add(struct drm_crtc *crtc);
> > >  #else
> > >  static inline void intel_display_debugfs_register(struct
> > > drm_i915_private *i915) {}
> > > -static inline int intel_connector_debugfs_add(struct
> > > drm_connector *connector) { return 0; }
> > > -static inline int intel_crtc_debugfs_add(struct drm_crtc *crtc)
> > > { return 0; }
> > > +static inline void intel_connector_debugfs_add(struct
> > > drm_connector *connector) {}
> > > +static inline void intel_crtc_debugfs_add(struct drm_crtc *crtc)
> > > {}
> > >  #endif
> > >  
> > >  #endif /* __INTEL_DISPLAY_DEBUGFS_H__ */
> > > -- 
> > > 2.20.1
> > > 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index c1cd5d005e08..845e2dc76f87 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -2443,17 +2443,15 @@  static const struct file_operations i915_dsc_bpp_fops = {
  *
  * Cleanup will be done by drm_connector_unregister() through a call to
  * drm_debugfs_connector_remove().
- *
- * Returns 0 on success, negative error codes on error.
  */
-int intel_connector_debugfs_add(struct drm_connector *connector)
+void intel_connector_debugfs_add(struct drm_connector *connector)
 {
 	struct dentry *root = connector->debugfs_entry;
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 
 	/* The connector must have been registered beforehands. */
 	if (!root)
-		return -ENODEV;
+		return;
 
 	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
 		debugfs_create_file("i915_panel_timings", S_IRUGO, root,
@@ -2493,23 +2491,16 @@  int intel_connector_debugfs_add(struct drm_connector *connector)
 	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)
 		debugfs_create_file("i915_lpsp_capability", 0444, root,
 				    connector, &i915_lpsp_capability_fops);
-
-	return 0;
 }
 
 /**
  * intel_crtc_debugfs_add - add i915 specific crtc debugfs files
  * @crtc: pointer to a drm_crtc
  *
- * Returns 0 on success, negative error codes on error.
- *
  * Failure to add debugfs entries should generally be ignored.
  */
-int intel_crtc_debugfs_add(struct drm_crtc *crtc)
+void intel_crtc_debugfs_add(struct drm_crtc *crtc)
 {
-	if (!crtc->debugfs_entry)
-		return -ENODEV;
-
-	crtc_updates_add(crtc);
-	return 0;
+	if (crtc->debugfs_entry)
+		crtc_updates_add(crtc);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.h b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
index 557901f3eb90..c72e35ecba1f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
@@ -12,12 +12,12 @@  struct drm_i915_private;
 
 #ifdef CONFIG_DEBUG_FS
 void intel_display_debugfs_register(struct drm_i915_private *i915);
-int intel_connector_debugfs_add(struct drm_connector *connector);
-int intel_crtc_debugfs_add(struct drm_crtc *crtc);
+void intel_connector_debugfs_add(struct drm_connector *connector);
+void intel_crtc_debugfs_add(struct drm_crtc *crtc);
 #else
 static inline void intel_display_debugfs_register(struct drm_i915_private *i915) {}
-static inline int intel_connector_debugfs_add(struct drm_connector *connector) { return 0; }
-static inline int intel_crtc_debugfs_add(struct drm_crtc *crtc) { return 0; }
+static inline void intel_connector_debugfs_add(struct drm_connector *connector) {}
+static inline void intel_crtc_debugfs_add(struct drm_crtc *crtc) {}
 #endif
 
 #endif /* __INTEL_DISPLAY_DEBUGFS_H__ */