From: Jeff Garzik <jeff@garzik.org>
To: Kristoffer Nyborg Gregertsen <gregerts@stud.ntnu.no>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Kristoffer Nyborg Gregertsen <kngregertsen@norway.atmel.com>,
linux-ide@vger.kernel.org
Subject: Re: [PATCH 1/1] AVR32 PATA driver
Date: Tue, 07 Aug 2007 14:14:27 -0400 [thread overview]
Message-ID: <46B8B683.6060000@garzik.org> (raw)
In-Reply-To: <200708071939.34266.gregerts@stud.ntnu.no>
Kristoffer Nyborg Gregertsen wrote:
> On Tuesday 07 August 2007 17:54:09 Alan Cox wrote:
>> +static int pata_at32_get_pio_mask(void)
>>
>>> +{
>>> + switch (max_pio) {
>>> + case 0:
>>> + return 0x01;
>>> + case 1:
>>> + return 0x03;
>>> + case 2:
>>> + return 0x07;
>>> + case 3:
>>> + return 0x0f;
>>> + case 4:
>>> + return 0x1f;
>>> + default:
>>> + return 0x01;
>> What is wrong with just using (1 << max_pio) - 1 as the range is only
>> 0-4 anyway.
>
> Since max_pio is a module argument it may be invalid. Perhaps:
>
> if (0 <= max_pio && max_pio <= 4)
> return (1 << max_pio) - 1;
> else
> return 0x01;
>
> Or is it common to trust the module arguments to be sane?
Well, a higher level issue, you should not have a max_pio module
parameter at all. Other drivers do not have such a thing.
Jeff
next prev parent reply other threads:[~2007-08-07 18:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 9:26 [PATCH 0/1] AVR32 PATA driver Kristoffer Nyborg Gregertsen
2007-08-07 9:27 ` [PATCH 1/1] " Kristoffer Nyborg Gregertsen
2007-08-07 15:54 ` Alan Cox
2007-08-07 17:39 ` Kristoffer Nyborg Gregertsen
2007-08-07 18:14 ` Jeff Garzik [this message]
2007-08-07 18:26 ` Kristoffer Nyborg Gregertsen
2007-08-08 14:57 ` Kristoffer Nyborg Gregertsen
2007-08-31 9:38 ` Jeff Garzik
2007-08-07 15:58 ` [PATCH 0/1] " Alan Cox
2007-08-07 18:18 ` Kristoffer Nyborg Gregertsen
2007-08-14 6:41 ` [PATCH 1/1] " Kristoffer Nyborg Gregertsen
2007-08-14 6:53 ` Kristoffer Nyborg Gregertsen
2007-08-15 8:44 ` Kristoffer Nyborg Gregertsen
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=46B8B683.6060000@garzik.org \
--to=jeff@garzik.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregerts@stud.ntnu.no \
--cc=kngregertsen@norway.atmel.com \
--cc=linux-ide@vger.kernel.org \
/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.