From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE781C4332F for ; Wed, 5 Oct 2022 15:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d3UTXxvfPl0WJvudsfAOwePjMJWMrJnll6oZuNe4csc=; b=PC9PayxurjG2vw AXy2t6WSRq4MOYsxS0Nv4FYygVuI33hBLXyJTkmYp/QYuGWrlFUIwuZfEX88MZarkfIwwAYijq0+Q fTJgpA8bzvhhFFysWLyDusCaRzWzlKvzlMLM74L3F9085bAzcuSOg2i1MpgeUPvOdNdgqdjvHfwQj 69hcMlO4adyNv4p/T0d2/qj+r9nxpcXH0vUsSBwXfykr8GpX7jLi4K6HH8iGb4dHBQQazxme6Zjn4 SqN3uJUrQ/dH8y+73nFUE8r0qXHc8pSqdtsa+LZxK21DfUm6xFsCw18mi7lK3SPybBisPSR1nsiNJ bj2BdCNU35U63eDpt1BA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og6LK-00ErkW-3q; Wed, 05 Oct 2022 15:29:54 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og6L6-00Ergr-2w for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:29:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664983780; x=1696519780; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kjLtd57mMK+EVcgFbt6pO20kW/y/VllWb3uvAku8dxQ=; b=RZHCxbNYzVfq3fvNxYoTyChp94cNg4tr3DSAMRQ13k0h2QEEVm2WTo3I lVqwcaybKh9eGUZ/rVJk3Gu7mtCUGunthQTKqj1MzhqYWoSury0Uo12Zr m2EtLo14z34j+iISKFsrVr+jpbr4+pZ5HxfJwZ9kHZ9H/7Y5/FBi5u2kX ZAepGqyBU8dQsQ+mnAp9M+yJTwrH1afdkvppCUp+/31FIFkqZgCNp0T7L sgfecN8pEKLK+81CgE6MZ8JZWZKrLwlpFn5y/iXTJhoyYWQAcFV4ZnVC4 cnRD9SlOKgtJYUXN6M5N/e8qjCawXuVA1SHOGeY6pwJOREOfzcm7Mfjjy g==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="282901777" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="282901777" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 08:29:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="626609384" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="626609384" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 05 Oct 2022 08:29:31 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0E7E97C; Wed, 5 Oct 2022 18:29:51 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Qiang Zhao , Li Yang , Daniel Scally , Heikki Krogerus , Sakari Ailus Subject: [PATCH v2 1/2] device property: Introduce fwnode_device_is_compatible() helper Date: Wed, 5 Oct 2022 18:29:46 +0300 Message-Id: <20221005152947.71696-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221005152947.71696-1-andriy.shevchenko@linux.intel.com> References: <20221005152947.71696-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_082940_161858_E0CF52F6 X-CRM114-Status: UNSURE ( 8.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The fwnode_device_is_compatible() helper searches for the given string in the "compatible" string array property and, if found, returns true. Signed-off-by: Andy Shevchenko --- include/linux/property.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/property.h b/include/linux/property.h index 1c26d263d5e4..701570423943 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -55,7 +55,6 @@ int device_property_read_string(struct device *dev, const char *propname, int device_property_match_string(struct device *dev, const char *propname, const char *string); -bool fwnode_device_is_available(const struct fwnode_handle *fwnode); bool fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname); int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, @@ -77,6 +76,15 @@ int fwnode_property_read_string(const struct fwnode_handle *fwnode, const char *propname, const char **val); int fwnode_property_match_string(const struct fwnode_handle *fwnode, const char *propname, const char *string); + +bool fwnode_device_is_available(const struct fwnode_handle *fwnode); + +static inline +bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) +{ + return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; +} + int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, const char *prop, const char *nargs_prop, unsigned int nargs, unsigned int index, -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel