Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3705120rwb; Sun, 9 Oct 2022 09:33:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OTBDHeXBFIW9kV5n2BAWc59CWxx/PCeJKmmoewTdrVRQBsM3kVaRe4CWsSxvGe3Zo/jmm X-Received: by 2002:a17:906:dac8:b0:741:545b:796a with SMTP id xi8-20020a170906dac800b00741545b796amr11522380ejb.240.1665333203034; Sun, 09 Oct 2022 09:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665333203; cv=none; d=google.com; s=arc-20160816; b=UfSgbK281TtqQa0cYCg27AinSHc2kIPObXQlQnWcOWdgJmms0BmbhVBQQ70zY06D1P tu7/8dNHtfpAQAdd8dqe/UY+XXqV+IVy7MuhDsxhv73RLxGG4HOpf9HSsmmPOdPjLYWX WHrS/BP8p/JHML3RyUwmfWLDRC3j4yyABEi7v9pE/2e3iJU3V17YPbLxmA1Vpb+3OENn ZMjE8YZgryC5k8lFE8prvBUaSCAh99illR0Bam9t0y6+Q5VTJwz2Te87UW6jEMPMPaQi 9U3kfqyimTQYwv2DAcHvm9pCeURWrtBs3JHSH/E0aDZ6rfF6f13UdwcAB//m1oEPI9HX 1A6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=JjDbh2DZdozyiAUBiYbkof3vhOjRW4ySeVxtn4XwKyc=; b=0GojbgOL6Wt1BOFcmmApyb28gQPTdsBiNGO3S6LlUoTU9JQnXQS8QuICFRItTLT2SS ZO+t7hFjqrG+DjqDUFMAm88iXvE41gDSpf9snRpH4Y2/k3pCbGiB7aSuZKggbmAJJSbS Hzg6CIZZdSndYqN/h4/L8oVt/Qyvu85MQ4zCn1W2vr/+rXfKrYoArpuV2OlMmW09r1G3 +IgNNsHfODhrm5Lg9YSJFR7gCn+C3Jqy1RrCqRfXudqjHz42gakjF+lwgAfimI7Syd9x psAeZ5bBTnTdrHGSL15VkDnuhpWpmAnaNX8GaCzsmMVw26hG5qbzW20ZQNapegIF4v9m yhGQ== 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=fail (p=NONE sp=NONE dis=NONE) header.from=lohu.info Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a056402090900b00454412dc7absi9520537edz.259.2022.10.09.09.32.54; Sun, 09 Oct 2022 09:33:23 -0700 (PDT) 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=fail (p=NONE sp=NONE dis=NONE) header.from=lohu.info Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbiJIQXA (ORCPT + 99 others); Sun, 9 Oct 2022 12:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbiJIQWs (ORCPT ); Sun, 9 Oct 2022 12:22:48 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4CB92B19D for ; Sun, 9 Oct 2022 09:22:45 -0700 (PDT) X-QQ-mid: bizesmtp63t1665332553tg3dgxz5 Received: from localhost.localdomain ( [58.247.70.42]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 10 Oct 2022 00:22:32 +0800 (CST) X-QQ-SSF: 01100000002000G0Z000B00A0000000 X-QQ-FEAT: xqT8U4SkSphFgcFPh5JRStQ/GKaIUXNKUgQ68cyZGIRbaqdoULKWb5GOFKtg3 cIxNITCqwXcs2VsfBb/8vGApOIm4U/q4iBSp4mnq580tWgEyhuNcM467J2T2LbqZIGr2LDd r8gOhflJ9f5AWNhMgGTlC+Vsvht1MO5wG/fdSV9ZPLt8DxrrRBLCPZVPoz2MvhuNCjLM7ub SU3BswYGhbXsOkGIe28jEHuduxNT1hd8xCuFaD3TYmGN0yjj7y8JjxPxkQrnE/zdXV45b7v iSugb/5UZ1tITubb34afvTMkCYAy7Aejtd3s9MBxgyjbQxFeN5vL2mkUFhvmm6CNXOKnq24 M3kLYO9wu89Vq6zgnk/39flVPvR2IW9mxUZaCWG6wqRPUdfKnmpcco43mrsfA== X-QQ-GoodBg: 0 From: Soha Jin To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , linux-kernel@vger.kernel.org, Soha Jin Subject: [PATCH 3/3] device property: add fwnode_is_compatible() for compatible match Date: Mon, 10 Oct 2022 00:21:55 +0800 Message-Id: <20221009162155.1318-4-soha@lohu.info> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221009162155.1318-1-soha@lohu.info> References: <20221009162155.1318-1-soha@lohu.info> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:lohu.info:qybglogicsvr:qybglogicsvr3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 fwnode_is_compatible is a shortcut to check if a device is compatible with a compat string in fwnode property "compatible". This function is similar to of_device_is_compatible. Signed-off-by: Soha Jin --- include/linux/property.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/property.h b/include/linux/property.h index dbe747f3e3be..776e4a8bc379 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -252,6 +252,13 @@ fwnode_property_string_array_count(const struct fwnode_handle *fwnode, return fwnode_property_read_string_array(fwnode, propname, NULL, 0); } +static inline bool fwnode_is_compatible(const struct fwnode_handle *fwnode, + const char *compat) +{ + return fwnode_property_match_string_nocase(fwnode, "compatible", + compat) >= 0; +} + struct software_node; /** -- 2.30.2