/* Return: 0 on success, a negative error code otherwise.  */
int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val)
/* Return: 0 on success, a negative error code otherwise.  */
int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val)
{
	int ret;
	u8 cfg;
	ret = spinand_get_cfg(spinand, &cfg);
	if (ret)
		return ret;
	cfg &= ~mask;
	cfg |= val;
	return spinand_set_cfg(spinand, cfg);
}