7ae8b1db6c38c64b82a7ded4f5ae571fe34f90c8
[15.05/openwrt.git] / target / linux / generic / patches-3.18 / 030-backport_bcm47xx_nvram.patch
1 --- /dev/null
2 +++ b/include/linux/bcm47xx_nvram.h
3 @@ -0,0 +1,49 @@
4 +/*
5 + *  This program is free software; you can redistribute  it and/or modify it
6 + *  under  the terms of  the GNU General  Public License as published by the
7 + *  Free Software Foundation;  either version 2 of the  License, or (at your
8 + *  option) any later version.
9 + */
10 +
11 +#ifndef __BCM47XX_NVRAM_H
12 +#define __BCM47XX_NVRAM_H
13 +
14 +#include <linux/types.h>
15 +#include <linux/kernel.h>
16 +#include <linux/vmalloc.h>
17 +
18 +#ifdef CONFIG_BCM47XX_NVRAM
19 +int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
20 +int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
21 +int bcm47xx_nvram_gpio_pin(const char *name);
22 +char *bcm47xx_nvram_get_contents(size_t *val_len);
23 +static inline void bcm47xx_nvram_release_contents(char *nvram)
24 +{
25 +       vfree(nvram);
26 +};
27 +#else
28 +static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
29 +{
30 +       return -ENOTSUPP;
31 +};
32 +static inline int bcm47xx_nvram_getenv(const char *name, char *val,
33 +                                      size_t val_len)
34 +{
35 +       return -ENOTSUPP;
36 +};
37 +static inline int bcm47xx_nvram_gpio_pin(const char *name)
38 +{
39 +       return -ENOTSUPP;
40 +};
41 +
42 +static inline char *bcm47xx_nvram_get_contents(size_t *val_len)
43 +{
44 +       return NULL;
45 +};
46 +
47 +static inline void bcm47xx_nvram_release_contents(char *nvram)
48 +{
49 +};
50 +#endif
51 +
52 +#endif /* __BCM47XX_NVRAM_H */