From: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
To: Billy Tsai <billy_tsai@aspeedtech.com>,
<alexandre.belloni@bootlin.com>, <pgaj@cadence.com>,
<miquel.raynal@bootlin.com>, <conor.culhane@silvaco.com>,
<aniketmaurya@google.com>, <Shyam-sundar.S-k@amd.com>,
<jarkko.nikula@linux.intel.com>,
<wsa+renesas@sang-engineering.com>, <xiaopei01@kylinos.cn>,
<Guruvendra.Punugupati@amd.com>, <linux-i3c@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API
Date: Wed, 22 Jan 2025 12:41:28 +0530 [thread overview]
Message-ID: <b91a21ed-c57f-4b71-8232-a3cd7124a549@quicinc.com> (raw)
In-Reply-To: <20250121110756.214714-1-billy_tsai@aspeedtech.com>
Good Change Billy. Thanks for bringing this to i3c.
On 1/21/2025 4:37 PM, Billy Tsai wrote:
> The change is necessary to enable the use of the
> `i2c_get_dma_safe_msg_buf()` API, which requires a non-const
> `struct i2c_msg *` to operate. The `i2c_get_dma_safe_msg_buf()` function
> ensures safe handling of I2C messages when using DMA, making it essential
> for scenarios where DMA transfers are involved. By removing the `const`
> qualifier, this patch allows drivers to prepare and manage DMA-safe
> buffers directly.
>
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
> drivers/i3c/master/dw-i3c-master.c | 2 +-
> drivers/i3c/master/i3c-master-cdns.c | 2 +-
> drivers/i3c/master/mipi-i3c-hci/core.c | 2 +-
> drivers/i3c/master/svc-i3c-master.c | 2 +-
> include/linux/i3c/master.h | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index d09ea5b6467c..54c7d86997d5 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1079,7 +1079,7 @@ static void dw_i3c_master_detach_i3c_dev(struct i3c_dev_desc *dev)
> }
>
> static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
> - const struct i2c_msg *i2c_xfers,
> + struct i2c_msg *i2c_xfers,
what we need is only i2c_xfers->buf to be DMA-safe, not the *i2c_xfers.
Right ?
> int i2c_nxfers)
> {
> struct dw_i3c_i2c_dev_data *data = i2c_dev_get_master_data(dev);
> diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
> index 8d69a34986d9..c9e4c129454c 100644
> --- a/drivers/i3c/master/i3c-master-cdns.c
> +++ b/drivers/i3c/master/i3c-master-cdns.c
> @@ -813,7 +813,7 @@ static int cdns_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
> }
>
> static int cdns_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
> - const struct i2c_msg *xfers, int nxfers)
> + struct i2c_msg *xfers, int nxfers)
> {
> struct i3c_master_controller *m = i2c_dev_get_master(dev);
> struct cdns_i3c_master *master = to_cdns_i3c_master(m);
we only need to use i2c_get_dma_safe_msg_buf() for the xfers[i].buf
being used inside the driver as a protection ?
Also I guess same change is required for all the vendor drivers. But Not
sure if it's feasible with this patch ?
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index e6e482a259b4..a408feac3e9e 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -367,7 +367,7 @@ static int i3c_hci_priv_xfers(struct i3c_dev_desc *dev,
> }
>
> static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
> - const struct i2c_msg *i2c_xfers, int nxfers)
> + struct i2c_msg *i2c_xfers, int nxfers)
> {
> struct i3c_master_controller *m = i2c_dev_get_master(dev);
> struct i3c_hci *hci = to_i3c_hci(m);
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index c1ee3828e7ee..24bd701b5de0 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -1584,7 +1584,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
> }
>
> static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
> - const struct i2c_msg *xfers,
> + struct i2c_msg *xfers,
> int nxfers)
> {
> struct i3c_master_controller *m = i2c_dev_get_master(dev);
> diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
> index 12d532b012c5..c67922ece617 100644
> --- a/include/linux/i3c/master.h
> +++ b/include/linux/i3c/master.h
> @@ -475,7 +475,7 @@ struct i3c_master_controller_ops {
> int (*attach_i2c_dev)(struct i2c_dev_desc *dev);
> void (*detach_i2c_dev)(struct i2c_dev_desc *dev);
> int (*i2c_xfers)(struct i2c_dev_desc *dev,
> - const struct i2c_msg *xfers, int nxfers);
> + struct i2c_msg *xfers, int nxfers);
> int (*request_ibi)(struct i3c_dev_desc *dev,
> const struct i3c_ibi_setup *req);
> void (*free_ibi)(struct i3c_dev_desc *dev);
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2025-01-22 7:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 11:07 [PATCH v1 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API Billy Tsai
2025-01-21 11:07 ` [PATCH v1 2/2] i3c: mipi-i3c-hci: Use DMA-safe buffer for I2C transfers Billy Tsai
2025-01-21 22:19 ` Wolfram Sang
2025-01-23 10:23 ` Billy Tsai
2025-01-22 7:11 ` Mukesh Kumar Savaliya
2025-01-22 8:28 ` Jarkko Nikula
2025-01-21 22:18 ` [PATCH v1 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API Wolfram Sang
2025-01-22 7:11 ` Mukesh Kumar Savaliya [this message]
2025-01-22 7:21 ` Wolfram Sang
2025-01-22 8:42 ` Thomas Weißschuh
2025-02-04 15:15 ` Mukesh Kumar Savaliya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b91a21ed-c57f-4b71-8232-a3cd7124a549@quicinc.com \
--to=quic_msavaliy@quicinc.com \
--cc=Guruvendra.Punugupati@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=alexandre.belloni@bootlin.com \
--cc=aniketmaurya@google.com \
--cc=billy_tsai@aspeedtech.com \
--cc=conor.culhane@silvaco.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=pgaj@cadence.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=xiaopei01@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox