From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 5A750170A30 for ; Wed, 22 Jan 2025 07:12:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737529935; cv=none; b=uZpnUOLZwEOSyDmkikgIZSB0jTIHZs5j+w3esFCzQOqhdPlX+zzaXfVCcd9zSuQkFHE91knW3APW851qJfhodfylbhjL/ZgT8vk9VgBnHHHJ6l85L5ee0v9cpTKSH+IcUA9dSQuI/0XRTtI/YWvY94YhXl+pVDuiWkYjcYyxpwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737529935; c=relaxed/simple; bh=B3z4Un+EHkaNjrOy3bSJtQbbsvfbJMclRCvZZHQ05og=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=N7qu3t1o4F7IVkwSmMDvj/RCZGoLFsfbIVyOKsnTOGOtAr9sDBdeF+uK0W5Om/AsduSFyLfp7CcJHcBKDzSZljFoMrgTQlbSZ9SpwsELJCKcB2Nc+iY4gMFQkY+MIHZ0AYa2cfJiCrxaurm1fAWLmWbTf9sPjTJRrHJhV8bXvlA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=FAVe3zOe; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FAVe3zOe" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50M6VeTn018272; Wed, 22 Jan 2025 07:11:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= s4ONRMFJ33W2W+pkz3dAYCRX2vppNe3R55B/m0nmeSM=; b=FAVe3zOeEr0qo2Xm 13AORh9N8D2UUi2fbLZIEwKefOf5lJrrzqjHvqlD0QaOqUx6+0l9jBA6REIYtqtv udo11dqib8tOAKnEy+VSK0ksJcy3NTlgwG5zySE6u52JbJR8PqB6RmRT9lCLmUJT YcspFnDd3h9biJNLx4bdaDR7GKmMt8MjCV0l0JAA5ps2uaEYv2LS5s3V72G4IgNh L28xAX2rwe37WxyT12lLe1a9tQtZ5B0n46LDkhV/vltydWNUikJDaY+r/TK4VA16 EaqlnsPjbQZgnhXQCpgstADr/RS2SPui6a4EpSyuE6reYsxKfiPyEAEXbPSo9HRk 1XQJMA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44aug2832c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 07:11:36 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 50M7BZBx024719 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 07:11:35 GMT Received: from [10.217.219.207] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 Jan 2025 23:11:31 -0800 Message-ID: Date: Wed, 22 Jan 2025 12:41:28 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API To: Billy Tsai , , , , , , , , , , , , References: <20250121110756.214714-1-billy_tsai@aspeedtech.com> Content-Language: en-US From: Mukesh Kumar Savaliya In-Reply-To: <20250121110756.214714-1-billy_tsai@aspeedtech.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: RLOMW_yZWZpYIW6jFVickxXXvy7yVYTz X-Proofpoint-ORIG-GUID: RLOMW_yZWZpYIW6jFVickxXXvy7yVYTz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-22_03,2025-01-22_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501220051 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 > --- > 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);