mirror of
https://github.com/torvalds/linux.git
synced 2026-04-24 01:25:49 -04:00
amdgpu/dc: remove pointless returns in the i2caux constructor paths. (v2)
There was lots of return true, and error checking that was never used in these paths. Just remove it all. v2: I missed one return true. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
4179cd8137
commit
b08c3ca4e9
@@ -426,22 +426,16 @@ static const struct engine_funcs engine_funcs = {
|
||||
.acquire = dal_aux_engine_acquire,
|
||||
};
|
||||
|
||||
static bool construct(
|
||||
static void construct(
|
||||
struct aux_engine_dce110 *engine,
|
||||
const struct aux_engine_dce110_init_data *aux_init_data)
|
||||
{
|
||||
if (!dal_aux_engine_construct(
|
||||
&engine->base, aux_init_data->ctx)) {
|
||||
ASSERT_CRITICAL(false);
|
||||
return false;
|
||||
}
|
||||
dal_aux_engine_construct(&engine->base, aux_init_data->ctx);
|
||||
engine->base.base.funcs = &engine_funcs;
|
||||
engine->base.funcs = &aux_engine_funcs;
|
||||
|
||||
engine->timeout_period = aux_init_data->timeout_period;
|
||||
engine->regs = aux_init_data->regs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void destruct(
|
||||
@@ -471,12 +465,6 @@ struct aux_engine *dal_aux_engine_dce110_create(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (construct(engine, aux_init_data))
|
||||
return &engine->base;
|
||||
|
||||
ASSERT_CRITICAL(false);
|
||||
|
||||
kfree(engine);
|
||||
|
||||
return NULL;
|
||||
construct(engine, aux_init_data);
|
||||
return &engine->base;
|
||||
}
|
||||
|
||||
@@ -498,17 +498,13 @@ static const struct i2c_hw_engine_funcs i2c_hw_engine_funcs = {
|
||||
.wait_on_operation_result = dal_i2c_hw_engine_wait_on_operation_result,
|
||||
};
|
||||
|
||||
bool i2c_hw_engine_dce110_construct(
|
||||
static void construct(
|
||||
struct i2c_hw_engine_dce110 *hw_engine,
|
||||
const struct i2c_hw_engine_dce110_create_arg *arg)
|
||||
{
|
||||
uint32_t xtal_ref_div = 0;
|
||||
|
||||
if (!arg->reference_frequency)
|
||||
return false;
|
||||
|
||||
if (!dal_i2c_hw_engine_construct(&hw_engine->base, arg->ctx))
|
||||
return false;
|
||||
dal_i2c_hw_engine_construct(&hw_engine->base, arg->ctx);
|
||||
|
||||
hw_engine->base.base.base.funcs = &engine_funcs;
|
||||
hw_engine->base.base.funcs = &i2c_engine_funcs;
|
||||
@@ -545,8 +541,6 @@ bool i2c_hw_engine_dce110_construct(
|
||||
*/
|
||||
hw_engine->reference_frequency =
|
||||
(arg->reference_frequency * 2) / xtal_ref_div;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct i2c_engine *dal_i2c_hw_engine_dce110_create(
|
||||
@@ -558,6 +552,10 @@ struct i2c_engine *dal_i2c_hw_engine_dce110_create(
|
||||
ASSERT_CRITICAL(false);
|
||||
return NULL;
|
||||
}
|
||||
if (!arg->reference_frequency) {
|
||||
ASSERT_CRITICAL(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
engine_dce10 = kzalloc(sizeof(struct i2c_hw_engine_dce110),
|
||||
GFP_KERNEL);
|
||||
@@ -567,12 +565,6 @@ struct i2c_engine *dal_i2c_hw_engine_dce110_create(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (i2c_hw_engine_dce110_construct(engine_dce10, arg))
|
||||
return &engine_dce10->base.base;
|
||||
|
||||
ASSERT_CRITICAL(false);
|
||||
|
||||
kfree(engine_dce10);
|
||||
|
||||
return NULL;
|
||||
construct(engine_dce10, arg);
|
||||
return &engine_dce10->base.base;
|
||||
}
|
||||
|
||||
@@ -207,8 +207,4 @@ struct i2c_hw_engine_dce110_create_arg {
|
||||
struct i2c_engine *dal_i2c_hw_engine_dce110_create(
|
||||
const struct i2c_hw_engine_dce110_create_arg *arg);
|
||||
|
||||
bool i2c_hw_engine_dce110_construct(
|
||||
struct i2c_hw_engine_dce110 *engine_dce110,
|
||||
const struct i2c_hw_engine_dce110_create_arg *arg);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -118,7 +118,7 @@ static const struct engine_funcs engine_funcs = {
|
||||
.submit_request = dal_i2c_sw_engine_submit_request,
|
||||
};
|
||||
|
||||
static bool construct(
|
||||
static void construct(
|
||||
struct i2c_sw_engine_dce110 *engine_dce110,
|
||||
const struct i2c_sw_engine_dce110_create_arg *arg_dce110)
|
||||
{
|
||||
@@ -127,11 +127,7 @@ static bool construct(
|
||||
arg_base.ctx = arg_dce110->ctx;
|
||||
arg_base.default_speed = arg_dce110->default_speed;
|
||||
|
||||
if (!dal_i2c_sw_engine_construct(
|
||||
&engine_dce110->base, &arg_base)) {
|
||||
ASSERT_CRITICAL(false);
|
||||
return false;
|
||||
}
|
||||
dal_i2c_sw_engine_construct(&engine_dce110->base, &arg_base);
|
||||
|
||||
/*struct engine struct engine_funcs*/
|
||||
engine_dce110->base.base.base.funcs = &engine_funcs;
|
||||
@@ -139,8 +135,6 @@ static bool construct(
|
||||
engine_dce110->base.base.funcs = &i2c_engine_funcs;
|
||||
engine_dce110->base.default_speed = arg_dce110->default_speed;
|
||||
engine_dce110->engine_id = arg_dce110->engine_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct i2c_engine *dal_i2c_sw_engine_dce110_create(
|
||||
@@ -161,12 +155,6 @@ struct i2c_engine *dal_i2c_sw_engine_dce110_create(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (construct(engine_dce110, arg))
|
||||
return &engine_dce110->base.base;
|
||||
|
||||
ASSERT_CRITICAL(false);
|
||||
|
||||
kfree(engine_dce110);
|
||||
|
||||
return NULL;
|
||||
construct(engine_dce110, arg);
|
||||
return &engine_dce110->base.base;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ static const struct dce110_i2c_hw_engine_mask i2c_mask = {
|
||||
I2C_COMMON_MASK_SH_LIST_DCE110(_MASK)
|
||||
};
|
||||
|
||||
bool dal_i2caux_dce110_construct(
|
||||
void dal_i2caux_dce110_construct(
|
||||
struct i2caux_dce110 *i2caux_dce110,
|
||||
struct dc_context *ctx,
|
||||
const struct dce110_aux_registers aux_regs[],
|
||||
@@ -217,10 +217,7 @@ bool dal_i2caux_dce110_construct(
|
||||
|
||||
base = &i2caux_dce110->base;
|
||||
|
||||
if (!dal_i2caux_construct(base, ctx)) {
|
||||
ASSERT_CRITICAL(false);
|
||||
return false;
|
||||
}
|
||||
dal_i2caux_construct(base, ctx);
|
||||
|
||||
i2caux_dce110->base.funcs = &i2caux_funcs;
|
||||
i2caux_dce110->i2c_hw_buffer_in_use = false;
|
||||
@@ -278,8 +275,6 @@ bool dal_i2caux_dce110_construct(
|
||||
} while (i < ARRAY_SIZE(hw_aux_lines));
|
||||
|
||||
/*TODO Generic I2C SW and HW*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -306,18 +301,11 @@ struct i2caux *dal_i2caux_dce110_create(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dal_i2caux_dce110_construct(
|
||||
i2caux_dce110,
|
||||
ctx,
|
||||
dce110_aux_regs,
|
||||
i2c_hw_engine_regs,
|
||||
&i2c_shift,
|
||||
&i2c_mask))
|
||||
return &i2caux_dce110->base;
|
||||
|
||||
ASSERT_CRITICAL(false);
|
||||
|
||||
kfree(i2caux_dce110);
|
||||
|
||||
return NULL;
|
||||
dal_i2caux_dce110_construct(i2caux_dce110,
|
||||
ctx,
|
||||
dce110_aux_regs,
|
||||
i2c_hw_engine_regs,
|
||||
&i2c_shift,
|
||||
&i2c_mask);
|
||||
return &i2caux_dce110->base;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ struct dce110_i2c_hw_engine_mask;
|
||||
struct i2caux *dal_i2caux_dce110_create(
|
||||
struct dc_context *ctx);
|
||||
|
||||
bool dal_i2caux_dce110_construct(
|
||||
void dal_i2caux_dce110_construct(
|
||||
struct i2caux_dce110 *i2caux_dce110,
|
||||
struct dc_context *ctx,
|
||||
const struct dce110_aux_registers *aux_regs,
|
||||
|
||||
Reference in New Issue
Block a user