diff options
| -rw-r--r-- | drivers/mtd/chips/map_rom.c | 8 | ||||
| -rw-r--r-- | drivers/mtd/devices/slram.c | 14 | ||||
| -rw-r--r-- | drivers/mtd/lpddr/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/mtd/maps/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/mtd/maps/bfin-async-flash.c | 6 | ||||
| -rw-r--r-- | drivers/mtd/maps/ck804xrom.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/maps/physmap.c | 38 | ||||
| -rw-r--r-- | fs/jffs2/background.c | 18 | ||||
| -rw-r--r-- | fs/jffs2/readinode.c | 42 |
9 files changed, 89 insertions, 42 deletions
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c index 821d0ed6bae3..c76d6e5f47ee 100644 --- a/drivers/mtd/chips/map_rom.c +++ b/drivers/mtd/chips/map_rom.c | |||
| @@ -19,6 +19,7 @@ static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | |||
| 19 | static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 19 | static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| 20 | static void maprom_nop (struct mtd_info *); | 20 | static void maprom_nop (struct mtd_info *); |
| 21 | static struct mtd_info *map_rom_probe(struct map_info *map); | 21 | static struct mtd_info *map_rom_probe(struct map_info *map); |
| 22 | static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); | ||
| 22 | 23 | ||
| 23 | static struct mtd_chip_driver maprom_chipdrv = { | 24 | static struct mtd_chip_driver maprom_chipdrv = { |
| 24 | .probe = map_rom_probe, | 25 | .probe = map_rom_probe, |
| @@ -42,6 +43,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map) | |||
| 42 | mtd->read = maprom_read; | 43 | mtd->read = maprom_read; |
| 43 | mtd->write = maprom_write; | 44 | mtd->write = maprom_write; |
| 44 | mtd->sync = maprom_nop; | 45 | mtd->sync = maprom_nop; |
| 46 | mtd->erase = maprom_erase; | ||
| 45 | mtd->flags = MTD_CAP_ROM; | 47 | mtd->flags = MTD_CAP_ROM; |
| 46 | mtd->erasesize = map->size; | 48 | mtd->erasesize = map->size; |
| 47 | mtd->writesize = 1; | 49 | mtd->writesize = 1; |
| @@ -71,6 +73,12 @@ static int maprom_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re | |||
| 71 | return -EIO; | 73 | return -EIO; |
| 72 | } | 74 | } |
| 73 | 75 | ||
| 76 | static int maprom_erase (struct mtd_info *mtd, struct erase_info *info) | ||
| 77 | { | ||
| 78 | /* We do our best 8) */ | ||
| 79 | return -EROFS; | ||
| 80 | } | ||
| 81 | |||
| 74 | static int __init map_rom_init(void) | 82 | static int __init map_rom_init(void) |
| 75 | { | 83 | { |
| 76 | register_mtd_chip_driver(&maprom_chipdrv); | 84 | register_mtd_chip_driver(&maprom_chipdrv); |
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index a425d09f35a0..00248e81ecd5 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
| @@ -267,22 +267,28 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) | |||
| 267 | if (*(szlength) != '+') { | 267 | if (*(szlength) != '+') { |
| 268 | devlength = simple_strtoul(szlength, &buffer, 0); | 268 | devlength = simple_strtoul(szlength, &buffer, 0); |
| 269 | devlength = handle_unit(devlength, buffer) - devstart; | 269 | devlength = handle_unit(devlength, buffer) - devstart; |
| 270 | if (devlength < devstart) | ||
| 271 | goto err_out; | ||
| 272 | |||
| 273 | devlength -= devstart; | ||
| 270 | } else { | 274 | } else { |
| 271 | devlength = simple_strtoul(szlength + 1, &buffer, 0); | 275 | devlength = simple_strtoul(szlength + 1, &buffer, 0); |
| 272 | devlength = handle_unit(devlength, buffer); | 276 | devlength = handle_unit(devlength, buffer); |
| 273 | } | 277 | } |
| 274 | T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", | 278 | T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", |
| 275 | devname, devstart, devlength); | 279 | devname, devstart, devlength); |
| 276 | if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) { | 280 | if (devlength % SLRAM_BLK_SZ != 0) |
| 277 | E("slram: Illegal start / length parameter.\n"); | 281 | goto err_out; |
| 278 | return(-EINVAL); | ||
| 279 | } | ||
| 280 | 282 | ||
| 281 | if ((devstart = register_device(devname, devstart, devlength))){ | 283 | if ((devstart = register_device(devname, devstart, devlength))){ |
| 282 | unregister_devices(); | 284 | unregister_devices(); |
| 283 | return((int)devstart); | 285 | return((int)devstart); |
| 284 | } | 286 | } |
| 285 | return(0); | 287 | return(0); |
| 288 | |||
| 289 | err_out: | ||
| 290 | E("slram: Illegal length parameter.\n"); | ||
| 291 | return(-EINVAL); | ||
| 286 | } | 292 | } |
| 287 | 293 | ||
| 288 | #ifndef MODULE | 294 | #ifndef MODULE |
diff --git a/drivers/mtd/lpddr/Kconfig b/drivers/mtd/lpddr/Kconfig index acd4ea9b2278..5a401d8047ab 100644 --- a/drivers/mtd/lpddr/Kconfig +++ b/drivers/mtd/lpddr/Kconfig | |||
| @@ -12,6 +12,7 @@ config MTD_LPDDR | |||
| 12 | DDR memories, intended for battery-operated systems. | 12 | DDR memories, intended for battery-operated systems. |
| 13 | 13 | ||
| 14 | config MTD_QINFO_PROBE | 14 | config MTD_QINFO_PROBE |
| 15 | depends on MTD_LPDDR | ||
| 15 | tristate "Detect flash chips by QINFO probe" | 16 | tristate "Detect flash chips by QINFO probe" |
| 16 | help | 17 | help |
| 17 | Device Information for LPDDR chips is offered through the Overlay | 18 | Device Information for LPDDR chips is offered through the Overlay |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 0225cbbf22de..043d50fb6ef6 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
| @@ -491,7 +491,7 @@ config MTD_PCMCIA_ANONYMOUS | |||
| 491 | 491 | ||
| 492 | config MTD_BFIN_ASYNC | 492 | config MTD_BFIN_ASYNC |
| 493 | tristate "Blackfin BF533-STAMP Flash Chip Support" | 493 | tristate "Blackfin BF533-STAMP Flash Chip Support" |
| 494 | depends on BFIN533_STAMP && MTD_CFI | 494 | depends on BFIN533_STAMP && MTD_CFI && MTD_COMPLEX_MAPPINGS |
| 495 | select MTD_PARTITIONS | 495 | select MTD_PARTITIONS |
| 496 | default y | 496 | default y |
| 497 | help | 497 | help |
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index 6fec86aaed7e..576611f605db 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
| @@ -152,14 +152,18 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) | |||
| 152 | 152 | ||
| 153 | if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { | 153 | if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { |
| 154 | pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); | 154 | pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); |
| 155 | kfree(state); | ||
| 155 | return -EBUSY; | 156 | return -EBUSY; |
| 156 | } | 157 | } |
| 157 | gpio_direction_output(state->enet_flash_pin, 1); | 158 | gpio_direction_output(state->enet_flash_pin, 1); |
| 158 | 159 | ||
| 159 | pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); | 160 | pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); |
| 160 | state->mtd = do_map_probe(memory->name, &state->map); | 161 | state->mtd = do_map_probe(memory->name, &state->map); |
| 161 | if (!state->mtd) | 162 | if (!state->mtd) { |
| 163 | gpio_free(state->enet_flash_pin); | ||
| 164 | kfree(state); | ||
| 162 | return -ENXIO; | 165 | return -ENXIO; |
| 166 | } | ||
| 163 | 167 | ||
| 164 | #ifdef CONFIG_MTD_PARTITIONS | 168 | #ifdef CONFIG_MTD_PARTITIONS |
| 165 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); | 169 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 5f7a245ed132..424f17d6ffd1 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
| @@ -342,9 +342,9 @@ static struct pci_device_id ck804xrom_pci_tbl[] = { | |||
| 342 | { 0, } | 342 | { 0, } |
| 343 | }; | 343 | }; |
| 344 | 344 | ||
| 345 | #if 0 | ||
| 345 | MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); | 346 | MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); |
| 346 | 347 | ||
| 347 | #if 0 | ||
| 348 | static struct pci_driver ck804xrom_driver = { | 348 | static struct pci_driver ck804xrom_driver = { |
| 349 | .name = MOD_NAME, | 349 | .name = MOD_NAME, |
| 350 | .id_table = ck804xrom_pci_tbl, | 350 | .id_table = ck804xrom_pci_tbl, |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 87743661d48e..4b122e7ab4b3 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
| @@ -29,6 +29,7 @@ struct physmap_flash_info { | |||
| 29 | struct map_info map[MAX_RESOURCES]; | 29 | struct map_info map[MAX_RESOURCES]; |
| 30 | #ifdef CONFIG_MTD_PARTITIONS | 30 | #ifdef CONFIG_MTD_PARTITIONS |
| 31 | int nr_parts; | 31 | int nr_parts; |
| 32 | struct mtd_partition *parts; | ||
| 32 | #endif | 33 | #endif |
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| @@ -45,25 +46,26 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
| 45 | 46 | ||
| 46 | physmap_data = dev->dev.platform_data; | 47 | physmap_data = dev->dev.platform_data; |
| 47 | 48 | ||
| 48 | #ifdef CONFIG_MTD_CONCAT | 49 | #ifdef CONFIG_MTD_PARTITIONS |
| 49 | if (info->cmtd != info->mtd[0]) { | 50 | if (info->nr_parts) { |
| 51 | del_mtd_partitions(info->cmtd); | ||
| 52 | kfree(info->parts); | ||
| 53 | } else if (physmap_data->nr_parts) | ||
| 54 | del_mtd_partitions(info->cmtd); | ||
| 55 | else | ||
| 50 | del_mtd_device(info->cmtd); | 56 | del_mtd_device(info->cmtd); |
| 57 | #else | ||
| 58 | del_mtd_device(info->cmtd); | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #ifdef CONFIG_MTD_CONCAT | ||
| 62 | if (info->cmtd != info->mtd[0]) | ||
| 51 | mtd_concat_destroy(info->cmtd); | 63 | mtd_concat_destroy(info->cmtd); |
| 52 | } | ||
| 53 | #endif | 64 | #endif |
| 54 | 65 | ||
| 55 | for (i = 0; i < MAX_RESOURCES; i++) { | 66 | for (i = 0; i < MAX_RESOURCES; i++) { |
| 56 | if (info->mtd[i] != NULL) { | 67 | if (info->mtd[i] != NULL) |
| 57 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 58 | if (info->nr_parts || physmap_data->nr_parts) | ||
| 59 | del_mtd_partitions(info->mtd[i]); | ||
| 60 | else | ||
| 61 | del_mtd_device(info->mtd[i]); | ||
| 62 | #else | ||
| 63 | del_mtd_device(info->mtd[i]); | ||
| 64 | #endif | ||
| 65 | map_destroy(info->mtd[i]); | 68 | map_destroy(info->mtd[i]); |
| 66 | } | ||
| 67 | } | 69 | } |
| 68 | return 0; | 70 | return 0; |
| 69 | } | 71 | } |
| @@ -86,9 +88,6 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
| 86 | int err = 0; | 88 | int err = 0; |
| 87 | int i; | 89 | int i; |
| 88 | int devices_found = 0; | 90 | int devices_found = 0; |
| 89 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 90 | struct mtd_partition *parts; | ||
| 91 | #endif | ||
| 92 | 91 | ||
| 93 | physmap_data = dev->dev.platform_data; | 92 | physmap_data = dev->dev.platform_data; |
| 94 | if (physmap_data == NULL) | 93 | if (physmap_data == NULL) |
| @@ -167,10 +166,11 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
| 167 | goto err_out; | 166 | goto err_out; |
| 168 | 167 | ||
| 169 | #ifdef CONFIG_MTD_PARTITIONS | 168 | #ifdef CONFIG_MTD_PARTITIONS |
| 170 | err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0); | 169 | err = parse_mtd_partitions(info->cmtd, part_probe_types, |
| 170 | &info->parts, 0); | ||
| 171 | if (err > 0) { | 171 | if (err > 0) { |
| 172 | add_mtd_partitions(info->cmtd, parts, err); | 172 | add_mtd_partitions(info->cmtd, info->parts, err); |
| 173 | kfree(parts); | 173 | info->nr_parts = err; |
| 174 | return 0; | 174 | return 0; |
| 175 | } | 175 | } |
| 176 | 176 | ||
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 3cceef4ad2b7..e9580104b6ba 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c | |||
| @@ -95,13 +95,17 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
| 95 | spin_unlock(&c->erase_completion_lock); | 95 | spin_unlock(&c->erase_completion_lock); |
| 96 | 96 | ||
| 97 | 97 | ||
| 98 | /* This thread is purely an optimisation. But if it runs when | 98 | /* Problem - immediately after bootup, the GCD spends a lot |
| 99 | other things could be running, it actually makes things a | 99 | * of time in places like jffs2_kill_fragtree(); so much so |
| 100 | lot worse. Use yield() and put it at the back of the runqueue | 100 | * that userspace processes (like gdm and X) are starved |
| 101 | every time. Especially during boot, pulling an inode in | 101 | * despite plenty of cond_resched()s and renicing. Yield() |
| 102 | with read_inode() is much preferable to having the GC thread | 102 | * doesn't help, either (presumably because userspace and GCD |
| 103 | get there first. */ | 103 | * are generally competing for a higher latency resource - |
| 104 | yield(); | 104 | * disk). |
| 105 | * This forces the GCD to slow the hell down. Pulling an | ||
| 106 | * inode in with read_inode() is much preferable to having | ||
| 107 | * the GC thread get there first. */ | ||
| 108 | schedule_timeout_interruptible(msecs_to_jiffies(50)); | ||
| 105 | 109 | ||
| 106 | /* Put_super will send a SIGKILL and then wait on the sem. | 110 | /* Put_super will send a SIGKILL and then wait on the sem. |
| 107 | */ | 111 | */ |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 6ca08ad887c0..1fc1e92356ee 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
| @@ -220,7 +220,7 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, | |||
| 220 | struct jffs2_tmp_dnode_info *tn) | 220 | struct jffs2_tmp_dnode_info *tn) |
| 221 | { | 221 | { |
| 222 | uint32_t fn_end = tn->fn->ofs + tn->fn->size; | 222 | uint32_t fn_end = tn->fn->ofs + tn->fn->size; |
| 223 | struct jffs2_tmp_dnode_info *this; | 223 | struct jffs2_tmp_dnode_info *this, *ptn; |
| 224 | 224 | ||
| 225 | dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw)); | 225 | dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw)); |
| 226 | 226 | ||
| @@ -251,11 +251,18 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, | |||
| 251 | if (this) { | 251 | if (this) { |
| 252 | /* If the node is coincident with another at a lower address, | 252 | /* If the node is coincident with another at a lower address, |
| 253 | back up until the other node is found. It may be relevant */ | 253 | back up until the other node is found. It may be relevant */ |
| 254 | while (this->overlapped) | 254 | while (this->overlapped) { |
| 255 | this = tn_prev(this); | 255 | ptn = tn_prev(this); |
| 256 | 256 | if (!ptn) { | |
| 257 | /* First node should never be marked overlapped */ | 257 | /* |
| 258 | BUG_ON(!this); | 258 | * We killed a node which set the overlapped |
| 259 | * flags during the scan. Fix it up. | ||
| 260 | */ | ||
| 261 | this->overlapped = 0; | ||
| 262 | break; | ||
| 263 | } | ||
| 264 | this = ptn; | ||
| 265 | } | ||
| 259 | dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole"); | 266 | dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole"); |
| 260 | } | 267 | } |
| 261 | 268 | ||
| @@ -360,7 +367,17 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, | |||
| 360 | } | 367 | } |
| 361 | if (!this->overlapped) | 368 | if (!this->overlapped) |
| 362 | break; | 369 | break; |
| 363 | this = tn_prev(this); | 370 | |
| 371 | ptn = tn_prev(this); | ||
| 372 | if (!ptn) { | ||
| 373 | /* | ||
| 374 | * We killed a node which set the overlapped | ||
| 375 | * flags during the scan. Fix it up. | ||
| 376 | */ | ||
| 377 | this->overlapped = 0; | ||
| 378 | break; | ||
| 379 | } | ||
| 380 | this = ptn; | ||
| 364 | } | 381 | } |
| 365 | } | 382 | } |
| 366 | 383 | ||
| @@ -456,8 +473,15 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c, | |||
| 456 | eat_last(&rii->tn_root, &last->rb); | 473 | eat_last(&rii->tn_root, &last->rb); |
| 457 | ver_insert(&ver_root, last); | 474 | ver_insert(&ver_root, last); |
| 458 | 475 | ||
| 459 | if (unlikely(last->overlapped)) | 476 | if (unlikely(last->overlapped)) { |
| 460 | continue; | 477 | if (pen) |
| 478 | continue; | ||
| 479 | /* | ||
| 480 | * We killed a node which set the overlapped | ||
| 481 | * flags during the scan. Fix it up. | ||
| 482 | */ | ||
| 483 | last->overlapped = 0; | ||
| 484 | } | ||
| 461 | 485 | ||
| 462 | /* Now we have a bunch of nodes in reverse version | 486 | /* Now we have a bunch of nodes in reverse version |
| 463 | order, in the tree at ver_root. Most of the time, | 487 | order, in the tree at ver_root. Most of the time, |
