qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 22/30] hw/intc/sh_intc: Inline and drop sh_intc_source() f


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v6 22/30] hw/intc/sh_intc: Inline and drop sh_intc_source() function
Date: Sat, 30 Oct 2021 00:45:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

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 <balaton@eik.bme.hu>
> ---
>  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++;
>                  }
>              }
>          }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]