From: Martin Dalecki <dalecki@evision-ventures.com>
To: Norbert Kiesel <nkiesel@tbdnetworks.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.5.8 IDE 36
Date: Tue, 16 Apr 2002 11:20:15 +0200 [thread overview]
Message-ID: <3CBBECCF.1050000@evision-ventures.com> (raw)
In-Reply-To: <200204160909.g3G99vEK025678@enterprise.tbdnetworks.com> <3CBBDF0E.4050605@evision-ventures.com> <1018951616.12352.38.camel@voyager>
Norbert Kiesel wrote:
> On Tue, 2002-04-16 at 01:21, Martin Dalecki wrote:
>
>>Norbert Kiesel wrote:
>>
>>>Hi,
>>>
>>>while trying to understand recent kernel changes I stumbled over
>>>the following patch to
>>>
>>>diff -urN linux-2.5.8/drivers/ide/ide.c linux/drivers/ide/ide.c
>>>--- linux-2.5.8/drivers/ide/ide.c Tue Apr 16 06:01:07 2002
>>>+++ linux/drivers/ide/ide.c Tue Apr 16 05:38:37 2002
>>>
>>>...
>>> while (i > 0) {
>>>- u32 buffer[16];
>>>- unsigned int wcount = (i > 16) ? 16 : i;
>>>- i -= wcount;
>>>- ata_input_data (drive, buffer, wcount);
>>>+ u32 buffer[SECTOR_WORDS];
>>>+ unsigned int count = (i > 1) ? 1 : i;
>>>+
>>>+ ata_read(drive, buffer, count * SECTOR_WORDS);
>>>+ i -= count;
>>> }
>>> }
>>>...
>>>
>>>While the old code called ata_input_read() with [0:16] as last param,
>>>the new code calls the (renamed) ata_read() with either 0 or 16. Also,
>>>the new code loops "i" times while the old code looped "i/16+1" times.
>>>Was this intended or should the patch better read like:
>>>
>>>...
>>> while (i > 0) {
>>>- u32 buffer[16];
>>>- unsigned int wcount = (i > 16) ? 16 : i;
>>>- i -= wcount;
>>>- ata_input_data (drive, buffer, wcount);
>>>+ u32 buffer[SECTOR_WORDS];
>>>+ unsigned int count = max(i, SECTOR_WORDS);
>>>+
>>>+ ata_read(drive, buffer, count);
>>>+ i -= count;
>>> }
>>> }
>>>...
>>>
>>>so long
>>
>>It's fine as it is I think. Please look up at the initialization of i.
>>I have just divded the SECTROT_WORDS (== 16) factor out
>>of all the places above ata_read.
>>
>
>
> You are right (assuming SECTOR_WORDS == 16. I was looking it up in
> 2.4.18 where SECTOR_WORDS is 512/4 == 128). However, the new code looks
> overly complicated (at least for me, easily proven by my wrong first
> email :-), given that count is now always == 1. Would the following not
> be nicer?
>
> int i;
>
> if (drive->type != ATA_DISK)
> return;
>
> for (i = min(drive->mult_count, 1); i > 0; i--) {
> u32 buffer[SECTOR_WORDS];
>
> ata_read(drive, buffer, SECTOR_WORDS);
> }
>
> (This of course assumes that drive->mult_count is always non-negative)
Yes this looks nicer. Would you mind to test it and drop me
a patch?
next prev parent reply other threads:[~2002-04-16 10:22 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-16 9:09 [PATCH] 2.5.8 IDE 36 Norbert Kiesel
2002-04-16 8:21 ` Martin Dalecki
2002-04-16 10:06 ` Norbert Kiesel
2002-04-16 9:20 ` Martin Dalecki [this message]
2002-04-16 10:20 ` Norbert Kiesel
-- strict thread matches above, loose matches on Subject: below --
2002-04-19 17:17 Peter T. Breuer
2002-04-17 10:10 Petr Vandrovec
2002-04-17 10:20 ` David Lang
2002-04-06 1:01 Linux 2.5.8-pre2 Linus Torvalds
2002-04-16 7:05 ` [PATCH] 2.5.8 IDE 36 Martin Dalecki
2002-04-16 8:30 ` Vojtech Pavlik
2002-04-16 7:33 ` Martin Dalecki
2002-04-16 8:43 ` Vojtech Pavlik
2002-04-16 9:19 ` David Lang
2002-04-16 8:43 ` Martin Dalecki
2002-04-16 14:14 ` Richard Gooch
2002-04-16 13:49 ` Martin Dalecki
2002-04-16 15:24 ` Vojtech Pavlik
2002-04-16 15:46 ` Linus Torvalds
2002-04-16 16:15 ` Alan Cox
2002-04-16 16:01 ` Linus Torvalds
2002-04-16 16:25 ` Alan Cox
2002-04-16 16:33 ` Padraig Brady
2002-04-16 17:42 ` Andreas Dilger
2002-04-16 17:00 ` Vojtech Pavlik
2002-04-16 17:04 ` David Lang
2002-04-16 17:00 ` David S. Miller
2002-04-16 17:09 ` David Lang
2002-04-16 17:06 ` David S. Miller
2002-04-16 17:16 ` David Lang
2002-04-17 7:44 ` Martin Dalecki
2002-04-17 9:33 ` David Lang
2002-04-16 17:40 ` Benjamin Herrenschmidt
2002-04-17 7:46 ` Martin Dalecki
2002-04-17 9:26 ` Anton Altaparmakov
2002-04-17 9:39 ` David Lang
2002-04-17 20:58 ` Mike Fedyk
2002-04-17 9:13 ` Geert Uytterhoeven
2002-04-17 1:55 ` Benjamin Herrenschmidt
2002-04-17 8:39 ` Martin Dalecki
2002-04-17 8:25 ` Geert Uytterhoeven
2002-04-16 15:43 ` Linus Torvalds
2002-04-16 15:58 ` Richard Gooch
2002-04-16 16:06 ` Linus Torvalds
2002-04-17 7:38 ` Martin Dalecki
2002-04-16 15:30 ` Linus Torvalds
2002-04-16 16:05 ` Alan Cox
2002-04-16 15:56 ` Linus Torvalds
2002-04-16 16:23 ` Alan Cox
2002-04-16 17:06 ` Vojtech Pavlik
2002-04-17 7:36 ` Martin Dalecki
2002-04-17 9:24 ` Alan Cox
2002-04-16 22:46 ` Brian Gerst
2002-04-17 7:52 ` Martin Dalecki
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=3CBBECCF.1050000@evision-ventures.com \
--to=dalecki@evision-ventures.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nkiesel@tbdnetworks.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox