From patchwork Thu Dec 29 09:27:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 133514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D842DB6F9D for ; Thu, 29 Dec 2011 20:28:13 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RgCG1-0004iV-Nc; Thu, 29 Dec 2011 09:26:41 +0000 Received: from mga01.intel.com ([192.55.52.88]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RgCF9-0004RA-0D for linux-mtd@lists.infradead.org; Thu, 29 Dec 2011 09:25:49 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 29 Dec 2011 01:25:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="101263587" Received: from sauron.fi.intel.com ([10.237.72.160]) by fmsmga001.fm.intel.com with ESMTP; 29 Dec 2011 01:25:41 -0800 From: dedekind1@gmail.com To: linux-mtd@lists.infradead.org Subject: [PATCH v2 06/27] mtd: introduce mtd_get_unmapped_area interface Date: Thu, 29 Dec 2011 11:27:10 +0200 Message-Id: <1325150851-2805-7-git-send-email-dedekind1@gmail.com> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1325150851-2805-1-git-send-email-dedekind1@gmail.com> References: <1325150851-2805-1-git-send-email-dedekind1@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.1 (-----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-5.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.55.52.88 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dedekind1[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) 0.1 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: Mike Dunn X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Artem Bityutskiy Signed-off-by: Artem Bityutskiy --- drivers/mtd/mtdchar.c | 2 +- drivers/mtd/mtdconcat.c | 4 ++-- drivers/mtd/mtdpart.c | 3 +-- fs/romfs/mmap-nommu.c | 2 +- include/linux/mtd/mtd.h | 18 +++++++++++++----- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 41d64ff..c51f04a 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -1135,7 +1135,7 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, if (offset > mtd->size - len) return (unsigned long) -EINVAL; - return mtd->get_unmapped_area(mtd, len, offset, flags); + return mtd_get_unmapped_area(mtd, len, offset, flags); } /* can't map directly */ diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 76123bd..b3895cf 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -726,8 +726,8 @@ static unsigned long concat_get_unmapped_area(struct mtd_info *mtd, return (unsigned long) -EINVAL; if (subdev->get_unmapped_area) - return subdev->get_unmapped_area(subdev, len, offset, - flags); + return mtd_get_unmapped_area(subdev, len, offset, + flags); break; } diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index b09624a..55a9cb5 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -108,8 +108,7 @@ static unsigned long part_get_unmapped_area(struct mtd_info *mtd, struct mtd_part *part = PART(mtd); offset += part->offset; - return part->master->get_unmapped_area(part->master, len, offset, - flags); + return mtd_get_unmapped_area(part->master, len, offset, flags); } static int part_read_oob(struct mtd_info *mtd, loff_t from, diff --git a/fs/romfs/mmap-nommu.c b/fs/romfs/mmap-nommu.c index eed9942..d5168e8 100644 --- a/fs/romfs/mmap-nommu.c +++ b/fs/romfs/mmap-nommu.c @@ -53,7 +53,7 @@ static unsigned long romfs_get_unmapped_area(struct file *file, if (offset > mtd->size - len) return (unsigned long) -EINVAL; - return mtd->get_unmapped_area(mtd, len, offset, flags); + return mtd_get_unmapped_area(mtd, len, offset, flags); } cant_map_directly: diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index a7d22b7..f38e827 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -178,11 +178,6 @@ struct mtd_info { int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, void **virt, resource_size_t *phys); void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); - - /* Allow NOMMU mmap() to directly map the device (if not NULL) - * - return the address to which the offset maps - * - return -ENOSYS to indicate refusal to do the mapping - */ unsigned long (*get_unmapped_area) (struct mtd_info *mtd, unsigned long len, unsigned long offset, @@ -293,6 +288,19 @@ static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) return mtd->unpoint(mtd, from, len); } +/* + * Allow NOMMU mmap() to directly map the device (if not NULL) + * - return the address to which the offset maps + * - return -ENOSYS to indicate refusal to do the mapping + */ +static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, + unsigned long len, + unsigned long offset, + unsigned long flags) +{ + return mtd->get_unmapped_area(mtd, len, offset, flags); +} + static inline struct mtd_info *dev_to_mtd(struct device *dev) { return dev ? dev_get_drvdata(dev) : NULL;