History

ALSA: emu10k1: Make uapi/emu10k1.h compilable again

Recently we updated the content in alsa-lib uapi header files by just copying from the latest Linus kernel uapi/*.h, and noticed that it broke the build of some alsa-tools programs. The reason is that we used to have a modified version in the past, so that the program can be built without referring to the unexported stuff like snd_ctl_elem_id or __user prefix. This patch attempts to restore that, i.e. dropping the stuff that can't be referred in the user-space. For adapting the changes in uapi/emu10k1.h, the emu10k1 driver code is also slightly modified. Most of changes are pointer cast.

Takashi Iwai committed 6 years ago

Commit 2e468861 parent a032ff02 files · +40 −24Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/sound/emu10k1.h+26−12
@@ -23,9 +23,6 @@ · 22 unmodified lines
2323 #ifndef _UAPI__SOUND_EMU10K1_H
2424 #define _UAPI__SOUND_EMU10K1_H
2525
26−#include <linux/types.h>
27−#include <sound/asound.h>
28−
2926 /*
3027 * ---- FX8010 ----
3128 */
@@ -282,8 +279,22 @@ struct snd_emu10k1_fx8010_info { · 250 unmodified lines
282279 #define EMU10K1_GPR_TRANSLATION_TREBLE 3
283280 #define EMU10K1_GPR_TRANSLATION_ONOFF 4
284281
282+enum emu10k1_ctl_elem_iface {
283+ EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
284+ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */
285+};
286+
287+struct emu10k1_ctl_elem_id {
288+ unsigned int pad; /* don't use */
289+ int iface; /* interface identifier */
290+ unsigned int device; /* device/client number */
291+ unsigned int subdevice; /* subdevice (substream) number */
292+ unsigned char name[44]; /* ASCII name of item */
293+ unsigned int index; /* index of item */
294+};
295+
285296 struct snd_emu10k1_fx8010_control_gpr {
286− struct snd_ctl_elem_id id; /* full control ID definition */
297+ struct emu10k1_ctl_elem_id id; /* full control ID definition */
287298 unsigned int vcount; /* visible count */
288299 unsigned int count; /* count of GPR (1..16) */
289300 unsigned short gpr[32]; /* GPR number(s) */
@@ -296,7 +307,7 @@ struct snd_emu10k1_fx8010_control_gpr { · 6 unmodified lines
296307
297308 /* old ABI without TLV support */
298309 struct snd_emu10k1_fx8010_control_old_gpr {
299− struct snd_ctl_elem_id id;
310+ struct emu10k1_ctl_elem_id id;
300311 unsigned int vcount;
301312 unsigned int count;
302313 unsigned short gpr[32];
@@ -310,24 +321,24 @@ struct snd_emu10k1_fx8010_code { · 7 unmodified lines
310321 char name[128];
311322
312323 __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
313− __u32 __user *gpr_map; /* initializers */
324+ __u32 *gpr_map; /* initializers */
314325
315326 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
316− struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
327+ struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */
317328
318329 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
319− struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
330+ struct emu10k1_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */
320331
321332 unsigned int gpr_list_control_count; /* count of GPR controls to list */
322333 unsigned int gpr_list_control_total; /* total count of GPR controls */
323− struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
334+ struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */
324335
325336 __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
326− __u32 __user *tram_data_map; /* data initializers */
327− __u32 __user *tram_addr_map; /* map initializers */
337+ __u32 *tram_data_map; /* data initializers */
338+ __u32 *tram_addr_map; /* map initializers */
328339
329340 __EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
330− __u32 __user *code; /* one instruction - 64 bits */
341+ __u32 *code; /* one instruction - 64 bits */
331342 };
332343
333344 struct snd_emu10k1_fx8010_tram {
@@ -371,11 +382,14 @@ struct snd_emu10k1_fx8010_pcm_rec { · 37 unmodified lines
371382 #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
372383 #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
373384
385+#ifndef __KERNEL__
374386 /* typedefs for compatibility to user-space */
375387 typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
376388 typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
377389 typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
378390 typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
379391 typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
392+typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t;
393+#endif
380394
381395 #endif /* _UAPI__SOUND_EMU10K1_H */