aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-08-08 13:06:28 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-08-08 13:06:28 +0000
commitc202ef57b1e002ad198e066c8a8ffc23a645bca9 (patch)
tree97d60aab75c9a4a3f50622b95f575fcc0899bd16 /target/linux/ar71xx
parent8f854e27c89bb089ac6da7a01f6f334c8fb55e3d (diff)
downloadupstream-c202ef57b1e002ad198e066c8a8ffc23a645bca9.tar.gz
upstream-c202ef57b1e002ad198e066c8a8ffc23a645bca9.tar.bz2
upstream-c202ef57b1e002ad198e066c8a8ffc23a645bca9.zip
WRT160NL: mtd parser cleanup
SVN-Revision: 17177
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c b/target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c
index f31d56ce28..d76be1a39c 100644
--- a/target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c
+++ b/target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c
@@ -41,7 +41,7 @@ struct trx_header {
};
#define IH_MAGIC 0x27051956 /* Image Magic Number */
-#define IH_NMLEN 32 /* Image Name Length */
+#define IH_NMLEN 32 /* Image Name Length */
struct uimage_header {
uint32_t ih_magic; /* Image Header Magic Number */
@@ -66,32 +66,31 @@ static int create_mtd_partitions(struct mtd_info *master,
{
uint8_t buf[512];
int len;
- struct trx_header* header;
- struct uimage_header* uheader;
+ struct trx_header *header;
+ struct uimage_header *uheader;
unsigned int kernel_len;
master->read(master, 4 * master->erasesize, sizeof(buf), &len, buf);
- if(strncmp(buf, "NL16", 4) == 0) {
+ if (strncmp(buf, "NL16", 4) == 0) {
printk(KERN_INFO "TRX on WRT160NL detected\n");
- header = (struct trx_header*)(buf + 32);
-
- if(le32_to_cpu(header->magic) != TRX_MAGIC) {
+ header = (struct trx_header *)(buf + 32);
+ if (le32_to_cpu(header->magic) != TRX_MAGIC) {
printk(KERN_WARNING "TRX messed up\n");
return 0;
}
- uheader = (struct uimage_header*)(buf + 60);
-
- if(uheader->ih_magic != IH_MAGIC) {
+ uheader = (struct uimage_header *)(buf + 60);
+ if (uheader->ih_magic != IH_MAGIC) {
printk(KERN_WARNING "uImage messed up\n");
return 0;
}
kernel_len = uheader->ih_size / master->erasesize;
- if(uheader->ih_size % master->erasesize)
- kernel_len++;
+ if (uheader->ih_size % master->erasesize)
kernel_len++;
+
+ kernel_len++;
kernel_len *= master->erasesize;
trx_parts[0].name = "u-boot";
@@ -112,9 +111,9 @@ static int create_mtd_partitions(struct mtd_info *master,
trx_parts[3].name = "nvram";
trx_parts[3].offset = master->size - 2 * master->erasesize;
trx_parts[3].size = master->erasesize;
- trx_parts[3].mask_flags = 0;
+ trx_parts[3].mask_flags = MTD_WRITEABLE;
- trx_parts[4].name = "ART";
+ trx_parts[4].name = "art";
trx_parts[4].offset = master->size - master->erasesize;
trx_parts[4].size = master->erasesize;
trx_parts[4].mask_flags = MTD_WRITEABLE;
@@ -133,9 +132,9 @@ static int create_mtd_partitions(struct mtd_info *master,
}
static struct mtd_part_parser trx_parser = {
- .owner = THIS_MODULE,
- .parse_fn = create_mtd_partitions,
- .name = "wrt160nl",
+ .owner = THIS_MODULE,
+ .parse_fn = create_mtd_partitions,
+ .name = "wrt160nl",
};
static int __init trx_parser_init(void)