Re: [PATCH] arm: remove unused code in delay.S

From: Wolfram Sang
Date: Mon Sep 14 2009 - 11:36:29 EST


On Mon, Sep 14, 2009 at 06:14:08PM +0300, Felipe Contreras wrote:
> On Mon, Sep 14, 2009 at 5:40 PM, Russell King - ARM Linux
> <linux@xxxxxxxxxxxxxxxx> wrote:
> > On Mon, Sep 14, 2009 at 05:38:32PM +0300, Felipe Contreras wrote:
> >> On Mon, Sep 14, 2009 at 5:00 PM, Russell King - ARM Linux
> >> <linux@xxxxxxxxxxxxxxxx> wrote:
> >> > On Mon, Sep 14, 2009 at 03:58:24PM +0300, Felipe Contreras wrote:
> >> >> On Mon, Sep 14, 2009 at 11:10 AM, Russell King - ARM Linux
> >> >> <linux@xxxxxxxxxxxxxxxx> wrote:
> >> >> > On Mon, Sep 14, 2009 at 01:21:00AM +0100, Jamie Lokier wrote:
> >> >> >> Russell King - ARM Linux wrote:
> >> >> >> > On Sun, Sep 13, 2009 at 11:28:47PM +0200, Marek Vasut wrote:
> >> >> >> > > >                 bhi     __delay
> >> >> >> > > >                 mov     pc, lr
> >> >> >> > > >  ENDPROC(__udelay)
> >> >> >> > > >
> >> >> >> > > Hi
> >> >> >> > >
> >> >> >> > > why was this code there in the first place ?
> >> >> >> >
> >> >> >> > To make the delay loop more stable and predictable on older CPUs.
> >> >> >>
> >> >> >> So why has it been commented out, if it's needed for that?
> >> >> >
> >> >> > We moved on and it penalises later CPUs, leading to udelay providing
> >> >> > shorter delays than requested.
> >> >> >
> >> >> > So the choice was either stable and predictable on older CPUs but
> >> >> > buggy on newer CPUs, or correct on all CPUs but gives unnecessarily
> >> >> > longer delays on older CPUs.
> >> >>
> >> >> Why not add an #ifdef CPU_V4 or whatever?
> >> >
> >> > Because then you get it whenever you configure for V4 as the lowest
> >> > denominator CPU, which leads to the buggy behaviour on better CPUs.
> >> > It's far better to leave it as is and just accept that the old CPUs
> >> > will have longer than necessary delays.  If people really really
> >> > care (and there's likely to only be a small minority of them now)
> >> > changing the '0' to a '1' is a very simple change for them to carry
> >> > in their local tree.  Unlike getting the right unrolling etc.
> >>
> >> Well, they can also 'git revert' this patch. If somebody really cares
> >> I think they should shout now and provide a better patch, otherwise
> >> this one should be merged.
> >
> > On the other hand, having the code there as it currently stands is not
> > harmful in any way, so leaving it there is just as easy.
>
> It makes the code less understandable. I'm not sure about linux's
> practices, but an #if 0 generally means somebody is being lazy.

And what about a comment like "Try including the following code if ..."? I
think I saw this somewhere else in the kernel and I'd be fine with that. So,
while I generally agree that "#if 0" looks suspicious, there are a few cases
for it, though they need documentation IMHO.

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |

Attachment: signature.asc
Description: Digital signature