All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: MTD Maling List <linux-mtd@lists.infradead.org>,
	Shmulik Ladkani <shmulik.ladkani@gmail.com>
Subject: [PATCH 3/5] UBI: fastmap: more nitpicks
Date: Tue,  5 Jun 2012 18:11:57 +0300	[thread overview]
Message-ID: <1338909119-5188-4-git-send-email-dedekind1@gmail.com> (raw)
In-Reply-To: <1338909119-5188-1-git-send-email-dedekind1@gmail.com>

From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

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 <artem.bityutskiy@linux.intel.com>
---
 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) {
-- 
1.7.10

  parent reply	other threads:[~2012-06-05 15:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 15:11 [PATCH 0/5] UBI: fastmap: add few todos Artem Bityutskiy
2012-06-05 15:11 ` [PATCH 1/5] UBI: fastmap: add more TODOs Artem Bityutskiy
2012-06-06 21:30   ` Richard Weinberger
2012-06-06 23:38     ` Artem Bityutskiy
2012-06-06 23:46       ` Richard Weinberger
2012-06-06 23:45         ` Artem Bityutskiy
2012-06-05 15:11 ` [PATCH 2/5] UBI: fastmap: kill junk newlines and add a TODO about that Artem Bityutskiy
2012-06-06 21:30   ` Richard Weinberger
2012-06-06 23:29     ` Artem Bityutskiy
2012-06-05 15:11 ` Artem Bityutskiy [this message]
2012-06-06 21:30   ` [PATCH 3/5] UBI: fastmap: more nitpicks Richard Weinberger
2012-06-05 15:11 ` [PATCH 4/5] UBI: fastmap: more annoying TODOs Artem Bityutskiy
2012-06-05 15:11 ` [PATCH 5/5] UBI: fastmap: more tiny TODOs Artem Bityutskiy
2012-06-06 21:30   ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338909119-5188-4-git-send-email-dedekind1@gmail.com \
    --to=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=shmulik.ladkani@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.