From patchwork Fri Apr 30 06:50:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Malat X-Patchwork-Id: 1472000 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=Xl+PtcOb; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lwNBlUXy; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=malat-biz.20150623.gappssmtp.com header.i=@malat-biz.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=w4owkoPn; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FWjhw0F5vz9sVt for ; Fri, 30 Apr 2021 16:52:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc: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=FIKrJ05Z571EeuLS4Z5XqH9pp0qKzk4vkpPA3g26nu0=; b=Xl+PtcObWJimhuLUtrigGkD3gQ vrl4BRfkqrPCzuxFpIB5ucLtocF4rday8r6gH+ldavCnqkYJVFC8tP/mzz9NbygTvVsCCRhmkTv9R llJDSfZUJk/OYLBo/qwIVk9irvaaT4VlLSot6kxzD0uQ79KvQPDHfvl4f8a21b7yacRNbjzdM//wU 8uDmJ0VIgSWJvqlQ9xmbk09zpgXnvxWvc4tXYwqdnoPzUBvqS9mSUJCj/yBxCeL1VYg0IfFbnHrW7 uSTLfXT8A8fGBIS3cjxsv71Bx+wGnuMGXtSFaEBTZVQVWctCKcXXjWMZl18Zfped7NT56K4tCmVpA 6SKO/YoQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcMza-007Nc7-6B; Fri, 30 Apr 2021 06:51:14 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcMzX-007Nba-KY for linux-mtd@desiato.infradead.org; Fri, 30 Apr 2021 06:51:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=0KRfznZTuM/jO4ilqCKxhVprbr78chsM5VnvUKT2TZQ=; b=lwNBlUXysdJuw8rYa35xh6vois I7AsGb/XyqtGfOZaOliF7sjlBEJOD9GLDzcRXa5hyGUKoFGwbb1UcgjRN1EMLy+iVKYSXyLt+ky96 SrwNb1do5GT61XjvNLxNtfahuJt5w37VKA9a8Whi2O1kCJdpVdUS/rY1CWLcgFwY+Fq2UoitZwYGY XJEwqBIwQWwp7Ei5FVOStGraCFD84Es+7wNfx6815ejnc8wqpPG+RItUfLhwDqocoa0k3qsETKQPT xfzKC3bMlfDXgROX/CXAjcwiGskTQWM8cYDno+LfgPdvs4yMr0xA0nCAS5JzW3XvFcW/sxHV8w58g ttZAK5vQ==; Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcMzU-001BHU-QY for linux-mtd@lists.infradead.org; Fri, 30 Apr 2021 06:51:10 +0000 Received: by mail-wm1-x333.google.com with SMTP id s82so2129962wmf.3 for ; Thu, 29 Apr 2021 23:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=malat-biz.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0KRfznZTuM/jO4ilqCKxhVprbr78chsM5VnvUKT2TZQ=; b=w4owkoPn/X0937J/kiXHzvc2UhQDlqyTpaAsD65pbCF1GztVNQSLLB5Xd/bwWvm759 54jdp6IxJUJ+71BRiK5YgrJwskaP8znmlBn1ZQlEgsO5pCDsKuIntNAkBVrcQktyKeZm tzO46PTWRQytxyEWGUH6O3Wzysir4Ww5g4AyvRIFmKXfe0P7v7AhUbYXfOGaZggxaALm 95PBTd4xW9O/f5SOTlaGKtA9daQX4V6ZE4hBAYZd7clnk7wfhtYJAevx+Qibuy+s/pHK re+0Rei5xSUdzFIlyfV6KpBu66igG92f2EsqXhMfecOSEBqPCO48BcONhOG59VLiYH/s 2Rqw== 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:mime-version :content-transfer-encoding; bh=0KRfznZTuM/jO4ilqCKxhVprbr78chsM5VnvUKT2TZQ=; b=DW4rAjp2HxBVvKYVNHbsiFgES281YILtQ+YIOpEIkPCiZJJa5H5NwmVTgAq7UkGOxV BhXohR7BKi8+k48bCGzj7MQR3QiguXYUV6sfNLvoAoSC6lnVDroT8n+YYdIi6Z9IMcGs XLQ+2DAbVhN6r8cPpKNb5gZrkO5AaZrMZPC6IXFuFcpZp16Z/IyQ76hI6SCD0PS7FoSc iz/3bdCEcAU/6U2m/KsSTnaLQAu5Phk0qXJmOqFd+F5GhVXuogQQtZnl5Jloo6U+SiYZ qT/dBuiBCYpRZvZZkEk4aWSO7wTSno6pz4/TwNJQmLD3jphZiPPSsV8R7WEVDJxNmTAJ HIUw== X-Gm-Message-State: AOAM5337ok3Zo7vFeCewjkDUaCkDGxLL6c5FDaN0Di/jvqW7r0SenFmm QoMnjtzpztfO4IWLX7INRU0i8qMTnsS15P8f X-Google-Smtp-Source: ABdhPJy5Xq6xSXMN7bfPOa3YB1UZCXhKQV1X71wcoaQaSjen/ujAsYWl6UcpGantJXxa+hp9Qc8Y3A== X-Received: by 2002:a05:600c:4f14:: with SMTP id l20mr4449459wmq.150.1619765466070; Thu, 29 Apr 2021 23:51:06 -0700 (PDT) Received: from ntb.petris.klfree.czf (snat2.klfree.cz. [81.201.48.25]) by smtp.googlemail.com with ESMTPSA id d6sm1115174wrr.77.2021.04.29.23.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 23:51:05 -0700 (PDT) From: Petr Malat To: linux-mtd@lists.infradead.org Cc: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Petr Malat Subject: [PATCH] mtd: Create partname and partid debug files for child MTDs Date: Fri, 30 Apr 2021 08:50:57 +0200 Message-Id: <20210430065057.32018-1-oss@malat.biz> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_235108_917996_CAB29EF6 X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Partname and partid are set by the upper driver (spi-nor) on the master MTD. If this MTD is partitioned and CONFIG_MTD_PARTITIONED_MASTER is disabled, the master MTD is not instantiated and partname a [...] Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:333 listed in] [list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Partname and partid are set by the upper driver (spi-nor) on the master MTD. If this MTD is partitioned and CONFIG_MTD_PARTITIONED_MASTER is disabled, the master MTD is not instantiated and partname and partid aren't available to the userspace. Always read the partname and partid from the master MTD, they describe the HW, which can't differ between master and its children. Signed-off-by: Petr Malat --- drivers/mtd/mtdcore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 2d6423d89a17..66fa7f702174 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -361,6 +361,7 @@ static struct dentry *dfs_dir_mtd; static void mtd_debugfs_populate(struct mtd_info *mtd) { + struct mtd_info *master = mtd_get_master(mtd); struct device *dev = &mtd->dev; struct dentry *root; @@ -370,12 +371,12 @@ static void mtd_debugfs_populate(struct mtd_info *mtd) root = debugfs_create_dir(dev_name(dev), dfs_dir_mtd); mtd->dbg.dfs_dir = root; - if (mtd->dbg.partid) - debugfs_create_file("partid", 0400, root, mtd, + if (master->dbg.partid) + debugfs_create_file("partid", 0400, root, master, &mtd_partid_debug_fops); - if (mtd->dbg.partname) - debugfs_create_file("partname", 0400, root, mtd, + if (master->dbg.partname) + debugfs_create_file("partname", 0400, root, master, &mtd_partname_debug_fops); }