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; -- 1.7.1