i2c: core: replace boolean variable by integer
Subsystems (2)
PATCH v3 1/1 i2c: core: replace boolean variable by integer
There is a warning when compiling i2c-core.c drivers/i2c/i2c-core.c:2561:36: warning: dubious: x | !y
Replace boolean exdpression by a plain bitwise AND since I2C_M_RD is a bit 0 and thus we are on the safe side.
---
Changelog v3:
- add tag
- rephrase commit message
drivers/i2c/i2c-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core.c +1 -1
@@ -2591,7 +2591,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count)static u8 i2c_smbus_msg_pec (u8 pec,struct i2c_msg *msg) {/* The address will be sent first */ -u8 addr = (msg->addr <<1 ) | !!(msg->flags &I2C_M_RD ); +u8 addr = (msg->addr <<1 ) | (msg->flags &I2C_M_RD ); pec =i2c_smbus_pec (pec, &addr,1 );/* The data buffer follows */
Signature · 1 line
2.6.2
Quoted 6 lines · Andy Shevchenko
There is a warning when compiling
i2c-core.cdrivers/i2c/i2c-core.c:2561:36: warning: dubious: x | !yReplace boolean exdpression by a plain bitwise AND since
I2C_M_RDis a bit 0
and thus we are on the safe side.
Wolfram, any news about this change? Last time I remember you talked about your series which makes this change obsolete.
Quoted 24 lines
Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Alexander Sverdlin <[email protected]>---
Changelog v3:
- add tag
- rephrase commit message
drivers/i2c/i2c-core.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/i2c-core.c +1
-1@@ -2591,7 +2591,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) static u8 i2c_smbus_msg_pec(u8 pec, struct i2c_msg *msg) { /* The address will be sent first */ -u8 addr = (msg->addr <<1 ) | !!(msg->flags &I2C_M_RD ); +u8 addr = (msg->addr <<1 ) | (msg->flags &I2C_M_RD ); pec = i2c_smbus_pec(pec, &addr, 1);
/* The data buffer follows */
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
There is a warning when compiling
i2c-core.cdrivers/i2c/i2c-core.c:2561:36: warning: dubious: x | !yReplace boolean exdpression by a plain bitwise AND since
I2C_M_RDis a bit 0
and thus we are on the safe side.Wolfram, any news about this change? Last time I remember you talked about your series which makes this change obsolete.
-EBUSY :/
I hope to tackle it on the train to FOSDEM later this week...
Hello,
Quoted 4 lines · Andy Shevchenko
There is a warning when compiling
i2c-core.cdrivers/i2c/i2c-core.c:2561:36: warning: dubious: x | !yReplace boolean exdpression by a plain bitwise AND since
I2C_M_RDis a bit 0
s/exdpression/expression/
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |