[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170419150725.GH27829@leverpostej>
Date: Wed, 19 Apr 2017 16:07:25 +0100
From: Mark Rutland <mark.rutland@....com>
To: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
Cc: fu.wei@...aro.org, rjw@...ysocki.net, lenb@...nel.org,
daniel.lezcano@...aro.org, tglx@...utronix.de,
marc.zyngier@....com, sudeep.holla@....com, hanjun.guo@...aro.org,
linux-arm-kernel@...ts.infradead.org, linaro-acpi@...ts.linaro.org,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
rruigrok@...eaurora.org, harba@...eaurora.org, cov@...eaurora.org,
timur@...eaurora.org, graeme.gregory@...aro.org,
al.stone@...aro.org, jcm@...hat.com, wei@...hat.com, arnd@...db.de,
catalin.marinas@....com, will.deacon@....com,
Suravee.Suthikulpanit@....com, leo.duran@....com, wim@...ana.be,
linux@...ck-us.net, linux-watchdog@...r.kernel.org,
tn@...ihalf.com, christoffer.dall@...aro.org, julien.grall@....com
Subject: Re: [PATCH v24 09/11] acpi/arm64: Add memory-mapped timer support in
GTDT driver
On Tue, Apr 18, 2017 at 06:21:07PM +0100, Lorenzo Pieralisi wrote:
> On Sat, Apr 15, 2017 at 02:40:12AM +0800, fu.wei@...aro.org wrote:
> > +error:
> > + for (i = 0; i < ARCH_TIMER_MEM_MAX_FRAMES; i++) {
> > + frame = &timer_mem->frame[i];
> > + if (frame->phys_irq > 0)
> > + acpi_unregister_irq(frame->phys_irq);
> > + if (frame->virt_irq > 0)
> > + acpi_unregister_irq(frame->virt_irq);
> > + }
>
> There are three error paths, none of them reset [i,gtdt_frame],
> correct ?
Correct.
> If yes, why can't it simply be written like this ?
>
> for (; i >= 0; i--, gtdt_frame--) {
> frame = &timer_mem->frame[gtdt_frame->frame_number];
>
> /* not sure this check is actually needed */
> if (gtdt_frame->common_flags & ACPI_GTDT_GT_IS_SECURE_TIMER)
> continue;
>
> if (frame->phys_irq > 0)
> acpi_unregister_gsi(gtdt_frame->timer_interrupt);
> if (frame->virt_irq > 0)
> acpi_unregister_gsi(gtdt_frame->virtual_timer_interrupt);
> }
A reverse loop of this form will work.
That requires some restructuring, and care to avoid going out of bounds
instantaneously with the gtdt_frame--, so as to not invoke nasal demons.
I've attacked this locally, and will send this out after testing. I'll
drop the new ACPI API patch.
Thanks,
Mark.
Powered by blists - more mailing lists