Merge tag 'drm-fixes-for-v4.14-rc8' of git://people.freedesktop.org/~airlied/linux
[sfrench/cifs-2.6.git] / arch / arm / boot / compressed / decompress.c
1 // SPDX-License-Identifier: GPL-2.0
2 #define _LINUX_STRING_H_
3
4 #include <linux/compiler.h>     /* for inline */
5 #include <linux/types.h>        /* for size_t */
6 #include <linux/stddef.h>       /* for NULL */
7 #include <linux/linkage.h>
8 #include <asm/string.h>
9
10 extern unsigned long free_mem_ptr;
11 extern unsigned long free_mem_end_ptr;
12 extern void error(char *);
13
14 #define STATIC static
15 #define STATIC_RW_DATA  /* non-static please */
16
17 /* Diagnostic functions */
18 #ifdef DEBUG
19 #  define Assert(cond,msg) {if(!(cond)) error(msg);}
20 #  define Trace(x) fprintf x
21 #  define Tracev(x) {if (verbose) fprintf x ;}
22 #  define Tracevv(x) {if (verbose>1) fprintf x ;}
23 #  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
24 #  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
25 #else
26 #  define Assert(cond,msg)
27 #  define Trace(x)
28 #  define Tracev(x)
29 #  define Tracevv(x)
30 #  define Tracec(c,x)
31 #  define Tracecv(c,x)
32 #endif
33
34 /* Not needed, but used in some headers pulled in by decompressors */
35 extern char * strstr(const char * s1, const char *s2);
36 extern size_t strlen(const char *s);
37 extern int memcmp(const void *cs, const void *ct, size_t count);
38
39 #ifdef CONFIG_KERNEL_GZIP
40 #include "../../../../lib/decompress_inflate.c"
41 #endif
42
43 #ifdef CONFIG_KERNEL_LZO
44 #include "../../../../lib/decompress_unlzo.c"
45 #endif
46
47 #ifdef CONFIG_KERNEL_LZMA
48 #include "../../../../lib/decompress_unlzma.c"
49 #endif
50
51 #ifdef CONFIG_KERNEL_XZ
52 #define memmove memmove
53 #define memcpy memcpy
54 #include "../../../../lib/decompress_unxz.c"
55 #endif
56
57 #ifdef CONFIG_KERNEL_LZ4
58 #include "../../../../lib/decompress_unlz4.c"
59 #endif
60
61 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
62 {
63         return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
64 }