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 DD86CCEBF9C for ; Fri, 27 Sep 2024 12:03:04 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:CC:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+jsVr4Ims5WSRmy2NLVUof7RpYlMYwogh7jR4rXlInk=; b=fvb940QhM15ic6k5jogQoPQYb6 rLNc2gTTFk4ZhS6NgSFbaBBXPb6zE2TzbfHChvcPGOk+p5aWCrvC4kvYzSpWTaLQg+ASOB+v3iSa3 WYEra7dhaMbNy3/E2kX7GUexbtOMplGgku8HA2YEnUxIFvb39IgKkLh7nvu19Rr5ETxZtTM5x3qw2 cL6i8heiMeVB8INd03WpJiJ1Zt7XKxCThmqo6yVdrKzn7iNewCBydnfECWSBCK0QqnbLRU0no3kl3 PzmqlhhBKdM57BrhYbF+r8AVnfs+xIjg/9lhnRp5/NsXPvZZcOArdLuZuM/t1NgQSZ3OKjuTAT/7t m4/kmNew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1su9gS-0000000B0wt-17OB; Fri, 27 Sep 2024 12:02:52 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1su9eK-0000000B0N9-11Vk for linux-arm-kernel@lists.infradead.org; Fri, 27 Sep 2024 12:00:41 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 48RC0MLi020296; Fri, 27 Sep 2024 07:00:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1727438422; bh=+jsVr4Ims5WSRmy2NLVUof7RpYlMYwogh7jR4rXlInk=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=l4mvowJAjM9PJeOeJyl4Lw0IoQxGpHFoAmHIUeiriguabhIc4m8fYPjXtPvdf1o9e px8xK7VGURl6MbTf1fWQDPL2/R8LqUjVVjmLijdXCKy1uRwXptRLzZLF2aA1vBTqVC Bz/w2OXYV+xHs4q2SxmyjvE9E5mJ8nRaHRNMgeSw= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 48RC0MQM110251 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 27 Sep 2024 07:00:22 -0500 Received: from flwvowa01.ent.ti.com (10.64.41.90) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 27 Sep 2024 07:00:22 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by flwvowa01.ent.ti.com (10.64.41.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.34; Fri, 27 Sep 2024 07:00:21 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 27 Sep 2024 07:00:21 -0500 Received: from localhost (uda0133052.dhcp.ti.com [128.247.81.232]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 48RC0LAu068343; Fri, 27 Sep 2024 07:00:21 -0500 Date: Fri, 27 Sep 2024 07:00:21 -0500 From: Nishanth Menon To: Lee Jones CC: Arnd Bergmann , , , Mark Brown , Shawn Guo , , Bjorn Andersson , , "Florian Fainelli" , , Alexandre Torgue Subject: Re: [PATCH V2] mfd: syscon: Use regmap max_register_is_0 as needed Message-ID: <20240927120021.b6okbwrdpguv4hp6@spiny> References: <20240903184710.1552067-1-nm@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240903184710.1552067-1-nm@ti.com> X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240927_050040_444233_C6B090EE X-CRM114-Status: GOOD ( 25.26 ) 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 13:47-20240903, Nishanth Menon wrote: > syscon has always set the optional max_register configuration of > regmap to ensure the correct checks are in place. However, a recent > commit 0ec74ad3c157 ("regmap: rework ->max_register handling") > introduced explicit configuration in regmap framework for register > maps that is exactly 1 register, when max_register is pointing to a > valid register 0. This commit solved a previous limitation of regmap > framework. > > Update syscon driver to consistent in regmap configuration for > all sizes of syscons by using this new capability by setting > max_register_is_0, when the max_register is valid and 0. > > Signed-off-by: Nishanth Menon > --- > > Based on my search > https://gist.github.com/nmenon/d537096d041fa553565fba7577d2cd24, the > pattern of syscon registers that may potentially be impacted by this > patch (that are exactly 1 register wide) is probably limited, though > this patch in itself was inspired by a buggy driver code fixed in > https://lore.kernel.org/linux-pm/20240828131915.3198081-1-nm@ti.com/ > I have tried to Cc lists that may be interested in looking closer to > avoid un-intended side-effects. > > Changes since V1: > * Incorporate review comments by rewording commit message and $subject > and dropped Fixes. > * No functional change to the patch. > * Expand the CC list to notify potential users. > > V1: https://lore.kernel.org/all/20240828121008.3066002-1-nm@ti.com/ > > Cc: Mark Brown > Cc: Shawn Guo > Cc: linux-arm-msm@vger.kernel.org > Cc: Bjorn Andersson > Cc: bcm-kernel-feedback-list@broadcom.com > Cc: Florian Fainelli > Cc: linux-stm32@st-md-mailman.stormreply.com > Cc: Alexandre Torgue A gentle ping. > > drivers/mfd/syscon.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c > index 2ce15f60eb10..3e1d699ba934 100644 > --- a/drivers/mfd/syscon.c > +++ b/drivers/mfd/syscon.c > @@ -108,6 +108,8 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) > syscon_config.reg_stride = reg_io_width; > syscon_config.val_bits = reg_io_width * 8; > syscon_config.max_register = resource_size(&res) - reg_io_width; > + if (!syscon_config.max_register) > + syscon_config.max_register_is_0 = true; > > regmap = regmap_init_mmio(NULL, base, &syscon_config); > kfree(syscon_config.name); > @@ -357,6 +359,9 @@ static int syscon_probe(struct platform_device *pdev) > return -ENOMEM; > > syscon_config.max_register = resource_size(res) - 4; > + if (!syscon_config.max_register) > + syscon_config.max_register_is_0 = true; > + > if (pdata) > syscon_config.name = pdata->label; > syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_config); > > -- > 2.46.0 > > -- Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D