[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1559747630-28065-7-git-send-email-suzuki.poulose@arm.com>
Date: Wed, 5 Jun 2019 16:13:43 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...uxfoundation.org, rafael@...nel.org,
suzuki.poulose@....com,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Arnd Bergmann <arnd@...db.de>,
Harald Freudenberger <freude@...ux.ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
linux-usb@...r.kernel.org, Oliver Neukum <oneukum@...e.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Tomas Winkler <tomas.winkler@...el.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Joe Perches <joe@...ches.com>
Subject: [PATCH 06/13] drivers: Add generic helper to match by devt
Add a helper to match the device type.
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Harald Freudenberger <freude@...ux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@...ibm.com>
Cc: linux-usb@...r.kernel.org
Cc: Oliver Neukum <oneukum@...e.com>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Tomas Winkler <tomas.winkler@...el.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Joe Perches <joe@...ches.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
---
drivers/base/core.c | 6 ++++++
include/linux/device.h | 1 +
2 files changed, 7 insertions(+)
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));
--
2.7.4
Powered by blists - more mailing lists