2009-11-08 19:27:00

by Krzysztof Halasa

[permalink] [raw]
Subject: ata_sff_data_xfer* return value

Hi,

I wonder if this is entirely correct? If so, why?
Only relevant parts left.

* RETURNS:
* Bytes consumed.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf,
unsigned int buflen, int rw)
{
unsigned int words = buflen >> 1;

...

/* Transfer trailing byte, if any. */
if (unlikely(buflen & 0x01)) {
...
words++;
}

return words << 1;



same here:

unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
unsigned int buflen, int rw)
{
...
return (buflen + 1) & ~1;

Please keep me in CC:, I'm not on the IDE list. Thanks.
--
Krzysztof Halasa


2009-11-08 20:01:00

by Alan

[permalink] [raw]
Subject: Re: ata_sff_data_xfer* return value

On Sun, 08 Nov 2009 20:27:02 +0100
Krzysztof Halasa <[email protected]> wrote:

> Hi,
>
> I wonder if this is entirely correct? If so, why?

It is correct. We return the bytes consumed as it may well not be the
same as the total bytes requested. In practice we don't currently do a
great deal with it even with ATAPI but it's useful for doing bug checks.

2009-11-08 20:06:02

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: ata_sff_data_xfer* return value

Alan Cox <[email protected]> writes:

> It is correct. We return the bytes consumed as it may well not be the
> same as the total bytes requested. In practice we don't currently do a
> great deal with it even with ATAPI but it's useful for doing bug checks.

I see. Thanks.
--
Krzysztof Halasa