From patchwork Tue Feb 4 09:17:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Billy Tsai X-Patchwork-Id: 13958823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00263C02193 for ; Tue, 4 Feb 2025 09:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WTYGYQJkrbYtP6szlxje7/EGT2mnhYkECIIUYtR57ug=; b=dRf7p0tJfTEjP5 QNNLHAVDQH6L7jcfwOBziDwHp/dcGYXfLcxvlB5MSSd4TKKkLE5uwuRcBJzGtvzpspIhVKghqSDus LftaouypMWuJfQX9eEhVuwSWSIqz9bPYyhZSxQWZOoFa8OFahDfR6Q373oBFQKWRAj8uqTCqiqGbB PDnCEQo9so/NkQcDAWDWKBtEOQV/39PTlSdwDuFPTOukDq+vIjny2xaKG/noGmfEDF7Df6OsYyAjF NssI9NLtytvywqhe1VzQgtlSYXFjOEVw14hjnfWqShyXGXMSw5jt1mtwt39bnp26mcF0n+d4F8JRS MSfkWe3aRuJb+8CnAE/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfF3O-000000000mN-2xrI; Tue, 04 Feb 2025 09:17:10 +0000 Received: from mail.aspeedtech.com ([211.20.114.72] helo=TWMBX01.aspeed.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfF3N-000000000lf-0l5P for linux-i3c@lists.infradead.org; Tue, 04 Feb 2025 09:17:10 +0000 Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 4 Feb 2025 17:17:02 +0800 Received: from mail.aspeedtech.com (192.168.10.10) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Tue, 4 Feb 2025 17:17:02 +0800 From: Billy Tsai To: , , , , , , , , , , , , , Subject: [PATCH v2 2/2] i3c: mipi-i3c-hci: Use I2C DMA-safe api Date: Tue, 4 Feb 2025 17:17:02 +0800 Message-ID: <20250204091702.4014466-2-billy_tsai@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250204091702.4014466-1-billy_tsai@aspeedtech.com> References: <20250204091702.4014466-1-billy_tsai@aspeedtech.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250204_011709_216794_1E2E0AF5 X-CRM114-Status: UNSURE ( 8.81 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Use the i2c_get/put_dma_safe_msg_buf for I2C transfers instead of using the I3C-specific API. Signed-off-by: Billy Tsai Acked-by: Mukesh Kumar Savaliya Reviewed-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index a408feac3e9e..4f3738beb0f2 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -382,14 +382,11 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev, return -ENOMEM; for (i = 0; i < nxfers; i++) { - xfer[i].data = i2c_xfers[i].buf; + xfer[i].data = i2c_get_dma_safe_msg_buf(&i2c_xfers[i], 1); xfer[i].data_len = i2c_xfers[i].len; xfer[i].rnw = i2c_xfers[i].flags & I2C_M_RD; hci->cmd->prep_i2c_xfer(hci, dev, &xfer[i]); xfer[i].cmd_desc[0] |= CMD_0_ROC; - ret = i3c_hci_alloc_safe_xfer_buf(hci, &xfer[i]); - if (ret) - goto out; } last = i - 1; xfer[last].cmd_desc[0] |= CMD_0_TOC; @@ -412,7 +409,8 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev, out: for (i = 0; i < nxfers; i++) - i3c_hci_free_safe_xfer_buf(hci, &xfer[i]); + i2c_put_dma_safe_msg_buf(xfer[i].data, &i2c_xfers[i], + ret ? false : true); hci_free_xfer(xfer, nxfers); return ret;