summaryrefslogtreecommitdiff
path: root/include/linux/i3c/master.h
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@nxp.com>2024-10-21 11:45:06 -0400
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2024-10-31 23:51:00 +0100
commit16aed0a6520ba01b7d22c32e193fc1ec674f92d4 (patch)
tree032eeba90e44389a0135f0bb8aa898b093ba12f5 /include/linux/i3c/master.h
parent9852d85ec9d492ebef56dc5f229416c925758edc (diff)
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 'include/linux/i3c/master.h')
-rw-r--r--include/linux/i3c/master.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 2a1ed05d5782..2100547b2d8d 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -313,6 +313,8 @@ enum i3c_addr_slot_status {
I3C_ADDR_SLOT_STATUS_MASK = 3,
};
+#define I3C_ADDR_SLOT_STATUS_BITS 2
+
/**
* struct i3c_bus - I3C bus object
* @cur_master: I3C master currently driving the bus. Since I3C is multi-master
@@ -354,7 +356,7 @@ enum i3c_addr_slot_status {
struct i3c_bus {
struct i3c_dev_desc *cur_master;
int id;
- unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG];
+ unsigned long addrslots[((I2C_MAX_ADDR + 1) * I3C_ADDR_SLOT_STATUS_BITS) / BITS_PER_LONG];
enum i3c_bus_mode mode;
struct {
unsigned long i3c;