aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/mtdchar.c2
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/mtd/mtd-abi.h11
3 files changed, 13 insertions, 8 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 24d35ba62b84..1d981a5c1b13 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -495,7 +495,7 @@ static int shrink_ecclayout(const struct nand_ecclayout *from,
495 495
496 memset(to, 0, sizeof(*to)); 496 memset(to, 0, sizeof(*to));
497 497
498 to->eccbytes = min((int)from->eccbytes, MTD_MAX_ECCPOS_ENTRIES_OLD); 498 to->eccbytes = min((int)from->eccbytes, MTD_MAX_ECCPOS_ENTRIES);
499 for (i = 0; i < to->eccbytes; i++) 499 for (i = 0; i < to->eccbytes; i++)
500 to->eccpos[i] = from->eccpos[i]; 500 to->eccpos[i] = from->eccpos[i];
501 501
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 03a1e954c586..fe8d77ebec13 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -112,11 +112,11 @@ struct mtd_oob_ops {
112 112
113#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32 113#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32
114#define MTD_MAX_ECCPOS_ENTRIES_LARGE 448 114#define MTD_MAX_ECCPOS_ENTRIES_LARGE 448
115#define MTD_MAX_ECCPOS_ENTRIES_OLD 64 /* Previous maximum */
116/* 115/*
117 * Correct ECC layout control structure. This replaces old nand_ecclayout 116 * Internal ECC layout control structure. For historical reasons, there is a
118 * (mtd-abi.h) that is exported via ECCGETLAYOUT ioctl. It should be expandable 117 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained
119 * in the future simply by the above macros. 118 * for export to user-space via the ECCGETLAYOUT ioctl.
119 * nand_ecclayout should be expandable in the future simply by the above macros.
120 */ 120 */
121struct nand_ecclayout { 121struct nand_ecclayout {
122 __u32 eccbytes; 122 __u32 eccbytes;
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 5bce08384345..a57c4cb7d6b2 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -144,13 +144,18 @@ struct nand_oobfree {
144}; 144};
145 145
146#define MTD_MAX_OOBFREE_ENTRIES 8 146#define MTD_MAX_OOBFREE_ENTRIES 8
147#define MTD_MAX_ECCPOS_ENTRIES 64
147/* 148/*
148 * ECC layout control structure. Exported to userspace for 149 * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl
149 * diagnosis and to allow creation of raw images 150 * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a
151 * complete set of ECC information. The ioctl truncates the larger internal
152 * structure to retain binary compatibility with the static declaration of the
153 * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of
154 * the user struct, not the MAX size of the internal struct nand_ecclayout.
150 */ 155 */
151struct nand_ecclayout_user { 156struct nand_ecclayout_user {
152 __u32 eccbytes; 157 __u32 eccbytes;
153 __u32 eccpos[64]; 158 __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
154 __u32 oobavail; 159 __u32 oobavail;
155 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; 160 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
156}; 161};