iio: adc: mcp3911: mask out device ID in debug prints
authorMarcus Folkesson <marcus.folkesson@gmail.com>
Mon, 10 Oct 2022 19:46:54 +0000 (21:46 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 Oct 2022 07:51:26 +0000 (08:51 +0100)
The Device ID should not be included when printing register.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Link: https://lore.kernel.org/r/20221010194654.676525-1-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/mcp3911.c

index f57f5eb23d49a6264ba19b563058d60e3d6905d4..76b334f5ac616326f704aee880d1b4d4fd039024 100644 (file)
@@ -57,6 +57,7 @@
 
 #define MCP3911_REG_READ(reg, id)      ((((reg) << 1) | ((id) << 6) | (1 << 0)) & 0xff)
 #define MCP3911_REG_WRITE(reg, id)     ((((reg) << 1) | ((id) << 6) | (0 << 0)) & 0xff)
+#define MCP3911_REG_MASK               GENMASK(4, 1)
 
 #define MCP3911_NUM_CHANNELS           2
 
@@ -89,8 +90,8 @@ static int mcp3911_read(struct mcp3911 *adc, u8 reg, u32 *val, u8 len)
 
        be32_to_cpus(val);
        *val >>= ((4 - len) * 8);
-       dev_dbg(&adc->spi->dev, "reading 0x%x from register 0x%x\n", *val,
-               reg >> 1);
+       dev_dbg(&adc->spi->dev, "reading 0x%x from register 0x%lx\n", *val,
+               FIELD_GET(MCP3911_REG_MASK, reg));
        return ret;
 }