/** * @mtd: the device * @erase: the erase info * Returns 0 if erase successful or -ERRNO if an error occurred */ static int powernv_flash_erase(struct mtd_info *mtd, struct erase_info *erase) { int rc; rc = powernv_flash_async_op(mtd, FLASH_OP_ERASE, erase->addr, erase->len, NULL, NULL); if (rc) erase->fail_addr = erase->addr; return rc; }
/** * @mtd: the device * @erase: the erase info * Returns 0 if erase successful or -ERRNO if an error occurred */ static int powernv_flash_erase(struct mtd_info *mtd, struct erase_info *erase) { int rc; erase->state = MTD_ERASING; /* todo: register our own notifier to do a true async implementation */ rc = powernv_flash_async_op(mtd, FLASH_OP_ERASE, erase->addr, erase->len, NULL, NULL); if (rc) { erase->fail_addr = erase->addr; erase->state = MTD_ERASE_FAILED; } else { erase->state = MTD_ERASE_DONE; } mtd_erase_callback(erase); return rc; }
/** * @mtd: the device * @to: the offset to write to * @len: the number of bytes to write * @retlen: the number of bytes actually written * @buf: the buffer to get bytes from * * Returns 0 if write successful, -ERRNO if error occurred */ static int powernv_flash_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { return powernv_flash_async_op(mtd, FLASH_OP_WRITE, to, len, retlen, (u_char *)buf); }
/** * @mtd: the device * @from: the offset to read from * @len: the number of bytes to read * @retlen: the number of bytes actually read * @buf: the filled in buffer * * Returns 0 if read successful, or -ERRNO if an error occurred */ static int powernv_flash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) { return powernv_flash_async_op(mtd, FLASH_OP_READ, from, len, retlen, buf); }