/* Returns 0 on success, a negative error code otherwise.  */
int nand_readid_op(struct nand_chip *chip, u8 addr, void *buf, unsigned int len)
/* Returns 0 on success, a negative error code otherwise.  */
int nand_readid_op(struct nand_chip *chip, u8 addr, void *buf, unsigned int len)
{
	struct mtd_info *mtd = nand_to_mtd(chip);
	unsigned int i;
	u8 *id = buf;
	if (len && !buf)
		return -EINVAL;
	chip->cmdfunc(mtd, NAND_CMD_READID, addr, -1);
	for (i = 0; i < len; i++)
		id[i] = chip->read_byte(mtd);
	return 0;
}