From patchwork Wed Jun 5 15:13:43 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: 165894 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7485454ili; Wed, 5 Jun 2019 08:14:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZfcTinmVmsfEMV7eOUFhE5CrkGRzoUiuiO9XyN2NRxN/iu2U6CpYjaJAWacsyoCSGPbjk X-Received: by 2002:a17:90a:a10f:: with SMTP id s15mr45757694pjp.30.1559747682365; Wed, 05 Jun 2019 08:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559747682; cv=none; d=google.com; s=arc-20160816; b=uizS8enhwikOOCgVjFHMkBvV2A6MoShM2CarUzSEDmmevnZ9pKoq1tuWWlUUD6zl3G 6DxBltkR98sUaBbRlrIckVSBZrhQc13zViaaclZPHjn9rkg1ssfM/ObXs/3F+Q1Q7bS/ K9BnHMyQoZ55w5yuwOdNIfzKsH3lfFObq5b3utHHgLAFiQhSzuOEKY9iMChUzvRrm4Uc NYXbEbb594oAb7oEfyRkUBMLKp3u39HNBExBRUV9EarX1PfGOlwLvRdnbf/8E8yd+yKB eXFx//OBge0Gy2nWex9pCVcuRWIeFqZ4Jp3c9PSU5lGFpzifXJV0nIBq714aWZ6W7DU3 7i5Q== 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=uFmGwAAs9uhBUeJ2540yvHReuiK2SlXmIB4VA7vUoos=; b=G2FELOAl93MlRirrft9sjOAnQqYkrFwrPgMYQnR0CNjQpKqJqZTbJbY7xcu0OpAYS/ ABRExkGMFCGReCClNVSyYCscXI1f1QnrXJ3zqHOA6A40rER0JkseDqvPGAGLMfZfFX9E 7rSl+1WZyk2sDgenK69oaz3IIH2T62okXNSl1NcsSHYbJ4YyTY0fOZJkM9I1Dw70PHXH bs9QMg3xBDsu+j2G0GyRhudqAHl2OeYXKz7384SCC4I3LZjlwBH2jZ+emo8bPfE1z37J 4Xtux8L7PEC0AT03MpzsmjPhPAWpuZX/BPlCYWVU8z4Q+0+WEHQG3YPDFjnb0UJQ6KKt 6/6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-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.42; Wed, 05 Jun 2019 08:14:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-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-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728541AbfFEPOk (ORCPT + 5 others); Wed, 5 Jun 2019 11:14:40 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33448 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728529AbfFEPOj (ORCPT ); Wed, 5 Jun 2019 11:14:39 -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 242BD15A2; Wed, 5 Jun 2019 08:14:39 -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 BDC883F246; Wed, 5 Jun 2019 08:14:36 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alexander Shishkin , Arnd Bergmann , Harald Freudenberger , Heiko Carstens , linux-usb@vger.kernel.org, Oliver Neukum , Sebastian Andrzej Siewior , Tomas Winkler , Ulf Hansson , Joe Perches Subject: [PATCH 06/13] drivers: Add generic helper to match by devt Date: Wed, 5 Jun 2019 16:13:43 +0100 Message-Id: <1559747630-28065-7-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-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add a helper to match the device type. Cc: Alexander Shishkin Cc: Arnd Bergmann Cc: Harald Freudenberger Cc: Heiko Carstens Cc: linux-usb@vger.kernel.org Cc: Oliver Neukum Cc: Sebastian Andrzej Siewior Cc: Tomas Winkler 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 efcdb96..b827ca1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3340,3 +3340,9 @@ int device_match_fwnode(struct device *dev, const void *fwnode) return dev_fwnode(dev) == fwnode; } EXPORT_SYMBOL_GPL(device_match_fwnode); + +int device_match_devt(struct device *dev, const void *pdevt) +{ + return dev->devt == *(dev_t *)pdevt; +} +EXPORT_SYMBOL_GPL(device_match_devt); diff --git a/include/linux/device.h b/include/linux/device.h index 08aa087..f315692 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -165,6 +165,7 @@ 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 device_match_devt(struct device *dev, const void *pdevt); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data));