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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C16CC433F5 for ; Wed, 5 Oct 2022 14:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbiJEOiD (ORCPT ); Wed, 5 Oct 2022 10:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbiJEOiB (ORCPT ); Wed, 5 Oct 2022 10:38:01 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D6984F182; Wed, 5 Oct 2022 07:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664980680; x=1696516680; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2SPqUsjF5qBIF1pomEqZowlFagnMO4IU7LXTD0kTMtM=; b=HLGXsYxK+NvkObZb2TBHzQd9uyCFUFh075dM+Q4DZaZGq/0T0XsquJqK 8cEu7sbyOcZn8HtutUUO0353BaQo6qi8c69A184XQL5l/I3/mZQLUh0pd WNwgHE8bF0pc1dN68XhvdUFiZU80MDAuFUaB3xlii6h+H9T/mmtCZwJuW G8bktIooqp31ozFNzAadNgMjSfFb2qCNQXbZ25YofIVLOyRBepzAk+GHD 2+1ZoE1xbm+QlgaFZwaD97BtjUYqoZJJ0b7Uwx+lW3Pzu9uiZWVzlJraZ Ur5Y9dtA6rf35kQMJrQGWHtjUitYaKQ/NpPuUStgi9Liurkpprs+Emd03 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="282889703" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="282889703" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 C107BC433F5 for ; Wed, 5 Oct 2022 14:39:59 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MjHKV1j50z3dr0 for ; Thu, 6 Oct 2022 01:39:58 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=dqJZRu+7; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.intel.com (client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=andriy.shevchenko@linux.intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=dqJZRu+7; dkim-atps=neutral Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MjHHQ5Htzz3bj8 for ; Thu, 6 Oct 2022 01:38:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664980690; x=1696516690; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2SPqUsjF5qBIF1pomEqZowlFagnMO4IU7LXTD0kTMtM=; b=dqJZRu+7BrxnRtR5aASmcCbGOgEHGUDavbEJJ8Z9FBoPO+PC7+QRk41N B3AIiBPCOdEB4MieOse8b+zkD/QsrHAavYhBb8LVOnUPg4Hqs5fkXQvo/ b/uBtgZD+gruY4XC6W3iuVB5a6fBw03yhhgaQ40BdHsjpCzIqp4f09XZ2 +pSlt+qVqe9Yk97zEL+57mMzsCMhksGoCssJIU9wwBdrmepUswcT7zdzv 1cZRUu6gEMePLce/NZacYNC0syyNfEz1KFk5wWTxQ07sbQXieE7UZHt0J DMTKSTgeIMOLOuRtbzEKaM0p7925K+qXbEpD4PO8r8uJPHjN258Bjd3c9 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="389465421" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="389465421" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.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 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 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Scally , Li Yang , Sakari Ailus , Heikki Krogerus , Qiang Zhao Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 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