* [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper
@ 2009-06-13 16:21 Bartlomiej Zolnierkiewicz
2009-06-13 20:19 ` Sergei Shtylyov
2009-06-13 20:49 ` Sergei Shtylyov
0 siblings, 2 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-13 16:21 UTC (permalink / raw)
To: linux-ide; +Cc: Jeff Garzik
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
against Linus' tree
include/linux/ata.h | 11 +++++++++++
1 file changed, 11 insertions(+)
Index: b/include/linux/ata.h
===================================================================
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -800,6 +800,17 @@ static inline int ata_id_is_ssd(const u1
return id[ATA_ID_ROT_SPEED] == 0x01;
}
+static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
+{
+ /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
+ if (ata_id_is_cfa(id) && pio > 4)
+ return 0;
+ /* PIO3 and higher it is mandatory. */
+ if (pio > 2 || ata_id_has_iordy(id))
+ return 1;
+ return 0;
+}
+
static inline int ata_drive_40wire(const u16 *dev_id)
{
if (ata_id_is_sata(dev_id))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper
2009-06-13 16:21 [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper Bartlomiej Zolnierkiewicz
@ 2009-06-13 20:19 ` Sergei Shtylyov
2009-06-13 20:49 ` Sergei Shtylyov
1 sibling, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2009-06-13 20:19 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, Jeff Garzik
Hello.
Bartlomiej Zolnierkiewicz wrote:
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> against Linus' tree
>
> include/linux/ata.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> Index: b/include/linux/ata.h
> ===================================================================
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -800,6 +800,17 @@ static inline int ata_id_is_ssd(const u1
> return id[ATA_ID_ROT_SPEED] == 0x01;
> }
>
> +static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
> +{
> + /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
> + if (ata_id_is_cfa(id) && pio > 4)
> + return 0;
> + /* PIO3 and higher it is mandatory. */
>
You need some puncuation between "higher" and "it" -- colon or long
dash... either that or "for" at the start of the statement. :-)
> + if (pio > 2 || ata_id_has_iordy(id))
> + return 1;
> + return 0;
> +}
> +
> static inline int ata_drive_40wire(const u16 *dev_id)
> {
> if (ata_id_is_sata(dev_id))
>
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper
2009-06-13 16:21 [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper Bartlomiej Zolnierkiewicz
2009-06-13 20:19 ` Sergei Shtylyov
@ 2009-06-13 20:49 ` Sergei Shtylyov
2009-06-15 16:32 ` Bartlomiej Zolnierkiewicz
1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2009-06-13 20:49 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, Jeff Garzik
Hello.
Bartlomiej Zolnierkiewicz wrote:
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> against Linus' tree
>
> include/linux/ata.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> Index: b/include/linux/ata.h
> ===================================================================
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -800,6 +800,17 @@ static inline int ata_id_is_ssd(const u1
> return id[ATA_ID_ROT_SPEED] == 0x01;
> }
>
> +static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
> +{
> + /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
> + if (ata_id_is_cfa(id) && pio > 4)
>
It actually makes sense to put the cheap 'pio' check first. We
shouldn't call ata_id_is_cfa() for all modes.
> + return 0;
> + /* PIO3 and higher it is mandatory. */
> + if (pio > 2 || ata_id_has_iordy(id))
> + return 1;
> + return 0;
> +}
> +
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper
2009-06-13 20:49 ` Sergei Shtylyov
@ 2009-06-15 16:32 ` Bartlomiej Zolnierkiewicz
2009-06-15 17:21 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-15 16:32 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide, Jeff Garzik
On Saturday 13 June 2009 22:49:26 Sergei Shtylyov wrote:
> Hello.
>
> Bartlomiej Zolnierkiewicz wrote:
>
> > Cc: Jeff Garzik <jgarzik@pobox.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > against Linus' tree
> >
> > include/linux/ata.h | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > Index: b/include/linux/ata.h
> > ===================================================================
> > --- a/include/linux/ata.h
> > +++ b/include/linux/ata.h
> > @@ -800,6 +800,17 @@ static inline int ata_id_is_ssd(const u1
> > return id[ATA_ID_ROT_SPEED] == 0x01;
> > }
> >
> > +static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
> > +{
> > + /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
> > + if (ata_id_is_cfa(id) && pio > 4)
> >
>
> It actually makes sense to put the cheap 'pio' check first. We
> shouldn't call ata_id_is_cfa() for all modes.
It is a micro-optimization but why not... revised version follows.
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] ata: add ata_id_pio_need_iordy() helper (v2)
v2:
Minor fixes per Sergei's review.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
against Linus' tree
include/linux/ata.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Index: b/include/linux/ata.h
===================================================================
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -800,6 +800,20 @@ static inline int ata_id_is_ssd(const u1
return id[ATA_ID_ROT_SPEED] == 0x01;
}
+static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
+{
+ /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
+ if (pio > 4 && ata_id_is_cfa(id))
+ return 0;
+ /* For PIO3 and higher it is mandatory. */
+ if (pio > 2)
+ return 1;
+ /* Turn it on when possible. */
+ if (ata_id_has_iordy(id))
+ return 1;
+ return 0;
+}
+
static inline int ata_drive_40wire(const u16 *dev_id)
{
if (ata_id_is_sata(dev_id))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper
2009-06-15 16:32 ` Bartlomiej Zolnierkiewicz
@ 2009-06-15 17:21 ` Jeff Garzik
0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2009-06-15 17:21 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: Sergei Shtylyov, linux-ide
Bartlomiej Zolnierkiewicz wrote:
> On Saturday 13 June 2009 22:49:26 Sergei Shtylyov wrote:
>> Hello.
>>
>> Bartlomiej Zolnierkiewicz wrote:
>>
>>> Cc: Jeff Garzik <jgarzik@pobox.com>
>>> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>> ---
>>> against Linus' tree
>>>
>>> include/linux/ata.h | 11 +++++++++++
>>> 1 file changed, 11 insertions(+)
>>>
>>> Index: b/include/linux/ata.h
>>> ===================================================================
>>> --- a/include/linux/ata.h
>>> +++ b/include/linux/ata.h
>>> @@ -800,6 +800,17 @@ static inline int ata_id_is_ssd(const u1
>>> return id[ATA_ID_ROT_SPEED] == 0x01;
>>> }
>>>
>>> +static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
>>> +{
>>> + /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
>>> + if (ata_id_is_cfa(id) && pio > 4)
>>>
>> It actually makes sense to put the cheap 'pio' check first. We
>> shouldn't call ata_id_is_cfa() for all modes.
>
> It is a micro-optimization but why not... revised version follows.
>
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] ata: add ata_id_pio_need_iordy() helper (v2)
>
> v2:
> Minor fixes per Sergei's review.
>
> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> against Linus' tree
>
> include/linux/ata.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> Index: b/include/linux/ata.h
> ===================================================================
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -800,6 +800,20 @@ static inline int ata_id_is_ssd(const u1
> return id[ATA_ID_ROT_SPEED] == 0x01;
> }
>
> +static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
> +{
> + /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
> + if (pio > 4 && ata_id_is_cfa(id))
> + return 0;
> + /* For PIO3 and higher it is mandatory. */
> + if (pio > 2)
> + return 1;
> + /* Turn it on when possible. */
> + if (ata_id_has_iordy(id))
> + return 1;
> + return 0;
ACK
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-15 17:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-13 16:21 [PATCH 1/3] ata: add ata_id_pio_need_iordy() helper Bartlomiej Zolnierkiewicz
2009-06-13 20:19 ` Sergei Shtylyov
2009-06-13 20:49 ` Sergei Shtylyov
2009-06-15 16:32 ` Bartlomiej Zolnierkiewicz
2009-06-15 17:21 ` Jeff Garzik
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.