Commit a3584f60 authored by Russell King's avatar Russell King

drm/i2c: tda998x: kill struct tda998x_priv2

Kill the redundant tda998x_priv2 structure now that its only member is
the struct tda998x_priv.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent eed64b59
...@@ -1330,21 +1330,17 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) ...@@ -1330,21 +1330,17 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
return -ENXIO; return -ENXIO;
} }
struct tda998x_priv2 { #define conn_to_tda998x_priv(x) \
struct tda998x_priv base; container_of(x, struct tda998x_priv, connector);
};
#define conn_to_tda998x_priv2(x) \
container_of(x, struct tda998x_priv2, base.connector);
#define enc_to_tda998x_priv2(x) \ #define enc_to_tda998x_priv(x) \
container_of(x, struct tda998x_priv2, base.encoder); container_of(x, struct tda998x_priv, encoder);
static void tda998x_encoder2_dpms(struct drm_encoder *encoder, int mode) static void tda998x_encoder2_dpms(struct drm_encoder *encoder, int mode)
{ {
struct tda998x_priv2 *priv = enc_to_tda998x_priv2(encoder); struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
tda998x_encoder_dpms(&priv->base, mode); tda998x_encoder_dpms(priv, mode);
} }
static void tda998x_encoder_prepare(struct drm_encoder *encoder) static void tda998x_encoder_prepare(struct drm_encoder *encoder)
...@@ -1361,9 +1357,9 @@ static void tda998x_encoder2_mode_set(struct drm_encoder *encoder, ...@@ -1361,9 +1357,9 @@ static void tda998x_encoder2_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode) struct drm_display_mode *adjusted_mode)
{ {
struct tda998x_priv2 *priv = enc_to_tda998x_priv2(encoder); struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
tda998x_encoder_mode_set(&priv->base, mode, adjusted_mode); tda998x_encoder_mode_set(priv, mode, adjusted_mode);
} }
static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = { static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = {
...@@ -1378,9 +1374,9 @@ static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = { ...@@ -1378,9 +1374,9 @@ static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = {
static void tda998x_encoder_destroy(struct drm_encoder *encoder) static void tda998x_encoder_destroy(struct drm_encoder *encoder)
{ {
struct tda998x_priv2 *priv = enc_to_tda998x_priv2(encoder); struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
tda998x_destroy(&priv->base); tda998x_destroy(priv);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
} }
...@@ -1390,25 +1386,25 @@ static const struct drm_encoder_funcs tda998x_encoder_funcs = { ...@@ -1390,25 +1386,25 @@ static const struct drm_encoder_funcs tda998x_encoder_funcs = {
static int tda998x_connector_get_modes(struct drm_connector *connector) static int tda998x_connector_get_modes(struct drm_connector *connector)
{ {
struct tda998x_priv2 *priv = conn_to_tda998x_priv2(connector); struct tda998x_priv *priv = conn_to_tda998x_priv(connector);
return tda998x_encoder_get_modes(&priv->base, connector); return tda998x_encoder_get_modes(priv, connector);
} }
static int tda998x_connector_mode_valid(struct drm_connector *connector, static int tda998x_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct tda998x_priv2 *priv = conn_to_tda998x_priv2(connector); struct tda998x_priv *priv = conn_to_tda998x_priv(connector);
return tda998x_encoder_mode_valid(&priv->base, mode); return tda998x_encoder_mode_valid(priv, mode);
} }
static struct drm_encoder * static struct drm_encoder *
tda998x_connector_best_encoder(struct drm_connector *connector) tda998x_connector_best_encoder(struct drm_connector *connector)
{ {
struct tda998x_priv2 *priv = conn_to_tda998x_priv2(connector); struct tda998x_priv *priv = conn_to_tda998x_priv(connector);
return &priv->base.encoder; return &priv->encoder;
} }
static static
...@@ -1421,9 +1417,9 @@ const struct drm_connector_helper_funcs tda998x_connector_helper_funcs = { ...@@ -1421,9 +1417,9 @@ const struct drm_connector_helper_funcs tda998x_connector_helper_funcs = {
static enum drm_connector_status static enum drm_connector_status
tda998x_connector_detect(struct drm_connector *connector, bool force) tda998x_connector_detect(struct drm_connector *connector, bool force)
{ {
struct tda998x_priv2 *priv = conn_to_tda998x_priv2(connector); struct tda998x_priv *priv = conn_to_tda998x_priv(connector);
return tda998x_encoder_detect(&priv->base); return tda998x_encoder_detect(priv);
} }
static void tda998x_connector_destroy(struct drm_connector *connector) static void tda998x_connector_destroy(struct drm_connector *connector)
...@@ -1444,7 +1440,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) ...@@ -1444,7 +1440,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
struct tda998x_encoder_params *params = dev->platform_data; struct tda998x_encoder_params *params = dev->platform_data;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct drm_device *drm = data; struct drm_device *drm = data;
struct tda998x_priv2 *priv; struct tda998x_priv *priv;
u32 crtcs = 0; u32 crtcs = 0;
int ret; int ret;
...@@ -1463,58 +1459,58 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) ...@@ -1463,58 +1459,58 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
crtcs = 1 << 0; crtcs = 1 << 0;
} }
priv->base.connector.interlace_allowed = 1; priv->connector.interlace_allowed = 1;
priv->base.encoder.possible_crtcs = crtcs; priv->encoder.possible_crtcs = crtcs;
ret = tda998x_create(client, &priv->base); ret = tda998x_create(client, priv);
if (ret) if (ret)
return ret; return ret;
if (!dev->of_node && params) if (!dev->of_node && params)
tda998x_encoder_set_config(&priv->base, params); tda998x_encoder_set_config(priv, params);
tda998x_encoder_set_polling(&priv->base, &priv->base.connector); tda998x_encoder_set_polling(priv, &priv->connector);
drm_encoder_helper_add(&priv->base.encoder, &tda998x_encoder_helper_funcs); drm_encoder_helper_add(&priv->encoder, &tda998x_encoder_helper_funcs);
ret = drm_encoder_init(drm, &priv->base.encoder, &tda998x_encoder_funcs, ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs,
DRM_MODE_ENCODER_TMDS); DRM_MODE_ENCODER_TMDS);
if (ret) if (ret)
goto err_encoder; goto err_encoder;
drm_connector_helper_add(&priv->base.connector, drm_connector_helper_add(&priv->connector,
&tda998x_connector_helper_funcs); &tda998x_connector_helper_funcs);
ret = drm_connector_init(drm, &priv->base.connector, ret = drm_connector_init(drm, &priv->connector,
&tda998x_connector_funcs, &tda998x_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA); DRM_MODE_CONNECTOR_HDMIA);
if (ret) if (ret)
goto err_connector; goto err_connector;
ret = drm_connector_register(&priv->base.connector); ret = drm_connector_register(&priv->connector);
if (ret) if (ret)
goto err_sysfs; goto err_sysfs;
priv->base.connector.encoder = &priv->base.encoder; priv->connector.encoder = &priv->encoder;
drm_mode_connector_attach_encoder(&priv->base.connector, &priv->base.encoder); drm_mode_connector_attach_encoder(&priv->connector, &priv->encoder);
return 0; return 0;
err_sysfs: err_sysfs:
drm_connector_cleanup(&priv->base.connector); drm_connector_cleanup(&priv->connector);
err_connector: err_connector:
drm_encoder_cleanup(&priv->base.encoder); drm_encoder_cleanup(&priv->encoder);
err_encoder: err_encoder:
tda998x_destroy(&priv->base); tda998x_destroy(priv);
return ret; return ret;
} }
static void tda998x_unbind(struct device *dev, struct device *master, static void tda998x_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct tda998x_priv2 *priv = dev_get_drvdata(dev); struct tda998x_priv *priv = dev_get_drvdata(dev);
drm_connector_cleanup(&priv->base.connector); drm_connector_cleanup(&priv->connector);
drm_encoder_cleanup(&priv->base.encoder); drm_encoder_cleanup(&priv->encoder);
tda998x_destroy(&priv->base); tda998x_destroy(priv);
} }
static const struct component_ops tda998x_ops = { static const struct component_ops tda998x_ops = {
......
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