mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jeff Garzik <jgarzik@redhat.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Mikael Pettersson <mikpe@it.uu.se>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: 2.6.29-rc libata sff 32bit PIO regression
Date: Mon, 2 Feb 2009 12:12:31 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0902021152220.17261@blonde.anvils> (raw)
In-Reply-To: <4986DDA9.6010903@ru.mvista.com>

On Mon, 2 Feb 2009, Sergei Shtylyov wrote:
> Hugh Dickins wrote:
> > But this patch works as well for me as the patch I posted before
> > (though much more verbose: please simplify if you see a better way).
> 
>   How about the following?
> 
> 		unsigned char *tail = buf + buflen - slop;
> 		unsigned char pad[4];
> 
> 		if (rw == READ) {
> 			if (slop <= 2)
> 				ioread16_rep(data_addr, pad, 1);
> 			else
> 				ioread32_rep(data_addr, pad, 1);
> 					memcpy(tail, pad, slop);

Too many tabs on the memcpy.

> 		} else {
> 			memcpy(pad, tail, slop);
> 			memset(pad + slop, 0, 4 - slop);

And we could make that line even more complicated!
But I think unsigned char pad[4] = {0, 0, 0, 0} would be better.
Though Alan didn't have it initialized at all: I don't know if
that was oversight or superior knowledge.  In Alan's case, one
should usually assume the latter.

> 			if (slop <= 2)
> 				iowrite16_rep(data_addr, pad, 1);
> 			else
> 				iowrite32_rep(data_addr, pad, 1);
> 		}

Well, I don't know.  I felt really pleased with using ioread16_rep
and the char array in my original patch, where slop might be 1 or 2
or 3; but once it comes down to always one single PIO op, I felt
it too lazy to be using the _rep form.

I really don't care, whatever works and best satisfies Alan.

> > -	return words << 2;
> > +
> > +	return buflen + (buflen & 1);
> >   
> 
>    return (buflen + 1) & ~1;
> 
>   Well, I guess I could just have posted my own patch... :-)

Yes, do go ahead, I'm not desperate to get my name in there!

Hugh

  reply	other threads:[~2009-02-02 12:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21 13:34 Hugh Dickins
2009-01-21 20:11 ` Mikael Pettersson
2009-01-21 21:47   ` Alan Cox
2009-01-21 22:51     ` Sergei Shtylyov
2009-01-21 22:58       ` Alan Cox
2009-01-21 23:34         ` Sergei Shtylyov
2009-01-21 23:37           ` Sergei Shtylyov
2009-01-22  0:20             ` Sergei Shtylyov
2009-01-25 15:22             ` Alan Cox
2009-01-26 19:11 ` Alan Cox
2009-01-31 15:11   ` Sergei Shtylyov
2009-01-31 16:06     ` Alan Cox
2009-01-31 16:57       ` Sergei Shtylyov
2009-02-01 21:13   ` Hugh Dickins
2009-02-02 11:48     ` Sergei Shtylyov
2009-02-02 12:12       ` Hugh Dickins [this message]
2009-02-02 14:17         ` Sergei Shtylyov
2009-02-03  3:59   ` Jeff Garzik
2009-02-04 11:10   ` Sergei Shtylyov
2009-01-26 19:12 ` Alan Cox
2009-02-03  4:00   ` Jeff Garzik

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=Pine.LNX.4.64.0902021152220.17261@blonde.anvils \
    --to=hugh@veritas.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    --cc=rjw@sisk.pl \
    --cc=sshtylyov@ru.mvista.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®