drm/ast: Store AST device in struct ast_ddc

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@suse.de>
Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240325200855.21150-9-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2024-03-25 21:06:53 +01:00
parent 0872fee2e1
commit d95e92e195
2 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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;
};