[U-Boot] [PATCH v2 09/11] S3C24XX: Add NAND Flash driver

José Miguel Gonçalves
2012-09-17T11:11:39Z

Hi Marek,

On 14-09-2012 19:21, Marek Vasut wrote:
> Dear Jos? Miguel Gon?alves,
>
>> NAND Flash driver with HW ECC for the S3C24XX SoCs.
>> Currently it only supports SLC NAND chips.
>>
>> Signed-off-by: Jos? Miguel Gon?alves <jose.goncalves@inov.pt>
> [...]
>
>> +#include <common.h>
>> +#include <nand.h>
>> +#include <asm/io.h>
>> +#include <asm/arch/s3c24xx_cpu.h>
>> +#include <asm/errno.h>
>> +
>> +#define MAX_CHIPS 2
>> +static int nand_cs[MAX_CHIPS] = { 0, 1 };
>> +
>> +#ifdef CONFIG_SPL_BUILD
>> +#define printf(arg...) do {} while (0)
> This doesn't seem quite right ...
>
> 1) this should be in CPU directory
> 2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
> 3) should be inline function, not a macro
>

I'm having difficulties in following this suggestion. No problem if I migrate the
printf as a macro to a header in the CPU directory. The problem is when I try to
put it as an inline function. In this case if I define it like this;

#ifdef CONFIG_SPL_BUILD
static inline int printf(const char *fmt, ...)
{
return 0;
}
#endif

I will get an "static declaration of `printf' follows non-static declaration"
error due to the printf() declaration in common.h.

If I put this inline printf function (without the static) in a .c file in the CPU
directory, it will compile but, as I expected, it will not be inlined, but it will
be compiled as a normal function.

Can you detail on how to do this?

Best regards,
Jos? Gon?alves