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 11279C369D8 for ; Wed, 23 Apr 2025 13:52:40 +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=Phbedu7xpyuH5nYJsAMb3poKKBwNLxsZinqwYSuHzUE=; b=PJUhteEXMfaEo4QsiVgiosqDQl y7DY2SQ8pFHldRr3zcYfsUsCwcCeWZTV5ROyoW7ctr29BAZ8SD2jWHJur4tl5nQKtHvGxR1P1wCZg miaXWf9mViS+BbEVYjinxGxK15ypO1+W6hwuab870hUxjKc8/lrx5f41m1vbdLrTctg3NWDIDZD5a 1XZmpMn0Njxoll1v6MAa/AhVO8wkgmlWr4J8yRqdbJLuZNJp5PyRzwVZby8MtuNFEuwjk21QkOpEw Ael1tKQ6vH9rJS/qHPXa4jxYdX0b/Dc9MftmT89IPvsUbtjmm6pCBfHpHExWlbTZKB4MZ++HJ1fXK u5JDsNUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u7aWd-0000000AgZm-319x; Wed, 23 Apr 2025 13:52:31 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u7ZmT-0000000AWlp-40Qx for linux-arm-kernel@lists.infradead.org; Wed, 23 Apr 2025 13:04:51 +0000 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 53NAIXvJ017291; Wed, 23 Apr 2025 13:04:29 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= Phbedu7xpyuH5nYJsAMb3poKKBwNLxsZinqwYSuHzUE=; b=iahpS7n/F/bDarVN E3ZgF4vG03KNPbYQZbzTR7ZVrZ6f7spf+ve30cp9n1a94p3PuxUqi00n3y8lRvvI wYeT6TdPvqFQw/elaCyTxG2NvtzNFHv0dqQYUQ7cXRZGTkObQ48IsB+uRVNE4BU5 GUPowKohVHSJ7erHRx5C6yCDdCjFfHNgdduSisW+buhWeTd/EoBg05mc7CZMJYsQ 3Nde65fRdfjE+0C300JVsYGeCqGquQfr7QNCB/k95lIugHLJLRhDTN7ddoVKHqwk LebYGTZAj84zWJHKJ88R133kfCjcQEZzKNEwLLZMQ8FhtEKfnz/1iN44XnnNHCKb QqIohw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 466jh3j5y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Apr 2025 13:04:29 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 53ND4S04016458 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Apr 2025 13:04:28 GMT Received: from [10.253.74.233] (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; Wed, 23 Apr 2025 06:04:22 -0700 Message-ID: <0ee48e2f-58db-49b0-b651-dcc0e517465e@quicinc.com> Date: Wed, 23 Apr 2025 21:04:19 +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> Content-Language: en-US From: Jie Luo In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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-Proofpoint-ORIG-GUID: d1C-_VtA2se0ltPj1-LpCYtqKYl_3Kko X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNDIzMDA5MSBTYWx0ZWRfX2HoPaNVS9Rs7 skvMbPo1O3/lDaMF3Rx3zRJoaEiSWBgzeVDMxsZJJO2e9jxt8qfRvlI5KD8g0tcaAR5W59oIxT+ HbBNVqMHeINLSNyJEZrhMSINbaakgbrmZ0ZiDWmSNbyHPI+R2LL38UK371n8IX1nZ6zOg0ZrD+I qh7h1Y/9oTycKb5NEkF7+MN42ZHOBl0ZLWDEXlfTm4PK2nG48KB76GjHDlzt4mph4wRmXS4D5+4 DNajvL7sbg8WYHwyZ/Eo3L8lzNDzj2dMZFcnpW+ZPWPJ15WlnizmFQKiI1TItPgf57CKGuKUy/5 JP1wSn2OXVEeDpkISxi9dbaxR9IVqixTVflxlExmCrIw93KqGsirZTE/jH8XwEkdbxTJcT9YjLR Fs4Cq/DHFYwvzw6HgDHY4XwnEp7yE8FJZj912d+vyIMPObrHmV3lzNcAIIouzKAnJlaIxQKN X-Authority-Analysis: v=2.4 cv=ELgG00ZC c=1 sm=1 tr=0 ts=6808e55d cx=c_pps a=JYp8KDb2vCoCEuGobkYCKw==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=VwQbUJbxAAAA:8 a=ZOzjf2MOAAAA:8 a=Tm5InjWKXzpK7Ii0gWsA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=1Mhi-5-LkjG4w5oc0yAU:22 X-Proofpoint-GUID: d1C-_VtA2se0ltPj1-LpCYtqKYl_3Kko X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.680,FMLib:17.12.80.40 definitions=2025-04-23_08,2025-04-22_01,2025-02-21_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 malwarescore=0 clxscore=1011 bulkscore=0 phishscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2504070000 definitions=main-2504230091 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250423_060450_125877_F161D3DD X-CRM114-Status: GOOD ( 17.70 ) 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/23/2025 7:01 PM, Markus Elfring wrote: >> This script finds and suggests conversions of opencoded field >> modify patterns with the wrapper FIELD_MODIFY() API defined in >> include/linux/bitfield.h for better readability. > > See also: > https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.15-rc3#n94 OK, I will update the commit message with the imperative mood. > > > … >> +++ b/scripts/coccinelle/misc/field_modify.cocci >> @@ -0,0 +1,24 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/// > > I suggest to omit a blank comment line here. OK. > > >> +/// Replaced below code with the wrapper FIELD_MODIFY(MASK, ®, val) > > Replace? I will correct it. > > > … >> +// Copyright (C) 2025 Qualcomm Innovation Center, Inc. > > Copyright: ? I will fix it. > > >> +// URL: https://coccinelle.gitlabpages.inria.fr/website > > I suggest to omit such information here. OK. > > > … >> +virtual patch > > How do you think about to support additional operation modes? Sure, I will update the patch to support other operation modes. > > > … >> +- reg &= ~mask; >> +- reg |= FIELD_PREP(mask, val); >> ++ FIELD_MODIFY(mask, ®, val); > > Would you like to integrate the following SmPL code variant? > > -reg &= ~mask; > -reg |= FIELD_PREP > + FIELD_MODIFY > (mask, > + ®, > val > ); > > > Regards, > Markus > 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? Thanks for the review comments. --- a/drivers/phy/starfive/phy-jh7110-dphy-tx.c +++ 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));