Skip to contentSkip to conversation

spi: Fix warning about redefinition

PATCH In review Nick Krause 4 participants 4 messages Aug 6, 2014 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: Fix warning about redefinition

Fix the following warnings about redefining READ and write

drivers/spi/spi-omap-100k.c:73:0: warning: "WRITE" redefined [enabled by default] include/linux/fs.h:193:0: note: this is the location of the previous definition drivers/spi/spi-omap-100k.c:74:0: warning: "READ" redefined [enabled by default] include/linux/fs.h:192:0: note: this is the location of the previous definition

---
 drivers/spi/spi-omap-100k.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/spi/spi-omap-100k.c +6 -0
index 5e91858..eb8ae4e 100644
@@ -70,6 +70,12 @@
 #define SPI_STATUS_WE                   (1UL << 1)
 #define SPI_STATUS_RD                   (1UL << 0)
 
+#ifdef WRITE
+#undef WRITE
+#endif
+#ifdef READ
+#undef READ
+#endif
 #define WRITE 0
 #define READ  1
 
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 18 lines · Nick Krause

Fix the following warnings about redefining READ and write

drivers/spi/spi-omap-100k.c:73:0: warning: "WRITE" redefined [enabled by default] include/linux/fs.h:193:0: note: this is the location of the previous definition drivers/spi/spi-omap-100k.c:74:0: warning: "READ" redefined [enabled by default] include/linux/fs.h:192:0: note: this is the location of the previous definition

---
 drivers/spi/spi-omap-100k.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/spi/spi-omap-100k.c +0 -0
index 5e91858..eb8ae4e 100644
@@ -70,6 +70,12 @@
 #define SPI_STATUS_WE                   (1UL << 1)

drivers/spi/spi-omap-100k.c line 80

Quoted 10 lines
drivers/spi/spi-omap-100k.c +6 -0
 #define SPI_STATUS_RD                   (1UL << 0)
 
+#ifdef WRITE
+#undef WRITE
+#endif
+#ifdef READ
+#undef READ
+#endif
 #define WRITE 0
 #define READ  1

Are these symbols even in use?

Quoted 8 lines
drivers/spi/spi-omap-100k.c +0 -1
--

1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 6 lines
Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#3 lore raw
In reply to Nick Krause

drivers/spi/spi-omap-100k.c line 80

Quoted 8 lines · Nick Krause
drivers/spi/spi-omap-100k.c +6 -0
+#ifdef WRITE
+#undef WRITE
+#endif
+#ifdef READ
+#undef READ
+#endif
 #define WRITE 0
 #define READ  1

Please think about what the effect of doing this is and look at how other similar problems have been addressed - the goal isn't to shut up the warning, it's to fix the problem the compiler is trying to tell you about.

#2 lore raw
In reply to Richard Weinberger
Quoted 21 lines · Richard Weinberger
Quoted 20 lines · Nick Krause

Fix the following warnings about redefining READ and write

drivers/spi/spi-omap-100k.c:73:0: warning: "WRITE" redefined [enabled by default] include/linux/fs.h:193:0: note: this is the location of the previous definition drivers/spi/spi-omap-100k.c:74:0: warning: "READ" redefined [enabled by default] include/linux/fs.h:192:0: note: this is the location of the previous definition

---
 drivers/spi/spi-omap-100k.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/spi/spi-omap-100k.c +0 -0
index 5e91858..eb8ae4e 100644
@@ -70,6 +70,12 @@
 #define SPI_STATUS_WE                   (1UL << 1)
 #define SPI_STATUS_RD                   (1UL << 0)
 
Quoted 11 lines

drivers/spi/spi-omap-100k.c line 80

Quoted 8 lines
drivers/spi/spi-omap-100k.c +6 -0
+#ifdef WRITE
+#undef WRITE
+#endif
+#ifdef READ
+#undef READ
+#endif
 #define WRITE 0
 #define READ  1

Are these symbols even in use?

It is always fun watching those patches flow by :-)

With the following patch:

drivers/spi/spi-omap-100k.c +2 -2
index 5e91858..f72ddfc 100644
@@ -70,8 +70,8 @@
 #define SPI_STATUS_WE                   (1UL << 1)
 #define SPI_STATUS_RD                   (1UL << 0)
 
-#define WRITE 0
-#define READ  1
+#undef WRITE
+#undef READ
 

[ just to make sure that no existing defines are used instead of the new ones ]

When compiling the resulting code with W=1, I get:

drivers/spi/spi-omap-100k.c: In function 'spi100k_read_data':
drivers/spi/spi-omap-100k.c:148:6: warning: variable 'dataH' set but not used
[-Wunused-but-set-variable]

So, one might conclude that the defines are not used.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html