}
 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
 
 }
 EXPORT_SYMBOL_GPL(device_set_of_node_from_dev);
 
+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_of_node(struct device *dev, const void *np)
 {
        return dev->of_node == np;
 
        .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
        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;
 
 
 
 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)
 {
        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);
        }
 
 }
 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);
 
 
 }
 EXPORT_SYMBOL(ccwgroup_driver_unregister);
 
-static int __ccwgroupdev_check_busid(struct device *dev, const void *id)
-{
-       const char *bus_id = id;
-
-       return (strcmp(bus_id, dev_name(dev)) == 0);
-}
-
 /**
  * get_ccwgroupdev_by_busid() - obtain device from a bus id
  * @gdrv: driver the device is owned by
 {
        struct device *dev;
 
-       dev = driver_find_device(&gdrv->driver, NULL, bus_id,
-                                __ccwgroupdev_check_busid);
+       dev = driver_find_device_by_name(&gdrv->driver, bus_id);
 
        return dev ? to_ccwgroupdev(dev) : NULL;
 }
 
 EXPORT_SYMBOL_GPL(ccw_device_force_console);
 #endif
 
-/*
- * get ccw_device matching the busid, but only if owned by cdrv
- */
-static int
-__ccwdev_check_busid(struct device *dev, const void *id)
-{
-       const char *bus_id = id;
-
-       return (strcmp(bus_id, dev_name(dev)) == 0);
-}
-
-
 /**
  * get_ccwdev_by_busid() - obtain device from a bus id
  * @cdrv: driver the device is owned by
 {
        struct device *dev;
 
-       dev = driver_find_device(&cdrv->driver, NULL, (void *)bus_id,
-                                __ccwdev_check_busid);
+       dev = driver_find_device_by_name(&cdrv->driver, bus_id);
 
        return dev ? to_ccwdev(dev) : NULL;
 }
 
 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)
 {
  */
 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;
 }
 
        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)
 {
                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);
 
        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;
                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);
 }
 
 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
 void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
 
+int device_match_name(struct device *dev, const void *name);
 int device_match_of_node(struct device *dev, const void *np);
 
 int bus_for_each_dev(struct bus_type *bus, struct device *start, 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,
                                  struct device *start, const void *data,
                                  int (*match)(struct device *dev, const void *data));
 
+/**
+ * driver_find_device_by_name - device iterator for locating a particular device
+ * of a specific name.
+ * @driver: the driver we're iterating
+ * @name: name of the device to match
+ */
+static inline struct device *driver_find_device_by_name(struct device_driver *drv,
+                                                       const char *name)
+{
+       return driver_find_device(drv, NULL, name, device_match_name);
+}
+
 void driver_deferred_probe_add(struct device *dev);
 int driver_deferred_probe_check_state(struct device *dev);
 int driver_deferred_probe_check_state_continue(struct device *dev);
                                        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,
 
 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;
        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;