Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6:
[MTD] [MAPS] Remove MODULE_DEVICE_TABLE() from ck804rom driver.
[JFFS2] fix mount crash caused by removed nodes
[JFFS2] force the jffs2 GC daemon to behave a bit better
[MTD] [MAPS] blackfin async requires complex mappings
[MTD] [MAPS] blackfin: fix memory leak in error path
[MTD] [MAPS] physmap: fix wrong free and del_mtd_{partition,device}
[MTD] slram: Handle negative devlength correctly
[MTD] map_rom has NULL erase pointer
[MTD] [LPDDR] qinfo_probe depends on lpddr

+89 -42
+8
drivers/mtd/chips/map_rom.c
··· 19 19 static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 20 20 static void maprom_nop (struct mtd_info *); 21 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 24 static struct mtd_chip_driver maprom_chipdrv = { 24 25 .probe = map_rom_probe, ··· 43 42 mtd->read = maprom_read; 44 43 mtd->write = maprom_write; 45 44 mtd->sync = maprom_nop; 45 + mtd->erase = maprom_erase; 46 46 mtd->flags = MTD_CAP_ROM; 47 47 mtd->erasesize = map->size; 48 48 mtd->writesize = 1; ··· 71 69 { 72 70 printk(KERN_NOTICE "maprom_write called\n"); 73 71 return -EIO; 72 + } 73 + 74 + static int maprom_erase (struct mtd_info *mtd, struct erase_info *info) 75 + { 76 + /* We do our best 8) */ 77 + return -EROFS; 74 78 } 75 79 76 80 static int __init map_rom_init(void)
+10 -4
drivers/mtd/devices/slram.c
··· 267 267 if (*(szlength) != '+') { 268 268 devlength = simple_strtoul(szlength, &buffer, 0); 269 269 devlength = handle_unit(devlength, buffer) - devstart; 270 + if (devlength < devstart) 271 + goto err_out; 272 + 273 + devlength -= devstart; 270 274 } else { 271 275 devlength = simple_strtoul(szlength + 1, &buffer, 0); 272 276 devlength = handle_unit(devlength, buffer); 273 277 } 274 278 T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", 275 279 devname, devstart, devlength); 276 - if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) { 277 - E("slram: Illegal start / length parameter.\n"); 278 - return(-EINVAL); 279 - } 280 + if (devlength % SLRAM_BLK_SZ != 0) 281 + goto err_out; 280 282 281 283 if ((devstart = register_device(devname, devstart, devlength))){ 282 284 unregister_devices(); 283 285 return((int)devstart); 284 286 } 285 287 return(0); 288 + 289 + err_out: 290 + E("slram: Illegal length parameter.\n"); 291 + return(-EINVAL); 286 292 } 287 293 288 294 #ifndef MODULE
+1
drivers/mtd/lpddr/Kconfig
··· 12 12 DDR memories, intended for battery-operated systems. 13 13 14 14 config MTD_QINFO_PROBE 15 + depends on MTD_LPDDR 15 16 tristate "Detect flash chips by QINFO probe" 16 17 help 17 18 Device Information for LPDDR chips is offered through the Overlay
+1 -1
drivers/mtd/maps/Kconfig
··· 491 491 492 492 config MTD_BFIN_ASYNC 493 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 495 select MTD_PARTITIONS 496 496 default y 497 497 help
+5 -1
drivers/mtd/maps/bfin-async-flash.c
··· 152 152 153 153 if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { 154 154 pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); 155 + kfree(state); 155 156 return -EBUSY; 156 157 } 157 158 gpio_direction_output(state->enet_flash_pin, 1); 158 159 159 160 pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); 160 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 165 return -ENXIO; 166 + } 163 167 164 168 #ifdef CONFIG_MTD_PARTITIONS 165 169 ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0);
+1 -1
drivers/mtd/maps/ck804xrom.c
··· 342 342 { 0, } 343 343 }; 344 344 345 + #if 0 345 346 MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); 346 347 347 - #if 0 348 348 static struct pci_driver ck804xrom_driver = { 349 349 .name = MOD_NAME, 350 350 .id_table = ck804xrom_pci_tbl,
+19 -19
drivers/mtd/maps/physmap.c
··· 29 29 struct map_info map[MAX_RESOURCES]; 30 30 #ifdef CONFIG_MTD_PARTITIONS 31 31 int nr_parts; 32 + struct mtd_partition *parts; 32 33 #endif 33 34 }; 34 35 ··· 46 45 47 46 physmap_data = dev->dev.platform_data; 48 47 49 - #ifdef CONFIG_MTD_CONCAT 50 - if (info->cmtd != info->mtd[0]) { 48 + #ifdef CONFIG_MTD_PARTITIONS 49 + if (info->nr_parts) { 50 + del_mtd_partitions(info->cmtd); 51 + kfree(info->parts); 52 + } else if (physmap_data->nr_parts) 53 + del_mtd_partitions(info->cmtd); 54 + else 51 55 del_mtd_device(info->cmtd); 56 + #else 57 + del_mtd_device(info->cmtd); 58 + #endif 59 + 60 + #ifdef CONFIG_MTD_CONCAT 61 + if (info->cmtd != info->mtd[0]) 52 62 mtd_concat_destroy(info->cmtd); 53 - } 54 63 #endif 55 64 56 65 for (i = 0; i < MAX_RESOURCES; i++) { 57 - if (info->mtd[i] != NULL) { 58 - #ifdef CONFIG_MTD_PARTITIONS 59 - if (info->nr_parts || physmap_data->nr_parts) 60 - del_mtd_partitions(info->mtd[i]); 61 - else 62 - del_mtd_device(info->mtd[i]); 63 - #else 64 - del_mtd_device(info->mtd[i]); 65 - #endif 66 + if (info->mtd[i] != NULL) 66 67 map_destroy(info->mtd[i]); 67 - } 68 68 } 69 69 return 0; 70 70 } ··· 88 86 int err = 0; 89 87 int i; 90 88 int devices_found = 0; 91 - #ifdef CONFIG_MTD_PARTITIONS 92 - struct mtd_partition *parts; 93 - #endif 94 89 95 90 physmap_data = dev->dev.platform_data; 96 91 if (physmap_data == NULL) ··· 166 167 goto err_out; 167 168 168 169 #ifdef CONFIG_MTD_PARTITIONS 169 - err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0); 170 + err = parse_mtd_partitions(info->cmtd, part_probe_types, 171 + &info->parts, 0); 170 172 if (err > 0) { 171 - add_mtd_partitions(info->cmtd, parts, err); 172 - kfree(parts); 173 + add_mtd_partitions(info->cmtd, info->parts, err); 174 + info->nr_parts = err; 173 175 return 0; 174 176 } 175 177
+11 -7
fs/jffs2/background.c
··· 95 95 spin_unlock(&c->erase_completion_lock); 96 96 97 97 98 - /* This thread is purely an optimisation. But if it runs when 99 - other things could be running, it actually makes things a 100 - lot worse. Use yield() and put it at the back of the runqueue 101 - every time. Especially during boot, pulling an inode in 102 - with read_inode() is much preferable to having the GC thread 103 - get there first. */ 104 - yield(); 98 + /* Problem - immediately after bootup, the GCD spends a lot 99 + * of time in places like jffs2_kill_fragtree(); so much so 100 + * that userspace processes (like gdm and X) are starved 101 + * despite plenty of cond_resched()s and renicing. Yield() 102 + * doesn't help, either (presumably because userspace and GCD 103 + * are generally competing for a higher latency resource - 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 110 /* Put_super will send a SIGKILL and then wait on the sem. 107 111 */
+33 -9
fs/jffs2/readinode.c
··· 220 220 struct jffs2_tmp_dnode_info *tn) 221 221 { 222 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 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 251 if (this) { 252 252 /* If the node is coincident with another at a lower address, 253 253 back up until the other node is found. It may be relevant */ 254 - while (this->overlapped) 255 - this = tn_prev(this); 256 - 257 - /* First node should never be marked overlapped */ 258 - BUG_ON(!this); 254 + while (this->overlapped) { 255 + ptn = tn_prev(this); 256 + if (!ptn) { 257 + /* 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 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 ··· 367 360 } 368 361 if (!this->overlapped) 369 362 break; 370 - this = tn_prev(this); 363 + 364 + ptn = tn_prev(this); 365 + if (!ptn) { 366 + /* 367 + * We killed a node which set the overlapped 368 + * flags during the scan. Fix it up. 369 + */ 370 + this->overlapped = 0; 371 + break; 372 + } 373 + this = ptn; 371 374 } 372 375 } 373 376 ··· 473 456 eat_last(&rii->tn_root, &last->rb); 474 457 ver_insert(&ver_root, last); 475 458 476 - if (unlikely(last->overlapped)) 477 - continue; 459 + if (unlikely(last->overlapped)) { 460 + if (pen) 461 + continue; 462 + /* 463 + * We killed a node which set the overlapped 464 + * flags during the scan. Fix it up. 465 + */ 466 + last->overlapped = 0; 467 + } 478 468 479 469 /* Now we have a bunch of nodes in reverse version 480 470 order, in the tree at ver_root. Most of the time,