Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp315590rdd; Tue, 9 Jan 2024 05:14:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKdfqt/Y/OSEM2mwvgE9dDMhRh+6tmWdwbYyMwn0tdKv+aHCilschzblAkQL2M3UO5JJ+1 X-Received: by 2002:a17:907:3684:b0:a29:b5ab:1df5 with SMTP id bi4-20020a170907368400b00a29b5ab1df5mr603924ejc.129.1704806062239; Tue, 09 Jan 2024 05:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704806062; cv=none; d=google.com; s=arc-20160816; b=v8lSVs2X/llSuzxlKDPA0635RiFrbJ7gU1Oxzvok7nRwBEdMX8acDo2MDmYF+zfbyq 2Y/UkwaHu0epUTf0ljsv9i5r8ljeLC7+5ILycLj85r9WFh4Vc3zzfasNiNVVDxuEPVwJ XdyY+x97o/qZ+tyrnlEumbqBSIYS67jZNQh+BKZOC0u6Ug/C5zepwNBIEnzF/9CYhv2S spVDOjpHfN8zDvdlyYo9WZr2XlS98FQJlzPEl2lCncyVpugcwNNFb2CVVG2vHRQ7WA2R feujV3g92wa+FSK/0WY+ShckOr3xkoeQkkHiBvvQLvqJ0ZYjjTA9tQHqwSZR7wZwyZpB uPQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=oGNYUtkWCOHBwunZC8iFn5R0Y2IJiR1ajiXmbfXxPkQ=; fh=uMCSDX0lvKwCKjbMgvOW6GB7N9hYiWYNfOZIxOPdlH8=; b=Mj28R6JjpwuEFzEVU3Bxn7fDGC8S0N4fq/hPorwgG1NrprXU1d9VZm+ds4iek/Npum F5qjTQrsZWWqLwc/iiispvUo1NN++xaCPYGk0Sxh8cu3Mb9c6GsMgnzcSd9L4TIedomj f/WZB0FYDz6ekgW2I2pPLeWJxqqUuGt/nAB3vLkqTMzBGG5Ev4dHexZaxolpJSupVjVL HzAChtc4XobSOy6SIBBk15+r/aVywQayz1dKjG8q4rN1CcvDqCdEsxl/J/qh454VBzyM ssgGaFcVK5LXGcc3umfQuZujCiV41CoCnCRCCmyvfI3Af6//c+zAm5W2PWVeoD28knDz n8zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pzk0/EZl"; spf=pass (google.com: domain of linux-kernel+bounces-20882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z23-20020a1709060ad700b00a2932805052si777057ejf.563.2024.01.09.05.14.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:14:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pzk0/EZl"; spf=pass (google.com: domain of linux-kernel+bounces-20882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 008A41F248EA for ; Tue, 9 Jan 2024 13:14:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4044A38F95; Tue, 9 Jan 2024 13:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Pzk0/EZl" Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23BDE381DB for ; Tue, 9 Jan 2024 13:14:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-dbed4b03b48so1916431276.3 for ; Tue, 09 Jan 2024 05:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704806051; x=1705410851; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oGNYUtkWCOHBwunZC8iFn5R0Y2IJiR1ajiXmbfXxPkQ=; b=Pzk0/EZlwGnNBSSrLAPlV8RiybYaAbwRR4MbrCzz4x0xtGy2qm+bELykfWMm5ZUWu7 XhYqkdWrfi/LMdSvq/tlVdN6pGrtgqLCSGFMSiUmLOr1G9DVDKzY778bV56UIKt1lEpq AXz80OCO8JID4uGSoPgkcNQPcpvS6GoF93iQuTOa2f4YQuEvu2Yl09ZRB8X6VOagn2vh U9C8KPZWChyEVAhrVoQUdAjRshvVp9WIkYzuKWTB7mNSOfaQ7R8HrPVGQMQmvhgClfbY A8FSDHJ6IffILcUTYTtEJeg0Py+SpTxXOWXyFNWd8yKc/w2U1MZgxzFziGxZQSyc0JWF zPZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704806051; x=1705410851; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oGNYUtkWCOHBwunZC8iFn5R0Y2IJiR1ajiXmbfXxPkQ=; b=WqWMvozrDAeC6g1TmSwqlxw6Uf156SHaGyTcX6lc7O1jHXUYZbK091gkB/grp3D4Qo Kz5+bVCGIXTVFsrsRLQVgzzL9EwJUhQs8tpkxJhOJnmbZQ7H6QCvLYaD+moQ9cq5GVYD h5+yzNTZG/am43sd6PM9gqJ2tRScRhOG2RfnAsWZjpCoh49ugpow4xVUVWPgnZP7qz80 i2k/SFl9ReWBpE3CZI3v7CFFWm/La71Qxdtqs/CZqcsPjU6Vk6w5q+jwK3ukBVK9y4Qy LVbOnr8PQxhE+oE6RW/SU2emBxe45AmcgKeC8lbmEAn5bWKLiybplNlFphQ/Scs9Xk/o do4w== X-Gm-Message-State: AOJu0Yzx5ZLdFNJUwL0Dausu5vSATR536GW1daU25CPx0Enx3VAIHtYr XklGPPKQa/wzOBw88aUlEgTGp9+hzqFHaqhi2ia/5YE8JD9bvA== X-Received: by 2002:a5b:181:0:b0:dbc:afb0:5b0 with SMTP id r1-20020a5b0181000000b00dbcafb005b0mr2822352ybl.1.1704806051145; Tue, 09 Jan 2024 05:14:11 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1704727654-13999-1-git-send-email-quic_mojha@quicinc.com> <1704727654-13999-2-git-send-email-quic_mojha@quicinc.com> In-Reply-To: <1704727654-13999-2-git-send-email-quic_mojha@quicinc.com> From: Linus Walleij Date: Tue, 9 Jan 2024 14:14:00 +0100 Message-ID: Subject: Re: [PATCH v11 1/4] firmware: qcom: scm: provide a read-modify-write function To: Mukesh Ojha , Mark Brown Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jan 8, 2024 at 4:28=E2=80=AFPM 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 va= l) > +{ > + unsigned int old, new; > + int ret; > + > + if (!__scm) > + return -EINVAL; > + > + spin_lock(&__scm->lock); > + ret =3D qcom_scm_io_readl(addr, &old); > + if (ret) > + goto unlock; > + > + new =3D (old & ~mask) | (val & mask); > + > + ret =3D 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? Yours, Linus Walleij