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 17131C54FB3 for ; Wed, 28 Aug 2024 13:34:42 +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=BiLmRdEJkR2KZs9VfjolkDfosTtrOJYzWKnvDNvDsVs=; b=x8Vefngmarf3yauAjXHdHqFprk ii7S98y0Tq3l5MzASDVZDAQsmMQTQGyNAdjGuJ5ArB8N3d5esXOuFtZRk5AqjD6ICLJf7SPjdiX8T NIoU+t7Rz0CBsWxShHBBHgtKg98EtIM4sWnVKj2umnTGfggof/XOocbKxsMQHph7adxhPS6KVKUB6 /ughtpNKu1eXm6uzqEGmaYN6LT/M9WfPFBU7LjpS8EWJHZzFFpbP8131jpdj0baIDPOUhnAkh+b8i ReHxdWS+vUuYkTm+aS0EFrzoS0RGXy/A9IQKrmCeJUVXo3aXL8JhGoWCp7DMjqxeZN9TvJO90+/+w yODBLJIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjIof-0000000FY7f-1iDO; Wed, 28 Aug 2024 13:34:29 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjInM-0000000FXoh-2rHE for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 13:33:10 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 47SDWTsv050379; Wed, 28 Aug 2024 08:32:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1724851949; bh=BiLmRdEJkR2KZs9VfjolkDfosTtrOJYzWKnvDNvDsVs=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=vTPlzDduyLwOz/YHo/ly1RZlUGh8O2s4UqmXAmf7exyVwd77xEaPL8N2SosIAAmMe k/3nd1l0mxQqHuyXKkicPFXPUaDzk+/AMqPx7jFYVwl/i1sT2yh9yiRHSi7WTb1aNo 534ecz7k4kR2HvlHNOZWfnp2s4F0YzgWQ68GvOQM= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 47SDWTK6025636 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Aug 2024 08:32:29 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 28 Aug 2024 08:32:29 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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 via Frontend Transport; Wed, 28 Aug 2024 08:32:29 -0500 Received: from localhost (uda0133052.dhcp.ti.com [128.247.81.232]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 47SDWT0K021616; Wed, 28 Aug 2024 08:32:29 -0500 Date: Wed, 28 Aug 2024 08:32:29 -0500 From: Nishanth Menon To: Mark Brown CC: Arnd Bergmann , Lee Jones , , , , , , Jan Dakinevich Subject: Re: [PATCH] mfd: syscon: Set max_register_is_0 when syscon points to a single register Message-ID: <20240828133229.67bej3utpgrmzr3p@retired> References: <20240828121008.3066002-1-nm@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_063308_867135_0B5BE40E X-CRM114-Status: GOOD ( 25.43 ) 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:57-20240828, Mark Brown wrote: > On Wed, Aug 28, 2024 at 07:10:08AM -0500, Nishanth Menon wrote: > > > Commit 0ec74ad3c157 ("regmap: rework ->max_register handling") > > introduced explicit handling in regmap framework for register maps > > that is exactly 1 register wide. As a result, a syscon pointing > > to a single register would cause regmap checks to skip checks > > (or in the case of regmap_get_max_register, return -EINVAL) as > > max_register_is_set will not be true. > > In what sense is the behaviour changed for a map that doesn't specify a > maximum register? > > > Fixes: 0ec74ad3c157 ("regmap: rework ->max_register handling") > > In what sense is this a fix? The max_register was 0x0 was clearly a corner case. The fix done for remap should have cleaned up the users of max_register to maintain the behavior. That is just my opinion. > > > + if (!syscon_config.max_register) > > + syscon_config.max_register_is_0 = true; > > This will cause any syscon which does not explicitly specify a maximum > register to be converted to having only one register at number 0. That The context of the diff is important - code above already sets the max_register as syscon_config.max_register = resource_size(&res) - reg_io_width; So it already does set the max_register. syscon does'nt explictly set a max_reg - it is derived from the resource_size. > really does not seem like a good idea - unless you've done an audit of > every single syscon to make sure they do explicitly specify a maximum > register, and confirmed that this can't be specified via DT, then it's > going to break things. I understand the risk - but having a consistent max_register definition is important - key here is that in regmap, max_register is valid if: a) max_register not being 0 b) if max_register is 0, it is valid only if max_register_is_0 is set to true. When syscon sets the max_register, it operates correctly for num_reg > 1 however, when reg_size == 1, you don't get the checks that you get when num_regs > 1. That is inconsistent behavior. It might help if you can clarify why you think an inconsistent behavior is correct for syscon? -- Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D