Re: [PATCH] i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling

From: andy . shevchenko
Date: Mon Feb 19 2024 - 15:38:59 EST


Fri, Jan 19, 2024 at 01:45:47PM +0800, Dylan Hung kirjoitti:
> Disable IBI IRQ signal and status only when hot-join and SIR enabling of
> all target devices attached to the bus are disabled.

> Fixes: e389b1d72a62 ("i3c: dw: Add support for in-band interrupts")
>
> Signed-off-by: Dylan Hung <dylan_hung@xxxxxxxxxxxxxx>

Tag block is not supposed to have blank lines.

..

> @@ -1163,8 +1163,10 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master,
> global = reg == 0xffffffff;
> reg &= ~BIT(idx);
> } else {
> - global = reg == 0;
> + bool hj_rejected = !!(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_HOT_JOIN_NACK);

'!!()' is redundant.

> +
> reg |= BIT(idx);
> + global = (reg == 0xffffffff) && hj_rejected;
> }

Moreover, you can refactor a bit both branches, like

bool hj_rejected = true;
...
if (...) {
...
} else {
hj_rejected = readl(master->regs + DEVICE_CTRL) & DEV_CTRL_HOT_JOIN_NACK;
...
}
global = (reg == 0xffffffff) && hj_rejected;


--
With Best Regards,
Andy Shevchenko