[PATCH v2 1/5] ARM: SPMP8000: Add machine base files
Arnd Bergmann
arnd at arndb.de
Wed Oct 19 15:15:35 EDT 2011
On Wednesday 19 October 2011 18:01:54 Zoltan Devai wrote:
> Files needed for the basic machine support of SPMP8000
>
> Signed-off-by: Zoltan Devai <zoss at devai.org>
Hi Zoltan,
This version looks very nice, only a few small things remain that I noticed
reading through it again:
> +
> +void __iomem *spmp8000_wdt_base;
> +EXPORT_SYMBOL(spmp8000_wdt_base);
This should really be EXPORT_SYMBOL_GPL.
> +#define SERIAL_BASE ((volatile unsigned char *)SPMP8000_UARTC0_BASE)
drop this, then
> +static void putc(const char c)
> +{
> + volatile unsigned char *base = SERIAL_BASE;
make this a "unsigned char __iomem *".
> + int i;
> +
> + for (i = 0; i < 0x1000; i++) {
> + if (base[UART_LSR << 2] & UART_LSR_THRE)
> + break;
> + barrier();
> + }
> +
> + base[UART_TX << 2] = c;
> +}
and use readb_relaxed/writeb_relaxed to do the access. You should
never just dereference volatile pointers to do an MMIO access.
Best check your code by running 'sparse' over it (make C=1). It will warn
about things like this. Try to fix all warnings that sparse reports.
Arnd
More information about the linux-arm-kernel
mailing list