[PATCH 5/5] i3c: mipi-i3c-hci: Convert remaining DBG() prints to dev_dbg()
Frank Li
Frank.li at nxp.com
Fri Sep 12 07:31:33 PDT 2025
On Wed, Aug 27, 2025 at 01:30:09PM +0300, Jarkko Nikula wrote:
> Get rid of local DBG() macro and convert remaining debug prints to
> dev_dbg() which can be controlled without code recompile when kernel is
> built with dynamic debug support.
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula at linux.intel.com>
> ---
> drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 9 ++-
> drivers/i3c/master/mipi-i3c-hci/cmd_v2.c | 7 ++-
> drivers/i3c/master/mipi-i3c-hci/core.c | 16 +++---
> drivers/i3c/master/mipi-i3c-hci/dma.c | 15 +++--
> drivers/i3c/master/mipi-i3c-hci/ext_caps.c | 11 ++--
> drivers/i3c/master/mipi-i3c-hci/hci.h | 3 -
> drivers/i3c/master/mipi-i3c-hci/pio.c | 66 +++++++++++++---------
> 7 files changed, 72 insertions(+), 55 deletions(-)
...
> -#define DBG(x, ...) pr_devel("%s: " x "\n", __func__, ##__VA_ARGS__)
> -
> /* 32-bit word aware bit and mask macros */
> #define W0_MASK(h, l) GENMASK((h) - 0, (l) - 0)
> #define W1_MASK(h, l) GENMASK((h) - 32, (l) - 32)
> diff --git a/drivers/i3c/master/mipi-i3c-hci/pio.c b/drivers/i3c/master/mipi-i3c-hci/pio.c
> index cde883137bc7..01e7d2833301 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/pio.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/pio.c
> @@ -213,7 +213,7 @@ static void hci_pio_cleanup(struct i3c_hci *hci)
> pio_reg_write(INTR_SIGNAL_ENABLE, 0x0);
>
> if (pio) {
> - DBG("status = %#x/%#x",
> + dev_dbg(&hci->master.dev, "status = %#x/%#x",
> pio_reg_read(INTR_STATUS), pio_reg_read(INTR_SIGNAL_ENABLE));
fix pio_reg_read() align to (
Frank
> BUG_ON(pio->curr_xfer);
> BUG_ON(pio->curr_rx);
> @@ -226,13 +226,17 @@ static void hci_pio_cleanup(struct i3c_hci *hci)
>
> static void hci_pio_write_cmd(struct i3c_hci *hci, struct hci_xfer *xfer)
> {
> - DBG("cmd_desc[%d] = 0x%08x", 0, xfer->cmd_desc[0]);
> - DBG("cmd_desc[%d] = 0x%08x", 1, xfer->cmd_desc[1]);
> + dev_dbg(&hci->master.dev, "cmd_desc[%d] = 0x%08x",
> + 0, xfer->cmd_desc[0]);
> + dev_dbg(&hci->master.dev, "cmd_desc[%d] = 0x%08x",
> + 1, xfer->cmd_desc[1]);
> pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[0]);
> pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[1]);
> if (hci->cmd == &mipi_i3c_hci_cmd_v2) {
> - DBG("cmd_desc[%d] = 0x%08x", 2, xfer->cmd_desc[2]);
> - DBG("cmd_desc[%d] = 0x%08x", 3, xfer->cmd_desc[3]);
> + dev_dbg(&hci->master.dev, "cmd_desc[%d] = 0x%08x",
> + 2, xfer->cmd_desc[2]);
> + dev_dbg(&hci->master.dev, "cmd_desc[%d] = 0x%08x",
> + 3, xfer->cmd_desc[3]);
> pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[2]);
> pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[3]);
> }
> @@ -254,7 +258,8 @@ static bool hci_pio_do_rx(struct i3c_hci *hci, struct hci_pio_data *pio)
> nr_words = min(xfer->data_left / 4, pio->rx_thresh_size);
> /* extract data from FIFO */
> xfer->data_left -= nr_words * 4;
> - DBG("now %d left %d", nr_words * 4, xfer->data_left);
> + dev_dbg(&hci->master.dev, "now %d left %d",
> + nr_words * 4, xfer->data_left);
> while (nr_words--)
> *p++ = pio_reg_read(XFER_DATA_PORT);
> }
> @@ -269,7 +274,7 @@ static void hci_pio_do_trailing_rx(struct i3c_hci *hci,
> struct hci_xfer *xfer = pio->curr_rx;
> u32 *p;
>
> - DBG("%d remaining", count);
> + dev_dbg(&hci->master.dev, "%d remaining", count);
>
> p = xfer->data;
> p += (xfer->data_len - xfer->data_left) / 4;
> @@ -278,7 +283,8 @@ static void hci_pio_do_trailing_rx(struct i3c_hci *hci,
> unsigned int nr_words = count / 4;
> /* extract data from FIFO */
> xfer->data_left -= nr_words * 4;
> - DBG("now %d left %d", nr_words * 4, xfer->data_left);
> + dev_dbg(&hci->master.dev, "now %d left %d",
> + nr_words * 4, xfer->data_left);
> while (nr_words--)
> *p++ = pio_reg_read(XFER_DATA_PORT);
> }
> @@ -321,7 +327,8 @@ static bool hci_pio_do_tx(struct i3c_hci *hci, struct hci_pio_data *pio)
> nr_words = min(xfer->data_left / 4, pio->tx_thresh_size);
> /* push data into the FIFO */
> xfer->data_left -= nr_words * 4;
> - DBG("now %d left %d", nr_words * 4, xfer->data_left);
> + dev_dbg(&hci->master.dev, "now %d left %d",
> + nr_words * 4, xfer->data_left);
> while (nr_words--)
> pio_reg_write(XFER_DATA_PORT, *p++);
> }
> @@ -336,7 +343,7 @@ static bool hci_pio_do_tx(struct i3c_hci *hci, struct hci_pio_data *pio)
> */
> if (!(pio_reg_read(INTR_STATUS) & STAT_TX_THLD))
> return false;
> - DBG("trailing %d", xfer->data_left);
> + dev_dbg(&hci->master.dev, "trailing %d", xfer->data_left);
> pio_reg_write(XFER_DATA_PORT, *p);
> xfer->data_left = 0;
> }
> @@ -481,7 +488,7 @@ static bool hci_pio_process_resp(struct i3c_hci *hci, struct hci_pio_data *pio)
> u32 resp = pio_reg_read(RESPONSE_QUEUE_PORT);
> unsigned int tid = RESP_TID(resp);
>
> - DBG("resp = 0x%08x", resp);
> + dev_dbg(&hci->master.dev, "resp = 0x%08x", resp);
> if (tid != xfer->cmd_tid) {
> dev_err(&hci->master.dev,
> "response tid=%d when expecting %d\n",
> @@ -522,14 +529,15 @@ static bool hci_pio_process_resp(struct i3c_hci *hci, struct hci_pio_data *pio)
> * still exists.
> */
> if (pio->curr_rx == xfer) {
> - DBG("short RX ?");
> + dev_dbg(&hci->master.dev, "short RX ?");
> pio->curr_rx = pio->curr_rx->next_data;
> } else if (pio->curr_tx == xfer) {
> - DBG("short TX ?");
> + dev_dbg(&hci->master.dev, "short TX ?");
> pio->curr_tx = pio->curr_tx->next_data;
> } else if (xfer->data_left) {
> - DBG("PIO xfer count = %d after response",
> - xfer->data_left);
> + dev_dbg(&hci->master.dev,
> + "PIO xfer count = %d after response",
> + xfer->data_left);
> }
>
> pio->curr_resp = xfer->next_resp;
> @@ -591,7 +599,7 @@ static int hci_pio_queue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n)
> struct hci_xfer *prev_queue_tail;
> int i;
>
> - DBG("n = %d", n);
> + dev_dbg(&hci->master.dev, "n = %d", n);
>
> /* link xfer instances together and initialize data count */
> for (i = 0; i < n; i++) {
> @@ -611,8 +619,9 @@ static int hci_pio_queue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n)
> if (!hci_pio_process_cmd(hci, pio))
> pio->enabled_irqs |= STAT_CMD_QUEUE_READY;
> pio_reg_write(INTR_SIGNAL_ENABLE, pio->enabled_irqs);
> - DBG("status = %#x/%#x",
> - pio_reg_read(INTR_STATUS), pio_reg_read(INTR_SIGNAL_ENABLE));
> + dev_dbg(&hci->master.dev, "status = %#x/%#x",
> + pio_reg_read(INTR_STATUS),
> + pio_reg_read(INTR_SIGNAL_ENABLE));
> }
> spin_unlock_irq(&pio->lock);
> return 0;
> @@ -686,10 +695,10 @@ static bool hci_pio_dequeue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int
> int ret;
>
> spin_lock_irq(&pio->lock);
> - DBG("n=%d status=%#x/%#x", n,
> - pio_reg_read(INTR_STATUS), pio_reg_read(INTR_SIGNAL_ENABLE));
> - DBG("main_status = %#x/%#x",
> - readl(hci->base_regs + 0x20), readl(hci->base_regs + 0x28));
> + dev_dbg(&hci->master.dev, "n=%d status=%#x/%#x", n,
> + pio_reg_read(INTR_STATUS), pio_reg_read(INTR_SIGNAL_ENABLE));
> + dev_dbg(&hci->master.dev, "main_status = %#x/%#x",
> + readl(hci->base_regs + 0x20), readl(hci->base_regs + 0x28));
>
> ret = hci_pio_dequeue_xfer_common(hci, pio, xfer, n);
> spin_unlock_irq(&pio->lock);
> @@ -733,8 +742,8 @@ static void hci_pio_err(struct i3c_hci *hci, struct hci_pio_data *pio,
> mipi_i3c_hci_pio_reset(hci);
> mipi_i3c_hci_resume(hci);
>
> - DBG("status=%#x/%#x",
> - pio_reg_read(INTR_STATUS), pio_reg_read(INTR_SIGNAL_ENABLE));
> + dev_dbg(&hci->master.dev, "status=%#x/%#x",
> + pio_reg_read(INTR_STATUS), pio_reg_read(INTR_SIGNAL_ENABLE));
> }
>
> static void hci_pio_set_ibi_thresh(struct i3c_hci *hci,
> @@ -749,7 +758,7 @@ static void hci_pio_set_ibi_thresh(struct i3c_hci *hci,
> if (regval != pio->reg_queue_thresh) {
> pio_reg_write(QUEUE_THLD_CTRL, regval);
> pio->reg_queue_thresh = regval;
> - DBG("%d", thresh_val);
> + dev_dbg(&hci->master.dev, "%d", thresh_val);
> }
> }
>
> @@ -773,7 +782,8 @@ static bool hci_pio_get_ibi_segment(struct i3c_hci *hci,
> /* extract the data from the IBI port */
> nr_words = thresh_val;
> ibi->seg_cnt -= nr_words * 4;
> - DBG("now %d left %d", nr_words * 4, ibi->seg_cnt);
> + dev_dbg(&hci->master.dev, "now %d left %d",
> + nr_words * 4, ibi->seg_cnt);
> while (nr_words--)
> *p++ = pio_reg_read(IBI_PORT);
> }
> @@ -791,7 +801,7 @@ static bool hci_pio_get_ibi_segment(struct i3c_hci *hci,
> hci_pio_set_ibi_thresh(hci, pio, 1);
> if (!(pio_reg_read(INTR_STATUS) & STAT_IBI_STATUS_THLD))
> return false;
> - DBG("trailing %d", ibi->seg_cnt);
> + dev_dbg(&hci->master.dev, "trailing %d", ibi->seg_cnt);
> data = pio_reg_read(IBI_PORT);
> data = (__force u32) cpu_to_le32(data);
> while (ibi->seg_cnt--) {
> @@ -820,7 +830,7 @@ static bool hci_pio_prep_new_ibi(struct i3c_hci *hci, struct hci_pio_data *pio)
> */
>
> ibi_status = pio_reg_read(IBI_PORT);
> - DBG("status = %#x", ibi_status);
> + dev_dbg(&hci->master.dev, "status = %#x", ibi_status);
> ibi->addr = FIELD_GET(IBI_TARGET_ADDR, ibi_status);
> if (ibi_status & IBI_ERROR) {
> dev_err(&hci->master.dev, "IBI error from %#x\n", ibi->addr);
> --
> 2.47.2
>
>
> --
> linux-i3c mailing list
> linux-i3c at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
More information about the linux-i3c
mailing list