cregit-Linux how code gets into the kernel

Release 4.7 drivers/mtd/chips/map_rom.c

/*
 * Common code to handle map devices which are simple ROM
 * (C) 2000 Red Hat. GPL'd.
 */

#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <asm/byteorder.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>

static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
static void maprom_nop (struct mtd_info *);
static struct mtd_info *map_rom_probe(struct map_info *map);
static int maprom_erase (struct mtd_info *mtd, struct erase_info *info);
static unsigned long maprom_unmapped_area(struct mtd_info *, unsigned long,
					  unsigned long, unsigned long);


static struct mtd_chip_driver maprom_chipdrv = {
	.probe	= map_rom_probe,
	.name	= "map_rom",
	.module	= THIS_MODULE
};


static unsigned int default_erasesize(struct map_info *map) { const __be32 *erase_size = NULL; erase_size = of_get_property(map->device_node, "erase-size", NULL); return !erase_size ? map->size : be32_to_cpu(*erase_size); }

Contributors

PersonTokensPropCommitsCommitProp
aaron sierraaaron sierra46100.00%1100.00%
Total46100.00%1100.00%


static struct mtd_info *map_rom_probe(struct map_info *map) { struct mtd_info *mtd; mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); if (!mtd) return NULL; map->fldrv = &maprom_chipdrv; mtd->priv = map; mtd->name = map->name; mtd->type = MTD_ROM; mtd->size = map->size; mtd->_get_unmapped_area = maprom_unmapped_area; mtd->_read = maprom_read; mtd->_write = maprom_write; mtd->_sync = maprom_nop; mtd->_erase = maprom_erase; mtd->flags = MTD_CAP_ROM; mtd->erasesize = default_erasesize(map); mtd->writesize = 1; mtd->writebufsize = 1; __module_get(THIS_MODULE); return mtd; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git9669.06%214.29%
artem bityutskiyartem bityutskiy117.91%214.29%
aaron sierraaaron sierra96.47%17.14%
david woodhousedavid woodhouse64.32%321.43%
alan coxalan cox53.60%17.14%
david howellsdavid howells53.60%17.14%
linus torvaldslinus torvalds53.60%214.29%
burman yanburman yan10.72%17.14%
joern engeljoern engel10.72%17.14%
Total139100.00%14100.00%

/* * 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 unsigned long maprom_unmapped_area(struct mtd_info *mtd, unsigned long len, unsigned long offset, unsigned long flags) { struct map_info *map = mtd->priv; return (unsigned long) map->virt + offset; }

Contributors

PersonTokensPropCommitsCommitProp
david howellsdavid howells44100.00%1100.00%
Total44100.00%1100.00%


static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) { struct map_info *map = mtd->priv; map_copy_from(map, buf, from, len); *retlen = len; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git5298.11%150.00%
david woodhousedavid woodhouse11.89%150.00%
Total53100.00%2100.00%


static void maprom_nop(struct mtd_info *mtd) { /* Nothing to see here */ }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git12100.00%1100.00%
Total12100.00%1100.00%


static int maprom_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { return -EROFS; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git2996.67%150.00%
artem bityutskiyartem bityutskiy13.33%150.00%
Total30100.00%2100.00%


static int maprom_erase (struct mtd_info *mtd, struct erase_info *info) { /* We do our best 8) */ return -EROFS; }

Contributors

PersonTokensPropCommitsCommitProp
alan coxalan cox21100.00%1100.00%
Total21100.00%1100.00%


static int __init map_rom_init(void) { register_mtd_chip_driver(&maprom_chipdrv); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1372.22%125.00%
linus torvaldslinus torvalds422.22%250.00%
david woodhousedavid woodhouse15.56%125.00%
Total18100.00%4100.00%


static void __exit map_rom_exit(void) { unregister_mtd_chip_driver(&maprom_chipdrv); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git960.00%133.33%
linus torvaldslinus torvalds640.00%266.67%
Total15100.00%3100.00%

module_init(map_rom_init); module_exit(map_rom_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); MODULE_DESCRIPTION("MTD chip driver for ROM chips");

Overall Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git29553.25%211.11%
david howellsdavid howells6912.45%15.56%
aaron sierraaaron sierra5810.47%15.56%
linus torvaldslinus torvalds559.93%316.67%
alan coxalan cox417.40%15.56%
david woodhousedavid woodhouse152.71%316.67%
artem bityutskiyartem bityutskiy122.17%316.67%
art haasart haas61.08%15.56%
burman yanburman yan10.18%15.56%
adrian bunkadrian bunk10.18%15.56%
joern engeljoern engel10.18%15.56%
Total554100.00%18100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}