From patchwork Tue Jun 19 18:33:56 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: 10475189 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 3D2A960230 for ; Tue, 19 Jun 2018 18:34:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2927828CCD for ; Tue, 19 Jun 2018 18:34:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A7A328CCF; Tue, 19 Jun 2018 18:34:22 +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=unavailable 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 BC28D28CCD for ; Tue, 19 Jun 2018 18:34:21 +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=fZy4kKS6O7Yxd9Etpw8mIelYkFPlgBN+gOmRIfTWZ8w=; b=RSF 0LeODncbS4z2a7Km+1CKknyBgxHgGXAfp0EdVMnYMdNnH2ldvtDOlWuQReYGrcktQKsbXZ2/Hgvc/ FSryxhzfNLvhiHMnkok9yw2+zdrNRooA+l4Jm0euaAWRsnEEa5izfVorTBxzjEhMIOfws9UNRu3BW C+4ybBX/9AajB7xq3XApUCNpM1nub+AABB6Dr+CGTxOTPmeSlX3Bv5t+C/YlvYGEpGa97g6xaSOEJ KkoaxRKGxr7kMb8hyDl2nXBjsj+tV7Nxe5890XfQGjFar2beZDWSzZVd+LwZ7c25+TrYlGr+9tWYJ UaF9gbqWwTZTDezaLvPuGd6BAR8VdUA==; 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 1fVLSH-00008M-Lb; Tue, 19 Jun 2018 18:34:13 +0000 Received: from mail-wr0-f195.google.com ([209.85.128.195]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVLSE-00007k-DP for linux-arm-kernel@lists.infradead.org; Tue, 19 Jun 2018 18:34:11 +0000 Received: by mail-wr0-f195.google.com with SMTP id d8-v6so659924wro.4 for ; Tue, 19 Jun 2018 11:34:00 -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=QtxUyfLucKOe/dBeI7a/kfctRhipQUIczmfKo7SJ/bY=; b=WGxaZzajVwi1Wp0DBL54Ey63F+utnoUT2pPTa1adBuLnpMl0LSNrTzjGNcijWQEsDX 56tKE8zdfcg2T/Hh8j2xi8lKFfH+46oBbZXdht7kFzb4J1p4hraNytohX4mQ4lr9YIhF 6FWhPb5j1y0etnPtcHv5jrAM8/NKYkCwNs/Uux/vHhU4CSNLM/WQ/rw3wJ8S3p8AIV3Q IUAtY8rVMRl4bHQnhiLMPzASFt3CxSnv3Tp1JrdA0LpJYBWHpTBNIzvBpU4DfdZaMmTn epLWOY4b7Tq2+p9OC2L2LMGLKKP1J1o9DA/ODKynZq5JRxQL8CGlNoeawS8djmQivzXf 5/qQ== X-Gm-Message-State: APt69E1E4armZHNBiCCC7FfkIAlnN2f6F7rJVCY1gj6G9OXdNXyRIROc 6RWt89Ugp3/I3Cp0gHfgeBQfoA== X-Google-Smtp-Source: ADUXVKJICeqJHg7CCYgoyqQ9FGWSYLnvlOYQl+nNTyI88WXHz1a+UDt9kqqRy9hFtVGt2pa0jTa4Ow== X-Received: by 2002:adf:ee0e:: with SMTP id y14-v6mr15950700wrn.63.1529433239000; Tue, 19 Jun 2018 11:33:59 -0700 (PDT) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id 127-v6sm1040104wmk.45.2018.06.19.11.33.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 11:33:58 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v2] driver core: add a debugfs entry to show deferred devices Date: Tue, 19 Jun 2018 20:33:56 +0200 Message-Id: <20180619183356.32106-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_113410_452466_E75EF64F X-CRM114-Status: GOOD ( 12.65 ) 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 , 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 --- Changes in v2: - Remove unneeded ret variable from deferred_devs_show() drivers/base/dd.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 1435d7281c6..d95bd4636fc 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -224,6 +224,42 @@ void device_unblock_probing(void) driver_deferred_probe_trigger(); } +#if IS_ENABLED(CONFIG_DEBUG_FS) +#include + +static struct dentry *deferred_devices; + +/* + * 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; +} + +static int deferred_devs_open(struct inode *inode, struct file *file) +{ + return single_open(file, deferred_devs_show, inode->i_private); +} + +static const struct file_operations deferred_devs_fops = { + .owner = THIS_MODULE, + .open = deferred_devs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +#endif /* IS_ENABLED(CONFIG_DEBUG_FS) */ + /** * deferred_probe_initcall() - Enable probing of deferred devices * @@ -233,6 +269,14 @@ void device_unblock_probing(void) */ static int deferred_probe_initcall(void) { + if (IS_ENABLED(CONFIG_DEBUG_FS)) { + deferred_devices = debugfs_create_file("deferred_devices", + 0444, NULL, NULL, + &deferred_devs_fops); + if (!deferred_devices) + return -ENOMEM; + } + driver_deferred_probe_enable = true; driver_deferred_probe_trigger(); /* Sort as many dependencies as possible before exiting initcalls */