toolchain/gcc: bump GCC 6.1.0 to 6.2.0
[openwrt/staging/wigyori.git] / package / boot / kobs-ng / patches / 001-fix-mtd-defines.patch
1 From: Paul B. Henson <henson@acm.org>
2
3 Newer kernel headers renamed mtd mode defines and no longer support
4 MEMSETOOBSEL. Allow code to work with both older and newer kernel
5 versions.
6
7 Signed-off-by: Paul B. Henson <henson@acm.org>
8 ---
9
10 http://git.buildroot.net/buildroot/plain/package/kobs-ng/kobs-ng-fix-mtd-defines.patch
11
12 --- a/src/mtd.c
13 +++ b/src/mtd.c
14 @@ -852,8 +852,11 @@ void mtd_close(struct mtd_data *md)
15 mp = &md->part[i];
16
17 if (mp->fd != -1) {
18 +/* Newer kernels dropped MEMSETOOBSEL */
19 +#ifdef MEMSETOOBSEL
20 (void)ioctl(mp->fd, MEMSETOOBSEL,
21 &mp->old_oobinfo);
22 +#endif
23 close(mp->fd);
24 }
25
26 @@ -896,6 +899,8 @@ int mtd_set_ecc_mode(struct mtd_data *md
27 continue;
28 }
29
30 +/* Newer kernels dropped MEMSETOOBSEL */
31 +#ifdef MEMSETOOBSEL
32 if (r == -ENOTTY) {
33 r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo);
34 if (r != 0) {
35 @@ -904,6 +909,7 @@ int mtd_set_ecc_mode(struct mtd_data *md
36 }
37 mp->oobinfochanged = 0;
38 }
39 +#endif
40 } else {
41 r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW);
42 if (r != 0 && r != -ENOTTY) {
43 @@ -911,6 +917,8 @@ int mtd_set_ecc_mode(struct mtd_data *md
44 continue;
45 }
46
47 +/* Newer kernels dropped MEMSETOOBSEL */
48 +#ifdef MEMSETOOBSEL
49 if (r == -ENOTTY) {
50 r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo);
51 if (r != 0) {
52 @@ -920,6 +928,7 @@ int mtd_set_ecc_mode(struct mtd_data *md
53 mp->oobinfochanged = 1;
54 } else
55 mp->oobinfochanged = 2;
56 +#endif
57 }
58
59 mp->ecc = ecc;
60 --- a/src/mtd.h
61 +++ b/src/mtd.h
62 @@ -31,6 +31,14 @@
63 #include "BootControlBlocks.h"
64 #include "rom_nand_hamming_code_ecc.h"
65
66 +// Newer kernel headers renamed define
67 +#ifndef MTD_MODE_NORMAL
68 +#define MTD_MODE_NORMAL MTD_FILE_MODE_NORMAL
69 +#endif
70 +#ifndef MTD_MODE_RAW
71 +#define MTD_MODE_RAW MTD_FILE_MODE_RAW
72 +#endif
73 +
74 //------------------------------------------------------------------------------
75 // Re-definitions of true and false, because the standard ones aren't good
76 // enough?