Skip to contentSkip to conversation

watchdog: sunxi: Fix compilation with C=2

PATCH In review Emilio López 4 participants 9 messages Apr 4, 2014 – May 26, 2014

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

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not a valid number

Fix it by using hex notation instead of the non-standard binary one

---
 drivers/watchdog/sunxi_wdt.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/watchdog/sunxi_wdt.c +11 -11
index cd00a78..693b9d2 100644
@@ -57,17 +57,17 @@ struct sunxi_wdt_dev {
  */
 
 static const int wdt_timeout_map[] = {
-	[1] = 0b0001,  /* 1s  */
-	[2] = 0b0010,  /* 2s  */
-	[3] = 0b0011,  /* 3s  */
-	[4] = 0b0100,  /* 4s  */
-	[5] = 0b0101,  /* 5s  */
-	[6] = 0b0110,  /* 6s  */
-	[8] = 0b0111,  /* 8s  */
-	[10] = 0b1000, /* 10s */
-	[12] = 0b1001, /* 12s */
-	[14] = 0b1010, /* 14s */
-	[16] = 0b1011, /* 16s */
+	[1] = 0x1,  /* 1s  */
+	[2] = 0x2,  /* 2s  */
+	[3] = 0x3,  /* 3s  */
+	[4] = 0x4,  /* 4s  */
+	[5] = 0x5,  /* 5s  */
+	[6] = 0x6,  /* 6s  */
+	[8] = 0x7,  /* 8s  */
+	[10] = 0x8, /* 10s */
+	[12] = 0x9, /* 12s */
+	[14] = 0xA, /* 14s */
+	[16] = 0xB, /* 16s */
 };
 
 static int sunxi_wdt_ping(struct watchdog_device *wdt_dev)
Signature · 1 line
1.9.1
maintainer
#1 lore raw

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

Quoted 7 lines · Emilio L?pez

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not a valid number

Fix it by using hex notation instead of the non-standard binary one

What defines "non-standard" here ? Isn't this a sparse problem that should possibly be fixed in sparse instead ?

[ I don't mind changing it as the 0bXXXX notation doesn't seem to be used much
in the kernel, but we should not claim something to be non-standard if it is just not widely used. As normal compilation doesn't seem to have a problem, we should be sure that it is non-standard if we claim it to be non-standard. ]

Thanks,
Guenter

Quoted 39 lines
---
  drivers/watchdog/sunxi_wdt.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
drivers/watchdog/sunxi_wdt.c +11 -11
index cd00a78..693b9d2 100644
@@ -57,17 +57,17 @@ struct sunxi_wdt_dev {
   */
 
  static const int wdt_timeout_map[] = {
-	[1] = 0b0001,  /* 1s  */
-	[2] = 0b0010,  /* 2s  */
-	[3] = 0b0011,  /* 3s  */
-	[4] = 0b0100,  /* 4s  */
-	[5] = 0b0101,  /* 5s  */
-	[6] = 0b0110,  /* 6s  */
-	[8] = 0b0111,  /* 8s  */
-	[10] = 0b1000, /* 10s */
-	[12] = 0b1001, /* 12s */
-	[14] = 0b1010, /* 14s */
-	[16] = 0b1011, /* 16s */
+	[1] = 0x1,  /* 1s  */
+	[2] = 0x2,  /* 2s  */
+	[3] = 0x3,  /* 3s  */
+	[4] = 0x4,  /* 4s  */
+	[5] = 0x5,  /* 5s  */
+	[6] = 0x6,  /* 6s  */
+	[8] = 0x7,  /* 8s  */
+	[10] = 0x8, /* 10s */
+	[12] = 0x9, /* 12s */
+	[14] = 0xA, /* 14s */
+	[16] = 0xB, /* 16s */
  };
 
  static int sunxi_wdt_ping(struct watchdog_device *wdt_dev)
#2 lore raw

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

Hi,

El 04/04/14 14:35, Guenter Roeck escribi?:

Quoted 11 lines · Emilio L?pez
Quoted 8 lines

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

     drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not

a valid number

Fix it by using hex notation instead of the non-standard binary one

What defines "non-standard" here ?

non-standard as not part of the C standard. Binary constant notation is a GCC extension as far as I'm aware:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23479
http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html (Note the "C Extensions" section)

Quoted 3 lines

Isn't this a sparse problem that
should possibly
be fixed in sparse instead ?

It could be fixed in sparse as well, I don't really mind either way. The binary notation doesn't seem to be used much, if at all, on the kernel though; most of the matches I saw when quickly grepping were comments.

Cheers,

Emilio

maintainer
#3 lore raw

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

Quoted 13 lines · Emilio L?pez

Hi,

El 04/04/14 14:35, Guenter Roeck escribi?:

Quoted 10 lines · Emilio L?pez
Quoted 8 lines

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

     drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not

a valid number

Fix it by using hex notation instead of the non-standard binary one

Quoted 7 lines
Quoted 1 line

What defines "non-standard" here ?

non-standard as not part of the C standard. Binary constant notation is a GCC extension as far as I'm aware:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23479
http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html (Note the "C Extensions" section)

Ok.

Quoted 6 lines
Quoted 3 lines

Isn't this a sparse problem that
should possibly
be fixed in sparse instead ?

It could be fixed in sparse as well, I don't really mind either way. The binary notation doesn't seem to be used much, if at all, on the kernel though; most of the matches I saw when quickly grepping were comments.

Nah, if it is non-standard I don't think that would be a good idea.

Guenter

maintainer
#4 lore raw

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

In reply to Emilio López
Quoted 8 lines · Emilio L?pez

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not a valid number

Fix it by using hex notation instead of the non-standard binary one

#5 lore raw

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

El 04/04/14 15:02, Guenter Roeck escribi?:

Quoted 13 lines · Emilio L?pez
Quoted 9 lines

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

     drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not

a valid number

Fix it by using hex notation instead of the non-standard binary one

Wim, Maxime, any comments on this?

Cheers,

Emilio

#6 lore raw

PATCH 1/1 watchdog: sunxi: Fix compilation with C=2

Quoted 8 lines · Emilio L?pez

El 04/04/14 15:02, Guenter Roeck escribi?:

Quoted 7 lines · Emilio L?pez
Quoted 6 lines

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

    drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not

a valid number

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Fix it by using hex notation instead of the non-standard binary one

Wim, Maxime, any comments on this?

I'm fine with this. Wim? Do you want to take this patch, or can we have an Acked-by?

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140515/1c5a5fa7/attachment.sig>
#7 lore raw

Hi Maxime,

Quoted 13 lines · Emilio López
Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Emilio López
Quoted 9 lines

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

    drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not

a valid number

Fix it by using hex notation instead of the non-standard binary one

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Wim, Maxime, any comments on this?

I'm fine with this. Wim? Do you want to take this patch, or can we have an Acked-by?

I'm taking the patch.

Kind regards,
Wim.

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

#8 lore raw
In reply to Emilio López

Hi Emilio,

Quoted 35 lines

When compiling sunxi_defconfig while using C=2, the following error causes the compilation to fail:

drivers/watchdog/sunxi_wdt.c:60:15: error: constant 0b0001 is not a valid number

Fix it by using hex notation instead of the non-standard binary one

---
 drivers/watchdog/sunxi_wdt.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/watchdog/sunxi_wdt.c +4 -11
index cd00a78..693b9d2 100644
@@ -57,17 +57,17 @@ struct sunxi_wdt_dev {
  */
 
 static const int wdt_timeout_map[] = {
-	[1] = 0b0001,  /* 1s  */
-	[2] = 0b0010,  /* 2s  */
-	[3] = 0b0011,  /* 3s  */
-	[4] = 0b0100,  /* 4s  */
-	[5] = 0b0101,  /* 5s  */
-	[6] = 0b0110,  /* 6s  */
-	[8] = 0b0111,  /* 8s  */
-	[10] = 0b1000, /* 10s */
-	[12] = 0b1001, /* 12s */
-	[14] = 0b1010, /* 14s */
-	[16] = 0b1011, /* 16s */
+	[1] = 0x1,  /* 1s  */
+	[2] = 0x2,  /* 2s  */
+	[3] = 0x3,  /* 3s  */
+	[4] = 0x4,  /* 4s  */

drivers/watchdog/sunxi_wdt.c struct sunxi_wdt_dev { · line 73

Quoted 10 lines
drivers/watchdog/sunxi_wdt.c +7 -0
+	[5] = 0x5,  /* 5s  */
+	[6] = 0x6,  /* 6s  */
+	[8] = 0x7,  /* 8s  */
+	[10] = 0x8, /* 10s */
+	[12] = 0x9, /* 12s */
+	[14] = 0xA, /* 14s */
+	[16] = 0xB, /* 16s */
 };
 
 static int sunxi_wdt_ping(struct watchdog_device *wdt_dev)

This has been added to linux-watchdog-next.

Kind regards,
Wim.

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