diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2016-02-25 07:49:42 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2016-03-14 09:53:01 +1000 |
commit | 97c2aa99f027342dde2cb480215652352a14e685 (patch) | |
tree | 5695823ea2d018756abd05e97ec78852fecd4cc2 /lib/include/nvif/os.h | |
parent | 547bc905af734fddb157419ec61f0b0bae92458b (diff) | |
download | nouveau-97c2aa99f027342dde2cb480215652352a14e685.tar.gz |
lib: support loading firmware from /lib/firmware
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'lib/include/nvif/os.h')
-rw-r--r-- | lib/include/nvif/os.h | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/lib/include/nvif/os.h b/lib/include/nvif/os.h index 071d8d91d..3b3b46daa 100644 --- a/lib/include/nvif/os.h +++ b/lib/include/nvif/os.h @@ -1211,28 +1211,8 @@ struct firmware { void *data; }; -static inline int -request_firmware(const struct firmware **pfw, const char *name, - struct device *dev) -{ - struct firmware *fw = *(void **)pfw = malloc(sizeof(*fw)); - int fd = open(name, O_RDONLY); - if (fd >= 0) { - off_t len = lseek(fd, 0, SEEK_END); - fw->data = malloc(len); - fw->size = pread(fd, fw->data, len, 0); - return 0; - } - free(fw); - return -EINVAL; -} - -static inline void -release_firmware(const struct firmware *fw) -{ - free(fw->data); - free((void *)fw); -} +int request_firmware(const struct firmware **, const char *, struct device *); +void release_firmware(const struct firmware *); #define MODULE_FIRMWARE(a) |