
Dear Graeme Russ,
In message 4E5985C8.8020404@gmail.com you wrote:
And this is actually wrong. If we can use the serial console for output, we definitely don;t want to use your buffer any more.
Look closer - It's a diff weirdness - The actual code is:
I see. Thanks for pointing out.
Also, I have noticed in drivers/i2c/ppc4xx_i2c.c:
if (gd->flags & GD_FLG_HAVE_CONSOLE) { printf("I2C %s: failed %d\n", read ? "read" : "write", ret); }
and in drivers/i2c/soft_i2c.c:
#ifdef DEBUG_I2C #define PRINTD(fmt,args...) do { \ if (gd->flags & GD_FLG_HAVE_CONSOLE) \ printf (fmt ,##args); \ } while (0) #else #define PRINTD(fmt,args...) #endif
So there are drivers that anticipate generating output before console is initialised - I think we should not put the onus on the driver and move these conditions to printf() in console.c - Unfortunately this could lead to head-scratching when one _thinks_ a printf() should generate an output, but it is squelched (which is what the pre-console buffer is for)
Indeed - which is why this code is only used for debugging drivers in certain very special configurations.
Best regards,
Wolfgang Denk