Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754806AbbERS5P (ORCPT ); Mon, 18 May 2015 14:57:15 -0400 Received: from mail-la0-f65.google.com ([209.85.215.65]:36762 "EHLO mail-la0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754684AbbERS5A (ORCPT ); Mon, 18 May 2015 14:57:00 -0400 From: Dmitry Kalinkin To: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Cc: Martyn Welch , Manohar Vanga , Greg Kroah-Hartman , Igor Alekseev , Dmitry Kalinkin Subject: [PATCH 5/6] staging: vme_user: refactor llseek to switch(){} Date: Mon, 18 May 2015 21:56:32 +0300 Message-Id: <1431975393-19735-6-git-send-email-dmitry.kalinkin@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1431975393-19735-1-git-send-email-dmitry.kalinkin@gmail.com> References: <1431975393-19735-1-git-send-email-dmitry.kalinkin@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1455 Lines: 47 This makes vme_user_llseek ignore all minors that don't have llseek implementation. Signed-off-by: Dmitry Kalinkin Cc: Igor Alekseev --- drivers/staging/vme/devices/vme_user.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 19ba749..da828f4 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; } /* -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/