From patchwork Tue Dec 31 11:43:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saumya Ranjan Kuanr X-Patchwork-Id: 305870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BC7072C00BE for ; Tue, 31 Dec 2013 22:44:47 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VxxkN-0003Gg-UE; Tue, 31 Dec 2013 11:44:32 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VxxkM-00081i-8q; Tue, 31 Dec 2013 11:44:30 +0000 Received: from mail-pb0-x22b.google.com ([2607:f8b0:400e:c01::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VxxkJ-00080d-1E for linux-mtd@lists.infradead.org; Tue, 31 Dec 2013 11:44:28 +0000 Received: by mail-pb0-f43.google.com with SMTP id rq2so12562759pbb.2 for ; Tue, 31 Dec 2013 03:44:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=bTbNIWRSlh7pXAJFd4oMck3+EosWv0MWBAjncigGBAY=; b=oymcDns0SnPeke86uFAaGX4L9PM7ytgedHYHUWF+xAMGlnaatiCw85sGVzvJMh4/vL KgKwnvyxaSUCsOR/Cvh+zt1bntEfZStfeAueakqcKfj2r3fpOj8tn/QaH0xKdogu6b6l pQBovUl4bJE+rMc5Bo8LGmr99ggKt4y/LSisgOIm1jG3hZEbBRH/bQXLFJjVnEuLY2XE WiTx9FHjqOST2VNGikPAA0hPxxoGbe3Ft0NNyV2MegoZWc9Jf3opAoAP9iiFdH/sqv8H MrICFrwHPL20P+LZEs1WQdd4OYAG3WHi/fi3HLDWS3qzK9P0D51CnnqS2ksyZ8NBEfpp EMRQ== X-Received: by 10.68.75.9 with SMTP id y9mr21030448pbv.61.1388490243534; Tue, 31 Dec 2013 03:44:03 -0800 (PST) Received: from ubuntu.localdomain (71-35-64-200.phnx.qwest.net. [71.35.64.200]) by mx.google.com with ESMTPSA id fk4sm115186159pab.23.2013.12.31.03.44.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 31 Dec 2013 03:44:02 -0800 (PST) From: Saumya Ranjan Kuanr To: dwmw2@infradead.org Subject: [PATCH] mtd: fixed few coding style and indentation issues Date: Tue, 31 Dec 2013 03:43:19 -0800 Message-Id: <1388490199-26517-1-git-send-email-saumyakuanr@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Antivirus: avast! (VPS 131230-1, 30-12-2013), Outbound message X-Antivirus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131231_064427_181305_D45BFFAD X-CRM114-Status: GOOD ( 14.14 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (saumyakuanr[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Saumya Ranjan Kuanr , Saumya Ranjan Kuanr , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Saumya Ranjan Kuanr fixed few coding style and indentatiuon issues signed-off-by: Saumya Ranjan Kuanr --- drivers/mtd/mtdchar.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 684bfa3..b008744 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -181,8 +182,8 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count, struct mtd_file_info *mfi = file->private_data; struct mtd_info *mtd = mfi->mtd; size_t retlen; - size_t total_retlen=0; - int ret=0; + size_t total_retlen = 0; + int ret = 0; int len; size_t size = count; char *kbuf; @@ -241,16 +242,14 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count, if (copy_to_user(buf, kbuf, retlen)) { kfree(kbuf); return -EFAULT; - } - else + } else total_retlen += retlen; count -= retlen; buf += retlen; if (retlen == 0) count = 0; - } - else { + } else { kfree(kbuf); return ret; } @@ -269,8 +268,8 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c size_t size = count; char *kbuf; size_t retlen; - size_t total_retlen=0; - int ret=0; + size_t total_retlen = 0; + int ret = 0; int len; pr_debug("MTD_write\n"); @@ -328,8 +327,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c total_retlen += retlen; count -= retlen; buf += retlen; - } - else { + } else { kfree(kbuf); return ret; } @@ -344,7 +342,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c IOCTL calls for getting device parameters. ======================================================================*/ -static void mtdchar_erase_callback (struct erase_info *instr) +static void mtdchar_erase_callback(struct erase_info *instr) { wake_up((wait_queue_head_t *)instr->priv); } @@ -670,10 +668,10 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) { struct erase_info *erase; - if(!(file->f_mode & FMODE_WRITE)) + if (!(file->f_mode & FMODE_WRITE)) return -EPERM; - erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL); + erase = kzalloc(sizeof(struct erase_info), GFP_KERNEL); if (!erase) ret = -ENOMEM; else { @@ -726,7 +724,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) remove_wait_queue(&waitq, &wait); set_current_state(TASK_RUNNING); - ret = (erase->state == MTD_ERASE_FAILED)?-EIO:0; + ret = (erase->state == MTD_ERASE_FAILED) ? -EIO : 0; } kfree(erase); } @@ -958,7 +956,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) { mfi->mode = 0; - switch(arg) { + switch (arg) { case MTD_FILE_MODE_OTP_FACTORY: case MTD_FILE_MODE_OTP_USER: ret = otp_select_filemode(mfi, arg); @@ -1099,7 +1097,7 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, return (unsigned long) -EINVAL; ret = mtd_get_unmapped_area(mtd, len, offset, flags); - return ret == -EOPNOTSUPP ? -ENOSYS : ret; + return ret == -EOPNOTSUPP ? -ENODEV : ret; } #endif @@ -1113,7 +1111,7 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) struct mtd_info *mtd = mfi->mtd; struct map_info *map = mtd->priv; - /* This is broken because it assumes the MTD device is map-based + /* This is broken because it assumes the MTD device is map-based and that mtd->priv is a valid struct map_info. It should be replaced with something that uses the mtd_get_unmapped_area() operation properly. */ @@ -1124,9 +1122,9 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) #endif return vm_iomap_memory(vma, map->phys, map->size); } - return -ENOSYS; + return -ENODEV; #else - return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS; + return vma->vm_flags & VM_SHARED ? 0 : -EACCES; #endif } @@ -1159,9 +1157,9 @@ static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type, } static struct file_system_type mtd_inodefs_type = { - .name = "mtd_inodefs", - .mount = mtd_inodefs_mount, - .kill_sb = kill_anon_super, + .name = "mtd_inodefs", + .mount = mtd_inodefs_mount, + .kill_sb = kill_anon_super, }; MODULE_ALIAS_FS("mtd_inodefs");