From patchwork Fri Jun 14 17:54:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 166882 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2352594ilk; Fri, 14 Jun 2019 10:55:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwatFLkgXmgZgCPGVpaxpgVnb4nlrB666HTjtlu5Nx6QgGrDClxgThY5iEJZADzS8YmDp7F X-Received: by 2002:a62:3605:: with SMTP id d5mr101073903pfa.28.1560534902731; Fri, 14 Jun 2019 10:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534902; cv=none; d=google.com; s=arc-20160816; b=bP6Odb3mccIlLtRmJwNykODQa4aA2vANDAxnwYcPO/LLlWkq2CLSLSEmX/eQwMCM7P LVI+5hnvCeWrzELTZsmq3upidwFZwrGo7WQ/GPGujjDDa31oa7cirjkXPrcv6O6wfvc5 KO2/Mi3M26P+zLWrl9HugMU6UTtHT1Si4R2y6U3f3flXpEUxY1cxDlRbvJCfsWnj8zgX Z6yFyDjE3fGB3JkBapFx+VyJVThPcxnCgzgL8roesjK7veSm+AR2jbKZV/WTAXZHS7wc 9GlI716TJYLOPo9woopadqTBaUGv7RnJyNaaBrJfeQLT0ss0ln4F2GO2haxBuckJCK0C u7JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=VStcCyo7cIBzRVdAFDdZh5mn68wGtntaR0HYCc/TaqA=; b=t3tK67DYSAapSsRm6h88HcFz0lytG2RG7/G6ewpAZYBz8dsWhEdu96O5P21s0SSqXt saKlHTREzUzqLd0zJaUfoewS/5f3Mz/yzXsckk2cM9ZWfzRl3iy13rNt0GzKXy/4++gE e1C9uM+Ed9zRDR9RGn+EjHsET+nAQmlcdlr34Fn6jBfaMY8Kp6wMbyWW79RyQLhN045Y tuI2VbSNFjZFXrZDinvfsmbdcXUHHOpBCmK4aZ1sNJCqnUnNjNDoUYQq1Mw2JXQRu4og GdtGGFy/8blc0S7HoXplK7t8ammJlM3DbQm+gD7ukQULs9gaMSTS38WmEZ3zIrtaQ0oc jcPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si3268706pgc.90.2019.06.14.10.55.02; Fri, 14 Jun 2019 10:55:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727426AbfFNRzA (ORCPT + 17 others); Fri, 14 Jun 2019 13:55:00 -0400 Received: from foss.arm.com ([217.140.110.172]:39392 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727397AbfFNRzA (ORCPT ); Fri, 14 Jun 2019 13:55:00 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9CA5C367; Fri, 14 Jun 2019 10:54:59 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2DFC23F718; Fri, 14 Jun 2019 10:54:58 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "David S. Miller" , Doug Ledford , Heikki Krogerus , Jason Gunthorpe , linux-usb@vger.kernel.org, Ulf Hansson , Joe Perches Subject: [PATCH v2 07/28] drivers: Add generic helper to match by fwnode Date: Fri, 14 Jun 2019 18:54:02 +0100 Message-Id: <1560534863-15115-8-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com> References: <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a helper to match the firmware node handle of a device. This will be used later for generic look up by fwnode helpers for bus/class/driver. Cc: "David S. Miller" Cc: Doug Ledford Cc: Greg Kroah-Hartman Cc: Heikki Krogerus Cc: Jason Gunthorpe Cc: linux-usb@vger.kernel.org Cc: "Rafael J. Wysocki" Cc: Greg Kroah-Hartman Cc: Ulf Hansson Cc: Joe Perches Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 1 + 2 files changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index 9211908..efcdb96 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3334,3 +3334,9 @@ int device_match_of_node(struct device *dev, const void *np) return dev->of_node == np; } EXPORT_SYMBOL_GPL(device_match_of_node); + +int device_match_fwnode(struct device *dev, const void *fwnode) +{ + return dev_fwnode(dev) == fwnode; +} +EXPORT_SYMBOL_GPL(device_match_fwnode); diff --git a/include/linux/device.h b/include/linux/device.h index 7093085..08aa087 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -164,6 +164,7 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, const void *np); +int device_match_fwnode(struct device *dev, const void *fwnode); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data));