From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2307C04AB6 for ; Mon, 3 Jun 2019 07:23:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A72F27C97 for ; Mon, 3 Jun 2019 07:23:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f/rv/fgb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A72F27C97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DdoFfU0SbdbE6suX0Aykswt/13nDD4UH/5ELs/vbt9E=; b=f/rv/fgbVs97/1 OHj1QEqFkEt5olS7zxPv+Ord+5t+ta8EfLzvuAe37NQPW9G+du7/aWCQYgZSvCVNKy+vlen5ghrzn +AWD2VoDk4mtGKmzZXS/LZJIwEbX0/a/evdAJpei63jHZPX2QA1XrLQ7OQAx533CdbMxnQLWJfRg9 2iYJwmOmpJcQ3+m5iHTijG6iIcNtXvCAAdaUQMIqFzxAfPHZL7xA/yLt5fvm1T69l3RxKXASsAyvE 3X0MJkCMwaxk5Na6VYStZ3EYTcxVh1p4Nt3dMkLv2YRvA/rtisrYqIPTv8cECg4IVEN+KgqW7lU3n xpd0zMwyT+uL1hnWBiqg==; 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 1hXhJY-0007hK-Q7; Mon, 03 Jun 2019 07:23:28 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hXhJW-0007h1-Ld for linux-mtd@lists.infradead.org; Mon, 03 Jun 2019 07:23:28 +0000 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id DE88326D296; Mon, 3 Jun 2019 08:23:24 +0100 (BST) Date: Mon, 3 Jun 2019 09:23:21 +0200 From: Boris Brezillon To: Zhuohao Lee Subject: Re: [PATCH v5 2/2] mtd: spi-nor: enable the debugfs for the partname and partid Message-ID: <20190603092321.3a8f1c7f@collabora.com> In-Reply-To: <20190603031451.60749-2-zhuohao@chromium.org> References: <20190603031451.60749-1-zhuohao@chromium.org> <20190603031451.60749-2-zhuohao@chromium.org> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190603_002326_833870_F2DD0EB9 X-CRM114-Status: GOOD ( 18.22 ) 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: drinkcat@chromium.org, bbrezillon@kernel.org, richard@nod.at, briannorris@chromium.org, marek.vasut@gmail.com, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, dwmw2@infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, 3 Jun 2019 11:14:51 +0800 Zhuohao Lee wrote: > This patch adds spi_nor_debugfs_init() for the debugfs initialization. > With this patch, we can read the partname and partid through the > debugfs. > > The output of new debugfs nodes on my device are: > cat /sys/kernel/debug/mtd/mtd0/partid > spi-nor:ef6017 > cat /sys/kernel/debug/mtd/mtd0/partname > w25q64dw > > Signed-off-by: Zhuohao Lee > --- > drivers/mtd/spi-nor/spi-nor.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c > index 6e13bbd1aaa5..acc1915b380b 100644 > --- a/drivers/mtd/spi-nor/spi-nor.c > +++ b/drivers/mtd/spi-nor/spi-nor.c > @@ -3935,6 +3935,18 @@ static void spi_nor_resume(struct mtd_info *mtd) > dev_err(dev, "resume() failed\n"); > } > > +static void spi_nor_debugfs_init(struct spi_nor *nor, > + const struct flash_info *info) > +{ > + struct mtd_info *mtd = &nor->mtd; > + > + mtd->dbg.partname = info->name; > + if (!mtd->dbg.partid) Hm, how can this happen? I'd expect mtd->dbg.partid to always be NULL when you reach that point. If that's not the case there's probably a bug somewhere. > + mtd->dbg.partid = devm_kasprintf(nor->dev, GFP_KERNEL, > + "spi-nor:%*phN", > + info->id_len, info->id); > +} > + > void spi_nor_restore(struct spi_nor *nor) > { > /* restore the addressing mode */ > @@ -4036,6 +4048,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, > mtd->_read = spi_nor_read; > mtd->_resume = spi_nor_resume; > > + spi_nor_debugfs_init(nor, info); > + > /* NOR protection support for STmicro/Micron chips and similar */ > if (JEDEC_MFR(info) == SNOR_MFR_ST || > JEDEC_MFR(info) == SNOR_MFR_MICRON || ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/