[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1559747630-28065-9-git-send-email-suzuki.poulose@arm.com>
Date: Wed, 5 Jun 2019 16:13:45 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...uxfoundation.org, rafael@...nel.org,
suzuki.poulose@....com, Alessandro Zummo <a.zummo@...ertech.it>,
Alexander Aring <alex.aring@...il.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Arnd Bergmann <arnd@...db.de>, Dan Murphy <dmurphy@...com>,
Harald Freudenberger <freude@...ux.ibm.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Lee Jones <lee.jones@...aro.org>, linux-leds@...r.kernel.org,
linux-rtc@...r.kernel.org, linux-usb@...r.kernel.org,
linux-wpan@...r.kernel.org,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Pavel Machek <pavel@....cz>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
Stefan Schmidt <stefan@...enfreihafen.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: [PATCH 08/13] drivers: Add generic helper to match by name
Add a helper to match the device name
Cc: Alessandro Zummo <a.zummo@...ertech.it>
Cc: Alexander Aring <alex.aring@...il.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Dan Murphy <dmurphy@...com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Harald Freudenberger <freude@...ux.ibm.com>
Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: Heiko Carstens <heiko.carstens@...ibm.com>
Cc: Jacek Anaszewski <jacek.anaszewski@...il.com>
Cc: Lee Jones <lee.jones@...aro.org>
Cc: linux-leds@...r.kernel.org
Cc: linux-rtc@...r.kernel.org
Cc: linux-usb@...r.kernel.org
Cc: linux-wpan@...r.kernel.org
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>
Cc: Pavel Machek <pavel@....cz>
Cc: Peter Oberparleiter <oberpar@...ux.ibm.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Stefan Schmidt <stefan@...enfreihafen.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.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 597095b..5724f93 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3352,3 +3352,9 @@ int device_match_acpi_dev(struct device *dev, const void *adev)
return ACPI_COMPANION(dev) == adev;
}
EXPORT_SYMBOL(device_match_acpi_dev);
+
+int device_match_name(struct device *dev, const void *name)
+{
+ return sysfs_streq(dev_name(dev), name);
+}
+EXPORT_SYMBOL_GPL(device_match_name);
diff --git a/include/linux/device.h b/include/linux/device.h
index a03b50d..74dd9c6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -167,6 +167,7 @@ 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 device_match_acpi_dev(struct device *dev, const void *adev);
+int device_match_name(struct device *dev, const void *name);
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