public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hannes Petermaier <hannes@petermaier.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] lcd: Add support for CONFIG_LCD_NOSTDOUT
Date: Thu, 06 Mar 2014 21:28:24 +0100	[thread overview]
Message-ID: <5318DA68.8070200@petermaier.org> (raw)
In-Reply-To: <20140306194905.GJ3327@book.gsilab.sittig.org>


On 2014-03-06 20:49, Gerhard Sittig wrote:

Hi Gerhard,
> On Thu, Mar 06, 2014 at 15:26 +0100, Hannes Petermaier wrote:
>> --- a/common/lcd.c
>> +++ b/common/lcd.c
>> @@ -400,12 +400,12 @@ __weak int lcd_get_size(int *line_length)
>>   
>>   int drv_lcd_init(void)
>>   {
>> -	struct stdio_dev lcddev;
>> -	int rc;
>> -
>>   	lcd_base = (void *) gd->fb_base;
>>   
>>   	lcd_init(lcd_base);		/* LCD initialization */
>> +#ifndef CONFIG_LCD_NOSTDOUT
>> +	struct stdio_dev lcddev;
>> +	int rc;
>>   
>>   	/* Device initialization */
>>   	memset(&lcddev, 0, sizeof(lcddev));
> What do language lawyers say about declarations after
> instructions within blocks?  This looks somewhat fishy.
Lawyers say, that compiler must not say warnings if the option ist 
turned on, so it is necessary to do this so.
>> @@ -419,6 +419,9 @@ int drv_lcd_init(void)
>>   	rc = stdio_register(&lcddev);
>>   
>>   	return (rc == 0) ? 1 : rc;
>> +#else
>> +	return 0;
>> +#endif
>>   }
> This (continuation from the above #ifndef) somehow reads like
> inverted logic.  It appears like "ifdef NOSTDOUT" is a shortcut,
> not a strict alternative as the patch suggests.
Yes, in fact - this is inverted logic.
Reason for this is, if someone doesn't want this feature, he/she simply 
doesn't set the #define.
All other applications which are using this code have to do nothing at 
all to be compatible in the future.
So for my opinion thats a good way to do so.
> In general U-Boot tries to get away from the multitude of ifdefs
> where possible.  I'm afraid adding a new one needs a very good
> reason to get perceived as welcome.
Okay, i didn't knew about this fact.
I have to check "how early" lcd_drv_init is called and if at this time 
reading environment variables are allready accessible, so it would be 
possible to make the behavior environment dependent. Maybe this would 
also cancel discussion about inverted logic :-)

> virtually yours
> Gerhard Sittig
best regards,
Hannes

  reply	other threads:[~2014-03-06 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 14:26 [U-Boot] [PATCH] lcd: Add support for CONFIG_LCD_NOSTDOUT Hannes Petermaier
2014-03-06 19:49 ` Gerhard Sittig
2014-03-06 20:28   ` Hannes Petermaier [this message]
2014-03-08 19:46   ` Hannes Petermaier
2014-03-10 19:44     ` Gerhard Sittig
2014-05-03 18:34 ` Jeroen Hofstee
2014-05-05  6:21   ` Hannes Petermaier
2014-08-11 13:52 ` Anatolij Gustschin
2015-02-04  9:05   ` Hannes Petermaier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5318DA68.8070200@petermaier.org \
    --to=hannes@petermaier.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox