2 #define __KERNEL_SYSCALLS__
3 #include <linux/module.h>
6 #include <linux/slab.h>
9 #include <asm/unistd.h>
10 #include <asm/uaccess.h>
12 static int do_mod_firmware_load(const char *fn, char **fp)
21 printk(KERN_INFO "Unable to load '%s'.\n", fn);
25 if (l <= 0 || l > 131072)
27 printk(KERN_INFO "Invalid firmware '%s'\n", fn);
35 printk(KERN_INFO "Out of memory loading '%s'.\n", fn);
39 if (read(fd, dp, l) != l)
41 printk(KERN_INFO "Failed to read '%s'.\n", fn);
52 * mod_firmware_load - load sound driver firmware
54 * @fp: return for the buffer.
56 * Load the firmware for a sound module (up to 128K) into a buffer.
57 * The buffer is returned in *fp. It is allocated with vmalloc so is
58 * virtually linear and not DMAable. The caller should free it with
59 * vfree when finished.
61 * The length of the buffer is returned on a successful load, the
62 * value zero on a failure.
64 * Caution: This API is not recommended. Firmware should be loaded via
65 * an ioctl call and a setup application. This function may disappear
69 int mod_firmware_load(const char *fn, char **fp)
72 mm_segment_t fs = get_fs();
75 r = do_mod_firmware_load(fn, fp);