From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809AbbGAXSd (ORCPT ); Wed, 1 Jul 2015 19:18:33 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:61750 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753064AbbGAXS0 (ORCPT ); Wed, 1 Jul 2015 19:18:26 -0400 From: "Rafael J. Wysocki" To: Tomeu Vizoso Cc: linux-kernel@vger.kernel.org, Mark Brown , Greg Kroah-Hartman Subject: Re: [PATCH v1 08/10] device property: add fwnode_is_compatible() Date: Thu, 02 Jul 2015 01:44:46 +0200 Message-ID: <2059631.9RN3FXDI12@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1435676108-20590-9-git-send-email-tomeu.vizoso@collabora.com> References: <1435676108-20590-1-git-send-email-tomeu.vizoso@collabora.com> <1435676108-20590-9-git-send-email-tomeu.vizoso@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, June 30, 2015 04:55:06 PM Tomeu Vizoso wrote: > This is being added so code that is independent of the firmware being > used can match firmware nodes to devices. > > This commit only implements it for OF nodes. > > Signed-off-by: Tomeu Vizoso I don't really like this one, as it is hiding OF-specific stuff under a seemingly generic API. The "compatible" property also makes sense for certain ACPI device objects nowadays, so at least this should take that case into accout. What do you need it for, specifically? > --- > > drivers/base/property.c | 9 +++++++++ > include/linux/property.h | 2 ++ > 2 files changed, 11 insertions(+) > > diff --git a/drivers/base/property.c b/drivers/base/property.c > index 92cdbb3..9c8be31 100644 > --- a/drivers/base/property.c > +++ b/drivers/base/property.c > @@ -585,3 +585,12 @@ const char *fwnode_get_name(struct fwnode_handle *fwnode) > return NULL; > } > EXPORT_SYMBOL_GPL(fwnode_get_name); > + > +bool fwnode_is_compatible(struct fwnode_handle *fwnode, const char *compatible) > +{ > + if (is_of_node(fwnode)) > + return of_device_is_compatible(to_of_node(fwnode), compatible); > + > + return false; > +} > +EXPORT_SYMBOL_GPL(fwnode_is_compatible); > diff --git a/include/linux/property.h b/include/linux/property.h > index cfd1eb2..bf10074 100644 > --- a/include/linux/property.h > +++ b/include/linux/property.h > @@ -80,6 +80,8 @@ const char *fwnode_get_name(struct fwnode_handle *fwnode); > > void fwnode_handle_put(struct fwnode_handle *fwnode); > > +bool fwnode_is_compatible(struct fwnode_handle *fwnode, const char *compatible); > + > unsigned int device_get_child_node_count(struct device *dev); > > static inline bool device_property_read_bool(struct device *dev, > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.