2 * Common code to handle map devices which are simple ROM
3 * (C) 2000 Red Hat. GPL'd.
4 * $Id: map_rom.c,v 1.2 2000/07/03 10:01:38 dwmw2 Exp $
7 #include <linux/module.h>
8 #include <linux/types.h>
9 #include <linux/kernel.h>
11 #include <asm/byteorder.h>
12 #include <linux/errno.h>
13 #include <linux/malloc.h>
15 #include <linux/mtd/map.h>
18 static int maprom_read (struct mtd_info
*, loff_t
, size_t, size_t *, u_char
*);
19 static void maprom_nop (struct mtd_info
*);
21 struct mtd_info
*map_rom_probe(struct map_info
*);
22 EXPORT_SYMBOL(map_rom_probe
);
24 struct mtd_info
*map_rom_probe(struct map_info
*map
)
28 mtd
= kmalloc(sizeof(*mtd
), GFP_KERNEL
);
32 memset(mtd
, 0, sizeof(*mtd
));
34 map
->fldrv_destroy
= maprom_nop
;
36 mtd
->name
= map
->name
;
38 mtd
->size
= map
->size
;
39 mtd
->read
= maprom_read
;
40 mtd
->sync
= maprom_nop
;
41 mtd
->flags
= MTD_CAP_ROM
;
48 static int maprom_read (struct mtd_info
*mtd
, loff_t from
, size_t len
, size_t *retlen
, u_char
*buf
)
50 struct map_info
*map
= (struct map_info
*)mtd
->priv
;
52 map
->copy_from(map
, buf
, from
, len
);
57 static void maprom_nop(struct mtd_info
*mtd
)
59 /* Nothing to see here */