#include #include #include #include static int __init __prepare_ram_resource(char *p, char *name, int group_selector) { char *np; unsigned long start, end; int result = 0; pr_debug("[%s] entered\n", __func__); if (p == NULL) { result = -EINVAL; goto err_out; } /* parse start and end addresses */ np = strchr(p, ','); if (np == NULL) { result = -EINVAL; goto err_out; } *np = '\0'; ++np; result = kstrtoul(p, 0, &start); if (result != 0) { goto err_out; } result = kstrtoul(np, 0, &end); if (result != 0) { goto err_out; } if (start >= end) { result = -ENOSPC; goto err_out; } result = avm_mtd_set_mtdram_info(name, group_selector, start, end, IORESOURCE_MEM); if (result != 0) { goto err_out; } pr_info("[%s] mtdram 0x%08lx-0x%08lx\n", __func__, start, end); return result; err_out: pr_err("[%s] error parsing setup string: %s\n", __func__, p); return result; } static int __init prepare_ram_resource0(char *p) { return __prepare_ram_resource(p, DEFAULT_MTD_STR, GROUP_MTDS); } static int __init prepare_ram_resource_n(char *p) { char *np, *name; /* parse device name */ np = strchr(p, ','); if (np == NULL) { return -EINVAL; } *np = '\0'; ++np; name = p; p = np; return __prepare_ram_resource(p, name, GROUP_FILESYSTEMS); } early_param("mtdram1", prepare_ram_resource0); early_param("mtdram", prepare_ram_resource_n);