Re: [PATCH v5 1/2] ata: pata_cswarp: Add Amiga cslab ata support

From: Paolo Pisati

Date: Wed Aug 26 2026 - 04:55:37 EST


On Tue, Aug 25, 2026 at 09:53:18AM +0200, Geert Uytterhoeven wrote:
> > +static unsigned int pata_cswarp_data_xfer(struct ata_queued_cmd *qc,
> > + unsigned char *buf,
> > + unsigned int buflen, int rw)
> > +{
> > + struct ata_device *dev = qc->dev;
> > + struct ata_port *ap = dev->link->ap;
> > + void __iomem *data_addr = ap->ioaddr.data_addr;
> > + unsigned int words = buflen >> 1;
> > + u16 *buf16 = (u16 *)buf;
> > +
> > + /* Transfer multiple of 2 bytes */
> > + if (rw == READ)
> > + raw_insw(data_addr, buf16, words);
> > + else
> > + raw_outsw(data_addr, buf16, words);
> > +
> > + /* Transfer trailing byte, if any. */
> > + if (unlikely(buflen & 0x01)) {
> > + if (rw == READ)
> > + buf[buflen - 1] = raw_inw(data_addr) >> 8;
> > + else
> > + raw_outw(buf[buflen - 1] << 8, data_addr);
> > + words++;
> > + }
> > +
> > + return words << 1;
>
> This may be one less than the actual number of bytes
> Why not buflen?

Cause every other driver (e.g. buddha, falcon, gayle, etc) is actually returning
words << 1: i think we are returning the "whole number of bytes" read
from the bus/ATA register here, or at least that's how i understood it.

Anyhow, thanks for the review, i'll send a V6 addressing all comments.
--
bye,
p.