mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Haojian Zhuang <haojian.zhuang@marvell.com>,
	Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [PATCH] backlight: fix 88pm860x_bl macro collision
Date: Fri, 18 Jun 2010 14:10:58 -0700	[thread overview]
Message-ID: <20100618141058.9044b83d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20100614170122.b44df729.randy.dunlap@oracle.com>

On Mon, 14 Jun 2010 17:01:22 -0700
Randy Dunlap <randy.dunlap@oracle.com> wrote:

> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> Fix collision with kernel-supplied #define:
> 
> drivers/video/backlight/88pm860x_bl.c:24:1: warning: "CURRENT_MASK" redefined
> arch/x86/include/asm/page_64_types.h:6:1: warning: this is the location of the previous definition
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
>  drivers/video/backlight/88pm860x_bl.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- lnx-2634-rc5.orig/drivers/video/backlight/88pm860x_bl.c
> +++ lnx-2634-rc5/drivers/video/backlight/88pm860x_bl.c
> @@ -21,7 +21,7 @@
>  #define MAX_BRIGHTNESS		(0xFF)
>  #define MIN_BRIGHTNESS		(0)
>  
> -#define CURRENT_MASK		(0x1F << 1)
> +#define CURRENT_BITMASK		(0x1F << 1)
>  
>  struct pm860x_backlight_data {
>  	struct pm860x_chip *chip;
> @@ -85,7 +85,7 @@ static int pm860x_backlight_set(struct b
>  	if ((data->current_brightness == 0) && brightness) {
>  		if (data->iset) {
>  			ret = pm860x_set_bits(data->i2c, wled_idc(data->port),
> -					      CURRENT_MASK, data->iset);
> +					      CURRENT_BITMASK, data->iset);
>  			if (ret < 0)
>  				goto out;
>  		}

mutter.  "CURRENT_BITMASK" isn't a lot better.  And look at
"MAX_BRIGHTNESS" and "MIN_BRIGHTNESS" up there (five instances of
MAX_BRIGHTNESS in the tree).

Just because a definition resides in a .c file doesn't mena that it's
"private"!  We should be more defensive about these things.  And
picking better identifiers gets you more ctags-friendliness for free.



      reply	other threads:[~2010-06-18 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  0:01 Randy Dunlap
2010-06-18 21:10 ` Andrew Morton [this message]

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=20100618141058.9044b83d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=haojian.zhuang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=rpurdie@rpsys.net \
    /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

Powered by JetHome