All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ata: replace macro with static inline in libata.h
Date: Wed, 20 Feb 2008 12:16:35 -0500	[thread overview]
Message-ID: <47BC6073.8080705@garzik.org> (raw)
In-Reply-To: <1203350873.5757.23.camel@brick>

Harvey Harrison wrote:
> Avoid ~70 sparse warnings like:
> drivers/ata/pata_ali.c:176:14: warning: symbol '__x' shadows an earlier one
> drivers/ata/pata_ali.c:176:14: originally declared here
> 
> Due to nesting min_t macro inside max_t macro which both use a __x
> identifier internally.
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
> Andrew, here is a patch that drastically reduces the number of sparse
> warnings in libata.  Alan Cox has suggested a clamp_t macro be added
> to kernel.h instead to avoid this issue.  I don't believe Jeff Garzik
> has given an opinion yet (other than not applying it when originally
> sent this was 5/11 of the libata sparse warnings)
> 
>  include/linux/libata.h |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index bc5a8d0..b5590fb 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -764,7 +764,14 @@ struct ata_timing {
>  	unsigned short udma;		/* t2CYCTYP/2 */
>  };
>  
> -#define FIT(v, vmin, vmax)	max_t(short, min_t(short, v, vmax), vmin)
> +static inline short FIT(short v, short vmin, short vmax)
> +{
> +	if (v >= vmax)
> +		return vmax;
> +	if (v <= vmin)
> +		return vmin;
> +	return v;
> +}

I agree with Alan...



  reply	other threads:[~2008-02-20 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 16:07 [PATCH] ata: replace macro with static inline in libata.h Harvey Harrison
2008-02-20 17:16 ` Jeff Garzik [this message]
2008-02-20 17:36   ` [PATCH] ata: use clamp_t macro to avoid sparse warnings Harvey Harrison

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=47BC6073.8080705@garzik.org \
    --to=jeff@garzik.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@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.