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

Paolo Pisati <[email protected]>
Newsgroups gmane.linux.ports.m68k,gmane.linux.ide,gmane.linux.kernel
Message-ID <gsfi4glv5fnwzwdw3sm7r2evfwn7gl6xqzjvslxwghdfxvreeu@i6s3xc65iple>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.