From patchwork Wed Jun 5 15:13:41 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: 165892 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7485288ili; Wed, 5 Jun 2019 08:14:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhhb5GAbg/LMdN1VW0T8Ps9SfxuzR+0KhsqrmTcFVhJpucDg2VtpCAv/JG8mCPo2RXEWAP X-Received: by 2002:a63:1854:: with SMTP id 20mr5060077pgy.366.1559747675724; Wed, 05 Jun 2019 08:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559747675; cv=none; d=google.com; s=arc-20160816; b=Asuf59BmVbUguuIX57Niv1phvEZKbWpmcdNBTrZhzlNaSseqMy2No90GYPQPjIdAX/ 4Z59jz7c0e/MXI7DZaz3ES/Ei5EMvjeTrMH/E3jzIRf+WvcwBEs1DgkNUQiGvmYzachR ILBcvYrmBtlHPJHtnSZD8nq+POkScsUl1m2eNpa1XbL6eDKstG0uz8rjHPQkfM5K+CDd iplZk6WMUzdIjWrd2NkAd19AuIY4nj7Tmb0oxgJTZ3Dpljfm+W7PKnxy77lO3ueyX3cm VaExU6IP63N4POMznK8882+CVedOxnjRF0rP4SuseTNfTR6585lHP0uqWC8XOQlzNMBZ xGNw== 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=LBwU9c0diZhfJW6GFBjFZOKz3rhCA+SLgpEES3YXVBk=; b=u9SKtZ/v2MGZasKD3KsBfBrkcGNzEn5XsclqBb2YFha8RZgtMja0EluGO57SM2KAaz hWfMBkiFnMlEEgBhi9zzbdlyguzSIM7KjrZKyNhK2UCc3GDbQhQg0cYHdhoPwceIRcrb qN+pJRtX3ldYOedE78K6L+QqEoxoM4DraR5nTt4tPdiyzLg/4g0zu44m4IcieWSs3u24 CvDIR3nnhvHH4y5pNQiU6uAMd0E5GRLuQTL8MvofA8WpwY6gZy6JZ93Wt4zq966pMjX5 0IZE4ItH1WpFhJLzN2yRHvLUX2V6C+9kuVrxiosVo6uf5s1mnKGcuMndy37VHTq59Sm0 ST7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-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 v15si29085327pfm.91.2019.06.05.08.14.35; Wed, 05 Jun 2019 08:14:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-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-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728467AbfFEPOf (ORCPT + 1 other); Wed, 5 Jun 2019 11:14:35 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33392 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728458AbfFEPOe (ORCPT ); Wed, 5 Jun 2019 11:14:34 -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 5092115BF; Wed, 5 Jun 2019 08:14:34 -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 0B1963F246; Wed, 5 Jun 2019 08:14:28 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alan Tull , Andrew Lunn , Daniel Vetter , David Airlie , "David S. Miller" , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Florian Fainelli , Frank Rowand , Heiner Kallweit , Jiri Slaby , Jonathan Hunter , Lee Jones , Liam Girdwood , linux-fpga@vger.kernel.org, linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, Maarten Lankhorst , Mark Brown , Mathieu Poirier , Maxime Ripard , Moritz Fischer , Peter Rosin , Rob Herring , Srinivas Kandagatla , Thierry Reding , Thor Thayer , Wolfram Sang , Ulf Hansson , Joe Perches Subject: [PATCH 04/13] drivers: Add generic helper to match by of_node Date: Wed, 5 Jun 2019 16:13:41 +0100 Message-Id: <1559747630-28065-5-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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add a helper to match device by the of_node. This will be later used to provide generic lookup functions by of_node. Cc: Alan Tull Cc: Andrew Lunn Cc: Daniel Vetter Cc: David Airlie Cc: "David S. Miller" Cc: devicetree@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: Florian Fainelli Cc: Frank Rowand Cc: Greg Kroah-Hartman Cc: Heiner Kallweit Cc: Jiri Slaby Cc: Jonathan Hunter Cc: Lee Jones Cc: Liam Girdwood Cc: linux-fpga@vger.kernel.org Cc: linux-i2c@vger.kernel.org Cc: linux-spi@vger.kernel.org Cc: Maarten Lankhorst Cc: Mark Brown Cc: Mathieu Poirier Cc: Maxime Ripard Cc: Moritz Fischer Cc: Peter Rosin Cc: Rob Herring Cc: Srinivas Kandagatla Cc: Thierry Reding Cc: Thor Thayer Cc: Wolfram Sang 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 | 2 ++ 2 files changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index fd7511e..9211908 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3328,3 +3328,9 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2) dev->of_node_reused = true; } EXPORT_SYMBOL_GPL(device_set_of_node_from_dev); + +int device_match_of_node(struct device *dev, const void *np) +{ + return dev->of_node == np; +} +EXPORT_SYMBOL_GPL(device_match_of_node); diff --git a/include/linux/device.h b/include/linux/device.h index 4d7c881..7093085 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -163,6 +163,8 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, 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 bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); struct device *bus_find_device(struct bus_type *bus, struct device *start,