From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E60863E2ABB for ; Fri, 12 Jun 2026 16:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781280335; cv=none; b=WGHhhW0IZpw55S56Y/gIo3ZFl8j48aRIN8t9O7qR4FyD0pWgoVZWHGI/jzu1xqrpKFxL6wOWazxhcrd76+1kcwtjlu/vZFBNu0lQV9FrPDn0thWaDuQHtTyhC1g+6L3z+ziveN/eWhGjVGCdtPLe0IEtVlyfP84gpWdtlk+MLgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781280335; c=relaxed/simple; bh=pBFXsSe6wQhMLdJZEe8lS+00FhDPkmvAT81v5cu5XxI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BL5cCKZCwirnkrQcvOTVuI7y9uxlDa0zZVQWD8CrkviOELDrLkA6JEm5yiBd66m5rBleYPkWXgCPp+cGvObaOORPqKEYKWvhfQid8Moj7tqRVHbkTG2DEh+dWpvuJhLvs0YPbNSQzuM1UWOZe/pN8lkEzE2CsjkLc3Y9yNoukPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EOid9+6s; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EOid9+6s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12D0C1F000E9; Fri, 12 Jun 2026 16:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781280333; bh=buvxaPg5Chrf+X+SBXlePmF21Q+EzJMfFIpo9bJOuuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EOid9+6sK55jo/nfh8wflYP360qWhqJ6AQZ1wCJF9eYaPTp+Clpuj1GD/Mtpyh/E8 Ux+yUExhmFTt5begorGCemOvXjAQ8z2xIYTQmQqyP0vE6eLegavXs49mOimQ8G7xzG 0n7fpQYn5eRTvDm/VED5PhBO1vQVndiWnKoWNoFZJVvIuD1FJ0jJgh3Vj6phbLAS1y teKW1rJHDR2P8Q4zP0ykNGpykm97yz/SqCBMOySdFYfKxA7ZvgPns0E3cYnVhMUOL+ W1p2xGwBcRwdb/djCCRlTo6X6uM/uVrtWBtphSnb3XMhhFz+Nj/cVJZz02XpWCSW8t PTFi+sfG5wnlA== From: Claudiu Beznea To: wsa+renesas@sang-engineering.com, tommaso.merciai.xr@bp.renesas.com, alexandre.belloni@bootlin.com, Frank.Li@nxp.com, p.zabel@pengutronix.de Cc: claudiu.beznea@kernel.org, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v4 10/16] i3c: renesas: Follow a unified pattern for transfer and command initialization Date: Fri, 12 Jun 2026 19:04:52 +0300 Message-ID: <20260612160458.3102106-11-claudiu.beznea@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260612160458.3102106-1-claudiu.beznea@kernel.org> References: <20260612160458.3102106-1-claudiu.beznea@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea Follow a unified pattern for transfer and command initialization across the driver. This keeps the code cleaner and easier to follow. Also, in some cases the I3C device was enabled before the transfer data structure was even allocated. Reviewed-by: Frank Li Signed-off-by: Claudiu Beznea --- Changes in v4: - none Changes in v3: - none Changes in v2: - collected tags drivers/i3c/master/renesas-i3c.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c index fa9c15381ed6..883be4326e43 100644 --- a/drivers/i3c/master/renesas-i3c.c +++ b/drivers/i3c/master/renesas-i3c.c @@ -726,6 +726,10 @@ static int renesas_i3c_daa(struct i3c_master_controller *m) if (!xfer) return -ENOMEM; + init_completion(&xfer->comp); + cmd = xfer->cmds; + cmd->rx_count = 0; + /* Enable I3C bus. */ renesas_i3c_bus_enable(m, true); @@ -756,10 +760,6 @@ static int renesas_i3c_daa(struct i3c_master_controller *m) renesas_writel(i3c->regs, DATBAS(pos), datbas_dvdyad_with_parity(ret)); } - init_completion(&xfer->comp); - cmd = xfer->cmds; - cmd->rx_count = 0; - if (i3c->resuming) { /* Run ENTDAA for all the I3C devices on the bus, if resuming. */ ret = first_i3c_pos; @@ -878,13 +878,13 @@ static int renesas_i3c_send_ccc_cmd(struct i3c_master_controller *m, if (!xfer) return -ENOMEM; - renesas_i3c_bus_enable(m, true); - init_completion(&xfer->comp); cmd = xfer->cmds; cmd->rnw = ccc->rnw; cmd->cmd0 = 0; + renesas_i3c_bus_enable(m, true); + /* Calculate the command descriptor. */ switch (ccc->id) { case I3C_CCC_SETDASA: @@ -934,15 +934,15 @@ static int renesas_i3c_i3c_xfers(struct i3c_dev_desc *dev, struct i3c_xfer *i3c_ struct renesas_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev); int i; - /* Enable I3C bus. */ - renesas_i3c_bus_enable(m, true); - struct renesas_i3c_xfer *xfer __free(kfree) = renesas_i3c_alloc_xfer(i3c, 1); if (!xfer) return -ENOMEM; init_completion(&xfer->comp); + /* Enable I3C bus. */ + renesas_i3c_bus_enable(m, true); + for (i = 0; i < i3c_nxfers; i++) { struct renesas_i3c_cmd *cmd = xfer->cmds; @@ -1068,12 +1068,12 @@ static int renesas_i3c_i2c_xfers(struct i2c_dev_desc *dev, if (!xfer) return -ENOMEM; - renesas_i3c_bus_enable(m, false); - init_completion(&xfer->comp); xfer->is_i2c_xfer = true; cmd = xfer->cmds; + renesas_i3c_bus_enable(m, false); + if (!(renesas_readl(i3c->regs, BCST) & BCST_BFREF)) { cmd->err = -EBUSY; return cmd->err; -- 2.43.0