Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3831027rwb; Sun, 9 Oct 2022 11:54:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gTBOYc7CXtcYXp0dmj51bDNYNfD1lyPBvQ3qKK8IvEfHTO4f7ocssjprcbVS8qOZrxM7w X-Received: by 2002:a17:90b:380e:b0:203:cc25:4ebe with SMTP id mq14-20020a17090b380e00b00203cc254ebemr27708381pjb.212.1665341660574; Sun, 09 Oct 2022 11:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665341660; cv=none; d=google.com; s=arc-20160816; b=fJw+l+jEIm3gFWHN2q/xHT/onjiVgca6h7Y+OC5FqFAGycGS9Pe00QaJSL6hNowWtc HTJdvwHLKWDX9Qz0EPPT6zan8YIcTdX5/Hf5WRVGh4KrVjrIEK53nO2LwQ73/RCE3KS2 +RCwF6xZJOsTloBs1YNVT/zraKnxdI4ygAIJOOiuNywHFudRtIaVA8N5d8N+BVpWmGs9 prpTt1hhS4LuIQtNQvRGsZoC3ji13oQwKGBUX4imLn8XQdapPomBbGU3J67tQ+9HgUe+ RjuSZ8vilTSESUh7PWU1Ql+wE2gJqn2zEBgtUPMm86KKqLBuS85cc/uvRQ6pI1bRv8FF UbAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RTru/+zHUy+WqF+g/TYzAl2BWFy+qemE7Z1icvNI0tY=; b=ZDRz375X0UnfqcDqugP2M2Tj0ADzi9El0NU1gxA2mX1V1HllmLCyhHZBQrNVPn9N2I +CjgWtT8nEGXbE6Tn3zTJQp/37YCDnf8eteeE+z5Tb8FyjGULF1ZpVc8VrGa9Abob+9h VsbKU/PsQy8lhto28qx1ZASCljSvKmi1lwZDAja3zMXVfKouhLK1l+bYqqnHVAK/e1y9 uRRX/eGjGX1uR81G6RJ2I8vzdDPGbYFsqpLaAJ69LOX4QO0E08zTQb+TY2aVOPrGacW1 XGR8DkE56ewEKPA0T8+Tf+4c9UOlQpvzIr0Ci1lJGtMcbNgWkL1T1bPYLumg7sNV+nMP Q1YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wmcW+bWG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h184-20020a6253c1000000b00562512ae9easi8463072pfb.159.2022.10.09.11.54.09; Sun, 09 Oct 2022 11:54:20 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wmcW+bWG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbiJISZ2 (ORCPT + 99 others); Sun, 9 Oct 2022 14:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbiJISZY (ORCPT ); Sun, 9 Oct 2022 14:25:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 721331AF04 for ; Sun, 9 Oct 2022 11:25:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0D4A760C48 for ; Sun, 9 Oct 2022 18:25:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00F0BC433C1; Sun, 9 Oct 2022 18:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665339922; bh=44P2OdzGEAkcFTDiVXHU8vL2N2Ja+R4/GPK9EB4aAZo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wmcW+bWGnqPrsuKw6aLReO474F90QEDF96Rmp4RSbqp/p97lXU7mHUSutb+Dpvx9P Og1RUPOhIfd8SAty/Xm/rtSGr9w8z4wN7+ZR+0YeOE35azQ4rPxdOT1cLaLK5aIO3Z C9geqGi/+qDzruq+okTh2BPfZSzKNsXieHRRHhjc= Date: Sun, 9 Oct 2022 20:26:05 +0200 From: Greg Kroah-Hartman To: Soha Jin Cc: "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] device property: add fwnode_is_compatible() for compatible match Message-ID: References: <20221009162155.1318-1-soha@lohu.info> <20221009162155.1318-4-soha@lohu.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221009162155.1318-4-soha@lohu.info> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Mon, Oct 10, 2022 at 12:21:55AM +0800, Soha Jin wrote: > 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; Who would mistype "compatible" in a case insensitive way? Why can't you fix the firmware to be correct instead of forcing the operating system to fix it for them? thanks, greg k-h