/* The underlying MTD device may cache data in hardware or in software. This function ensures the caches are flushed. Returns zero in case of success and a negative error code in case of failure.  */
int ubi_sync(int ubi_num)
/* The underlying MTD device may cache data in hardware or in software. This function ensures the caches are flushed. Returns zero in case of success and a negative error code in case of failure.  */
int ubi_sync(int ubi_num)
{
	struct ubi_device *ubi;
	ubi = ubi_get_device(ubi_num);
	if (!ubi)
		return -ENODEV;
	mtd_sync(ubi->mtd);
	ubi_put_device(ubi);
	return 0;
}