From patchwork Tue Jun 19 20:59:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 10475439 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 A0F20601D7 for ; Tue, 19 Jun 2018 20:59:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E5192877E for ; Tue, 19 Jun 2018 20:59:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81ABD28C27; Tue, 19 Jun 2018 20:59:38 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 313512877E for ; Tue, 19 Jun 2018 20:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Lf+BgDqV7x0WAVEub6mgNPJawiXubmckfT7/CObXbaM=; b=MUH NJZsob5P+rjoELHzKGt2oGTywD+PX0Cs/RbgrJxQ3ZpONRL0FDyy8QfAxqsIJacCSf2lnBLVIznR/ 2dgVLQYSbLw0rAjPUbkhT2BsEP9IGFIebPIZfb5hHPC4BwnzRNEx4VINJwKF1N3ZgXmnDCYN2oSTW 8PoauQOQQyW7obqO1OFVYs6z/bK+fPd7GIH5pBlWRoBosZqzJ1Y4WimkYbpjxgYYadARG8Ksaujvv CNhBrsyNN9V8g13q3V73fnlfIoggiWLhB1GZgV25jO1Ys4R4nGAHuHUATomLHFxw90hgNMGuoKDvW uBLGq+aUE/l68P3Un7rEXp4mQgzVhNQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVNiu-0006WE-4Y; Tue, 19 Jun 2018 20:59:32 +0000 Received: from mail-wm0-f68.google.com ([74.125.82.68]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVNiq-0006Uk-OL for linux-arm-kernel@lists.infradead.org; Tue, 19 Jun 2018 20:59:30 +0000 Received: by mail-wm0-f68.google.com with SMTP id o13-v6so2500613wmf.4 for ; Tue, 19 Jun 2018 13:59:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mjYHSJbe8beWgs7as0mUAtGZ5vsVj/kppDBdnF8dUmI=; b=jrbB6mpfYVwcOuJxkKkd0pEw+zP22lP6zN7ScXhO3k7MdSIpDX6dfRWQUOfRCzn2+C unm4AOoBGXnt8EnZtQGdUquhC9SH/sAhJNzpNBBnqs//ha0yMfNJqpfKe16i0q6Jm9Lz lSPvihG2hnfX2WJgTIWSGdL8VEwVK57QQGVutI0407tNCx/uZkkCTtrlbKwIBrkEVVq6 uuGkmKw1+baISnV0IbALF5vyR0/fK45Bp35KS0kmFD7abz5NK+kcjjaawiXiOfd7TVQq 1RQhK0vq1yG716IRDC/EV35DF8IBUrG7Ao1K20t0RtHb9YkUFMZnd2ddafED0NMg7Y3w yhYg== X-Gm-Message-State: APt69E0lqLbPkWZPz11Ar1IUUUcyHIo/OZiWLmEwrJ3ZXyfm3QhQbS+t 6V4G7ZhtRhOvytOEcJgITfIm6Q== X-Google-Smtp-Source: ADUXVKJ3OddB2fw0ENv1n/k8NWIPeHLJANU2ErgZVkLXbFPXuNs8VpSlklkchMv0fKfj/h5hyQs85g== X-Received: by 2002:a1c:e6d9:: with SMTP id e86-v6mr12002302wmi.135.1529441957190; Tue, 19 Jun 2018 13:59:17 -0700 (PDT) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id k17-v6sm1431150wmc.23.2018.06.19.13.59.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 13:59:16 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH] driver core: add a debugfs entry to show deferred devices Date: Tue, 19 Jun 2018 22:59:14 +0200 Message-Id: <20180619205914.21375-1-javierm@redhat.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180619_135928_787538_AF913388 X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Tomeu Vizoso , Greg Kroah-Hartman , Javier Martinez Canillas , Andy Shevchenko , Mark Brown , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP For debugging purposes it may be useful to know what are the devices whose probe function was deferred. Add a debugfs entry showing that information. $ cat /sys/kernel/debug/deferred_devices 48070000.i2c:twl@48:bci musb-hdrc.0.auto omapdrm.0 Signed-off-by: Javier Martinez Canillas Reviewed-by: Andy Shevchenko --- Changes since RFC v1: - Remove unneeded ret variable from deferred_devs_show() Changes since RFC v2: - Use DEFINE_SHOW_ATTRIBUTE() macro. - Don't propagate debugfs_create_file() error. - Remove IS_ENABLED(CONFIG_DEBUG_FS) guards. - Drop RFC prefix. drivers/base/dd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 1435d7281c6..8ec9e3cfbe4 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -16,6 +16,7 @@ * Copyright (c) 2007-2009 Novell Inc. */ +#include #include #include #include @@ -224,6 +225,24 @@ void device_unblock_probing(void) driver_deferred_probe_trigger(); } +/* + * deferred_devs_show() - Show the devices in the deferred probe pending list. + */ +static int deferred_devs_show(struct seq_file *s, void *data) +{ + struct device_private *curr; + + mutex_lock(&deferred_probe_mutex); + + list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe) + seq_printf(s, "%s\n", dev_name(curr->device)); + + mutex_unlock(&deferred_probe_mutex); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(deferred_devs); + /** * deferred_probe_initcall() - Enable probing of deferred devices * @@ -233,6 +252,9 @@ void device_unblock_probing(void) */ static int deferred_probe_initcall(void) { + debugfs_create_file("deferred_devices", 0444, NULL, NULL, + &deferred_devs_fops); + driver_deferred_probe_enable = true; driver_deferred_probe_trigger(); /* Sort as many dependencies as possible before exiting initcalls */