Skip to content

Commit 7ee6910

Browse files
jhovoldgregkh
authored andcommitted
serdev: only match serdev devices
Only serdev devices (a.k.a. clients or slaves) are bound to drivers so bail out early from match() in case the device is not a serdev device (i.e. if it's a serdev controller). Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2460942 commit 7ee6910

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/tty/serdev/core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ static const struct device_type serdev_device_type = {
6363
.release = serdev_device_release,
6464
};
6565

66+
static bool is_serdev_device(const struct device *dev)
67+
{
68+
return dev->type == &serdev_device_type;
69+
}
70+
6671
static void serdev_ctrl_release(struct device *dev)
6772
{
6873
struct serdev_controller *ctrl = to_serdev_controller(dev);
@@ -76,6 +81,9 @@ static const struct device_type serdev_ctrl_type = {
7681

7782
static int serdev_device_match(struct device *dev, struct device_driver *drv)
7883
{
84+
if (!is_serdev_device(dev))
85+
return 0;
86+
7987
/* TODO: platform matching */
8088
if (acpi_driver_match_device(dev, drv))
8189
return 1;

0 commit comments

Comments
 (0)