size_t size;
phys_addr_t dest_addr;
size_t dest_size;
- void * (*map_fw_mem)(phys_addr_t phys, size_t size);
- void (*unmap_fw_mem)(void *virt);
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data);
+ void (*unmap_fw_mem)(void *virt, void *data);
+ void *map_data;
#ifdef CONFIG_FW_LOADER_USER_HELPER
bool is_paged_buf;
bool need_uevent;
unsigned int opt_flags;
phys_addr_t dest_addr;
size_t dest_size;
- void * (*map_fw_mem)(phys_addr_t phys, size_t size);
- void (*unmap_fw_mem)(void *virt);
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data);
+ void (*unmap_fw_mem)(void *virt, void *data);
+ void *map_data;
struct module *module;
void *context;
void (*cont)(const struct firmware *fw, void *context);
if (fw_buf->dest_addr)
buf = fw_buf->map_fw_mem(fw_buf->dest_addr,
- fw_buf->dest_size);
+ fw_buf->dest_size, fw_buf->map_data);
else
buf = vmalloc(size);
if (!buf)
fw_buf->data = buf;
fw_buf->size = size;
if (fw_buf->dest_addr)
- fw_buf->unmap_fw_mem(buf);
+ fw_buf->unmap_fw_mem(buf, fw_buf->map_data);
return 0;
fail:
if (fw_buf->dest_addr)
- fw_buf->unmap_fw_mem(buf);
+ fw_buf->unmap_fw_mem(buf, fw_buf->map_data);
else
vfree(buf);
return rc;
goto out;
}
- fw_buf = buf->map_fw_mem(buf->dest_addr + *offset, count);
+ fw_buf = buf->map_fw_mem(buf->dest_addr + *offset, count,
+ buf->map_data);
if (!fw_buf) {
pr_debug("%s: Failed ioremap.\n", __func__);
retval = -ENOMEM;
memcpy(fw_buf, buffer, count);
*offset += count;
- buf->unmap_fw_mem(fw_buf);
+ buf->unmap_fw_mem(fw_buf, buf->map_data);
out:
return retval;
buf->dest_size = desc->dest_size;
buf->map_fw_mem = desc->map_fw_mem;
buf->unmap_fw_mem = desc->unmap_fw_mem;
+ buf->map_data = desc->map_data;
firmware->priv = buf;
return 1;
}
int
request_firmware_into_buf(const char *name, struct device *device,
phys_addr_t dest_addr, size_t dest_size,
- void * (*map_fw_mem)(phys_addr_t phys, size_t size),
- void (*unmap_fw_mem)(void *virt))
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size,
+ void *data),
+ void (*unmap_fw_mem)(void *virt, void *data),
+ void *map_data)
{
struct fw_desc desc;
const struct firmware *fp = NULL;
desc.dest_size = dest_size;
desc.map_fw_mem = map_fw_mem;
desc.unmap_fw_mem = unmap_fw_mem;
+ desc.map_data = map_data;
ret = _request_firmware(&desc);
if (ret)
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context),
bool nocache, phys_addr_t dest_addr, size_t dest_size,
- void * (*map_fw_mem)(phys_addr_t phys, size_t size),
- void (*unmap_fw_mem)(void *virt))
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data),
+ void (*unmap_fw_mem)(void *virt, void *data),
+ void *map_data)
{
struct fw_desc *desc;
desc->dest_size = dest_size;
desc->map_fw_mem = map_fw_mem;
desc->unmap_fw_mem = unmap_fw_mem;
+ desc->map_data = map_data;
desc->opt_flags = FW_OPT_FALLBACK | FW_OPT_NOWAIT;
if (uevent)
void (*cont)(const struct firmware *fw, void *context))
{
return _request_firmware_nowait(module, uevent, name, device, gfp,
- context, cont, false, 0, 0, NULL, NULL);
+ context, cont, false, 0, 0, NULL, NULL, NULL);
}
EXPORT_SYMBOL(request_firmware_nowait);
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context),
phys_addr_t dest_addr, size_t dest_size,
- void * (*map_fw_mem)(phys_addr_t phys, size_t size),
- void (*unmap_fw_mem)(void *virt))
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data),
+ void (*unmap_fw_mem)(void *virt, void *data),
+ void *map_data)
{
return _request_firmware_nowait(module, uevent, name, device, gfp,
context, cont, true, dest_addr,
- dest_size, map_fw_mem, unmap_fw_mem);
+ dest_size, map_fw_mem, unmap_fw_mem,
+ map_data);
}
EXPORT_SYMBOL_GPL(request_firmware_nowait_into_buf);
int request_firmware_into_buf(const char *name, struct device *device,
phys_addr_t dest_addr, size_t dest_size,
void * (*map_fw_mem)(phys_addr_t phys,
- size_t size),
- void (*unmap_fw_mem)(void *virt));
+ size_t size, void *data),
+ void (*unmap_fw_mem)(void *virt, void *data),
+ void *data);
int request_firmware_nowait_into_buf(
struct module *module, bool uevent,
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context),
phys_addr_t dest_addr, size_t dest_size,
- void * (*map_fw_mem)(phys_addr_t phys, size_t size),
- void (*unmap_fw_mem)(void *virt));
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data),
+ void (*unmap_fw_mem)(void *virt, void *data), void *data);
void release_firmware(const struct firmware *fw);
#else
static inline int request_firmware(const struct firmware **fw,
phys_addr_t dest_addr,
size_t dest_size,
void * (*map_fw_mem)(phys_addr_t phys,
- size_t size),
- void (*unmap_fw_mem)(void *virt))
+ size_t size, void *data),
+ void (*unmap_fw_mem)(void *virt,
+ void *data),
+ void *data)
{
return -EINVAL;
}
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context),
phys_addr_t dest_addr, size_t dest_size,
- void * (*map_fw_mem)(phys_addr_t phys, size_t size),
- void (*unmap_fw_mem)(void *virt))
+ void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data),
+ void (*unmap_fw_mem)(void *virt, void *data), void *data)
{
return -EINVAL;
}