[RFC PATCH 35/57] drivers: core: Reuse generic match by device type helper

From: Suzuki K Poulose
Date: Mon Jun 03 2019 - 11:55:44 EST


Use the generic helper to match the device type of a given device.

Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
drivers/base/core.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 731baac..69cba57 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2839,13 +2839,6 @@ struct device *device_create_with_groups(struct class *class,
}
EXPORT_SYMBOL_GPL(device_create_with_groups);

-static int __match_devt(struct device *dev, const void *data)
-{
- const dev_t *devt = data;
-
- return dev->devt == *devt;
-}
-
/**
* device_destroy - removes a device that was created with device_create()
* @class: pointer to the struct class that this device was registered with
@@ -2858,7 +2851,7 @@ void device_destroy(struct class *class, dev_t devt)
{
struct device *dev;

- dev = class_find_device(class, NULL, &devt, __match_devt);
+ dev = class_find_device_by_devt(class, NULL, devt);
if (dev) {
put_device(dev);
device_unregister(dev);
--
2.7.4