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 11:45:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

On 10/30/21 01:48, BALATON Zoltan wrote:
> On Sat, 30 Oct 2021, Philippe Mathieu-Daudé wrote:
>> 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.
> 
> I've tried to preserve the original brhaviour in this patch and not
> change it for now. This will need to be rewritten anyway beause it does
> not handle priorities and hard to QOM-ify as it is so I'll come back to
> this where these will probably change, so for now just leave it to keep
> the existing behaviour. Then we can revise it later in separate patch.

Fine.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Thanks for taking the time to review my patches, much appreciated.
> 
> Regards,
> BALATON Zoltan
> 
>>> +                    desc->sources[id].enable_max++;
>>>                  }
>>>              }
>>>          }
>>
>>



reply via email to

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