* [PATCH v2 07/28] drivers: Add generic helper to match by fwnode
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
@ 2019-06-14 17:54 ` Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 08/28] drivers: Add generic helper to match by device type Suzuki K Poulose
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2019-06-14 17:54 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, rafael, suzuki.poulose, David S. Miller, Doug Ledford,
Heikki Krogerus, Jason Gunthorpe, linux-usb, Ulf Hansson,
Joe Perches
Add a helper to match the firmware node handle of a device. This
will be used later for generic look up by fwnode helpers for bus/class/driver.
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-usb@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.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 9211908..efcdb96 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3334,3 +3334,9 @@ int device_match_of_node(struct device *dev, const void *np)
return dev->of_node == np;
}
EXPORT_SYMBOL_GPL(device_match_of_node);
+
+int device_match_fwnode(struct device *dev, const void *fwnode)
+{
+ return dev_fwnode(dev) == fwnode;
+}
+EXPORT_SYMBOL_GPL(device_match_fwnode);
diff --git a/include/linux/device.h b/include/linux/device.h
index 7093085..08aa087 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -164,6 +164,7 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
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 bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
int (*fn)(struct device *dev, void *data));
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 08/28] drivers: Add generic helper to match by device type
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
2019-06-14 17:54 ` [PATCH v2 07/28] drivers: Add generic helper to match by fwnode Suzuki K Poulose
@ 2019-06-14 17:54 ` Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 10/28] drivers: Add generic helper to match by name Suzuki K Poulose
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2019-06-14 17:54 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, rafael, suzuki.poulose, Alexander Shishkin,
Arnd Bergmann, Harald Freudenberger, Heiko Carstens, linux-usb,
Oliver Neukum, Sebastian Andrzej Siewior, Tomas Winkler,
Ulf Hansson, Joe Perches
Add a helper to match a device by its type. This will be used
later for providing wrappers to the device iterators for bus/class/driver.
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-usb@vger.kernel.org
Cc: Oliver Neukum <oneukum@suse.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 10/28] drivers: Add generic helper to match by name
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
2019-06-14 17:54 ` [PATCH v2 07/28] drivers: Add generic helper to match by fwnode Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 08/28] drivers: Add generic helper to match by device type Suzuki K Poulose
@ 2019-06-14 17:54 ` Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper Suzuki K Poulose
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2019-06-14 17:54 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, rafael, suzuki.poulose, Alessandro Zummo,
Alexander Aring, Alexander Shishkin, Alexandre Belloni,
Arnd Bergmann, Dan Murphy, Harald Freudenberger, Heikki Krogerus,
Heiko Carstens, Jacek Anaszewski, Lee Jones, linux-leds,
linux-rtc, linux-usb, linux-wpan, Martin Schwidefsky,
Maxime Coquelin, Pavel Machek, Peter Oberparleiter,
Stefan Schmidt, Rafael J. Wysocki
Add a helper to match the device name. Also reuse this generic
exported helper for bus_find_device_by_name(). This will also be
used to add similar interface for (driver/class)_find_device()
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexander Aring <alex.aring@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: linux-leds@vger.kernel.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-wpan@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Stefan Schmidt <stefan@datenfreihafen.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/base/bus.c | 24 ------------------------
drivers/base/core.c | 6 ++++++
include/linux/device.h | 18 +++++++++++++++---
3 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index df3cac7..a1d1e82 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -342,30 +342,6 @@ struct device *bus_find_device(struct bus_type *bus,
}
EXPORT_SYMBOL_GPL(bus_find_device);
-static int match_name(struct device *dev, const void *data)
-{
- const char *name = data;
-
- return sysfs_streq(name, dev_name(dev));
-}
-
-/**
- * bus_find_device_by_name - device iterator for locating a particular device of a specific name
- * @bus: bus type
- * @start: Device to begin with
- * @name: name of the device to match
- *
- * This is similar to the bus_find_device() function above, but it handles
- * searching by a name automatically, no need to write another strcmp matching
- * function.
- */
-struct device *bus_find_device_by_name(struct bus_type *bus,
- struct device *start, const char *name)
-{
- return bus_find_device(bus, start, (void *)name, match_name);
-}
-EXPORT_SYMBOL_GPL(bus_find_device_by_name);
-
/**
* subsys_find_device_by_id - find a device with a specific enumeration number
* @subsys: subsystem
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..b9b82b7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -167,15 +167,27 @@ 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));
struct device *bus_find_device(struct bus_type *bus, struct device *start,
const void *data,
int (*match)(struct device *dev, const void *data));
-struct device *bus_find_device_by_name(struct bus_type *bus,
- struct device *start,
- const char *name);
+/**
+ * bus_find_device_by_name - device iterator for locating a particular device
+ * of a specific name.
+ * @bus: bus type
+ * @start: Device to begin with
+ * @name: name of the device to match
+ */
+static inline struct device *bus_find_device_by_name(struct bus_type *bus,
+ struct device *start,
+ const char *name)
+{
+ return bus_find_device(bus, start, name, device_match_name);
+}
+
struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
struct device *hint);
int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
` (2 preceding siblings ...)
2019-06-14 17:54 ` [PATCH v2 10/28] drivers: Add generic helper to match by name Suzuki K Poulose
@ 2019-06-14 17:54 ` Suzuki K Poulose
2019-06-21 11:02 ` Pavel Machek
2019-06-24 10:08 ` Alexandre Belloni
2019-06-14 17:54 ` [PATCH v2 14/28] drivers: Introduce class_find_device_by_fwnode() helper Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 19/28] drivers: Introduce bus_find_device_by_devt() helper Suzuki K Poulose
5 siblings, 2 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2019-06-14 17:54 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, rafael, suzuki.poulose, Alexander Shishkin,
Maxime Coquelin, Alessandro Zummo, Alexander Aring,
Alexandre Belloni, Dan Murphy, Heikki Krogerus, Heiko Carstens,
Jacek Anaszewski, linux-leds, linux-rtc, linux-usb, linux-wpan,
Martin Schwidefsky, Stefan Schmidt
Add a new wrapper for class_find_device() to search for devices
by name and convert the existing users to use the new helper.
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexander Aring <alex.aring@gmail.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: linux-leds@vger.kernel.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-wpan@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Stefan Schmidt <stefan@datenfreihafen.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/hwtracing/stm/core.c | 9 +--------
drivers/leds/led-class.c | 9 +--------
drivers/rtc/interface.c | 11 +----------
drivers/s390/crypto/zcrypt_api.c | 11 +----------
drivers/usb/roles/class.c | 8 +-------
drivers/usb/typec/class.c | 8 +-------
include/linux/device.h | 12 ++++++++++++
net/ieee802154/core.c | 7 +------
8 files changed, 19 insertions(+), 56 deletions(-)
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index e55b902..2b6bd42 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -89,13 +89,6 @@ static struct class stm_class = {
.dev_groups = stm_groups,
};
-static int stm_dev_match(struct device *dev, const void *data)
-{
- const char *name = data;
-
- return sysfs_streq(name, dev_name(dev));
-}
-
/**
* stm_find_device() - find stm device by name
* @buf: character buffer containing the name
@@ -116,7 +109,7 @@ struct stm_device *stm_find_device(const char *buf)
if (!stm_core_up)
return NULL;
- dev = class_find_device(&stm_class, NULL, buf, stm_dev_match);
+ dev = class_find_device_by_name(&stm_class, buf);
if (!dev)
return NULL;
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 85848c5..317a619 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -216,13 +216,6 @@ static int led_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume);
-static int match_name(struct device *dev, const void *data)
-{
- if (!dev_name(dev))
- return 0;
- return !strcmp(dev_name(dev), (char *)data);
-}
-
static int led_classdev_next_name(const char *init_name, char *name,
size_t len)
{
@@ -233,7 +226,7 @@ static int led_classdev_next_name(const char *init_name, char *name,
strlcpy(name, init_name, len);
while ((ret < len) &&
- (dev = class_find_device(leds_class, NULL, name, match_name))) {
+ (dev = class_find_device_by_name(leds_class, name))) {
put_device(dev);
ret = snprintf(name, len, "%s_%u", init_name, ++i);
}
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 4124f4d..1bee39c 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -663,21 +663,12 @@ void rtc_update_irq(struct rtc_device *rtc,
}
EXPORT_SYMBOL_GPL(rtc_update_irq);
-static int __rtc_match(struct device *dev, const void *data)
-{
- const char *name = data;
-
- if (strcmp(dev_name(dev), name) == 0)
- return 1;
- return 0;
-}
-
struct rtc_device *rtc_class_open(const char *name)
{
struct device *dev;
struct rtc_device *rtc = NULL;
- dev = class_find_device(rtc_class, NULL, name, __rtc_match);
+ dev = class_find_device_by_name(rtc_class, name);
if (dev)
rtc = to_rtc_device(dev);
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 1058b4b..38a5a47 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -133,12 +133,6 @@ struct zcdn_device {
static int zcdn_create(const char *name);
static int zcdn_destroy(const char *name);
-/* helper function, matches the name for find_zcdndev_by_name() */
-static int __match_zcdn_name(struct device *dev, const void *data)
-{
- return strcmp(dev_name(dev), (const char *)data) == 0;
-}
-
/* helper function, matches the devt value for find_zcdndev_by_devt() */
static int __match_zcdn_devt(struct device *dev, const void *data)
{
@@ -152,10 +146,7 @@ static int __match_zcdn_devt(struct device *dev, const void *data)
*/
static inline struct zcdn_device *find_zcdndev_by_name(const char *name)
{
- struct device *dev =
- class_find_device(zcrypt_class, NULL,
- (void *) name,
- __match_zcdn_name);
+ struct device *dev = class_find_device_by_name(zcrypt_class, name);
return dev ? to_zcdn_dev(dev) : NULL;
}
diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
index f45d8df..07aaa96 100644
--- a/drivers/usb/roles/class.c
+++ b/drivers/usb/roles/class.c
@@ -90,11 +90,6 @@ static int switch_fwnode_match(struct device *dev, const void *fwnode)
return dev_fwnode(dev) == fwnode;
}
-static int switch_name_match(struct device *dev, const void *name)
-{
- return !strcmp((const char *)name, dev_name(dev));
-}
-
static void *usb_role_switch_match(struct device_connection *con, int ep,
void *data)
{
@@ -107,8 +102,7 @@ static void *usb_role_switch_match(struct device_connection *con, int ep,
dev = class_find_device(role_class, NULL, con->fwnode,
switch_fwnode_match);
} else {
- dev = class_find_device(role_class, NULL, con->endpoint[ep],
- switch_name_match);
+ dev = class_find_device_by_name(role_class, con->endpoint[ep]);
}
return dev ? to_role_switch(dev) : ERR_PTR(-EPROBE_DEFER);
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 2eb6238..18a0687 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -210,11 +210,6 @@ static int typec_port_fwnode_match(struct device *dev, const void *fwnode)
return dev_fwnode(dev) == fwnode;
}
-static int typec_port_name_match(struct device *dev, const void *name)
-{
- return !strcmp((const char *)name, dev_name(dev));
-}
-
static void *typec_port_match(struct device_connection *con, int ep, void *data)
{
struct device *dev;
@@ -227,8 +222,7 @@ static void *typec_port_match(struct device_connection *con, int ep, void *data)
return class_find_device(typec_class, NULL, con->fwnode,
typec_port_fwnode_match);
- dev = class_find_device(typec_class, NULL, con->endpoint[ep],
- typec_port_name_match);
+ dev = class_find_device_by_name(typec_class, con->endpoint[ep]);
return dev ? dev : ERR_PTR(-EPROBE_DEFER);
}
diff --git a/include/linux/device.h b/include/linux/device.h
index a449d09..bb14c7f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -485,6 +485,18 @@ extern struct device *class_find_device(struct class *class,
struct device *start, const void *data,
int (*match)(struct device *, const void *));
+/**
+ * class_find_device_by_name - device iterator for locating a particular device
+ * of a specific name.
+ * @class: class type
+ * @name: name of the device to match
+ */
+static inline struct device *class_find_device_by_name(struct class *class,
+ const char *name)
+{
+ return class_find_device(class, NULL, name, device_match_name);
+}
+
struct class_attribute {
struct attribute attr;
ssize_t (*show)(struct class *class, struct class_attribute *attr,
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
index 60b7ac5..de259b5 100644
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -23,11 +23,6 @@
LIST_HEAD(cfg802154_rdev_list);
int cfg802154_rdev_list_generation;
-static int wpan_phy_match(struct device *dev, const void *data)
-{
- return !strcmp(dev_name(dev), (const char *)data);
-}
-
struct wpan_phy *wpan_phy_find(const char *str)
{
struct device *dev;
@@ -35,7 +30,7 @@ struct wpan_phy *wpan_phy_find(const char *str)
if (WARN_ON(!str))
return NULL;
- dev = class_find_device(&wpan_phy_class, NULL, str, wpan_phy_match);
+ dev = class_find_device_by_name(&wpan_phy_class, str);
if (!dev)
return NULL;
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 14/28] drivers: Introduce class_find_device_by_fwnode() helper
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
` (3 preceding siblings ...)
2019-06-14 17:54 ` [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper Suzuki K Poulose
@ 2019-06-14 17:54 ` Suzuki K Poulose
2019-06-18 10:42 ` Heikki Krogerus
2019-06-14 17:54 ` [PATCH v2 19/28] drivers: Introduce bus_find_device_by_devt() helper Suzuki K Poulose
5 siblings, 1 reply; 9+ messages in thread
From: Suzuki K Poulose @ 2019-06-14 17:54 UTC (permalink / raw)
To: linux-kernel; +Cc: gregkh, rafael, suzuki.poulose, Heikki Krogerus, linux-usb
Add a wrapper to class_find_device() to search for a device
by the fwnode pointer, reusing the generic match function.
Also convert the existing users to make use of the new helper.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/usb/roles/class.c | 8 +-------
drivers/usb/typec/class.c | 8 +-------
include/linux/device.h | 13 +++++++++++++
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
index 07aaa96..5cd87d8 100644
--- a/drivers/usb/roles/class.c
+++ b/drivers/usb/roles/class.c
@@ -85,11 +85,6 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
}
EXPORT_SYMBOL_GPL(usb_role_switch_get_role);
-static int switch_fwnode_match(struct device *dev, const void *fwnode)
-{
- return dev_fwnode(dev) == fwnode;
-}
-
static void *usb_role_switch_match(struct device_connection *con, int ep,
void *data)
{
@@ -99,8 +94,7 @@ static void *usb_role_switch_match(struct device_connection *con, int ep,
if (!fwnode_property_present(con->fwnode, con->id))
return NULL;
- dev = class_find_device(role_class, NULL, con->fwnode,
- switch_fwnode_match);
+ dev = class_find_device_by_fwnode(role_class, con->fwnode);
} else {
dev = class_find_device_by_name(role_class, con->endpoint[ep]);
}
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 18a0687..af4fb73 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -205,11 +205,6 @@ static void typec_altmode_put_partner(struct altmode *altmode)
put_device(&adev->dev);
}
-static int typec_port_fwnode_match(struct device *dev, const void *fwnode)
-{
- return dev_fwnode(dev) == fwnode;
-}
-
static void *typec_port_match(struct device_connection *con, int ep, void *data)
{
struct device *dev;
@@ -219,8 +214,7 @@ static void *typec_port_match(struct device_connection *con, int ep, void *data)
* we need to return ERR_PTR(-PROBE_DEFER) when there is no device.
*/
if (con->fwnode)
- return class_find_device(typec_class, NULL, con->fwnode,
- typec_port_fwnode_match);
+ return class_find_device_by_fwnode(typec_class, con->fwnode);
dev = class_find_device_by_name(typec_class, con->endpoint[ep]);
diff --git a/include/linux/device.h b/include/linux/device.h
index 9228502..52ac911 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -509,6 +509,19 @@ class_find_device_by_of_node(struct class *class, const struct device_node *np)
return class_find_device(class, NULL, np, device_match_of_node);
}
+/**
+ * class_find_device_by_fwnode : device iterator for locating a particular device
+ * matching the fwnode.
+ * @class: class type
+ * @fwnode: fwnode of the device to match.
+ */
+static inline struct device *
+class_find_device_by_fwnode(struct class *class,
+ const struct fwnode_handle *fwnode)
+{
+ return class_find_device(class, NULL, fwnode, device_match_fwnode);
+}
+
struct class_attribute {
struct attribute attr;
ssize_t (*show)(struct class *class, struct class_attribute *attr,
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 19/28] drivers: Introduce bus_find_device_by_devt() helper
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
` (4 preceding siblings ...)
2019-06-14 17:54 ` [PATCH v2 14/28] drivers: Introduce class_find_device_by_fwnode() helper Suzuki K Poulose
@ 2019-06-14 17:54 ` Suzuki K Poulose
5 siblings, 0 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2019-06-14 17:54 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, rafael, suzuki.poulose, linux-usb, Oliver Neukum,
Sebastian Andrzej Siewior, Alexander Shishkin
Add a wrapper to bus_find_device() to search for a device
by the device type, reusing the generic match function.
Also convert the existing users to make use of the new helper.
Cc: linux-usb@vger.kernel.org
Cc: Oliver Neukum <oneukum@suse.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/hwtracing/intel_th/core.c | 10 +---------
drivers/usb/core/devio.c | 8 +-------
include/linux/device.h | 12 ++++++++++++
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 5592289..d5c1821 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -789,12 +789,6 @@ static int intel_th_populate(struct intel_th *th)
return 0;
}
-static int match_devt(struct device *dev, const void *data)
-{
- dev_t devt = (dev_t)(unsigned long)(void *)data;
- return dev->devt == devt;
-}
-
static int intel_th_output_open(struct inode *inode, struct file *file)
{
const struct file_operations *fops;
@@ -802,9 +796,7 @@ static int intel_th_output_open(struct inode *inode, struct file *file)
struct device *dev;
int err;
- dev = bus_find_device(&intel_th_bus, NULL,
- (void *)(unsigned long)inode->i_rdev,
- match_devt);
+ dev = bus_find_device_by_devt(&intel_th_bus, inode->i_rdev);
if (!dev || !dev->driver)
return -ENODEV;
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 7bd7de7..4e83623 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -947,17 +947,11 @@ static int parse_usbdevfs_streams(struct usb_dev_state *ps,
return ret;
}
-static int match_devt(struct device *dev, const void *data)
-{
- return dev->devt == (dev_t)(unsigned long)(void *)data;
-}
-
static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
{
struct device *dev;
- dev = bus_find_device(&usb_bus_type, NULL,
- (void *) (unsigned long) devt, match_devt);
+ dev = bus_find_device_by_devt(&usb_bus_type, devt);
if (!dev)
return NULL;
return to_usb_device(dev);
diff --git a/include/linux/device.h b/include/linux/device.h
index 576d84f..3c244ac 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -213,6 +213,18 @@ bus_find_device_by_fwnode(struct bus_type *bus, const struct fwnode_handle *fwno
return bus_find_device(bus, NULL, fwnode, device_match_fwnode);
}
+/**
+ * bus_find_device_by_devt : device iterator for locating a particular device
+ * matching the device type.
+ * @bus: bus type
+ * @devt: device type of the device to match.
+ */
+static inline struct device *bus_find_device_by_devt(struct bus_type *bus,
+ dev_t devt)
+{
+ return bus_find_device(bus, NULL, &devt, device_match_devt);
+}
+
struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
struct device *hint);
int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 14/28] drivers: Introduce class_find_device_by_fwnode() helper
2019-06-14 17:54 ` [PATCH v2 14/28] drivers: Introduce class_find_device_by_fwnode() helper Suzuki K Poulose
@ 2019-06-18 10:42 ` Heikki Krogerus
0 siblings, 0 replies; 9+ messages in thread
From: Heikki Krogerus @ 2019-06-18 10:42 UTC (permalink / raw)
To: Suzuki K Poulose; +Cc: linux-kernel, gregkh, rafael, linux-usb
On Fri, Jun 14, 2019 at 06:54:09PM +0100, Suzuki K Poulose wrote:
> Add a wrapper to class_find_device() to search for a device
> by the fwnode pointer, reusing the generic match function.
> Also convert the existing users to make use of the new helper.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/roles/class.c | 8 +-------
> drivers/usb/typec/class.c | 8 +-------
> include/linux/device.h | 13 +++++++++++++
> 3 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
> index 07aaa96..5cd87d8 100644
> --- a/drivers/usb/roles/class.c
> +++ b/drivers/usb/roles/class.c
> @@ -85,11 +85,6 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
> }
> EXPORT_SYMBOL_GPL(usb_role_switch_get_role);
>
> -static int switch_fwnode_match(struct device *dev, const void *fwnode)
> -{
> - return dev_fwnode(dev) == fwnode;
> -}
> -
> static void *usb_role_switch_match(struct device_connection *con, int ep,
> void *data)
> {
> @@ -99,8 +94,7 @@ static void *usb_role_switch_match(struct device_connection *con, int ep,
> if (!fwnode_property_present(con->fwnode, con->id))
> return NULL;
>
> - dev = class_find_device(role_class, NULL, con->fwnode,
> - switch_fwnode_match);
> + dev = class_find_device_by_fwnode(role_class, con->fwnode);
> } else {
> dev = class_find_device_by_name(role_class, con->endpoint[ep]);
> }
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 18a0687..af4fb73 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -205,11 +205,6 @@ static void typec_altmode_put_partner(struct altmode *altmode)
> put_device(&adev->dev);
> }
>
> -static int typec_port_fwnode_match(struct device *dev, const void *fwnode)
> -{
> - return dev_fwnode(dev) == fwnode;
> -}
> -
> static void *typec_port_match(struct device_connection *con, int ep, void *data)
> {
> struct device *dev;
> @@ -219,8 +214,7 @@ static void *typec_port_match(struct device_connection *con, int ep, void *data)
> * we need to return ERR_PTR(-PROBE_DEFER) when there is no device.
> */
> if (con->fwnode)
> - return class_find_device(typec_class, NULL, con->fwnode,
> - typec_port_fwnode_match);
> + return class_find_device_by_fwnode(typec_class, con->fwnode);
>
> dev = class_find_device_by_name(typec_class, con->endpoint[ep]);
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index 9228502..52ac911 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -509,6 +509,19 @@ class_find_device_by_of_node(struct class *class, const struct device_node *np)
> return class_find_device(class, NULL, np, device_match_of_node);
> }
>
> +/**
> + * class_find_device_by_fwnode : device iterator for locating a particular device
> + * matching the fwnode.
> + * @class: class type
> + * @fwnode: fwnode of the device to match.
> + */
> +static inline struct device *
> +class_find_device_by_fwnode(struct class *class,
> + const struct fwnode_handle *fwnode)
> +{
> + return class_find_device(class, NULL, fwnode, device_match_fwnode);
> +}
> +
> struct class_attribute {
> struct attribute attr;
> ssize_t (*show)(struct class *class, struct class_attribute *attr,
> --
> 2.7.4
thanks,
--
heikki
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper
2019-06-14 17:54 ` [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper Suzuki K Poulose
@ 2019-06-21 11:02 ` Pavel Machek
2019-06-24 10:08 ` Alexandre Belloni
1 sibling, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2019-06-21 11:02 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: linux-kernel, gregkh, rafael, Alexander Shishkin,
Maxime Coquelin, Alessandro Zummo, Alexander Aring,
Alexandre Belloni, Dan Murphy, Heikki Krogerus, Heiko Carstens,
Jacek Anaszewski, linux-leds, linux-rtc, linux-usb, linux-wpan,
Martin Schwidefsky, Stefan Schmidt
[-- Attachment #1: Type: text/plain, Size: 431 bytes --]
On Fri 2019-06-14 18:54:07, Suzuki K Poulose wrote:
> Add a new wrapper for class_find_device() to search for devices
> by name and convert the existing users to use the new helper.
>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper
2019-06-14 17:54 ` [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper Suzuki K Poulose
2019-06-21 11:02 ` Pavel Machek
@ 2019-06-24 10:08 ` Alexandre Belloni
1 sibling, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2019-06-24 10:08 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: linux-kernel, gregkh, rafael, Alexander Shishkin,
Maxime Coquelin, Alessandro Zummo, Alexander Aring, Dan Murphy,
Heikki Krogerus, Heiko Carstens, Jacek Anaszewski, linux-leds,
linux-rtc, linux-usb, linux-wpan, Martin Schwidefsky,
Stefan Schmidt
On 14/06/2019 18:54:07+0100, Suzuki K Poulose wrote:
> Add a new wrapper for class_find_device() to search for devices
> by name and convert the existing users to use the new helper.
>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexander Aring <alex.aring@gmail.com>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Dan Murphy <dmurphy@ti.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Cc: linux-leds@vger.kernel.org
> Cc: linux-rtc@vger.kernel.org
> Cc: linux-usb@vger.kernel.org
> Cc: linux-wpan@vger.kernel.org
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Stefan Schmidt <stefan@datenfreihafen.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/hwtracing/stm/core.c | 9 +--------
> drivers/leds/led-class.c | 9 +--------
> drivers/rtc/interface.c | 11 +----------
> drivers/s390/crypto/zcrypt_api.c | 11 +----------
> drivers/usb/roles/class.c | 8 +-------
> drivers/usb/typec/class.c | 8 +-------
> include/linux/device.h | 12 ++++++++++++
> net/ieee802154/core.c | 7 +------
> 8 files changed, 19 insertions(+), 56 deletions(-)
>
> diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
> index e55b902..2b6bd42 100644
> --- a/drivers/hwtracing/stm/core.c
> +++ b/drivers/hwtracing/stm/core.c
> @@ -89,13 +89,6 @@ static struct class stm_class = {
> .dev_groups = stm_groups,
> };
>
> -static int stm_dev_match(struct device *dev, const void *data)
> -{
> - const char *name = data;
> -
> - return sysfs_streq(name, dev_name(dev));
> -}
> -
> /**
> * stm_find_device() - find stm device by name
> * @buf: character buffer containing the name
> @@ -116,7 +109,7 @@ struct stm_device *stm_find_device(const char *buf)
> if (!stm_core_up)
> return NULL;
>
> - dev = class_find_device(&stm_class, NULL, buf, stm_dev_match);
> + dev = class_find_device_by_name(&stm_class, buf);
> if (!dev)
> return NULL;
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 85848c5..317a619 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -216,13 +216,6 @@ static int led_resume(struct device *dev)
>
> static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume);
>
> -static int match_name(struct device *dev, const void *data)
> -{
> - if (!dev_name(dev))
> - return 0;
> - return !strcmp(dev_name(dev), (char *)data);
> -}
> -
> static int led_classdev_next_name(const char *init_name, char *name,
> size_t len)
> {
> @@ -233,7 +226,7 @@ static int led_classdev_next_name(const char *init_name, char *name,
> strlcpy(name, init_name, len);
>
> while ((ret < len) &&
> - (dev = class_find_device(leds_class, NULL, name, match_name))) {
> + (dev = class_find_device_by_name(leds_class, name))) {
> put_device(dev);
> ret = snprintf(name, len, "%s_%u", init_name, ++i);
> }
> diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
> index 4124f4d..1bee39c 100644
> --- a/drivers/rtc/interface.c
> +++ b/drivers/rtc/interface.c
> @@ -663,21 +663,12 @@ void rtc_update_irq(struct rtc_device *rtc,
> }
> EXPORT_SYMBOL_GPL(rtc_update_irq);
>
> -static int __rtc_match(struct device *dev, const void *data)
> -{
> - const char *name = data;
> -
> - if (strcmp(dev_name(dev), name) == 0)
> - return 1;
> - return 0;
> -}
> -
> struct rtc_device *rtc_class_open(const char *name)
> {
> struct device *dev;
> struct rtc_device *rtc = NULL;
>
> - dev = class_find_device(rtc_class, NULL, name, __rtc_match);
> + dev = class_find_device_by_name(rtc_class, name);
> if (dev)
> rtc = to_rtc_device(dev);
>
> diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
> index 1058b4b..38a5a47 100644
> --- a/drivers/s390/crypto/zcrypt_api.c
> +++ b/drivers/s390/crypto/zcrypt_api.c
> @@ -133,12 +133,6 @@ struct zcdn_device {
> static int zcdn_create(const char *name);
> static int zcdn_destroy(const char *name);
>
> -/* helper function, matches the name for find_zcdndev_by_name() */
> -static int __match_zcdn_name(struct device *dev, const void *data)
> -{
> - return strcmp(dev_name(dev), (const char *)data) == 0;
> -}
> -
> /* helper function, matches the devt value for find_zcdndev_by_devt() */
> static int __match_zcdn_devt(struct device *dev, const void *data)
> {
> @@ -152,10 +146,7 @@ static int __match_zcdn_devt(struct device *dev, const void *data)
> */
> static inline struct zcdn_device *find_zcdndev_by_name(const char *name)
> {
> - struct device *dev =
> - class_find_device(zcrypt_class, NULL,
> - (void *) name,
> - __match_zcdn_name);
> + struct device *dev = class_find_device_by_name(zcrypt_class, name);
>
> return dev ? to_zcdn_dev(dev) : NULL;
> }
> diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
> index f45d8df..07aaa96 100644
> --- a/drivers/usb/roles/class.c
> +++ b/drivers/usb/roles/class.c
> @@ -90,11 +90,6 @@ static int switch_fwnode_match(struct device *dev, const void *fwnode)
> return dev_fwnode(dev) == fwnode;
> }
>
> -static int switch_name_match(struct device *dev, const void *name)
> -{
> - return !strcmp((const char *)name, dev_name(dev));
> -}
> -
> static void *usb_role_switch_match(struct device_connection *con, int ep,
> void *data)
> {
> @@ -107,8 +102,7 @@ static void *usb_role_switch_match(struct device_connection *con, int ep,
> dev = class_find_device(role_class, NULL, con->fwnode,
> switch_fwnode_match);
> } else {
> - dev = class_find_device(role_class, NULL, con->endpoint[ep],
> - switch_name_match);
> + dev = class_find_device_by_name(role_class, con->endpoint[ep]);
> }
>
> return dev ? to_role_switch(dev) : ERR_PTR(-EPROBE_DEFER);
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 2eb6238..18a0687 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -210,11 +210,6 @@ static int typec_port_fwnode_match(struct device *dev, const void *fwnode)
> return dev_fwnode(dev) == fwnode;
> }
>
> -static int typec_port_name_match(struct device *dev, const void *name)
> -{
> - return !strcmp((const char *)name, dev_name(dev));
> -}
> -
> static void *typec_port_match(struct device_connection *con, int ep, void *data)
> {
> struct device *dev;
> @@ -227,8 +222,7 @@ static void *typec_port_match(struct device_connection *con, int ep, void *data)
> return class_find_device(typec_class, NULL, con->fwnode,
> typec_port_fwnode_match);
>
> - dev = class_find_device(typec_class, NULL, con->endpoint[ep],
> - typec_port_name_match);
> + dev = class_find_device_by_name(typec_class, con->endpoint[ep]);
>
> return dev ? dev : ERR_PTR(-EPROBE_DEFER);
> }
> diff --git a/include/linux/device.h b/include/linux/device.h
> index a449d09..bb14c7f 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -485,6 +485,18 @@ extern struct device *class_find_device(struct class *class,
> struct device *start, const void *data,
> int (*match)(struct device *, const void *));
>
> +/**
> + * class_find_device_by_name - device iterator for locating a particular device
> + * of a specific name.
> + * @class: class type
> + * @name: name of the device to match
> + */
> +static inline struct device *class_find_device_by_name(struct class *class,
> + const char *name)
> +{
> + return class_find_device(class, NULL, name, device_match_name);
> +}
> +
> struct class_attribute {
> struct attribute attr;
> ssize_t (*show)(struct class *class, struct class_attribute *attr,
> diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
> index 60b7ac5..de259b5 100644
> --- a/net/ieee802154/core.c
> +++ b/net/ieee802154/core.c
> @@ -23,11 +23,6 @@
> LIST_HEAD(cfg802154_rdev_list);
> int cfg802154_rdev_list_generation;
>
> -static int wpan_phy_match(struct device *dev, const void *data)
> -{
> - return !strcmp(dev_name(dev), (const char *)data);
> -}
> -
> struct wpan_phy *wpan_phy_find(const char *str)
> {
> struct device *dev;
> @@ -35,7 +30,7 @@ struct wpan_phy *wpan_phy_find(const char *str)
> if (WARN_ON(!str))
> return NULL;
>
> - dev = class_find_device(&wpan_phy_class, NULL, str, wpan_phy_match);
> + dev = class_find_device_by_name(&wpan_phy_class, str);
> if (!dev)
> return NULL;
>
> --
> 2.7.4
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-06-24 10:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com>
2019-06-14 17:54 ` [PATCH v2 07/28] drivers: Add generic helper to match by fwnode Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 08/28] drivers: Add generic helper to match by device type Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 10/28] drivers: Add generic helper to match by name Suzuki K Poulose
2019-06-14 17:54 ` [PATCH v2 12/28] drivers: Introduce class_find_device_by_name() helper Suzuki K Poulose
2019-06-21 11:02 ` Pavel Machek
2019-06-24 10:08 ` Alexandre Belloni
2019-06-14 17:54 ` [PATCH v2 14/28] drivers: Introduce class_find_device_by_fwnode() helper Suzuki K Poulose
2019-06-18 10:42 ` Heikki Krogerus
2019-06-14 17:54 ` [PATCH v2 19/28] drivers: Introduce bus_find_device_by_devt() helper Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).