[U-Boot] [PATCH v5 01/20] sandbox: Add architecture header files

Wolfgang Denk wd at denx.de
Sun Oct 9 21:28:16 CEST 2011


Dear Simon Glass,

In message <1318031631-13643-2-git-send-email-sjg at chromium.org> you wrote:
> This adds required header files for the sandbox architecture, and a basic
> description of what sandbox is (README.sandbox).
> 
> This commit generates a list of 44 checkpatch warnings:

This should go to the comment section.   I don't want to see this as
part of the commit message.

> 0 errors, 44 warnings for 0001-sandbox-Add-architecture-header-files.patch:
> warning: arch/sandbox/include/asm/bitops.h,30: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,32: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,34: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,36: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,44: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,54: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,66: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,76: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,88: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> warning: arch/sandbox/include/asm/bitops.h,90: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt
> 
> (These are the bitops and seem to have volatile in all the other archs also.)

Existence of bad code examples is no excuse for submitting new bad
code.

...
> +/*
> + * Function prototypes to keep gcc -Wall happy.
> + */
> +extern void set_bit(int nr, volatile void *addr);
> +
> +extern void clear_bit(int nr, volatile void *addr);
> +
> +extern void change_bit(int nr, volatile void *addr);

I see no reason to accept these voplatiles here.

> +static inline void __change_bit(int nr, volatile void *addr)
> +{
> +	unsigned long mask = BIT_MASK(nr);
> +	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
> +
> +	*p ^= mask;

Please note that you actually even drop the volatile property in your
implementation.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There is no statute of limitations on stupidity."
- Randomly produced by a computer program called Markov3.


More information about the U-Boot mailing list