Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp99777rwd; Fri, 26 May 2023 15:46:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64jxjMITL3ssPwX4VUNkESZu+1wxympagZjxGBuvNDN2kA4zUv9ko6JR123LWdNvv8BuCW X-Received: by 2002:a17:902:c40f:b0:1ae:622c:e745 with SMTP id k15-20020a170902c40f00b001ae622ce745mr5403861plk.1.1685141180128; Fri, 26 May 2023 15:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685141180; cv=none; d=google.com; s=arc-20160816; b=TlQ+RqB6tVTKpC0GI2WcNOQWgt+rPfy3vMe95Gn6JBsz0VtpfAovb1buDUYbJtYcpe B/kdPDzOeFDp0JbKg6SFz7bhnJwfJDa2oMel/vO2jLyHYUbyuyJ1Fs6vtsDzxTvfqglj AqgNm/cQyb75x0JFW620ID59hduXESpq6xZ/gomfL6AZi3xo7ZS8jCegDR4j4Mgdy+/i iwJg+5hEtdwvpRjR8x/AFP7vPEILhaQHdSz+mcqhow/Dd/amf25HNhnUdoUw/juauKsS rimIdPSRcaH5BbNJ28S3KGIc9UDUo1Oii5tNJ1cT2JaBAiW1iKOUBIbMmmDeUqNwvlYo lWjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=szKg1wRNI+jDcQkmdpB6llxcOwHarqFiP8nI6T7foys=; b=RD8G0vLVrFIv9KTyZlo7KwNe5MUP8oowKp9xAh1eaP21V5mrfHr2Bho4MazM9SfBvs 4KIrnPQSDwdW9jVKUPVqXE46g5HqO+JrEB/YUtxy3Z4g6RI5AgSCoQD7IIYO0H8nTmEM TE4uup+9JhGjnCkcLRS9qrTBG/5cXhaIo3X4kDddfo3EJoK7VPtwdxaIXHzTCOsa/2Y/ hDnvZi0LRe+1kK2KmgFktAxrHu9JeBCzgNCvjhlyI00nossLbllxyz5B4KMHoPmcOOp+ S1CVE4Aj1PY/VYA6wz/MAJ9fzuFePJ9Doas+cij0LnZOJU4x3gBLJcLIqQel4jzPhshG kM/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li12-20020a170903294c00b001ae5b59462asi4529662plb.309.2023.05.26.15.46.08; Fri, 26 May 2023 15:46:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbjEZWWh (ORCPT + 99 others); Fri, 26 May 2023 18:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235695AbjEZWWf (ORCPT ); Fri, 26 May 2023 18:22:35 -0400 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0554C119 for ; Fri, 26 May 2023 15:22:22 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id c6010c4f-fc10-11ed-b972-005056bdfda7; Sat, 27 May 2023 01:00:49 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Sat, 27 May 2023 01:00:48 +0300 To: Mukesh Ojha Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linus.walleij@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH v6 1/5] firmware: qcom_scm: provide a read-modify-write function Message-ID: References: <1680076012-10785-1-git-send-email-quic_mojha@quicinc.com> <1680076012-10785-2-git-send-email-quic_mojha@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1680076012-10785-2-git-send-email-quic_mojha@quicinc.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wed, Mar 29, 2023 at 01:16:48PM +0530, Mukesh Ojha kirjoitti: > 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_update_field() which masks > out the bits and write the passed value to that > bit-offset. Subsequent patch will use this function. ... > + new = (old & ~mask) | val << (ffs(mask) - 1); It's a bit non-standard to see left shift here instead of masking. new = (old & ~mask) | (val & mask); is usual pattern. Note as well that your code is prone to subtle mistakes when overflow may easily override bits outside the mask. > + return qcom_scm_io_writel(addr, new); > +} -- With Best Regards, Andy Shevchenko