Commit 62ec3d13 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Mark Brown

ASoC: SOF: use __u32 instead of uint32_t in uapi headers

When CONFIG_UAPI_HEADER_TEST=y, exported headers are compile-tested to
make sure they can be included from user-space.

Currently, header.h and fw.h are excluded from the test coverage.
To make them join the compile-test, we need to fix the build errors
attached below.

For a case like this, we decided to use __u{8,16,32,64} variable types
in this discussion:

  https://lkml.org/lkml/2019/6/5/18

Build log:

  CC      usr/include/sound/sof/header.h.s
  CC      usr/include/sound/sof/fw.h.s
In file included from <command-line>:32:0:
./usr/include/sound/sof/header.h:19:2: error: unknown type name ‘uint32_t’
  uint32_t magic;  /**< 'S', 'O', 'F', '\0' */
  ^~~~~~~~
./usr/include/sound/sof/header.h:20:2: error: unknown type name ‘uint32_t’
  uint32_t type;  /**< component specific type */
  ^~~~~~~~
./usr/include/sound/sof/header.h:21:2: error: unknown type name ‘uint32_t’
  uint32_t size;  /**< size in bytes of data excl. this struct */
  ^~~~~~~~
./usr/include/sound/sof/header.h:22:2: error: unknown type name ‘uint32_t’
  uint32_t abi;  /**< SOF ABI version */
  ^~~~~~~~
./usr/include/sound/sof/header.h:23:2: error: unknown type name ‘uint32_t’
  uint32_t reserved[4]; /**< reserved for future use */
  ^~~~~~~~
./usr/include/sound/sof/header.h:24:2: error: unknown type name ‘uint32_t’
  uint32_t data[0]; /**< Component data - opaque to core */
  ^~~~~~~~
In file included from <command-line>:32:0:
./usr/include/sound/sof/fw.h:49:2: error: unknown type name ‘uint32_t’
  uint32_t size;  /* bytes minus this header */
  ^~~~~~~~
./usr/include/sound/sof/fw.h:50:2: error: unknown type name ‘uint32_t’
  uint32_t offset; /* offset from base */
  ^~~~~~~~
./usr/include/sound/sof/fw.h:64:2: error: unknown type name ‘uint32_t’
  uint32_t size;  /* bytes minus this header */
  ^~~~~~~~
./usr/include/sound/sof/fw.h:65:2: error: unknown type name ‘uint32_t’
  uint32_t num_blocks; /* number of blocks */
  ^~~~~~~~
./usr/include/sound/sof/fw.h:73:2: error: unknown type name ‘uint32_t’
  uint32_t file_size; /* size of file minus this header */
  ^~~~~~~~
./usr/include/sound/sof/fw.h:74:2: error: unknown type name ‘uint32_t’
  uint32_t num_modules; /* number of modules */
  ^~~~~~~~
./usr/include/sound/sof/fw.h:75:2: error: unknown type name ‘uint32_t’
  uint32_t abi;  /* version of header format */
  ^~~~~~~~
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Link: https://lore.kernel.org/r/20190721142308.30306-1-yamada.masahiro@socionext.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f86621cd
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#ifndef __INCLUDE_UAPI_SOF_FW_H__ #ifndef __INCLUDE_UAPI_SOF_FW_H__
#define __INCLUDE_UAPI_SOF_FW_H__ #define __INCLUDE_UAPI_SOF_FW_H__
#include <linux/types.h>
#define SND_SOF_FW_SIG_SIZE 4 #define SND_SOF_FW_SIG_SIZE 4
#define SND_SOF_FW_ABI 1 #define SND_SOF_FW_ABI 1
#define SND_SOF_FW_SIG "Reef" #define SND_SOF_FW_SIG "Reef"
...@@ -46,8 +48,8 @@ enum snd_sof_fw_blk_type { ...@@ -46,8 +48,8 @@ enum snd_sof_fw_blk_type {
struct snd_sof_blk_hdr { struct snd_sof_blk_hdr {
enum snd_sof_fw_blk_type type; enum snd_sof_fw_blk_type type;
uint32_t size; /* bytes minus this header */ __u32 size; /* bytes minus this header */
uint32_t offset; /* offset from base */ __u32 offset; /* offset from base */
} __packed; } __packed;
/* /*
...@@ -61,8 +63,8 @@ enum snd_sof_fw_mod_type { ...@@ -61,8 +63,8 @@ enum snd_sof_fw_mod_type {
struct snd_sof_mod_hdr { struct snd_sof_mod_hdr {
enum snd_sof_fw_mod_type type; enum snd_sof_fw_mod_type type;
uint32_t size; /* bytes minus this header */ __u32 size; /* bytes minus this header */
uint32_t num_blocks; /* number of blocks */ __u32 num_blocks; /* number of blocks */
} __packed; } __packed;
/* /*
...@@ -70,9 +72,9 @@ struct snd_sof_mod_hdr { ...@@ -70,9 +72,9 @@ struct snd_sof_mod_hdr {
*/ */
struct snd_sof_fw_header { struct snd_sof_fw_header {
unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */ unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */
uint32_t file_size; /* size of file minus this header */ __u32 file_size; /* size of file minus this header */
uint32_t num_modules; /* number of modules */ __u32 num_modules; /* number of modules */
uint32_t abi; /* version of header format */ __u32 abi; /* version of header format */
} __packed; } __packed;
#endif #endif
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__
#define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ #define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__
#include <linux/types.h>
/* /*
* Header for all non IPC ABI data. * Header for all non IPC ABI data.
* *
...@@ -16,12 +18,12 @@ ...@@ -16,12 +18,12 @@
* Used by any bespoke component data structures or binary blobs. * Used by any bespoke component data structures or binary blobs.
*/ */
struct sof_abi_hdr { struct sof_abi_hdr {
uint32_t magic; /**< 'S', 'O', 'F', '\0' */ __u32 magic; /**< 'S', 'O', 'F', '\0' */
uint32_t type; /**< component specific type */ __u32 type; /**< component specific type */
uint32_t size; /**< size in bytes of data excl. this struct */ __u32 size; /**< size in bytes of data excl. this struct */
uint32_t abi; /**< SOF ABI version */ __u32 abi; /**< SOF ABI version */
uint32_t reserved[4]; /**< reserved for future use */ __u32 reserved[4]; /**< reserved for future use */
uint32_t data[0]; /**< Component data - opaque to core */ __u32 data[0]; /**< Component data - opaque to core */
} __packed; } __packed;
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment