public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Make intel_dsi_init() return void
@ 2014-05-28 11:30 Damien Lespiau
  2014-05-28 13:00 ` Daniel Vetter
  2014-06-03 12:05 ` Jani Nikula
  0 siblings, 2 replies; 4+ messages in thread
From: Damien Lespiau @ 2014-05-28 11:30 UTC (permalink / raw)
  To: intel-gfx

Functions that can't fail are such a bliss to work with, it'd be shame
to miss the occasion. The "failure" mode is the DSI connector not being
created, the rest of the initialization can carry on happily.

We weren't even checking that value anyway.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Suggested-by: Shobhit Kumar <shobhit.kumar@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h |  2 +-
 drivers/gpu/drm/i915/intel_dsi.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index edecf89..62686b2 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -831,7 +831,7 @@ void intel_edp_psr_update(struct drm_device *dev);
 void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
 
 /* intel_dsi.c */
-bool intel_dsi_init(struct drm_device *dev);
+void intel_dsi_init(struct drm_device *dev);
 
 
 /* intel_dvo.c */
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index e73bec6..4dbd160 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -646,7 +646,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 };
 
-bool intel_dsi_init(struct drm_device *dev)
+void intel_dsi_init(struct drm_device *dev)
 {
 	struct intel_dsi *intel_dsi;
 	struct intel_encoder *intel_encoder;
@@ -662,12 +662,12 @@ bool intel_dsi_init(struct drm_device *dev)
 
 	intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
 	if (!intel_dsi)
-		return false;
+		return;
 
 	intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL);
 	if (!intel_connector) {
 		kfree(intel_dsi);
-		return false;
+		return;
 	}
 
 	intel_encoder = &intel_dsi->base;
@@ -678,7 +678,7 @@ bool intel_dsi_init(struct drm_device *dev)
 		dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
 	} else {
 		DRM_ERROR("Unsupported Mipi device to reg base");
-		return false;
+		return;
 	}
 
 	connector = &intel_connector->base;
@@ -738,12 +738,12 @@ bool intel_dsi_init(struct drm_device *dev)
 	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 
-	return true;
+	return;
 
 err:
 	drm_encoder_cleanup(&intel_encoder->base);
 	kfree(intel_dsi);
 	kfree(intel_connector);
 
-	return false;
+	return;
 }
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Make intel_dsi_init() return void
  2014-05-28 11:30 [PATCH] drm/i915: Make intel_dsi_init() return void Damien Lespiau
@ 2014-05-28 13:00 ` Daniel Vetter
  2014-06-03 12:05 ` Jani Nikula
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2014-05-28 13:00 UTC (permalink / raw)
  To: Damien Lespiau; +Cc: intel-gfx

On Wed, May 28, 2014 at 12:30:56PM +0100, Damien Lespiau wrote:
> Functions that can't fail are such a bliss to work with, it'd be shame
> to miss the occasion. The "failure" mode is the DSI connector not being
> created, the rest of the initialization can carry on happily.
> 
> We weren't even checking that value anyway.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Suggested-by: Shobhit Kumar <shobhit.kumar@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Shobhit Kumar <shobhit.kumar@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_drv.h |  2 +-
>  drivers/gpu/drm/i915/intel_dsi.c | 12 ++++++------
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index edecf89..62686b2 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -831,7 +831,7 @@ void intel_edp_psr_update(struct drm_device *dev);
>  void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
>  
>  /* intel_dsi.c */
> -bool intel_dsi_init(struct drm_device *dev);
> +void intel_dsi_init(struct drm_device *dev);
>  
>  
>  /* intel_dvo.c */
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index e73bec6..4dbd160 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -646,7 +646,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  };
>  
> -bool intel_dsi_init(struct drm_device *dev)
> +void intel_dsi_init(struct drm_device *dev)
>  {
>  	struct intel_dsi *intel_dsi;
>  	struct intel_encoder *intel_encoder;
> @@ -662,12 +662,12 @@ bool intel_dsi_init(struct drm_device *dev)
>  
>  	intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
>  	if (!intel_dsi)
> -		return false;
> +		return;
>  
>  	intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL);
>  	if (!intel_connector) {
>  		kfree(intel_dsi);
> -		return false;
> +		return;
>  	}
>  
>  	intel_encoder = &intel_dsi->base;
> @@ -678,7 +678,7 @@ bool intel_dsi_init(struct drm_device *dev)
>  		dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
>  	} else {
>  		DRM_ERROR("Unsupported Mipi device to reg base");
> -		return false;
> +		return;
>  	}
>  
>  	connector = &intel_connector->base;
> @@ -738,12 +738,12 @@ bool intel_dsi_init(struct drm_device *dev)
>  	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
>  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
>  
> -	return true;
> +	return;
>  
>  err:
>  	drm_encoder_cleanup(&intel_encoder->base);
>  	kfree(intel_dsi);
>  	kfree(intel_connector);
>  
> -	return false;
> +	return;
>  }
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Make intel_dsi_init() return void
  2014-05-28 11:30 [PATCH] drm/i915: Make intel_dsi_init() return void Damien Lespiau
  2014-05-28 13:00 ` Daniel Vetter
@ 2014-06-03 12:05 ` Jani Nikula
  2014-06-03 12:50   ` Damien Lespiau
  1 sibling, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2014-06-03 12:05 UTC (permalink / raw)
  To: Damien Lespiau, intel-gfx

On Wed, 28 May 2014, Damien Lespiau <damien.lespiau@intel.com> wrote:
> Functions that can't fail are such a bliss to work with, it'd be shame
> to miss the occasion. The "failure" mode is the DSI connector not being
> created, the rest of the initialization can carry on happily.
>
> We weren't even checking that value anyway.
>
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Suggested-by: Shobhit Kumar <shobhit.kumar@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Shobhit Kumar <shobhit.kumar@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_drv.h |  2 +-
>  drivers/gpu/drm/i915/intel_dsi.c | 12 ++++++------
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index edecf89..62686b2 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -831,7 +831,7 @@ void intel_edp_psr_update(struct drm_device *dev);
>  void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
>  
>  /* intel_dsi.c */
> -bool intel_dsi_init(struct drm_device *dev);
> +void intel_dsi_init(struct drm_device *dev);
>  
>  
>  /* intel_dvo.c */
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index e73bec6..4dbd160 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -646,7 +646,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  };
>  
> -bool intel_dsi_init(struct drm_device *dev)
> +void intel_dsi_init(struct drm_device *dev)
>  {
>  	struct intel_dsi *intel_dsi;
>  	struct intel_encoder *intel_encoder;
> @@ -662,12 +662,12 @@ bool intel_dsi_init(struct drm_device *dev)
>  
>  	intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
>  	if (!intel_dsi)
> -		return false;
> +		return;
>  
>  	intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL);
>  	if (!intel_connector) {
>  		kfree(intel_dsi);
> -		return false;
> +		return;
>  	}
>  
>  	intel_encoder = &intel_dsi->base;
> @@ -678,7 +678,7 @@ bool intel_dsi_init(struct drm_device *dev)
>  		dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
>  	} else {
>  		DRM_ERROR("Unsupported Mipi device to reg base");
> -		return false;
> +		return;
>  	}
>  
>  	connector = &intel_connector->base;
> @@ -738,12 +738,12 @@ bool intel_dsi_init(struct drm_device *dev)
>  	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
>  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
>  
> -	return true;
> +	return;
>  
>  err:
>  	drm_encoder_cleanup(&intel_encoder->base);
>  	kfree(intel_dsi);
>  	kfree(intel_connector);
>  
> -	return false;
> +	return;

Okay this went in already, but I find return statements at the end of
void functions like that a bit silly...

...but hey, you can send a fix removing that! ;)

BR,
Jani.


>  }
> -- 
> 1.8.3.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915: Make intel_dsi_init() return void
  2014-06-03 12:05 ` Jani Nikula
@ 2014-06-03 12:50   ` Damien Lespiau
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Lespiau @ 2014-06-03 12:50 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Tue, Jun 03, 2014 at 03:05:14PM +0300, Jani Nikula wrote:
> > -	return false;
> > +	return;
> 
> Okay this went in already, but I find return statements at the end of
> void functions like that a bit silly...
> 
> ...but hey, you can send a fix removing that! ;)

Sigh, will do, thanks for pointed it out. 

-- 
Damien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-03 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28 11:30 [PATCH] drm/i915: Make intel_dsi_init() return void Damien Lespiau
2014-05-28 13:00 ` Daniel Vetter
2014-06-03 12:05 ` Jani Nikula
2014-06-03 12:50   ` Damien Lespiau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox