Skip to content

Commit

Permalink
[review] drivers: gic: register to dt_driver
Browse files Browse the repository at this point in the history
Updates dt_get_gic_chip_cb().

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
  • Loading branch information
etienne-lms committed Jun 14, 2023
1 parent 0ce2fee commit 3b5b1f6
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions core/drivers/gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ static void gic_op_set_affinity(struct itr_chip *chip, size_t it,

#ifdef CFG_DT
/* Callback for "interrupt-extended" GIC interrupts in consumer DT nodes */
static struct itr_desc *dt_get_gic_chip_cb(struct dt_pargs *arg,
void *priv_data, TEE_Result *res)
static TEE_Result dt_get_gic_chip_cb(struct dt_pargs *arg, void *priv_data,
struct itr_desc **out_itr_desc)
{
int itr_num = DT_INFO_INVALID_INTERRUPT;
struct itr_chip *chip = priv_data;
Expand All @@ -599,25 +599,22 @@ static struct itr_desc *dt_get_gic_chip_cb(struct dt_pargs *arg,
uint32_t prio = 0;

itr_num = gic_dt_get_irq(arg->args, arg->args_count, &type, &prio);
if (itr_num == DT_INFO_INVALID_INTERRUPT) {
*res = TEE_ERROR_GENERIC;
return NULL;
}
if (itr_num == DT_INFO_INVALID_INTERRUPT)
return TEE_ERROR_GENERIC;

/* Allocate returned itr_desc as required by itr_dt_get_func type */
desc = calloc(1, sizeof(*desc));
if (!desc) {
*res = TEE_ERROR_OUT_OF_MEMORY;
return NULL;
}
if (!desc)
return TEE_ERROR_OUT_OF_MEMORY;

gic_op_add(chip, itr_num, type, prio);

desc->chip = chip;
desc->itr_num = itr_num;

*res = TEE_SUCCESS;
return desc;
*out_itr_desc = desc;

return TEE_SUCCESS;
}

static TEE_Result gic_probe(const void *fdt, int offs, const void *cd __unused)
Expand Down

0 comments on commit 3b5b1f6

Please sign in to comment.