On 10/29/21 23:02, BALATON Zoltan wrote:
> This function is very simple and provides no advantage. Call sites
> become simpler without it so just write it in line and drop the
> separate function.
>
> Signed-off-by: BALATON Zoltan <[email protected]>
> ---
> hw/intc/sh_intc.c | 54 ++++++++++++++++------------------------
> hw/sh4/sh7750.c | 4 +--
> include/hw/sh4/sh_intc.h | 2 +-
> 3 files changed, 25 insertions(+), 35 deletions(-)
> static void sh_intc_register_source(struct intc_desc *desc,
> intc_enum source,
> struct intc_group *groups,
> int nr_groups)
> {
> unsigned int i, k;
> - struct intc_source *s;
> + intc_enum id;
>
Maybe:
assert(source != UNUSED);
> if (desc->mask_regs) {
> for (i = 0; i < desc->nr_mask_regs; i++) {
> struct intc_mask_reg *mr = &desc->mask_regs[i];
>
> for (k = 0; k < ARRAY_SIZE(mr->enum_ids); k++) {
> - if (mr->enum_ids[k] != source) {
> - continue;
> - }
> - s = sh_intc_source(desc, mr->enum_ids[k]);
> - if (s) {
> - s->enable_max++;
> + id = mr->enum_ids[k];
> + if (id && id == source) {
Then you can drop the 'id' checks.
> + desc->sources[id].enable_max++;
> }
> }
> }