Commit d95e92e1 authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarSui Jingfeng <sui.jingfeng@linux.dev>
Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240325200855.21150-9-tzimmermann@suse.de
parent 0872fee2
......@@ -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;
......
......@@ -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;
};
......
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