linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] [media] v4l2: SI476X MFD - Do not use binary constants
@ 2013-05-08 20:23 Geert Uytterhoeven
  2013-05-08 20:23 ` [PATCH 2/2] mfd: si476x: " Geert Uytterhoeven
  2013-05-13 14:29 ` [PATCH 1/2] [media] v4l2: SI476X MFD - " Andrey Smirnov
  0 siblings, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2013-05-08 20:23 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: linux-kernel, Geert Uytterhoeven, Mauro Carvalho Chehab, linux-media

Gcc < 4.3 doesn't understand binary constanrs (0b*):

drivers/media/radio/radio-si476x.c:862:20: error: invalid suffix "b10000000" on integer constant

Hence use a hexadecimal constant (0x*) instead.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
---
 drivers/media/radio/radio-si476x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
index 9430c6a..9dc8baf 100644
--- a/drivers/media/radio/radio-si476x.c
+++ b/drivers/media/radio/radio-si476x.c
@@ -44,7 +44,7 @@
 
 #define FREQ_MUL (10000000 / 625)
 
-#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b10000000 & (status))
+#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0x80 & (status))
 
 #define DRIVER_NAME "si476x-radio"
 #define DRIVER_CARD "SI476x AM/FM Receiver"
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mfd: si476x: Do not use binary constants
  2013-05-08 20:23 [PATCH 1/2] [media] v4l2: SI476X MFD - Do not use binary constants Geert Uytterhoeven
@ 2013-05-08 20:23 ` Geert Uytterhoeven
  2013-05-13 14:29   ` Andrey Smirnov
  2013-05-16 22:16   ` Samuel Ortiz
  2013-05-13 14:29 ` [PATCH 1/2] [media] v4l2: SI476X MFD - " Andrey Smirnov
  1 sibling, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2013-05-08 20:23 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: linux-kernel, Geert Uytterhoeven, Samuel Ortiz

Gcc < 4.3 doesn't understand binary constanrs (0b*):

drivers/mfd/si476x-cmd.c:153:22: error: invalid suffix "b11111" on integer constant
drivers/mfd/si476x-cmd.c:775:20: error: invalid suffix "b00001000" on integer constant
drivers/mfd/si476x-cmd.c:776:20: error: invalid suffix "b00000100" on integer constant
drivers/mfd/si476x-cmd.c:777:21: error: invalid suffix "b00000010" on integer constant
drivers/mfd/si476x-cmd.c:778:21: error: invalid suffix "b00000001" on integer constant
drivers/mfd/si476x-cmd.c:780:17: error: invalid suffix "b10000000" on integer constant
drivers/mfd/si476x-cmd.c:781:22: error: invalid suffix "b00100000" on integer constant
...

Hence use hexadecimal constants (0x*) instead.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
---
 drivers/mfd/si476x-cmd.c |  122 +++++++++++++++++++++++-----------------------
 1 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c
index de48b4e..f12f016 100644
--- a/drivers/mfd/si476x-cmd.c
+++ b/drivers/mfd/si476x-cmd.c
@@ -150,7 +150,7 @@ enum si476x_acf_status_report_bits {
 	SI476X_ACF_SOFTMUTE_INT	= (1 << 0),
 
 	SI476X_ACF_SMUTE	= (1 << 0),
-	SI476X_ACF_SMATTN	= 0b11111,
+	SI476X_ACF_SMATTN	= 0x1f,
 	SI476X_ACF_PILOT	= (1 << 7),
 	SI476X_ACF_STBLEND	= ~SI476X_ACF_PILOT,
 };
@@ -772,16 +772,16 @@ int si476x_core_cmd_am_rsq_status(struct si476x_core *core,
 	if (!report)
 		return err;
 
-	report->snrhint		= 0b00001000 & resp[1];
-	report->snrlint		= 0b00000100 & resp[1];
-	report->rssihint	= 0b00000010 & resp[1];
-	report->rssilint	= 0b00000001 & resp[1];
+	report->snrhint		= 0x08 & resp[1];
+	report->snrlint		= 0x04 & resp[1];
+	report->rssihint	= 0x02 & resp[1];
+	report->rssilint	= 0x01 & resp[1];
 
-	report->bltf		= 0b10000000 & resp[2];
-	report->snr_ready	= 0b00100000 & resp[2];
-	report->rssiready	= 0b00001000 & resp[2];
-	report->afcrl		= 0b00000010 & resp[2];
-	report->valid		= 0b00000001 & resp[2];
+	report->bltf		= 0x80 & resp[2];
+	report->snr_ready	= 0x20 & resp[2];
+	report->rssiready	= 0x08 & resp[2];
+	report->afcrl		= 0x02 & resp[2];
+	report->valid		= 0x01 & resp[2];
 
 	report->readfreq	= be16_to_cpup((__be16 *)(resp + 3));
 	report->freqoff		= resp[5];
@@ -931,26 +931,26 @@ int si476x_core_cmd_fm_rds_status(struct si476x_core *core,
 	if (err < 0 || report == NULL)
 		return err;
 
-	report->rdstpptyint	= 0b00010000 & resp[1];
-	report->rdspiint	= 0b00001000 & resp[1];
-	report->rdssyncint	= 0b00000010 & resp[1];
-	report->rdsfifoint	= 0b00000001 & resp[1];
+	report->rdstpptyint	= 0x10 & resp[1];
+	report->rdspiint	= 0x08 & resp[1];
+	report->rdssyncint	= 0x02 & resp[1];
+	report->rdsfifoint	= 0x01 & resp[1];
 
-	report->tpptyvalid	= 0b00010000 & resp[2];
-	report->pivalid		= 0b00001000 & resp[2];
-	report->rdssync		= 0b00000010 & resp[2];
-	report->rdsfifolost	= 0b00000001 & resp[2];
+	report->tpptyvalid	= 0x10 & resp[2];
+	report->pivalid		= 0x08 & resp[2];
+	report->rdssync		= 0x02 & resp[2];
+	report->rdsfifolost	= 0x01 & resp[2];
 
-	report->tp		= 0b00100000 & resp[3];
-	report->pty		= 0b00011111 & resp[3];
+	report->tp		= 0x20 & resp[3];
+	report->pty		= 0x1f & resp[3];
 
 	report->pi		= be16_to_cpup((__be16 *)(resp + 4));
 	report->rdsfifoused	= resp[6];
 
-	report->ble[V4L2_RDS_BLOCK_A]	= 0b11000000 & resp[7];
-	report->ble[V4L2_RDS_BLOCK_B]	= 0b00110000 & resp[7];
-	report->ble[V4L2_RDS_BLOCK_C]	= 0b00001100 & resp[7];
-	report->ble[V4L2_RDS_BLOCK_D]	= 0b00000011 & resp[7];
+	report->ble[V4L2_RDS_BLOCK_A]	= 0xc0 & resp[7];
+	report->ble[V4L2_RDS_BLOCK_B]	= 0x30 & resp[7];
+	report->ble[V4L2_RDS_BLOCK_C]	= 0x0c & resp[7];
+	report->ble[V4L2_RDS_BLOCK_D]	= 0x03 & resp[7];
 
 	report->rds[V4L2_RDS_BLOCK_A].block = V4L2_RDS_BLOCK_A;
 	report->rds[V4L2_RDS_BLOCK_A].msb = resp[8];
@@ -1005,7 +1005,7 @@ int si476x_core_cmd_fm_phase_diversity(struct si476x_core *core,
 {
 	u8       resp[CMD_FM_PHASE_DIVERSITY_NRESP];
 	const u8 args[CMD_FM_PHASE_DIVERSITY_NARGS] = {
-		mode & 0b111,
+		mode & 0x07,
 	};
 
 	return si476x_core_send_command(core, CMD_FM_PHASE_DIVERSITY,
@@ -1162,7 +1162,7 @@ static int si476x_core_cmd_am_tune_freq_a20(struct si476x_core *core,
 	const int am_freq = tuneargs->freq;
 	u8       resp[CMD_AM_TUNE_FREQ_NRESP];
 	const u8 args[CMD_AM_TUNE_FREQ_NARGS] = {
-		(tuneargs->zifsr << 6) | (tuneargs->injside & 0b11),
+		(tuneargs->zifsr << 6) | (tuneargs->injside & 0x03),
 		msb(am_freq),
 		lsb(am_freq),
 	};
@@ -1197,18 +1197,18 @@ static int si476x_core_cmd_fm_rsq_status_a10(struct si476x_core *core,
 	if (err < 0 || report == NULL)
 		return err;
 
-	report->multhint	= 0b10000000 & resp[1];
-	report->multlint	= 0b01000000 & resp[1];
-	report->snrhint		= 0b00001000 & resp[1];
-	report->snrlint		= 0b00000100 & resp[1];
-	report->rssihint	= 0b00000010 & resp[1];
-	report->rssilint	= 0b00000001 & resp[1];
+	report->multhint	= 0x80 & resp[1];
+	report->multlint	= 0x40 & resp[1];
+	report->snrhint		= 0x08 & resp[1];
+	report->snrlint		= 0x04 & resp[1];
+	report->rssihint	= 0x02 & resp[1];
+	report->rssilint	= 0x01 & resp[1];
 
-	report->bltf		= 0b10000000 & resp[2];
-	report->snr_ready	= 0b00100000 & resp[2];
-	report->rssiready	= 0b00001000 & resp[2];
-	report->afcrl		= 0b00000010 & resp[2];
-	report->valid		= 0b00000001 & resp[2];
+	report->bltf		= 0x80 & resp[2];
+	report->snr_ready	= 0x20 & resp[2];
+	report->rssiready	= 0x08 & resp[2];
+	report->afcrl		= 0x02 & resp[2];
+	report->valid		= 0x01 & resp[2];
 
 	report->readfreq	= be16_to_cpup((__be16 *)(resp + 3));
 	report->freqoff		= resp[5];
@@ -1251,18 +1251,18 @@ static int si476x_core_cmd_fm_rsq_status_a20(struct si476x_core *core,
 	if (err < 0 || report == NULL)
 		return err;
 
-	report->multhint	= 0b10000000 & resp[1];
-	report->multlint	= 0b01000000 & resp[1];
-	report->snrhint		= 0b00001000 & resp[1];
-	report->snrlint		= 0b00000100 & resp[1];
-	report->rssihint	= 0b00000010 & resp[1];
-	report->rssilint	= 0b00000001 & resp[1];
+	report->multhint	= 0x80 & resp[1];
+	report->multlint	= 0x40 & resp[1];
+	report->snrhint		= 0x08 & resp[1];
+	report->snrlint		= 0x04 & resp[1];
+	report->rssihint	= 0x02 & resp[1];
+	report->rssilint	= 0x01 & resp[1];
 
-	report->bltf		= 0b10000000 & resp[2];
-	report->snr_ready	= 0b00100000 & resp[2];
-	report->rssiready	= 0b00001000 & resp[2];
-	report->afcrl		= 0b00000010 & resp[2];
-	report->valid		= 0b00000001 & resp[2];
+	report->bltf		= 0x80 & resp[2];
+	report->snr_ready	= 0x20 & resp[2];
+	report->rssiready	= 0x08 & resp[2];
+	report->afcrl		= 0x02 & resp[2];
+	report->valid		= 0x01 & resp[2];
 
 	report->readfreq	= be16_to_cpup((__be16 *)(resp + 3));
 	report->freqoff		= resp[5];
@@ -1306,19 +1306,19 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core,
 	if (err < 0 || report == NULL)
 		return err;
 
-	report->multhint	= 0b10000000 & resp[1];
-	report->multlint	= 0b01000000 & resp[1];
-	report->snrhint		= 0b00001000 & resp[1];
-	report->snrlint		= 0b00000100 & resp[1];
-	report->rssihint	= 0b00000010 & resp[1];
-	report->rssilint	= 0b00000001 & resp[1];
-
-	report->bltf		= 0b10000000 & resp[2];
-	report->snr_ready	= 0b00100000 & resp[2];
-	report->rssiready	= 0b00001000 & resp[2];
-	report->injside         = 0b00000100 & resp[2];
-	report->afcrl		= 0b00000010 & resp[2];
-	report->valid		= 0b00000001 & resp[2];
+	report->multhint	= 0x80 & resp[1];
+	report->multlint	= 0x40 & resp[1];
+	report->snrhint		= 0x08 & resp[1];
+	report->snrlint		= 0x04 & resp[1];
+	report->rssihint	= 0x02 & resp[1];
+	report->rssilint	= 0x01 & resp[1];
+
+	report->bltf		= 0x80 & resp[2];
+	report->snr_ready	= 0x20 & resp[2];
+	report->rssiready	= 0x08 & resp[2];
+	report->injside         = 0x04 & resp[2];
+	report->afcrl		= 0x02 & resp[2];
+	report->valid		= 0x01 & resp[2];
 
 	report->readfreq	= be16_to_cpup((__be16 *)(resp + 3));
 	report->freqoff		= resp[5];
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mfd: si476x: Do not use binary constants
  2013-05-08 20:23 ` [PATCH 2/2] mfd: si476x: " Geert Uytterhoeven
@ 2013-05-13 14:29   ` Andrey Smirnov
  2013-05-13 14:41     ` Joe Perches
  2013-05-16 22:16   ` Samuel Ortiz
  1 sibling, 1 reply; 6+ messages in thread
From: Andrey Smirnov @ 2013-05-13 14:29 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-kernel, Samuel Ortiz

On Wed, May 8, 2013 at 1:23 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Gcc < 4.3 doesn't understand binary constanrs (0b*):
>
> drivers/mfd/si476x-cmd.c:153:22: error: invalid suffix "b11111" on integer constant
> drivers/mfd/si476x-cmd.c:775:20: error: invalid suffix "b00001000" on integer constant
> drivers/mfd/si476x-cmd.c:776:20: error: invalid suffix "b00000100" on integer constant
> drivers/mfd/si476x-cmd.c:777:21: error: invalid suffix "b00000010" on integer constant
> drivers/mfd/si476x-cmd.c:778:21: error: invalid suffix "b00000001" on integer constant
> drivers/mfd/si476x-cmd.c:780:17: error: invalid suffix "b10000000" on integer constant
> drivers/mfd/si476x-cmd.c:781:22: error: invalid suffix "b00100000" on integer constant
> ...
>
> Hence use hexadecimal constants (0x*) instead.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Samuel Ortiz <sameo@linux.intel.com>

Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>

I really begin to regret my decision to use those constants in place
instead of defining a corresponding symbol in a header file. Because
now that those binary constants are replaced the code looks a little
bit more cryptic. Currently I am doing some additional work on the
driver(adding the support of a different chip) and I'll try to make
patches to address the issue.


> ---
>  drivers/mfd/si476x-cmd.c |  122 +++++++++++++++++++++++-----------------------
>  1 files changed, 61 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c
> index de48b4e..f12f016 100644
> --- a/drivers/mfd/si476x-cmd.c
> +++ b/drivers/mfd/si476x-cmd.c
> @@ -150,7 +150,7 @@ enum si476x_acf_status_report_bits {
>         SI476X_ACF_SOFTMUTE_INT = (1 << 0),
>
>         SI476X_ACF_SMUTE        = (1 << 0),
> -       SI476X_ACF_SMATTN       = 0b11111,
> +       SI476X_ACF_SMATTN       = 0x1f,
>         SI476X_ACF_PILOT        = (1 << 7),
>         SI476X_ACF_STBLEND      = ~SI476X_ACF_PILOT,
>  };
> @@ -772,16 +772,16 @@ int si476x_core_cmd_am_rsq_status(struct si476x_core *core,
>         if (!report)
>                 return err;
>
> -       report->snrhint         = 0b00001000 & resp[1];
> -       report->snrlint         = 0b00000100 & resp[1];
> -       report->rssihint        = 0b00000010 & resp[1];
> -       report->rssilint        = 0b00000001 & resp[1];
> +       report->snrhint         = 0x08 & resp[1];
> +       report->snrlint         = 0x04 & resp[1];
> +       report->rssihint        = 0x02 & resp[1];
> +       report->rssilint        = 0x01 & resp[1];
>
> -       report->bltf            = 0b10000000 & resp[2];
> -       report->snr_ready       = 0b00100000 & resp[2];
> -       report->rssiready       = 0b00001000 & resp[2];
> -       report->afcrl           = 0b00000010 & resp[2];
> -       report->valid           = 0b00000001 & resp[2];
> +       report->bltf            = 0x80 & resp[2];
> +       report->snr_ready       = 0x20 & resp[2];
> +       report->rssiready       = 0x08 & resp[2];
> +       report->afcrl           = 0x02 & resp[2];
> +       report->valid           = 0x01 & resp[2];
>
>         report->readfreq        = be16_to_cpup((__be16 *)(resp + 3));
>         report->freqoff         = resp[5];
> @@ -931,26 +931,26 @@ int si476x_core_cmd_fm_rds_status(struct si476x_core *core,
>         if (err < 0 || report == NULL)
>                 return err;
>
> -       report->rdstpptyint     = 0b00010000 & resp[1];
> -       report->rdspiint        = 0b00001000 & resp[1];
> -       report->rdssyncint      = 0b00000010 & resp[1];
> -       report->rdsfifoint      = 0b00000001 & resp[1];
> +       report->rdstpptyint     = 0x10 & resp[1];
> +       report->rdspiint        = 0x08 & resp[1];
> +       report->rdssyncint      = 0x02 & resp[1];
> +       report->rdsfifoint      = 0x01 & resp[1];
>
> -       report->tpptyvalid      = 0b00010000 & resp[2];
> -       report->pivalid         = 0b00001000 & resp[2];
> -       report->rdssync         = 0b00000010 & resp[2];
> -       report->rdsfifolost     = 0b00000001 & resp[2];
> +       report->tpptyvalid      = 0x10 & resp[2];
> +       report->pivalid         = 0x08 & resp[2];
> +       report->rdssync         = 0x02 & resp[2];
> +       report->rdsfifolost     = 0x01 & resp[2];
>
> -       report->tp              = 0b00100000 & resp[3];
> -       report->pty             = 0b00011111 & resp[3];
> +       report->tp              = 0x20 & resp[3];
> +       report->pty             = 0x1f & resp[3];
>
>         report->pi              = be16_to_cpup((__be16 *)(resp + 4));
>         report->rdsfifoused     = resp[6];
>
> -       report->ble[V4L2_RDS_BLOCK_A]   = 0b11000000 & resp[7];
> -       report->ble[V4L2_RDS_BLOCK_B]   = 0b00110000 & resp[7];
> -       report->ble[V4L2_RDS_BLOCK_C]   = 0b00001100 & resp[7];
> -       report->ble[V4L2_RDS_BLOCK_D]   = 0b00000011 & resp[7];
> +       report->ble[V4L2_RDS_BLOCK_A]   = 0xc0 & resp[7];
> +       report->ble[V4L2_RDS_BLOCK_B]   = 0x30 & resp[7];
> +       report->ble[V4L2_RDS_BLOCK_C]   = 0x0c & resp[7];
> +       report->ble[V4L2_RDS_BLOCK_D]   = 0x03 & resp[7];
>
>         report->rds[V4L2_RDS_BLOCK_A].block = V4L2_RDS_BLOCK_A;
>         report->rds[V4L2_RDS_BLOCK_A].msb = resp[8];
> @@ -1005,7 +1005,7 @@ int si476x_core_cmd_fm_phase_diversity(struct si476x_core *core,
>  {
>         u8       resp[CMD_FM_PHASE_DIVERSITY_NRESP];
>         const u8 args[CMD_FM_PHASE_DIVERSITY_NARGS] = {
> -               mode & 0b111,
> +               mode & 0x07,
>         };
>
>         return si476x_core_send_command(core, CMD_FM_PHASE_DIVERSITY,
> @@ -1162,7 +1162,7 @@ static int si476x_core_cmd_am_tune_freq_a20(struct si476x_core *core,
>         const int am_freq = tuneargs->freq;
>         u8       resp[CMD_AM_TUNE_FREQ_NRESP];
>         const u8 args[CMD_AM_TUNE_FREQ_NARGS] = {
> -               (tuneargs->zifsr << 6) | (tuneargs->injside & 0b11),
> +               (tuneargs->zifsr << 6) | (tuneargs->injside & 0x03),
>                 msb(am_freq),
>                 lsb(am_freq),
>         };
> @@ -1197,18 +1197,18 @@ static int si476x_core_cmd_fm_rsq_status_a10(struct si476x_core *core,
>         if (err < 0 || report == NULL)
>                 return err;
>
> -       report->multhint        = 0b10000000 & resp[1];
> -       report->multlint        = 0b01000000 & resp[1];
> -       report->snrhint         = 0b00001000 & resp[1];
> -       report->snrlint         = 0b00000100 & resp[1];
> -       report->rssihint        = 0b00000010 & resp[1];
> -       report->rssilint        = 0b00000001 & resp[1];
> +       report->multhint        = 0x80 & resp[1];
> +       report->multlint        = 0x40 & resp[1];
> +       report->snrhint         = 0x08 & resp[1];
> +       report->snrlint         = 0x04 & resp[1];
> +       report->rssihint        = 0x02 & resp[1];
> +       report->rssilint        = 0x01 & resp[1];
>
> -       report->bltf            = 0b10000000 & resp[2];
> -       report->snr_ready       = 0b00100000 & resp[2];
> -       report->rssiready       = 0b00001000 & resp[2];
> -       report->afcrl           = 0b00000010 & resp[2];
> -       report->valid           = 0b00000001 & resp[2];
> +       report->bltf            = 0x80 & resp[2];
> +       report->snr_ready       = 0x20 & resp[2];
> +       report->rssiready       = 0x08 & resp[2];
> +       report->afcrl           = 0x02 & resp[2];
> +       report->valid           = 0x01 & resp[2];
>
>         report->readfreq        = be16_to_cpup((__be16 *)(resp + 3));
>         report->freqoff         = resp[5];
> @@ -1251,18 +1251,18 @@ static int si476x_core_cmd_fm_rsq_status_a20(struct si476x_core *core,
>         if (err < 0 || report == NULL)
>                 return err;
>
> -       report->multhint        = 0b10000000 & resp[1];
> -       report->multlint        = 0b01000000 & resp[1];
> -       report->snrhint         = 0b00001000 & resp[1];
> -       report->snrlint         = 0b00000100 & resp[1];
> -       report->rssihint        = 0b00000010 & resp[1];
> -       report->rssilint        = 0b00000001 & resp[1];
> +       report->multhint        = 0x80 & resp[1];
> +       report->multlint        = 0x40 & resp[1];
> +       report->snrhint         = 0x08 & resp[1];
> +       report->snrlint         = 0x04 & resp[1];
> +       report->rssihint        = 0x02 & resp[1];
> +       report->rssilint        = 0x01 & resp[1];
>
> -       report->bltf            = 0b10000000 & resp[2];
> -       report->snr_ready       = 0b00100000 & resp[2];
> -       report->rssiready       = 0b00001000 & resp[2];
> -       report->afcrl           = 0b00000010 & resp[2];
> -       report->valid           = 0b00000001 & resp[2];
> +       report->bltf            = 0x80 & resp[2];
> +       report->snr_ready       = 0x20 & resp[2];
> +       report->rssiready       = 0x08 & resp[2];
> +       report->afcrl           = 0x02 & resp[2];
> +       report->valid           = 0x01 & resp[2];
>
>         report->readfreq        = be16_to_cpup((__be16 *)(resp + 3));
>         report->freqoff         = resp[5];
> @@ -1306,19 +1306,19 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core,
>         if (err < 0 || report == NULL)
>                 return err;
>
> -       report->multhint        = 0b10000000 & resp[1];
> -       report->multlint        = 0b01000000 & resp[1];
> -       report->snrhint         = 0b00001000 & resp[1];
> -       report->snrlint         = 0b00000100 & resp[1];
> -       report->rssihint        = 0b00000010 & resp[1];
> -       report->rssilint        = 0b00000001 & resp[1];
> -
> -       report->bltf            = 0b10000000 & resp[2];
> -       report->snr_ready       = 0b00100000 & resp[2];
> -       report->rssiready       = 0b00001000 & resp[2];
> -       report->injside         = 0b00000100 & resp[2];
> -       report->afcrl           = 0b00000010 & resp[2];
> -       report->valid           = 0b00000001 & resp[2];
> +       report->multhint        = 0x80 & resp[1];
> +       report->multlint        = 0x40 & resp[1];
> +       report->snrhint         = 0x08 & resp[1];
> +       report->snrlint         = 0x04 & resp[1];
> +       report->rssihint        = 0x02 & resp[1];
> +       report->rssilint        = 0x01 & resp[1];
> +
> +       report->bltf            = 0x80 & resp[2];
> +       report->snr_ready       = 0x20 & resp[2];
> +       report->rssiready       = 0x08 & resp[2];
> +       report->injside         = 0x04 & resp[2];
> +       report->afcrl           = 0x02 & resp[2];
> +       report->valid           = 0x01 & resp[2];
>
>         report->readfreq        = be16_to_cpup((__be16 *)(resp + 3));
>         report->freqoff         = resp[5];
> --
> 1.7.0.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] [media] v4l2: SI476X MFD - Do not use binary constants
  2013-05-08 20:23 [PATCH 1/2] [media] v4l2: SI476X MFD - Do not use binary constants Geert Uytterhoeven
  2013-05-08 20:23 ` [PATCH 2/2] mfd: si476x: " Geert Uytterhoeven
@ 2013-05-13 14:29 ` Andrey Smirnov
  1 sibling, 0 replies; 6+ messages in thread
From: Andrey Smirnov @ 2013-05-13 14:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kernel, Mauro Carvalho Chehab, Linux Media Mailing List

On Wed, May 8, 2013 at 1:23 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Gcc < 4.3 doesn't understand binary constanrs (0b*):
>
> drivers/media/radio/radio-si476x.c:862:20: error: invalid suffix "b10000000" on integer constant
>
> Hence use a hexadecimal constant (0x*) instead.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org

Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>

> ---
>  drivers/media/radio/radio-si476x.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
> index 9430c6a..9dc8baf 100644
> --- a/drivers/media/radio/radio-si476x.c
> +++ b/drivers/media/radio/radio-si476x.c
> @@ -44,7 +44,7 @@
>
>  #define FREQ_MUL (10000000 / 625)
>
> -#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b10000000 & (status))
> +#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0x80 & (status))
>
>  #define DRIVER_NAME "si476x-radio"
>  #define DRIVER_CARD "SI476x AM/FM Receiver"
> --
> 1.7.0.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mfd: si476x: Do not use binary constants
  2013-05-13 14:29   ` Andrey Smirnov
@ 2013-05-13 14:41     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2013-05-13 14:41 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: Geert Uytterhoeven, linux-kernel, Samuel Ortiz

On Mon, 2013-05-13 at 07:29 -0700, Andrey Smirnov wrote:
> On Wed, May 8, 2013 at 1:23 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > Gcc < 4.3 doesn't understand binary constanrs (0b*):
[]
> > Hence use hexadecimal constants (0x*) instead.
[]
> I really begin to regret my decision to use those constants in place
> instead of defining a corresponding symbol in a header file. Because
> now that those binary constants are replaced the code looks a little
> bit more cryptic. Currently I am doing some additional work on the
> driver(adding the support of a different chip) and I'll try to make
> patches to address the issue.
[]
> > diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c
[]
> > @@ -772,16 +772,16 @@ int si476x_core_cmd_am_rsq_status(struct si476x_core *core,
[]
> > +       report->snrhint         = 0x08 & resp[1];
> > +       report->snrlint         = 0x04 & resp[1];
> > +       report->rssihint        = 0x02 & resp[1];
> > +       report->rssilint        = 0x01 & resp[1];

You might also want to change all the
u8 report variables to bool.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mfd: si476x: Do not use binary constants
  2013-05-08 20:23 ` [PATCH 2/2] mfd: si476x: " Geert Uytterhoeven
  2013-05-13 14:29   ` Andrey Smirnov
@ 2013-05-16 22:16   ` Samuel Ortiz
  1 sibling, 0 replies; 6+ messages in thread
From: Samuel Ortiz @ 2013-05-16 22:16 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andrey Smirnov, linux-kernel

Hi Geert,

On Wed, May 08, 2013 at 10:23:42PM +0200, Geert Uytterhoeven wrote:
> Gcc < 4.3 doesn't understand binary constanrs (0b*):
> 
> drivers/mfd/si476x-cmd.c:153:22: error: invalid suffix "b11111" on integer constant
> drivers/mfd/si476x-cmd.c:775:20: error: invalid suffix "b00001000" on integer constant
> drivers/mfd/si476x-cmd.c:776:20: error: invalid suffix "b00000100" on integer constant
> drivers/mfd/si476x-cmd.c:777:21: error: invalid suffix "b00000010" on integer constant
> drivers/mfd/si476x-cmd.c:778:21: error: invalid suffix "b00000001" on integer constant
> drivers/mfd/si476x-cmd.c:780:17: error: invalid suffix "b10000000" on integer constant
> drivers/mfd/si476x-cmd.c:781:22: error: invalid suffix "b00100000" on integer constant
> ...
> 
> Hence use hexadecimal constants (0x*) instead.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> ---
>  drivers/mfd/si476x-cmd.c |  122 +++++++++++++++++++++++-----------------------
>  1 files changed, 61 insertions(+), 61 deletions(-)
Applied to mfd-fixes, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-16 22:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 20:23 [PATCH 1/2] [media] v4l2: SI476X MFD - Do not use binary constants Geert Uytterhoeven
2013-05-08 20:23 ` [PATCH 2/2] mfd: si476x: " Geert Uytterhoeven
2013-05-13 14:29   ` Andrey Smirnov
2013-05-13 14:41     ` Joe Perches
2013-05-16 22:16   ` Samuel Ortiz
2013-05-13 14:29 ` [PATCH 1/2] [media] v4l2: SI476X MFD - " Andrey Smirnov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).