From patchwork Fri Jun 14 17:54:06 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: 166886 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2352730ilk; Fri, 14 Jun 2019 10:55:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbqQ3ZErOfzgt/pqUVK/3u7hTwN8zFTX386C0XzQRYs6QrIMxr2Zcat2gtCAC/G4FTD0P6 X-Received: by 2002:a17:902:44a4:: with SMTP id l33mr14818273pld.174.1560534911911; Fri, 14 Jun 2019 10:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534911; cv=none; d=google.com; s=arc-20160816; b=JDHTtdMmE9o9cRER6wjdrkhEvlxzzy6VGLex6Y4T9Wsl89xMw4Fsr5VkDK/mAjQh4J zH0iesf6N/sI+4n/MVLyjN7aGxyY6XRTFJ13/1JNe/Fz5UN3+lWX7WukapF1ogQCSZdv SX9APjVUGEBzfKfeXhLYFHyXQh3u6Kz8BD440/bPksJNlRHg3oQ9FFT1zvVITp6KodRb tfAx6fA1LsrTNbpdztw3npfd+Sf9yZ100+tPtRjr72OQoiavY/aEAjkb5deIqwGDU/M+ 3o4QNu9iLJCIn7oLQUlRuUc2QxaxxRPCx9uTGliE/7kiVpajYb/TCH8y9oZOMzgOJJiR En3w== 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=a9IXM88j6Ie+YWYt+f76NKxQ+LJdkM9Ws5fTUTyr3vQ=; b=sbnnvYVz8GpBGFlafRxiJdN4ul3E2cMtAbQr3BNCWTNGE1y/p7QPd5tW2rr7MGrW0H AwEk/VqigGdN+PKL5Vr6GeOv8t+sBPSl1HvT+mtE2l0o8a7MoRZt0yEBAOiTnRdtmHHb L9il6lB8cvfITNPqDcxXcu25OQ0ERYAkG7jL1zTJmoNfoOM/ZeNX3IXuYTRSCQVdUVE4 i8v7pgWXOeCwm0SSCryZrJPmZpz6J6DjuRSnXKMndTRqfIgu6IAunNC+Bt6vuq2dN8QS 9W0G8D6rALjEMcmWtM0TNXeqrdFNe2mmp63hdN7RiKriBqOde4C5a9rDnOUdSVZb0Y77 rLYw== 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 s13si3122309pgp.95.2019.06.14.10.55.11; Fri, 14 Jun 2019 10:55:11 -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 S1727506AbfFNRzK (ORCPT + 17 others); Fri, 14 Jun 2019 13:55:10 -0400 Received: from foss.arm.com ([217.140.110.172]:39480 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbfFNRzI (ORCPT ); Fri, 14 Jun 2019 13:55:08 -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 D3019D6E; Fri, 14 Jun 2019 10:55:07 -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 644D63F718; Fri, 14 Jun 2019 10:55:06 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Bjorn Helgaas , Elie Morisse , "James E.J. Bottomley" , "Martin K. Petersen" , Nehal Shah , "Rafael J. Wysocki" , Shyam Sundar S K Subject: [PATCH v2 11/28] drivers: Add generic helper to match any device Date: Fri, 14 Jun 2019 18:54:06 +0100 Message-Id: <1560534863-15115-12-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 generic helper to match any/all devices. This will be used for providing {bus/driver/class}_find_next_device() Cc: Bjorn Helgaas Cc: Elie Morisse Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Nehal Shah Cc: "Rafael J. Wysocki" Cc: Shyam Sundar S K Cc: Greg Kroah-Hartman 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 5724f93..053ee2e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3358,3 +3358,9 @@ int device_match_name(struct device *dev, const void *name) return sysfs_streq(dev_name(dev), name); } EXPORT_SYMBOL_GPL(device_match_name); + +int device_match_any(struct device *dev, const void *unused) +{ + return 1; +} +EXPORT_SYMBOL_GPL(device_match_any); diff --git a/include/linux/device.h b/include/linux/device.h index b9b82b7..a449d09 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -168,6 +168,7 @@ int device_match_fwnode(struct device *dev, const void *fwnode); int device_match_devt(struct device *dev, const void *pdevt); int device_match_acpi_dev(struct device *dev, const void *adev); int device_match_name(struct device *dev, const void *name); +int device_match_any(struct device *dev, const void *unused); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data));