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

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
...@@ -211,30 +211,23 @@ static bool dvic_detect(struct omap_dss_device *dssdev) ...@@ -211,30 +211,23 @@ static bool dvic_detect(struct omap_dss_device *dssdev)
return r == 0; 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, void (*cb)(void *cb_data,
enum drm_connector_status status), enum drm_connector_status status),
void *cb_data) void *cb_data)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return -ENOTSUPP;
mutex_lock(&ddata->hpd_lock); mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = cb; ddata->hpd_cb = cb;
ddata->hpd_cb_data = cb_data; ddata->hpd_cb_data = cb_data;
mutex_unlock(&ddata->hpd_lock); mutex_unlock(&ddata->hpd_lock);
return 0;
} }
static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev) static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return;
mutex_lock(&ddata->hpd_lock); mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = NULL; ddata->hpd_cb = NULL;
ddata->hpd_cb_data = NULL; ddata->hpd_cb_data = NULL;
......
...@@ -147,31 +147,23 @@ static bool hdmic_detect(struct omap_dss_device *dssdev) ...@@ -147,31 +147,23 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
return connected; 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, void (*cb)(void *cb_data,
enum drm_connector_status status), enum drm_connector_status status),
void *cb_data) void *cb_data)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return -ENOTSUPP;
mutex_lock(&ddata->hpd_lock); mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = cb; ddata->hpd_cb = cb;
ddata->hpd_cb_data = cb_data; ddata->hpd_cb_data = cb_data;
mutex_unlock(&ddata->hpd_lock); mutex_unlock(&ddata->hpd_lock);
return 0;
} }
static void hdmic_unregister_hpd_cb(struct omap_dss_device *dssdev) static void hdmic_unregister_hpd_cb(struct omap_dss_device *dssdev)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
if (!ddata->hpd_gpio)
return;
mutex_lock(&ddata->hpd_lock); mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = NULL; ddata->hpd_cb = NULL;
ddata->hpd_cb_data = NULL; ddata->hpd_cb_data = NULL;
......
...@@ -140,10 +140,10 @@ static bool tpd_detect(struct omap_dss_device *dssdev) ...@@ -140,10 +140,10 @@ static bool tpd_detect(struct omap_dss_device *dssdev)
return connected; 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, void (*cb)(void *cb_data,
enum drm_connector_status status), enum drm_connector_status status),
void *cb_data) void *cb_data)
{ {
struct panel_drv_data *ddata = to_panel_data(dssdev); struct panel_drv_data *ddata = to_panel_data(dssdev);
...@@ -151,8 +151,6 @@ static int tpd_register_hpd_cb(struct omap_dss_device *dssdev, ...@@ -151,8 +151,6 @@ static int tpd_register_hpd_cb(struct omap_dss_device *dssdev,
ddata->hpd_cb = cb; ddata->hpd_cb = cb;
ddata->hpd_cb_data = cb_data; ddata->hpd_cb_data = cb_data;
mutex_unlock(&ddata->hpd_lock); mutex_unlock(&ddata->hpd_lock);
return 0;
} }
static void tpd_unregister_hpd_cb(struct omap_dss_device *dssdev) static void tpd_unregister_hpd_cb(struct omap_dss_device *dssdev)
......
...@@ -372,10 +372,10 @@ struct omap_dss_device_ops { ...@@ -372,10 +372,10 @@ struct omap_dss_device_ops {
bool (*detect)(struct omap_dss_device *dssdev); 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, void (*cb)(void *cb_data,
enum drm_connector_status status), enum drm_connector_status status),
void *cb_data); void *cb_data);
void (*unregister_hpd_cb)(struct omap_dss_device *dssdev); void (*unregister_hpd_cb)(struct omap_dss_device *dssdev);
void (*enable_hpd)(struct omap_dss_device *dssdev); void (*enable_hpd)(struct omap_dss_device *dssdev);
void (*disable_hpd)(struct omap_dss_device *dssdev); void (*disable_hpd)(struct omap_dss_device *dssdev);
......
...@@ -298,19 +298,10 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, ...@@ -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); dssdev = omap_connector_find_device(connector, OMAP_DSS_DEVICE_OP_HPD);
if (dssdev) { if (dssdev) {
int ret; dssdev->ops->register_hpd_cb(dssdev, omap_connector_hpd_cb,
omap_connector);
ret = dssdev->ops->register_hpd_cb(dssdev, connector->polled = DRM_CONNECTOR_POLL_HPD;
omap_connector_hpd_cb, } else {
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 = omap_connector_find_device(connector, dssdev = omap_connector_find_device(connector,
OMAP_DSS_DEVICE_OP_DETECT); OMAP_DSS_DEVICE_OP_DETECT);
if (dssdev) if (dssdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment