From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.nokia.com ([192.100.105.134] helo=mgw-mx09.nokia.com) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NHz3n-0001YS-V9 for linux-mtd@lists.infradead.org; Tue, 08 Dec 2009 12:21:00 +0000 Subject: Re: [RFC] [PATCH] [MTD-UTILS]: flash_unlock: enhancing for unlocking of specified number of blocks From: Artem Bityutskiy To: Vimal Singh In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Tue, 08 Dec 2009 14:20:41 +0200 Message-Id: <1260274841.19669.51.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: , On Wed, 2009-12-02 at 20:00 +0530, Vimal Singh wrote: > This patch enhances the flash_unlock utility to be able to do > unlocking for specified blocks range. > This patch also fixes calculation of 'length' as in previous patch. > > Say there are 240 blocks present in the device. Then: > offset starts from: 0x0 > and full size of device: 0x1E00000 > > doing: 240 * 0x20000 gives -> 0x1E00000 > But last block address should be 0x1DE0000 (which spans for 0x20000 > bytes, adding up to size of 0x1E00000) > > Signed-off-by: Vimal Singh > --- > > --- a/flash_unlock.c 2009-11-24 19:33:18.000000000 +0530 > +++ b/flash_unlock.c 2009-11-24 19:36:18.000000000 +0530 > @@ -21,13 +21,14 @@ int main(int argc, char *argv[]) > int fd; > struct mtd_info_user mtdInfo; > struct erase_info_user mtdLockInfo; > + int count; > > /* > * Parse command line options > */ > - if(argc != 2) > + if(argc < 2) > { > - fprintf(stderr, "USAGE: %s \n", argv[0]); > + fprintf(stderr, "USAGE: %s