mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-28 04:15:20 +02:00
ar71xx: use dynamically allocated partitions in wrt160nl_part
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29970 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b623047424
commit
41e9c172ba
@ -77,8 +77,6 @@ struct wrt160nl_header {
|
|||||||
struct uimage_header uimage;
|
struct uimage_header uimage;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
static struct mtd_partition trx_parts[TRX_PARTS];
|
|
||||||
|
|
||||||
#define WRT160NL_UBOOT_LEN 0x40000
|
#define WRT160NL_UBOOT_LEN 0x40000
|
||||||
#define WRT160NL_ART_LEN 0x10000
|
#define WRT160NL_ART_LEN 0x10000
|
||||||
#define WRT160NL_NVRAM_LEN 0x10000
|
#define WRT160NL_NVRAM_LEN 0x10000
|
||||||
@ -90,6 +88,7 @@ static int wrt160nl_parse_partitions(struct mtd_info *master,
|
|||||||
struct wrt160nl_header *header;
|
struct wrt160nl_header *header;
|
||||||
struct trx_header *theader;
|
struct trx_header *theader;
|
||||||
struct uimage_header *uheader;
|
struct uimage_header *uheader;
|
||||||
|
struct mtd_partition *trx_parts;
|
||||||
size_t retlen;
|
size_t retlen;
|
||||||
unsigned int kernel_len;
|
unsigned int kernel_len;
|
||||||
unsigned int uboot_len;
|
unsigned int uboot_len;
|
||||||
@ -101,10 +100,17 @@ static int wrt160nl_parse_partitions(struct mtd_info *master,
|
|||||||
nvram_len = max_t(unsigned int, master->erasesize, WRT160NL_NVRAM_LEN);
|
nvram_len = max_t(unsigned int, master->erasesize, WRT160NL_NVRAM_LEN);
|
||||||
art_len = max_t(unsigned int, master->erasesize, WRT160NL_ART_LEN);
|
art_len = max_t(unsigned int, master->erasesize, WRT160NL_ART_LEN);
|
||||||
|
|
||||||
|
trx_parts = kzalloc(TRX_PARTS * sizeof(struct mtd_partition),
|
||||||
|
GFP_KERNEL);
|
||||||
|
if (!trx_parts) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
header = vmalloc(sizeof(*header));
|
header = vmalloc(sizeof(*header));
|
||||||
if (!header) {
|
if (!header) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
goto free_parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = master->read(master, uboot_len, sizeof(*header),
|
ret = master->read(master, uboot_len, sizeof(*header),
|
||||||
@ -169,11 +175,15 @@ static int wrt160nl_parse_partitions(struct mtd_info *master,
|
|||||||
trx_parts[5].size = master->size - uboot_len - nvram_len - art_len;
|
trx_parts[5].size = master->size - uboot_len - nvram_len - art_len;
|
||||||
trx_parts[5].mask_flags = 0;
|
trx_parts[5].mask_flags = 0;
|
||||||
|
|
||||||
|
vfree(header);
|
||||||
|
|
||||||
*pparts = trx_parts;
|
*pparts = trx_parts;
|
||||||
ret = TRX_PARTS;
|
return TRX_PARTS;
|
||||||
|
|
||||||
free_hdr:
|
free_hdr:
|
||||||
vfree(header);
|
vfree(header);
|
||||||
|
free_parts:
|
||||||
|
kfree(trx_parts);
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- a/drivers/mtd/wrt160nl_part.c
|
--- a/drivers/mtd/wrt160nl_part.c
|
||||||
+++ b/drivers/mtd/wrt160nl_part.c
|
+++ b/drivers/mtd/wrt160nl_part.c
|
||||||
@@ -85,7 +85,7 @@ static struct mtd_partition trx_parts[TR
|
@@ -83,7 +83,7 @@ struct wrt160nl_header {
|
||||||
|
|
||||||
static int wrt160nl_parse_partitions(struct mtd_info *master,
|
static int wrt160nl_parse_partitions(struct mtd_info *master,
|
||||||
struct mtd_partition **pparts,
|
struct mtd_partition **pparts,
|
||||||
|
Loading…
Reference in New Issue
Block a user