Skip to content

Commit 74e931f

Browse files
jhnikulaalexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci: Switch to lower_32_bits()/upper_32_bits() helpers
Rather than having own lo32()/hi32() helpers for dealing with 32-bit and 64-bit build targets switch to generic lower_32_bits()/upper_32_bits() helpers. Signed-off-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent d9deb28 commit 74e931f

File tree

1 file changed

+6
-21
lines changed
  • drivers/i3c/master/mipi-i3c-hci

1 file changed

+6
-21
lines changed

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

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,6 @@ struct hci_dma_dev_ibi_data {
147147
unsigned int max_len;
148148
};
149149

150-
static inline u32 lo32(dma_addr_t physaddr)
151-
{
152-
return physaddr;
153-
}
154-
155-
static inline u32 hi32(dma_addr_t physaddr)
156-
{
157-
/* trickery to avoid compiler warnings on 32-bit build targets */
158-
if (sizeof(dma_addr_t) > 4) {
159-
u64 hi = physaddr;
160-
return hi >> 32;
161-
}
162-
return 0;
163-
}
164-
165150
static void hci_dma_cleanup(struct i3c_hci *hci)
166151
{
167152
struct hci_rings_data *rings = hci->io_data;
@@ -265,10 +250,10 @@ static int hci_dma_init(struct i3c_hci *hci)
265250
if (!rh->xfer || !rh->resp || !rh->src_xfers)
266251
goto err_out;
267252

268-
rh_reg_write(CMD_RING_BASE_LO, lo32(rh->xfer_dma));
269-
rh_reg_write(CMD_RING_BASE_HI, hi32(rh->xfer_dma));
270-
rh_reg_write(RESP_RING_BASE_LO, lo32(rh->resp_dma));
271-
rh_reg_write(RESP_RING_BASE_HI, hi32(rh->resp_dma));
253+
rh_reg_write(CMD_RING_BASE_LO, lower_32_bits(rh->xfer_dma));
254+
rh_reg_write(CMD_RING_BASE_HI, upper_32_bits(rh->xfer_dma));
255+
rh_reg_write(RESP_RING_BASE_LO, lower_32_bits(rh->resp_dma));
256+
rh_reg_write(RESP_RING_BASE_HI, upper_32_bits(rh->resp_dma));
272257

273258
regval = FIELD_PREP(CR_RING_SIZE, rh->xfer_entries);
274259
rh_reg_write(CR_SETUP, regval);
@@ -404,8 +389,8 @@ static int hci_dma_queue_xfer(struct i3c_hci *hci,
404389
hci_dma_unmap_xfer(hci, xfer_list, i);
405390
return -ENOMEM;
406391
}
407-
*ring_data++ = lo32(xfer->data_dma);
408-
*ring_data++ = hi32(xfer->data_dma);
392+
*ring_data++ = lower_32_bits(xfer->data_dma);
393+
*ring_data++ = upper_32_bits(xfer->data_dma);
409394
} else {
410395
*ring_data++ = 0;
411396
*ring_data++ = 0;

0 commit comments

Comments
 (0)