/* Returns 0 on success, a negative error code otherwise.  */
static int nand_set_features_op(struct nand_chip *chip, u8 feature, const void *data)
/* Returns 0 on success, a negative error code otherwise.  */
static int nand_set_features_op(struct nand_chip *chip, u8 feature, const void *data)
{
	struct mtd_info *mtd = nand_to_mtd(chip);
	const u8 *params = data;
	int i, status;
	chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, feature, -1);
	for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
		chip->write_byte(mtd, params[i]);
	status = chip->waitfunc(mtd, chip);
	if (status & NAND_STATUS_FAIL)
		return -EIO;
	return 0;
}