From: Dmitry Kalinkin Date: Thu, 28 May 2015 12:07:02 +0000 (+0300) Subject: staging: vme_user: refactor llseek to switch(){} X-Git-Tag: firefly_0821_release~176^2~1545^2~160 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=615c40dd9f884add78cc3048167b59856d241fa3;p=firefly-linux-kernel-4.4.55.git staging: vme_user: refactor llseek to switch(){} This makes vme_user_llseek ignore all minors that don't have llseek implementation. Signed-off-by: Dmitry Kalinkin Cc: Igor Alekseev Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 19ba749bb122..da828f48b2ef 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -430,15 +430,17 @@ 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; - - 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); + 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 res; + return -EINVAL; } /*