mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
UBI: add ubi_sync() interface
To flush MTD device caches. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
parent
73789a3d9f
commit
a5bf619041
@ -632,3 +632,27 @@ int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum)
|
||||
return vol->eba_tbl[lnum] >= 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ubi_is_mapped);
|
||||
|
||||
/**
|
||||
* ubi_sync - synchronize UBI device buffers.
|
||||
* @ubi_num: UBI device to synchronize
|
||||
*
|
||||
* 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;
|
||||
|
||||
if (ubi->mtd->sync)
|
||||
ubi->mtd->sync(ubi->mtd);
|
||||
|
||||
ubi_put_device(ubi);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ubi_sync);
|
||||
|
@ -152,6 +152,7 @@ int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
|
||||
int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
|
||||
int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype);
|
||||
int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
|
||||
int ubi_sync(int ubi_num);
|
||||
|
||||
/*
|
||||
* This function is the same as the 'ubi_leb_read()' function, but it does not
|
||||
|
Loading…
Reference in New Issue
Block a user