From patchwork Fri Dec 6 00:52:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019005 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=eLeNS1rW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=devicetree+bounces-127736-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CRx5wPZz1yRK for ; Fri, 6 Dec 2024 11:53:33 +1100 (AEDT) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C8229283C39 for ; Fri, 6 Dec 2024 00:53:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F25745028; Fri, 6 Dec 2024 00:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="eLeNS1rW" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 0DCE92F32 for ; Fri, 6 Dec 2024 00:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446392; cv=none; b=lijq6b9Ibj85g7nMw6jWkGcKDUDcw0bp7T9uWzbP23dbsEFpc/u3BGjpI8nPC7jkJkYApaQwGkxOrcV9LJOwTFsEm5kJ7xm60dKoXndn6bCD5ZpXpfpVU8ibMPhvsLCQM/cCrTROM6WYg9syh6oyiquM0eJ2lOS1upwNbtfFLG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446392; c=relaxed/simple; bh=Wwz17/zhfYFbbFxy81RaIgqyHTpcJu8VU0c4FjQZIqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Pwe0mdLZeYSU9PfLzvzy0g24JzI7ha4ZhwbsWGxQScWG/3hiQykySEc7K01gZtvRBATmHkDfZ06PLpiWFVT3nyrEWSykw0ovFjyU+PLkzSwh/lqqJuSswMQjhmfmHaqS97/DKhQF57gjSnwdS20LADZ7xvy19Q01dE0APGuI364= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=eLeNS1rW; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446390; bh=Z8FxYowJt8L03PaNytmuPjkcdXVFkhckag7aRnXxAiM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=eLeNS1rW03NcojFnd0UQ7um3nBqmjQXtLh6FEjC31VkcTdYLrqSUpCwJiuhYO5GVW QWHX2XiGfKdt668M93bqV4J8xJCV+WebgvLVvvxXtyqgNTUfaxc6KnQFkEnzdDO7u1 r4+C6D0fz7+zSc5shNvuyxLF76Jb4Vh6OE4rtHFfqBU/Lb81KAqEdbGDQFxu4BDMXH sGE6GQV6yRzmcy+pT8UbSn36TLqqQ5VKkeDatUfriOEPBaOg0bERuAY8LEG8PL5zLe pWpi3OtKf22Ww5Z3ZuesLuFGBMw9qk37Y9TEQb8rVjz/MI5TY1kRjce4mGFnHuD0S0 3FNwBFnVXnv+A== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 42E30A02C3; Fri, 6 Dec 2024 00:53:03 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:27 +0800 Subject: [PATCH 01/10] of: Fix alias name length calculating error in API of_find_node_opts_by_path() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-1-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: JLWXoN9J3ROI2oJSfcVDAoO7hFSlu5j_ X-Proofpoint-ORIG-GUID: JLWXoN9J3ROI2oJSfcVDAoO7hFSlu5j_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=878 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Alias name length calculated by of_find_node_opts_by_path() is wrong as explained below: Take "alias/serial@llc500:115200n8" as its @patch argument for an example ^ ^ ^ 0 5 19 The right length of alias 'alias' is 5, but the API results in 19 which is obvious wrong. The wrong length will cause finding device node failure for such paths. Fix by using index of either '/' or ':' as the length who comes earlier. Fixes: 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 7dc394255a0a14cd1aed02ec79c2f787a222b44c..9a9313183d1f1b61918fe7e6fa80c2726b099a1c 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -893,10 +893,10 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt /* The path could begin with an alias */ if (*path != '/') { int len; - const char *p = separator; + const char *p = strchrnul(path, '/'); - if (!p) - p = strchrnul(path, '/'); + if (separator && separator < p) + p = separator; len = p - path; /* of_aliases must not be NULL */ From patchwork Fri Dec 6 00:52:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019006 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=vS/rPvlR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=devicetree+bounces-127737-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CS93DMxz1yRK for ; Fri, 6 Dec 2024 11:53:45 +1100 (AEDT) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 17A42164731 for ; Fri, 6 Dec 2024 00:53:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4203857CAC; Fri, 6 Dec 2024 00:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="vS/rPvlR" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 C0B432AF1E for ; Fri, 6 Dec 2024 00:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446399; cv=none; b=lxyCNoihjti+U5dLHIPRgFRioKfO6J/+RXyBM31eWYLg2QzXgxmwjvrw02q/afDIFSjvZ0wJ6jlgsGF4hv3+H4Cra73ZeTM1bqIwWSFHBwODjlUDKATBEAuZICASIeMwsBxWpprtI+sV8pgkfEms8rsD7rDnZA3VS+avAjiKKvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446399; c=relaxed/simple; bh=QNsEWPAUkVVpVRHkibyslz6e/t3LkzhnTAjUDcHXryo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T2LiG0S2fTwQGBfauSB1hCeDYM8IcPWxa8k7aZLjh87sYErua+BOShcmlxd5y9SH6H0fwiMExeOYobzwl8zHxp4I4C6YzbJEC/ShsF1DmSqrMBtnLIa2LTZVjzsGc3xR0hJq777UIKm7hqQ4Q9HR2heBhAVtnVqE8IHRJogE1EA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=vS/rPvlR; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446397; bh=RWEwv6+w7N1voYBxavX8EFSb/Sf8/2DrEXYvWY7v5b8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=vS/rPvlRMVJdI3sTb6UxqxuUmZkywhQliTgtCNwf9IkCPmEeE+MYVn1rRYh7Ryc87 VQSbhHXg14duSX/X8ey6dc51Vd+D2+wj1MWZ3wP7iRGBmyM5J7pwAws6/oZP/iX33Y JkAK4Xwv/H15KmCaM2M+31s0BQ+gf5vz8QWb0GqNGQX9ODlgKCz2fWvhfJSJKmxLJb 5/JrmlL4dhCJd0fIT0W/W+lKgHFa7NFgnNN1ZOyxSJZYtfi+fqyzEwueINiy+WJeQk XMZ2/lKhArILdPHpRfnH+3x3xOQlzN73CuVkzCuqPicKJNLmrXI6sVv3wb0eUdKNwX 0lz+iI2BBA6Gw== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 4E134A02CB; Fri, 6 Dec 2024 00:53:10 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:28 +0800 Subject: [PATCH 02/10] of: Correct return value for API of_parse_phandle_with_args_map() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-2-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: CmPjX01vzh582m55VjBZWZ-kMxVZ6PMg X-Proofpoint-ORIG-GUID: CmPjX01vzh582m55VjBZWZ-kMxVZ6PMg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu @ret is used by of_parse_phandle_with_args_map() to record return value and it is preseted with -EINVAL before the outer while loop, but it is changed to 0 by below successful operation within the inner loop: of_property_read_u32(new, cells_name, &new_size) So cause 0(success) is returned for all failures which happen after the operation, that is obviously wrong. Fix by restoring @ret with preseted -EINVAL after the operation. Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 9a9313183d1f1b61918fe7e6fa80c2726b099a1c..b294924aa31cfed1ec06983f420a445f7fae7394 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1516,6 +1516,8 @@ int of_parse_phandle_with_args_map(const struct device_node *np, ret = of_property_read_u32(new, cells_name, &new_size); if (ret) goto put; + /* Restore preseted error code */ + ret = -EINVAL; /* Check for malformed properties */ if (WARN_ON(new_size > MAX_PHANDLE_ARGS)) From patchwork Fri Dec 6 00:52:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019007 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=lDypAx2r; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=devicetree+bounces-127738-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CSS03ylz1yRK for ; Fri, 6 Dec 2024 11:54:00 +1100 (AEDT) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 724221884570 for ; Fri, 6 Dec 2024 00:53:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70E70126C04; Fri, 6 Dec 2024 00:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="lDypAx2r" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 EC80E80BF8 for ; Fri, 6 Dec 2024 00:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446406; cv=none; b=X8F1JdPm/wnrbO6CJlYI5KOpOiFawkEy996x8VHaUYO/DFrheUJzzHY69UWIwWL0nYAmavLC3r3jmMJ1ktpcKTuT/1UkEyO17GrySGGpB5XUN3xGRAS1cs4t92V2UCYWWjmdPn4KiCsDPq8YKPwe5Tc7ACuNs02YLemkRaQ21b0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446406; c=relaxed/simple; bh=mEThiGvzQrWP4T5PTbX9axo1KDuPsGVUxJFR2EnyR6Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LEoTtCQbcpVMXuW3Pj8kzpDYoACltBU/co2CTfKcszbSSk+GbPbdDtUgvDDJbKt1t+fCr6O5r7X+bWdzQWzGlvPlM6r2y1TMJVRSuFdEC8LJncqTxdCBZJyiKLt/vTIArOkXdHkwmA+wZxJWxWW/vIGkXqsZO522jn0E6ygYhUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=lDypAx2r; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446404; bh=dz50I+uPmRhfwhn2tfWCnV8FssyJCtBV9kiQ8UvvO0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=lDypAx2rdyIN/ZFc9shpxJ5OI/QQ6e6nPRppyfB07woqWrd+yINxO3zyYJHHsNcw8 a5Mf6NYje7GCq6GlgxLIBGXPnW0dZK8wY0tfOwW3+NolMkVX2wYn9aADI+T+scIbCu xlK8wJJflC0rqmfhNMCBH/fnLEyzt/HI1vIjcKgtrW+YMIshKl7jRB8zY23BLJCase 8kQVtHceyT7atS9RPeVASQRAUq2zIq8ETAOsbjAprA9lCAJeM196paOKxRhQarNkaw jdq22jW98L5PcCVBHx3XcHE3UWYB1eZC6AQ5AJJ7KgK4rgHBDGNIC3LP/U22UNM8qv zWa31q374NglQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 586AAA02B3; Fri, 6 Dec 2024 00:53:17 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:29 +0800 Subject: [PATCH 03/10] of: Correct child specifier used as input of the 2nd nexus node Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-3-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: bI027jOBE2iL0sJEEtmYBj4aX4FrwwpK X-Proofpoint-ORIG-GUID: bI027jOBE2iL0sJEEtmYBj4aX4FrwwpK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu API of_parse_phandle_with_args_map() will use wrong input for nexus node Nexus_2 as shown below: Node_1 Nexus_1 Nexus_2 &Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,... map-pass-thru=<...> Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru. Fix by always making @match_array point to @initial_match_array into which to store nexus output. Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index b294924aa31cfed1ec06983f420a445f7fae7394..1c62cda4ebcd9e3dc5f91d10fa68f975226693dd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1542,7 +1542,6 @@ int of_parse_phandle_with_args_map(const struct device_node *np, * specifier into the out_args structure, keeping the * bits specified in -map-pass-thru. */ - match_array = map - new_size; for (i = 0; i < new_size; i++) { __be32 val = *(map - new_size + i); @@ -1551,6 +1550,7 @@ int of_parse_phandle_with_args_map(const struct device_node *np, val |= cpu_to_be32(out_args->args[i]) & pass[i]; } + initial_match_array[i] = val; out_args->args[i] = be32_to_cpu(val); } out_args->args_count = list_size = new_size; From patchwork Fri Dec 6 00:52:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019008 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=b+yW8+sX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=devicetree+bounces-127739-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CSc3w5tz1yRK for ; Fri, 6 Dec 2024 11:54:08 +1100 (AEDT) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 67260283AB3 for ; Fri, 6 Dec 2024 00:54:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23E3D13C906; Fri, 6 Dec 2024 00:53:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="b+yW8+sX" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 B5D9612D773 for ; Fri, 6 Dec 2024 00:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446413; cv=none; b=ZBZj7dU40boRtob8pWimvDlFg4Yx55TTXZHBoyhgt6cpuYIwTiCT+Lga758QJ6+SsbLCs7ET50e382Z+SrG5cway9VCNoNZfmQcKZjj8x68l4p2UFb89WBpXUU5sde8sBG/vzXjfjkqcmHdh01beWK9/GUIBhSlgD2yiJL5U//g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446413; c=relaxed/simple; bh=FaRMEIV+exE3InCIiV8aqHdt9GbcDCRX0xauLBCBB1g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b0Dd+nmcRe4obnXvJ7WQSg65I9mA6bXFxEgDr6Y6fe2EdPMcG8Z3sXhUn4utzWbmU5x+KYHHonsqqBXOEav0HAzlLEBZkORw+zkZn6DHqKaqeg4mcBfFZezeDksR+Jiu6k3uqTMtRln2uKt4U+Gpk3zvycVuOY2SzqHxvi4zixE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=b+yW8+sX; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446412; bh=SO+YgkHSdNXANbZ5T5jcpT8WEiFa/mZr6j+65qv6KYM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=b+yW8+sXHX+kntqg1oF8Ua+6ejCxKtpfcYTUin21jsKCANSUKkBL51EBFuOOGTMgs nH2CYsvfkrp9o1HMVNKoFNtEG8C3qSPkMT9t5PtYekjXy7hth33T/9iu0TD8PaZgVJ F3vhQtA3JP+4/u8U6IA55PClX+LjdYrzJ0lnrDJN2hTPKH3ZbMyMbXOsX74DEp4KDY VC/lz1m6eyYP5wRmN2irCA3GRgND6lOo/YqEkepN9DgKK1BPAq2RYXJoWcBQ05dNrG GRHq8HT26NWc7yekv0f3qToW8Ttvhs/YsYFLz3MnicW7stOX6u2mElPbR1grOE/y4J UxC1KeDWzz5xQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 57FDCA028F; Fri, 6 Dec 2024 00:53:24 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:30 +0800 Subject: [PATCH 04/10] of: Fix refcount leakage for OF node returned by __of_get_dma_parent() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-4-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: oPvYCtz1VfHG2AZPba9aShtEj8EUGgiZ X-Proofpoint-ORIG-GUID: oPvYCtz1VfHG2AZPba9aShtEj8EUGgiZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=855 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu __of_get_dma_parent() returns OF device node @args.np, but the node's refcount is increased twice, by both of_parse_phandle_with_args() and of_node_get(), so causes refcount leakage for the node. Fix by directly returning the node got by of_parse_phandle_with_args(). Fixes: f83a6e5dea6c ("of: address: Add support for the parent DMA bus") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index c5b925ac469f16b8ae4b8275b60210a2d583ff83..cda1cbb82eabdcd39d32446023fbb105b69bc99d 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -619,7 +619,7 @@ struct device_node *__of_get_dma_parent(const struct device_node *np) if (ret < 0) return of_get_parent(np); - return of_node_get(args.np); + return args.np; } #endif From patchwork Fri Dec 6 00:52:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019009 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=pWbqZAPx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=devicetree+bounces-127740-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CSp4WSLz1yRK for ; Fri, 6 Dec 2024 11:54:18 +1100 (AEDT) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A89F6283B5A for ; Fri, 6 Dec 2024 00:54:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDBEC13D245; Fri, 6 Dec 2024 00:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="pWbqZAPx" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 41A93139D07 for ; Fri, 6 Dec 2024 00:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446420; cv=none; b=dMZf41l8uGahwShyDoN/TTzgpGKP/en9tPkSv2pSLBW7Gj9TsXYMb23BIZDDEIs9ZZ2KezQ3ac5c3/7yJxLrRxCrO+dHM8x+tVg+GNxjjBD/hhXVvke8SLKDFXsE2lglqF7VRhh5X7iWqumd13q/8fLQICBbNAYW9lGvCyThEq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446420; c=relaxed/simple; bh=FgwvHjDGIbQG/R/BNUFvSMUMH8Fj/yPF7XlOjRUkyNY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gKNfTJbVc5XmF7MTFI6Wcwekrrhv4PEWwO40KRcAgRazb+oC1+Y+h6xAYiuSHz+Gd+qfbP6Mo5nSEsMMe6YFInMA/mcm/g7F+/jZp/LNjOqK4WuTDFdrRWys9CiLqhU7rVj4BONfTxf6s1awW/BiVw4jBKdi7P4r0bGbVuXgWrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=pWbqZAPx; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446418; bh=3+suBHwqaJPwVuU9nWF9+bbade9Tamq+5YBxYiQbdDM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=pWbqZAPxRYhijtofVz4kvariE1IES6fKMu8pshJJFQuAkdHlhBqQmMmz1uHqhcG0F uiQMem94lNr2DcmjE+Yjlw71vsu1ZS3tOA7zR8loN5eZXxVTwsYJlTSndaTXeJcBrs +xZ9NXM1pse+VdUbzBoH5oN4T/Ezn1AdptUkVYSefxkZbrp5dbzASkKHLUAq7Raq8V IH7UQ+6f79gVv5ETySUhNrAhzANnGuanvhCr5/ywqSNUDT0LzaUBrLvhxolbnHHIaW e9QmwbNoqgZg8ZAk2ZgYkUfvtRd6PTbv+KhYf+ZPiKDCJZ6UKdi5imBWNh5GOmE5b1 ozkh/82CSp26A== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 11E45A02C3; Fri, 6 Dec 2024 00:53:32 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:31 +0800 Subject: [PATCH 05/10] of: Fix available buffer size calculating error in API of_device_uevent_modalias() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-5-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: K5CjjhjSYBHgKtGr_iDbQTSXbi0zQvw0 X-Proofpoint-ORIG-GUID: K5CjjhjSYBHgKtGr_iDbQTSXbi0zQvw0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=978 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_device_uevent_modalias() saves MODALIAS value from offset (@env->buflen - 1), so the available buffer size should be (sizeof(@env->buf) - @env->buflen + 1), but it uses the wrong size (sizeof(@env->buf) - @env->buflen). Fix by using right size (sizeof(@env->buf) - @env->buflen + 1). Fixes: dd27dcda37f0 ("of/device: merge of_device_uevent") Signed-off-by: Zijun Hu --- drivers/of/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index edf3be1972658f6dc165f577da53b10c7eebc116..ee29c07c83b9e6abd9b1c7747dd341026bc79eb0 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -266,10 +266,10 @@ int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env * return -ENOMEM; sl = of_modalias(dev->of_node, &env->buf[env->buflen-1], - sizeof(env->buf) - env->buflen); + sizeof(env->buf) - env->buflen + 1); if (sl < 0) return sl; - if (sl >= (sizeof(env->buf) - env->buflen)) + if (sl >= (sizeof(env->buf) - env->buflen + 1)) return -ENOMEM; env->buflen += sl; From patchwork Fri Dec 6 00:52:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019010 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=R9wSIWxo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=devicetree+bounces-127741-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CT43BQrz1yRK for ; Fri, 6 Dec 2024 11:54:32 +1100 (AEDT) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4A5D01884D0C for ; Fri, 6 Dec 2024 00:54:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9412F76048; Fri, 6 Dec 2024 00:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="R9wSIWxo" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 D5506282FE for ; Fri, 6 Dec 2024 00:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446427; cv=none; b=N7nYTCPLT4ffsRQSmwcxaD8/LWvs2O63pDQ4rpsONshFjSUJKKZbxMBGVMiHjMe2jlogS4TWdyiu+Qyr/HS4DJVz+THa0e/xdlH3XCX+2BJ2ihXKrqX1dV2xK9NtAhEdbChefrwEq/DWGRUwUmndvDoci8jGNrgZhtLo3NT1NHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446427; c=relaxed/simple; bh=Q9xVwx+mmn7ZFp9zYbGBt/qs8maxp/kG00CZiM5eHAI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jira/jBz3W7JWJxrMkeWy0cJsBpC2A4Ku6/tJqQiSpAXmg5U8zgLYR5sr/v9JT+OhRTjzYVqSgrJWnGi45CjCgECV73d/w6Wuq69A73wNs72CzYnaaTHhlO1zRQ2aMpOxfH2h/pdlraHoqNCvFrfSiiwLzMUXLeUsf+ckMte2x8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=R9wSIWxo; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446425; bh=h19CCu79uQPaou5AwQpkA6b+XyLa6pyMxHtnX9ZwgYY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=R9wSIWxodsjd+FrWBAWSML3aQx5b1J4EEhuCEb95I/d+3DDIBG6iLrwKcTtE8Vjxk AqXh3lepG6aA94eCND1wqvXaF90wGwzj5Sc14faR6vqwha5uuNBS1OC3ZreQa5wblG xWsxhC2cMRZ/BOXVjBOrhycvsdbGqrocoLDYtD5f5npyLjIfn4hu13p+Vh/GWSC+ng 4iwN6gMoEPFdR/o9hZ7Gmayxp4SQ5e1UsoxHOR+w8QquLDuBHhAlhAfyDYi/TkKF9Z aS/BgJH9nTRe2oMsVBGIzS7/a0EHWEbCRi3yLzEj865ldHPFeqbxUaVh7mcGJclXTk vRW5kX56p2pcg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id B7B5BA0287; Fri, 6 Dec 2024 00:53:39 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:32 +0800 Subject: [PATCH 06/10] of/fdt: Dump __be32 array in CPU type order in of_dump_addr() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-6-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: _l3FG0YuEQ29KnYZI_r-lqY1WcqzrzaZ X-Proofpoint-ORIG-GUID: _l3FG0YuEQ29KnYZI_r-lqY1WcqzrzaZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=771 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_dump_addr() dumps __be32 array without conversion to CPU byte order in advance, that will reduce log readability for little endian CPUs. Fix by be32_to_cpu() conversion before dump. Signed-off-by: Zijun Hu --- drivers/of/fdt_address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt_address.c b/drivers/of/fdt_address.c index 9804d7f067056a9437d37f0b4561d79dedcc3187..1e5311f6f1858b59b99f650bcafa55a8d11225f9 100644 --- a/drivers/of/fdt_address.c +++ b/drivers/of/fdt_address.c @@ -28,7 +28,7 @@ static void __init of_dump_addr(const char *s, const __be32 *addr, int na) { pr_debug("%s", s); while(na--) - pr_cont(" %08x", *(addr++)); + pr_cont(" %08x", be32_to_cpu(*(addr++))); pr_cont("\n"); } #else From patchwork Fri Dec 6 00:52:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019011 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=jBpGd9le; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=devicetree+bounces-127742-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CTH5LVGz1yRK for ; Fri, 6 Dec 2024 11:54:43 +1100 (AEDT) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A305C2838C4 for ; Fri, 6 Dec 2024 00:54:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BD6C13B588; Fri, 6 Dec 2024 00:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="jBpGd9le" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 77D7413AD2F for ; Fri, 6 Dec 2024 00:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446433; cv=none; b=OVRHJYKXa1UFAUbBqe2DeBxK4qI/mDT6AtLXo0z5ReOUR6QiT6q5mmDgvLnchMLXLh/s+CpaE+sOjtHaeYPiE8zyyqL1hlpBPFy50RQpp4juT2RTbDjgbA9dH2x4+Vr8nu4K02+Fc/AKEgqfJ4gEzuigdtmC88LxXbRarc8WXOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446433; c=relaxed/simple; bh=3r59l2ZKH0fb/gjUMwsN9/pByrdyRbSqBd7pZeH+Fqw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hgIo6O4qFWqcvhsGXL/b9V9cpZfuU9+3Zp7TchS9Htu82DE1j7Alavje6yAUf496UuXJrOW2BIJ2V7PQ2oObtrbgaPMR123N3glPWtcrRQuaq9cJldGekUUcleakKoqRnhlguPEa5lr+90ujEk16ZtgjJ4Xyhj3Ph/waaFTqKsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=jBpGd9le; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446432; bh=6eW1KIk0QTFVWX1i7yXwMwfKqVa+AKG/PTqwf319jEk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=jBpGd9leV4TpDMvlt7wR4rMtF2g2DydLFBQY7S+BYpS0dSSseYv+xMlS0mCmf/uF0 iBUH5cuf0Eugc2Ikokj2j+Sy5CB4ZzMolCh+mE5ku+S1tMAQ+8ytMzkWJ5nZE9nDdC DBrM8QmIq6dnfZo7vFFTioiOq+ZsIUQeWe0xE81DNTJ3yVuk0O2XjIOtvtl7dcu33K MraPlklI10JEg5GO7X7q0t0e+KvqNpnF7KWh3ix5lE+Cpn8q7rumZKNFoc+zukuDPC XzfHeGc27Ed4q7LkcMUcP1YhC5w2kMT51cATzGx2To7vP3G26IEGefWVCdbeWe99ed WQFxIFfA2LAxQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 64023A0286; Fri, 6 Dec 2024 00:53:45 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:33 +0800 Subject: [PATCH 07/10] of: Correct comments for of_alias_scan() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-7-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 0Di-Sp0-9pGnSZP4hO3f-_yAwFawx1pf X-Proofpoint-ORIG-GUID: 0Di-Sp0-9pGnSZP4hO3f-_yAwFawx1pf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Correct of_alias_scan() comments by: - Replace /* with /** to start comments since it is not a API. - Delete return value descriptions since it is a void function. Signed-off-by: Zijun Hu --- drivers/of/base.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 1c62cda4ebcd9e3dc5f91d10fa68f975226693dd..33abb6227468c03fd191201aa2bbe05a41fdd9f4 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1812,14 +1812,13 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np, ap->alias, ap->stem, ap->id, np); } -/** +/* * of_alias_scan - Scan all properties of the 'aliases' node * @dt_alloc: An allocator that provides a virtual address to memory * for storing the resulting tree * * The function scans all the properties of the 'aliases' node and populates - * the global lookup table with the properties. It returns the - * number of alias properties found, or an error code in case of failure. + * the global lookup table with the properties. */ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) { From patchwork Fri Dec 6 00:52:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019012 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=ckdP6A42; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=devicetree+bounces-127743-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CTb42pmz1yRK for ; Fri, 6 Dec 2024 11:54:59 +1100 (AEDT) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C6019165EA3 for ; Fri, 6 Dec 2024 00:54:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5698213B293; Fri, 6 Dec 2024 00:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="ckdP6A42" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 C888D126C09 for ; Fri, 6 Dec 2024 00:53:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446441; cv=none; b=QPaU/WJ0TdCxp8hMOhVL0D0lm5MBSWjNQRtKZLWzIirhK6Lgq+vINUrH2z5JM8wo20L0IZvZMWQ3WUAZpkVBtKMSvmZEIm7RpC9yyYcu4kiTQtNirTiPRTuwQU6PrAE1/eXwGoxYLSHW6xwcX5yGIlmpKuElVm8ssxiqMLS7M/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446441; c=relaxed/simple; bh=Ve3n7niyMk1tbFP7EFflEAAnysU9QzXXKxfUINvS3wc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OFSoHanlf1cobEd7PtyfIuLQR14AfapP4oe4U7dN8Yecm6N8bUl0Q5hSB4Y9UjleL7zboswQhicWGEkqk2J62qRO7qXNdIC2T/UOftbMYVGXxywvyH/H+cuf3CZsdntbKe9V/vO61V3Tjlp/UJrodtQ+wEiTLaqRq8WNdjRh068= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=ckdP6A42; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446439; bh=ZlEoJI341ZSEvnqS6oDGrnWUpLJKotzXqO9H+UmL4dw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=ckdP6A421aaBj/IIvvr5OxHE1DOGGumkgD2MQrttU+nUS76oaXVBQCDBEJo4iKDMZ jpMD/hZmld5ybRG27CyiTN85poZL9ECHeXMwKKqVYKP/3SznpvQ+QalKJXUG1TamrB Qs0nbhxRl5o4kaSh09Sk1JneWVEaNMymZxOwnkdNE3zGA7kjqvi6/H+KQofFUtPjGU JEbQvBIBl2fTGzOoDnsAgmjaSuy5VuJZKktRjSrXdljBAEoZ4Dxhc81WsMtPaOnD6p cYKHawZAhU73n8kgP+g4CA1Y4mOUmjwW+B2JY9xMseErO7fr7dzMm9iuaN3a0FA3DZ RUs64ekbmjRow== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 0ECA9A0287; Fri, 6 Dec 2024 00:53:52 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:34 +0800 Subject: [PATCH 08/10] of: Swap implementation between of_property_present() and of_property_read_bool() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-8-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: PXcWkQ90dxDs5MfUk7htivn02RgapTAS X-Proofpoint-ORIG-GUID: PXcWkQ90dxDs5MfUk7htivn02RgapTAS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=857 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_property_present() is exactly same as of_property_read_bool(). Swap their implementation to make them more logical as shown below: find property -> property is present or not -> boolean property value. Signed-off-by: Zijun Hu --- include/linux/of.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/of.h b/include/linux/of.h index f921786cb8ac782286ed5ff4425a35668204d050..7b0da8d352dffd8b872998903282119b6164a5bc 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1243,17 +1243,16 @@ static inline int of_property_read_string_index(const struct device_node *np, } /** - * of_property_read_bool - Find a property - * @np: device node from which the property value is to be read. + * of_property_present - Test if a property is present in a node + * @np: device node to search for the property. * @propname: name of the property to be searched. * - * Search for a boolean property in a device node. Usage on non-boolean - * property types is deprecated. + * Test for a property present in a device node. * * Return: true if the property exists false otherwise. */ -static inline bool of_property_read_bool(const struct device_node *np, - const char *propname) +static inline bool of_property_present(const struct device_node *np, + const char *propname) { const struct property *prop = of_find_property(np, propname, NULL); @@ -1261,17 +1260,19 @@ static inline bool of_property_read_bool(const struct device_node *np, } /** - * of_property_present - Test if a property is present in a node - * @np: device node to search for the property. + * of_property_read_bool - Find a property + * @np: device node from which the property value is to be read. * @propname: name of the property to be searched. * - * Test for a property present in a device node. + * Search for a boolean property in a device node. Usage on non-boolean + * property types is deprecated. * * Return: true if the property exists false otherwise. */ -static inline bool of_property_present(const struct device_node *np, const char *propname) +static inline bool of_property_read_bool(const struct device_node *np, + const char *propname) { - return of_property_read_bool(np, propname); + return of_property_present(np, propname); } /** From patchwork Fri Dec 6 00:52:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019013 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=C52GUwAS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=devicetree+bounces-127744-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CTq1HjSz1yRL for ; Fri, 6 Dec 2024 11:55:11 +1100 (AEDT) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 61697165857 for ; Fri, 6 Dec 2024 00:55:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 321D313BAD7; Fri, 6 Dec 2024 00:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="C52GUwAS" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 AD79B38DC8 for ; Fri, 6 Dec 2024 00:54:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446448; cv=none; b=dwEFVF/mw7mEPEtJwn8hH8NuJklacTwYgGxwTwAf8GXB09ZfkFwEp92d6Bni0bq9Q4MFUaZ+6sOZAaDzBq4rOjuKBrTLHmFQgqQYex6PzMcUCTh/egdwtIR6N9SJVxrhxPmJcrEth/AzmpErbKHIy7njK0BtOzpgkp3qIizg660= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446448; c=relaxed/simple; bh=p2uJy5wlhcAeH29QIKPJq4WBggZbGwCXj0DgoGtnco8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RjOdG43MQcv4KvgUwNLMpKOoyDcGpWvSgl2xZUDEMfY5QEeTEhQA9H6zYwk4RBR8mFxe10AODJhrMcNue5US0b65QQna3z79Z17TpOJ/Gvp2cX+cmm/HP4rUNkAKLiBe6fXUPsBcXyoV7W5EnV8itQsb0Pzt6dDEUMLcGKTD2io= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=C52GUwAS; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446446; bh=v8GTvyAKaega/LEBXEiMnIjJ5Doyy9iyoBrZIPFUfM0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=C52GUwASzYXmvwiAOuLkCT07bTBEy+zo30Uynnca1KTn+h5/hQLzmOwTQEY2r7Hnf D3v7fnp/cF250qBRdelu10XQ1m0EEv9N/Sb4E1BfPLCKmRWfS5DjXCP2DzukuAFXXh QpAmAXrmzEw2ZTHlnb9vWYYrchT0brh6gTu+j5UtULsK40gDCYij0wBfkIzf6csPrx r7y+8s+nOU2Wiqzv9TVQFRqsDMmfkJDLjaJ8q0tCGHBGMU23BAILCZjAsl8RbjkdyC taEp65XrsnhwrNYyWOROAOlOptEfEk7LX7OvpydQ7MpCokCAgnkse7VshHShWQR9oF h0Ue6bNhI4tEQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 5F27AA029A; Fri, 6 Dec 2024 00:53:59 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:35 +0800 Subject: [PATCH 09/10] of: property: Implement of_fwnode_property_present() by of_property_present() Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-9-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: y32qnoVcQ2pobTvnBj3XT4sfiocRSh8W X-Proofpoint-ORIG-GUID: y32qnoVcQ2pobTvnBj3XT4sfiocRSh8W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=862 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_property_read_bool() is deprecated for non-boolean property, but of_fwnode_property_present() still uses it. Fix by using of_property_present() instead of of_property_read_bool(). Signed-off-by: Zijun Hu --- drivers/of/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 519bf9229e613906547b57d8c68e7b8558eff327..dca1a3ebccae1093b2b11f51e8e692bca854d0e3 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -966,7 +966,7 @@ of_fwnode_device_get_dma_attr(const struct fwnode_handle *fwnode) static bool of_fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname) { - return of_property_read_bool(to_of_node(fwnode), propname); + return of_property_present(to_of_node(fwnode), propname); } static int of_fwnode_property_read_int_array(const struct fwnode_handle *fwnode, From patchwork Fri Dec 6 00:52:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019014 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=AC8Exnno; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=devicetree+bounces-127745-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CV01LXPz1yRL for ; Fri, 6 Dec 2024 11:55:20 +1100 (AEDT) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3A4F02839EB for ; Fri, 6 Dec 2024 00:55:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B554613CA95; Fri, 6 Dec 2024 00:54:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="AC8Exnno" X-Original-To: devicetree@vger.kernel.org Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 4458C46447 for ; Fri, 6 Dec 2024 00:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446454; cv=none; b=Ds88OT1qKVzfvlv54a9UplrRRRk0tpEKborySgM9UsTls025ntq9LjMH4UavGSwKbR+quMB+0w3iihqeNb1assdPuiOklqUxxfwkZcrN5n9AAHXHKv5qyV7RVgsv6XIoPCpSAGAE5UgDZgruAWAv3183JcJYyUWcLv9Ny2MposE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446454; c=relaxed/simple; bh=4gGpUxc+ueLe/9s3H5w03yxhgZr4jHYyf/gMsxtAANU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XfIwxUbbheqhlR7oO45PGLwL5Atf70Z+7hDZufXYcSOjtDfZp8Kj1gqrstuvlpVIVRC/c2XpGm627lr3XSmgRd1UopF/xNWIRoF3WQZCEvgALDZoJVLKP9KyP1lYXzFRClmONbFnNN6WEuOobeUE8eYzc0UCG+zdqs0SQV9+beI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=AC8Exnno; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446452; bh=GcCykD0GR82c2pG2Xkejm3Z3BIkCqKMX+zNiZjv69I0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=AC8Exnnoz0LrM2fmLtefB52Ri8YOch6woOLhBi9pH8zAgZx9OTBiNPPVz7vS6fIaP +yc9rr3bXLdI8yxrmhaXRU2ZUcRF7csGrc3O61Y+Ncd8bOQZVY2Bn9PgmzmuTW2avf N4Twwi3WqzqxESz5ZIL5ahagWYNCQfCwK+9jhkgPwq2ro0TZenLqt8Q/MMn2TINbYf PJDcdseLyL7Gw7JwVChUarLa/AzmiQOCxPm++laJk9RUws6nw/in2IPFBKL9Z5acxN bhs95pjPbbLvfLJr2/KcqqEZIegDPSBnqYIei8t2mXYRGz9jKuIuBTvBTqqOjD7+dq LxkPMou//d5ew== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 0E386A01E8; Fri, 6 Dec 2024 00:54:06 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:36 +0800 Subject: [PATCH 10/10] of: Simplify API of_find_node_with_property() implementation Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241206-of_core_fix-v1-10-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: -03kjP29dKbBOXPMmppkSPOOwTG3W9wv X-Proofpoint-ORIG-GUID: -03kjP29dKbBOXPMmppkSPOOwTG3W9wv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=965 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Simplify of_find_node_with_property() implementation by __of_find_property(). Signed-off-by: Zijun Hu --- drivers/of/base.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 33abb6227468c03fd191201aa2bbe05a41fdd9f4..5fc061b66116d106c398f04a1d9d235f09741de7 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1026,19 +1026,15 @@ struct device_node *of_find_node_with_property(struct device_node *from, const char *prop_name) { struct device_node *np; - const struct property *pp; unsigned long flags; raw_spin_lock_irqsave(&devtree_lock, flags); for_each_of_allnodes_from(from, np) { - for (pp = np->properties; pp; pp = pp->next) { - if (of_prop_cmp(pp->name, prop_name) == 0) { - of_node_get(np); - goto out; - } + if (__of_find_property(np, prop_name, NULL)) { + of_node_get(np); + break; } } -out: of_node_put(from); raw_spin_unlock_irqrestore(&devtree_lock, flags); return np;