alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros
       [not found] <1433000370-19509-1-git-send-email-mikko.rapeli@iki.fi>
@ 2015-05-30 15:38 ` Mikko Rapeli
       [not found]   ` <1433000370-19509-19-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
       [not found] ` <1433000370-19509-1-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Mikko Rapeli @ 2015-05-30 15:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Takashi Iwai, Mikko Rapeli, alsa-devel, linux-api

Fixes userspace compilation error:

error: expected specifier-qualifier-list before ‘DECLARE_BITMAP’
  DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */

DECLARE_BITMAP etc macros are not meant for userspace headers and thus
added here as private copies for emu10k.h.

Fix was suggested by Arnd Bergmann <arnd@arndb.de> in message
<2168807.4Yxh5gl11Q@wuerfel> on lkml.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/sound/emu10k1.h | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
index ec1535b..7575f0f 100644
--- a/include/uapi/sound/emu10k1.h
+++ b/include/uapi/sound/emu10k1.h
@@ -34,6 +34,23 @@
 
 #define EMU10K1_FX8010_PCM_COUNT		8
 
+/*
+ * Following definitions are copies from kernel headers to support compiling
+ * this header file in userspace. The definitions are not generally available
+ * in uapi headers so the needed things are copied here wtih __EMU10k1 prefix.
+ */
+
+/* From include/linux/bitops.h */
+#define __EMU10K1_BITS_PER_BYTE           8
+/* From include/linux/kernel.h */
+#define __EMU10K1_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+/* From include/linux/bitops.h */
+#define __EMU10K1_BITS_TO_LONGS(nr) \
+        __EMU10K1_DIV_ROUND_UP(nr, __EMU10K1_BITS_PER_BYTE * sizeof(long))
+/* From include/linux/types.h */
+#define __EMU10K1_DECLARE_BITMAP(name,bits) \
+        unsigned long name[__EMU10K1_BITS_TO_LONGS(bits)]
+
 /* instruction set */
 #define iMAC0	 0x00	/* R = A + (X * Y >> 31)   ; saturation */
 #define iMAC1	 0x01	/* R = A + (-X * Y >> 31)  ; saturation */
@@ -300,7 +317,7 @@ struct snd_emu10k1_fx8010_control_old_gpr {
 struct snd_emu10k1_fx8010_code {
 	char name[128];
 
-	DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
+	__EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
 	__u32 __user *gpr_map;		/* initializers */
 
 	unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
@@ -313,11 +330,11 @@ struct snd_emu10k1_fx8010_code {
 	unsigned int gpr_list_control_total; /* total count of GPR controls */
 	struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
 
-	DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
+	__EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
 	__u32 __user *tram_data_map;	  /* data initializers */
 	__u32 __user *tram_addr_map;	  /* map initializers */
 
-	DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
+	__EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
 	__u32 __user *code;		  /* one instruction - 64 bits */
 };
 
-- 
2.1.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 30/98] hdspm.h: use __u8, __u32 and __u64 from linux/types.h
       [not found] ` <1433000370-19509-1-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2015-05-30 15:38   ` Mikko Rapeli
       [not found]     ` <1433000370-19509-31-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mikko Rapeli @ 2015-05-30 15:38 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Mikko Rapeli, Jaroslav Kysela, Takashi Iwai,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-api-u79uwXL29TY76Z2rM5mHXA

Fixes userspace compilation errors like:

sound/hdspm.h:43:2: error: unknown type name ‘uint32_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
---
 include/uapi/sound/hdspm.h | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h
index 5737332..c4db6f5 100644
--- a/include/uapi/sound/hdspm.h
+++ b/include/uapi/sound/hdspm.h
@@ -20,11 +20,7 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifdef __KERNEL__
 #include <linux/types.h>
-#else
-#include <stdint.h>
-#endif
 
 /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
 #define HDSPM_MAX_CHANNELS      64
@@ -46,15 +42,15 @@ enum hdspm_speed {
 /* -------------------- IOCTL Peak/RMS Meters -------------------- */
 
 struct hdspm_peak_rms {
-	uint32_t input_peaks[64];
-	uint32_t playback_peaks[64];
-	uint32_t output_peaks[64];
+	__u32 input_peaks[64];
+	__u32 playback_peaks[64];
+	__u32 output_peaks[64];
 
-	uint64_t input_rms[64];
-	uint64_t playback_rms[64];
-	uint64_t output_rms[64];
+	__u64 input_rms[64];
+	__u64 playback_rms[64];
+	__u64 output_rms[64];
 
-	uint8_t speed; /* enum {ss, ds, qs} */
+	__u8 speed; /* enum {ss, ds, qs} */
 	int status2;
 };
 
@@ -155,21 +151,21 @@ enum hdspm_syncsource {
 };
 
 struct hdspm_status {
-	uint8_t card_type; /* enum hdspm_io_type */
+	__u8 card_type; /* enum hdspm_io_type */
 	enum hdspm_syncsource autosync_source;
 
-	uint64_t card_clock;
-	uint32_t master_period;
+	__u64 card_clock;
+	__u32 master_period;
 
 	union {
 		struct {
-			uint8_t sync_wc; /* enum hdspm_sync */
-			uint8_t sync_madi; /* enum hdspm_sync */
-			uint8_t sync_tco; /* enum hdspm_sync */
-			uint8_t sync_in; /* enum hdspm_sync */
-			uint8_t madi_input; /* enum hdspm_madi_input */
-			uint8_t channel_format; /* enum hdspm_madi_channel_format */
-			uint8_t frame_format; /* enum hdspm_madi_frame_format */
+			__u8 sync_wc; /* enum hdspm_sync */
+			__u8 sync_madi; /* enum hdspm_sync */
+			__u8 sync_tco; /* enum hdspm_sync */
+			__u8 sync_in; /* enum hdspm_sync */
+			__u8 madi_input; /* enum hdspm_madi_input */
+			__u8 channel_format; /* enum hdspm_madi_channel_format */
+			__u8 frame_format; /* enum hdspm_madi_frame_format */
 		} madi;
 	} card_specific;
 };
@@ -184,7 +180,7 @@ struct hdspm_status {
 #define HDSPM_ADDON_TCO 1
 
 struct hdspm_version {
-	uint8_t card_type; /* enum hdspm_io_type */
+	__u8 card_type; /* enum hdspm_io_type */
 	char cardname[20];
 	unsigned int serial;
 	unsigned short firmware_rev;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 30/98] hdspm.h: use __u8, __u32 and __u64 from linux/types.h
       [not found]     ` <1433000370-19509-31-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2015-05-31  7:11       ` Takashi Iwai
  2015-06-02 19:18         ` Mikko Rapeli
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2015-05-31  7:11 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-api-u79uwXL29TY76Z2rM5mHXA

At Sat, 30 May 2015 17:38:22 +0200,
Mikko Rapeli wrote:
> 
> Fixes userspace compilation errors like:
> 
> sound/hdspm.h:43:2: error: unknown type name ‘uint32_t’

Hmm, how do you get this error at all?
The header includes stdint.h for user-space.


thanks,

Takashi

> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> ---
>  include/uapi/sound/hdspm.h | 40 ++++++++++++++++++----------------------
>  1 file changed, 18 insertions(+), 22 deletions(-)
> 
> diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h
> index 5737332..c4db6f5 100644
> --- a/include/uapi/sound/hdspm.h
> +++ b/include/uapi/sound/hdspm.h
> @@ -20,11 +20,7 @@
>   *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>   */
>  
> -#ifdef __KERNEL__
>  #include <linux/types.h>
> -#else
> -#include <stdint.h>
> -#endif
>  
>  /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
>  #define HDSPM_MAX_CHANNELS      64
> @@ -46,15 +42,15 @@ enum hdspm_speed {
>  /* -------------------- IOCTL Peak/RMS Meters -------------------- */
>  
>  struct hdspm_peak_rms {
> -	uint32_t input_peaks[64];
> -	uint32_t playback_peaks[64];
> -	uint32_t output_peaks[64];
> +	__u32 input_peaks[64];
> +	__u32 playback_peaks[64];
> +	__u32 output_peaks[64];
>  
> -	uint64_t input_rms[64];
> -	uint64_t playback_rms[64];
> -	uint64_t output_rms[64];
> +	__u64 input_rms[64];
> +	__u64 playback_rms[64];
> +	__u64 output_rms[64];
>  
> -	uint8_t speed; /* enum {ss, ds, qs} */
> +	__u8 speed; /* enum {ss, ds, qs} */
>  	int status2;
>  };
>  
> @@ -155,21 +151,21 @@ enum hdspm_syncsource {
>  };
>  
>  struct hdspm_status {
> -	uint8_t card_type; /* enum hdspm_io_type */
> +	__u8 card_type; /* enum hdspm_io_type */
>  	enum hdspm_syncsource autosync_source;
>  
> -	uint64_t card_clock;
> -	uint32_t master_period;
> +	__u64 card_clock;
> +	__u32 master_period;
>  
>  	union {
>  		struct {
> -			uint8_t sync_wc; /* enum hdspm_sync */
> -			uint8_t sync_madi; /* enum hdspm_sync */
> -			uint8_t sync_tco; /* enum hdspm_sync */
> -			uint8_t sync_in; /* enum hdspm_sync */
> -			uint8_t madi_input; /* enum hdspm_madi_input */
> -			uint8_t channel_format; /* enum hdspm_madi_channel_format */
> -			uint8_t frame_format; /* enum hdspm_madi_frame_format */
> +			__u8 sync_wc; /* enum hdspm_sync */
> +			__u8 sync_madi; /* enum hdspm_sync */
> +			__u8 sync_tco; /* enum hdspm_sync */
> +			__u8 sync_in; /* enum hdspm_sync */
> +			__u8 madi_input; /* enum hdspm_madi_input */
> +			__u8 channel_format; /* enum hdspm_madi_channel_format */
> +			__u8 frame_format; /* enum hdspm_madi_frame_format */
>  		} madi;
>  	} card_specific;
>  };
> @@ -184,7 +180,7 @@ struct hdspm_status {
>  #define HDSPM_ADDON_TCO 1
>  
>  struct hdspm_version {
> -	uint8_t card_type; /* enum hdspm_io_type */
> +	__u8 card_type; /* enum hdspm_io_type */
>  	char cardname[20];
>  	unsigned int serial;
>  	unsigned short firmware_rev;
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros
       [not found]   ` <1433000370-19509-19-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
@ 2015-05-31  7:18     ` Takashi Iwai
       [not found]       ` <s5h8uc58ba6.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2015-05-31  7:18 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-api-u79uwXL29TY76Z2rM5mHXA

At Sat, 30 May 2015 17:38:10 +0200,
Mikko Rapeli wrote:
> 
> Fixes userspace compilation error:
> 
> error: expected specifier-qualifier-list before ‘DECLARE_BITMAP’
>   DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
> 
> DECLARE_BITMAP etc macros are not meant for userspace headers and thus
> added here as private copies for emu10k.h.
> 
> Fix was suggested by Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> in message
> <2168807.4Yxh5gl11Q@wuerfel> on lkml.
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> ---
>  include/uapi/sound/emu10k1.h | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
> index ec1535b..7575f0f 100644
> --- a/include/uapi/sound/emu10k1.h
> +++ b/include/uapi/sound/emu10k1.h
> @@ -34,6 +34,23 @@
>  
>  #define EMU10K1_FX8010_PCM_COUNT		8
>  
> +/*
> + * Following definitions are copies from kernel headers to support compiling
> + * this header file in userspace. The definitions are not generally available
> + * in uapi headers so the needed things are copied here wtih __EMU10k1 prefix.
> + */
> +
> +/* From include/linux/bitops.h */
> +#define __EMU10K1_BITS_PER_BYTE           8
> +/* From include/linux/kernel.h */
> +#define __EMU10K1_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> +/* From include/linux/bitops.h */
> +#define __EMU10K1_BITS_TO_LONGS(nr) \
> +        __EMU10K1_DIV_ROUND_UP(nr, __EMU10K1_BITS_PER_BYTE * sizeof(long))
> +/* From include/linux/types.h */
> +#define __EMU10K1_DECLARE_BITMAP(name,bits) \
> +        unsigned long name[__EMU10K1_BITS_TO_LONGS(bits)]

This is way too complicated just for a few expansion of the aligned
size arrays, IMO.  Rather simplify it like below with a comment:

/* the array must be aligned to unsigned long (i.e. 4 or 8 bytes) */
#define __EMU10K1_DECLARE_BITMAP(name) \
	unsigned long name[(bits) / sizeof(unsigned long)]
	
or expand as is at each place like:
	unsigned long gpr_valid[0x200 / sizeof(unsigned long)];


thanks,

Takashi

>  /* instruction set */
>  #define iMAC0	 0x00	/* R = A + (X * Y >> 31)   ; saturation */
>  #define iMAC1	 0x01	/* R = A + (-X * Y >> 31)  ; saturation */
> @@ -300,7 +317,7 @@ struct snd_emu10k1_fx8010_control_old_gpr {
>  struct snd_emu10k1_fx8010_code {
>  	char name[128];
>  
> -	DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
> +	__EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
>  	__u32 __user *gpr_map;		/* initializers */
>  
>  	unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
> @@ -313,11 +330,11 @@ struct snd_emu10k1_fx8010_code {
>  	unsigned int gpr_list_control_total; /* total count of GPR controls */
>  	struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
>  
> -	DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
> +	__EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
>  	__u32 __user *tram_data_map;	  /* data initializers */
>  	__u32 __user *tram_addr_map;	  /* map initializers */
>  
> -	DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
> +	__EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
>  	__u32 __user *code;		  /* one instruction - 64 bits */
>  };
>  
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros
       [not found]       ` <s5h8uc58ba6.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
@ 2015-05-31  8:12         ` Takashi Iwai
       [not found]           ` <s5h1thx88tk.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2015-05-31  8:12 UTC (permalink / raw)
  To: Mikko Rapeli
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-api-u79uwXL29TY76Z2rM5mHXA

At Sun, 31 May 2015 09:18:57 +0200,
Takashi Iwai wrote:
> 
> At Sat, 30 May 2015 17:38:10 +0200,
> Mikko Rapeli wrote:
> > 
> > Fixes userspace compilation error:
> > 
> > error: expected specifier-qualifier-list before ‘DECLARE_BITMAP’
> >   DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
> > 
> > DECLARE_BITMAP etc macros are not meant for userspace headers and thus
> > added here as private copies for emu10k.h.
> > 
> > Fix was suggested by Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> in message
> > <2168807.4Yxh5gl11Q@wuerfel> on lkml.
> > 
> > Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> > ---
> >  include/uapi/sound/emu10k1.h | 23 ++++++++++++++++++++---
> >  1 file changed, 20 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
> > index ec1535b..7575f0f 100644
> > --- a/include/uapi/sound/emu10k1.h
> > +++ b/include/uapi/sound/emu10k1.h
> > @@ -34,6 +34,23 @@
> >  
> >  #define EMU10K1_FX8010_PCM_COUNT		8
> >  
> > +/*
> > + * Following definitions are copies from kernel headers to support compiling
> > + * this header file in userspace. The definitions are not generally available
> > + * in uapi headers so the needed things are copied here wtih __EMU10k1 prefix.
> > + */
> > +
> > +/* From include/linux/bitops.h */
> > +#define __EMU10K1_BITS_PER_BYTE           8
> > +/* From include/linux/kernel.h */
> > +#define __EMU10K1_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> > +/* From include/linux/bitops.h */
> > +#define __EMU10K1_BITS_TO_LONGS(nr) \
> > +        __EMU10K1_DIV_ROUND_UP(nr, __EMU10K1_BITS_PER_BYTE * sizeof(long))
> > +/* From include/linux/types.h */
> > +#define __EMU10K1_DECLARE_BITMAP(name,bits) \
> > +        unsigned long name[__EMU10K1_BITS_TO_LONGS(bits)]
> 
> This is way too complicated just for a few expansion of the aligned
> size arrays, IMO.  Rather simplify it like below with a comment:
> 
> /* the array must be aligned to unsigned long (i.e. 4 or 8 bytes) */
> #define __EMU10K1_DECLARE_BITMAP(name) \
> 	unsigned long name[(bits) / sizeof(unsigned long)]

Crap, of course, it must be multiplied with 8.

/* the array must be aligned to unsigned long (i.e. 32 or 64) */
#define __EMU10K1_DECLARE_BITMAP(name) \
	unsigned long name[(bits) / (sizeof(unsigned long) * 8)]


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros
       [not found]           ` <s5h1thx88tk.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
@ 2015-06-02 19:08             ` Mikko Rapeli
  0 siblings, 0 replies; 7+ messages in thread
From: Mikko Rapeli @ 2015-06-02 19:08 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jaroslav Kysela,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-api-u79uwXL29TY76Z2rM5mHXA

On Sun, May 31, 2015 at 10:12:07AM +0200, Takashi Iwai wrote:
> At Sun, 31 May 2015 09:18:57 +0200,
> Takashi Iwai wrote:
> > 
> > At Sat, 30 May 2015 17:38:10 +0200,
> > Mikko Rapeli wrote:
> > > 
> > > Fixes userspace compilation error:
> > > 
> > > error: expected specifier-qualifier-list before ‘DECLARE_BITMAP’
> > >   DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
> > > 
> > > DECLARE_BITMAP etc macros are not meant for userspace headers and thus
> > > added here as private copies for emu10k.h.
> > > 
> > > Fix was suggested by Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> in message
> > > <2168807.4Yxh5gl11Q@wuerfel> on lkml.
> > > 
> > > Signed-off-by: Mikko Rapeli <mikko.rapeli-X3B1VOXEql0@public.gmane.org>
> > > ---
> > >  include/uapi/sound/emu10k1.h | 23 ++++++++++++++++++++---
> > >  1 file changed, 20 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
> > > index ec1535b..7575f0f 100644
> > > --- a/include/uapi/sound/emu10k1.h
> > > +++ b/include/uapi/sound/emu10k1.h
> > > @@ -34,6 +34,23 @@
> > >  
> > >  #define EMU10K1_FX8010_PCM_COUNT		8
> > >  
> > > +/*
> > > + * Following definitions are copies from kernel headers to support compiling
> > > + * this header file in userspace. The definitions are not generally available
> > > + * in uapi headers so the needed things are copied here wtih __EMU10k1 prefix.
> > > + */
> > > +
> > > +/* From include/linux/bitops.h */
> > > +#define __EMU10K1_BITS_PER_BYTE           8
> > > +/* From include/linux/kernel.h */
> > > +#define __EMU10K1_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> > > +/* From include/linux/bitops.h */
> > > +#define __EMU10K1_BITS_TO_LONGS(nr) \
> > > +        __EMU10K1_DIV_ROUND_UP(nr, __EMU10K1_BITS_PER_BYTE * sizeof(long))
> > > +/* From include/linux/types.h */
> > > +#define __EMU10K1_DECLARE_BITMAP(name,bits) \
> > > +        unsigned long name[__EMU10K1_BITS_TO_LONGS(bits)]
> > 
> > This is way too complicated just for a few expansion of the aligned
> > size arrays, IMO.  Rather simplify it like below with a comment:
> > 
> > /* the array must be aligned to unsigned long (i.e. 4 or 8 bytes) */
> > #define __EMU10K1_DECLARE_BITMAP(name) \
> > 	unsigned long name[(bits) / sizeof(unsigned long)]
> 
> Crap, of course, it must be multiplied with 8.
> 
> /* the array must be aligned to unsigned long (i.e. 32 or 64) */
> #define __EMU10K1_DECLARE_BITMAP(name) \
> 	unsigned long name[(bits) / (sizeof(unsigned long) * 8)]

Thanks, I'll use this definition instead.

-Mikko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 30/98] hdspm.h: use __u8, __u32 and __u64 from linux/types.h
  2015-05-31  7:11       ` Takashi Iwai
@ 2015-06-02 19:18         ` Mikko Rapeli
  0 siblings, 0 replies; 7+ messages in thread
From: Mikko Rapeli @ 2015-06-02 19:18 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, Jaroslav Kysela, alsa-devel, linux-api

On Sun, May 31, 2015 at 09:11:54AM +0200, Takashi Iwai wrote:
> At Sat, 30 May 2015 17:38:22 +0200,
> Mikko Rapeli wrote:
> > 
> > Fixes userspace compilation errors like:
> > 
> > sound/hdspm.h:43:2: error: unknown type name ‘uint32_t’
> 
> Hmm, how do you get this error at all?
> The header includes stdint.h for user-space.

Yes, sorry. This patch removes the stdint.h include and uses kernel __u32
types instead. Will fix the commit message. Thanks!

-Mikko

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-02 19:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1433000370-19509-1-git-send-email-mikko.rapeli@iki.fi>
2015-05-30 15:38 ` [PATCH 18/98] include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP etc macros Mikko Rapeli
     [not found]   ` <1433000370-19509-19-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-05-31  7:18     ` Takashi Iwai
     [not found]       ` <s5h8uc58ba6.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2015-05-31  8:12         ` Takashi Iwai
     [not found]           ` <s5h1thx88tk.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2015-06-02 19:08             ` Mikko Rapeli
     [not found] ` <1433000370-19509-1-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-05-30 15:38   ` [PATCH 30/98] hdspm.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli
     [not found]     ` <1433000370-19509-31-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2015-05-31  7:11       ` Takashi Iwai
2015-06-02 19:18         ` Mikko Rapeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).