From patchwork Wed Oct 4 13:52:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 821316 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eyEw9JsQ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y6cn96qqCz9s7M for ; Thu, 5 Oct 2017 00:53:33 +1100 (AEDT) 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:References: In-Reply-To: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:List-Owner; bh=T2IqOKXG7YByGw37wkn5T3PpAYYd7YgwDEP6GwO7jxk=; b=eyEw9JsQDw5P4pk/HFX70UTFl/ F+PRrrFJt/46aTCISyDh0NtJO5ULsyXQUE5YzWaLMX4SqrBW7lwmudreY5IO7N00dZdigB8UFArQh wcjRG5YsvDnuIg4gjQfh3DN2wUKiQst2wzrlJHgSZWWbjmCLPfl7K/Ln43lmSfZ4nY509sOAPv0XF ogNwdNu/cXX20E5hk93loaeF9bR6Bb7iJ1b9wN3PdJqDTLgUgT5mL3j3XJmD9cXM8k3m/bLMBlzcV YtdkNcSnBpFWZHvGKK0l14QEtFeqX5/g3sR7Ne3s020tYqd71R2851nDHmF3JA1u7cf/ZTJHCTC+3 4w14KS4Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzk6z-0002Sz-VD; Wed, 04 Oct 2017 13:53:21 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzk6u-0002Qt-AR for linux-mtd@lists.infradead.org; Wed, 04 Oct 2017 13:53:18 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 5291520932; Wed, 4 Oct 2017 15:52:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 140202091E; Wed, 4 Oct 2017 15:52:42 +0200 (CEST) From: Boris Brezillon To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Cyrille Pitchen , linux-mtd@lists.infradead.org Subject: [PATCH 2/2] mtd: mtdpart: Create a symlink to the master debugfs dir Date: Wed, 4 Oct 2017 15:52:39 +0200 Message-Id: <20171004135239.16316-2-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171004135239.16316-1-boris.brezillon@free-electrons.com> References: <20171004135239.16316-1-boris.brezillon@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171004_065316_510304_3883A77A X-CRM114-Status: GOOD ( 13.27 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Mario J. Rugiero" MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It's sometime hard to figure out which master device is attached to an MTD partition, especially when this master device is not registered to the device model. Add a symlink to master's debugfs dir from the partition debugfs dir to help with that. Signed-off-by: Boris Brezillon --- drivers/mtd/mtdpart.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index a308e707392d..6f81acdd7f34 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -21,6 +21,7 @@ * */ +#include #include #include #include @@ -778,15 +779,18 @@ int add_mtd_partitions(struct mtd_info *master, { struct mtd_part *slave; uint64_t cur_offset = 0; - int i; + int ret = 0, i; + char *link; printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); + link = kasprintf(GFP_KERNEL, "../%s", dev_name(&master->dev)); for (i = 0; i < nbparts; i++) { slave = allocate_partition(master, parts + i, i, cur_offset); if (IS_ERR(slave)) { del_mtd_partitions(master); - return PTR_ERR(slave); + ret = PTR_ERR(slave); + break; } mutex_lock(&mtd_partitions_mutex); @@ -798,10 +802,13 @@ int add_mtd_partitions(struct mtd_info *master, if (parts[i].types) mtd_parse_part(slave, parts[i].types); + debugfs_create_symlink("master", slave->mtd.dbg.dfs_dir, link); cur_offset = slave->offset + slave->mtd.size; } - return 0; + kfree(link); + + return ret; } static DEFINE_SPINLOCK(part_parser_lock);