1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NVIF_UNPACK_H__
3 #define __NVIF_UNPACK_H__
5 #define nvif_unvers(r,d,s,m) ({ \
6 void **_data = (d); __u32 *_size = (s); int _ret = (r); \
7 if (_ret == -ENOSYS && *_size == sizeof(m)) { \
14 #define nvif_unpack(r,d,s,m,vl,vh,x) ({ \
15 void **_data = (d); __u32 *_size = (s); \
16 int _ret = (r), _vl = (vl), _vh = (vh); \
17 if (_ret == -ENOSYS && *_size >= sizeof(m) && \
18 (m).version >= _vl && (m).version <= _vh) { \
19 *_data = (__u8 *)*_data + sizeof(m); \
20 *_size = *_size - sizeof(m); \
21 if (_ret = 0, !(x)) { \
22 _ret = *_size ? -E2BIG : 0; \