Skip to content

Commit 4b37895

Browse files
committed
Merge tag 'i3c/for-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux
Pull i3c updates from Alexandre Belloni: "Mostly non urgent fixes and a few improvements (including runtime pm suport) to the Silvaco driver" * tag 'i3c/for-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux: i3c: master: dw: check return of dw_i3c_master_get_free_pos() i3c: master: mipi-i3c-hci: correct the config reference for endianness i3c: master: svc: enable the interrupt in the enable ibi function i3c: master: svc: add the missing module device table i3c: master: svc: add runtime pm support i3c: master: svc: set ODSTOP to let I2C device see the STOP signal i3c: master: svc: add support for slave to stop returning data i3c: master: svc: separate err, fifo and disable interrupt of reset function i3c: master: svc: fix atomic issue i3c: master: svc: move module reset behind clk enable i3c/master/mipi-i3c-hci: Fix a potentially infinite loop in 'hci_dat_v1_get_index()' i3c: fix incorrect address slot lookup on 64-bit i3c/master/mipi-i3c-hci: Prefer kcalloc over open coded arithmetic i3c/master/mipi-i3c-hci: Prefer struct_size over open coded arithmetic
2 parents 96000bc + 13462ba commit 4b37895

File tree

7 files changed

+260
-98
lines changed

7 files changed

+260
-98
lines changed

drivers/i3c/master.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ struct bus_type i3c_bus_type = {
343343
static enum i3c_addr_slot_status
344344
i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
345345
{
346-
int status, bitpos = addr * 2;
346+
unsigned long status;
347+
int bitpos = addr * 2;
347348

348349
if (addr > I2C_MAX_ADDR)
349350
return I3C_ADDR_SLOT_RSVD;

drivers/i3c/master/dw-i3c-master.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
793793
return -ENOMEM;
794794

795795
pos = dw_i3c_master_get_free_pos(master);
796+
if (pos < 0) {
797+
dw_i3c_master_free_xfer(xfer);
798+
return pos;
799+
}
796800
cmd = &xfer->cmds[0];
797801
cmd->cmd_hi = 0x1;
798802
cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |

drivers/i3c/master/mipi-i3c-hci/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static int i3c_hci_init(struct i3c_hci *hci)
662662

663663
/* Make sure our data ordering fits the host's */
664664
regval = reg_read(HC_CONTROL);
665-
if (IS_ENABLED(CONFIG_BIG_ENDIAN)) {
665+
if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) {
666666
if (!(regval & HC_CONTROL_DATA_BIG_ENDIAN)) {
667667
regval |= HC_CONTROL_DATA_BIG_ENDIAN;
668668
reg_write(HC_CONTROL, regval);

drivers/i3c/master/mipi-i3c-hci/dat_v1.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ static int hci_dat_v1_get_index(struct i3c_hci *hci, u8 dev_addr)
160160
unsigned int dat_idx;
161161
u32 dat_w0;
162162

163-
for (dat_idx = find_first_bit(hci->DAT_data, hci->DAT_entries);
164-
dat_idx < hci->DAT_entries;
165-
dat_idx = find_next_bit(hci->DAT_data, hci->DAT_entries, dat_idx)) {
163+
for_each_set_bit(dat_idx, hci->DAT_data, hci->DAT_entries) {
166164
dat_w0 = dat_w0_read(dat_idx);
167165
if (FIELD_GET(DAT_0_DYNAMIC_ADDRESS, dat_w0) == dev_addr)
168166
return dat_idx;

drivers/i3c/master/mipi-i3c-hci/dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int hci_dma_init(struct i3c_hci *hci)
223223
}
224224
if (nr_rings > XFER_RINGS)
225225
nr_rings = XFER_RINGS;
226-
rings = kzalloc(sizeof(*rings) + nr_rings * sizeof(*rh), GFP_KERNEL);
226+
rings = kzalloc(struct_size(rings, headers, nr_rings), GFP_KERNEL);
227227
if (!rings)
228228
return -ENOMEM;
229229
hci->io_data = rings;

drivers/i3c/master/mipi-i3c-hci/hci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct hci_xfer {
9898

9999
static inline struct hci_xfer *hci_alloc_xfer(unsigned int n)
100100
{
101-
return kzalloc(sizeof(struct hci_xfer) * n, GFP_KERNEL);
101+
return kcalloc(n, sizeof(struct hci_xfer), GFP_KERNEL);
102102
}
103103

104104
static inline void hci_free_xfer(struct hci_xfer *xfer, unsigned int n)

0 commit comments

Comments
 (0)