diff options
author | Johan Hovold <johan@kernel.org> | 2018-01-09 11:09:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-22 08:19:10 -0500 |
commit | 7ee69102dbc4eea90f46a24f16961226a477dd4c (patch) | |
tree | c00b7db06a656fabb01d33b1ea926b1a93554585 | |
parent | 2460942f51f1f262e77072c9a7c963a1b047a367 (diff) |
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>
-rw-r--r-- | drivers/tty/serdev/core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index c8c43834477b..f710862f5c06 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c | |||
@@ -63,6 +63,11 @@ static const struct device_type serdev_device_type = { | |||
63 | .release = serdev_device_release, | 63 | .release = serdev_device_release, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static bool is_serdev_device(const struct device *dev) | ||
67 | { | ||
68 | return dev->type == &serdev_device_type; | ||
69 | } | ||
70 | |||
66 | static void serdev_ctrl_release(struct device *dev) | 71 | static void serdev_ctrl_release(struct device *dev) |
67 | { | 72 | { |
68 | struct serdev_controller *ctrl = to_serdev_controller(dev); | 73 | struct serdev_controller *ctrl = to_serdev_controller(dev); |
@@ -76,6 +81,9 @@ static const struct device_type serdev_ctrl_type = { | |||
76 | 81 | ||
77 | static int serdev_device_match(struct device *dev, struct device_driver *drv) | 82 | static int serdev_device_match(struct device *dev, struct device_driver *drv) |
78 | { | 83 | { |
84 | if (!is_serdev_device(dev)) | ||
85 | return 0; | ||
86 | |||
79 | /* TODO: platform matching */ | 87 | /* TODO: platform matching */ |
80 | if (acpi_driver_match_device(dev, drv)) | 88 | if (acpi_driver_match_device(dev, drv)) |
81 | return 1; | 89 | return 1; |