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 ED663C4332F for ; Wed, 5 Oct 2022 14:39:27 +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: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:In-Reply-To:References: List-Owner; bh=0hUwIKXf8OQCyd9yLeRZxtW1H/amPUY92bxRcf9OTlc=; b=fj9Bs54Olt8jEq bOyo/7ALA9k75Gk1BQdGbR2Ab6u0fHVyENafBpSGtsDqf0a3uxIOGt+5ZM4yfJth65zWR4OAg/lSC SENXONSqdg1ADTWVj3yoKZXhGSvE/kH+rmQUh1141aKiy7LdT3gr8467NzoBhYLiPFnn9/5ym1QXZ /AJRDz36S/l6xgCFS13LqJCI/KC0leFohInMCpbmkRqzCVQiT8Pcnue9s08RmbDwjXt8+H3JGSxe3 yaJJn8SwPRX8YscJHCk2vBoR5Z9wpZ82/96GpbDFBV8s6KUoGJTz6gDHGYIfCc/7FpQIgF83UrPYy JxKitjEvAyriZe1ppp5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og5XC-00EYsS-LK; Wed, 05 Oct 2022 14:38:06 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og5X9-00EYe0-NV for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 14:38:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664980683; x=1696516683; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2SPqUsjF5qBIF1pomEqZowlFagnMO4IU7LXTD0kTMtM=; b=mwnI8yrw9by7kF/SfB8oINzuqK1wF/PwLopYiN4o8Dq8E5DFlafMpwO0 X5M0jNymnno8I2natxqNGbKYrhtDAALeI7wowV0PlH+ROm9bq+ISAB2W5 JAfiPENIBjsrIdh+M04rW8A3VKnKeMhp1VOL0w2DplJkpbGf/gqDta2rU EisXnrVSrRfTCS/7v6klRy5OpbIECMje4+l1sOUfUvwf2L+DiTssKsjs6 77Hj02wOCBy8dbz4p6rri4U2ezOozhN0173vnySzhwpS8wFY5/R1ZeuIh jd15KZd8t6EAl2h5ZizQuymr+TKLyHvHhd0yBxEZuFJovRQvpVshx0N4t g==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="286388017" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="286388017" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 07:38:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="869420640" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="869420640" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 05 Oct 2022 07:37:57 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 585C0155; Wed, 5 Oct 2022 17:38:17 +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 v1 1/2] device property: Introduce fwnode_device_is_compatible() helper Date: Wed, 5 Oct 2022 17:38:11 +0300 Message-Id: <20221005143812.33503-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_073803_828978_9AB2510F X-CRM114-Status: UNSURE ( 8.81 ) 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/property.h b/include/linux/property.h index 1c26d263d5e4..4948a890b153 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -56,6 +56,11 @@ 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_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) +{ + return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; +} + bool fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname); int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel