Re: [PATCH 15/21] drm/omap: Remove unneeded safety checks in the HPD operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Jun 06, 2018 at 12:36:44PM +0300, Laurent Pinchart wrote:
> The HPD-related omap_dss_device operations are now only called when the
> device supports HPD. There's no need to duplicate that check in the
> omap_dss_device drivers. The .register_hpd_cb() operation can as a
> result be turned into a void operation.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx>

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c     |  9 +--------
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c    | 14 +++-----------
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c |  8 +++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h                |  6 +++---
>  drivers/gpu/drm/omapdrm/omap_connector.c             | 17 ++++-------------
>  5 files changed, 14 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index e9353e4cd297..a53d5967e5a9 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -211,30 +211,23 @@ static bool dvic_detect(struct omap_dss_device *dssdev)
>  	return r == 0;
>  }
>  
> -static int dvic_register_hpd_cb(struct omap_dss_device *dssdev,
> +static void dvic_register_hpd_cb(struct omap_dss_device *dssdev,
>  				 void (*cb)(void *cb_data,
>  					    enum drm_connector_status status),
>  				 void *cb_data)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  
> -	if (!ddata->hpd_gpio)
> -		return -ENOTSUPP;
> -
>  	mutex_lock(&ddata->hpd_lock);
>  	ddata->hpd_cb = cb;
>  	ddata->hpd_cb_data = cb_data;
>  	mutex_unlock(&ddata->hpd_lock);
> -	return 0;
>  }
>  
>  static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  
> -	if (!ddata->hpd_gpio)
> -		return;
> -
>  	mutex_lock(&ddata->hpd_lock);
>  	ddata->hpd_cb = NULL;
>  	ddata->hpd_cb_data = NULL;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 8eae973474dd..c58bf64d1a9b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -147,31 +147,23 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
>  	return connected;
>  }
>  
> -static int hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
> -				 void (*cb)(void *cb_data,
> +static void hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
> +				  void (*cb)(void *cb_data,
>  					    enum drm_connector_status status),
> -				 void *cb_data)
> +				  void *cb_data)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  
> -	if (!ddata->hpd_gpio)
> -		return -ENOTSUPP;
> -
>  	mutex_lock(&ddata->hpd_lock);
>  	ddata->hpd_cb = cb;
>  	ddata->hpd_cb_data = cb_data;
>  	mutex_unlock(&ddata->hpd_lock);
> -
> -	return 0;
>  }
>  
>  static void hdmic_unregister_hpd_cb(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  
> -	if (!ddata->hpd_gpio)
> -		return;
> -
>  	mutex_lock(&ddata->hpd_lock);
>  	ddata->hpd_cb = NULL;
>  	ddata->hpd_cb_data = NULL;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index e5a25baa0364..7a6cac5b29e1 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -140,10 +140,10 @@ static bool tpd_detect(struct omap_dss_device *dssdev)
>  	return connected;
>  }
>  
> -static int tpd_register_hpd_cb(struct omap_dss_device *dssdev,
> -			       void (*cb)(void *cb_data,
> +static void tpd_register_hpd_cb(struct omap_dss_device *dssdev,
> +				void (*cb)(void *cb_data,
>  					  enum drm_connector_status status),
> -			       void *cb_data)
> +				void *cb_data)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  
> @@ -151,8 +151,6 @@ static int tpd_register_hpd_cb(struct omap_dss_device *dssdev,
>  	ddata->hpd_cb = cb;
>  	ddata->hpd_cb_data = cb_data;
>  	mutex_unlock(&ddata->hpd_lock);
> -
> -	return 0;
>  }
>  
>  static void tpd_unregister_hpd_cb(struct omap_dss_device *dssdev)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index e9a47d8c0edc..d7e06883f95c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -372,10 +372,10 @@ struct omap_dss_device_ops {
>  
>  	bool (*detect)(struct omap_dss_device *dssdev);
>  
> -	int (*register_hpd_cb)(struct omap_dss_device *dssdev,
> -			       void (*cb)(void *cb_data,
> +	void (*register_hpd_cb)(struct omap_dss_device *dssdev,
> +				void (*cb)(void *cb_data,
>  					  enum drm_connector_status status),
> -			       void *cb_data);
> +				void *cb_data);
>  	void (*unregister_hpd_cb)(struct omap_dss_device *dssdev);
>  	void (*enable_hpd)(struct omap_dss_device *dssdev);
>  	void (*disable_hpd)(struct omap_dss_device *dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> index 578b0b105755..ba9a3dfec33e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -299,19 +299,10 @@ struct drm_connector *omap_connector_init(struct drm_device *dev,
>  	 */
>  	dssdev = omap_connector_find_device(connector, OMAP_DSS_DEVICE_OP_HPD);
>  	if (dssdev) {
> -		int ret;
> -
> -		ret = dssdev->ops->register_hpd_cb(dssdev,
> -						   omap_connector_hpd_cb,
> -						   omap_connector);
> -		if (ret < 0)
> -			DBG("%s: Failed to register HPD callback (%d).",
> -			    dssdev->name, ret);
> -		else
> -			connector->polled = DRM_CONNECTOR_POLL_HPD;
> -	}
> -
> -	if (!connector->polled) {
> +		dssdev->ops->register_hpd_cb(dssdev, omap_connector_hpd_cb,
> +					     omap_connector);
> +		connector->polled = DRM_CONNECTOR_POLL_HPD;
> +	} else {
>  		dssdev = omap_connector_find_device(connector,
>  						    OMAP_DSS_DEVICE_OP_DETECT);
>  		if (dssdev)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux