[PATCH] mtd: dc21285.c: remove double check of CONFIG_ARCH_NETWINDER

David Woodhouse dwmw2 at infradead.org
Tue May 29 06:19:20 EDT 2012


On Tue, 2012-05-29 at 12:06 +0200, Christian Dietrich wrote:
> When CONFIG_ARCH_NETWINDER is unset nw_en_write is a NOP. But
> machine_is_netwinder() also checks for
> CONFIG_ARCH_NETWINDER. Therefore in the !netwinder case the
> preprocessed code is:
> 
> if (0)
>    do {} while(0); 

It's not a double check. It's a compile time check for "do we even need
to build this code at all?", and a separate run time check for "do we
need to run this code now?".

Think about the case where CONFIG_ARCH_NETWINDER is set, but you aren't
actually running this kernel binary on a netwinder *today*.

Yes, we might not support multi-platform kernels on ARM yet, but we are
slowly getting there. This kind of change just makes that harder.

And even if the machine_is_netwinder() "function" is *currently* a macro
which is hard-coded to return one or zero, that just means that your
change achieves nothing in the compiler output. It'll be silently
optimised away, or not, as appropriate.

-- 
dwmw2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6171 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120529/4caf602a/attachment.bin>


More information about the linux-mtd mailing list