Skip to content

Commit

Permalink
serdev: only match serdev devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Jan 22, 2018
1 parent 2460942 commit 7ee6910
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/tty/serdev/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 7ee6910

Please sign in to comment.