From patchwork Thu Dec 14 10:31:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 178632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8445490dys; Thu, 14 Dec 2023 02:32:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpEuYK3t5qDwGwNpd97dq9rpKVOViHF7irvEdUC79X63PXG7h9i1BaDDcVVQNZ3lmTKKcw X-Received: by 2002:a9d:7758:0:b0:6d9:dd14:3a75 with SMTP id t24-20020a9d7758000000b006d9dd143a75mr9387075otl.70.1702549938962; Thu, 14 Dec 2023 02:32:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702549938; cv=none; d=google.com; s=arc-20160816; b=mQyKribYSXGjZQtutyGsqMcmuyUrWa2rNVUPuV9QF6c2LtgmlpcRyls4sfe6nKinYF hBsC5BtFjGxstsO0gtuRnu8kc2iY+UgIzCM+TWSW6mL1nSeGRZFjWI2nAT76OwbK3maR CAJIK+Vk4VepB8Z+mpr/ZjMZVYJIN7JtfwceDqS6TiODgYxau0o90bov/fUWyubNtWXj adSuZqB6XM4Pwc4CH3xNy7Nxl5kCjBS9t784jTRS/HPz012+ogVHt90GRt/kgUb8HqYM eFeQ8mGpZSTsBBpwdIE1t+WZWm+s5kqhqTf8O5LgJmihSRb7eqI7GPAB0L9SFzRAtrmW wegA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RoCUu1mXewEDtm43Qq0pBWgiYLguorwyr3zE9+lEq2w=; fh=6z+ElFTra147heHAzZZJ57t98ehK0pbxyWNV5p0IBGo=; b=p/yg+1PnXOLMkCwyACy5KZsg8JwrW4f/vxsN6VqepqAI+1hZk3CiXXRSMmdyLmHDlz 9I/cd8OQjfQ8YNItZdtfOCtCdLtMRvYPD56EDDuoKwdp2tjwCtsl3rjp+lkzfdWdMEDO 8LzV9xg3hOXFySX2jkSzCBeTnvgZZeAsD+UeL183i9DRmn9uuqgHvUQTU+UDl863bS+j GT0pEvRCIxYXccNtoF+UV7s+93Jufx+0fol5oVGL6Ssu8d3tczx7CJaFFlQ4eBV52Ejz rBVZBJhpcUjLFe6DDIn0seuIEuSKyOmrt6Tg8d5+TYScftLbg2Ybtg9zlg/EsFCsXWBM hYaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=TCEU2AUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 17-20020a631651000000b005c668a5a90esi10586746pgw.596.2023.12.14.02.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 02:32:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=TCEU2AUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3C3038313D24; Thu, 14 Dec 2023 02:32:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443652AbjLNKcF (ORCPT + 99 others); Thu, 14 Dec 2023 05:32:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443630AbjLNKcE (ORCPT ); Thu, 14 Dec 2023 05:32:04 -0500 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8138A11A for ; Thu, 14 Dec 2023 02:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1702549926; bh=RoCUu1mXewEDtm43Qq0pBWgiYLguorwyr3zE9+lEq2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCEU2AUr0ZA04uTWvKS/i3ZVnJa0VyDib+4PiyGCQg7iYXZ0YGOJGDur97P5pyzAJ ZDtG+cH7Qm4T+X/9B8J01Tj1odsNEBX7Zv7jVYv2UGg/igHIajr64YmluEtiDAktbJ FYNzi99K+px1npcA6NnqaXreto/JcbyQnFH3ZgWLhJhkphXGPb0d8FRzCMmA5OYoTE mi2ltw6Peioc0GwLpqNoOvumthQnpVxfsByUQS6ELu2c/csI87q8kODmX4phBHrPBG geRxOfCFC/OBotVhANnyzFeit42L1QHw+6Blf+5bqiU+1uuONyJ2OrSuNgPt6FhPFz cMuyAa7oMqijg== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4SrTDk1lzGz4xPQ; Thu, 14 Dec 2023 21:32:06 +1100 (AEDT) From: Michael Ellerman To: Cc: , , Subject: [PATCH v2 2/5] of: Change of_machine_is_compatible() to return bool Date: Thu, 14 Dec 2023 21:31:49 +1100 Message-ID: <20231214103152.12269-2-mpe@ellerman.id.au> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231214103152.12269-1-mpe@ellerman.id.au> References: <20231214103152.12269-1-mpe@ellerman.id.au> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Dec 2023 02:32:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785253004596408167 X-GMAIL-MSGID: 1785253004596408167 of_machine_is_compatible() currently returns a positive integer if it finds a match. However none of the callers ever check the value, they all treat it as a true/false. So change of_machine_is_compatible() to return bool, which will allow the implementation to be changed in a subsequent patch. Suggested-by: Rob Herring Signed-off-by: Michael Ellerman --- drivers/of/base.c | 5 ++--- include/linux/of.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) v2: New. diff --git a/drivers/of/base.c b/drivers/of/base.c index 9020be2eb4d5..c82c8b77badc 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -419,10 +419,9 @@ bool of_machine_compatible_match(const char *const *compats) * of_machine_is_compatible - Test root of device tree for a given compatible value * @compat: compatible string to look for in root node's compatible property. * - * Return: A positive integer if the root node has the given value in its - * compatible property. + * Return: true if the root node has the given value in its compatible property. */ -int of_machine_is_compatible(const char *compat) +bool of_machine_is_compatible(const char *compat) { struct device_node *root; int rc = 0; diff --git a/include/linux/of.h b/include/linux/of.h index e3418babc203..c5c663a7fb77 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -402,7 +402,7 @@ extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); extern int of_alias_get_id(struct device_node *np, const char *stem); extern int of_alias_get_highest_id(const char *stem); -extern int of_machine_is_compatible(const char *compat); +extern bool of_machine_is_compatible(const char *compat); bool of_machine_compatible_match(const char *const *compats); extern int of_add_property(struct device_node *np, struct property *prop);