[OpenWrt-Devel] [PATCH] bcm53xx: Add functions to get/release copies of nvram contents.
Felix Fietkau
nbd at openwrt.org
Tue May 12 16:03:19 EDT 2015
On 2015-05-12 15:10, Hante Meuleman wrote:
> Added two functions to the bcm47xx_nvram module to get and release copies
> of the complete nvram contents. This can be used by for example brcmfmac
> to get complete nvram contents which will after some parsing be sent to
> device.
>
> Signed-off-by: Hante Meuleman <meuleman at broadcom.com>
> ---
> diff --git a/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c b/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c
> index d0055a4..96d2308 100644
> --- a/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c
> +++ b/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c
> @@ -222,4 +222,32 @@ int bcm47xx_nvram_gpio_pin(const char *name)
> }
> EXPORT_SYMBOL(bcm47xx_nvram_gpio_pin);
>
> +char *bcm47xx_nvram_get_contents(size_t *nvram_size)
> +{
> + int err;
> + char *nvram;
> +
> + if (!nvram_buf[0]) {
> + err = nvram_init();
> + if (err)
> + return NULL;
> + }
> +
> + *nvram_size = nvram_len - sizeof(struct nvram_header);
> + nvram = vmalloc(*nvram_size);
> + if (nvram == NULL)
> + return NULL;
> + memcpy(nvram, &nvram_buf[sizeof(struct nvram_header)], *nvram_size);
> +
> + return nvram;
> +}
> +EXPORT_SYMBOL(bcm47xx_nvram_get_contents);
> +
> +void bcm47xx_nvram_release_contents(char *nvram)
> +{
> + vfree(nvram);
> +}
> +EXPORT_SYMBOL(bcm47xx_nvram_release_contents);
How about making this one inline instead of adding yet another export?
- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list