if (chip_good(map, adr, map_word_ff(map))) { 
if (!chip_good(map, adr, map_word_ff(map))) { 
static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr, int len, void *thunk){	struct cfi_private *cfi = map->fldrv_priv;	unsigned long timeo = jiffies + HZ;	DECLARE_WAITQUEUE(wait, current);	int ret = 0;	adr += chip->start;	cfi_spin_lock(chip->mutex);	ret = get_chip(map, chip, adr, FL_ERASING);	if (ret) {		cfi_spin_unlock(chip->mutex);		return ret;	}	DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): ERASE 0x%.8lx\n",	       __func__, adr );	ENABLE_VPP(map);	cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL);	cfi_send_gen_cmd(0x80, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);	cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL);	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL);	map_write(map, CMD(0x30), adr);	chip->state = FL_ERASING;	chip->erase_suspended = 0;	chip->in_progress_block_addr = adr;		cfi_spin_unlock(chip->mutex);	msleep(chip->erase_time/2);	cfi_spin_lock(chip->mutex);	timeo = jiffies + (HZ*20);	for (;;) {		if (chip->state != FL_ERASING) {			/* Someone's suspended the erase. Sleep */			set_current_state(TASK_UNINTERRUPTIBLE);			add_wait_queue(&chip->wq, &wait);			cfi_spin_unlock(chip->mutex);			schedule();			remove_wait_queue(&chip->wq, &wait);			cfi_spin_lock(chip->mutex);			continue;		}		if (chip->erase_suspended) {			/* This erase was suspended and resumed.			   Adjust the timeout */			timeo = jiffies + (HZ*20); /* FIXME */			chip->erase_suspended = 0;		}		if (chip_ready(map, adr))			break;		if (time_after(jiffies, timeo)) {			printk(KERN_WARNING "MTD %s(): software timeout\n",				__func__ );			break;		}		/* Latency issues. Drop the lock, wait a while and retry */		cfi_spin_unlock(chip->mutex);		set_current_state(TASK_UNINTERRUPTIBLE);		schedule_timeout(1);		cfi_spin_lock(chip->mutex);	}	/* Did we succeed? */	if (chip_good(map, adr, map_word_ff(map))) {		/* reset on all failures. */		map_write( map, CMD(0xF0), chip->start );		/* FIXME - should have reset delay before continuing */		ret = -EIO;	}	chip->state = FL_READY;	put_chip(map, chip, adr);	cfi_spin_unlock(chip->mutex);	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/22fd9a8750bcad4999768aafc8fbd8a4bd6f5aa1/cfi_cmdset_0002.c/clean/drivers/mtd/chips/cfi_cmdset_0002.c