Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 615c40dd authored by Dmitry Kalinkin's avatar Dmitry Kalinkin Committed by Greg Kroah-Hartman
Browse files

staging: vme_user: refactor llseek to switch(){}



This makes vme_user_llseek ignore all minors that don't have llseek
implementation.

Signed-off-by: default avatarDmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 75c66b6d
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -430,17 +430,19 @@ static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
	size_t image_size;
	loff_t res;

	if (minor == CONTROL_MINOR)
		return -EINVAL;

	switch (type[minor]) {
	case MASTER_MINOR:
	case SLAVE_MINOR:
		mutex_lock(&image[minor].mutex);
		image_size = vme_get_size(image[minor].resource);
		res = fixed_size_llseek(file, off, whence, image_size);
		mutex_unlock(&image[minor].mutex);

		return res;
	}

	return -EINVAL;
}

/*
 * The ioctls provided by the old VME access method (the one at vmelinux.org)
 * are most certainly wrong as the effectively push the registers layout