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: 129302 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp851064lja; Thu, 22 Feb 2018 09:42:56 -0800 (PST) X-Google-Smtp-Source: AH8x2269icCEjz/i8cWLA5JeJLrT0oY8U3tQb24CyikUiQn1G3pC9Cpedhygga5oboguH2QZVULC X-Received: by 10.99.96.145 with SMTP id u139mr6330883pgb.110.1519321376645; Thu, 22 Feb 2018 09:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519321376; cv=none; d=google.com; s=arc-20160816; b=cJj1HzNphpWxwKi3aRa3QuN4sz8wM8oqRg4XQZ5kd8INNzxBM0aOk6YoTrqR1bvKJY +RilwN7AIdYt83gDXtLin220xv0wVQAF3m9GqqVOLXcbTk2Tbp0VQPHXSwcpIoivOXYO gcLycA6dUWGY5nx2bbPPH9GBlryctH1dITWQzCav/AiZbFwKv9lqqa/XnEZZeP+SQaM+ gTbbYHCTwyrWQcgJTkVWM10zQlUaB3ErTgJ8BCp2s3W1ab5B9scgg0l71/0fY3JVIefd kata8iGH/VsFcdNrWe5jIFinaQTSrRVU37Siz9hh/OYhePvxjjvULt0uhCs6GqqCLe9a /jag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=Mn3FXPunq0RiHzQzz5WLuJIzaldN0INYgmQ8CfMxADM=; b=MF2aqpzohPw9SSQ7LE+HNDMhhgj6nJUWn+YG2YYKFxDQvrLv8CFkMyXJIxtdn5NMk8 3r1rh54dL/GcDRLDiiKkHwvJz2qZUFmllC7wfVEV4v7a3mSdRt5ClhfQblLqtveXWDbk fYd4gC7kLv5Of5hqWbHobQSXKHpz5aauVc8yQDgpj35wzxXA4646nvozcB06QfFwqu0q EEO7v/vn/FBs1n6kA9eNYavwGCPUxLyBbj786J8abHW+F33ROhvlfP+vjyZJhkrLlgaY o9+ArmvxZJ97UVuYxWHl4qBUsXT5FS02VGNQdXVrEMpYu2c7NIUJEcx6hYrRbAoIlmin o67w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=hSy89EaG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id k6si298162pgp.709.2018.02.22.09.42.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Feb 2018 09:42:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=hSy89EaG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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" 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)) {