diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-10-23 11:31:44 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2016-11-18 00:00:40 +0000 |
commit | 02efac0fbfd59a9b9cf57cd09c8bdf5d8471c533 (patch) | |
tree | dcdd77ce51e5f2071908e80315eaa592f41e8920 /drivers/gpu/drm/i2c | |
parent | ad975f9364a3e1beb0909a009671c122b47763cd (diff) |
drm/i2c: tda998x: remove complexity from tda998x_audio_get_eld()
tda998x_audio_get_eld() is needlessly complex - the connector associated
with the encoder is always our own priv->connector. Remove this
complexity, but ensure that there are no races when copying out the ELD.
Tested-by: Jon Medhurst <tixy@linaro.org>
Acked-by: Jon Medhurst <tixy@linaro.org>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/i2c')
-rw-r--r-- | drivers/gpu/drm/i2c/tda998x_drv.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 0f604d2dd1c7..78df92b3e055 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -910,21 +910,13 @@ static int tda998x_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len) { struct tda998x_priv *priv = dev_get_drvdata(dev); - struct drm_mode_config *config = &priv->encoder.dev->mode_config; - struct drm_connector *connector; - int ret = -ENODEV; - - mutex_lock(&config->mutex); - list_for_each_entry(connector, &config->connector_list, head) { - if (&priv->encoder == connector->encoder) { - memcpy(buf, connector->eld, - min(sizeof(connector->eld), len)); - ret = 0; - } - } - mutex_unlock(&config->mutex); - return ret; + mutex_lock(&priv->audio_mutex); + memcpy(buf, priv->connector.eld, + min(sizeof(priv->connector.eld), len)); + mutex_unlock(&priv->audio_mutex); + + return 0; } static const struct hdmi_codec_ops audio_codec_ops = { @@ -975,6 +967,7 @@ static int tda998x_connector_fill_modes(struct drm_connector *connector, struct tda998x_priv *priv = conn_to_tda998x_priv(connector); int ret; + mutex_lock(&priv->audio_mutex); ret = drm_helper_probe_single_connector_modes(connector, maxX, maxY); if (connector->edid_blob_ptr) { @@ -984,6 +977,7 @@ static int tda998x_connector_fill_modes(struct drm_connector *connector, } else { priv->sink_has_audio = false; } + mutex_unlock(&priv->audio_mutex); return ret; } |