Re: [PATCH] 2.4.19-rc2-ac2 pdc202xx.c update

Francois Romieu (romieu@cogenit.fr)
Tue, 23 Jul 2002 09:19:15 +0200


support <support@promise.com.tw> :
> We think there is no problems, Acturally it is
>
> if (speed == XFER_UDMA_2) {
> OUT_BYTE((thold + adj), indexreg);
> OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg);
> }
>
> So,
> if (speed == XFER_UDMA_2)
> set_2regs(thold, (IN_BYTE(datareg) & 0x7f));

set_2regs() is a macro. Macro have side effects.

Before the change, assuming speed != XFER_UDMA_2

if (speed == XFER_UDMA_2) {
OUT_BYTE((thold + adj), indexreg); <- not executed
OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg); <- not executed
}

-> the block isn't executed

After the change, the code is:

if (speed == XFER_UDMA_2)
OUT_BYTE((thold + adj), indexreg); <- not executed
OUT_BYTE((IN_BYTE(datareg) & 0x7f), datareg); <- executed, damn it !

-> only the first statement of the macro is executed.

Put a pair of {} after the "if", a "do {...} while (0)" in the macro
declaration. Please, please, think about it a few minutes.

-- 
Ueimor
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/