提交 76767fda 编写于 作者: R Russell King

drm/i2c: tda998x: cleanup from previous changes

Cleanup the code a little from the effects of the previous changes:
- Move tda998x_destroy() to be above tda998x_create()
- Use 'dev' directly in tda998x_create() where appropriate.
Tested-by: NPeter Rosin <peda@axentia.se>
Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
上级 2143adb0
...@@ -1576,31 +1576,6 @@ static const struct drm_bridge_funcs tda998x_bridge_funcs = { ...@@ -1576,31 +1576,6 @@ static const struct drm_bridge_funcs tda998x_bridge_funcs = {
.enable = tda998x_bridge_enable, .enable = tda998x_bridge_enable,
}; };
static void tda998x_destroy(struct device *dev)
{
struct tda998x_priv *priv = dev_get_drvdata(dev);
drm_bridge_remove(&priv->bridge);
/* disable all IRQs and free the IRQ handler */
cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
if (priv->audio_pdev)
platform_device_unregister(priv->audio_pdev);
if (priv->hdmi->irq)
free_irq(priv->hdmi->irq, priv);
del_timer_sync(&priv->edid_delay_timer);
cancel_work_sync(&priv->detect_work);
i2c_unregister_device(priv->cec);
if (priv->cec_notify)
cec_notifier_put(priv->cec_notify);
}
/* I2C driver functions */ /* I2C driver functions */
static int tda998x_get_audio_ports(struct tda998x_priv *priv, static int tda998x_get_audio_ports(struct tda998x_priv *priv,
...@@ -1664,6 +1639,31 @@ static void tda998x_set_config(struct tda998x_priv *priv, ...@@ -1664,6 +1639,31 @@ static void tda998x_set_config(struct tda998x_priv *priv,
priv->audio_params = p->audio_params; priv->audio_params = p->audio_params;
} }
static void tda998x_destroy(struct device *dev)
{
struct tda998x_priv *priv = dev_get_drvdata(dev);
drm_bridge_remove(&priv->bridge);
/* disable all IRQs and free the IRQ handler */
cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
if (priv->audio_pdev)
platform_device_unregister(priv->audio_pdev);
if (priv->hdmi->irq)
free_irq(priv->hdmi->irq, priv);
del_timer_sync(&priv->edid_delay_timer);
cancel_work_sync(&priv->detect_work);
i2c_unregister_device(priv->cec);
if (priv->cec_notify)
cec_notifier_put(priv->cec_notify);
}
static int tda998x_create(struct device *dev) static int tda998x_create(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
...@@ -1705,13 +1705,13 @@ static int tda998x_create(struct device *dev) ...@@ -1705,13 +1705,13 @@ static int tda998x_create(struct device *dev)
/* read version: */ /* read version: */
rev_lo = reg_read(priv, REG_VERSION_LSB); rev_lo = reg_read(priv, REG_VERSION_LSB);
if (rev_lo < 0) { if (rev_lo < 0) {
dev_err(&client->dev, "failed to read version: %d\n", rev_lo); dev_err(dev, "failed to read version: %d\n", rev_lo);
return rev_lo; return rev_lo;
} }
rev_hi = reg_read(priv, REG_VERSION_MSB); rev_hi = reg_read(priv, REG_VERSION_MSB);
if (rev_hi < 0) { if (rev_hi < 0) {
dev_err(&client->dev, "failed to read version: %d\n", rev_hi); dev_err(dev, "failed to read version: %d\n", rev_hi);
return rev_hi; return rev_hi;
} }
...@@ -1722,20 +1722,19 @@ static int tda998x_create(struct device *dev) ...@@ -1722,20 +1722,19 @@ static int tda998x_create(struct device *dev)
switch (priv->rev) { switch (priv->rev) {
case TDA9989N2: case TDA9989N2:
dev_info(&client->dev, "found TDA9989 n2"); dev_info(dev, "found TDA9989 n2");
break; break;
case TDA19989: case TDA19989:
dev_info(&client->dev, "found TDA19989"); dev_info(dev, "found TDA19989");
break; break;
case TDA19989N2: case TDA19989N2:
dev_info(&client->dev, "found TDA19989 n2"); dev_info(dev, "found TDA19989 n2");
break; break;
case TDA19988: case TDA19988:
dev_info(&client->dev, "found TDA19988"); dev_info(dev, "found TDA19988");
break; break;
default: default:
dev_err(&client->dev, "found unsupported device: %04x\n", dev_err(dev, "found unsupported device: %04x\n", priv->rev);
priv->rev);
return -ENXIO; return -ENXIO;
} }
...@@ -1778,8 +1777,7 @@ static int tda998x_create(struct device *dev) ...@@ -1778,8 +1777,7 @@ static int tda998x_create(struct device *dev)
tda998x_irq_thread, irq_flags, tda998x_irq_thread, irq_flags,
"tda998x", priv); "tda998x", priv);
if (ret) { if (ret) {
dev_err(&client->dev, dev_err(dev, "failed to request IRQ#%u: %d\n",
"failed to request IRQ#%u: %d\n",
client->irq, ret); client->irq, ret);
goto err_irq; goto err_irq;
} }
...@@ -1788,13 +1786,13 @@ static int tda998x_create(struct device *dev) ...@@ -1788,13 +1786,13 @@ static int tda998x_create(struct device *dev)
cec_write(priv, REG_CEC_RXSHPDINTENA, CEC_RXSHPDLEV_HPD); cec_write(priv, REG_CEC_RXSHPDINTENA, CEC_RXSHPDLEV_HPD);
} }
priv->cec_notify = cec_notifier_get(&client->dev); priv->cec_notify = cec_notifier_get(dev);
if (!priv->cec_notify) { if (!priv->cec_notify) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
} }
priv->cec_glue.parent = &client->dev; priv->cec_glue.parent = dev;
priv->cec_glue.data = priv; priv->cec_glue.data = priv;
priv->cec_glue.init = tda998x_cec_hook_init; priv->cec_glue.init = tda998x_cec_hook_init;
priv->cec_glue.exit = tda998x_cec_hook_exit; priv->cec_glue.exit = tda998x_cec_hook_exit;
...@@ -1839,8 +1837,8 @@ static int tda998x_create(struct device *dev) ...@@ -1839,8 +1837,8 @@ static int tda998x_create(struct device *dev)
if (priv->audio_port[0].format != AFMT_UNUSED) if (priv->audio_port[0].format != AFMT_UNUSED)
tda998x_audio_codec_init(priv, &client->dev); tda998x_audio_codec_init(priv, &client->dev);
} else if (client->dev.platform_data) { } else if (dev->platform_data) {
tda998x_set_config(priv, client->dev.platform_data); tda998x_set_config(priv, dev->platform_data);
} }
priv->bridge.funcs = &tda998x_bridge_funcs; priv->bridge.funcs = &tda998x_bridge_funcs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册