From nobody Wed Dec 17 03:26:11 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C3402236926 for ; Wed, 11 Dec 2024 20:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733950653; cv=none; b=UcrPJBcMsm31yGgULnItwEJt5dA7RuPnQ5IyoLnVICBHDIIYsUxXO8IAj+TXQNAvqbHRcDqmKGjvoLr0lfR50/q82VX7DaYwdokSg1lTlOP/uo67nF9TIYXL0SqC319QxS5MJlAFBmz/nwP/XXJl0TLWom0hXQBnpyZoMm8j0XM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733950653; c=relaxed/simple; bh=Y/MDmPX+r3gFiGkupbpCHeLUQbC0UW+h6X8OOkloMKE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZJa/75YLb2HBAxpFUi2zLB5LRC0lG7yNVK78UQ9u1U6oYGCqkZzvzXJ3RkZgm9pXSkN6B/l1WHV0aqVsS4pf8BeD9y016of6f3snKrhiezApZ3vofKvNw4KRQkT8gJ8Rc4O04Q4ObvdZBjpArbp1YvzbehLpsmy2vBvLhBcgQbo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LN0YFaNW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LN0YFaNW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76787C4CED2; Wed, 11 Dec 2024 20:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733950653; bh=Y/MDmPX+r3gFiGkupbpCHeLUQbC0UW+h6X8OOkloMKE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LN0YFaNW0XkbhQWrUu4KyYxoUxFeOOL/7gN/959Y/oZ4XosqkwUk6Ful1RaogQoXe d0UADj0jmauunJXNMJtYTA68o52KnvAKrFoADSFc4baqVNTbsf8QO4NAxRyZVT1MBW gcPjNKqg1R8UdZdA6xp84He5i51rheLtXsXe0hDoO04B9JmcTOZEIm6HwFZqV8wV5y NeRys0hIIBzMlo7yDVjGVyTSP2NdJ4xiJWOwgW/ndGBeMUJzFl7L7oGy8tvlHorfK+ mhg1r5u5NYb/QVKhXBxLxRKYlVOLXE8D6Nzz3Ae5U7SOArctOsFvRDY8Qa/h6K87Cy HJ8KM84ngZejg== From: "Rob Herring (Arm)" Date: Wed, 11 Dec 2024 14:57:14 -0600 Subject: [PATCH 3/3] mfd: syscon: Allow syscon nodes without a "syscon" compatible Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241211-syscon-fixes-v1-3-b5ac8c219e96@kernel.org> References: <20241211-syscon-fixes-v1-0-b5ac8c219e96@kernel.org> In-Reply-To: <20241211-syscon-fixes-v1-0-b5ac8c219e96@kernel.org> To: Lee Jones , Arnd Bergmann , Pankaj Dubey , Heiko Stuebner , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi Cc: Peter Griffin , Will McVicker , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.15-dev of_syscon_register_regmap() was added for nodes which need a custom regmap setup. It's not really correct for those nodes to claim they are compatible with "syscon" as the default handling likely doesn't work in those cases. If device_node_get_regmap() happens to be called first, then of_syscon_register() will be called and an incorrect regmap will be created (barring some other error). That may lead to unknown results in the worst case. In the best case, of_syscon_register_regmap() will fail with -EEXIST. This problem remains unless these cases drop "syscon" (an ABI issue) or we exclude them using their specific compatible. ATM, there is only one user: "google,gs101-pmu" There are also cases of adding "syscon" compatible to existing nodes after the fact in order to register the syscon. That presents a potential DT ABI problem. Instead, if there's a kernel change needing a syscon for a node, then it should be possible to allow the kernel to register a syscon without a DT change. That's only possible by using of_syscon_register_regmap() currently, but in the future we may want to support a match list for cases which don't need a custom regmap. With this change, the lookup functions will succeed for any node registered by of_syscon_register_regmap() regardless of whether the node compatible contains "syscon". Signed-off-by: Rob Herring (Arm) --- drivers/mfd/syscon.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index bfb1f69fcff1..e6df2825c14d 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -171,8 +171,10 @@ static struct regmap *device_node_get_regmap(struct de= vice_node *np, break; } =20 - if (!syscon) + if (!syscon && of_device_is_compatible(np, "syscon")) syscon =3D of_syscon_register(np, check_res); + else + syscon =3D ERR_PTR(-EINVAL); =20 mutex_unlock(&syscon_list_lock); =20 @@ -238,9 +240,6 @@ EXPORT_SYMBOL_GPL(device_node_to_regmap); =20 struct regmap *syscon_node_to_regmap(struct device_node *np) { - if (!of_device_is_compatible(np, "syscon")) - return ERR_PTR(-EINVAL); - return device_node_get_regmap(np, true); } EXPORT_SYMBOL_GPL(syscon_node_to_regmap); --=20 2.45.2