From patchwork Wed Feb 15 21:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 653795 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DCACC636D4 for ; Wed, 15 Feb 2023 21:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjBOVzw (ORCPT ); Wed, 15 Feb 2023 16:55:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbjBOVzv (ORCPT ); Wed, 15 Feb 2023 16:55:51 -0500 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5317F252B2; Wed, 15 Feb 2023 13:55:51 -0800 (PST) Received: by mail-ot1-f54.google.com with SMTP id y11-20020a05683009cb00b0068dbf908574so66882ott.8; Wed, 15 Feb 2023 13:55:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+qxOnZbyyMD2X855f4MGJc4sepk9aV6FO9PjuZ5202w=; b=noJgcpDjdEwaUs2o39mjJl2m8bKArqmP7pbpfOBuqBlyCYNy1UbDnZcmT3w8m9oK/f Dtv3+q+aH+CGjZ1LerKXepyyDxW4ficEH+5E6xjX6CdWZtROBlcYfb/Wopj0LwghlEPq NlfmKmthfd5PtzoGngpRU3iFj8bjHsehZVx0y7yn0aJ9F0/2esljzHBEcDPjm7WZA6vM 73rQrsSKL+E4J7epbiQsbtdgsjoaqr74w+6MDna+iZjMXRWKHT3YlfzPLgLRMYXAKehP 2mu9zzdwjxXH/0mAj2lU/c4ofgBqtHGZ7InT+EB3h/Ko59buUSdkWUjCKXuhmlnw7DFn DGbA== X-Gm-Message-State: AO0yUKUP0Pf6c1U/PzHjs2PbtM7i/GmEK1i+htL2J3yWUsPVD2DT6yP0 vLwjPq0j2evP/1ZviZNax3SjmYBryA== X-Google-Smtp-Source: AK7set9St7sz9CLuIGJpDcK362y0DUfwewQJgY+ksCsjouAS1e6sjFww30S46EbvzZtcTm87C6k/Wg== X-Received: by 2002:a05:6830:1d45:b0:68b:ddb1:89a2 with SMTP id p5-20020a0568301d4500b0068bddb189a2mr1758446oth.32.1676498150585; Wed, 15 Feb 2023 13:55:50 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id l18-20020a05683004b200b0068d59d15a93sm8167500otd.40.2023.02.15.13.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 13:55:50 -0800 (PST) Received: (nullmailer pid 691641 invoked by uid 1000); Wed, 15 Feb 2023 21:55:49 -0000 From: Rob Herring To: Frank Rowand Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] of: Add of_property_present() helper Date: Wed, 15 Feb 2023 15:55:46 -0600 Message-Id: <20230215215547.691573-1-robh@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add an of_property_present() function similar to fwnode_property_present(). of_property_read_bool() could be used directly, but it is cleaner to not use it on non-boolean properties. Signed-off-by: Rob Herring Reviewed-by: Frank Rowand Tested-by: Frank Rowand --- I plan to add this for v6.3 and send most of the conversion patches in the next cycle. --- include/linux/of.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index 8b9f94386dc3..b3e04021186f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1537,6 +1537,11 @@ static inline bool of_device_is_system_power_controller(const struct device_node return of_property_read_bool(np, "system-power-controller"); } +static inline bool of_property_present(const struct device_node *np, const char *propname) +{ + return of_property_read_bool(np, propname); +} + /* * Overlay support */ From patchwork Wed Feb 15 21:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 654636 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8DCFC636CC for ; Wed, 15 Feb 2023 21:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjBOVzx (ORCPT ); Wed, 15 Feb 2023 16:55:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229865AbjBOVzx (ORCPT ); Wed, 15 Feb 2023 16:55:53 -0500 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58020252B2; Wed, 15 Feb 2023 13:55:52 -0800 (PST) Received: by mail-oi1-f174.google.com with SMTP id c15so17144699oic.8; Wed, 15 Feb 2023 13:55:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ex8q2zDUDeHEdh9muzAk4Jw77fIktw5FRuus10AheOk=; b=Or9QCws6+84T67Itj41A+YueCjA2NCy/F0Zf/G0XCAt8ddqZQPpHkiqieNMXnxUy8n YipAFldY1Il6r2ZFtFpvEtDJgw+jMfYWvMxGvgQoaHQ4oL1yxFoqTtRZ/0hZ3scyRG/B 4LSVrBhE2yCEdvkUkHBjeR3LMdzpxiR1dVOm6aXsYnTIMFVbxk4Nf+cBr9oRZ3HoNEsA DlCAvSQmuEzguyeZnDNItLClAD+o7oLPiCNL+NLWgREhhKbbjyebVXFF2toWAVGEj3N7 J/qK8g9XIrRWwox32tz0iuvjiteMgESLwcinBq6B7AwcHDDHH3YQ78YihfLLcU5x2sfM CRfA== X-Gm-Message-State: AO0yUKWwT0gm04KVI2ISJIePqGWl5bLkKRN/79WkNJdBxfbswcAuLPxA pxfovvPd3r91q2s6avmnpbS5GQjFVw== X-Google-Smtp-Source: AK7set8QEGb5Omu11b1kK2zldOn2Cwel+sPXJ54m7NTANSoNlGVwmnR845tkxxROFaoxx4TJ7xVENQ== X-Received: by 2002:a05:6808:6c8:b0:378:c02:bd51 with SMTP id m8-20020a05680806c800b003780c02bd51mr1645069oih.33.1676498151530; Wed, 15 Feb 2023 13:55:51 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id m128-20020acabc86000000b0037880fdb1f6sm7747510oif.24.2023.02.15.13.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 13:55:51 -0800 (PST) Received: (nullmailer pid 691658 invoked by uid 1000); Wed, 15 Feb 2023 21:55:50 -0000 From: Rob Herring To: Frank Rowand Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] of: Use of_property_present() helper Date: Wed, 15 Feb 2023 15:55:47 -0600 Message-Id: <20230215215547.691573-2-robh@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215215547.691573-1-robh@kernel.org> References: <20230215215547.691573-1-robh@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use of_property_present() instead of of_get_property/of_find_property() in places where we just need to test presence of a property. Signed-off-by: Rob Herring --- drivers/of/platform.c | 2 +- drivers/of/property.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b3878a98d27f..284379e67649 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -529,7 +529,7 @@ static int __init of_platform_default_populate_init(void) int ret; /* Check if we have a MacOS display without a node spec */ - if (of_get_property(of_chosen, "linux,bootx-noscreen", NULL)) { + if (of_property_present(of_chosen, "linux,bootx-noscreen")) { /* * The old code tried to work out which node was the MacOS * display based on the address. I'm dropping that since the diff --git a/drivers/of/property.c b/drivers/of/property.c index 134cfc980b70..ff71d2ac26cb 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1086,7 +1086,7 @@ static struct device_node *of_get_compat_node(struct device_node *np) np = NULL; } - if (of_find_property(np, "compatible", NULL)) + if (of_property_present(np, "compatible")) break; np = of_get_next_parent(np);