[Intel-gfx] [PATCH v2 2/7] drm/i915: make g4x_digital_port_connected return boolean status
R, Durgadoss
durgadoss.r at intel.com
Thu Aug 20 01:17:29 PDT 2015
>-----Original Message-----
>From: Nikula, Jani
>Sent: Thursday, August 20, 2015 1:18 PM
>To: intel-gfx at lists.freedesktop.org
>Cc: R, Durgadoss; Ville Syrjälä; Nikula, Jani
>Subject: [PATCH v2 2/7] drm/i915: make g4x_digital_port_connected return boolean status
>
>We should not be hitting any of the default cases in
>g4x_digital_port_connected, so add MISSING_CASE annotation and return
>boolean status. The current behaviour is just cargo culting from the
>days of yonder when the display port support was added to i915.
>
Reviewed-by: Durgadoss R <durgadoss.r at intel.com>
Thanks,
Durga
>Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>---
> drivers/gpu/drm/i915/intel_dp.c | 26 +++++++++++---------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>index 4aa3d664765b..d35dc0711f9b 100644
>--- a/drivers/gpu/drm/i915/intel_dp.c
>+++ b/drivers/gpu/drm/i915/intel_dp.c
>@@ -4518,14 +4518,14 @@ static bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
> return I915_READ(SDEISR) & bit;
> }
>
>-static int g4x_digital_port_connected(struct drm_device *dev,
>- struct intel_digital_port *intel_dig_port)
>+static bool g4x_digital_port_connected(struct drm_device *dev,
>+ struct intel_digital_port *port)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> uint32_t bit;
>
> if (IS_VALLEYVIEW(dev)) {
>- switch (intel_dig_port->port) {
>+ switch (port->port) {
> case PORT_B:
> bit = PORTB_HOTPLUG_LIVE_STATUS_VLV;
> break;
>@@ -4536,10 +4536,11 @@ static int g4x_digital_port_connected(struct drm_device *dev,
> bit = PORTD_HOTPLUG_LIVE_STATUS_VLV;
> break;
> default:
>- return -EINVAL;
>+ MISSING_CASE(port->port);
>+ return false;
> }
> } else {
>- switch (intel_dig_port->port) {
>+ switch (port->port) {
> case PORT_B:
> bit = PORTB_HOTPLUG_LIVE_STATUS_G4X;
> break;
>@@ -4550,13 +4551,12 @@ static int g4x_digital_port_connected(struct drm_device *dev,
> bit = PORTD_HOTPLUG_LIVE_STATUS_G4X;
> break;
> default:
>- return -EINVAL;
>+ MISSING_CASE(port->port);
>+ return false;
> }
> }
>
>- if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
>- return 0;
>- return 1;
>+ return I915_READ(PORT_HOTPLUG_STAT) & bit;
> }
>
> static enum drm_connector_status
>@@ -4577,7 +4577,6 @@ g4x_dp_detect(struct intel_dp *intel_dp)
> {
> struct drm_device *dev = intel_dp_to_dev(intel_dp);
> struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
>- int ret;
>
> /* Can't disconnect eDP, but you can close the lid... */
> if (is_edp(intel_dp)) {
>@@ -4589,10 +4588,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
> return status;
> }
>
>- ret = g4x_digital_port_connected(dev, intel_dig_port);
>- if (ret == -EINVAL)
>- return connector_status_unknown;
>- else if (ret == 0)
>+ if (!g4x_digital_port_connected(dev, intel_dig_port))
> return connector_status_disconnected;
>
> return intel_dp_detect_dpcd(intel_dp);
>@@ -5059,7 +5055,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
> if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
> goto mst_fail;
> } else {
>- if (g4x_digital_port_connected(dev, intel_dig_port) != 1)
>+ if (!g4x_digital_port_connected(dev, intel_dig_port))
> goto mst_fail;
> }
>
>--
>2.1.4
More information about the Intel-gfx
mailing list