Skip to content

Commit d95e92e

Browse files
committed
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
1 parent 0872fee commit d95e92e

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/gpu/drm/ast/ast_ddc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
static void ast_i2c_setsda(void *i2c_priv, int data)
3131
{
3232
struct ast_ddc *ddc = i2c_priv;
33-
struct ast_device *ast = to_ast_device(ddc->dev);
33+
struct ast_device *ast = ddc->ast;
3434
int i;
3535
u8 ujcrb7, jtemp;
3636

@@ -46,7 +46,7 @@ static void ast_i2c_setsda(void *i2c_priv, int data)
4646
static void ast_i2c_setscl(void *i2c_priv, int clock)
4747
{
4848
struct ast_ddc *ddc = i2c_priv;
49-
struct ast_device *ast = to_ast_device(ddc->dev);
49+
struct ast_device *ast = ddc->ast;
5050
int i;
5151
u8 ujcrb7, jtemp;
5252

@@ -62,7 +62,7 @@ static void ast_i2c_setscl(void *i2c_priv, int clock)
6262
static int ast_i2c_getsda(void *i2c_priv)
6363
{
6464
struct ast_ddc *ddc = i2c_priv;
65-
struct ast_device *ast = to_ast_device(ddc->dev);
65+
struct ast_device *ast = ddc->ast;
6666
uint32_t val, val2, count, pass;
6767

6868
count = 0;
@@ -84,7 +84,7 @@ static int ast_i2c_getsda(void *i2c_priv)
8484
static int ast_i2c_getscl(void *i2c_priv)
8585
{
8686
struct ast_ddc *ddc = i2c_priv;
87-
struct ast_device *ast = to_ast_device(ddc->dev);
87+
struct ast_device *ast = ddc->ast;
8888
uint32_t val, val2, count, pass;
8989

9090
count = 0;
@@ -121,7 +121,7 @@ struct ast_ddc *ast_ddc_create(struct ast_device *ast)
121121
ddc = drmm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL);
122122
if (!ddc)
123123
return ERR_PTR(-ENOMEM);
124-
ddc->dev = dev;
124+
ddc->ast = ast;
125125

126126
adapter = &ddc->adapter;
127127
adapter->owner = THIS_MODULE;

drivers/gpu/drm/ast/ast_ddc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include <linux/i2c-algo-bit.h>
88

99
struct ast_device;
10-
struct drm_device;
1110

1211
struct ast_ddc {
12+
struct ast_device *ast;
13+
1314
struct i2c_adapter adapter;
14-
struct drm_device *dev;
1515
struct i2c_algo_bit_data bit;
1616
};
1717

0 commit comments

Comments
 (0)