Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp321175rdd; Tue, 9 Jan 2024 05:25:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKe8yzi1jwobUU+LfQCfeE9QGIhmi6LBzfEEDP9ALHi00D//FOcD2u3Dmx6VqOL8ynaGSh X-Received: by 2002:a05:6a00:909b:b0:6da:3194:1e68 with SMTP id jo27-20020a056a00909b00b006da31941e68mr6555778pfb.41.1704806702855; Tue, 09 Jan 2024 05:25:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704806702; cv=none; d=google.com; s=arc-20160816; b=H1/ohSX5ya4d22el8z9i2nw6cfWjRWdTvvjKHN20UeptU8MiXhvSeuCdZJaTMPthX8 RZPuk4cMd/d9JAX8PB9smV0KJ5btkEqyh/lX88q9D15GlfAyU+wZ3W1QKdUGejZyrnzz nf6MS049GqOcHW/JYX92i3eL6Wt7madDmHj23j+5udNFxBaqCp1oBOXvlUzoGRN2nCYA t15XB5mv4demY1/95Jbm9wqIykzmbGvuZIbpcqXYkBAZdJ1SctLdET1psDIoiUHIIfzE aKBgz1HlKUm1HIO9iP/UTf52P4EeZS4rYIK0rR/89lfIIAfN+Hi7wX4p10vkUd8my2UJ u7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=7glfnnpCpN5mrx64ygsoXAEGUKHpeaPmhuGLsawq5uw=; fh=GmO9tjlhntlQQYVn7BatZywXnzUmiTP80ID4rFIFfzI=; b=CD60vHBJyCF2Osae4Pu5JllWqWO36C+Lii9da3jVQxpap/5f1rHOvB9CMMWQ0SOfTV D1uQumeVkBkEY/Ue1tm5rWRoA6Mc4gykknq+XLI/HqPExbaq/ZEHSPqSDxVGdpSoEypD 0tYPDv48/zCEoORPzP9XiRM0JWgcJpaKXSB8fmI6wd33h+jmP0w9xl9DI4RsE0UQ/L25 p027+c6SeZ8zAKoEJ2mU6q3xsQUsLpHKND7/PFZTgKQO8fP8wXUnWRaqfLzPRTp/+Rvm w+LTmBti30D0Z9lpJJEbxh7yHJ4H2H6HiopsUI1B4JnOJ1nW56xq6MBEXCXC3URKpq/a ytdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QESw8Fi5; spf=pass (google.com: domain of linux-kernel+bounces-20891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i126-20020a625484000000b006d6f98a58a4si1450340pfb.255.2024.01.09.05.25.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:25:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QESw8Fi5; spf=pass (google.com: domain of linux-kernel+bounces-20891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BADD9B235B9 for ; Tue, 9 Jan 2024 13:24:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A46A838FA3; Tue, 9 Jan 2024 13:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="QESw8Fi5" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 9B5A438F8A; Tue, 9 Jan 2024 13:24:34 +0000 (UTC) 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 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 409D8x8k007881; Tue, 9 Jan 2024 13:24:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=7glfnnpCpN5mrx64ygsoXAEGUKHpeaPmhuGLsawq5uw=; b=QE Sw8Fi53wlD/vsiBNmC3EYjXp9o4cs3m0S17RnrVytrvBfERNdpCmWUfZvnCXgBX9 Q1GN1Jhk2lhoztALIBoqUW7wHXgiXQ8J4VMeaAzB3ULiBuMFHUZOh88l96t2SnTu TmoXJDAWbxwcra5olfVh0B4poKut1jss3BD+eT5stgPzW5qm5hXwIEV4N5xogdog rty5c+4/y8x+1m0Fg+yIqpeEhrOKbhQ0FDyPCdbQ0sHIIFPI/2sWNeRhvwpEPXM7 4IMGNeAyQ4ars+xgLMSD7eNyfHl8hFDGDeoKd472JuS5tZkvDBcSddFVNA4yQ409 NnTLNB5y16JfM3wSSS+w== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vh234gkuq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jan 2024 13:24:30 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 409DOTKN013306 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Jan 2024 13:24:29 GMT Received: from [10.214.66.81] (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.1118.40; Tue, 9 Jan 2024 05:24:27 -0800 Message-ID: <3a17f36a-04bf-04f2-7a22-82b76977b325@quicinc.com> Date: Tue, 9 Jan 2024 18:54:22 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v11 1/4] firmware: qcom: scm: provide a read-modify-write function Content-Language: en-US To: Linus Walleij , Mark Brown CC: , , , , References: <1704727654-13999-1-git-send-email-quic_mojha@quicinc.com> <1704727654-13999-2-git-send-email-quic_mojha@quicinc.com> From: Mukesh Ojha In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit 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-ORIG-GUID: 7NBQlC_FIUtPqOrbYbh0Dz26UGPIzPi6 X-Proofpoint-GUID: 7NBQlC_FIUtPqOrbYbh0Dz26UGPIzPi6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=608 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401090110 On 1/9/2024 6:44 PM, Linus Walleij wrote: > On Mon, Jan 8, 2024 at 4:28 PM Mukesh Ojha wrote: > >> It was realized by Srinivas K. that there is a need of >> read-modify-write scm exported function so that it can >> be used by multiple clients. >> >> Let's introduce qcom_scm_io_rmw() which masks out the bits >> and write the passed value to that bit-offset. > (...) >> +int qcom_scm_io_rmw(phys_addr_t addr, unsigned int mask, unsigned int val) >> +{ >> + unsigned int old, new; >> + int ret; >> + >> + if (!__scm) >> + return -EINVAL; >> + >> + spin_lock(&__scm->lock); >> + ret = qcom_scm_io_readl(addr, &old); >> + if (ret) >> + goto unlock; >> + >> + new = (old & ~mask) | (val & mask); >> + >> + ret = qcom_scm_io_writel(addr, new); >> +unlock: >> + spin_unlock(&__scm->lock); >> + return ret; >> +} >> +EXPORT_SYMBOL_GPL(qcom_scm_io_rmw); > > This looks a lot like you are starting to re-invent regmaps > regmap_update_bits(). > > If you are starting to realize you need more and more of > regmap, why not use regmap and its functions? I think, this discussion has happened already .. https://lore.kernel.org/lkml/CACRpkdb95V5GC81w8fiuLfx_V1DtWYpO33FOfMnArpJeC9SDQA@mail.gmail.com/ -Mukesh > > Yours, > Linus Walleij