diff options
author | Frank Li <Frank.Li@nxp.com> | 2024-10-21 11:45:06 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2024-10-31 23:51:00 +0100 |
commit | 16aed0a6520ba01b7d22c32e193fc1ec674f92d4 (patch) | |
tree | 032eeba90e44389a0135f0bb8aa898b093ba12f5 /drivers/i3c | |
parent | 9852d85ec9d492ebef56dc5f229416c925758edc (diff) | |
download | lwn-16aed0a6520ba01b7d22c32e193fc1ec674f92d4.tar.gz lwn-16aed0a6520ba01b7d22c32e193fc1ec674f92d4.zip |
i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
Replace the hardcoded value 2, which indicates 2 bits for I3C address
status, with the predefined macro I3C_ADDR_SLOT_STATUS_BITS.
Improve maintainability and extensibility of the code.
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20241021-i3c_dts_assign-v8-1-4098b8bde01e@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/i3c')
-rw-r--r-- | drivers/i3c/master.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 6f3eb710a75d..dcf8d23c5941 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -348,7 +348,7 @@ static enum i3c_addr_slot_status i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) { unsigned long status; - int bitpos = addr * 2; + int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS; if (addr > I2C_MAX_ADDR) return I3C_ADDR_SLOT_RSVD; @@ -362,7 +362,7 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, enum i3c_addr_slot_status status) { - int bitpos = addr * 2; + int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS; unsigned long *ptr; if (addr > I2C_MAX_ADDR) |