From patchwork Tue Jun 19 18:20:51 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: 10475185 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 4F33E60230 for ; Tue, 19 Jun 2018 18:26:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4191228913 for ; Tue, 19 Jun 2018 18:26:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34B8F28CBB; Tue, 19 Jun 2018 18:26:41 +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 E73FD28913 for ; Tue, 19 Jun 2018 18:26:40 +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=GFD+KSKYNR3NLtagUuenwB1TB3gpL5qaaJ/IrlCpFtY=; b=NIW aV59ln2plzDM+dWAOeP5LXkvwJTpaF/irnXFDq8DcyuSgzxMMp2LaQsn8xcab7R/IliDYhq4oGnfQ zcG6qcEN3ByReVWvv5xRxtIGADLH2orS9LUyz64LaJ9WVQpL4jr79C0ZBscTpStxXXfci/U8Pv1ty bUVcgjOtYb8MQUK34VyT+xyQ+RrPkknxTN2nDF9ubjJKxeJZGGA5qW1lH9FPVZX7gYkSpOowzRE+a H0VEsT1zIj/YYGigeiUyi/JZ7+TpC+b5GTkwDTCHGxEWE802R+83SKaEmlOlmoty55eZbBs/tRPgC lfmRvb0Uw4DK3c6sF1W7vtG/T3uOq6w==; 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 1fVLKs-0006E2-Qs; Tue, 19 Jun 2018 18:26:34 +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 1fVLKp-0006DA-9p for linux-arm-kernel@lists.infradead.org; Tue, 19 Jun 2018 18:26:33 +0000 Received: by mail-wr0-f195.google.com with SMTP id h10-v6so620990wrq.8 for ; Tue, 19 Jun 2018 11:26:20 -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=F2OcYT/MOlc0iq2dBErH7pItRAqGbgn8aaiSWnOr4PU=; b=ZFXlpBiB0ChagXUKUZ6uGi9YphSkMZRw9EKlGXvSgDw74R91gExzulz1W/okzRu6qU Tpqa+8ybxcmUe90hqpWUdW0A/3Uk7e+iqvcNfLTXpMTgfzo1+pQ+HU9QHW7+C+DCTGSe wOAOiKbAZh4hwTrXjGgSwe/vsTv5M1EOnQMQ6cGzXQWx50jNARExDe9zH5kH+KgGttxb tBYxrvhXyvpRO2ZaPiI3TJhOnne0SaAB6ZiJSGDvaSi3DbaudpjbcZajRzpYr7OaCtBQ R3nVAuATXopq3ZTby0hTo6Z1qpEvRzSl/roTun3hhaa61htCCvdbZ0YM5RgX+jSai37B xRDQ== X-Gm-Message-State: APt69E2NH5HFMYbtruYvFgNKgjN6/pjy4A9f9kk/n9jBE78ZLeUloWWz Ujtwl2ghvrv/zt/mBVp4uA1Sfw== X-Google-Smtp-Source: ADUXVKJxY5IiyzcoEB0BkTPu78CrJFupW0CYeW6PgL1EBg0OO8h2T7nxWdQRMCYh10B1ztSPYA9Pdg== X-Received: by 2002:adf:878c:: with SMTP id b12-v6mr15708251wrb.92.1529432463497; Tue, 19 Jun 2018 11:21:03 -0700 (PDT) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id l84-v6sm1060216wmi.3.2018.06.19.11.21.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 11:21:02 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [RFC PATCH] driver core: add a debugfs entry to show deferred devices Date: Tue, 19 Jun 2018 20:20:51 +0200 Message-Id: <20180619182051.26478-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_112631_340895_8C942E98 X-CRM114-Status: GOOD ( 12.68 ) 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 --- drivers/base/dd.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 1435d7281c6..98a3ab4a852 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -224,6 +224,43 @@ 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; + int ret = 0; + + 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 ret; +} + +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 +270,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 */