Commit a21a8f3c authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

drm/omap: Remove unneeded safety checks in the HPD operations



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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 949ea2ef
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -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;
+3 −11
Original line number Diff line number Diff line
@@ -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,
static void hdmic_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 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;
+3 −5
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ static bool tpd_detect(struct omap_dss_device *dssdev)
	return connected;
}

static int tpd_register_hpd_cb(struct omap_dss_device *dssdev,
static void tpd_register_hpd_cb(struct omap_dss_device *dssdev,
				void (*cb)(void *cb_data,
					  enum drm_connector_status status),
				void *cb_data)
@@ -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)
+3 −3
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ struct omap_dss_device_ops {

	bool (*detect)(struct omap_dss_device *dssdev);

	int (*register_hpd_cb)(struct omap_dss_device *dssdev,
	void (*register_hpd_cb)(struct omap_dss_device *dssdev,
				void (*cb)(void *cb_data,
					  enum drm_connector_status status),
				void *cb_data);
+4 −13
Original line number Diff line number Diff line
@@ -298,19 +298,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,
		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) {
	} else {
		dssdev = omap_connector_find_device(connector,
						    OMAP_DSS_DEVICE_OP_DETECT);
		if (dssdev)