From patchwork Tue Jun 5 15:11:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 163095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D6C7BB6EF3 for ; Wed, 6 Jun 2012 01:12:15 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SbvPQ-0004IR-AZ; Tue, 05 Jun 2012 15:11:00 +0000 Received: from mga09.intel.com ([134.134.136.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SbvPE-0004Gc-BG for linux-mtd@lists.infradead.org; Tue, 05 Jun 2012 15:10:49 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 05 Jun 2012 08:10:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="153188565" Received: from blue.fi.intel.com ([10.237.72.50]) by orsmga002.jf.intel.com with ESMTP; 05 Jun 2012 08:10:46 -0700 From: Artem Bityutskiy To: Richard Weinberger Subject: [PATCH 3/5] UBI: fastmap: more nitpicks Date: Tue, 5 Jun 2012 18:11:57 +0300 Message-Id: <1338909119-5188-4-git-send-email-dedekind1@gmail.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1338909119-5188-1-git-send-email-dedekind1@gmail.com> References: <1338909119-5188-1-git-send-email-dedekind1@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [134.134.136.24 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dedekind1[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 0.8 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: MTD Maling List , Shmulik Ladkani X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 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-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Artem Bityutskiy Again, I feel that this may be annoing for others, but it will make me happier if I see UBI code having consistent style. After all, people come and go but I stay maintaining this stuff so I want reading the code to be pleasant for me. So please, bear with my strange requirements, I will not add this long explanation anymore, ok? :-) Anyway, in UBI/UBIFS we try to put identifiers of the same type on one line, if it fits them. Also, we do not add blank lines to the identifiers declaration block. If your function is so huge that it has too many local variables and you need to group it - fix the function - split it instead. I've also added a TODO about this. If you could change this globally - it would make me happier and I'd read your code with more pleasure. Signed-off-by: Artem Bityutskiy --- drivers/mtd/ubi/fastmap.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index b2ee872..e6900e4 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -447,6 +447,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, { struct list_head used; struct list_head eba_orphans; + /* TODO: please, try to declare variables of the same time on one line */ struct ubi_ainf_volume *av; struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb; struct ubi_ec_hdr *ech; @@ -458,6 +459,8 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, struct ubi_fm_volhdr *fmvhdr; struct ubi_fm_eba *fm_eba; + /* TODO: no blank lines in the local variable declaration block + * please. */ int ret, i, j; size_t fm_pos = 0; unsigned long long max_sqnum = 0; @@ -735,8 +738,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai) struct ubi_fm_sb *fmsb; struct ubi_vid_hdr *vh; struct ubi_ec_hdr *ech; - int ret, i, used_blocks, pnum; - int sb_pnum = 0; + int ret, i, used_blocks, pnum, sb_pnum = 0; char *fm_raw; size_t fm_size; __be32 crc, tmp_crc; @@ -961,25 +963,19 @@ out: static int ubi_write_fastmap(struct ubi_device *ubi, struct ubi_fastmap_layout *new_fm) { - int ret; size_t fm_pos = 0; char *fm_raw; - int i, j; - struct ubi_fm_sb *fmsb; struct ubi_fm_hdr *fmh; struct ubi_fm_scan_pool *fmpl; struct ubi_fm_ec *fec; struct ubi_fm_volhdr *fvh; struct ubi_fm_eba *feba; - struct rb_node *node; struct ubi_wl_entry *wl_e; struct ubi_volume *vol; - struct ubi_vid_hdr *avhdr, *dvhdr; - - int free_peb_count, used_peb_count, vol_count; + int ret, i, j, free_peb_count, used_peb_count, vol_count; fm_raw = vzalloc(new_fm->size); if (!fm_raw) {