tua6100: Avoid build warnings. [Linux 4.4.187]

This Linux kernel change "tua6100: Avoid build warnings" is included in the Linux 4.4.187 release. This change is authored by David S. Miller <davem [at] davemloft.net> on Thu May 30 11:36:15 2019 -0700. The commit for this change in Linux stable tree is 3c910e7 (patch) which is from upstream commit 621ccc6. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 621ccc6.

tua6100: Avoid build warnings.

[ Upstream commit 621ccc6cc5f8d6730b740d31d4818227866c93c9 ]

Rename _P to _P_VAL and _R to _R_VAL to avoid global
namespace conflicts:

drivers/media/dvb-frontends/tua6100.c: In function ‘tua6100_set_params’:
drivers/media/dvb-frontends/tua6100.c:79: warning: "_P" redefined
 #define _P 32

In file included from ./include/acpi/platform/aclinux.h:54,
                 from ./include/acpi/platform/acenv.h:152,
                 from ./include/acpi/acpi.h:22,
                 from ./include/linux/acpi.h:34,
                 from ./include/linux/i2c.h:17,
                 from drivers/media/dvb-frontends/tua6100.h:30,
                 from drivers/media/dvb-frontends/tua6100.c:32:
./include/linux/ctype.h:14: note: this is the location of the previous definition
 #define _P 0x10 /* punct */

Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 22 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/media/dvb-frontends/tua6100.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/media/dvb-frontends/tua6100.c b/drivers/media/dvb-frontends/tua6100.c
index 029384d..7a3e91c 100644
--- a/drivers/media/dvb-frontends/tua6100.c
+++ b/drivers/media/dvb-frontends/tua6100.c
@@ -80,8 +80,8 @@ static int tua6100_set_params(struct dvb_frontend *fe)
    struct i2c_msg msg1 = { .addr = priv->i2c_address, .flags = 0, .buf = reg1, .len = 4 };
    struct i2c_msg msg2 = { .addr = priv->i2c_address, .flags = 0, .buf = reg2, .len = 3 };

-#define _R 4
-#define _P 32
+#define _R_VAL 4
+#define _P_VAL 32
 #define _ri 4000000

    // setup register 0
@@ -96,14 +96,14 @@ static int tua6100_set_params(struct dvb_frontend *fe)
    else
        reg1[1] = 0x0c;

-   if (_P == 64)
+   if (_P_VAL == 64)
        reg1[1] |= 0x40;
    if (c->frequency >= 1525000)
        reg1[1] |= 0x80;

    // register 2
-   reg2[1] = (_R >> 8) & 0x03;
-   reg2[2] = _R;
+   reg2[1] = (_R_VAL >> 8) & 0x03;
+   reg2[2] = _R_VAL;
    if (c->frequency < 1455000)
        reg2[1] |= 0x1c;
    else if (c->frequency < 1630000)
@@ -115,18 +115,18 @@ static int tua6100_set_params(struct dvb_frontend *fe)
     * The N divisor ratio (note: c->frequency is in kHz, but we
     * need it in Hz)
     */
-   prediv = (c->frequency * _R) / (_ri / 1000);
-   div = prediv / _P;
+   prediv = (c->frequency * _R_VAL) / (_ri / 1000);
+   div = prediv / _P_VAL;
    reg1[1] |= (div >> 9) & 0x03;
    reg1[2] = div >> 1;
    reg1[3] = (div << 7);
-   priv->frequency = ((div * _P) * (_ri / 1000)) / _R;
+   priv->frequency = ((div * _P_VAL) * (_ri / 1000)) / _R_VAL;

    // Finally, calculate and store the value for A
-   reg1[3] |= (prediv - (div*_P)) & 0x7f;
+   reg1[3] |= (prediv - (div*_P_VAL)) & 0x7f;

-#undef _R
-#undef _P
+#undef _R_VAL
+#undef _P_VAL
 #undef _ri

    if (fe->ops.i2c_gate_ctrl)

Leave a Reply

Your email address will not be published. Required fields are marked *