drm/ast: Avoid upcasting to struct ast_device

Several functions receive an instance of struct drm_device only to
upcast it to struct ast_device. Improve type safety by passing the
AST device directly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240911115347.899148-11-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann
2024-09-11 13:51:28 +02:00
parent 0994ea1b27
commit c1779a2346
5 changed files with 21 additions and 27 deletions
+1 -1
View File
@@ -396,7 +396,7 @@ static int ast_drm_thaw(struct drm_device *dev)
ast_enable_vga(ast->ioregs);
ast_open_key(ast->ioregs);
ast_enable_mmio(dev->dev, ast->ioregs);
ast_post_gpu(dev);
ast_post_gpu(ast);
return drm_mode_config_helper_resume(dev);
}
+1 -1
View File
@@ -446,7 +446,7 @@ int ast_mode_config_init(struct ast_device *ast);
int ast_mm_init(struct ast_device *ast);
/* ast post */
void ast_post_gpu(struct drm_device *dev);
void ast_post_gpu(struct ast_device *ast);
u32 ast_mindwm(struct ast_device *ast, u32 r);
void ast_moutdwm(struct ast_device *ast, u32 r, u32 v);
void ast_patch_ahb_2500(void __iomem *regs);
+4 -4
View File
@@ -132,10 +132,10 @@ static void ast_detect_tx_chip(struct ast_device *ast, bool need_post)
drm_info(dev, "Using %s\n", info_str[ast->tx_chip]);
}
static int ast_get_dram_info(struct drm_device *dev)
static int ast_get_dram_info(struct ast_device *ast)
{
struct drm_device *dev = &ast->base;
struct device_node *np = dev->dev->of_node;
struct ast_device *ast = to_ast_device(dev);
uint32_t mcr_cfg, mcr_scu_mpll, mcr_scu_strap;
uint32_t denum, num, div, ref_pll, dsel;
@@ -277,7 +277,7 @@ struct drm_device *ast_device_create(struct pci_dev *pdev,
ast_detect_widescreen(ast);
ast_detect_tx_chip(ast, need_post);
ret = ast_get_dram_info(dev);
ret = ast_get_dram_info(ast);
if (ret)
return ERR_PTR(ret);
@@ -285,7 +285,7 @@ struct drm_device *ast_device_create(struct pci_dev *pdev,
ast->mclk, ast->dram_type, ast->dram_bus_width);
if (need_post)
ast_post_gpu(dev);
ast_post_gpu(ast);
ret = ast_mm_init(ast);
if (ret)
+3 -3
View File
@@ -1287,9 +1287,9 @@ static const struct drm_crtc_funcs ast_crtc_funcs = {
.atomic_destroy_state = ast_crtc_atomic_destroy_state,
};
static int ast_crtc_init(struct drm_device *dev)
static int ast_crtc_init(struct ast_device *ast)
{
struct ast_device *ast = to_ast_device(dev);
struct drm_device *dev = &ast->base;
struct drm_crtc *crtc = &ast->crtc;
int ret;
@@ -1396,7 +1396,7 @@ int ast_mode_config_init(struct ast_device *ast)
if (ret)
return ret;
ret = ast_crtc_init(dev);
ret = ast_crtc_init(ast);
if (ret)
return ret;
+12 -18
View File
@@ -34,16 +34,14 @@
#include "ast_dram_tables.h"
#include "ast_drv.h"
static void ast_post_chip_2300(struct drm_device *dev);
static void ast_post_chip_2500(struct drm_device *dev);
static void ast_post_chip_2300(struct ast_device *ast);
static void ast_post_chip_2500(struct ast_device *ast);
static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff };
static const u8 extreginfo_ast2300[] = { 0x0f, 0x04, 0x1f, 0xff };
static void
ast_set_def_ext_reg(struct drm_device *dev)
static void ast_set_def_ext_reg(struct ast_device *ast)
{
struct ast_device *ast = to_ast_device(dev);
u8 i, index, reg;
const u8 *ext_reg_info;
@@ -252,9 +250,8 @@ cbr_start:
static void ast_init_dram_reg(struct drm_device *dev)
static void ast_init_dram_reg(struct ast_device *ast)
{
struct ast_device *ast = to_ast_device(dev);
u8 j;
u32 data, temp, i;
const struct ast_dramstruct *dram_reg_info;
@@ -343,22 +340,20 @@ static void ast_init_dram_reg(struct drm_device *dev)
} while ((j & 0x40) == 0);
}
void ast_post_gpu(struct drm_device *dev)
void ast_post_gpu(struct ast_device *ast)
{
struct ast_device *ast = to_ast_device(dev);
ast_set_def_ext_reg(dev);
ast_set_def_ext_reg(ast);
if (IS_AST_GEN7(ast)) {
if (ast->tx_chip == AST_TX_ASTDP)
ast_dp_launch(ast);
} else if (ast->config_mode == ast_use_p2a) {
if (IS_AST_GEN6(ast))
ast_post_chip_2500(dev);
ast_post_chip_2500(ast);
else if (IS_AST_GEN5(ast) || IS_AST_GEN4(ast))
ast_post_chip_2300(dev);
ast_post_chip_2300(ast);
else
ast_init_dram_reg(dev);
ast_init_dram_reg(ast);
ast_init_3rdtx(ast);
} else {
@@ -1569,9 +1564,8 @@ ddr2_init_start:
}
static void ast_post_chip_2300(struct drm_device *dev)
static void ast_post_chip_2300(struct ast_device *ast)
{
struct ast_device *ast = to_ast_device(dev);
struct ast2300_dram_param param;
u32 temp;
u8 reg;
@@ -2038,9 +2032,9 @@ void ast_patch_ahb_2500(void __iomem *regs)
__ast_moutdwm(regs, 0x1e6e207c, 0x08000000); /* clear fast reset */
}
void ast_post_chip_2500(struct drm_device *dev)
void ast_post_chip_2500(struct ast_device *ast)
{
struct ast_device *ast = to_ast_device(dev);
struct drm_device *dev = &ast->base;
u32 temp;
u8 reg;