/* revoke_exclusive - revoke exclusive mode. @desc: volume descriptor @mode: new mode to switch to  */
static void revoke_exclusive(struct ubi_volume_desc *desc, int mode)
/* revoke_exclusive - revoke exclusive mode. @desc: volume descriptor @mode: new mode to switch to  */
static void revoke_exclusive(struct ubi_volume_desc *desc, int mode)
{
	struct ubi_volume *vol = desc->vol;
	spin_lock(&vol->ubi->volumes_lock);
	ubi_assert(vol->readers == 0 && vol->writers == 0);
	ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE);
	vol->exclusive = 0;
	if (mode == UBI_READONLY)
		vol->readers = 1;
	else if (mode == UBI_READWRITE)
		vol->writers = 1;
	else
		vol->exclusive = 1;
	spin_unlock(&vol->ubi->volumes_lock);
	desc->mode = mode;
}