[SRU][B][PATCH 07/10] serdev: only match serdev devices
Shrirang Bagul
shrirang.bagul at canonical.com
Fri Feb 21 06:41:24 UTC 2020
From: Johan Hovold <johan at kernel.org>
BugLink: https://bugs.launchpad.net/bugs/1864147
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).
linux-oem buglink: http://bugs.launchpad.net/bugs/1769610
Signed-off-by: Johan Hovold <johan at kernel.org>
Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit 7ee69102dbc4eea90f46a24f16961226a477dd4c)
Signed-off-by: Shrirang Bagul <shrirang.bagul at canonical.com>
Signed-off-by: AceLan Kao <acelan.kao at canonical.com>
(cherry picked from commit fbb158de77a91db97d05ac367ccf51136a30addc)
(source tag: Ubuntu-oem-4.15.0-1073.83)
Signed-off-by: Shrirang Bagul <shrirang.bagul at canonical.com>
---
drivers/tty/serdev/core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 340204257e98..845f766c7169 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 = {
.release = serdev_device_release,
};
+static bool is_serdev_device(const struct device *dev)
+{
+ return dev->type == &serdev_device_type;
+}
+
static void serdev_ctrl_release(struct device *dev)
{
struct serdev_controller *ctrl = to_serdev_controller(dev);
@@ -76,6 +81,9 @@ static const struct device_type serdev_ctrl_type = {
static int serdev_device_match(struct device *dev, struct device_driver *drv)
{
+ if (!is_serdev_device(dev))
+ return 0;
+
/* TODO: platform matching */
if (acpi_driver_match_device(dev, drv))
return 1;
--
2.17.1
More information about the kernel-team
mailing list