[package] comgt: move 3g hotplug handling to tty subsystem, fixes race on coldplug...
[openwrt/svn-archive/archive.git] / package / uboot-envtools / patches / 001-crc32_func_signature.patch
1 --- a/crc32.c
2 +++ b/crc32.c
3 @@ -8,11 +8,7 @@
4 * For conditions of distribution and use, see copyright notice in zlib.h
5 */
6
7 -#ifndef USE_HOSTCC /* Shut down "ANSI does not permit..." warnings */
8 -#include <common.h>
9 -#else
10 #include <stdint.h>
11 -#endif
12
13 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
14 #include <watchdog.h>
15 @@ -136,7 +132,7 @@ local const uint32_t crc_table[256] = {
16
17 #if 0
18 /* =========================================================================
19 - * This function can be used by asm versions of crc32()
20 + * This function can be used by asm versions of uboot_crc32()
21 */
22 const uint32_t * ZEXPORT get_crc_table()
23 {
24 @@ -154,7 +150,7 @@ const uint32_t * ZEXPORT get_crc_table()
25 #define DO8(buf) DO4(buf); DO4(buf);
26
27 /* ========================================================================= */
28 -uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *buf, uInt len)
29 +uint32_t ZEXPORT uboot_crc32 (uint32_t crc, const Bytef *buf, uInt len)
30 {
31 #ifdef DYNAMIC_CRC_TABLE
32 if (crc_table_empty)
33 @@ -217,12 +213,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
34 chunk = end - curr;
35 if (chunk > chunk_sz)
36 chunk = chunk_sz;
37 - crc = crc32 (crc, curr, chunk);
38 + crc = uboot_crc32 (crc, curr, chunk);
39 curr += chunk;
40 WATCHDOG_RESET ();
41 }
42 #else
43 - crc = crc32 (crc, buf, len);
44 + crc = uboot_crc32 (crc, buf, len);
45 #endif
46
47 return crc;
48 --- a/fw_env.c
49 +++ b/fw_env.c
50 @@ -216,9 +216,9 @@ static int parse_config (void);
51 #if defined(CONFIG_FILE)
52 static int get_config (char *);
53 #endif
54 -static inline ulong getenvsize (void)
55 +static inline uint32_t getenvsize (void)
56 {
57 - ulong rc = CONFIG_ENV_SIZE - sizeof (long);
58 + uint32_t rc = CONFIG_ENV_SIZE - sizeof (uint32_t);
59
60 if (HaveRedundEnv)
61 rc -= sizeof (char);
62 @@ -437,7 +437,7 @@ int fw_setenv (int argc, char *argv[])
63 /*
64 * Update CRC
65 */
66 - *environment.crc = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
67 + *environment.crc = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
68
69 /* write environment back to flash */
70 if (flash_io (O_RDWR)) {
71 @@ -627,7 +627,7 @@ static int flash_write_buf (int dev, int
72 data = malloc (erase_len);
73 if (!data) {
74 fprintf (stderr,
75 - "Cannot malloc %u bytes: %s\n",
76 + "Cannot malloc %zu bytes: %s\n",
77 erase_len, strerror (errno));
78 return -1;
79 }
80 @@ -883,11 +883,11 @@ static char *envmatch (char * s1, char *
81 static int env_init (void)
82 {
83 int crc0, crc0_ok;
84 - char flag0;
85 + unsigned char flag0;
86 void *addr0;
87
88 int crc1, crc1_ok;
89 - char flag1;
90 + unsigned char flag1;
91 void *addr1;
92
93 struct env_image_single *single;
94 @@ -923,7 +923,7 @@ static int env_init (void)
95 if (flash_io (O_RDONLY))
96 return -1;
97
98 - crc0 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
99 + crc0 = uboot_crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
100 crc0_ok = (crc0 == *environment.crc);
101 if (!HaveRedundEnv) {
102 if (!crc0_ok) {
103 @@ -964,7 +964,7 @@ static int env_init (void)
104 return -1;
105 }
106
107 - crc1 = crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
108 + crc1 = uboot_crc32 (0, (uint8_t *) redundant->data, ENV_SIZE);
109 crc1_ok = (crc1 == redundant->crc);
110 flag1 = redundant->flags;
111
112 --- a/fw_env.h
113 +++ b/fw_env.h
114 @@ -47,8 +47,10 @@
115 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " \
116 "bootm"
117
118 +# include <stdint.h>
119 +
120 extern int fw_printenv(int argc, char *argv[]);
121 extern char *fw_getenv (char *name);
122 extern int fw_setenv (int argc, char *argv[]);
123
124 -extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned);
125 +extern uint32_t uboot_crc32 (uint32_t, const unsigned char *, unsigned);