Commit 7c885f8a authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/ast: Group DDC init code by data structure

Reorder the code to set up the DDC channel by data structure, so
that each data structure's init is in a separate block: first the
bit algo then the i2c adapter. Makes the code more readable. No
functional changes.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240403103325.30457-3-tzimmermann@suse.de
parent c0cd6925
......@@ -145,15 +145,7 @@ struct ast_ddc *ast_ddc_create(struct ast_device *ast)
return ERR_PTR(-ENOMEM);
ddc->ast = ast;
adapter = &ddc->adapter;
adapter->owner = THIS_MODULE;
adapter->dev.parent = dev->dev;
i2c_set_adapdata(adapter, ddc);
snprintf(adapter->name, sizeof(adapter->name), "AST DDC bus");
bit = &ddc->bit;
bit->udelay = 20;
bit->timeout = usecs_to_jiffies(2200);
bit->data = ddc;
bit->setsda = ast_ddc_algo_bit_data_setsda;
bit->setscl = ast_ddc_algo_bit_data_setscl;
......@@ -161,8 +153,16 @@ struct ast_ddc *ast_ddc_create(struct ast_device *ast)
bit->getscl = ast_ddc_algo_bit_data_getscl;
bit->pre_xfer = ast_ddc_algo_bit_data_pre_xfer;
bit->post_xfer = ast_ddc_algo_bit_data_post_xfer;
bit->udelay = 20;
bit->timeout = usecs_to_jiffies(2200);
adapter = &ddc->adapter;
adapter->owner = THIS_MODULE;
adapter->algo_data = bit;
adapter->dev.parent = dev->dev;
snprintf(adapter->name, sizeof(adapter->name), "AST DDC bus");
i2c_set_adapdata(adapter, ddc);
ret = i2c_bit_add_bus(adapter);
if (ret) {
drm_err(dev, "Failed to register bit i2c\n");
......
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