Lines Matching refs:erase

340 static int concat_dev_erase(struct mtd_info *mtd, struct erase_info *erase)
351 erase->mtd = mtd;
352 erase->callback = concat_erase_callback;
353 erase->priv = (unsigned long) &waitq;
359 err = mtd_erase(mtd, erase);
363 if (erase->state != MTD_ERASE_DONE
364 && erase->state != MTD_ERASE_FAILED)
369 err = (erase->state == MTD_ERASE_FAILED) ? -EIO : 0;
380 struct erase_info *erase;
383 * Check for proper erase block alignment of the to-be-erased area.
384 * It is easier to do this based on the super device's erase
389 /* the easy case: device has uniform erase block size */
395 /* device has variable erase size */
400 * Find the erase region where the to-be-erased area begins:
409 * offset is aligned to this region's erase size:
415 * now find the erase region where the to-be-erased area ends:
422 * check if the ending offset is aligned to this region's erase size
430 erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL);
432 if (!erase)
435 *erase = *instr;
444 if (subdev->size <= erase->addr) {
445 erase->addr -= subdev->size;
455 /* now do the erase: */
462 if (erase->addr + length > subdev->size)
463 erase->len = subdev->size - erase->addr;
465 erase->len = length;
467 length -= erase->len;
468 if ((err = concat_dev_erase(subdev, erase))) {
472 if (erase->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
473 instr->fail_addr = erase->fail_addr + offset;
477 * erase->addr specifies the offset of the area to be
484 erase->addr = 0;
487 instr->state = erase->state;
488 kfree(erase);
805 * Combine the erase block size info of the subdevices:
808 * many changes in erase size we have
814 /* current subdevice has uniform erase size */
816 /* if it differs from the last subdevice's erase size, count it */
823 /* current subdevice has variable erase size */
827 /* walk the list of erase regions, count any changes */
843 * All subdevices have the same uniform erase size.
852 * erase block size varies across the subdevices: allocate
853 * space to store the data describing the variable erase regions
866 ("memory allocation error while creating erase region list"
873 * in erase region info:
879 /* current subdevice has uniform erase size */
898 /* current subdevice has variable erase size */
901 /* walk the list of erase regions, count any changes */