NOMMU: Present backing device capabilities for MTD chardevs
Present backing device capabilities for MTD character device files to allow NOMMU mmap to do direct mapping where possible. Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Bernd Schmidt <bernd.schmidt@analog.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
committed by
David Woodhouse
parent
9ce969082e
commit
402d326519
@ -19,6 +19,7 @@
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include "mtdcore.h"
|
||||
|
||||
@ -46,6 +47,20 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!mtd->backing_dev_info) {
|
||||
switch (mtd->type) {
|
||||
case MTD_RAM:
|
||||
mtd->backing_dev_info = &mtd_bdi_rw_mappable;
|
||||
break;
|
||||
case MTD_ROM:
|
||||
mtd->backing_dev_info = &mtd_bdi_ro_mappable;
|
||||
break;
|
||||
default:
|
||||
mtd->backing_dev_info = &mtd_bdi_unmappable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BUG_ON(mtd->writesize == 0);
|
||||
mutex_lock(&mtd_table_mutex);
|
||||
|
||||
|
Reference in New Issue
Block a user