Skip to contentSkip to conversation

backlight: fix 88pm860x_bl macro collision

PATCH In review Randy Dunlap 2 participants 2 messages Jun 15, 2010 – Jun 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backlight: fix 88pm860x_bl macro collision

From: Randy Dunlap <[email protected]>

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

Cc Haojian Zhuang <[email protected]>
---
 drivers/video/backlight/88pm860x_bl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/88pm860x_bl.c +2 -2
@@ -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;
 		}
#1 lore raw
Quoted 25 lines · On Mon, 14 Jun 2010 17:01:22 -0700 Randy Dunlap <[email protected]> wrote:

From: Randy Dunlap <[email protected]>

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

Cc Haojian Zhuang <[email protected]>
---
 drivers/video/backlight/88pm860x_bl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/88pm860x_bl.c +1 -1
@@ -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;

drivers/video/backlight/88pm860x_bl.c static int pm860x_backlight_set(struct b · line 91

Quoted 8 lines
drivers/video/backlight/88pm860x_bl.c +1 -1
@@ -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.