Message ID | 20230609152507.77649-3-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1030432vqr; Fri, 9 Jun 2023 08:38:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ75fG6d9Ryj83dx79CVi2BjWEPylPC6lbu4R2h5XtYC7177+56nKqjpleZb+5JFJZ4OYQ1H X-Received: by 2002:a17:90b:3750:b0:255:a7ed:94a1 with SMTP id ne16-20020a17090b375000b00255a7ed94a1mr1188608pjb.41.1686325112224; Fri, 09 Jun 2023 08:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686325112; cv=none; d=google.com; s=arc-20160816; b=gjVx83K8CeqCA09A0w/XjlvoL/vjI8couCeLNrfGrpqHMN557HFUTjU1bTASH2Or1L Ples2KxQ4z4XzVW57xgeCmLr2jK4ZV4SnadcDeUYyeNlEZTjHrzCPXPqZFrGs6aN2K+N yaS99KrHoktBnLDI860xjxak150IwOF8MEUtj/0QlRLXgB/QIFQU6mKh6IXUufMwmZKS mfbt1oVJV3yODLI2F73A2tg2+gzjJQTqmhc8HuvNoQ7vJoKAwlwJGnQ9U3x9VsTseWnb JxibWWpJ8qudqVN8J27cQ4F79AnTXNS5QJcT1cyidoacJPopSERellFUAbyVhqGhfsXs HIBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GvKXdmTg0iXM9yiu5aIqHmZfjG6Y4INLBNEr6rQekUY=; b=eH17mv7W0E17mKd4T1fDOVHaNbdtzCxskU3cmcwuaCyIm+WADhB+KcZysSie8AuP6E vwYfelD4qrbNIwudPbQlqBa/nNC/X/Yx8sw4jN108gqdvNLy0pW3Dk89g7vJ1Y3/2b/r lxoXUqAFuYeF4wCSLz55Wf2F4ym1DeKqC8JMNpJKSofUsMm5Vb81HzvEjSKMveqT60cA XSDK3zN+KHT3y4RZgggCWS1Cs3vFFIZk6GEOBelveLhfaKYU7FWE+lm6DQDNpnI15fRT n0Lmfd7IuYZtkz8vteKd4IgOcMtV+Qf6OQwokABUyegbyHTexF5WvsvMi6MXY8i4KCAn OfrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I+FqyP3f; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na4-20020a17090b4c0400b00246a5991cc6si2904205pjb.162.2023.06.09.08.38.20; Fri, 09 Jun 2023 08:38:32 -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=@intel.com header.s=Intel header.b=I+FqyP3f; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241036AbjFIPZ0 (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Fri, 9 Jun 2023 11:25:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241524AbjFIPZO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 9 Jun 2023 11:25:14 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAA7235BE; Fri, 9 Jun 2023 08:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686324312; x=1717860312; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zHjAgdVUBB0uVbkIgjmznv/ebWgxcQFRvgnhOx3Y82k=; b=I+FqyP3fmtGL4UXWxvjPPrf9JOsNIpmpUW9m1LAw6sEfXXeA8ozKYWoZ JdIHBK0hk/rUEpEr+ARuCSGYVrF3wkIqVio6sdTnnyzq1W9/w487hFQbq tdFdiV4ni06do0qWWXo1s3y+5/Qs0ag+wY/IQgdvg3S+t7hjmimLxy52j 1i/LT1IgLiHvDDGnasWAJbg29t7pXryHqEbmdGTvLTyKCQanIl0hrdDkq HGGxtVO2j9q6HHwJSqvagur/UXJv1xS1tVFf2J4l3VaY8pyYVhcerU/QI 9Bp3GnDqo9AOr2aZBxBZ22TuNZ6uWVTsCsiJ6YJqTpo/4+s8OE1GJX5ne w==; X-IronPort-AV: E=McAfee;i="6600,9927,10736"; a="357623195" X-IronPort-AV: E=Sophos;i="6.00,229,1681196400"; d="scan'208";a="357623195" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 08:25:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10736"; a="775532602" X-IronPort-AV: E=Sophos;i="6.00,229,1681196400"; d="scan'208";a="775532602" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 09 Jun 2023 08:25:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7760E56D; Fri, 9 Jun 2023 18:25:14 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Damien Le Moal <dlemoal@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Hans de Goede <hdegoede@redhat.com>, Jens Axboe <axboe@kernel.dk>, "Rafael J. Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Daniel Scally <djrscally@gmail.com>, Heikki Krogerus <heikki.krogerus@linux.intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com> Subject: [PATCH v1 2/3] device property: Implement device_is_compatible() Date: Fri, 9 Jun 2023 18:25:06 +0300 Message-Id: <20230609152507.77649-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230609152507.77649-1-andriy.shevchenko@linux.intel.com> References: <20230609152507.77649-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768240040560762403?= X-GMAIL-MSGID: =?utf-8?q?1768240040560762403?= |
Series |
device property: Introduce device_is_compatible()
|
|
Commit Message
Andy Shevchenko
June 9, 2023, 3:25 p.m. UTC
Some users want to use the struct device pointer to see if
the device is compatible. Provide inline helpers for them.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/property.h | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Fri, Jun 09, 2023 at 06:25:06PM +0300, Andy Shevchenko wrote: > Some users want to use the struct device pointer to see if > the device is compatible. Provide inline helpers for them. What do you mean by "compatible"? thanks, greg k-h
On Fri, Jun 09, 2023 at 05:33:25PM +0200, Greg Kroah-Hartman wrote: > On Fri, Jun 09, 2023 at 06:25:06PM +0300, Andy Shevchenko wrote: > > Some users want to use the struct device pointer to see if > > the device is compatible. Provide inline helpers for them. > What do you mean by "compatible"? In terms of how OF defines it (note that ACPI may also utilize it, so it's wider than there). I will elaborate this in v2.
diff --git a/include/linux/property.h b/include/linux/property.h index 695053c60306..8de2c707818a 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -85,6 +85,11 @@ bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; } +static inline bool device_is_compatible(const struct device *dev, const char *compat) +{ + return fwnode_device_is_compatible(dev_fwnode(dev), compat); +} + int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, const char *prop, const char *nargs_prop, unsigned int nargs, unsigned int index,