Skip to contentSkip to conversation

ASoC: Fix I2C component device id number creation

PATCH Applied Jarkko Nikula 3 participants 3 messages Oct 19, 2010

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

PATCH 1/1 ASoC: Fix I2C component device id number creation

Use bitwise AND instead of logical AND when masking.

---
Random note, not known to cause any problems at the moment as id field of codec seems to be unused.

---
 sound/soc/soc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-core.c +1 -1
index 8751efd..fe9f20b 100644
@@ -2892,7 +2892,7 @@ static inline char *fmt_single_name(struct device *dev, int *id)
 			char tmp[NAME_SIZE];
 
 			/* create unique ID number from I2C addr and bus */
-			*id = ((id1 && 0xffff) << 16) + id2;
+			*id = ((id1 & 0xffff) << 16) + id2;
 
 			/* sanitize component name for DAI link creation */
 			snprintf(tmp, NAME_SIZE, "%s.%s", dev->driver->name, name);
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Jarkko Nikula

Use bitwise AND instead of logical AND when masking.

---
Random note, not known to cause any problems at the moment as id field of codec seems to be unused.

---
 sound/soc/soc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/soc-core.c +0 -0
index 8751efd..fe9f20b 100644

sound/soc/soc-core.c static inline char *fmt_single_name(struct device *dev, int *id) · line 2898

Quoted 8 lines
sound/soc/soc-core.c +1 -1
@@ -2892,7 +2892,7 @@ static inline char *fmt_single_name(struct device *dev, int *id)
 			char tmp[NAME_SIZE];
 
 			/* create unique ID number from I2C addr and bus */
-			*id = ((id1 && 0xffff) << 16) + id2;
+			*id = ((id1 & 0xffff) << 16) + id2;
 
 			/* sanitize component name for DAI link creation */
 			snprintf(tmp, NAME_SIZE, "%s.%s", dev->driver->name, name);
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk