From patchwork Sun May 23 07:30:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 53301 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 ozlabs.org (Postfix) with ESMTPS id 7DC0DB7D45 for ; Sun, 23 May 2010 17:28:42 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1OG5ap-0001gK-57; Sun, 23 May 2010 07:27:27 +0000 Received: from smtp.gentoo.org ([140.211.166.183]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1OG5aI-0001RC-Gs for linux-mtd@lists.infradead.org; Sun, 23 May 2010 07:26:56 +0000 Received: from vapier-m.hsd1.ma.comcast.net. (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 5060D1B4038; Sun, 23 May 2010 07:26:36 +0000 (UTC) From: Mike Frysinger To: linux-mtd@lists.infradead.org, David Woodhouse Subject: [PATCH 2/2] mtd: physmap: allow maps to be read-only mapped Date: Sun, 23 May 2010 03:30:24 -0400 Message-Id: <1274599824-17530-2-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1274599824-17530-1-git-send-email-vapier@gentoo.org> References: <1274599824-17530-1-git-send-email-vapier@gentoo.org> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100523_032654_806524_CF8132A0 X-CRM114-Status: GOOD ( 20.66 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [140.211.166.183 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: uclinux-dev@uclinux.org, Bernd Schmidt , David Howells , Paul Mundt , Greg Ungerer , uclinux-dist-devel@blackfin.uclinux.org, David McCullough X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 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: Bernd Schmidt Recent changes have made nommu.c more careful about checking device capabilities before attempting to create a direct mapping. This means that the physmap driver has to mark its mtd devices as ro-mappable if we want to support XIP on flash. Signed-off-by: Bernd Schmidt Signed-off-by: Mike Frysinger --- Note: this does semi-undo recent changes that punted the prototypes for these common mtd_bdi's ... drivers/mtd/maps/physmap.c | 2 ++ drivers/mtd/mtdcore.c | 4 ++++ include/linux/mtd/mtdbdi.h | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 0 deletions(-) create mode 100644 include/linux/mtd/mtdbdi.h diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 370da18..be2dbc2 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #define MAX_RESOURCES 4 @@ -165,6 +166,7 @@ static int physmap_flash_probe(struct platform_device *dev) } if (info->mtd[i]->get_unmapped_area == NULL) info->mtd[i]->get_unmapped_area = physmap_unmapped_area; + info->mtd[i]->backing_dev_info = &mtd_bdi_ro_mappable; info->mtd[i]->owner = THIS_MODULE; info->mtd[i]->dev.parent = &dev->dev; } diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index a1b8b70..0995819 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -24,6 +24,7 @@ #include #include +#include #include "mtdcore.h" /* @@ -33,6 +34,7 @@ struct backing_dev_info mtd_bdi_unmappable = { .capabilities = BDI_CAP_MAP_COPY, }; +EXPORT_SYMBOL(mtd_bdi_unmappable); /* * backing device capabilities for R/O mappable devices (such as ROM) @@ -43,6 +45,7 @@ struct backing_dev_info mtd_bdi_ro_mappable = { .capabilities = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT | BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP), }; +EXPORT_SYMBOL(mtd_bdi_ro_mappable); /* * backing device capabilities for writable mappable devices (such as RAM) @@ -54,6 +57,7 @@ struct backing_dev_info mtd_bdi_rw_mappable = { BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP), }; +EXPORT_SYMBOL(mtd_bdi_rw_mappable); static int mtd_cls_suspend(struct device *dev, pm_message_t state); static int mtd_cls_resume(struct device *dev); diff --git a/include/linux/mtd/mtdbdi.h b/include/linux/mtd/mtdbdi.h new file mode 100644 index 0000000..ec0dd7e --- /dev/null +++ b/include/linux/mtd/mtdbdi.h @@ -0,0 +1,17 @@ +/* Internal MTD definitions + * + * Copyright © 2006 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +/* + * mtdcore.c + */ +extern struct backing_dev_info mtd_bdi_unmappable; +extern struct backing_dev_info mtd_bdi_ro_mappable; +extern struct backing_dev_info mtd_bdi_rw_mappable;