aboutsummaryrefslogtreecommitdiff
path: root/flash_info.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-06-06 00:09:10 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-06 15:25:56 +0300
commit3e4c601e5c00f3bb5844402954d9b9dcf9387da2 (patch)
tree316c949660206db72216da853a7c9803af8d80e1 /flash_info.c
parent21fd84ba4d580b47e15e8e5e13e1e9cb47481e44 (diff)
flash_lock/flash_unlock/flash_info: clean up style
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'flash_info.c')
-rw-r--r--flash_info.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/flash_info.c b/flash_info.c
index ad7b30a..f8b7efa 100644
--- a/flash_info.c
+++ b/flash_info.c
@@ -14,44 +14,39 @@
#include <mtd/mtd-user.h>
-int main(int argc,char *argv[])
+int main(int argc, char *argv[])
{
int regcount;
- int Fd;
+ int fd;
- if (1 >= argc)
- {
- fprintf(stderr,"Usage: %s device\n", PROGRAM_NAME);
+ if (1 >= argc) {
+ fprintf(stderr, "Usage: %s device\n", PROGRAM_NAME);
return 16;
}
- // Open and size the device
- if ((Fd = open(argv[1],O_RDONLY)) < 0)
- {
- fprintf(stderr,"File open error\n");
+ /* Open and size the device */
+ fd = open(argv[1], O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "File open error\n");
return 8;
}
- if (ioctl(Fd,MEMGETREGIONCOUNT,&regcount) == 0)
- {
+ if (ioctl(fd, MEMGETREGIONCOUNT, &regcount) == 0) {
int i;
region_info_t reginfo;
printf("Device %s has %d erase regions\n", argv[1], regcount);
- for (i = 0; i < regcount; i++)
- {
+ for (i = 0; i < regcount; i++) {
reginfo.regionindex = i;
- if(ioctl(Fd, MEMGETREGIONINFO, &reginfo) == 0)
- {
+ if (ioctl(fd, MEMGETREGIONINFO, &reginfo) == 0) {
printf("Region %d is at 0x%x with size 0x%x and "
"has 0x%x blocks\n", i, reginfo.offset,
reginfo.erasesize, reginfo.numblocks);
- }
- else
- {
+ } else {
printf("Strange can not read region %d from a %d region device\n",
i, regcount);
}
}
}
+
return 0;
}