The DDC code needs the AST device. Store a pointer in struct ast_ddc and avoid internal upcasts. Improves type safety within the DDC code. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- drivers/gpu/drm/ast/ast_ddc.c | 10 +++++----- drivers/gpu/drm/ast/ast_ddc.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_ddc.c b/drivers/gpu/drm/ast/ast_ddc.c index 24b7d589f0d4c..47670285fd765 100644 --- a/drivers/gpu/drm/ast/ast_ddc.c +++ b/drivers/gpu/drm/ast/ast_ddc.c @@ -30,7 +30,7 @@ static void ast_i2c_setsda(void *i2c_priv, int data) { struct ast_ddc *ddc = i2c_priv; - struct ast_device *ast = to_ast_device(ddc->dev); + struct ast_device *ast = ddc->ast; int i; u8 ujcrb7, jtemp; @@ -46,7 +46,7 @@ static void ast_i2c_setsda(void *i2c_priv, int data) static void ast_i2c_setscl(void *i2c_priv, int clock) { struct ast_ddc *ddc = i2c_priv; - struct ast_device *ast = to_ast_device(ddc->dev); + struct ast_device *ast = ddc->ast; int i; u8 ujcrb7, jtemp; @@ -62,7 +62,7 @@ static void ast_i2c_setscl(void *i2c_priv, int clock) static int ast_i2c_getsda(void *i2c_priv) { struct ast_ddc *ddc = i2c_priv; - struct ast_device *ast = to_ast_device(ddc->dev); + struct ast_device *ast = ddc->ast; uint32_t val, val2, count, pass; count = 0; @@ -84,7 +84,7 @@ static int ast_i2c_getsda(void *i2c_priv) static int ast_i2c_getscl(void *i2c_priv) { struct ast_ddc *ddc = i2c_priv; - struct ast_device *ast = to_ast_device(ddc->dev); + struct ast_device *ast = ddc->ast; uint32_t val, val2, count, pass; count = 0; @@ -121,7 +121,7 @@ struct ast_ddc *ast_ddc_create(struct ast_device *ast) ddc = drmm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL); if (!ddc) return ERR_PTR(-ENOMEM); - ddc->dev = dev; + ddc->ast = ast; adapter = &ddc->adapter; adapter->owner = THIS_MODULE; diff --git a/drivers/gpu/drm/ast/ast_ddc.h b/drivers/gpu/drm/ast/ast_ddc.h index d423b144a3458..08f3994e09ccd 100644 --- a/drivers/gpu/drm/ast/ast_ddc.h +++ b/drivers/gpu/drm/ast/ast_ddc.h @@ -7,11 +7,11 @@ #include <linux/i2c-algo-bit.h> struct ast_device; -struct drm_device; struct ast_ddc { + struct ast_device *ast; + struct i2c_adapter adapter; - struct drm_device *dev; struct i2c_algo_bit_data bit; }; -- 2.44.0