From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757305AbeAHMnC (ORCPT + 1 other); Mon, 8 Jan 2018 07:43:02 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:42625 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756727AbeAHMm5 (ORCPT ); Mon, 8 Jan 2018 07:42:57 -0500 X-Google-Smtp-Source: ACJfBoudnVcde07kJf61lLnviFBC2FG28jR/V4hhggp5j0BuB5PuAu3ecDHKgMf+N4+pkQPq4kkS4g== From: Johan Hovold To: Rob Herring , Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= , Johan Hovold Subject: [PATCH 2/2] serdev: only match serdev devices Date: Mon, 8 Jan 2018 13:42:33 +0100 Message-Id: <20180108124233.26729-3-johan@kernel.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108124233.26729-1-johan@kernel.org> References: <20180108124233.26729-1-johan@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 --- 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 61c85e49e178..a30e237eb98c 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.15.1