Commit b08c3ca4 authored by Dave Airlie's avatar Dave Airlie Committed by Alex Deucher

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: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4179cd81
...@@ -555,15 +555,13 @@ bool dal_aux_engine_submit_request( ...@@ -555,15 +555,13 @@ bool dal_aux_engine_submit_request(
return result; return result;
} }
bool dal_aux_engine_construct( void dal_aux_engine_construct(
struct aux_engine *engine, struct aux_engine *engine,
struct dc_context *ctx) struct dc_context *ctx)
{ {
if (!dal_i2caux_construct_engine(&engine->base, ctx)) dal_i2caux_construct_engine(&engine->base, ctx);
return false;
engine->delay = 0; engine->delay = 0;
engine->max_defer_write_retry = 0; engine->max_defer_write_retry = 0;
return true;
} }
void dal_aux_engine_destruct( void dal_aux_engine_destruct(
......
...@@ -100,7 +100,7 @@ struct aux_engine { ...@@ -100,7 +100,7 @@ struct aux_engine {
bool acquire_reset; bool acquire_reset;
}; };
bool dal_aux_engine_construct( void dal_aux_engine_construct(
struct aux_engine *engine, struct aux_engine *engine,
struct dc_context *ctx); struct dc_context *ctx);
......
...@@ -95,18 +95,11 @@ struct i2caux *dal_i2caux_dce100_create( ...@@ -95,18 +95,11 @@ struct i2caux *dal_i2caux_dce100_create(
return NULL; return NULL;
} }
if (dal_i2caux_dce110_construct( dal_i2caux_dce110_construct(i2caux_dce110,
i2caux_dce110, ctx,
ctx, dce100_aux_regs,
dce100_aux_regs, dce100_hw_engine_regs,
dce100_hw_engine_regs, &i2c_shift,
&i2c_shift, &i2c_mask);
&i2c_mask)) return &i2caux_dce110->base;
return &i2caux_dce110->base;
ASSERT_CRITICAL(false);
kfree(i2caux_dce110);
return NULL;
} }
...@@ -426,22 +426,16 @@ static const struct engine_funcs engine_funcs = { ...@@ -426,22 +426,16 @@ static const struct engine_funcs engine_funcs = {
.acquire = dal_aux_engine_acquire, .acquire = dal_aux_engine_acquire,
}; };
static bool construct( static void construct(
struct aux_engine_dce110 *engine, struct aux_engine_dce110 *engine,
const struct aux_engine_dce110_init_data *aux_init_data) const struct aux_engine_dce110_init_data *aux_init_data)
{ {
if (!dal_aux_engine_construct( dal_aux_engine_construct(&engine->base, aux_init_data->ctx);
&engine->base, aux_init_data->ctx)) {
ASSERT_CRITICAL(false);
return false;
}
engine->base.base.funcs = &engine_funcs; engine->base.base.funcs = &engine_funcs;
engine->base.funcs = &aux_engine_funcs; engine->base.funcs = &aux_engine_funcs;
engine->timeout_period = aux_init_data->timeout_period; engine->timeout_period = aux_init_data->timeout_period;
engine->regs = aux_init_data->regs; engine->regs = aux_init_data->regs;
return true;
} }
static void destruct( static void destruct(
...@@ -471,12 +465,6 @@ struct aux_engine *dal_aux_engine_dce110_create( ...@@ -471,12 +465,6 @@ struct aux_engine *dal_aux_engine_dce110_create(
return NULL; return NULL;
} }
if (construct(engine, aux_init_data)) construct(engine, aux_init_data);
return &engine->base; return &engine->base;
ASSERT_CRITICAL(false);
kfree(engine);
return NULL;
} }
...@@ -498,17 +498,13 @@ static const struct i2c_hw_engine_funcs i2c_hw_engine_funcs = { ...@@ -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, .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, struct i2c_hw_engine_dce110 *hw_engine,
const struct i2c_hw_engine_dce110_create_arg *arg) const struct i2c_hw_engine_dce110_create_arg *arg)
{ {
uint32_t xtal_ref_div = 0; uint32_t xtal_ref_div = 0;
if (!arg->reference_frequency) dal_i2c_hw_engine_construct(&hw_engine->base, arg->ctx);
return false;
if (!dal_i2c_hw_engine_construct(&hw_engine->base, arg->ctx))
return false;
hw_engine->base.base.base.funcs = &engine_funcs; hw_engine->base.base.base.funcs = &engine_funcs;
hw_engine->base.base.funcs = &i2c_engine_funcs; hw_engine->base.base.funcs = &i2c_engine_funcs;
...@@ -545,8 +541,6 @@ bool i2c_hw_engine_dce110_construct( ...@@ -545,8 +541,6 @@ bool i2c_hw_engine_dce110_construct(
*/ */
hw_engine->reference_frequency = hw_engine->reference_frequency =
(arg->reference_frequency * 2) / xtal_ref_div; (arg->reference_frequency * 2) / xtal_ref_div;
return true;
} }
struct i2c_engine *dal_i2c_hw_engine_dce110_create( struct i2c_engine *dal_i2c_hw_engine_dce110_create(
...@@ -558,6 +552,10 @@ 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); ASSERT_CRITICAL(false);
return NULL; return NULL;
} }
if (!arg->reference_frequency) {
ASSERT_CRITICAL(false);
return NULL;
}
engine_dce10 = kzalloc(sizeof(struct i2c_hw_engine_dce110), engine_dce10 = kzalloc(sizeof(struct i2c_hw_engine_dce110),
GFP_KERNEL); GFP_KERNEL);
...@@ -567,12 +565,6 @@ struct i2c_engine *dal_i2c_hw_engine_dce110_create( ...@@ -567,12 +565,6 @@ struct i2c_engine *dal_i2c_hw_engine_dce110_create(
return NULL; return NULL;
} }
if (i2c_hw_engine_dce110_construct(engine_dce10, arg)) construct(engine_dce10, arg);
return &engine_dce10->base.base; return &engine_dce10->base.base;
ASSERT_CRITICAL(false);
kfree(engine_dce10);
return NULL;
} }
...@@ -207,8 +207,4 @@ struct i2c_hw_engine_dce110_create_arg { ...@@ -207,8 +207,4 @@ struct i2c_hw_engine_dce110_create_arg {
struct i2c_engine *dal_i2c_hw_engine_dce110_create( struct i2c_engine *dal_i2c_hw_engine_dce110_create(
const struct i2c_hw_engine_dce110_create_arg *arg); 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 #endif
...@@ -118,7 +118,7 @@ static const struct engine_funcs engine_funcs = { ...@@ -118,7 +118,7 @@ static const struct engine_funcs engine_funcs = {
.submit_request = dal_i2c_sw_engine_submit_request, .submit_request = dal_i2c_sw_engine_submit_request,
}; };
static bool construct( static void construct(
struct i2c_sw_engine_dce110 *engine_dce110, struct i2c_sw_engine_dce110 *engine_dce110,
const struct i2c_sw_engine_dce110_create_arg *arg_dce110) const struct i2c_sw_engine_dce110_create_arg *arg_dce110)
{ {
...@@ -127,11 +127,7 @@ static bool construct( ...@@ -127,11 +127,7 @@ static bool construct(
arg_base.ctx = arg_dce110->ctx; arg_base.ctx = arg_dce110->ctx;
arg_base.default_speed = arg_dce110->default_speed; arg_base.default_speed = arg_dce110->default_speed;
if (!dal_i2c_sw_engine_construct( dal_i2c_sw_engine_construct(&engine_dce110->base, &arg_base);
&engine_dce110->base, &arg_base)) {
ASSERT_CRITICAL(false);
return false;
}
/*struct engine struct engine_funcs*/ /*struct engine struct engine_funcs*/
engine_dce110->base.base.base.funcs = &engine_funcs; engine_dce110->base.base.base.funcs = &engine_funcs;
...@@ -139,8 +135,6 @@ static bool construct( ...@@ -139,8 +135,6 @@ static bool construct(
engine_dce110->base.base.funcs = &i2c_engine_funcs; engine_dce110->base.base.funcs = &i2c_engine_funcs;
engine_dce110->base.default_speed = arg_dce110->default_speed; engine_dce110->base.default_speed = arg_dce110->default_speed;
engine_dce110->engine_id = arg_dce110->engine_id; engine_dce110->engine_id = arg_dce110->engine_id;
return true;
} }
struct i2c_engine *dal_i2c_sw_engine_dce110_create( struct i2c_engine *dal_i2c_sw_engine_dce110_create(
...@@ -161,12 +155,6 @@ struct i2c_engine *dal_i2c_sw_engine_dce110_create( ...@@ -161,12 +155,6 @@ struct i2c_engine *dal_i2c_sw_engine_dce110_create(
return NULL; return NULL;
} }
if (construct(engine_dce110, arg)) construct(engine_dce110, arg);
return &engine_dce110->base.base; return &engine_dce110->base.base;
ASSERT_CRITICAL(false);
kfree(engine_dce110);
return NULL;
} }
...@@ -196,7 +196,7 @@ static const struct dce110_i2c_hw_engine_mask i2c_mask = { ...@@ -196,7 +196,7 @@ static const struct dce110_i2c_hw_engine_mask i2c_mask = {
I2C_COMMON_MASK_SH_LIST_DCE110(_MASK) I2C_COMMON_MASK_SH_LIST_DCE110(_MASK)
}; };
bool dal_i2caux_dce110_construct( void dal_i2caux_dce110_construct(
struct i2caux_dce110 *i2caux_dce110, struct i2caux_dce110 *i2caux_dce110,
struct dc_context *ctx, struct dc_context *ctx,
const struct dce110_aux_registers aux_regs[], const struct dce110_aux_registers aux_regs[],
...@@ -217,10 +217,7 @@ bool dal_i2caux_dce110_construct( ...@@ -217,10 +217,7 @@ bool dal_i2caux_dce110_construct(
base = &i2caux_dce110->base; base = &i2caux_dce110->base;
if (!dal_i2caux_construct(base, ctx)) { dal_i2caux_construct(base, ctx);
ASSERT_CRITICAL(false);
return false;
}
i2caux_dce110->base.funcs = &i2caux_funcs; i2caux_dce110->base.funcs = &i2caux_funcs;
i2caux_dce110->i2c_hw_buffer_in_use = false; i2caux_dce110->i2c_hw_buffer_in_use = false;
...@@ -278,8 +275,6 @@ bool dal_i2caux_dce110_construct( ...@@ -278,8 +275,6 @@ bool dal_i2caux_dce110_construct(
} while (i < ARRAY_SIZE(hw_aux_lines)); } while (i < ARRAY_SIZE(hw_aux_lines));
/*TODO Generic I2C SW and HW*/ /*TODO Generic I2C SW and HW*/
return true;
} }
/* /*
...@@ -306,18 +301,11 @@ struct i2caux *dal_i2caux_dce110_create( ...@@ -306,18 +301,11 @@ struct i2caux *dal_i2caux_dce110_create(
return NULL; return NULL;
} }
if (dal_i2caux_dce110_construct( dal_i2caux_dce110_construct(i2caux_dce110,
i2caux_dce110, ctx,
ctx, dce110_aux_regs,
dce110_aux_regs, i2c_hw_engine_regs,
i2c_hw_engine_regs, &i2c_shift,
&i2c_shift, &i2c_mask);
&i2c_mask)) return &i2caux_dce110->base;
return &i2caux_dce110->base;
ASSERT_CRITICAL(false);
kfree(i2caux_dce110);
return NULL;
} }
...@@ -42,7 +42,7 @@ struct dce110_i2c_hw_engine_mask; ...@@ -42,7 +42,7 @@ struct dce110_i2c_hw_engine_mask;
struct i2caux *dal_i2caux_dce110_create( struct i2caux *dal_i2caux_dce110_create(
struct dc_context *ctx); struct dc_context *ctx);
bool dal_i2caux_dce110_construct( void dal_i2caux_dce110_construct(
struct i2caux_dce110 *i2caux_dce110, struct i2caux_dce110 *i2caux_dce110,
struct dc_context *ctx, struct dc_context *ctx,
const struct dce110_aux_registers *aux_regs, const struct dce110_aux_registers *aux_regs,
......
...@@ -87,22 +87,16 @@ static const struct dce110_i2c_hw_engine_mask i2c_mask = { ...@@ -87,22 +87,16 @@ static const struct dce110_i2c_hw_engine_mask i2c_mask = {
I2C_COMMON_MASK_SH_LIST_DCE110(_MASK) I2C_COMMON_MASK_SH_LIST_DCE110(_MASK)
}; };
static bool construct( static void construct(
struct i2caux_dce110 *i2caux_dce110, struct i2caux_dce110 *i2caux_dce110,
struct dc_context *ctx) struct dc_context *ctx)
{ {
if (!dal_i2caux_dce110_construct( dal_i2caux_dce110_construct(i2caux_dce110,
i2caux_dce110, ctx,
ctx, dce112_aux_regs,
dce112_aux_regs, dce112_hw_engine_regs,
dce112_hw_engine_regs, &i2c_shift,
&i2c_shift, &i2c_mask);
&i2c_mask)) {
ASSERT_CRITICAL(false);
return false;
}
return true;
} }
/* /*
...@@ -129,12 +123,6 @@ struct i2caux *dal_i2caux_dce112_create( ...@@ -129,12 +123,6 @@ struct i2caux *dal_i2caux_dce112_create(
return NULL; return NULL;
} }
if (construct(i2caux_dce110, ctx)) construct(i2caux_dce110, ctx);
return &i2caux_dce110->base; return &i2caux_dce110->base;
ASSERT_CRITICAL(false);
kfree(i2caux_dce110);
return NULL;
} }
...@@ -108,18 +108,11 @@ struct i2caux *dal_i2caux_dce120_create( ...@@ -108,18 +108,11 @@ struct i2caux *dal_i2caux_dce120_create(
return NULL; return NULL;
} }
if (dal_i2caux_dce110_construct( dal_i2caux_dce110_construct(i2caux_dce110,
i2caux_dce110, ctx,
ctx, dce120_aux_regs,
dce120_aux_regs, dce120_hw_engine_regs,
dce120_hw_engine_regs, &i2c_shift,
&i2c_shift, &i2c_mask);
&i2c_mask)) return &i2caux_dce110->base;
return &i2caux_dce110->base;
ASSERT_CRITICAL(false);
kfree(i2caux_dce110);
return NULL;
} }
...@@ -824,20 +824,11 @@ static const struct i2c_hw_engine_funcs i2c_hw_engine_funcs = { ...@@ -824,20 +824,11 @@ static const struct i2c_hw_engine_funcs i2c_hw_engine_funcs = {
dal_i2c_hw_engine_wait_on_operation_result, dal_i2c_hw_engine_wait_on_operation_result,
}; };
static bool construct( static void construct(
struct i2c_hw_engine_dce80 *engine, struct i2c_hw_engine_dce80 *engine,
const struct i2c_hw_engine_dce80_create_arg *arg) const struct i2c_hw_engine_dce80_create_arg *arg)
{ {
if (arg->engine_id >= sizeof(ddc_setup_offset) / sizeof(int32_t)) dal_i2c_hw_engine_construct(&engine->base, arg->ctx);
return false;
if (arg->engine_id >= sizeof(ddc_speed_offset) / sizeof(int32_t))
return false;
if (!arg->reference_frequency)
return false;
if (!dal_i2c_hw_engine_construct(&engine->base, arg->ctx))
return false;
engine->base.base.base.funcs = &engine_funcs; engine->base.base.base.funcs = &engine_funcs;
engine->base.base.funcs = &i2c_engine_funcs; engine->base.base.funcs = &i2c_engine_funcs;
...@@ -853,8 +844,6 @@ static bool construct( ...@@ -853,8 +844,6 @@ static bool construct(
engine->buffer_used_bytes = 0; engine->buffer_used_bytes = 0;
engine->transaction_count = 0; engine->transaction_count = 0;
engine->engine_keep_power_up_count = 1; engine->engine_keep_power_up_count = 1;
return true;
} }
struct i2c_engine *dal_i2c_hw_engine_dce80_create( struct i2c_engine *dal_i2c_hw_engine_dce80_create(
...@@ -867,6 +856,13 @@ struct i2c_engine *dal_i2c_hw_engine_dce80_create( ...@@ -867,6 +856,13 @@ struct i2c_engine *dal_i2c_hw_engine_dce80_create(
return NULL; return NULL;
} }
if ((arg->engine_id >= sizeof(ddc_setup_offset) / sizeof(int32_t)) ||
(arg->engine_id >= sizeof(ddc_speed_offset) / sizeof(int32_t)) ||
!arg->reference_frequency) {
BREAK_TO_DEBUGGER();
return NULL;
}
engine = kzalloc(sizeof(struct i2c_hw_engine_dce80), GFP_KERNEL); engine = kzalloc(sizeof(struct i2c_hw_engine_dce80), GFP_KERNEL);
if (!engine) { if (!engine) {
...@@ -874,12 +870,6 @@ struct i2c_engine *dal_i2c_hw_engine_dce80_create( ...@@ -874,12 +870,6 @@ struct i2c_engine *dal_i2c_hw_engine_dce80_create(
return NULL; return NULL;
} }
if (construct(engine, arg)) construct(engine, arg);
return &engine->base.base; return &engine->base.base;
BREAK_TO_DEBUGGER();
kfree(engine);
return NULL;
} }
...@@ -133,7 +133,7 @@ static const struct engine_funcs engine_funcs = { ...@@ -133,7 +133,7 @@ static const struct engine_funcs engine_funcs = {
.submit_request = dal_i2c_sw_engine_submit_request, .submit_request = dal_i2c_sw_engine_submit_request,
}; };
static bool construct( static void construct(
struct i2c_sw_engine_dce80 *engine, struct i2c_sw_engine_dce80 *engine,
const struct i2c_sw_engine_dce80_create_arg *arg) const struct i2c_sw_engine_dce80_create_arg *arg)
{ {
...@@ -142,17 +142,12 @@ static bool construct( ...@@ -142,17 +142,12 @@ static bool construct(
arg_base.ctx = arg->ctx; arg_base.ctx = arg->ctx;
arg_base.default_speed = arg->default_speed; arg_base.default_speed = arg->default_speed;
if (!dal_i2c_sw_engine_construct(&engine->base, &arg_base)) { dal_i2c_sw_engine_construct(&engine->base, &arg_base);
BREAK_TO_DEBUGGER();
return false;
}
engine->base.base.base.funcs = &engine_funcs; engine->base.base.base.funcs = &engine_funcs;
engine->base.base.funcs = &i2c_engine_funcs; engine->base.base.funcs = &i2c_engine_funcs;
engine->base.default_speed = arg->default_speed; engine->base.default_speed = arg->default_speed;
engine->engine_id = arg->engine_id; engine->engine_id = arg->engine_id;
return true;
} }
struct i2c_engine *dal_i2c_sw_engine_dce80_create( struct i2c_engine *dal_i2c_sw_engine_dce80_create(
...@@ -172,13 +167,7 @@ struct i2c_engine *dal_i2c_sw_engine_dce80_create( ...@@ -172,13 +167,7 @@ struct i2c_engine *dal_i2c_sw_engine_dce80_create(
return NULL; return NULL;
} }
if (construct(engine, arg)) construct(engine, arg);
return &engine->base.base; return &engine->base.base;
BREAK_TO_DEBUGGER();
kfree(engine);
return NULL;
} }
...@@ -187,7 +187,7 @@ static const struct i2caux_funcs i2caux_funcs = { ...@@ -187,7 +187,7 @@ static const struct i2caux_funcs i2caux_funcs = {
.acquire_aux_engine = dal_i2caux_acquire_aux_engine, .acquire_aux_engine = dal_i2caux_acquire_aux_engine,
}; };
static bool construct( static void construct(
struct i2caux_dce80 *i2caux_dce80, struct i2caux_dce80 *i2caux_dce80,
struct dc_context *ctx) struct dc_context *ctx)
{ {
...@@ -207,10 +207,7 @@ static bool construct( ...@@ -207,10 +207,7 @@ static bool construct(
uint32_t i; uint32_t i;
if (!dal_i2caux_construct(base, ctx)) { dal_i2caux_construct(base, ctx);
BREAK_TO_DEBUGGER();
return false;
}
i2caux_dce80->base.funcs = &i2caux_funcs; i2caux_dce80->base.funcs = &i2caux_funcs;
i2caux_dce80->i2c_hw_buffer_in_use = false; i2caux_dce80->i2c_hw_buffer_in_use = false;
...@@ -269,8 +266,6 @@ static bool construct( ...@@ -269,8 +266,6 @@ static bool construct(
} while (i < ARRAY_SIZE(hw_aux_lines)); } while (i < ARRAY_SIZE(hw_aux_lines));
/* TODO Generic I2C SW and HW */ /* TODO Generic I2C SW and HW */
return true;
} }
struct i2caux *dal_i2caux_dce80_create( struct i2caux *dal_i2caux_dce80_create(
...@@ -284,12 +279,6 @@ struct i2caux *dal_i2caux_dce80_create( ...@@ -284,12 +279,6 @@ struct i2caux *dal_i2caux_dce80_create(
return NULL; return NULL;
} }
if (construct(i2caux_dce80, ctx)) construct(i2caux_dce80, ctx);
return &i2caux_dce80->base; return &i2caux_dce80->base;
BREAK_TO_DEBUGGER();
kfree(i2caux_dce80);
return NULL;
} }
...@@ -108,18 +108,11 @@ struct i2caux *dal_i2caux_dcn10_create( ...@@ -108,18 +108,11 @@ struct i2caux *dal_i2caux_dcn10_create(
return NULL; return NULL;
} }
if (dal_i2caux_dce110_construct( dal_i2caux_dce110_construct(i2caux_dce110,
i2caux_dce110, ctx,
ctx, dcn10_aux_regs,
dcn10_aux_regs, dcn10_hw_engine_regs,
dcn10_hw_engine_regs, &i2c_shift,
&i2c_shift, &i2c_mask);
&i2c_mask)) return &i2caux_dce110->base;
return &i2caux_dce110->base;
ASSERT_CRITICAL(false);
kfree(i2caux_dce110);
return NULL;
} }
...@@ -73,18 +73,12 @@ static const struct i2caux_funcs i2caux_funcs = { ...@@ -73,18 +73,12 @@ static const struct i2caux_funcs i2caux_funcs = {
.acquire_aux_engine = NULL, .acquire_aux_engine = NULL,
}; };
static bool construct( static void construct(
struct i2caux *i2caux, struct i2caux *i2caux,
struct dc_context *ctx) struct dc_context *ctx)
{ {
if (!dal_i2caux_construct(i2caux, ctx)) { dal_i2caux_construct(i2caux, ctx);
ASSERT_CRITICAL(false);
return false;
}
i2caux->funcs = &i2caux_funcs; i2caux->funcs = &i2caux_funcs;
return true;
} }
struct i2caux *dal_i2caux_diag_fpga_create( struct i2caux *dal_i2caux_diag_fpga_create(
...@@ -98,12 +92,6 @@ struct i2caux *dal_i2caux_diag_fpga_create( ...@@ -98,12 +92,6 @@ struct i2caux *dal_i2caux_diag_fpga_create(
return NULL; return NULL;
} }
if (construct(i2caux, ctx)) construct(i2caux, ctx);
return i2caux; return i2caux;
ASSERT_CRITICAL(false);
kfree(i2caux);
return NULL;
} }
...@@ -110,7 +110,7 @@ struct engine { ...@@ -110,7 +110,7 @@ struct engine {
struct dc_context *ctx; struct dc_context *ctx;
}; };
bool dal_i2caux_construct_engine( void dal_i2caux_construct_engine(
struct engine *engine, struct engine *engine,
struct dc_context *ctx); struct dc_context *ctx);
......
...@@ -36,13 +36,12 @@ ...@@ -36,13 +36,12 @@
#include "engine.h" #include "engine.h"
bool dal_i2caux_construct_engine( void dal_i2caux_construct_engine(
struct engine *engine, struct engine *engine,
struct dc_context *ctx) struct dc_context *ctx)
{ {
engine->ddc = NULL; engine->ddc = NULL;
engine->ctx = ctx; engine->ctx = ctx;
return true;
} }
void dal_i2caux_destruct_engine( void dal_i2caux_destruct_engine(
......
...@@ -103,15 +103,12 @@ void dal_i2c_engine_process_channel_reply( ...@@ -103,15 +103,12 @@ void dal_i2c_engine_process_channel_reply(
} }
bool dal_i2c_engine_construct( void dal_i2c_engine_construct(
struct i2c_engine *engine, struct i2c_engine *engine,
struct dc_context *ctx) struct dc_context *ctx)
{ {
if (!dal_i2caux_construct_engine(&engine->base, ctx)) dal_i2caux_construct_engine(&engine->base, ctx);
return false;
engine->timeout_delay = 0; engine->timeout_delay = 0;
return true;
} }
void dal_i2c_engine_destruct( void dal_i2c_engine_destruct(
......
...@@ -88,7 +88,7 @@ struct i2c_engine { ...@@ -88,7 +88,7 @@ struct i2c_engine {
uint32_t timeout_delay; uint32_t timeout_delay;
}; };
bool dal_i2c_engine_construct( void dal_i2c_engine_construct(
struct i2c_engine *engine, struct i2c_engine *engine,
struct dc_context *ctx); struct dc_context *ctx);
......
...@@ -270,13 +270,11 @@ uint32_t dal_i2c_generic_hw_engine_get_transaction_timeout( ...@@ -270,13 +270,11 @@ uint32_t dal_i2c_generic_hw_engine_get_transaction_timeout(
(1 + (length << 3) + 1); (1 + (length << 3) + 1);
} }
bool dal_i2c_generic_hw_engine_construct( void dal_i2c_generic_hw_engine_construct(
struct i2c_generic_hw_engine *engine, struct i2c_generic_hw_engine *engine,
struct dc_context *ctx) struct dc_context *ctx)
{ {
if (!dal_i2c_hw_engine_construct(&engine->base, ctx)) dal_i2c_hw_engine_construct(&engine->base, ctx);
return false;
return true;
} }
void dal_i2c_generic_hw_engine_destruct( void dal_i2c_generic_hw_engine_destruct(
......
...@@ -59,7 +59,7 @@ struct i2c_generic_hw_engine { ...@@ -59,7 +59,7 @@ struct i2c_generic_hw_engine {
const struct i2c_generic_hw_engine_funcs *funcs; const struct i2c_generic_hw_engine_funcs *funcs;
}; };
bool dal_i2c_generic_hw_engine_construct( void dal_i2c_generic_hw_engine_construct(
struct i2c_generic_hw_engine *engine, struct i2c_generic_hw_engine *engine,
struct dc_context *ctx); struct dc_context *ctx);
......
...@@ -228,15 +228,13 @@ enum i2c_channel_operation_result dal_i2c_hw_engine_wait_on_operation_result( ...@@ -228,15 +228,13 @@ enum i2c_channel_operation_result dal_i2c_hw_engine_wait_on_operation_result(
return result; return result;
} }
bool dal_i2c_hw_engine_construct( void dal_i2c_hw_engine_construct(
struct i2c_hw_engine *engine, struct i2c_hw_engine *engine,
struct dc_context *ctx) struct dc_context *ctx)
{ {
if (!dal_i2c_engine_construct(&engine->base, ctx)) dal_i2c_engine_construct(&engine->base, ctx);
return false;
engine->original_speed = I2CAUX_DEFAULT_I2C_HW_SPEED; engine->original_speed = I2CAUX_DEFAULT_I2C_HW_SPEED;
engine->default_speed = I2CAUX_DEFAULT_I2C_HW_SPEED; engine->default_speed = I2CAUX_DEFAULT_I2C_HW_SPEED;
return true;
} }
void dal_i2c_hw_engine_destruct( void dal_i2c_hw_engine_destruct(
......
...@@ -53,7 +53,7 @@ struct i2c_hw_engine { ...@@ -53,7 +53,7 @@ struct i2c_hw_engine {
uint32_t default_speed; uint32_t default_speed;
}; };
bool dal_i2c_hw_engine_construct( void dal_i2c_hw_engine_construct(
struct i2c_hw_engine *engine, struct i2c_hw_engine *engine,
struct dc_context *ctx); struct dc_context *ctx);
......
...@@ -569,17 +569,14 @@ static const struct engine_funcs engine_funcs = { ...@@ -569,17 +569,14 @@ static const struct engine_funcs engine_funcs = {
.submit_request = dal_i2c_sw_engine_submit_request, .submit_request = dal_i2c_sw_engine_submit_request,
}; };
bool dal_i2c_sw_engine_construct( void dal_i2c_sw_engine_construct(
struct i2c_sw_engine *engine, struct i2c_sw_engine *engine,
const struct i2c_sw_engine_create_arg *arg) const struct i2c_sw_engine_create_arg *arg)
{ {
if (!dal_i2c_engine_construct(&engine->base, arg->ctx)) dal_i2c_engine_construct(&engine->base, arg->ctx);
return false;
dal_i2c_sw_engine_set_speed(&engine->base, arg->default_speed); dal_i2c_sw_engine_set_speed(&engine->base, arg->default_speed);
engine->base.funcs = &i2c_engine_funcs; engine->base.funcs = &i2c_engine_funcs;
engine->base.base.funcs = &engine_funcs; engine->base.base.funcs = &engine_funcs;
return true;
} }
struct i2c_engine *dal_i2c_sw_engine_create( struct i2c_engine *dal_i2c_sw_engine_create(
...@@ -599,12 +596,6 @@ struct i2c_engine *dal_i2c_sw_engine_create( ...@@ -599,12 +596,6 @@ struct i2c_engine *dal_i2c_sw_engine_create(
return NULL; return NULL;
} }
if (dal_i2c_sw_engine_construct(engine, arg)) dal_i2c_sw_engine_construct(engine, arg);
return &engine->base; return &engine->base;
BREAK_TO_DEBUGGER();
kfree(engine);
return NULL;
} }
...@@ -48,7 +48,7 @@ struct i2c_sw_engine_create_arg { ...@@ -48,7 +48,7 @@ struct i2c_sw_engine_create_arg {
struct dc_context *ctx; struct dc_context *ctx;
}; };
bool dal_i2c_sw_engine_construct( void dal_i2c_sw_engine_construct(
struct i2c_sw_engine *engine, struct i2c_sw_engine *engine,
const struct i2c_sw_engine_create_arg *arg); const struct i2c_sw_engine_create_arg *arg);
......
...@@ -423,7 +423,7 @@ void dal_i2caux_release_engine( ...@@ -423,7 +423,7 @@ void dal_i2caux_release_engine(
engine->ddc = NULL; engine->ddc = NULL;
} }
bool dal_i2caux_construct( void dal_i2caux_construct(
struct i2caux *i2caux, struct i2caux *i2caux,
struct dc_context *ctx) struct dc_context *ctx)
{ {
...@@ -451,8 +451,6 @@ bool dal_i2caux_construct( ...@@ -451,8 +451,6 @@ bool dal_i2caux_construct(
i2caux->default_i2c_hw_speed = DEFAULT_I2C_HW_SPEED; i2caux->default_i2c_hw_speed = DEFAULT_I2C_HW_SPEED;
i2caux->default_i2c_sw_speed = DEFAULT_I2C_SW_SPEED; i2caux->default_i2c_sw_speed = DEFAULT_I2C_SW_SPEED;
} }
return true;
} }
void dal_i2caux_destruct( void dal_i2caux_destruct(
......
...@@ -97,7 +97,7 @@ struct i2caux { ...@@ -97,7 +97,7 @@ struct i2caux {
uint32_t default_i2c_hw_speed; uint32_t default_i2c_hw_speed;
}; };
bool dal_i2caux_construct( void dal_i2caux_construct(
struct i2caux *i2caux, struct i2caux *i2caux,
struct dc_context *ctx); struct dc_context *ctx);
......
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