From patchwork Thu Feb 22 17:42:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 10236033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22414602DC for ; Thu, 22 Feb 2018 17:43:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BDDF23E64 for ; Thu, 22 Feb 2018 17:43:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1058726212; Thu, 22 Feb 2018 17:43:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9798923E64 for ; Thu, 22 Feb 2018 17:42:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 693CC6EF10; Thu, 22 Feb 2018 17:42:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7A296EF10 for ; Thu, 22 Feb 2018 17:42:54 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1MHgpNt013171; Thu, 22 Feb 2018 11:42:51 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519321371; bh=GYPFf+g7mPbL950Wqb278iQmQrAOrou6+DGSUrs1L9I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=hSy89EaG0mane4GDC8axaJfWv9OxAxt2bwY4TVVwWbgqhZwVOBStp7qEgUBBQF9rw LbLeh6Ku/NnfcADUD/zvnL2Mo9sJ6wuOCb7QO5NLAPCHDk9GS/8B30VvXradyqS3rO MnD9DiW4DmiJI6sFKR/H1LANCdYHuPU68M2H34Ek= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1MHgpee013187; Thu, 22 Feb 2018 11:42:51 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 22 Feb 2018 11:42:50 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Thu, 22 Feb 2018 11:42:50 -0600 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1MHgmx9007912; Thu, 22 Feb 2018 11:42:49 -0600 From: Jyri Sarha To: , Subject: [PATCH RFC] driver core: Reprobe consumer if it was unbound by dropped device_link Date: Thu, 22 Feb 2018 19:42:46 +0200 Message-ID: <57c1d52a5a8f5985dc1dd53260d7d68795be8ea2.1519321145.git.jsarha@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregkh@linuxfoundation.org, "Rafael J . Wysocki" , Jyri Sarha , tomi.valkeinen@ti.com, thierry.reding@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Put consumer device to deferred probe list if it is unbound due to a dropped link to a supplier. When a device link supplier is unbound (either manually or because one of its own suppliers was unbound), its consumers are unbound as well. Currently if the supplier binds again after this the consumer does not automatically probe again. With this patch it does. If this patch is not acceptable as such, how about adding this behavior behind a new device link flag? The idea to this patch was gotten from this post by Lucas Wunner: https://www.spinics.net/lists/dri-devel/msg166318.html Part of the code and the description is borrowed from him. cc: Lukas Wunner cc: Rafael J. Wysocki cc: Thierry Reding Signed-off-by: Jyri Sarha --- drivers/base/base.h | 1 + drivers/base/core.c | 2 ++ drivers/base/dd.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/base/base.h b/drivers/base/base.h index d800de6..39370eb 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev, extern void driver_detach(struct device_driver *drv); extern int driver_probe_device(struct device_driver *drv, struct device *dev); +extern void driver_deferred_probe_add(struct device *dev); extern void driver_deferred_probe_del(struct device *dev); static inline int driver_match_device(struct device_driver *drv, struct device *dev) diff --git a/drivers/base/core.c b/drivers/base/core.c index b2261f9..0964ed5 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev) device_release_driver_internal(consumer, NULL, consumer->parent); + driver_deferred_probe_add(consumer); + put_device(consumer); goto start; } diff --git a/drivers/base/dd.c b/drivers/base/dd.c index de6fd09..846ae78 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) } static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func); -static void driver_deferred_probe_add(struct device *dev) +void driver_deferred_probe_add(struct device *dev) { mutex_lock(&deferred_probe_mutex); if (list_empty(&dev->p->deferred_probe)) {