[alsa-devel] [PATCH] topology: Include <linux/types.h> in API header file

Takashi Iwai tiwai at suse.de
Fri Nov 6 15:40:53 CET 2015


On Fri, 06 Nov 2015 15:37:27 +0100,
Liam Girdwood wrote:
> 
> On Fri, 2015-11-06 at 14:33 +0100, Takashi Iwai wrote:
> > On Fri, 06 Nov 2015 14:31:18 +0100,
> > Vinod Koul wrote:
> > > 
> > > On Fri, Nov 06, 2015 at 01:59:41PM +0100, Takashi Iwai wrote:
> > > > On Fri, 06 Nov 2015 13:39:36 +0100,
> > > > mengdong.lin at linux.intel.com wrote:
> > > > > 
> > > > > From: Mengdong Lin <mengdong.lin at linux.intel.com>
> > > > > 
> > > > > Include <linux/types.h> in the API header file topology.h
> > > > > 
> > > > > The struct snd_tplg_stream_caps_template has a member "formats"
> > > > > of type __le64. So <linux/types.h> is needed.
> > > > 
> > > > We shouldn't use __le64 for user-space API.  I couldn't find it in
> > > > include/topology.h.  Where is it used?
> > > > 
> > > > Of course, it's fine to use it for kernel ABI.  But then linux/types.h
> > > > is already included in local.h, so it shouldn't be a problem.
> > > 
> > > Our tool threw this error
> > > 
> > > ./local-alsa/include/alsa/topology.h:668:2: error: â__le64â does not name a
> > > type
> > >   __le64 formats; /*!< supported formats SNDRV_PCM_FMTBIT_* */
> > > 
> 
> Can you try the following patch for the userspace header.
> 
> >From 568f769269122e90fceee605a98a1a526db2b3d4 Mon Sep 17 00:00:00 2001
> From: Liam Girdwood <liam.r.girdwood at linux.intel.com>
> Date: Fri, 6 Nov 2015 14:30:36 +0000
> Subject: [PATCH] topology: remove little endian type from userspace header.
> 
> Use a generic unsigned long long for formats instead of an ABI endian
> specific __le64 type.

Or use uint64_t instead.  This is the standard definition of 64bit
integer.  I thought we already include stdint.h somewhere, but you can
included it there again to be sure, too.


Takashi

> 
> Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
> ---
>  include/topology.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/topology.h b/include/topology.h
> index b631871..1a110a2 100644
> --- a/include/topology.h
> +++ b/include/topology.h
> @@ -665,7 +665,7 @@ struct snd_tplg_stream_template {
>   */
>  struct snd_tplg_stream_caps_template {
>  	const char *name;	/*!< name of the stream caps */
> -	__le64 formats;	/*!< supported formats SNDRV_PCM_FMTBIT_* */
> +	unsigned long long formats;	/*!< supported formats SNDRV_PCM_FMTBIT_* */
>  	unsigned int rates;	/*!< supported rates SNDRV_PCM_RATE_* */
>  	unsigned int rate_min;	/*!< min rate */
>  	unsigned int rate_max;	/*!< max rate */
> -- 
> 2.5.0
> 
> 


More information about the Alsa-devel mailing list