From: Hannes Petermaier <hannes@petermaier.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] board/BuR/kwb: fix usage of 'i2c_set_bus_speed'
Date: Sat, 08 Mar 2014 19:14:13 +0100 [thread overview]
Message-ID: <531B5DF5.7010402@petermaier.org> (raw)
In-Reply-To: <20140308173830.GP3327@book.gsilab.sittig.org>
Hi Gerhard,
On 2014-03-08 18:38, Gerhard Sittig wrote:
> On Fri, Mar 07, 2014 at 18:56 +0100, Hannes Petermaier wrote:
>> - fix: return-value of 'i2c_set_bus_speed' was interpreted wrong
>>
>> Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
>> ---
>> board/BuR/kwb/board.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/board/BuR/kwb/board.c b/board/BuR/kwb/board.c
>> index 8aa16bc..8fb5e68 100644
>> --- a/board/BuR/kwb/board.c
>> +++ b/board/BuR/kwb/board.c
>> @@ -120,7 +120,7 @@ void am33xx_spl_board_init(void)
>>
>> /* power-ON 3V3 via Resetcontroller */
>> oldspeed = i2c_get_bus_speed();
>> - if (0 != i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC)) {
>> + if (0 <= i2c_set_bus_speed(CONFIG_SYS_OMAP24_I2C_SPEED_PSOC)) {
>> buf = RSTCTRL_FORCE_PWR_NEN;
>> i2c_write(RSTCTRL_ADDR, RSTCTRL_CTRLREG, 1,
>> (uint8_t *)&buf, sizeof(buf));
> While you are at it, can you fixup this Yoda programming style
> and use the regular idiom instead? It hurts the brain to have to
> stop and read code "backwards" before seeing what's going on.
OK. I'll send v2. Maybe i can change my personal idiom.
I've learned to do this so to avoid a unintended assignment to a variable.
For exmaple:
if (var = 10)
compiler will do assignment to variable.
if (10 = var)
compiler will generate error.
But in these days "checkpatch.pl" will warn in such case.
> virtually yours
> Gerhard Sittig
best regards,
Hannes
next prev parent reply other threads:[~2014-03-08 18:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 17:56 [U-Boot] [PATCH] board/BuR/kwb: fix usage of 'i2c_set_bus_speed' Hannes Petermaier
2014-03-08 17:38 ` Gerhard Sittig
2014-03-08 18:14 ` Hannes Petermaier [this message]
2014-03-08 19:45 ` Gerhard Sittig
2014-03-08 18:09 ` [U-Boot] [PATCH v2] " Hannes Petermaier
2014-03-12 20:23 ` [U-Boot] [U-Boot, " Tom Rini
2014-03-12 20:04 ` [U-Boot] " Tom Rini
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=531B5DF5.7010402@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.