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 X-Patchwork-Id: 57750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp448974wrn; Wed, 15 Feb 2023 14:22:00 -0800 (PST) X-Google-Smtp-Source: AK7set+MIHgPZJn70qkoNf6wCl4rFLDOA0Khz+oG2Tf9y0lWiLw7Nf7MaCMEQ1QOct4/Yv18laoW X-Received: by 2002:a17:903:3013:b0:19a:9831:c8d4 with SMTP id o19-20020a170903301300b0019a9831c8d4mr3076496pla.65.1676499719983; Wed, 15 Feb 2023 14:21:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676499719; cv=none; d=google.com; s=arc-20160816; b=c8iYH1xzA1TSY3cfNDnqXG6/v5uy/HnoR41NW6hydPlPvmwA4kMm08KVR+9nE1Bbwg xuYjaQeeLKlYl895RjviXId1Sx2AfhjELYGRh/WYaeCSoZM0r8qkRVR55VKvptB53Q3/ 9m0Gb4Cdc2oGRis4A1JRdhqnuCIOH/xhITaKx5GRiI6RgfIvVRBQEL2GJ4nPJO5dyDmG 1ZNYdtFxzIF39sfFlfoAMZUtajUiiL/2Vb0P4jGnb46SlXtaSzpY7ybjYac00pgVwVAR yfVydU/iKW6tpzCqF4SXdRKI8eiP0Ye/5XWk+mCKHZZN/bbBEz+iyUbnAdG9cxNfUUnc dthg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+qxOnZbyyMD2X855f4MGJc4sepk9aV6FO9PjuZ5202w=; b=uElzE5Z+PcTuPT0xX0BrJZHtbPJjIVgB8x8qcm8B97KHbn2QVrQbGXi79MsAKf4pbt bCpJFDBsapwhcTb1dHMvFwb+wc1VGJ4ZOBK55sKpCgUXZLW5H2QdtrBeRN899ROxl3Fr VEi7zHu0SrR/Hfrd9g37iJWWlWlY/+Zc1GU8NJQ4zK685bhANa4podLTqpk7al6UYyco IR1ONVrBzPcCe34pKRAeuHOS2c0ESk1oL4aSjusohoDZ2sV/fZgpc5wcJd3rwX/Kj0DU Sr1ldjiKLioBjmUV3sclVErputHpzI0rAs7Pr91NYWPPOYzmc49H6YHT5bBckABFfIUP 7RZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a170903019000b001930ab4c4fesi7401895plg.165.2023.02.15.14.20.24; Wed, 15 Feb 2023 14:21:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjBOVzx (ORCPT + 99 others); Wed, 15 Feb 2023 16:55:53 -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-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 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757937370233331851?= X-GMAIL-MSGID: =?utf-8?q?1757937370233331851?= 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 */