sound_firmware.h 784 B

123456789101112131415161718192021222324252627282930
  1. #include <linux/fs.h>
  2. /**
  3. * mod_firmware_load - load sound driver firmware
  4. * @fn: filename
  5. * @fp: return for the buffer.
  6. *
  7. * Load the firmware for a sound module (up to 128K) into a buffer.
  8. * The buffer is returned in *fp. It is allocated with vmalloc so is
  9. * virtually linear and not DMAable. The caller should free it with
  10. * vfree when finished.
  11. *
  12. * The length of the buffer is returned on a successful load, the
  13. * value zero on a failure.
  14. *
  15. * Caution: This API is not recommended. Firmware should be loaded via
  16. * request_firmware.
  17. */
  18. static inline int mod_firmware_load(const char *fn, char **fp)
  19. {
  20. loff_t size;
  21. int err;
  22. err = kernel_read_file_from_path((char *)fn, (void **)fp, &size,
  23. 131072, READING_FIRMWARE);
  24. if (err < 0)
  25. return 0;
  26. return size;
  27. }