From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.nokia.com ([192.100.122.233] helo=mgw-mx06.nokia.com) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NaVek-0007Jn-QI for linux-mtd@lists.infradead.org; Thu, 28 Jan 2010 14:47:43 +0000 Subject: Re: [PATCH v2 2/2] Creating helper func for block alignment verfication From: Artem Bityutskiy To: Vimal Singh In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Thu, 28 Jan 2010 16:46:43 +0200 Message-ID: <1264690003.1973.138.camel@localhost> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Linux MTD Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi, On Wed, 2010-01-13 at 18:59 +0530, Vimal Singh wrote: > From 310f7faa8f319bd9384512f7d5a7f13dcfbeebc8 Mon Sep 17 00:00:00 2001 > From: Vimal Singh > Date: Wed, 13 Jan 2010 18:11:47 +0530 > Subject: [PATCH] Creating helper func for block alignment verfication > > These checks are fairly common in 'nand_erase_nand', 'nand_lock' > and 'nand_unlock' functions. > > Signed-off-by: Vimal Singh > --- > drivers/mtd/nand/nand_base.c | 97 +++++++++++++++--------------------------- > 1 files changed, 34 insertions(+), 63 deletions(-) > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index 4e27426..c80cec5 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -108,6 +108,37 @@ static int nand_do_write_oob(struct > */ > DEFINE_LED_TRIGGER(nand_led_trigger); > > +static int block_alignment_verification(struct mtd_info *mtd, > + loff_t ofs, uint64_t len) > +{ This function checks not only alignment, so the name is bad. I suggest check_offs_len() - it at least does not lie about what it does :-) > + struct nand_chip *chip = mtd->priv; > + > + DEBUG(MTD_DEBUG_LEVEL3, "%s: start = 0x%012llx, len = %llu\n", > + __func__, (unsigned long long)ofs, len); No, you should keep the DEBUG part in the caller. Because of __func__. Also please, introduce the helper in the _first_ patch, and then use it in your functions in the second patch. This is more logical. -- Best Regards, Artem Bityutskiy (Артём Битюцкий)