From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Roel Kluin <roel.kluin@gmail.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-ide@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] atiixp: missing parentheses?
Date: Tue, 17 Feb 2009 17:26:53 +0300 [thread overview]
Message-ID: <499AC92D.50108@ru.mvista.com> (raw)
In-Reply-To: <499AC8E2.60406@ru.mvista.com>
I wrote:
>> This looks odd, is below what was intended? note that timing_shift can
>> only be 16, 8 or 0. Maybe intended was 24, 16, 8 or 0? then we should do:
> Looking at the libata driver, yes, it should be 0, 8, 16, and 24.
>> int timing_shift = ((drive->dn & 2) ? 16 : 0) + ((drive->dn & 1) ? 0 :
>> 8);
>> --------------------------->8-------------8<------------------------------
>>
>> Add missing parentheses
>
>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>
>
>> diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c
>> index b2735d2..b7813ec 100644
>> --- a/drivers/ide/atiixp.c
>> +++ b/drivers/ide/atiixp.c
>> @@ -52,7 +52,7 @@ static void atiixp_set_pio_mode(ide_drive_t *drive,
>> const u8 pio)
>> {
>> struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
>> unsigned long flags;
>> - int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0
>> : 8;
>> + int timing_shift = (drive->dn & 2) ? 16 : 0 + ((drive->dn & 1) ?
>> 0 : 8);
>> u32 pio_timing_data;
>> u16 pio_mode_data;
>>
>> @@ -85,7 +85,7 @@ static void atiixp_set_dma_mode(ide_drive_t *drive,
>> const u8 speed)
>> {
>> struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
>> unsigned long flags;
>> - int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0
>> : 8;
>> + int timing_shift = (drive->dn & 2) ? 16 : 0 + ((drive->dn & 1) ?
>> 0 : 8);
>> u32 tmp32;
>> u16 tmp16;
>> u16 udma_ctl = 0;
>
>
> Why didn't you add parens around the first ?: then? They are surely
> needed. Though this clearly needs to be simplified to (drive->dn * 8).
Oh, actually, timing_shift = (drive->dn ^ 1) * 8.
MBR, Sergei
next prev parent reply other threads:[~2009-02-17 14:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-17 13:10 [PATCH] atiixp: missing parentheses? Roel Kluin
2009-02-17 14:25 ` Sergei Shtylyov
2009-02-17 14:26 ` Sergei Shtylyov [this message]
2009-02-17 15:10 ` Bartlomiej Zolnierkiewicz
2009-02-17 15:37 ` Roel Kluin
2009-02-18 18:53 ` Bartlomiej Zolnierkiewicz
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=499AC92D.50108@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=akpm@linux-foundation.org \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/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.