From patchwork Wed Jun 5 15:13:42 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: 165893 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7485407ili; Wed, 5 Jun 2019 08:14:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgFVGP2BxLPUwF5B4cA26X+fIfD8x7EihpABisBzjX/H4DvIExRIKupkqUEySb2gypu4dY X-Received: by 2002:a63:d416:: with SMTP id a22mr5189643pgh.218.1559747680806; Wed, 05 Jun 2019 08:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559747680; cv=none; d=google.com; s=arc-20160816; b=kMcjA3huL2k1GYYgKlaiUSuOcYoX3xobiRO49RDfjPTMywtM6MF0Rq9ViZq+5SJFUA Sj6aEK+PH4qB7BnLfNPpDzgRFgnxS1Yx2zM0LnReKxpzPsGx4q46il0NQ2HcyvqIhzUp oudfn2exYrF7FLLNbRRQw2iWIsZwyQ0EFWrnVb8DGSePCcCHUw+OASVRuFNSEWkRddGb jzZvZZ45+lrFlyYFtFIKZTG9wNFVZzhhu4KBqb1Pi92vDr7pG+HzAOgc2oyotaUnmeMn TAsHoYe+xAXZSVjIwHsBTCwBMrZF2TUJJNajBSW0s9X6mRTAwGsAbQlVRQ8+ko/+W86t 74Zg== 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=bOYYioo2+Mo5WyuuBNP7QClb29vzs18ofNSx+oECXfQ=; b=OpQ6qiwZHFlt7EeFz5RUC3QDv3Ybb8HPvevBbGTecuxmMVkP2nC6BlyxnVLoaIYceD aJ31MrLegMb6OalnfkPMJ03O5hlw2dZx6DM8GRMMg7WXhEOTSqiVgqsuWF+cIiIZ7SMv 0iFgcOQ33TG28nTfWfEAgugeA3uPWP4zGP+S4qss9Je8MNvqsmUBzjAVw0iuVOWIMMKh co36eUqRzwmIjB+237um8q69yZhRdYQq/7Btck00FLqcYXJUiy0FTfARnq9uEnU1LBnh YHJRLEXkzZtLW3sonlzXFDzvZi9gHMWwTVYA7s5rUF4RaqkSAMUQUrjtXMFJXJM1a54Y ndSw== 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 x13si27921029pjn.50.2019.06.05.08.14.40; Wed, 05 Jun 2019 08:14:40 -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 S1728534AbfFEPOj (ORCPT + 30 others); Wed, 5 Jun 2019 11:14:39 -0400 Received: from foss.arm.com ([217.140.101.70]:33426 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728458AbfFEPOh (ORCPT ); Wed, 5 Jun 2019 11:14:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F2AB374; Wed, 5 Jun 2019 08:14:36 -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 8DD463F246; Wed, 5 Jun 2019 08:14:34 -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 05/13] drivers: Add generic helper to match by fwnode Date: Wed, 5 Jun 2019 16:13:42 +0100 Message-Id: <1559747630-28065-6-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559747630-28065-1-git-send-email-suzuki.poulose@arm.com> References: <1559747630-28065-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. 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));