From patchwork Fri Apr 17 15:11:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 26124 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 47C91B7067 for ; Sat, 18 Apr 2009 01:13:34 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LupjO-0003zE-MB; Fri, 17 Apr 2009 15:11:54 +0000 Received: from smtp.nokia.com ([192.100.122.230] helo=mgw-mx03.nokia.com) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1LupjE-0003yv-Tm; Fri, 17 Apr 2009 15:11:52 +0000 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n3HFBbFs026062; Fri, 17 Apr 2009 18:11:39 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 17 Apr 2009 18:11:38 +0300 Received: from mgw-int01.ntc.nokia.com ([172.21.143.96]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 17 Apr 2009 18:11:37 +0300 Received: from [172.21.42.232] (esdhcp042232.research.nokia.com [172.21.42.232]) by mgw-int01.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n3HFBa1k028523; Fri, 17 Apr 2009 18:11:36 +0300 Subject: [PATCH] MTD: expose subpage size via sysfs From: Artem Bityutskiy To: David Woodhouse Date: Fri, 17 Apr 2009 18:11:36 +0300 Message-Id: <1239981096.3390.300.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) X-OriginalArrivalTime: 17 Apr 2009 15:11:37.0941 (UTC) FILETIME=[CDF43050:01C9BF6E] X-Nokia-AV: Clean X-Spam-Score: -4.0 (----) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (-4.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.100.122.230 listed in list.dnswl.org] Cc: linux-mtd X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: dedekind@infradead.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Artem Bityutskiy Subject: [PATCH] MTD: expose subpage size via sysfs MTD has got sysfs support in 2.6.30-rc1. But subpage size is not exposed there - do this. Signed-off-by: Artem Bityutskiy --- drivers/mtd/mtdcore.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) -- 1.6.0.6 diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index fdd6ae8..ae6f15e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -132,6 +132,17 @@ static ssize_t mtd_writesize_show(struct device *dev, } static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL); +static ssize_t mtd_subpage_size_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mtd_info *mtd = dev_to_mtd(dev); + unsigned int subpage_size = mtd->writesize >> mtd->subpage_sft; + + return snprintf(buf, PAGE_SIZE, "%u\n", subpage_size); + +} +static DEVICE_ATTR(subpage_size, S_IRUGO, mtd_subpage_size_show, NULL); + static ssize_t mtd_oobsize_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -169,6 +180,7 @@ static struct attribute *mtd_attrs[] = { &dev_attr_size.attr, &dev_attr_erasesize.attr, &dev_attr_writesize.attr, + &dev_attr_subpage_size.attr, &dev_attr_oobsize.attr, &dev_attr_numeraseregions.attr, &dev_attr_name.attr,