From: Harvey Harrison <harvey.harrison@gmail.com>
To: Tejun Heo <htejun@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
linux-ide <linux-ide@vger.kernel.org>
Subject: Re: [RFC-UGLYPATCH] ata: small optimization in linux/libata.h
Date: Thu, 14 Feb 2008 16:05:02 -0800 [thread overview]
Message-ID: <1203033902.10192.7.camel@brick> (raw)
In-Reply-To: <47B4D129.8060308@gmail.com>
On Fri, 2008-02-15 at 08:39 +0900, Tejun Heo wrote:
> Harvey Harrison wrote:
> > This patch may be too ugly to live, it suppresses a lot of
> > sparse warnings in the libata build and produces slightly
> > tighter code. (4 instructions vs 5 and a few bytes saved).
> >
> > include/linux/libata.h:1214:13: warning: potentially expensive pointer subtraction
> > ---
> > I know it's ugly, but I had it done anyways. The one real problem I have
> > with it is that if link and ap->pmp_link ever get changed to different types
> > the compiler will not even warn as we cast away to (char *). To make it
> > a bit more robust, a BUILD_BUG_ON checking the pointer types may be a
> > good idea.
>
> Sorry, but Nacked-by: Tejun Heo <htejun@gmail.com>
>
Can't say I really blame you, other than this one error, drivers/ata
builds almost sparse-clean, and I had it done anyways. I wonder if
a helper similar in spirit would be any better. This doesn't have
any typechecking, but perhaps that could be dealt with too.
Ran into a similar problem with mmzone.h, akpm has the patch, but
maybe a helper (kernel.h?) would be cleaner. Or maybe it's just
better to live with the sparse warnings....
/*
* return the offset of the ptr from the base, in bytes.
*/
#define PTR_OFF(base, ptr) \
((char *)ptr - (char *)base)
if (PTR_OFF(ap->pmp_link, ++link) < ap->nr_pmp_links * sizeof(*link))
return link;
Cheers,
Harvey
next prev parent reply other threads:[~2008-02-15 0:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-14 19:16 [RFC-UGLYPATCH] ata: small optimization in linux/libata.h Harvey Harrison
2008-02-14 23:39 ` Tejun Heo
2008-02-15 0:05 ` Harvey Harrison [this message]
2008-02-15 1:58 ` Tejun Heo
2008-02-15 8:56 ` Mikael Pettersson
2008-02-15 16:10 ` Jeff Garzik
2008-02-15 21:32 ` Christer Weinigel
2008-02-15 21:41 ` [PATCH] ata: fix sparse warning in libata.h Harvey Harrison
2008-02-15 22:18 ` Tejun Heo
2008-02-20 17:12 ` 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=1203033902.10192.7.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
/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 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.