From patchwork Mon Apr 15 16:04:10 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: 10901221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2AE61390 for ; Mon, 15 Apr 2019 16:33:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A57A928987 for ; Mon, 15 Apr 2019 16:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 998AD28971; Mon, 15 Apr 2019 16:33:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2202C28987 for ; Mon, 15 Apr 2019 16:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FNzy1WAofgxGujFyiY++1okZFPLDIDWLI9gtLjlDvB0=; b=go+I3VqrXpxUvk6ONScmnp0tgh KTWMY/rejXN0ZR4b+5JKOQWr/dVjpDtoPL8ODpZ1ZXEy6Num8D/3a1mK1aAFSA5oDOfp2i2xi9IyB rBrDX/OKToc0Is+rGWExuziSQJf28hr+gSH+VjOsnAZtJVGXYX5uzhlExmvU3Bom+EXDYoIw1XRCt AzI1tPi5iDru0A0rh2JvT2ANcHQSBHDcy2A2gjykfd9Q6q2eC+GR90lQdwDZIqOVA8swJX51RG6qr 5xpnm1tkrz+Mvyr/52CMqqMsLxte0KxuISV/QEHpcU7k3ja0m/NwETmFl1tnNDIjbL7IQRv4eYMpt VacszRlQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG4Xk-0006P7-O8; Mon, 15 Apr 2019 16:33:16 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG4Vm-0003me-2V for linux-arm-kernel@bombadil.infradead.org; Mon, 15 Apr 2019 16:31:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=l7ZbeE+7IXL/SrPJhpshOt18L87W8JQ783MAq+6fvt8=; b=euHAxRNicn40mzTun09cnulMi l4HpjkYYpf6AW1kNoG9OfSTID9RWv8DYUlJdZ7gXcuunb3xrtNCBurOyS9o0DkNlNOCXJsgSKH2Kn o3yULPEylMQTp1h5wu3PoTLjfCtajjI0RI2l5dqsK2VxxVj127m/vTFp9HHoK4QmK7konNgVaTr6B QIzrjGCsA8MQylMDYrcwtPiJbw3WvVKVDmu1Vpk/z+lWe4b6Z8op6OnnzcnW3Orct2Kq7VAakh20I eJb5rlpCuXd/OCU2fCfsCOReqtz/4WFvf1iOVdYFP/xWueOxl2Sn/u6Wb5jgbNy8J0OGChVZr0SBh CdNWFJ7EQ==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG47s-0002hu-KQ for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 16:06:33 +0000 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 7A8541A25; Mon, 15 Apr 2019 09:06:32 -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 AD8F23F68F; Mon, 15 Apr 2019 09:06:30 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 27/36] drivers: Add a generic helper to match device by fwnode handle Date: Mon, 15 Apr 2019 17:04:10 +0100 Message-Id: <1555344260-12375-28-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> References: <1555344260-12375-1-git-send-email-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_120632_842567_6D7AA3FC X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mathieu.poirier@linaro.org, Suzuki K Poulose , Greg Kroah-Hartman , coresight@lists.linaro.org, "Rafael J. Wysocki" , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, robert.walker@arm.com, mike.leach@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Make the device_fwnode_match() a generic helper to match device by fwnode handle for use with bus_find_device(). This will be also used by coresight. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/base/devcon.c | 5 ----- drivers/base/property.c | 6 ++++++ include/linux/property.h | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c index 04db9ae..f4a9e30 100644 --- a/drivers/base/devcon.c +++ b/drivers/base/devcon.c @@ -107,11 +107,6 @@ static struct bus_type *generic_match_buses[] = { NULL, }; -static int device_fwnode_match(struct device *dev, void *fwnode) -{ - return dev_fwnode(dev) == fwnode; -} - static void *device_connection_fwnode_match(struct device_connection *con) { struct bus_type *bus; diff --git a/drivers/base/property.c b/drivers/base/property.c index 8b91ab3..d10d923 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -25,6 +25,12 @@ struct fwnode_handle *dev_fwnode(struct device *dev) } EXPORT_SYMBOL_GPL(dev_fwnode); +int device_fwnode_match(struct device *dev, void *fwnode) +{ + return dev_fwnode(dev) == fwnode; +} +EXPORT_SYMBOL_GPL(device_fwnode_match); + /** * device_property_present - check if a property of a device is present * @dev: Device whose property is being checked diff --git a/include/linux/property.h b/include/linux/property.h index 65d3420..c8fd3d42 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -34,6 +34,7 @@ enum dev_dma_attr { }; struct fwnode_handle *dev_fwnode(struct device *dev); +int device_fwnode_match(struct device *dev, void *fwnode); bool device_property_present(struct device *dev, const char *propname); int device_property_read_u8_array(struct device *dev, const char *propname,