1/* 2 * Copyright 2022, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _OBSD_COMPAT_SYS_DEVICE_H_ 6#define _OBSD_COMPAT_SYS_DEVICE_H_ 7 8 9#include <sys/firmware.h> 10 11 12static inline int 13loadfirmware(const char *name, u_char **bufp, size_t *buflen) 14{ 15 struct firmware* fw = firmware_get(name); 16 if (fw == NULL) 17 return -1; 18 19 *bufp = fw->data; 20 *buflen = fw->datasize; 21 22 // Caller takes ownership of data. 23 fw->data = NULL; 24 firmware_put(fw, 0); 25 return 0; 26} 27 28 29#endif /* _OBSD_COMPAT_SYS_DEVICE_H_ */ 30