Commit 6b564ad7 authored by Wolfram Sang's avatar Wolfram Sang Committed by Andrzej Hajda

gpu: drm: bridge: sii9234: convert to devm_i2c_new_dummy_device

Move from the deprecated i2c_new_dummy() to devm_i2c_new_dummy_device().
We now get an ERRPTR which we use in error handling and we can skip
removal of the created devices.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191008203322.3238-1-wsa+renesas@sang-engineering.com
parent 64292b33
...@@ -842,39 +842,28 @@ static int sii9234_init_resources(struct sii9234 *ctx, ...@@ -842,39 +842,28 @@ static int sii9234_init_resources(struct sii9234 *ctx,
ctx->client[I2C_MHL] = client; ctx->client[I2C_MHL] = client;
ctx->client[I2C_TPI] = i2c_new_dummy(adapter, I2C_TPI_ADDR); ctx->client[I2C_TPI] = devm_i2c_new_dummy_device(&client->dev, adapter,
if (!ctx->client[I2C_TPI]) { I2C_TPI_ADDR);
if (IS_ERR(ctx->client[I2C_TPI])) {
dev_err(ctx->dev, "failed to create TPI client\n"); dev_err(ctx->dev, "failed to create TPI client\n");
return -ENODEV; return PTR_ERR(ctx->client[I2C_TPI]);
} }
ctx->client[I2C_HDMI] = i2c_new_dummy(adapter, I2C_HDMI_ADDR); ctx->client[I2C_HDMI] = devm_i2c_new_dummy_device(&client->dev, adapter,
if (!ctx->client[I2C_HDMI]) { I2C_HDMI_ADDR);
if (IS_ERR(ctx->client[I2C_HDMI])) {
dev_err(ctx->dev, "failed to create HDMI RX client\n"); dev_err(ctx->dev, "failed to create HDMI RX client\n");
goto fail_tpi; return PTR_ERR(ctx->client[I2C_HDMI]);
} }
ctx->client[I2C_CBUS] = i2c_new_dummy(adapter, I2C_CBUS_ADDR); ctx->client[I2C_CBUS] = devm_i2c_new_dummy_device(&client->dev, adapter,
if (!ctx->client[I2C_CBUS]) { I2C_CBUS_ADDR);
if (IS_ERR(ctx->client[I2C_CBUS])) {
dev_err(ctx->dev, "failed to create CBUS client\n"); dev_err(ctx->dev, "failed to create CBUS client\n");
goto fail_hdmi; return PTR_ERR(ctx->client[I2C_CBUS]);
} }
return 0; return 0;
fail_hdmi:
i2c_unregister_device(ctx->client[I2C_HDMI]);
fail_tpi:
i2c_unregister_device(ctx->client[I2C_TPI]);
return -ENODEV;
}
static void sii9234_deinit_resources(struct sii9234 *ctx)
{
i2c_unregister_device(ctx->client[I2C_CBUS]);
i2c_unregister_device(ctx->client[I2C_HDMI]);
i2c_unregister_device(ctx->client[I2C_TPI]);
} }
static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge) static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
...@@ -951,7 +940,6 @@ static int sii9234_remove(struct i2c_client *client) ...@@ -951,7 +940,6 @@ static int sii9234_remove(struct i2c_client *client)
sii9234_cable_out(ctx); sii9234_cable_out(ctx);
drm_bridge_remove(&ctx->bridge); drm_bridge_remove(&ctx->bridge);
sii9234_deinit_resources(ctx);
return 0; return 0;
} }
......
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