diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-04-11 16:52:10 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-04-15 12:21:45 +0200 |
commit | 947fb5adf8af450507c978abf1c7ec9f051e5842 (patch) | |
tree | af790669292308b56baf188611ac430012037cba /drivers/mtd/core.c | |
parent | 48b205e32342fc8a2648b2bd3f1f6d9a7d74e6cb (diff) | |
download | barebox-947fb5adf8af450507c978abf1c7ec9f051e5842.tar.gz barebox-947fb5adf8af450507c978abf1c7ec9f051e5842.tar.xz |
string: Fix (v)asprintf prototypes
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/core.c')
-rw-r--r-- | drivers/mtd/core.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index dcf94bfc0d..6d04b88553 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -470,10 +470,10 @@ static int mtd_partition_set(struct device_d *dev, struct param_d *p, const char static char *print_size(uint64_t s) { if (!(s & ((1 << 20) - 1))) - return asprintf("%lldM", s >> 20); + return basprintf("%lldM", s >> 20); if (!(s & ((1 << 10) - 1))) - return asprintf("%lldk", s >> 10); - return asprintf("0x%lld", s); + return basprintf("%lldk", s >> 10); + return basprintf("0x%lld", s); } static int print_part(char *buf, int bufsize, struct mtd_info *mtd, uint64_t last_ofs, @@ -577,7 +577,8 @@ static int of_mtd_fixup(struct device_node *root, void *ctx) list_for_each_entry(partmtd, &mtd->partitions, partitions_entry) { int na, ns, len = 0; - char *name = asprintf("partition@%0llx", partmtd->master_offset); + char *name = basprintf("partition@%0llx", + partmtd->master_offset); void *p; u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */ @@ -675,7 +676,8 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id) if (device_id == DEVICE_ID_SINGLE) mtd->cdev.name = xstrdup(devname); else - mtd->cdev.name = asprintf("%s%d", devname, mtd->class_dev.id); + mtd->cdev.name = basprintf("%s%d", devname, + mtd->class_dev.id); INIT_LIST_HEAD(&mtd->partitions); |