From mboxrd@z Thu Jan 1 00:00:00 1970 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 BC839C3ABD8 for ; Mon, 19 May 2025 14:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PdV8uO80/mflHpZW6Zmyg39cv5SMy1ND2QAP2t8eHzY=; b=NxiET88Z/srxXu2VytWHlIlzcI qKAWF1bqFdowj7MU6SHM6935JhNQhgxfHNkvJ9uCyewLIJ0p1pDjbYFABM24yAZ+Osj3T4rOsBCMb WZI/HFZc65hCO1F+x8RQsNTaTE9LbVZ0qIzv9HidkXQQfQblJfilbdAH1lXb77culYS4oXhN0Gl3K vOBBCNO9fiawYTXVJ8nXFeSLNVCRdWdmBVbQrxR5v1izPpeotWDJvN4h0T3ePsdIWMZe/nQsbBqpU 3EjHyZ0+mqXTllFbxYFI6a9hc+sozHNgfnLnVXZZKTtMtVxCA+XOTlmg32i0yxhGGd0h8faT+tyBn YHSM+a+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uH195-00000009OlN-2CPz; Mon, 19 May 2025 14:07:11 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uH0ng-00000009K27-3Pk8 for linux-arm-kernel@bombadil.infradead.org; Mon, 19 May 2025 13:45:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=PdV8uO80/mflHpZW6Zmyg39cv5SMy1ND2QAP2t8eHzY=; b=ln9gZILGHpbP6HJ6lr7Ot4YEFL ASgYfOfHk2wPOTx325rLHimZElZ/gWi+xDyb6QEb7lXuOF/xlDVsWhe0ik6dA8noilOng0xAEXK80 kcmq1yilB4g2WioF6Q/kPDjCYQzRSOElTU6K8ozi9KrL9v3rNUV4/9y8ZMf+8cQw+ELC5qCCY1cG5 6huIlAreJBtteaIYz9j7hzP7tFZU8vqKJZSSrQnFBaAuWKjBEzB9XGo0J/ZFu4XEaO/QFTU31DE/f GhDdwAJks+pg9/cq3PUSQwo6w2QPpyvdyRqqOploTSHT9D9GXnvHwIjERejO6L7pv2yfvIiy/bYHE NKjKVVog==; Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by desiato.infradead.org with esmtps (Exim 4.98.1 #2 (Red Hat Linux)) id 1uH0nc-00000000dpN-25vW for linux-arm-kernel@lists.infradead.org; Mon, 19 May 2025 13:45:03 +0000 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 54J9IUfw028604; Mon, 19 May 2025 13:44:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= PdV8uO80/mflHpZW6Zmyg39cv5SMy1ND2QAP2t8eHzY=; b=prEs2AZG6sM1zEGe VlkKyMnGGYxkLQMT3wdOmMthss1lBfNyEtDD15+kpRauYm9ctxxE1rtGyBG7Fv0f 7mJCkiJOnbNqwy/6kx5b3EJw/fdr4USRKjSBQQZQ0jHR3qMi+DE0bCsRrQ4toQWM XQpE8v6IZupkHpPDe9Et6SnwT6edFLhvkgEDwG+tYmfYg686FX3HielgtSb5ymMw H/6iWbGkmnrSAkUBtyDQyIUB5N69MUsS4VuPSWbwetCUd2aJT9KZy84qdFiXZdPk mqWtVNNGCrWJyKA02Gb/R93mSzgTlfhvNmEC0JXDbA8nvT4pFil22EVufRp+SY2P LCv/Dw== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 46pju7cgmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 May 2025 13:44:32 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 54JDiVn1028686 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 May 2025 13:44:31 GMT Received: from [10.253.10.117] (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 19 May 2025 06:44:23 -0700 Message-ID: <1e3ba498-2bfb-4cab-ba13-5ab2c5b03ef9@quicinc.com> Date: Mon, 19 May 2025 21:44:20 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [cocci] [PATCH v3 2/6] coccinelle: misc: Add field_modify script To: Markus Elfring , , , , "Catalin Marinas" , Joey Gouly , "Julia Lawall" , Marc Zyngier , Nicolas Palix , Oliver Upton , "Rasmus Villemoes" , Suzuki Poulouse , Will Deacon , Yury Norov , Zenghui Yu CC: LKML , Andrew Lunn , "Kiran Kumar C.S.K" , Lei Wei , Pavithra R , Suruchi Agarwal , References: <20250417-field_modify-v3-0-6f7992aafcb7@quicinc.com> <20250417-field_modify-v3-2-6f7992aafcb7@quicinc.com> <0ee48e2f-58db-49b0-b651-dcc0e517465e@quicinc.com> <43712874-6f1d-435c-98b2-30ac44d25309@web.de> Content-Language: en-US From: Luo Jie In-Reply-To: <43712874-6f1d-435c-98b2-30ac44d25309@web.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=XKEwSRhE c=1 sm=1 tr=0 ts=682b35c0 cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=dt9VzEwgFbYA:10 a=NEAV23lmAAAA:8 a=c3S3xlzBOW1yjAwqZsgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: DDx5Kpyrf6pBeNUIV-O76BAavKioXic- X-Proofpoint-GUID: DDx5Kpyrf6pBeNUIV-O76BAavKioXic- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNTE5MDEyNyBTYWx0ZWRfX8LBxompbvgoH 3i7uWyfrxx5T3Tfgsvy7ubiVJ6v1qhIGwf4jf/Xj3Xy1N8bv6dH9EU/v4+YK8hk3EOZKpGwsXpO zKPXnFqYrqWOXyiJzvXGm6Lg+ocGxkUpkTDXJZ/O5AXvVsS8FpVHPcnvp90SgtTIkcdhMEupjQ2 uOj/n9xXrmiGEGLnLbuK3/1L9NHPSOpmoaK3yrzHw6a5A4PoIXXRCzpq8QAa9ZmTuW4GdgZaAci EHCwTjF+Lk7iDIzSmtS2qgKhzHtqhTC9bWvgCDe3sDRnz3V+dDqppGyupxR8VK2WXx2IejHyv8w JFBhRBjRDa880TK7422aleYlIMa6BgheyGcrQ8t5EswA8UqaJ1amugbbjV7lOzAkyz96FklOAvx XIva8OfJHDHpw248ZP7AXaRVN54826XqkLx8ayhxETvYMM/RYgIieue2XoBPYKPK+9fivQ+l X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-05-19_06,2025-05-16_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505070000 definitions=main-2505190127 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250519_144501_180407_35943C04 X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 4/24/2025 12:35 AM, Markus Elfring wrote: > … >>> -reg &= ~mask; >>> -reg |= FIELD_PREP >>> +       FIELD_MODIFY >>>                    (mask, >>> +                  ®, >>>                     val >>>                    ); > … >> With this code variant, there is no space prior to ®, here is the >> example code changes generated by the SmPL code as below, is this expected? > … >> +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c >> @@ -244,8 +244,7 @@ static int stf_dphy_configure(struct phy >>         i = stf_dphy_get_config_index(bitrate); >> >>         tmp = readl(dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100)); >> -       tmp &= ~STF_DPHY_REFCLK_IN_SEL; >> -       tmp |= FIELD_PREP(STF_DPHY_REFCLK_IN_SEL, STF_DPHY_REFCLK_12M); >> +       FIELD_MODIFY(STF_DPHY_REFCLK_IN_SEL,&tmp, STF_DPHY_REFCLK_12M); >>         writel(tmp, dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100)); > > The Coccinelle software is still evolving somehow. > Thus your test result can trigger further development considerations. > I hope that clarifications and corresponding improvements can be achieved > also according to such source code layout concerns. > > Regards, > Markus OK, understand. I will keep the original patch as below for now, as we need to ensure the script generates code with the expected style. +- reg &= ~mask; +- reg |= FIELD_PREP(mask, val); ++ FIELD_MODIFY(mask, ®, val); In addition, below case is filed to request this improvement on the coccinelle project. https://github.com/coccinelle/coccinelle/issues/397 Thanks.