提交 877211f5 编写于 作者: T Takashi Iwai 提交者: Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: PCM

Modules: PCM Midlevel

Remove xxx_t typedefs from the core PCM codes.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 24c1f931
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <sound/pcm.h> #include <sound/pcm.h>
typedef struct sndrv_pcm_indirect { struct snd_pcm_indirect {
unsigned int hw_buffer_size; /* Byte size of hardware buffer */ unsigned int hw_buffer_size; /* Byte size of hardware buffer */
unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */ unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */
unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */ unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */
...@@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect { ...@@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect {
unsigned int sw_io; /* Current software pointer in bytes */ unsigned int sw_io; /* Current software pointer in bytes */
int sw_ready; /* Bytes ready to be transferred to/from hw */ int sw_ready; /* Bytes ready to be transferred to/from hw */
snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */ snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */
} snd_pcm_indirect_t; };
typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream, typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream,
snd_pcm_indirect_t *rec, size_t bytes); struct snd_pcm_indirect *rec, size_t bytes);
/* /*
* helper function for playback ack callback * helper function for playback ack callback
*/ */
static inline void static inline void
snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
snd_pcm_indirect_t *rec, struct snd_pcm_indirect *rec,
snd_pcm_indirect_copy_t copy) snd_pcm_indirect_copy_t copy)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
int qsize; int qsize;
...@@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, ...@@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
* ptr = current byte pointer * ptr = current byte pointer
*/ */
static inline snd_pcm_uframes_t static inline snd_pcm_uframes_t
snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
snd_pcm_indirect_t *rec, unsigned int ptr) struct snd_pcm_indirect *rec, unsigned int ptr)
{ {
int bytes = ptr - rec->hw_io; int bytes = ptr - rec->hw_io;
if (bytes < 0) if (bytes < 0)
...@@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, ...@@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
* helper function for capture ack callback * helper function for capture ack callback
*/ */
static inline void static inline void
snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream,
snd_pcm_indirect_t *rec, struct snd_pcm_indirect *rec,
snd_pcm_indirect_copy_t copy) snd_pcm_indirect_copy_t copy)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
...@@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, ...@@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
* ptr = current byte pointer * ptr = current byte pointer
*/ */
static inline snd_pcm_uframes_t static inline snd_pcm_uframes_t
snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream, snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream,
snd_pcm_indirect_t *rec, unsigned int ptr) struct snd_pcm_indirect *rec, unsigned int ptr)
{ {
int qsize; int qsize;
int bytes = ptr - rec->hw_io; int bytes = ptr - rec->hw_io;
......
...@@ -28,36 +28,9 @@ ...@@ -28,36 +28,9 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/bitops.h> #include <linux/bitops.h>
typedef sndrv_pcm_uframes_t snd_pcm_uframes_t;
typedef sndrv_pcm_sframes_t snd_pcm_sframes_t;
typedef enum sndrv_pcm_class snd_pcm_class_t;
typedef enum sndrv_pcm_subclass snd_pcm_subclass_t;
typedef enum sndrv_pcm_stream snd_pcm_stream_t;
typedef enum sndrv_pcm_access snd_pcm_access_t;
typedef enum sndrv_pcm_format snd_pcm_format_t;
typedef enum sndrv_pcm_subformat snd_pcm_subformat_t;
typedef enum sndrv_pcm_state snd_pcm_state_t;
typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
typedef struct sndrv_pcm_info snd_pcm_info_t;
typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
typedef enum sndrv_pcm_start snd_pcm_start_t;
typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t;
typedef struct sndrv_pcm_status snd_pcm_status_t;
typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t;
typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t;
typedef struct sndrv_mask snd_mask_t;
typedef struct snd_sg_buf snd_pcm_sgbuf_t;
#define snd_pcm_substream_chip(substream) ((substream)->private_data) #define snd_pcm_substream_chip(substream) ((substream)->private_data)
#define snd_pcm_chip(pcm) ((pcm)->private_data) #define snd_pcm_chip(pcm) ((pcm)->private_data)
typedef struct _snd_pcm_file snd_pcm_file_t;
typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
#include "pcm_oss.h" #include "pcm_oss.h"
#endif #endif
...@@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t; ...@@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
* Hardware (lowlevel) section * Hardware (lowlevel) section
*/ */
typedef struct _snd_pcm_hardware { struct snd_pcm_hardware {
unsigned int info; /* SNDRV_PCM_INFO_* */ unsigned int info; /* SNDRV_PCM_INFO_* */
u64 formats; /* SNDRV_PCM_FMTBIT_* */ u64 formats; /* SNDRV_PCM_FMTBIT_* */
unsigned int rates; /* SNDRV_PCM_RATE_* */ unsigned int rates; /* SNDRV_PCM_RATE_* */
...@@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware { ...@@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware {
unsigned int periods_min; /* min # of periods */ unsigned int periods_min; /* min # of periods */
unsigned int periods_max; /* max # of periods */ unsigned int periods_max; /* max # of periods */
size_t fifo_size; /* fifo size in bytes */ size_t fifo_size; /* fifo size in bytes */
} snd_pcm_hardware_t; };
typedef struct _snd_pcm_ops { struct snd_pcm_ops {
int (*open)(snd_pcm_substream_t *substream); int (*open)(struct snd_pcm_substream *substream);
int (*close)(snd_pcm_substream_t *substream); int (*close)(struct snd_pcm_substream *substream);
int (*ioctl)(snd_pcm_substream_t * substream, int (*ioctl)(struct snd_pcm_substream * substream,
unsigned int cmd, void *arg); unsigned int cmd, void *arg);
int (*hw_params)(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * params); int (*hw_params)(struct snd_pcm_substream *substream,
int (*hw_free)(snd_pcm_substream_t *substream); struct snd_pcm_hw_params *params);
int (*prepare)(snd_pcm_substream_t * substream); int (*hw_free)(struct snd_pcm_substream *substream);
int (*trigger)(snd_pcm_substream_t * substream, int cmd); int (*prepare)(struct snd_pcm_substream *substream);
snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream); int (*trigger)(struct snd_pcm_substream *substream, int cmd);
int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
int (*copy)(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos,
void __user *buf, snd_pcm_uframes_t count); void __user *buf, snd_pcm_uframes_t count);
int (*silence)(snd_pcm_substream_t *substream, int channel, int (*silence)(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos, snd_pcm_uframes_t count); snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); struct page *(*page)(struct snd_pcm_substream *substream,
int (*mmap)(snd_pcm_substream_t *substream, struct vm_area_struct *vma); unsigned long offset);
int (*ack)(snd_pcm_substream_t *substream); int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
} snd_pcm_ops_t; int (*ack)(struct snd_pcm_substream *substream);
};
/* /*
* *
...@@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops { ...@@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops {
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
#endif #endif
struct _snd_pcm_file { struct snd_pcm_file {
snd_pcm_substream_t * substream; struct snd_pcm_substream *substream;
struct _snd_pcm_file * next; struct snd_pcm_file *next;
}; };
typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t; struct snd_pcm_hw_rule;
typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule);
typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params, struct snd_pcm_hw_rule {
snd_pcm_hw_rule_t *rule);
struct _snd_pcm_hw_rule {
unsigned int cond; unsigned int cond;
snd_pcm_hw_rule_func_t func; snd_pcm_hw_rule_func_t func;
int var; int var;
...@@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule { ...@@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule {
void *private; void *private;
}; };
typedef struct _snd_pcm_hw_constraints { struct snd_pcm_hw_constraints {
snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK - struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
unsigned int rules_num; unsigned int rules_num;
unsigned int rules_all; unsigned int rules_all;
snd_pcm_hw_rule_t *rules; struct snd_pcm_hw_rule *rules;
} snd_pcm_hw_constraints_t; };
static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs, static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
} }
static inline snd_interval_t *constrs_interval(snd_pcm_hw_constraints_t *constrs, static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
} }
typedef struct { struct snd_ratnum {
unsigned int num; unsigned int num;
unsigned int den_min, den_max, den_step; unsigned int den_min, den_max, den_step;
} ratnum_t; };
typedef struct { struct snd_ratden {
unsigned int num_min, num_max, num_step; unsigned int num_min, num_max, num_step;
unsigned int den; unsigned int den;
} ratden_t; };
typedef struct { struct snd_pcm_hw_constraint_ratnums {
int nrats; int nrats;
ratnum_t *rats; struct snd_ratnum *rats;
} snd_pcm_hw_constraint_ratnums_t; };
typedef struct { struct snd_pcm_hw_constraint_ratdens {
int nrats; int nrats;
ratden_t *rats; struct snd_ratden *rats;
} snd_pcm_hw_constraint_ratdens_t; };
typedef struct { struct snd_pcm_hw_constraint_list {
unsigned int count; unsigned int count;
unsigned int *list; unsigned int *list;
unsigned int mask; unsigned int mask;
} snd_pcm_hw_constraint_list_t; };
struct _snd_pcm_runtime { struct snd_pcm_runtime {
/* -- Status -- */ /* -- Status -- */
snd_pcm_substream_t *trigger_master; struct snd_pcm_substream *trigger_master;
struct timespec trigger_tstamp; /* trigger timestamp */ struct timespec trigger_tstamp; /* trigger timestamp */
int overrange; int overrange;
snd_pcm_uframes_t avail_max; snd_pcm_uframes_t avail_max;
...@@ -306,7 +281,7 @@ struct _snd_pcm_runtime { ...@@ -306,7 +281,7 @@ struct _snd_pcm_runtime {
unsigned int rate_den; unsigned int rate_den;
/* -- SW params -- */ /* -- SW params -- */
snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ int tstamp_mode; /* mmap timestamp is updated */
unsigned int period_step; unsigned int period_step;
unsigned int sleep_min; /* min ticks to sleep */ unsigned int sleep_min; /* min ticks to sleep */
snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
...@@ -320,11 +295,11 @@ struct _snd_pcm_runtime { ...@@ -320,11 +295,11 @@ struct _snd_pcm_runtime {
snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
snd_pcm_uframes_t silence_filled; /* size filled with silence */ snd_pcm_uframes_t silence_filled; /* size filled with silence */
snd_pcm_sync_id_t sync; /* hardware synchronization ID */ union snd_pcm_sync_id sync; /* hardware synchronization ID */
/* -- mmap -- */ /* -- mmap -- */
volatile snd_pcm_mmap_status_t *status; volatile struct snd_pcm_mmap_status *status;
volatile snd_pcm_mmap_control_t *control; volatile struct snd_pcm_mmap_control *control;
atomic_t mmap_count; atomic_t mmap_count;
/* -- locking / scheduling -- */ /* -- locking / scheduling -- */
...@@ -334,15 +309,15 @@ struct _snd_pcm_runtime { ...@@ -334,15 +309,15 @@ struct _snd_pcm_runtime {
/* -- private section -- */ /* -- private section -- */
void *private_data; void *private_data;
void (*private_free)(snd_pcm_runtime_t *runtime); void (*private_free)(struct snd_pcm_runtime *runtime);
/* -- hardware description -- */ /* -- hardware description -- */
snd_pcm_hardware_t hw; struct snd_pcm_hardware hw;
snd_pcm_hw_constraints_t hw_constraints; struct snd_pcm_hw_constraints hw_constraints;
/* -- interrupt callbacks -- */ /* -- interrupt callbacks -- */
void (*transfer_ack_begin)(snd_pcm_substream_t *substream); void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
void (*transfer_ack_end)(snd_pcm_substream_t *substream); void (*transfer_ack_end)(struct snd_pcm_substream *substream);
/* -- timer -- */ /* -- timer -- */
unsigned int timer_resolution; /* timer resolution */ unsigned int timer_resolution; /* timer resolution */
...@@ -356,19 +331,19 @@ struct _snd_pcm_runtime { ...@@ -356,19 +331,19 @@ struct _snd_pcm_runtime {
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */ /* -- OSS things -- */
snd_pcm_oss_runtime_t oss; struct snd_pcm_oss_runtime oss;
#endif #endif
}; };
typedef struct _snd_pcm_group { /* keep linked substreams */ struct snd_pcm_group { /* keep linked substreams */
spinlock_t lock; spinlock_t lock;
struct list_head substreams; struct list_head substreams;
int count; int count;
} snd_pcm_group_t; };
struct _snd_pcm_substream { struct snd_pcm_substream {
snd_pcm_t *pcm; struct snd_pcm *pcm;
snd_pcm_str_t *pstr; struct snd_pcm_str *pstr;
void *private_data; /* copied from pcm->private_data */ void *private_data; /* copied from pcm->private_data */
int number; int number;
char name[32]; /* substream name */ char name[32]; /* substream name */
...@@ -378,32 +353,32 @@ struct _snd_pcm_substream { ...@@ -378,32 +353,32 @@ struct _snd_pcm_substream {
unsigned int dma_buf_id; unsigned int dma_buf_id;
size_t dma_max; size_t dma_max;
/* -- hardware operations -- */ /* -- hardware operations -- */
snd_pcm_ops_t *ops; struct snd_pcm_ops *ops;
/* -- runtime information -- */ /* -- runtime information -- */
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
/* -- timer section -- */ /* -- timer section -- */
snd_timer_t *timer; /* timer */ struct snd_timer *timer; /* timer */
unsigned timer_running: 1; /* time is running */ unsigned timer_running: 1; /* time is running */
spinlock_t timer_lock; spinlock_t timer_lock;
/* -- next substream -- */ /* -- next substream -- */
snd_pcm_substream_t *next; struct snd_pcm_substream *next;
/* -- linked substreams -- */ /* -- linked substreams -- */
struct list_head link_list; /* linked list member */ struct list_head link_list; /* linked list member */
snd_pcm_group_t self_group; /* fake group for non linked substream (with substream lock inside) */ struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
snd_pcm_group_t *group; /* pointer to current group */ struct snd_pcm_group *group; /* pointer to current group */
/* -- assigned files -- */ /* -- assigned files -- */
snd_pcm_file_t *file; struct snd_pcm_file *file;
struct file *ffile; struct file *ffile;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */ /* -- OSS things -- */
snd_pcm_oss_substream_t oss; struct snd_pcm_oss_substream oss;
#endif #endif
snd_info_entry_t *proc_root; struct snd_info_entry *proc_root;
snd_info_entry_t *proc_info_entry; struct snd_info_entry *proc_info_entry;
snd_info_entry_t *proc_hw_params_entry; struct snd_info_entry *proc_hw_params_entry;
snd_info_entry_t *proc_sw_params_entry; struct snd_info_entry *proc_sw_params_entry;
snd_info_entry_t *proc_status_entry; struct snd_info_entry *proc_status_entry;
snd_info_entry_t *proc_prealloc_entry; struct snd_info_entry *proc_prealloc_entry;
/* misc flags */ /* misc flags */
unsigned int no_mmap_ctrl: 1; unsigned int no_mmap_ctrl: 1;
}; };
...@@ -415,65 +390,65 @@ struct _snd_pcm_substream { ...@@ -415,65 +390,65 @@ struct _snd_pcm_substream {
#endif #endif
struct _snd_pcm_str { struct snd_pcm_str {
int stream; /* stream (direction) */ int stream; /* stream (direction) */
snd_pcm_t *pcm; struct snd_pcm *pcm;
/* -- substreams -- */ /* -- substreams -- */
unsigned int substream_count; unsigned int substream_count;
unsigned int substream_opened; unsigned int substream_opened;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */ /* -- OSS things -- */
snd_pcm_oss_stream_t oss; struct snd_pcm_oss_stream oss;
#endif #endif
snd_pcm_file_t *files; struct snd_pcm_file *files;
snd_minor_t *reg; struct snd_minor *reg;
snd_info_entry_t *proc_root; struct snd_info_entry *proc_root;
snd_info_entry_t *proc_info_entry; struct snd_info_entry *proc_info_entry;
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
snd_info_entry_t *proc_xrun_debug_entry; struct snd_info_entry *proc_xrun_debug_entry;
#endif #endif
}; };
struct _snd_pcm { struct snd_pcm {
snd_card_t *card; struct snd_card *card;
unsigned int device; /* device number */ unsigned int device; /* device number */
unsigned int info_flags; unsigned int info_flags;
unsigned short dev_class; unsigned short dev_class;
unsigned short dev_subclass; unsigned short dev_subclass;
char id[64]; char id[64];
char name[80]; char name[80];
snd_pcm_str_t streams[2]; struct snd_pcm_str streams[2];
struct semaphore open_mutex; struct semaphore open_mutex;
wait_queue_head_t open_wait; wait_queue_head_t open_wait;
void *private_data; void *private_data;
void (*private_free) (snd_pcm_t *pcm); void (*private_free) (struct snd_pcm *pcm);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
snd_pcm_oss_t oss; struct snd_pcm_oss oss;
#endif #endif
}; };
typedef struct _snd_pcm_notify { struct snd_pcm_notify {
int (*n_register) (snd_pcm_t * pcm); int (*n_register) (struct snd_pcm * pcm);
int (*n_disconnect) (snd_pcm_t * pcm); int (*n_disconnect) (struct snd_pcm * pcm);
int (*n_unregister) (snd_pcm_t * pcm); int (*n_unregister) (struct snd_pcm * pcm);
struct list_head list; struct list_head list;
} snd_pcm_notify_t; };
/* /*
* Registering * Registering
*/ */
extern snd_pcm_t *snd_pcm_devices[]; extern struct snd_pcm *snd_pcm_devices[];
extern snd_minor_t snd_pcm_reg[2]; extern struct snd_minor snd_pcm_reg[2];
int snd_pcm_new(snd_card_t * card, char *id, int device, int snd_pcm_new(struct snd_card *card, char *id, int device,
int playback_count, int capture_count, int playback_count, int capture_count,
snd_pcm_t **rpcm); struct snd_pcm **rpcm);
int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count); int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
/* /*
* Native I/O * Native I/O
...@@ -481,24 +456,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); ...@@ -481,24 +456,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);
extern rwlock_t snd_pcm_link_rwlock; extern rwlock_t snd_pcm_link_rwlock;
int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info); int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info); int snd_pcm_info_user(struct snd_pcm_substream *substream,
int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status); struct snd_pcm_info __user *info);
int snd_pcm_prepare(snd_pcm_substream_t *substream); int snd_pcm_status(struct snd_pcm_substream *substream,
int snd_pcm_start(snd_pcm_substream_t *substream); struct snd_pcm_status *status);
int snd_pcm_stop(snd_pcm_substream_t *substream, int status); int snd_pcm_prepare(struct snd_pcm_substream *substream);
int snd_pcm_drain_done(snd_pcm_substream_t *substream); int snd_pcm_start(struct snd_pcm_substream *substream);
int snd_pcm_stop(struct snd_pcm_substream *substream, int status);
int snd_pcm_drain_done(struct snd_pcm_substream *substream);
#ifdef CONFIG_PM #ifdef CONFIG_PM
int snd_pcm_suspend(snd_pcm_substream_t *substream); int snd_pcm_suspend(struct snd_pcm_substream *substream);
int snd_pcm_suspend_all(snd_pcm_t *pcm); int snd_pcm_suspend_all(struct snd_pcm *pcm);
#endif #endif
int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream); int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
void snd_pcm_release_substream(snd_pcm_substream_t *substream); void snd_pcm_release_substream(struct snd_pcm_substream *substream);
void snd_pcm_vma_notify_data(void *client, void *data); void snd_pcm_vma_notify_data(void *client, void *data);
int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area); int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
#if BITS_PER_LONG >= 64 #if BITS_PER_LONG >= 64
...@@ -578,30 +555,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem) ...@@ -578,30 +555,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
* PCM library * PCM library
*/ */
static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream) static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
{ {
return substream->group != &substream->self_group; return substream->group != &substream->self_group;
} }
static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream) static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
{ {
read_lock(&snd_pcm_link_rwlock); read_lock(&snd_pcm_link_rwlock);
spin_lock(&substream->self_group.lock); spin_lock(&substream->self_group.lock);
} }
static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream) static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream)
{ {
spin_unlock(&substream->self_group.lock); spin_unlock(&substream->self_group.lock);
read_unlock(&snd_pcm_link_rwlock); read_unlock(&snd_pcm_link_rwlock);
} }
static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream) static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
{ {
read_lock_irq(&snd_pcm_link_rwlock); read_lock_irq(&snd_pcm_link_rwlock);
spin_lock(&substream->self_group.lock); spin_lock(&substream->self_group.lock);
} }
static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream) static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
{ {
spin_unlock(&substream->self_group.lock); spin_unlock(&substream->self_group.lock);
read_unlock_irq(&snd_pcm_link_rwlock); read_unlock_irq(&snd_pcm_link_rwlock);
...@@ -623,56 +600,56 @@ do { \ ...@@ -623,56 +600,56 @@ do { \
list_for_each(pos, &substream->group->substreams) list_for_each(pos, &substream->group->substreams)
#define snd_pcm_group_substream_entry(pos) \ #define snd_pcm_group_substream_entry(pos) \
list_entry(pos, snd_pcm_substream_t, link_list) list_entry(pos, struct snd_pcm_substream, link_list)
static inline int snd_pcm_running(snd_pcm_substream_t *substream) static inline int snd_pcm_running(struct snd_pcm_substream *substream)
{ {
return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
(substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
} }
static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size) static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
{ {
return size * 8 / runtime->sample_bits; return size * 8 / runtime->sample_bits;
} }
static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size) static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
{ {
return size * 8 / runtime->frame_bits; return size * 8 / runtime->frame_bits;
} }
static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size) static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
{ {
return size * runtime->sample_bits / 8; return size * runtime->sample_bits / 8;
} }
static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size) static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
{ {
return size * runtime->frame_bits / 8; return size * runtime->frame_bits / 8;
} }
static inline int frame_aligned(snd_pcm_runtime_t *runtime, ssize_t bytes) static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
{ {
return bytes % runtime->byte_align == 0; return bytes % runtime->byte_align == 0;
} }
static inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream) static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
return frames_to_bytes(runtime, runtime->buffer_size); return frames_to_bytes(runtime, runtime->buffer_size);
} }
static inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream) static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
return frames_to_bytes(runtime, runtime->period_size); return frames_to_bytes(runtime, runtime->period_size);
} }
/* /*
* result is: 0 ... (boundary - 1) * result is: 0 ... (boundary - 1)
*/ */
static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtime) static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
{ {
snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
if (avail < 0) if (avail < 0)
...@@ -685,7 +662,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim ...@@ -685,7 +662,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim
/* /*
* result is: 0 ... (boundary - 1) * result is: 0 ... (boundary - 1)
*/ */
static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime) static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
{ {
snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr;
if (avail < 0) if (avail < 0)
...@@ -693,12 +670,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime ...@@ -693,12 +670,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime
return avail; return avail;
} }
static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(snd_pcm_runtime_t *runtime) static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
{ {
return runtime->buffer_size - snd_pcm_playback_avail(runtime); return runtime->buffer_size - snd_pcm_playback_avail(runtime);
} }
static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runtime) static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
{ {
return runtime->buffer_size - snd_pcm_capture_avail(runtime); return runtime->buffer_size - snd_pcm_capture_avail(runtime);
} }
...@@ -711,9 +688,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt ...@@ -711,9 +688,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt
* *
* Returns non-zero if available, or zero if not. * Returns non-zero if available, or zero if not.
*/ */
static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min;
} }
...@@ -725,9 +702,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) ...@@ -725,9 +702,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream)
* *
* Returns non-zero if available, or zero if not. * Returns non-zero if available, or zero if not.
*/ */
static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min;
} }
...@@ -740,9 +717,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) ...@@ -740,9 +717,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
* *
* Returns non-zero if exists, or zero if not. * Returns non-zero if exists, or zero if not.
*/ */
static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->stop_threshold >= runtime->boundary) if (runtime->stop_threshold >= runtime->boundary)
return 1; return 1;
...@@ -757,9 +734,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) ...@@ -757,9 +734,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream)
* *
* Returns non-zero if empty, or zero if not. * Returns non-zero if empty, or zero if not.
*/ */
static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; return snd_pcm_playback_avail(runtime) >= runtime->buffer_size;
} }
...@@ -771,14 +748,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) ...@@ -771,14 +748,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream)
* *
* Returns non-zero if empty, or zero if not. * Returns non-zero if empty, or zero if not.
*/ */
static inline int snd_pcm_capture_empty(snd_pcm_substream_t *substream) static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_capture_avail(runtime) == 0; return snd_pcm_capture_avail(runtime) == 0;
} }
static inline void snd_pcm_trigger_done(snd_pcm_substream_t *substream, static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
snd_pcm_substream_t *master) struct snd_pcm_substream *master)
{ {
substream->runtime->trigger_master = master; substream->runtime->trigger_master = master;
} }
...@@ -795,28 +772,28 @@ static inline int hw_is_interval(int var) ...@@ -795,28 +772,28 @@ static inline int hw_is_interval(int var)
var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
} }
static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
} }
static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
} }
static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params, static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var); return (const struct snd_mask *)hw_param_mask((struct snd_pcm_hw_params*) params, var);
} }
static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params, static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var); return (const struct snd_interval *)hw_param_interval((struct snd_pcm_hw_params*) params, var);
} }
#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) #define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))
...@@ -832,66 +809,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_ ...@@ -832,66 +809,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_
#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min #define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v); int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
unsigned int k, snd_interval_t *c); unsigned int k, struct snd_interval *c);
void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
const snd_interval_t *b, snd_interval_t *c); const struct snd_interval *b, struct snd_interval *c);
int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask); int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask);
int snd_interval_ratnum(snd_interval_t *i, int snd_interval_ratnum(struct snd_interval *i,
unsigned int rats_count, ratnum_t *rats, unsigned int rats_count, struct snd_ratnum *rats,
unsigned int *nump, unsigned int *denp); unsigned int *nump, unsigned int *denp);
void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, int snd_pcm_hw_param_near(struct snd_pcm_substream *substream,
snd_pcm_hw_params_t *params, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned int val, int *dir); unsigned int val, int *dir);
int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm, int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
snd_pcm_hw_params_t *params, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned int val, int dir); unsigned int val, int dir);
int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int32_t mask); u_int32_t mask);
int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int64_t mask); u_int64_t mask);
int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
unsigned int min, unsigned int max); unsigned int min, unsigned int max);
int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var); int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_list_t *l); struct snd_pcm_hw_constraint_list *l);
int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_ratnums_t *r); struct snd_pcm_hw_constraint_ratnums *r);
int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_ratdens_t *r); struct snd_pcm_hw_constraint_ratdens *r);
int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
unsigned int width, unsigned int width,
unsigned int msbits); unsigned int msbits);
int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned long step); unsigned long step);
int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var); snd_pcm_hw_param_t var);
int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
int var, int var,
snd_pcm_hw_rule_func_t func, void *private, snd_pcm_hw_rule_func_t func, void *private,
...@@ -925,37 +902,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int ...@@ -925,37 +902,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int
snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);
const char *snd_pcm_format_name(snd_pcm_format_t format); const char *snd_pcm_format_name(snd_pcm_format_t format);
void snd_pcm_set_ops(snd_pcm_t * pcm, int direction, snd_pcm_ops_t *ops); void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
void snd_pcm_set_sync(snd_pcm_substream_t * substream); void snd_pcm_set_sync(struct snd_pcm_substream *substream);
int snd_pcm_lib_interleave_len(snd_pcm_substream_t *substream); int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg); unsigned int cmd, void *arg);
int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream); int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
int snd_pcm_playback_xrun_check(snd_pcm_substream_t *substream); int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
int snd_pcm_capture_xrun_check(snd_pcm_substream_t *substream); int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
int snd_pcm_playback_xrun_asap(snd_pcm_substream_t *substream); int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
int snd_pcm_capture_xrun_asap(snd_pcm_substream_t *substream); int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr); void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
void snd_pcm_tick_prepare(snd_pcm_substream_t *substream); void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks); void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream); void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
void snd_pcm_period_elapsed(snd_pcm_substream_t *substream); void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
const void __user *buf, const void __user *buf,
snd_pcm_uframes_t frames); snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream,
void __user *buf, snd_pcm_uframes_t frames); void __user *buf, snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
void __user **bufs, snd_pcm_uframes_t frames); void __user **bufs, snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
void __user **bufs, snd_pcm_uframes_t frames); void __user **bufs, snd_pcm_uframes_t frames);
int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime); int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
struct snd_dma_buffer *bufp) struct snd_dma_buffer *bufp)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (bufp) { if (bufp) {
runtime->dma_buffer_p = bufp; runtime->dma_buffer_p = bufp;
runtime->dma_area = bufp->area; runtime->dma_area = bufp->area;
...@@ -973,47 +950,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, ...@@ -973,47 +950,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream,
* Timer interface * Timer interface
*/ */
void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream); void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
void snd_pcm_timer_init(snd_pcm_substream_t * substream); void snd_pcm_timer_init(struct snd_pcm_substream *substream);
void snd_pcm_timer_done(snd_pcm_substream_t * substream); void snd_pcm_timer_done(struct snd_pcm_substream *substream);
/* /*
* Memory * Memory
*/ */
int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream); int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm); int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data, int type, struct device *data,
size_t size, size_t max); size_t size, size_t max);
int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
int type, void *data, int type, void *data,
size_t size, size_t max); size_t size, size_t max);
int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size); int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream); int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) #define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)
#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) #define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) #define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
/* handle mmap counter - PCM mmap callback should handle this counter properly */ /* handle mmap counter - PCM mmap callback should handle this counter properly */
static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
atomic_inc(&substream->runtime->mmap_count); atomic_inc(&substream->runtime->mmap_count);
} }
static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
atomic_dec(&substream->runtime->mmap_count); atomic_dec(&substream->runtime->mmap_count);
} }
/* mmap for io-memory area */ /* mmap for io-memory area */
#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP #define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP
int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area); int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);
#else #else
#define SNDRV_PCM_INFO_MMAP_IOMEM 0 #define SNDRV_PCM_INFO_MMAP_IOMEM 0
#define snd_pcm_lib_mmap_iomem NULL #define snd_pcm_lib_mmap_iomem NULL
......
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
* *
*/ */
extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params, extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, const snd_mask_t *val); snd_pcm_hw_param_t var, const struct snd_mask *val);
extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir); snd_pcm_hw_param_t var, int *dir);
extern unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir); snd_pcm_hw_param_t var, int *dir);
extern int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir); snd_pcm_hw_param_t var, unsigned int val, int dir);
extern int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var); snd_pcm_hw_param_t var);
extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir); snd_pcm_hw_param_t var, unsigned int val, int dir);
/* To share the same code we have alsa-lib */ /* To share the same code we have alsa-lib */
...@@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v) ...@@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v)
INLINE size_t snd_mask_sizeof(void) INLINE size_t snd_mask_sizeof(void)
{ {
return sizeof(snd_mask_t); return sizeof(struct snd_mask);
} }
INLINE void snd_mask_none(snd_mask_t *mask) INLINE void snd_mask_none(struct snd_mask *mask)
{ {
memset(mask, 0, sizeof(*mask)); memset(mask, 0, sizeof(*mask));
} }
INLINE void snd_mask_any(snd_mask_t *mask) INLINE void snd_mask_any(struct snd_mask *mask)
{ {
memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
} }
INLINE int snd_mask_empty(const snd_mask_t *mask) INLINE int snd_mask_empty(const struct snd_mask *mask)
{ {
int i; int i;
for (i = 0; i < SNDRV_MASK_SIZE; i++) for (i = 0; i < SNDRV_MASK_SIZE; i++)
...@@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask) ...@@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask)
return 1; return 1;
} }
INLINE unsigned int snd_mask_min(const snd_mask_t *mask) INLINE unsigned int snd_mask_min(const struct snd_mask *mask)
{ {
int i; int i;
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
...@@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask) ...@@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
return 0; return 0;
} }
INLINE unsigned int snd_mask_max(const snd_mask_t *mask) INLINE unsigned int snd_mask_max(const struct snd_mask *mask)
{ {
int i; int i;
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
...@@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask) ...@@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
return 0; return 0;
} }
INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val) INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val)
{ {
assert(val <= SNDRV_MASK_BITS); assert(val <= SNDRV_MASK_BITS);
mask->bits[MASK_OFS(val)] |= MASK_BIT(val); mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
} }
INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val) INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val)
{ {
assert(val <= SNDRV_MASK_BITS); assert(val <= SNDRV_MASK_BITS);
mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
} }
INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to) INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to)
{ {
unsigned int i; unsigned int i;
assert(to <= SNDRV_MASK_BITS && from <= to); assert(to <= SNDRV_MASK_BITS && from <= to);
...@@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int ...@@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int
mask->bits[MASK_OFS(i)] |= MASK_BIT(i); mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
} }
INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to) INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to)
{ {
unsigned int i; unsigned int i;
assert(to <= SNDRV_MASK_BITS && from <= to); assert(to <= SNDRV_MASK_BITS && from <= to);
...@@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i ...@@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i
mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
} }
INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val)
{ {
unsigned int v; unsigned int v;
assert(val <= SNDRV_MASK_BITS); assert(val <= SNDRV_MASK_BITS);
...@@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) ...@@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
mask->bits[MASK_OFS(val)] = v; mask->bits[MASK_OFS(val)] = v;
} }
INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v) INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v)
{ {
int i; int i;
for (i = 0; i < SNDRV_MASK_SIZE; i++) for (i = 0; i < SNDRV_MASK_SIZE; i++)
mask->bits[i] &= v->bits[i]; mask->bits[i] &= v->bits[i];
} }
INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v) INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v)
{ {
return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t));
} }
INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v) INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v)
{ {
*mask = *v; *mask = *v;
} }
INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val) INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val)
{ {
assert(val <= SNDRV_MASK_BITS); assert(val <= SNDRV_MASK_BITS);
return mask->bits[MASK_OFS(val)] & MASK_BIT(val); return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
} }
INLINE int snd_mask_single(const snd_mask_t *mask) INLINE int snd_mask_single(const struct snd_mask *mask)
{ {
int i, c = 0; int i, c = 0;
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
...@@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask) ...@@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask)
return 1; return 1;
} }
INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v)
{ {
snd_mask_t old; struct snd_mask old;
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
snd_mask_copy(&old, mask); snd_mask_copy(&old, mask);
snd_mask_intersect(mask, v); snd_mask_intersect(mask, v);
...@@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) ...@@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
return !snd_mask_eq(mask, &old); return !snd_mask_eq(mask, &old);
} }
INLINE int snd_mask_refine_first(snd_mask_t *mask) INLINE int snd_mask_refine_first(struct snd_mask *mask)
{ {
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
if (snd_mask_single(mask)) if (snd_mask_single(mask))
...@@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask) ...@@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask)
return 1; return 1;
} }
INLINE int snd_mask_refine_last(snd_mask_t *mask) INLINE int snd_mask_refine_last(struct snd_mask *mask)
{ {
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
if (snd_mask_single(mask)) if (snd_mask_single(mask))
...@@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask) ...@@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask)
return 1; return 1;
} }
INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
{ {
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
if (snd_mask_min(mask) >= val) if (snd_mask_min(mask) >= val)
...@@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) ...@@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
return 1; return 1;
} }
INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
{ {
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
if (snd_mask_max(mask) <= val) if (snd_mask_max(mask) <= val)
...@@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) ...@@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
return 1; return 1;
} }
INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
{ {
int changed; int changed;
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
...@@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) ...@@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
return changed; return changed;
} }
INLINE int snd_mask_value(const snd_mask_t *mask) INLINE int snd_mask_value(const struct snd_mask *mask)
{ {
assert(!snd_mask_empty(mask)); assert(!snd_mask_empty(mask));
return snd_mask_min(mask); return snd_mask_min(mask);
} }
INLINE void snd_interval_any(snd_interval_t *i) INLINE void snd_interval_any(struct snd_interval *i)
{ {
i->min = 0; i->min = 0;
i->openmin = 0; i->openmin = 0;
...@@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i) ...@@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i)
i->empty = 0; i->empty = 0;
} }
INLINE void snd_interval_none(snd_interval_t *i) INLINE void snd_interval_none(struct snd_interval *i)
{ {
i->empty = 1; i->empty = 1;
} }
INLINE int snd_interval_checkempty(const snd_interval_t *i) INLINE int snd_interval_checkempty(const struct snd_interval *i)
{ {
return (i->min > i->max || return (i->min > i->max ||
(i->min == i->max && (i->openmin || i->openmax))); (i->min == i->max && (i->openmin || i->openmax)));
} }
INLINE int snd_interval_empty(const snd_interval_t *i) INLINE int snd_interval_empty(const struct snd_interval *i)
{ {
return i->empty; return i->empty;
} }
INLINE int snd_interval_single(const snd_interval_t *i) INLINE int snd_interval_single(const struct snd_interval *i)
{ {
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
return (i->min == i->max || return (i->min == i->max ||
(i->min + 1 == i->max && i->openmax)); (i->min + 1 == i->max && i->openmax));
} }
INLINE int snd_interval_value(const snd_interval_t *i) INLINE int snd_interval_value(const struct snd_interval *i)
{ {
assert(snd_interval_single(i)); assert(snd_interval_single(i));
return i->min; return i->min;
} }
INLINE int snd_interval_min(const snd_interval_t *i) INLINE int snd_interval_min(const struct snd_interval *i)
{ {
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
return i->min; return i->min;
} }
INLINE int snd_interval_max(const snd_interval_t *i) INLINE int snd_interval_max(const struct snd_interval *i)
{ {
unsigned int v; unsigned int v;
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
...@@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i) ...@@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i)
return v; return v;
} }
INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val) INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val)
{ {
return !((i->min > val || (i->min == val && i->openmin) || return !((i->min > val || (i->min == val && i->openmin) ||
i->max < val || (i->max == val && i->openmax))); i->max < val || (i->max == val && i->openmax)));
} }
INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s) INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s)
{ {
*d = *s; *d = *s;
} }
INLINE int snd_interval_setinteger(snd_interval_t *i) INLINE int snd_interval_setinteger(struct snd_interval *i)
{ {
if (i->integer) if (i->integer)
return 0; return 0;
...@@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i) ...@@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i)
return 1; return 1;
} }
INLINE int snd_interval_eq(const snd_interval_t *i1, const snd_interval_t *i2) INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2)
{ {
if (i1->empty) if (i1->empty)
return i2->empty; return i2->empty;
......
...@@ -33,18 +33,18 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Abramo Bagnara <abramo@alsa-proj ...@@ -33,18 +33,18 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Abramo Bagnara <abramo@alsa-proj
MODULE_DESCRIPTION("Midlevel PCM code for ALSA."); MODULE_DESCRIPTION("Midlevel PCM code for ALSA.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
snd_pcm_t *snd_pcm_devices[SNDRV_CARDS * SNDRV_PCM_DEVICES]; struct snd_pcm *snd_pcm_devices[SNDRV_CARDS * SNDRV_PCM_DEVICES];
static LIST_HEAD(snd_pcm_notify_list); static LIST_HEAD(snd_pcm_notify_list);
static DECLARE_MUTEX(register_mutex); static DECLARE_MUTEX(register_mutex);
static int snd_pcm_free(snd_pcm_t *pcm); static int snd_pcm_free(struct snd_pcm *pcm);
static int snd_pcm_dev_free(snd_device_t *device); static int snd_pcm_dev_free(struct snd_device *device);
static int snd_pcm_dev_register(snd_device_t *device); static int snd_pcm_dev_register(struct snd_device *device);
static int snd_pcm_dev_disconnect(snd_device_t *device); static int snd_pcm_dev_disconnect(struct snd_device *device);
static int snd_pcm_dev_unregister(snd_device_t *device); static int snd_pcm_dev_unregister(struct snd_device *device);
static int snd_pcm_control_ioctl(snd_card_t * card, static int snd_pcm_control_ioctl(struct snd_card *card,
snd_ctl_file_t * control, struct snd_ctl_file *control,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
unsigned int tmp; unsigned int tmp;
...@@ -71,13 +71,13 @@ static int snd_pcm_control_ioctl(snd_card_t * card, ...@@ -71,13 +71,13 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
} }
case SNDRV_CTL_IOCTL_PCM_INFO: case SNDRV_CTL_IOCTL_PCM_INFO:
{ {
snd_pcm_info_t __user *info; struct snd_pcm_info __user *info;
unsigned int device, subdevice; unsigned int device, subdevice;
snd_pcm_stream_t stream; int stream;
snd_pcm_t *pcm; struct snd_pcm *pcm;
snd_pcm_str_t *pstr; struct snd_pcm_str *pstr;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
info = (snd_pcm_info_t __user *)arg; info = (struct snd_pcm_info __user *)arg;
if (get_user(device, &info->device)) if (get_user(device, &info->device))
return -EFAULT; return -EFAULT;
if (device >= SNDRV_PCM_DEVICES) if (device >= SNDRV_PCM_DEVICES)
...@@ -200,7 +200,7 @@ static char *snd_pcm_tstamp_mode_names[] = { ...@@ -200,7 +200,7 @@ static char *snd_pcm_tstamp_mode_names[] = {
TSTAMP(MMAP), TSTAMP(MMAP),
}; };
static const char *snd_pcm_stream_name(snd_pcm_stream_t stream) static const char *snd_pcm_stream_name(int stream)
{ {
snd_assert(stream <= SNDRV_PCM_STREAM_LAST, return NULL); snd_assert(stream <= SNDRV_PCM_STREAM_LAST, return NULL);
return snd_pcm_stream_names[stream]; return snd_pcm_stream_names[stream];
...@@ -208,23 +208,20 @@ static const char *snd_pcm_stream_name(snd_pcm_stream_t stream) ...@@ -208,23 +208,20 @@ static const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
static const char *snd_pcm_access_name(snd_pcm_access_t access) static const char *snd_pcm_access_name(snd_pcm_access_t access)
{ {
snd_assert(access <= SNDRV_PCM_ACCESS_LAST, return NULL);
return snd_pcm_access_names[access]; return snd_pcm_access_names[access];
} }
const char *snd_pcm_format_name(snd_pcm_format_t format) const char *snd_pcm_format_name(snd_pcm_format_t format)
{ {
snd_assert(format <= SNDRV_PCM_FORMAT_LAST, return NULL);
return snd_pcm_format_names[format]; return snd_pcm_format_names[format];
} }
static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat) static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
{ {
snd_assert(subformat <= SNDRV_PCM_SUBFORMAT_LAST, return NULL);
return snd_pcm_subformat_names[subformat]; return snd_pcm_subformat_names[subformat];
} }
static const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode) static const char *snd_pcm_tstamp_mode_name(int mode)
{ {
snd_assert(mode <= SNDRV_PCM_TSTAMP_LAST, return NULL); snd_assert(mode <= SNDRV_PCM_TSTAMP_LAST, return NULL);
return snd_pcm_tstamp_mode_names[mode]; return snd_pcm_tstamp_mode_names[mode];
...@@ -232,7 +229,6 @@ static const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode) ...@@ -232,7 +229,6 @@ static const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
static const char *snd_pcm_state_name(snd_pcm_state_t state) static const char *snd_pcm_state_name(snd_pcm_state_t state)
{ {
snd_assert(state <= SNDRV_PCM_STATE_LAST, return NULL);
return snd_pcm_state_names[state]; return snd_pcm_state_names[state];
} }
...@@ -268,9 +264,10 @@ static const char *snd_pcm_oss_format_name(int format) ...@@ -268,9 +264,10 @@ static const char *snd_pcm_oss_format_name(int format)
#endif #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buffer_t *buffer) static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
struct snd_info_buffer *buffer)
{ {
snd_pcm_info_t *info; struct snd_pcm_info *info;
int err; int err;
if (! substream) if (! substream)
...@@ -302,20 +299,25 @@ static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buff ...@@ -302,20 +299,25 @@ static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buff
kfree(info); kfree(info);
} }
static void snd_pcm_stream_proc_info_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_stream_proc_info_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_proc_info_read(((snd_pcm_str_t *)entry->private_data)->substream, buffer); snd_pcm_proc_info_read(((struct snd_pcm_str *)entry->private_data)->substream,
buffer);
} }
static void snd_pcm_substream_proc_info_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_substream_proc_info_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_proc_info_read((snd_pcm_substream_t *)entry->private_data, buffer); snd_pcm_proc_info_read((struct snd_pcm_substream *)entry->private_data,
buffer);
} }
static void snd_pcm_substream_proc_hw_params_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; struct snd_pcm_substream *substream = entry->private_data;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (!runtime) { if (!runtime) {
snd_iprintf(buffer, "closed\n"); snd_iprintf(buffer, "closed\n");
return; return;
...@@ -347,10 +349,11 @@ static void snd_pcm_substream_proc_hw_params_read(snd_info_entry_t *entry, snd_i ...@@ -347,10 +349,11 @@ static void snd_pcm_substream_proc_hw_params_read(snd_info_entry_t *entry, snd_i
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
} }
static void snd_pcm_substream_proc_sw_params_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; struct snd_pcm_substream *substream = entry->private_data;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (!runtime) { if (!runtime) {
snd_iprintf(buffer, "closed\n"); snd_iprintf(buffer, "closed\n");
return; return;
...@@ -374,11 +377,12 @@ static void snd_pcm_substream_proc_sw_params_read(snd_info_entry_t *entry, snd_i ...@@ -374,11 +377,12 @@ static void snd_pcm_substream_proc_sw_params_read(snd_info_entry_t *entry, snd_i
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
} }
static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; struct snd_pcm_substream *substream = entry->private_data;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_status_t status; struct snd_pcm_status status;
int err; int err;
if (!runtime) { if (!runtime) {
snd_iprintf(buffer, "closed\n"); snd_iprintf(buffer, "closed\n");
...@@ -405,25 +409,27 @@ static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info ...@@ -405,25 +409,27 @@ static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info
#endif #endif
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
static void snd_pcm_xrun_debug_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_str_t *pstr = (snd_pcm_str_t *)entry->private_data; struct snd_pcm_str *pstr = entry->private_data;
snd_iprintf(buffer, "%d\n", pstr->xrun_debug); snd_iprintf(buffer, "%d\n", pstr->xrun_debug);
} }
static void snd_pcm_xrun_debug_write(snd_info_entry_t *entry, snd_info_buffer_t *buffer) static void snd_pcm_xrun_debug_write(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
snd_pcm_str_t *pstr = (snd_pcm_str_t *)entry->private_data; struct snd_pcm_str *pstr = entry->private_data;
char line[64]; char line[64];
if (!snd_info_get_line(buffer, line, sizeof(line))) if (!snd_info_get_line(buffer, line, sizeof(line)))
pstr->xrun_debug = simple_strtoul(line, NULL, 10); pstr->xrun_debug = simple_strtoul(line, NULL, 10);
} }
#endif #endif
static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr) static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
{ {
snd_pcm_t *pcm = pstr->pcm; struct snd_pcm *pcm = pstr->pcm;
snd_info_entry_t *entry; struct snd_info_entry *entry;
char name[16]; char name[16];
sprintf(name, "pcm%i%c", pcm->device, sprintf(name, "pcm%i%c", pcm->device,
...@@ -447,7 +453,8 @@ static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr) ...@@ -447,7 +453,8 @@ static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr)
pstr->proc_info_entry = entry; pstr->proc_info_entry = entry;
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug", pstr->proc_root)) != NULL) { if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
pstr->proc_root)) != NULL) {
entry->c.text.read_size = 64; entry->c.text.read_size = 64;
entry->c.text.read = snd_pcm_xrun_debug_read; entry->c.text.read = snd_pcm_xrun_debug_read;
entry->c.text.write_size = 64; entry->c.text.write_size = 64;
...@@ -464,7 +471,7 @@ static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr) ...@@ -464,7 +471,7 @@ static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr)
return 0; return 0;
} }
static int snd_pcm_stream_proc_done(snd_pcm_str_t *pstr) static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr)
{ {
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
if (pstr->proc_xrun_debug_entry) { if (pstr->proc_xrun_debug_entry) {
...@@ -483,10 +490,10 @@ static int snd_pcm_stream_proc_done(snd_pcm_str_t *pstr) ...@@ -483,10 +490,10 @@ static int snd_pcm_stream_proc_done(snd_pcm_str_t *pstr)
return 0; return 0;
} }
static int snd_pcm_substream_proc_init(snd_pcm_substream_t *substream) static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
{ {
snd_info_entry_t *entry; struct snd_info_entry *entry;
snd_card_t *card; struct snd_card *card;
char name[16]; char name[16];
card = substream->pcm->card; card = substream->pcm->card;
...@@ -540,7 +547,7 @@ static int snd_pcm_substream_proc_init(snd_pcm_substream_t *substream) ...@@ -540,7 +547,7 @@ static int snd_pcm_substream_proc_init(snd_pcm_substream_t *substream)
return 0; return 0;
} }
static int snd_pcm_substream_proc_done(snd_pcm_substream_t *substream) static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream)
{ {
if (substream->proc_info_entry) { if (substream->proc_info_entry) {
snd_info_unregister(substream->proc_info_entry); snd_info_unregister(substream->proc_info_entry);
...@@ -578,11 +585,11 @@ static int snd_pcm_substream_proc_done(snd_pcm_substream_t *substream) ...@@ -578,11 +585,11 @@ static int snd_pcm_substream_proc_done(snd_pcm_substream_t *substream)
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count) int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
{ {
int idx, err; int idx, err;
snd_pcm_str_t *pstr = &pcm->streams[stream]; struct snd_pcm_str *pstr = &pcm->streams[stream];
snd_pcm_substream_t *substream, *prev; struct snd_pcm_substream *substream, *prev;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
init_MUTEX(&pstr->oss.setup_mutex); init_MUTEX(&pstr->oss.setup_mutex);
...@@ -642,13 +649,13 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count) ...@@ -642,13 +649,13 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_new(snd_card_t * card, char *id, int device, int snd_pcm_new(struct snd_card *card, char *id, int device,
int playback_count, int capture_count, int playback_count, int capture_count,
snd_pcm_t ** rpcm) struct snd_pcm ** rpcm)
{ {
snd_pcm_t *pcm; struct snd_pcm *pcm;
int err; int err;
static snd_device_ops_t ops = { static struct snd_device_ops ops = {
.dev_free = snd_pcm_dev_free, .dev_free = snd_pcm_dev_free,
.dev_register = snd_pcm_dev_register, .dev_register = snd_pcm_dev_register,
.dev_disconnect = snd_pcm_dev_disconnect, .dev_disconnect = snd_pcm_dev_disconnect,
...@@ -684,11 +691,11 @@ int snd_pcm_new(snd_card_t * card, char *id, int device, ...@@ -684,11 +691,11 @@ int snd_pcm_new(snd_card_t * card, char *id, int device,
return 0; return 0;
} }
static void snd_pcm_free_stream(snd_pcm_str_t * pstr) static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
{ {
snd_pcm_substream_t *substream, *substream_next; struct snd_pcm_substream *substream, *substream_next;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
snd_pcm_oss_setup_t *setup, *setupn; struct snd_pcm_oss_setup *setup, *setupn;
#endif #endif
substream = pstr->substream; substream = pstr->substream;
while (substream) { while (substream) {
...@@ -707,7 +714,7 @@ static void snd_pcm_free_stream(snd_pcm_str_t * pstr) ...@@ -707,7 +714,7 @@ static void snd_pcm_free_stream(snd_pcm_str_t * pstr)
#endif #endif
} }
static int snd_pcm_free(snd_pcm_t *pcm) static int snd_pcm_free(struct snd_pcm *pcm)
{ {
snd_assert(pcm != NULL, return -ENXIO); snd_assert(pcm != NULL, return -ENXIO);
if (pcm->private_free) if (pcm->private_free)
...@@ -719,26 +726,26 @@ static int snd_pcm_free(snd_pcm_t *pcm) ...@@ -719,26 +726,26 @@ static int snd_pcm_free(snd_pcm_t *pcm)
return 0; return 0;
} }
static int snd_pcm_dev_free(snd_device_t *device) static int snd_pcm_dev_free(struct snd_device *device)
{ {
snd_pcm_t *pcm = device->device_data; struct snd_pcm *pcm = device->device_data;
return snd_pcm_free(pcm); return snd_pcm_free(pcm);
} }
static void snd_pcm_tick_timer_func(unsigned long data) static void snd_pcm_tick_timer_func(unsigned long data)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t*) data; struct snd_pcm_substream *substream = (struct snd_pcm_substream *) data;
snd_pcm_tick_elapsed(substream); snd_pcm_tick_elapsed(substream);
} }
int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,
snd_pcm_substream_t **rsubstream) struct snd_pcm_substream **rsubstream)
{ {
snd_pcm_str_t * pstr; struct snd_pcm_str * pstr;
snd_pcm_substream_t * substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t * runtime; struct snd_pcm_runtime *runtime;
snd_ctl_file_t *kctl; struct snd_ctl_file *kctl;
snd_card_t *card; struct snd_card *card;
struct list_head *list; struct list_head *list;
int prefer_subdevice = -1; int prefer_subdevice = -1;
size_t size; size_t size;
...@@ -800,7 +807,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, ...@@ -800,7 +807,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
if (runtime == NULL) if (runtime == NULL)
return -ENOMEM; return -ENOMEM;
size = PAGE_ALIGN(sizeof(snd_pcm_mmap_status_t)); size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status));
runtime->status = snd_malloc_pages(size, GFP_KERNEL); runtime->status = snd_malloc_pages(size, GFP_KERNEL);
if (runtime->status == NULL) { if (runtime->status == NULL) {
kfree(runtime); kfree(runtime);
...@@ -808,10 +815,11 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, ...@@ -808,10 +815,11 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
} }
memset((void*)runtime->status, 0, size); memset((void*)runtime->status, 0, size);
size = PAGE_ALIGN(sizeof(snd_pcm_mmap_control_t)); size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control));
runtime->control = snd_malloc_pages(size, GFP_KERNEL); runtime->control = snd_malloc_pages(size, GFP_KERNEL);
if (runtime->control == NULL) { if (runtime->control == NULL) {
snd_free_pages((void*)runtime->status, PAGE_ALIGN(sizeof(snd_pcm_mmap_status_t))); snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
kfree(runtime); kfree(runtime);
return -ENOMEM; return -ENOMEM;
} }
...@@ -832,30 +840,32 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, ...@@ -832,30 +840,32 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
return 0; return 0;
} }
void snd_pcm_release_substream(snd_pcm_substream_t *substream) void snd_pcm_release_substream(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t * runtime; struct snd_pcm_runtime *runtime;
substream->file = NULL; substream->file = NULL;
runtime = substream->runtime; runtime = substream->runtime;
snd_assert(runtime != NULL, return); snd_assert(runtime != NULL, return);
if (runtime->private_free != NULL) if (runtime->private_free != NULL)
runtime->private_free(runtime); runtime->private_free(runtime);
snd_free_pages((void*)runtime->status, PAGE_ALIGN(sizeof(snd_pcm_mmap_status_t))); snd_free_pages((void*)runtime->status,
snd_free_pages((void*)runtime->control, PAGE_ALIGN(sizeof(snd_pcm_mmap_control_t))); PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
snd_free_pages((void*)runtime->control,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
kfree(runtime->hw_constraints.rules); kfree(runtime->hw_constraints.rules);
kfree(runtime); kfree(runtime);
substream->runtime = NULL; substream->runtime = NULL;
substream->pstr->substream_opened--; substream->pstr->substream_opened--;
} }
static int snd_pcm_dev_register(snd_device_t *device) static int snd_pcm_dev_register(struct snd_device *device)
{ {
int idx, cidx, err; int idx, cidx, err;
unsigned short minor; unsigned short minor;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
struct list_head *list; struct list_head *list;
char str[16]; char str[16];
snd_pcm_t *pcm = device->device_data; struct snd_pcm *pcm = device->device_data;
snd_assert(pcm != NULL && device != NULL, return -ENXIO); snd_assert(pcm != NULL && device != NULL, return -ENXIO);
down(&register_mutex); down(&register_mutex);
...@@ -890,19 +900,19 @@ static int snd_pcm_dev_register(snd_device_t *device) ...@@ -890,19 +900,19 @@ static int snd_pcm_dev_register(snd_device_t *device)
snd_pcm_timer_init(substream); snd_pcm_timer_init(substream);
} }
list_for_each(list, &snd_pcm_notify_list) { list_for_each(list, &snd_pcm_notify_list) {
snd_pcm_notify_t *notify; struct snd_pcm_notify *notify;
notify = list_entry(list, snd_pcm_notify_t, list); notify = list_entry(list, struct snd_pcm_notify, list);
notify->n_register(pcm); notify->n_register(pcm);
} }
up(&register_mutex); up(&register_mutex);
return 0; return 0;
} }
static int snd_pcm_dev_disconnect(snd_device_t *device) static int snd_pcm_dev_disconnect(struct snd_device *device)
{ {
snd_pcm_t *pcm = device->device_data; struct snd_pcm *pcm = device->device_data;
struct list_head *list; struct list_head *list;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
int idx, cidx; int idx, cidx;
down(&register_mutex); down(&register_mutex);
...@@ -913,20 +923,20 @@ static int snd_pcm_dev_disconnect(snd_device_t *device) ...@@ -913,20 +923,20 @@ static int snd_pcm_dev_disconnect(snd_device_t *device)
if (substream->runtime) if (substream->runtime)
substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
list_for_each(list, &snd_pcm_notify_list) { list_for_each(list, &snd_pcm_notify_list) {
snd_pcm_notify_t *notify; struct snd_pcm_notify *notify;
notify = list_entry(list, snd_pcm_notify_t, list); notify = list_entry(list, struct snd_pcm_notify, list);
notify->n_disconnect(pcm); notify->n_disconnect(pcm);
} }
up(&register_mutex); up(&register_mutex);
return 0; return 0;
} }
static int snd_pcm_dev_unregister(snd_device_t *device) static int snd_pcm_dev_unregister(struct snd_device *device)
{ {
int idx, cidx, devtype; int idx, cidx, devtype;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
struct list_head *list; struct list_head *list;
snd_pcm_t *pcm = device->device_data; struct snd_pcm *pcm = device->device_data;
snd_assert(pcm != NULL, return -ENXIO); snd_assert(pcm != NULL, return -ENXIO);
down(&register_mutex); down(&register_mutex);
...@@ -947,15 +957,15 @@ static int snd_pcm_dev_unregister(snd_device_t *device) ...@@ -947,15 +957,15 @@ static int snd_pcm_dev_unregister(snd_device_t *device)
snd_pcm_timer_done(substream); snd_pcm_timer_done(substream);
} }
list_for_each(list, &snd_pcm_notify_list) { list_for_each(list, &snd_pcm_notify_list) {
snd_pcm_notify_t *notify; struct snd_pcm_notify *notify;
notify = list_entry(list, snd_pcm_notify_t, list); notify = list_entry(list, struct snd_pcm_notify, list);
notify->n_unregister(pcm); notify->n_unregister(pcm);
} }
up(&register_mutex); up(&register_mutex);
return snd_pcm_free(pcm); return snd_pcm_free(pcm);
} }
int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree) int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree)
{ {
int idx; int idx;
...@@ -984,10 +994,11 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree) ...@@ -984,10 +994,11 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree)
* Info interface * Info interface
*/ */
static void snd_pcm_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) static void snd_pcm_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{ {
int idx; int idx;
snd_pcm_t *pcm; struct snd_pcm *pcm;
down(&register_mutex); down(&register_mutex);
for (idx = 0; idx < SNDRV_CARDS * SNDRV_PCM_DEVICES; idx++) { for (idx = 0; idx < SNDRV_CARDS * SNDRV_PCM_DEVICES; idx++) {
...@@ -997,9 +1008,11 @@ static void snd_pcm_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffe ...@@ -997,9 +1008,11 @@ static void snd_pcm_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffe
snd_iprintf(buffer, "%02i-%02i: %s : %s", idx / SNDRV_PCM_DEVICES, snd_iprintf(buffer, "%02i-%02i: %s : %s", idx / SNDRV_PCM_DEVICES,
idx % SNDRV_PCM_DEVICES, pcm->id, pcm->name); idx % SNDRV_PCM_DEVICES, pcm->id, pcm->name);
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
snd_iprintf(buffer, " : playback %i", pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count); snd_iprintf(buffer, " : playback %i",
pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count);
if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
snd_iprintf(buffer, " : capture %i", pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); snd_iprintf(buffer, " : capture %i",
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count);
snd_iprintf(buffer, "\n"); snd_iprintf(buffer, "\n");
} }
up(&register_mutex); up(&register_mutex);
...@@ -1009,16 +1022,17 @@ static void snd_pcm_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffe ...@@ -1009,16 +1022,17 @@ static void snd_pcm_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffe
* ENTRY functions * ENTRY functions
*/ */
static snd_info_entry_t *snd_pcm_proc_entry = NULL; static struct snd_info_entry *snd_pcm_proc_entry = NULL;
static int __init alsa_pcm_init(void) static int __init alsa_pcm_init(void)
{ {
snd_info_entry_t *entry; struct snd_info_entry *entry;
snd_ctl_register_ioctl(snd_pcm_control_ioctl); snd_ctl_register_ioctl(snd_pcm_control_ioctl);
snd_ctl_register_ioctl_compat(snd_pcm_control_ioctl); snd_ctl_register_ioctl_compat(snd_pcm_control_ioctl);
if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) { if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
snd_info_set_text_ops(entry, NULL, SNDRV_CARDS * SNDRV_PCM_DEVICES * 128, snd_pcm_proc_read); snd_info_set_text_ops(entry, NULL, SNDRV_CARDS * SNDRV_PCM_DEVICES * 128,
snd_pcm_proc_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry); snd_info_free_entry(entry);
entry = NULL; entry = NULL;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/compat.h> #include <linux/compat.h>
static int snd_pcm_ioctl_delay_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream,
s32 __user *src) s32 __user *src)
{ {
snd_pcm_sframes_t delay; snd_pcm_sframes_t delay;
...@@ -39,7 +39,7 @@ static int snd_pcm_ioctl_delay_compat(snd_pcm_substream_t *substream, ...@@ -39,7 +39,7 @@ static int snd_pcm_ioctl_delay_compat(snd_pcm_substream_t *substream,
return err; return err;
} }
static int snd_pcm_ioctl_rewind_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_rewind_compat(struct snd_pcm_substream *substream,
u32 __user *src) u32 __user *src)
{ {
snd_pcm_uframes_t frames; snd_pcm_uframes_t frames;
...@@ -56,7 +56,7 @@ static int snd_pcm_ioctl_rewind_compat(snd_pcm_substream_t *substream, ...@@ -56,7 +56,7 @@ static int snd_pcm_ioctl_rewind_compat(snd_pcm_substream_t *substream,
return err < 0 ? err : 0; return err < 0 ? err : 0;
} }
static int snd_pcm_ioctl_forward_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_forward_compat(struct snd_pcm_substream *substream,
u32 __user *src) u32 __user *src)
{ {
snd_pcm_uframes_t frames; snd_pcm_uframes_t frames;
...@@ -73,12 +73,12 @@ static int snd_pcm_ioctl_forward_compat(snd_pcm_substream_t *substream, ...@@ -73,12 +73,12 @@ static int snd_pcm_ioctl_forward_compat(snd_pcm_substream_t *substream,
return err < 0 ? err : 0; return err < 0 ? err : 0;
} }
struct sndrv_pcm_hw_params32 { struct snd_pcm_hw_params32 {
u32 flags; u32 flags;
struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; /* this must be identical */ struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; /* this must be identical */
struct sndrv_mask mres[5]; /* reserved masks */ struct snd_mask mres[5]; /* reserved masks */
struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
struct sndrv_interval ires[9]; /* reserved intervals */ struct snd_interval ires[9]; /* reserved intervals */
u32 rmask; u32 rmask;
u32 cmask; u32 cmask;
u32 info; u32 info;
...@@ -89,7 +89,7 @@ struct sndrv_pcm_hw_params32 { ...@@ -89,7 +89,7 @@ struct sndrv_pcm_hw_params32 {
unsigned char reserved[64]; unsigned char reserved[64];
}; };
struct sndrv_pcm_sw_params32 { struct snd_pcm_sw_params32 {
s32 tstamp_mode; s32 tstamp_mode;
u32 period_step; u32 period_step;
u32 sleep_min; u32 sleep_min;
...@@ -104,7 +104,7 @@ struct sndrv_pcm_sw_params32 { ...@@ -104,7 +104,7 @@ struct sndrv_pcm_sw_params32 {
}; };
/* recalcuate the boundary within 32bit */ /* recalcuate the boundary within 32bit */
static snd_pcm_uframes_t recalculate_boundary(snd_pcm_runtime_t *runtime) static snd_pcm_uframes_t recalculate_boundary(struct snd_pcm_runtime *runtime)
{ {
snd_pcm_uframes_t boundary; snd_pcm_uframes_t boundary;
...@@ -116,10 +116,10 @@ static snd_pcm_uframes_t recalculate_boundary(snd_pcm_runtime_t *runtime) ...@@ -116,10 +116,10 @@ static snd_pcm_uframes_t recalculate_boundary(snd_pcm_runtime_t *runtime)
return boundary; return boundary;
} }
static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_sw_params_compat(struct snd_pcm_substream *substream,
struct sndrv_pcm_sw_params32 __user *src) struct snd_pcm_sw_params32 __user *src)
{ {
snd_pcm_sw_params_t params; struct snd_pcm_sw_params params;
snd_pcm_uframes_t boundary; snd_pcm_uframes_t boundary;
int err; int err;
...@@ -149,17 +149,17 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, ...@@ -149,17 +149,17 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream,
return err; return err;
} }
struct sndrv_pcm_channel_info32 { struct snd_pcm_channel_info32 {
u32 channel; u32 channel;
u32 offset; u32 offset;
u32 first; u32 first;
u32 step; u32 step;
}; };
static int snd_pcm_ioctl_channel_info_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substream,
struct sndrv_pcm_channel_info32 __user *src) struct snd_pcm_channel_info32 __user *src)
{ {
snd_pcm_channel_info_t info; struct snd_pcm_channel_info info;
int err; int err;
if (get_user(info.channel, &src->channel) || if (get_user(info.channel, &src->channel) ||
...@@ -178,7 +178,7 @@ static int snd_pcm_ioctl_channel_info_compat(snd_pcm_substream_t *substream, ...@@ -178,7 +178,7 @@ static int snd_pcm_ioctl_channel_info_compat(snd_pcm_substream_t *substream,
return err; return err;
} }
struct sndrv_pcm_status32 { struct snd_pcm_status32 {
s32 state; s32 state;
struct compat_timespec trigger_tstamp; struct compat_timespec trigger_tstamp;
struct compat_timespec tstamp; struct compat_timespec tstamp;
...@@ -193,10 +193,10 @@ struct sndrv_pcm_status32 { ...@@ -193,10 +193,10 @@ struct sndrv_pcm_status32 {
} __attribute__((packed)); } __attribute__((packed));
static int snd_pcm_status_user_compat(snd_pcm_substream_t *substream, static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
struct sndrv_pcm_status32 __user *src) struct snd_pcm_status32 __user *src)
{ {
snd_pcm_status_t status; struct snd_pcm_status status;
int err; int err;
err = snd_pcm_status(substream, &status); err = snd_pcm_status(substream, &status);
...@@ -221,12 +221,12 @@ static int snd_pcm_status_user_compat(snd_pcm_substream_t *substream, ...@@ -221,12 +221,12 @@ static int snd_pcm_status_user_compat(snd_pcm_substream_t *substream,
} }
/* both for HW_PARAMS and HW_REFINE */ /* both for HW_PARAMS and HW_REFINE */
static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
int refine, int refine,
struct sndrv_pcm_hw_params32 __user *data32) struct snd_pcm_hw_params32 __user *data32)
{ {
struct sndrv_pcm_hw_params *data; struct snd_pcm_hw_params *data;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int err; int err;
if (! (runtime = substream->runtime)) if (! (runtime = substream->runtime))
...@@ -265,14 +265,14 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, ...@@ -265,14 +265,14 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream,
/* /*
*/ */
struct sndrv_xferi32 { struct snd_xferi32 {
s32 result; s32 result;
u32 buf; u32 buf;
u32 frames; u32 frames;
}; };
static int snd_pcm_ioctl_xferi_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_xferi_compat(struct snd_pcm_substream *substream,
int dir, struct sndrv_xferi32 __user *data32) int dir, struct snd_xferi32 __user *data32)
{ {
compat_caddr_t buf; compat_caddr_t buf;
u32 frames; u32 frames;
...@@ -303,7 +303,7 @@ static int snd_pcm_ioctl_xferi_compat(snd_pcm_substream_t *substream, ...@@ -303,7 +303,7 @@ static int snd_pcm_ioctl_xferi_compat(snd_pcm_substream_t *substream,
/* snd_xfern needs remapping of bufs */ /* snd_xfern needs remapping of bufs */
struct sndrv_xfern32 { struct snd_xfern32 {
s32 result; s32 result;
u32 bufs; /* this is void **; */ u32 bufs; /* this is void **; */
u32 frames; u32 frames;
...@@ -315,8 +315,8 @@ struct sndrv_xfern32 { ...@@ -315,8 +315,8 @@ struct sndrv_xfern32 {
* handler there expands again the same 128 pointers on stack, so it is better * handler there expands again the same 128 pointers on stack, so it is better
* to handle the function (calling pcm_readv/writev) directly in this handler. * to handle the function (calling pcm_readv/writev) directly in this handler.
*/ */
static int snd_pcm_ioctl_xfern_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
int dir, struct sndrv_xfern32 __user *data32) int dir, struct snd_xfern32 __user *data32)
{ {
compat_caddr_t buf; compat_caddr_t buf;
compat_caddr_t __user *bufptr; compat_caddr_t __user *bufptr;
...@@ -360,7 +360,7 @@ static int snd_pcm_ioctl_xfern_compat(snd_pcm_substream_t *substream, ...@@ -360,7 +360,7 @@ static int snd_pcm_ioctl_xfern_compat(snd_pcm_substream_t *substream,
} }
struct sndrv_pcm_mmap_status32 { struct snd_pcm_mmap_status32 {
s32 state; s32 state;
s32 pad1; s32 pad1;
u32 hw_ptr; u32 hw_ptr;
...@@ -368,32 +368,32 @@ struct sndrv_pcm_mmap_status32 { ...@@ -368,32 +368,32 @@ struct sndrv_pcm_mmap_status32 {
s32 suspended_state; s32 suspended_state;
} __attribute__((packed)); } __attribute__((packed));
struct sndrv_pcm_mmap_control32 { struct snd_pcm_mmap_control32 {
u32 appl_ptr; u32 appl_ptr;
u32 avail_min; u32 avail_min;
}; };
struct sndrv_pcm_sync_ptr32 { struct snd_pcm_sync_ptr32 {
u32 flags; u32 flags;
union { union {
struct sndrv_pcm_mmap_status32 status; struct snd_pcm_mmap_status32 status;
unsigned char reserved[64]; unsigned char reserved[64];
} s; } s;
union { union {
struct sndrv_pcm_mmap_control32 control; struct snd_pcm_mmap_control32 control;
unsigned char reserved[64]; unsigned char reserved[64];
} c; } c;
} __attribute__((packed)); } __attribute__((packed));
static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
struct sndrv_pcm_sync_ptr32 __user *src) struct snd_pcm_sync_ptr32 __user *src)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
volatile struct sndrv_pcm_mmap_status *status; volatile struct snd_pcm_mmap_status *status;
volatile struct sndrv_pcm_mmap_control *control; volatile struct snd_pcm_mmap_control *control;
u32 sflags; u32 sflags;
struct sndrv_pcm_mmap_control scontrol; struct snd_pcm_mmap_control scontrol;
struct sndrv_pcm_mmap_status sstatus; struct snd_pcm_mmap_status sstatus;
snd_pcm_uframes_t boundary; snd_pcm_uframes_t boundary;
int err; int err;
...@@ -444,26 +444,26 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, ...@@ -444,26 +444,26 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream,
/* /*
*/ */
enum { enum {
SNDRV_PCM_IOCTL_HW_REFINE32 = _IOWR('A', 0x10, struct sndrv_pcm_hw_params32), SNDRV_PCM_IOCTL_HW_REFINE32 = _IOWR('A', 0x10, struct snd_pcm_hw_params32),
SNDRV_PCM_IOCTL_HW_PARAMS32 = _IOWR('A', 0x11, struct sndrv_pcm_hw_params32), SNDRV_PCM_IOCTL_HW_PARAMS32 = _IOWR('A', 0x11, struct snd_pcm_hw_params32),
SNDRV_PCM_IOCTL_SW_PARAMS32 = _IOWR('A', 0x13, struct sndrv_pcm_sw_params32), SNDRV_PCM_IOCTL_SW_PARAMS32 = _IOWR('A', 0x13, struct snd_pcm_sw_params32),
SNDRV_PCM_IOCTL_STATUS32 = _IOR('A', 0x20, struct sndrv_pcm_status32), SNDRV_PCM_IOCTL_STATUS32 = _IOR('A', 0x20, struct snd_pcm_status32),
SNDRV_PCM_IOCTL_DELAY32 = _IOR('A', 0x21, s32), SNDRV_PCM_IOCTL_DELAY32 = _IOR('A', 0x21, s32),
SNDRV_PCM_IOCTL_CHANNEL_INFO32 = _IOR('A', 0x32, struct sndrv_pcm_channel_info32), SNDRV_PCM_IOCTL_CHANNEL_INFO32 = _IOR('A', 0x32, struct snd_pcm_channel_info32),
SNDRV_PCM_IOCTL_REWIND32 = _IOW('A', 0x46, u32), SNDRV_PCM_IOCTL_REWIND32 = _IOW('A', 0x46, u32),
SNDRV_PCM_IOCTL_FORWARD32 = _IOW('A', 0x49, u32), SNDRV_PCM_IOCTL_FORWARD32 = _IOW('A', 0x49, u32),
SNDRV_PCM_IOCTL_WRITEI_FRAMES32 = _IOW('A', 0x50, struct sndrv_xferi32), SNDRV_PCM_IOCTL_WRITEI_FRAMES32 = _IOW('A', 0x50, struct snd_xferi32),
SNDRV_PCM_IOCTL_READI_FRAMES32 = _IOR('A', 0x51, struct sndrv_xferi32), SNDRV_PCM_IOCTL_READI_FRAMES32 = _IOR('A', 0x51, struct snd_xferi32),
SNDRV_PCM_IOCTL_WRITEN_FRAMES32 = _IOW('A', 0x52, struct sndrv_xfern32), SNDRV_PCM_IOCTL_WRITEN_FRAMES32 = _IOW('A', 0x52, struct snd_xfern32),
SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct sndrv_xfern32), SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32),
SNDRV_PCM_IOCTL_SYNC_PTR32 = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr32), SNDRV_PCM_IOCTL_SYNC_PTR32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr32),
}; };
static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
void __user *argp = compat_ptr(arg); void __user *argp = compat_ptr(arg);
pcm_file = file->private_data; pcm_file = file->private_data;
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
* *
* when runtime->silence_size >= runtime->boundary - fill processed area with silence immediately * when runtime->silence_size >= runtime->boundary - fill processed area with silence immediately
*/ */
void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr) void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t frames, ofs, transfer; snd_pcm_uframes_t frames, ofs, transfer;
if (runtime->silence_size < runtime->boundary) { if (runtime->silence_size < runtime->boundary) {
...@@ -128,7 +128,7 @@ void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t ...@@ -128,7 +128,7 @@ void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t
} }
} }
static void xrun(snd_pcm_substream_t *substream) static void xrun(struct snd_pcm_substream *substream)
{ {
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
...@@ -143,8 +143,8 @@ static void xrun(snd_pcm_substream_t *substream) ...@@ -143,8 +143,8 @@ static void xrun(snd_pcm_substream_t *substream)
#endif #endif
} }
static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(snd_pcm_substream_t *substream, static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream,
snd_pcm_runtime_t *runtime) struct snd_pcm_runtime *runtime)
{ {
snd_pcm_uframes_t pos; snd_pcm_uframes_t pos;
...@@ -162,8 +162,8 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(snd_pcm_substream_t *s ...@@ -162,8 +162,8 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(snd_pcm_substream_t *s
return pos; return pos;
} }
static inline int snd_pcm_update_hw_ptr_post(snd_pcm_substream_t *substream, static inline int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream,
snd_pcm_runtime_t *runtime) struct snd_pcm_runtime *runtime)
{ {
snd_pcm_uframes_t avail; snd_pcm_uframes_t avail;
...@@ -185,9 +185,9 @@ static inline int snd_pcm_update_hw_ptr_post(snd_pcm_substream_t *substream, ...@@ -185,9 +185,9 @@ static inline int snd_pcm_update_hw_ptr_post(snd_pcm_substream_t *substream,
return 0; return 0;
} }
static inline int snd_pcm_update_hw_ptr_interrupt(snd_pcm_substream_t *substream) static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t pos; snd_pcm_uframes_t pos;
snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt; snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt;
snd_pcm_sframes_t delta; snd_pcm_sframes_t delta;
...@@ -232,9 +232,9 @@ static inline int snd_pcm_update_hw_ptr_interrupt(snd_pcm_substream_t *substream ...@@ -232,9 +232,9 @@ static inline int snd_pcm_update_hw_ptr_interrupt(snd_pcm_substream_t *substream
} }
/* CAUTION: call it with irq disabled */ /* CAUTION: call it with irq disabled */
int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream) int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t pos; snd_pcm_uframes_t pos;
snd_pcm_uframes_t old_hw_ptr, new_hw_ptr; snd_pcm_uframes_t old_hw_ptr, new_hw_ptr;
snd_pcm_sframes_t delta; snd_pcm_sframes_t delta;
...@@ -281,10 +281,10 @@ int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream) ...@@ -281,10 +281,10 @@ int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream)
* *
* Sets the given PCM operators to the pcm instance. * Sets the given PCM operators to the pcm instance.
*/ */
void snd_pcm_set_ops(snd_pcm_t *pcm, int direction, snd_pcm_ops_t *ops) void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops)
{ {
snd_pcm_str_t *stream = &pcm->streams[direction]; struct snd_pcm_str *stream = &pcm->streams[direction];
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
for (substream = stream->substream; substream != NULL; substream = substream->next) for (substream = stream->substream; substream != NULL; substream = substream->next)
substream->ops = ops; substream->ops = ops;
...@@ -297,9 +297,9 @@ void snd_pcm_set_ops(snd_pcm_t *pcm, int direction, snd_pcm_ops_t *ops) ...@@ -297,9 +297,9 @@ void snd_pcm_set_ops(snd_pcm_t *pcm, int direction, snd_pcm_ops_t *ops)
* *
* Sets the PCM sync identifier for the card. * Sets the PCM sync identifier for the card.
*/ */
void snd_pcm_set_sync(snd_pcm_substream_t * substream) void snd_pcm_set_sync(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
runtime->sync.id32[0] = substream->pcm->card->number; runtime->sync.id32[0] = substream->pcm->card->number;
runtime->sync.id32[1] = -1; runtime->sync.id32[1] = -1;
...@@ -370,7 +370,7 @@ static inline unsigned int muldiv32(unsigned int a, unsigned int b, ...@@ -370,7 +370,7 @@ static inline unsigned int muldiv32(unsigned int a, unsigned int b,
return n; return n;
} }
static int snd_interval_refine_min(snd_interval_t *i, unsigned int min, int openmin) static int snd_interval_refine_min(struct snd_interval *i, unsigned int min, int openmin)
{ {
int changed = 0; int changed = 0;
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
...@@ -395,7 +395,7 @@ static int snd_interval_refine_min(snd_interval_t *i, unsigned int min, int open ...@@ -395,7 +395,7 @@ static int snd_interval_refine_min(snd_interval_t *i, unsigned int min, int open
return changed; return changed;
} }
static int snd_interval_refine_max(snd_interval_t *i, unsigned int max, int openmax) static int snd_interval_refine_max(struct snd_interval *i, unsigned int max, int openmax)
{ {
int changed = 0; int changed = 0;
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
...@@ -431,7 +431,7 @@ static int snd_interval_refine_max(snd_interval_t *i, unsigned int max, int open ...@@ -431,7 +431,7 @@ static int snd_interval_refine_max(snd_interval_t *i, unsigned int max, int open
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v) int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v)
{ {
int changed = 0; int changed = 0;
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
...@@ -473,7 +473,7 @@ int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v) ...@@ -473,7 +473,7 @@ int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v)
return changed; return changed;
} }
static int snd_interval_refine_first(snd_interval_t *i) static int snd_interval_refine_first(struct snd_interval *i)
{ {
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
if (snd_interval_single(i)) if (snd_interval_single(i))
...@@ -485,7 +485,7 @@ static int snd_interval_refine_first(snd_interval_t *i) ...@@ -485,7 +485,7 @@ static int snd_interval_refine_first(snd_interval_t *i)
return 1; return 1;
} }
static int snd_interval_refine_last(snd_interval_t *i) static int snd_interval_refine_last(struct snd_interval *i)
{ {
assert(!snd_interval_empty(i)); assert(!snd_interval_empty(i));
if (snd_interval_single(i)) if (snd_interval_single(i))
...@@ -497,9 +497,9 @@ static int snd_interval_refine_last(snd_interval_t *i) ...@@ -497,9 +497,9 @@ static int snd_interval_refine_last(snd_interval_t *i)
return 1; return 1;
} }
static int snd_interval_refine_set(snd_interval_t *i, unsigned int val) static int snd_interval_refine_set(struct snd_interval *i, unsigned int val)
{ {
snd_interval_t t; struct snd_interval t;
t.empty = 0; t.empty = 0;
t.min = t.max = val; t.min = t.max = val;
t.openmin = t.openmax = 0; t.openmin = t.openmax = 0;
...@@ -507,7 +507,7 @@ static int snd_interval_refine_set(snd_interval_t *i, unsigned int val) ...@@ -507,7 +507,7 @@ static int snd_interval_refine_set(snd_interval_t *i, unsigned int val)
return snd_interval_refine(i, &t); return snd_interval_refine(i, &t);
} }
void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c) void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c)
{ {
if (a->empty || b->empty) { if (a->empty || b->empty) {
snd_interval_none(c); snd_interval_none(c);
...@@ -531,7 +531,7 @@ void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_inte ...@@ -531,7 +531,7 @@ void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_inte
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c) void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c)
{ {
unsigned int r; unsigned int r;
if (a->empty || b->empty) { if (a->empty || b->empty) {
...@@ -566,8 +566,8 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte ...@@ -566,8 +566,8 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
unsigned int k, snd_interval_t *c) unsigned int k, struct snd_interval *c)
{ {
unsigned int r; unsigned int r;
if (a->empty || b->empty) { if (a->empty || b->empty) {
...@@ -597,8 +597,8 @@ void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, ...@@ -597,8 +597,8 @@ void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
const snd_interval_t *b, snd_interval_t *c) const struct snd_interval *b, struct snd_interval *c)
{ {
unsigned int r; unsigned int r;
if (a->empty || b->empty) { if (a->empty || b->empty) {
...@@ -636,13 +636,13 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, ...@@ -636,13 +636,13 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
int snd_interval_ratnum(snd_interval_t *i, int snd_interval_ratnum(struct snd_interval *i,
unsigned int rats_count, ratnum_t *rats, unsigned int rats_count, struct snd_ratnum *rats,
unsigned int *nump, unsigned int *denp) unsigned int *nump, unsigned int *denp)
{ {
unsigned int best_num, best_diff, best_den; unsigned int best_num, best_diff, best_den;
unsigned int k; unsigned int k;
snd_interval_t t; struct snd_interval t;
int err; int err;
best_num = best_den = best_diff = 0; best_num = best_den = best_diff = 0;
...@@ -731,20 +731,20 @@ int snd_interval_ratnum(snd_interval_t *i, ...@@ -731,20 +731,20 @@ int snd_interval_ratnum(snd_interval_t *i,
/** /**
* snd_interval_ratden - refine the interval value * snd_interval_ratden - refine the interval value
* @i: interval to refine * @i: interval to refine
* @rats_count: number of ratden_t * @rats_count: number of struct ratden
* @rats: ratden_t array * @rats: struct ratden array
* @nump: pointer to store the resultant numerator * @nump: pointer to store the resultant numerator
* @denp: pointer to store the resultant denominator * @denp: pointer to store the resultant denominator
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
static int snd_interval_ratden(snd_interval_t *i, static int snd_interval_ratden(struct snd_interval *i,
unsigned int rats_count, ratden_t *rats, unsigned int rats_count, struct snd_ratden *rats,
unsigned int *nump, unsigned int *denp) unsigned int *nump, unsigned int *denp)
{ {
unsigned int best_num, best_diff, best_den; unsigned int best_num, best_diff, best_den;
unsigned int k; unsigned int k;
snd_interval_t t; struct snd_interval t;
int err; int err;
best_num = best_den = best_diff = 0; best_num = best_den = best_diff = 0;
...@@ -837,7 +837,7 @@ static int snd_interval_ratden(snd_interval_t *i, ...@@ -837,7 +837,7 @@ static int snd_interval_ratden(snd_interval_t *i,
* *
* Returns non-zero if the value is changed, zero if not changed. * Returns non-zero if the value is changed, zero if not changed.
*/ */
int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask) int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask)
{ {
unsigned int k; unsigned int k;
int changed = 0; int changed = 0;
...@@ -878,7 +878,7 @@ int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, ...@@ -878,7 +878,7 @@ int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list,
return changed; return changed;
} }
static int snd_interval_step(snd_interval_t *i, unsigned int min, unsigned int step) static int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int step)
{ {
unsigned int n; unsigned int n;
int changed = 0; int changed = 0;
...@@ -912,18 +912,18 @@ static int snd_interval_step(snd_interval_t *i, unsigned int min, unsigned int s ...@@ -912,18 +912,18 @@ static int snd_interval_step(snd_interval_t *i, unsigned int min, unsigned int s
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond, int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond,
int var, int var,
snd_pcm_hw_rule_func_t func, void *private, snd_pcm_hw_rule_func_t func, void *private,
int dep, ...) int dep, ...)
{ {
snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
snd_pcm_hw_rule_t *c; struct snd_pcm_hw_rule *c;
unsigned int k; unsigned int k;
va_list args; va_list args;
va_start(args, dep); va_start(args, dep);
if (constrs->rules_num >= constrs->rules_all) { if (constrs->rules_num >= constrs->rules_all) {
snd_pcm_hw_rule_t *new; struct snd_pcm_hw_rule *new;
unsigned int new_rules = constrs->rules_all + 16; unsigned int new_rules = constrs->rules_all + 16;
new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL);
if (!new) if (!new)
...@@ -962,11 +962,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond, ...@@ -962,11 +962,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond,
* *
* Apply the constraint of the given bitmap mask to a mask parameter. * Apply the constraint of the given bitmap mask to a mask parameter.
*/ */
int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int32_t mask) u_int32_t mask)
{ {
snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
snd_mask_t *maskp = constrs_mask(constrs, var); struct snd_mask *maskp = constrs_mask(constrs, var);
*maskp->bits &= mask; *maskp->bits &= mask;
memset(maskp->bits + 1, 0, (SNDRV_MASK_MAX-32) / 8); /* clear rest */ memset(maskp->bits + 1, 0, (SNDRV_MASK_MAX-32) / 8); /* clear rest */
if (*maskp->bits == 0) if (*maskp->bits == 0)
...@@ -982,11 +982,11 @@ int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t va ...@@ -982,11 +982,11 @@ int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t va
* *
* Apply the constraint of the given bitmap mask to a mask parameter. * Apply the constraint of the given bitmap mask to a mask parameter.
*/ */
int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int64_t mask) u_int64_t mask)
{ {
snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
snd_mask_t *maskp = constrs_mask(constrs, var); struct snd_mask *maskp = constrs_mask(constrs, var);
maskp->bits[0] &= (u_int32_t)mask; maskp->bits[0] &= (u_int32_t)mask;
maskp->bits[1] &= (u_int32_t)(mask >> 32); maskp->bits[1] &= (u_int32_t)(mask >> 32);
memset(maskp->bits + 2, 0, (SNDRV_MASK_MAX-64) / 8); /* clear rest */ memset(maskp->bits + 2, 0, (SNDRV_MASK_MAX-64) / 8); /* clear rest */
...@@ -1002,9 +1002,9 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t ...@@ -1002,9 +1002,9 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
* *
* Apply the constraint of integer to an interval parameter. * Apply the constraint of integer to an interval parameter.
*/ */
int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var) int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var)
{ {
snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
return snd_interval_setinteger(constrs_interval(constrs, var)); return snd_interval_setinteger(constrs_interval(constrs, var));
} }
...@@ -1017,11 +1017,11 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t ...@@ -1017,11 +1017,11 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
* *
* Apply the min/max range constraint to an interval parameter. * Apply the min/max range constraint to an interval parameter.
*/ */
int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
unsigned int min, unsigned int max) unsigned int min, unsigned int max)
{ {
snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
snd_interval_t t; struct snd_interval t;
t.min = min; t.min = min;
t.max = max; t.max = max;
t.openmin = t.openmax = 0; t.openmin = t.openmax = 0;
...@@ -1029,10 +1029,10 @@ int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t ...@@ -1029,10 +1029,10 @@ int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
return snd_interval_refine(constrs_interval(constrs, var), &t); return snd_interval_refine(constrs_interval(constrs, var), &t);
} }
static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_pcm_hw_constraint_list_t *list = rule->private; struct snd_pcm_hw_constraint_list *list = rule->private;
return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask); return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask);
} }
...@@ -1046,20 +1046,20 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params, ...@@ -1046,20 +1046,20 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params,
* *
* Apply the list of constraints to an interval parameter. * Apply the list of constraints to an interval parameter.
*/ */
int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_list_t *l) struct snd_pcm_hw_constraint_list *l)
{ {
return snd_pcm_hw_rule_add(runtime, cond, var, return snd_pcm_hw_rule_add(runtime, cond, var,
snd_pcm_hw_rule_list, l, snd_pcm_hw_rule_list, l,
var, -1); var, -1);
} }
static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_pcm_hw_constraint_ratnums_t *r = rule->private; struct snd_pcm_hw_constraint_ratnums *r = rule->private;
unsigned int num = 0, den = 0; unsigned int num = 0, den = 0;
int err; int err;
err = snd_interval_ratnum(hw_param_interval(params, rule->var), err = snd_interval_ratnum(hw_param_interval(params, rule->var),
...@@ -1076,22 +1076,22 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params, ...@@ -1076,22 +1076,22 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params,
* @runtime: PCM runtime instance * @runtime: PCM runtime instance
* @cond: condition bits * @cond: condition bits
* @var: hw_params variable to apply the ratnums constraint * @var: hw_params variable to apply the ratnums constraint
* @r: ratnums_t constriants * @r: struct snd_ratnums constriants
*/ */
int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_ratnums_t *r) struct snd_pcm_hw_constraint_ratnums *r)
{ {
return snd_pcm_hw_rule_add(runtime, cond, var, return snd_pcm_hw_rule_add(runtime, cond, var,
snd_pcm_hw_rule_ratnums, r, snd_pcm_hw_rule_ratnums, r,
var, -1); var, -1);
} }
static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_pcm_hw_constraint_ratdens_t *r = rule->private; struct snd_pcm_hw_constraint_ratdens *r = rule->private;
unsigned int num = 0, den = 0; unsigned int num = 0, den = 0;
int err = snd_interval_ratden(hw_param_interval(params, rule->var), int err = snd_interval_ratden(hw_param_interval(params, rule->var),
r->nrats, r->rats, &num, &den); r->nrats, r->rats, &num, &den);
...@@ -1107,25 +1107,25 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params, ...@@ -1107,25 +1107,25 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params,
* @runtime: PCM runtime instance * @runtime: PCM runtime instance
* @cond: condition bits * @cond: condition bits
* @var: hw_params variable to apply the ratdens constraint * @var: hw_params variable to apply the ratdens constraint
* @r: ratdens_t constriants * @r: struct snd_ratdens constriants
*/ */
int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_ratdens_t *r) struct snd_pcm_hw_constraint_ratdens *r)
{ {
return snd_pcm_hw_rule_add(runtime, cond, var, return snd_pcm_hw_rule_add(runtime, cond, var,
snd_pcm_hw_rule_ratdens, r, snd_pcm_hw_rule_ratdens, r,
var, -1); var, -1);
} }
static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
unsigned int l = (unsigned long) rule->private; unsigned int l = (unsigned long) rule->private;
int width = l & 0xffff; int width = l & 0xffff;
unsigned int msbits = l >> 16; unsigned int msbits = l >> 16;
snd_interval_t *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); struct snd_interval *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS);
if (snd_interval_single(i) && snd_interval_value(i) == width) if (snd_interval_single(i) && snd_interval_value(i) == width)
params->msbits = msbits; params->msbits = msbits;
return 0; return 0;
...@@ -1138,7 +1138,7 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params, ...@@ -1138,7 +1138,7 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params,
* @width: sample bits width * @width: sample bits width
* @msbits: msbits width * @msbits: msbits width
*/ */
int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
unsigned int width, unsigned int width,
unsigned int msbits) unsigned int msbits)
...@@ -1150,8 +1150,8 @@ int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, ...@@ -1150,8 +1150,8 @@ int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1);
} }
static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
unsigned long step = (unsigned long) rule->private; unsigned long step = (unsigned long) rule->private;
return snd_interval_step(hw_param_interval(params, rule->var), 0, step); return snd_interval_step(hw_param_interval(params, rule->var), 0, step);
...@@ -1164,7 +1164,7 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params, ...@@ -1164,7 +1164,7 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params,
* @var: hw_params variable to apply the step constraint * @var: hw_params variable to apply the step constraint
* @step: step size * @step: step size
*/ */
int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var, snd_pcm_hw_param_t var,
unsigned long step) unsigned long step)
...@@ -1174,7 +1174,7 @@ int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, ...@@ -1174,7 +1174,7 @@ int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime,
var, -1); var, -1);
} }
static int snd_pcm_hw_rule_pow2(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *rule) static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule)
{ {
static int pow2_sizes[] = { static int pow2_sizes[] = {
1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, 1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7,
...@@ -1192,7 +1192,7 @@ static int snd_pcm_hw_rule_pow2(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t * ...@@ -1192,7 +1192,7 @@ static int snd_pcm_hw_rule_pow2(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *
* @cond: condition bits * @cond: condition bits
* @var: hw_params variable to apply the power-of-2 constraint * @var: hw_params variable to apply the power-of-2 constraint
*/ */
int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
unsigned int cond, unsigned int cond,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
...@@ -1202,13 +1202,12 @@ int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, ...@@ -1202,13 +1202,12 @@ int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime,
} }
/* To use the same code we have in alsa-lib */ /* To use the same code we have in alsa-lib */
#define snd_pcm_t snd_pcm_substream_t
#define assert(i) snd_assert((i), return -EINVAL) #define assert(i) snd_assert((i), return -EINVAL)
#ifndef INT_MIN #ifndef INT_MIN
#define INT_MIN ((int)((unsigned int)INT_MAX+1)) #define INT_MIN ((int)((unsigned int)INT_MAX+1))
#endif #endif
static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, static void _snd_pcm_hw_param_any(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
if (hw_is_mask(var)) { if (hw_is_mask(var)) {
...@@ -1230,7 +1229,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, ...@@ -1230,7 +1229,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params,
/* /*
* snd_pcm_hw_param_any * snd_pcm_hw_param_any
*/ */
int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int snd_pcm_hw_param_any(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
_snd_pcm_hw_param_any(params, var); _snd_pcm_hw_param_any(params, var);
...@@ -1238,7 +1237,7 @@ int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ...@@ -1238,7 +1237,7 @@ int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
} }
#endif /* 0 */ #endif /* 0 */
void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params) void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params)
{ {
unsigned int k; unsigned int k;
memset(params, 0, sizeof(*params)); memset(params, 0, sizeof(*params));
...@@ -1255,7 +1254,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params) ...@@ -1255,7 +1254,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
* *
* Fill PARAMS with full configuration space boundaries * Fill PARAMS with full configuration space boundaries
*/ */
int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) int snd_pcm_hw_params_any(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params)
{ {
_snd_pcm_hw_params_any(params); _snd_pcm_hw_params_any(params);
return snd_pcm_hw_refine(pcm, params); return snd_pcm_hw_refine(pcm, params);
...@@ -1271,11 +1270,11 @@ int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) ...@@ -1271,11 +1270,11 @@ int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
* Return the value for field PAR if it's fixed in configuration space * Return the value for field PAR if it's fixed in configuration space
* defined by PARAMS. Return -EINVAL otherwise * defined by PARAMS. Return -EINVAL otherwise
*/ */
static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params, static int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir) snd_pcm_hw_param_t var, int *dir)
{ {
if (hw_is_mask(var)) { if (hw_is_mask(var)) {
const snd_mask_t *mask = hw_param_mask_c(params, var); const struct snd_mask *mask = hw_param_mask_c(params, var);
if (!snd_mask_single(mask)) if (!snd_mask_single(mask))
return -EINVAL; return -EINVAL;
if (dir) if (dir)
...@@ -1283,7 +1282,7 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params, ...@@ -1283,7 +1282,7 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params,
return snd_mask_value(mask); return snd_mask_value(mask);
} }
if (hw_is_interval(var)) { if (hw_is_interval(var)) {
const snd_interval_t *i = hw_param_interval_c(params, var); const struct snd_interval *i = hw_param_interval_c(params, var);
if (!snd_interval_single(i)) if (!snd_interval_single(i))
return -EINVAL; return -EINVAL;
if (dir) if (dir)
...@@ -1302,7 +1301,7 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params, ...@@ -1302,7 +1301,7 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params,
* *
* Return the minimum value for field PAR. * Return the minimum value for field PAR.
*/ */
unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir) snd_pcm_hw_param_t var, int *dir)
{ {
if (hw_is_mask(var)) { if (hw_is_mask(var)) {
...@@ -1311,7 +1310,7 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, ...@@ -1311,7 +1310,7 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
return snd_mask_min(hw_param_mask_c(params, var)); return snd_mask_min(hw_param_mask_c(params, var));
} }
if (hw_is_interval(var)) { if (hw_is_interval(var)) {
const snd_interval_t *i = hw_param_interval_c(params, var); const struct snd_interval *i = hw_param_interval_c(params, var);
if (dir) if (dir)
*dir = i->openmin; *dir = i->openmin;
return snd_interval_min(i); return snd_interval_min(i);
...@@ -1328,7 +1327,7 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, ...@@ -1328,7 +1327,7 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
* *
* Return the maximum value for field PAR. * Return the maximum value for field PAR.
*/ */
unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir) snd_pcm_hw_param_t var, int *dir)
{ {
if (hw_is_mask(var)) { if (hw_is_mask(var)) {
...@@ -1337,7 +1336,7 @@ unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, ...@@ -1337,7 +1336,7 @@ unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params,
return snd_mask_max(hw_param_mask_c(params, var)); return snd_mask_max(hw_param_mask_c(params, var));
} }
if (hw_is_interval(var)) { if (hw_is_interval(var)) {
const snd_interval_t *i = hw_param_interval_c(params, var); const struct snd_interval *i = hw_param_interval_c(params, var);
if (dir) if (dir)
*dir = - (int) i->openmax; *dir = - (int) i->openmax;
return snd_interval_max(i); return snd_interval_max(i);
...@@ -1346,7 +1345,7 @@ unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, ...@@ -1346,7 +1345,7 @@ unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params,
return -EINVAL; return -EINVAL;
} }
void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
if (hw_is_mask(var)) { if (hw_is_mask(var)) {
...@@ -1362,7 +1361,7 @@ void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, ...@@ -1362,7 +1361,7 @@ void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params,
} }
} }
int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
int changed; int changed;
...@@ -1383,8 +1382,8 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, ...@@ -1383,8 +1382,8 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params,
* non integer values. Reduce configuration space accordingly. * non integer values. Reduce configuration space accordingly.
* Return -EINVAL if the configuration space is empty * Return -EINVAL if the configuration space is empty
*/ */
int snd_pcm_hw_param_setinteger(snd_pcm_t *pcm, int snd_pcm_hw_param_setinteger(struct snd_pcm_substream *pcm,
snd_pcm_hw_params_t *params, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
int changed = _snd_pcm_hw_param_setinteger(params, var); int changed = _snd_pcm_hw_param_setinteger(params, var);
...@@ -1399,7 +1398,7 @@ int snd_pcm_hw_param_setinteger(snd_pcm_t *pcm, ...@@ -1399,7 +1398,7 @@ int snd_pcm_hw_param_setinteger(snd_pcm_t *pcm,
} }
#endif /* 0 */ #endif /* 0 */
static int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params, static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
int changed; int changed;
...@@ -1430,8 +1429,8 @@ static int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params, ...@@ -1430,8 +1429,8 @@ static int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params,
* values > minimum. Reduce configuration space accordingly. * values > minimum. Reduce configuration space accordingly.
* Return the minimum. * Return the minimum.
*/ */
static int snd_pcm_hw_param_first(snd_pcm_t *pcm, static int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm,
snd_pcm_hw_params_t *params, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir) snd_pcm_hw_param_t var, int *dir)
{ {
int changed = _snd_pcm_hw_param_first(params, var); int changed = _snd_pcm_hw_param_first(params, var);
...@@ -1444,7 +1443,7 @@ static int snd_pcm_hw_param_first(snd_pcm_t *pcm, ...@@ -1444,7 +1443,7 @@ static int snd_pcm_hw_param_first(snd_pcm_t *pcm,
return snd_pcm_hw_param_value(params, var, dir); return snd_pcm_hw_param_value(params, var, dir);
} }
static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params, static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var) snd_pcm_hw_param_t var)
{ {
int changed; int changed;
...@@ -1475,8 +1474,8 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params, ...@@ -1475,8 +1474,8 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params,
* values < maximum. Reduce configuration space accordingly. * values < maximum. Reduce configuration space accordingly.
* Return the maximum. * Return the maximum.
*/ */
static int snd_pcm_hw_param_last(snd_pcm_t *pcm, static int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm,
snd_pcm_hw_params_t *params, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir) snd_pcm_hw_param_t var, int *dir)
{ {
int changed = _snd_pcm_hw_param_last(params, var); int changed = _snd_pcm_hw_param_last(params, var);
...@@ -1489,7 +1488,7 @@ static int snd_pcm_hw_param_last(snd_pcm_t *pcm, ...@@ -1489,7 +1488,7 @@ static int snd_pcm_hw_param_last(snd_pcm_t *pcm,
return snd_pcm_hw_param_value(params, var, dir); return snd_pcm_hw_param_value(params, var, dir);
} }
int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir) snd_pcm_hw_param_t var, unsigned int val, int dir)
{ {
int changed; int changed;
...@@ -1531,7 +1530,7 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, ...@@ -1531,7 +1530,7 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params,
* values < VAL. Reduce configuration space accordingly. * values < VAL. Reduce configuration space accordingly.
* Return new minimum or -EINVAL if the configuration space is empty * Return new minimum or -EINVAL if the configuration space is empty
*/ */
static int snd_pcm_hw_param_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, static int snd_pcm_hw_param_min(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, snd_pcm_hw_param_t var, unsigned int val,
int *dir) int *dir)
{ {
...@@ -1546,7 +1545,7 @@ static int snd_pcm_hw_param_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ...@@ -1546,7 +1545,7 @@ static int snd_pcm_hw_param_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
return snd_pcm_hw_param_value_min(params, var, dir); return snd_pcm_hw_param_value_min(params, var, dir);
} }
static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params, static int _snd_pcm_hw_param_max(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, snd_pcm_hw_param_t var, unsigned int val,
int dir) int dir)
{ {
...@@ -1591,7 +1590,7 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params, ...@@ -1591,7 +1590,7 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params,
* values >= VAL + 1. Reduce configuration space accordingly. * values >= VAL + 1. Reduce configuration space accordingly.
* Return new maximum or -EINVAL if the configuration space is empty * Return new maximum or -EINVAL if the configuration space is empty
*/ */
static int snd_pcm_hw_param_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, static int snd_pcm_hw_param_max(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, snd_pcm_hw_param_t var, unsigned int val,
int *dir) int *dir)
{ {
...@@ -1606,12 +1605,12 @@ static int snd_pcm_hw_param_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ...@@ -1606,12 +1605,12 @@ static int snd_pcm_hw_param_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
return snd_pcm_hw_param_value_max(params, var, dir); return snd_pcm_hw_param_value_max(params, var, dir);
} }
int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir) snd_pcm_hw_param_t var, unsigned int val, int dir)
{ {
int changed; int changed;
if (hw_is_mask(var)) { if (hw_is_mask(var)) {
snd_mask_t *m = hw_param_mask(params, var); struct snd_mask *m = hw_param_mask(params, var);
if (val == 0 && dir < 0) { if (val == 0 && dir < 0) {
changed = -EINVAL; changed = -EINVAL;
snd_mask_none(m); snd_mask_none(m);
...@@ -1623,14 +1622,14 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, ...@@ -1623,14 +1622,14 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
changed = snd_mask_refine_set(hw_param_mask(params, var), val); changed = snd_mask_refine_set(hw_param_mask(params, var), val);
} }
} else if (hw_is_interval(var)) { } else if (hw_is_interval(var)) {
snd_interval_t *i = hw_param_interval(params, var); struct snd_interval *i = hw_param_interval(params, var);
if (val == 0 && dir < 0) { if (val == 0 && dir < 0) {
changed = -EINVAL; changed = -EINVAL;
snd_interval_none(i); snd_interval_none(i);
} else if (dir == 0) } else if (dir == 0)
changed = snd_interval_refine_set(i, val); changed = snd_interval_refine_set(i, val);
else { else {
snd_interval_t t; struct snd_interval t;
t.openmin = 1; t.openmin = 1;
t.openmax = 1; t.openmax = 1;
t.empty = 0; t.empty = 0;
...@@ -1667,7 +1666,7 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, ...@@ -1667,7 +1666,7 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
* values != VAL. Reduce configuration space accordingly. * values != VAL. Reduce configuration space accordingly.
* Return VAL or -EINVAL if the configuration space is empty * Return VAL or -EINVAL if the configuration space is empty
*/ */
int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir) snd_pcm_hw_param_t var, unsigned int val, int dir)
{ {
int changed = _snd_pcm_hw_param_set(params, var, val, dir); int changed = _snd_pcm_hw_param_set(params, var, val, dir);
...@@ -1681,8 +1680,8 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ...@@ -1681,8 +1680,8 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
return snd_pcm_hw_param_value(params, var, NULL); return snd_pcm_hw_param_value(params, var, NULL);
} }
static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, static int _snd_pcm_hw_param_mask(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, const snd_mask_t *val) snd_pcm_hw_param_t var, const struct snd_mask *val)
{ {
int changed; int changed;
assert(hw_is_mask(var)); assert(hw_is_mask(var));
...@@ -1708,8 +1707,8 @@ static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, ...@@ -1708,8 +1707,8 @@ static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params,
* Return 0 on success or -EINVAL * Return 0 on success or -EINVAL
* if the configuration space is empty * if the configuration space is empty
*/ */
int snd_pcm_hw_param_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, const snd_mask_t *val) snd_pcm_hw_param_t var, const struct snd_mask *val)
{ {
int changed = _snd_pcm_hw_param_mask(params, var, val); int changed = _snd_pcm_hw_param_mask(params, var, val);
if (changed < 0) if (changed < 0)
...@@ -1784,10 +1783,10 @@ static int boundary_nearer(int min, int mindir, ...@@ -1784,10 +1783,10 @@ static int boundary_nearer(int min, int mindir,
* SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_SUBFORMAT. * SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_SUBFORMAT.
* Return the value found. * Return the value found.
*/ */
int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int best, int *dir) snd_pcm_hw_param_t var, unsigned int best, int *dir)
{ {
snd_pcm_hw_params_t *save = NULL; struct snd_pcm_hw_params *save = NULL;
int v; int v;
unsigned int saved_min; unsigned int saved_min;
int last = 0; int last = 0;
...@@ -1814,7 +1813,7 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ...@@ -1814,7 +1813,7 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
saved_min = min; saved_min = min;
min = snd_pcm_hw_param_min(pcm, params, var, min, &mindir); min = snd_pcm_hw_param_min(pcm, params, var, min, &mindir);
if (min >= 0) { if (min >= 0) {
snd_pcm_hw_params_t *params1; struct snd_pcm_hw_params *params1;
if (max < 0) if (max < 0)
goto _end; goto _end;
if ((unsigned int)min == saved_min && mindir == valdir) if ((unsigned int)min == saved_min && mindir == valdir)
...@@ -1861,7 +1860,7 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ...@@ -1861,7 +1860,7 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
* first access, first format, first subformat, min channels, * first access, first format, first subformat, min channels,
* min rate, min period time, max buffer size, min tick time * min rate, min period time, max buffer size, min tick time
*/ */
int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params)
{ {
int err; int err;
...@@ -1892,13 +1891,12 @@ int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) ...@@ -1892,13 +1891,12 @@ int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
return 0; return 0;
} }
#undef snd_pcm_t
#undef assert #undef assert
static int snd_pcm_lib_ioctl_reset(snd_pcm_substream_t *substream, static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream,
void *arg) void *arg)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
unsigned long flags; unsigned long flags;
snd_pcm_stream_lock_irqsave(substream, flags); snd_pcm_stream_lock_irqsave(substream, flags);
if (snd_pcm_running(substream) && if (snd_pcm_running(substream) &&
...@@ -1910,11 +1908,11 @@ static int snd_pcm_lib_ioctl_reset(snd_pcm_substream_t *substream, ...@@ -1910,11 +1908,11 @@ static int snd_pcm_lib_ioctl_reset(snd_pcm_substream_t *substream,
return 0; return 0;
} }
static int snd_pcm_lib_ioctl_channel_info(snd_pcm_substream_t *substream, static int snd_pcm_lib_ioctl_channel_info(struct snd_pcm_substream *substream,
void *arg) void *arg)
{ {
snd_pcm_channel_info_t *info = arg; struct snd_pcm_channel_info *info = arg;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int width; int width;
if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) { if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) {
info->offset = -1; info->offset = -1;
...@@ -1956,7 +1954,7 @@ static int snd_pcm_lib_ioctl_channel_info(snd_pcm_substream_t *substream, ...@@ -1956,7 +1954,7 @@ static int snd_pcm_lib_ioctl_channel_info(snd_pcm_substream_t *substream,
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
switch (cmd) { switch (cmd) {
...@@ -1974,10 +1972,10 @@ int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, ...@@ -1974,10 +1972,10 @@ int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream,
* Conditions * Conditions
*/ */
static void snd_pcm_system_tick_set(snd_pcm_substream_t *substream, static void snd_pcm_system_tick_set(struct snd_pcm_substream *substream,
unsigned long ticks) unsigned long ticks)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (ticks == 0) if (ticks == 0)
del_timer(&runtime->tick_timer); del_timer(&runtime->tick_timer);
else { else {
...@@ -1988,14 +1986,14 @@ static void snd_pcm_system_tick_set(snd_pcm_substream_t *substream, ...@@ -1988,14 +1986,14 @@ static void snd_pcm_system_tick_set(snd_pcm_substream_t *substream,
} }
/* Temporary alias */ /* Temporary alias */
void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks) void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks)
{ {
snd_pcm_system_tick_set(substream, ticks); snd_pcm_system_tick_set(substream, ticks);
} }
void snd_pcm_tick_prepare(snd_pcm_substream_t *substream) void snd_pcm_tick_prepare(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t frames = ULONG_MAX; snd_pcm_uframes_t frames = ULONG_MAX;
snd_pcm_uframes_t avail, dist; snd_pcm_uframes_t avail, dist;
unsigned int ticks; unsigned int ticks;
...@@ -2046,9 +2044,9 @@ void snd_pcm_tick_prepare(snd_pcm_substream_t *substream) ...@@ -2046,9 +2044,9 @@ void snd_pcm_tick_prepare(snd_pcm_substream_t *substream)
snd_pcm_tick_set(substream, (unsigned long) ticks); snd_pcm_tick_set(substream, (unsigned long) ticks);
} }
void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream) void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
unsigned long flags; unsigned long flags;
snd_assert(substream != NULL, return); snd_assert(substream != NULL, return);
...@@ -2076,9 +2074,9 @@ void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream) ...@@ -2076,9 +2074,9 @@ void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream)
* Even if more than one periods have elapsed since the last call, you * Even if more than one periods have elapsed since the last call, you
* have to call this only once. * have to call this only once.
*/ */
void snd_pcm_period_elapsed(snd_pcm_substream_t *substream) void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
unsigned long flags; unsigned long flags;
snd_assert(substream != NULL, return); snd_assert(substream != NULL, return);
...@@ -2104,12 +2102,12 @@ void snd_pcm_period_elapsed(snd_pcm_substream_t *substream) ...@@ -2104,12 +2102,12 @@ void snd_pcm_period_elapsed(snd_pcm_substream_t *substream)
kill_fasync(&runtime->fasync, SIGIO, POLL_IN); kill_fasync(&runtime->fasync, SIGIO, POLL_IN);
} }
static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream, static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream,
unsigned int hwoff, unsigned int hwoff,
unsigned long data, unsigned int off, unsigned long data, unsigned int off,
snd_pcm_uframes_t frames) snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
if (substream->ops->copy) { if (substream->ops->copy) {
...@@ -2124,17 +2122,17 @@ static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream, ...@@ -2124,17 +2122,17 @@ static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream,
return 0; return 0;
} }
typedef int (*transfer_f)(snd_pcm_substream_t *substream, unsigned int hwoff, typedef int (*transfer_f)(struct snd_pcm_substream *substream, unsigned int hwoff,
unsigned long data, unsigned int off, unsigned long data, unsigned int off,
snd_pcm_uframes_t size); snd_pcm_uframes_t size);
static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream,
unsigned long data, unsigned long data,
snd_pcm_uframes_t size, snd_pcm_uframes_t size,
int nonblock, int nonblock,
transfer_f transfer) transfer_f transfer)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t xfer = 0; snd_pcm_uframes_t xfer = 0;
snd_pcm_uframes_t offset = 0; snd_pcm_uframes_t offset = 0;
int err = 0; int err = 0;
...@@ -2290,9 +2288,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, ...@@ -2290,9 +2288,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
} }
snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void __user *buf, snd_pcm_uframes_t size) snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, const void __user *buf, snd_pcm_uframes_t size)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int nonblock; int nonblock;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2306,7 +2304,7 @@ snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void _ ...@@ -2306,7 +2304,7 @@ snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void _
nonblock = !!(substream->ffile->f_flags & O_NONBLOCK); nonblock = !!(substream->ffile->f_flags & O_NONBLOCK);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
if (substream->oss.oss) { if (substream->oss.oss) {
snd_pcm_oss_setup_t *setup = substream->oss.setup; struct snd_pcm_oss_setup *setup = substream->oss.setup;
if (setup != NULL) { if (setup != NULL) {
if (setup->nonblock) if (setup->nonblock)
nonblock = 1; nonblock = 1;
...@@ -2323,12 +2321,12 @@ snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void _ ...@@ -2323,12 +2321,12 @@ snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void _
snd_pcm_lib_write_transfer); snd_pcm_lib_write_transfer);
} }
static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, static int snd_pcm_lib_writev_transfer(struct snd_pcm_substream *substream,
unsigned int hwoff, unsigned int hwoff,
unsigned long data, unsigned int off, unsigned long data, unsigned int off,
snd_pcm_uframes_t frames) snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
void __user **bufs = (void __user **)data; void __user **bufs = (void __user **)data;
int channels = runtime->channels; int channels = runtime->channels;
...@@ -2363,11 +2361,11 @@ static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream, ...@@ -2363,11 +2361,11 @@ static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream,
return 0; return 0;
} }
snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
void __user **bufs, void __user **bufs,
snd_pcm_uframes_t frames) snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int nonblock; int nonblock;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2381,7 +2379,7 @@ snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, ...@@ -2381,7 +2379,7 @@ snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream,
nonblock = !!(substream->ffile->f_flags & O_NONBLOCK); nonblock = !!(substream->ffile->f_flags & O_NONBLOCK);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
if (substream->oss.oss) { if (substream->oss.oss) {
snd_pcm_oss_setup_t *setup = substream->oss.setup; struct snd_pcm_oss_setup *setup = substream->oss.setup;
if (setup != NULL) { if (setup != NULL) {
if (setup->nonblock) if (setup->nonblock)
nonblock = 1; nonblock = 1;
...@@ -2397,12 +2395,12 @@ snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, ...@@ -2397,12 +2395,12 @@ snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream,
nonblock, snd_pcm_lib_writev_transfer); nonblock, snd_pcm_lib_writev_transfer);
} }
static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream, static int snd_pcm_lib_read_transfer(struct snd_pcm_substream *substream,
unsigned int hwoff, unsigned int hwoff,
unsigned long data, unsigned int off, unsigned long data, unsigned int off,
snd_pcm_uframes_t frames) snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
if (substream->ops->copy) { if (substream->ops->copy) {
...@@ -2417,13 +2415,13 @@ static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream, ...@@ -2417,13 +2415,13 @@ static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream,
return 0; return 0;
} }
static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream,
unsigned long data, unsigned long data,
snd_pcm_uframes_t size, snd_pcm_uframes_t size,
int nonblock, int nonblock,
transfer_f transfer) transfer_f transfer)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t xfer = 0; snd_pcm_uframes_t xfer = 0;
snd_pcm_uframes_t offset = 0; snd_pcm_uframes_t offset = 0;
int err = 0; int err = 0;
...@@ -2587,9 +2585,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, ...@@ -2587,9 +2585,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
} }
snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *buf, snd_pcm_uframes_t size) snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, void __user *buf, snd_pcm_uframes_t size)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int nonblock; int nonblock;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2603,7 +2601,7 @@ snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user * ...@@ -2603,7 +2601,7 @@ snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *
nonblock = !!(substream->ffile->f_flags & O_NONBLOCK); nonblock = !!(substream->ffile->f_flags & O_NONBLOCK);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
if (substream->oss.oss) { if (substream->oss.oss) {
snd_pcm_oss_setup_t *setup = substream->oss.setup; struct snd_pcm_oss_setup *setup = substream->oss.setup;
if (setup != NULL) { if (setup != NULL) {
if (setup->nonblock) if (setup->nonblock)
nonblock = 1; nonblock = 1;
...@@ -2617,12 +2615,12 @@ snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user * ...@@ -2617,12 +2615,12 @@ snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *
return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer); return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer);
} }
static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream, static int snd_pcm_lib_readv_transfer(struct snd_pcm_substream *substream,
unsigned int hwoff, unsigned int hwoff,
unsigned long data, unsigned int off, unsigned long data, unsigned int off,
snd_pcm_uframes_t frames) snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
void __user **bufs = (void __user **)data; void __user **bufs = (void __user **)data;
int channels = runtime->channels; int channels = runtime->channels;
...@@ -2654,11 +2652,11 @@ static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream, ...@@ -2654,11 +2652,11 @@ static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream,
return 0; return 0;
} }
snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
void __user **bufs, void __user **bufs,
snd_pcm_uframes_t frames) snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int nonblock; int nonblock;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2672,7 +2670,7 @@ snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, ...@@ -2672,7 +2670,7 @@ snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream,
nonblock = !!(substream->ffile->f_flags & O_NONBLOCK); nonblock = !!(substream->ffile->f_flags & O_NONBLOCK);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
if (substream->oss.oss) { if (substream->oss.oss) {
snd_pcm_oss_setup_t *setup = substream->oss.setup; struct snd_pcm_oss_setup *setup = substream->oss.setup;
if (setup != NULL) { if (setup != NULL) {
if (setup->nonblock) if (setup->nonblock)
nonblock = 1; nonblock = 1;
......
...@@ -46,7 +46,7 @@ static const size_t snd_minimum_buffer = 16384; ...@@ -46,7 +46,7 @@ static const size_t snd_minimum_buffer = 16384;
* *
* the minimum size is snd_minimum_buffer. it should be power of 2. * the minimum size is snd_minimum_buffer. it should be power of 2.
*/ */
static int preallocate_pcm_pages(snd_pcm_substream_t *substream, size_t size) static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size)
{ {
struct snd_dma_buffer *dmab = &substream->dma_buffer; struct snd_dma_buffer *dmab = &substream->dma_buffer;
int err; int err;
...@@ -78,7 +78,7 @@ static int preallocate_pcm_pages(snd_pcm_substream_t *substream, size_t size) ...@@ -78,7 +78,7 @@ static int preallocate_pcm_pages(snd_pcm_substream_t *substream, size_t size)
/* /*
* release the preallocated buffer if not yet done. * release the preallocated buffer if not yet done.
*/ */
static void snd_pcm_lib_preallocate_dma_free(snd_pcm_substream_t *substream) static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream)
{ {
if (substream->dma_buffer.area == NULL) if (substream->dma_buffer.area == NULL)
return; return;
...@@ -97,7 +97,7 @@ static void snd_pcm_lib_preallocate_dma_free(snd_pcm_substream_t *substream) ...@@ -97,7 +97,7 @@ static void snd_pcm_lib_preallocate_dma_free(snd_pcm_substream_t *substream)
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream) int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
{ {
snd_pcm_lib_preallocate_dma_free(substream); snd_pcm_lib_preallocate_dma_free(substream);
if (substream->proc_prealloc_entry) { if (substream->proc_prealloc_entry) {
...@@ -115,9 +115,9 @@ int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream) ...@@ -115,9 +115,9 @@ int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream)
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm) int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm)
{ {
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
int stream; int stream;
for (stream = 0; stream < 2; stream++) for (stream = 0; stream < 2; stream++)
...@@ -131,10 +131,10 @@ int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm) ...@@ -131,10 +131,10 @@ int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm)
* *
* prints the current allocated size in kB. * prints the current allocated size in kB.
*/ */
static void snd_pcm_lib_preallocate_proc_read(snd_info_entry_t *entry, static void snd_pcm_lib_preallocate_proc_read(struct snd_info_entry *entry,
snd_info_buffer_t *buffer) struct snd_info_buffer *buffer)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; struct snd_pcm_substream *substream = entry->private_data;
snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024); snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024);
} }
...@@ -143,10 +143,10 @@ static void snd_pcm_lib_preallocate_proc_read(snd_info_entry_t *entry, ...@@ -143,10 +143,10 @@ static void snd_pcm_lib_preallocate_proc_read(snd_info_entry_t *entry,
* *
* accepts the preallocation size in kB. * accepts the preallocation size in kB.
*/ */
static void snd_pcm_lib_preallocate_proc_write(snd_info_entry_t *entry, static void snd_pcm_lib_preallocate_proc_write(struct snd_info_entry *entry,
snd_info_buffer_t *buffer) struct snd_info_buffer *buffer)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data; struct snd_pcm_substream *substream = entry->private_data;
char line[64], str[64]; char line[64], str[64];
size_t size; size_t size;
struct snd_dma_buffer new_dmab; struct snd_dma_buffer new_dmab;
...@@ -188,10 +188,10 @@ static void snd_pcm_lib_preallocate_proc_write(snd_info_entry_t *entry, ...@@ -188,10 +188,10 @@ static void snd_pcm_lib_preallocate_proc_write(snd_info_entry_t *entry,
/* /*
* pre-allocate the buffer and create a proc file for the substream * pre-allocate the buffer and create a proc file for the substream
*/ */
static int snd_pcm_lib_preallocate_pages1(snd_pcm_substream_t *substream, static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream,
size_t size, size_t max) size_t size, size_t max)
{ {
snd_info_entry_t *entry; struct snd_info_entry *entry;
if (size > 0 && preallocate_dma && substream->number < maximum_substreams) if (size > 0 && preallocate_dma && substream->number < maximum_substreams)
preallocate_pcm_pages(substream, size); preallocate_pcm_pages(substream, size);
...@@ -233,7 +233,7 @@ static int snd_pcm_lib_preallocate_pages1(snd_pcm_substream_t *substream, ...@@ -233,7 +233,7 @@ static int snd_pcm_lib_preallocate_pages1(snd_pcm_substream_t *substream,
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data, int type, struct device *data,
size_t size, size_t max) size_t size, size_t max)
{ {
...@@ -255,11 +255,11 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, ...@@ -255,11 +255,11 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream,
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
int type, void *data, int type, void *data,
size_t size, size_t max) size_t size, size_t max)
{ {
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
int stream, err; int stream, err;
for (stream = 0; stream < 2; stream++) for (stream = 0; stream < 2; stream++)
...@@ -277,7 +277,7 @@ int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, ...@@ -277,7 +277,7 @@ int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm,
* Returns the page struct at the given buffer offset. * Returns the page struct at the given buffer offset.
* Used as the page callback of PCM ops. * Used as the page callback of PCM ops.
*/ */
struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset) struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset)
{ {
struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
...@@ -298,9 +298,9 @@ struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned lon ...@@ -298,9 +298,9 @@ struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned lon
* Returns 1 if the buffer is changed, 0 if not changed, or a negative * Returns 1 if the buffer is changed, 0 if not changed, or a negative
* code on failure. * code on failure.
*/ */
int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
struct snd_dma_buffer *dmab = NULL; struct snd_dma_buffer *dmab = NULL;
snd_assert(substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_UNKNOWN, return -EINVAL); snd_assert(substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_UNKNOWN, return -EINVAL);
...@@ -318,7 +318,8 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) ...@@ -318,7 +318,8 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
} }
snd_pcm_lib_free_pages(substream); snd_pcm_lib_free_pages(substream);
} }
if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { if (substream->dma_buffer.area != NULL &&
substream->dma_buffer.bytes >= size) {
dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
} else { } else {
dmab = kzalloc(sizeof(*dmab), GFP_KERNEL); dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
...@@ -345,9 +346,9 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) ...@@ -345,9 +346,9 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
* *
* Returns zero if successful, or a negative error code on failure. * Returns zero if successful, or a negative error code on failure.
*/ */
int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream) int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_assert(substream != NULL, return -EINVAL); snd_assert(substream != NULL, return -EINVAL);
runtime = substream->runtime; runtime = substream->runtime;
......
...@@ -441,7 +441,7 @@ snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_end ...@@ -441,7 +441,7 @@ snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_end
* *
* Returns zero if successful. * Returns zero if successful.
*/ */
int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime) int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime)
{ {
static unsigned rates[] = { static unsigned rates[] = {
/* ATTENTION: these values depend on the definition in pcm.h! */ /* ATTENTION: these values depend on the definition in pcm.h! */
......
...@@ -39,11 +39,11 @@ ...@@ -39,11 +39,11 @@
* Compatibility * Compatibility
*/ */
struct sndrv_pcm_hw_params_old { struct snd_pcm_hw_params_old {
unsigned int flags; unsigned int flags;
unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT - unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT -
SNDRV_PCM_HW_PARAM_ACCESS + 1]; SNDRV_PCM_HW_PARAM_ACCESS + 1];
struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME - struct snd_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME -
SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1]; SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1];
unsigned int rmask; unsigned int rmask;
unsigned int cmask; unsigned int cmask;
...@@ -51,15 +51,17 @@ struct sndrv_pcm_hw_params_old { ...@@ -51,15 +51,17 @@ struct sndrv_pcm_hw_params_old {
unsigned int msbits; unsigned int msbits;
unsigned int rate_num; unsigned int rate_num;
unsigned int rate_den; unsigned int rate_den;
sndrv_pcm_uframes_t fifo_size; snd_pcm_uframes_t fifo_size;
unsigned char reserved[64]; unsigned char reserved[64];
}; };
#define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old) #define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct snd_pcm_hw_params_old)
#define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old) #define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct snd_pcm_hw_params_old)
static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams); struct snd_pcm_hw_params_old __user * _oparams);
static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params_old __user * _oparams);
/* /*
* *
...@@ -83,11 +85,11 @@ static inline void snd_leave_user(mm_segment_t fs) ...@@ -83,11 +85,11 @@ static inline void snd_leave_user(mm_segment_t fs)
int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info) int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info)
{ {
snd_pcm_runtime_t * runtime; struct snd_pcm_runtime *runtime;
snd_pcm_t *pcm = substream->pcm; struct snd_pcm *pcm = substream->pcm;
snd_pcm_str_t *pstr = substream->pstr; struct snd_pcm_str *pstr = substream->pstr;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
...@@ -111,9 +113,10 @@ int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info) ...@@ -111,9 +113,10 @@ int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info)
return 0; return 0;
} }
int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * _info) int snd_pcm_info_user(struct snd_pcm_substream *substream,
struct snd_pcm_info __user * _info)
{ {
snd_pcm_info_t *info; struct snd_pcm_info *info;
int err; int err;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
...@@ -151,14 +154,14 @@ char *snd_pcm_hw_param_names[] = { ...@@ -151,14 +154,14 @@ char *snd_pcm_hw_param_names[] = {
}; };
#endif #endif
int snd_pcm_hw_refine(snd_pcm_substream_t *substream, int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
snd_pcm_hw_params_t *params) struct snd_pcm_hw_params *params)
{ {
unsigned int k; unsigned int k;
snd_pcm_hardware_t *hw; struct snd_pcm_hardware *hw;
snd_interval_t *i = NULL; struct snd_interval *i = NULL;
snd_mask_t *m = NULL; struct snd_mask *m = NULL;
snd_pcm_hw_constraints_t *constrs = &substream->runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &substream->runtime->hw_constraints;
unsigned int rstamps[constrs->rules_num]; unsigned int rstamps[constrs->rules_num];
unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1]; unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1];
unsigned int stamp = 2; unsigned int stamp = 2;
...@@ -231,7 +234,7 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream, ...@@ -231,7 +234,7 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream,
do { do {
again = 0; again = 0;
for (k = 0; k < constrs->rules_num; k++) { for (k = 0; k < constrs->rules_num; k++) {
snd_pcm_hw_rule_t *r = &constrs->rules[k]; struct snd_pcm_hw_rule *r = &constrs->rules[k];
unsigned int d; unsigned int d;
int doit = 0; int doit = 0;
if (r->cond && !(r->cond & params->flags)) if (r->cond && !(r->cond & params->flags))
...@@ -313,9 +316,10 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream, ...@@ -313,9 +316,10 @@ int snd_pcm_hw_refine(snd_pcm_substream_t *substream,
return 0; return 0;
} }
static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params __user * _params)
{ {
snd_pcm_hw_params_t *params; struct snd_pcm_hw_params *params;
int err; int err;
params = kmalloc(sizeof(*params), GFP_KERNEL); params = kmalloc(sizeof(*params), GFP_KERNEL);
...@@ -337,10 +341,10 @@ static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_pa ...@@ -337,10 +341,10 @@ static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_pa
return err; return err;
} }
static int snd_pcm_hw_params(snd_pcm_substream_t *substream, static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
snd_pcm_hw_params_t *params) struct snd_pcm_hw_params *params)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int err; int err;
unsigned int bits; unsigned int bits;
snd_pcm_uframes_t frames; snd_pcm_uframes_t frames;
...@@ -432,9 +436,10 @@ static int snd_pcm_hw_params(snd_pcm_substream_t *substream, ...@@ -432,9 +436,10 @@ static int snd_pcm_hw_params(snd_pcm_substream_t *substream,
return err; return err;
} }
static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params) static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params __user * _params)
{ {
snd_pcm_hw_params_t *params; struct snd_pcm_hw_params *params;
int err; int err;
params = kmalloc(sizeof(*params), GFP_KERNEL); params = kmalloc(sizeof(*params), GFP_KERNEL);
...@@ -456,9 +461,9 @@ static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_pa ...@@ -456,9 +461,9 @@ static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_pa
return err; return err;
} }
static int snd_pcm_hw_free(snd_pcm_substream_t * substream) static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int result = 0; int result = 0;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -482,9 +487,10 @@ static int snd_pcm_hw_free(snd_pcm_substream_t * substream) ...@@ -482,9 +487,10 @@ static int snd_pcm_hw_free(snd_pcm_substream_t * substream)
return result; return result;
} }
static int snd_pcm_sw_params(snd_pcm_substream_t * substream, snd_pcm_sw_params_t *params) static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
struct snd_pcm_sw_params *params)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
runtime = substream->runtime; runtime = substream->runtime;
...@@ -537,9 +543,10 @@ static int snd_pcm_sw_params(snd_pcm_substream_t * substream, snd_pcm_sw_params_ ...@@ -537,9 +543,10 @@ static int snd_pcm_sw_params(snd_pcm_substream_t * substream, snd_pcm_sw_params_
return 0; return 0;
} }
static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t __user * _params) static int snd_pcm_sw_params_user(struct snd_pcm_substream *substream,
struct snd_pcm_sw_params __user * _params)
{ {
snd_pcm_sw_params_t params; struct snd_pcm_sw_params params;
int err; int err;
if (copy_from_user(&params, _params, sizeof(params))) if (copy_from_user(&params, _params, sizeof(params)))
return -EFAULT; return -EFAULT;
...@@ -549,10 +556,10 @@ static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_pa ...@@ -549,10 +556,10 @@ static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_pa
return err; return err;
} }
int snd_pcm_status(snd_pcm_substream_t *substream, int snd_pcm_status(struct snd_pcm_substream *substream,
snd_pcm_status_t *status) struct snd_pcm_status *status)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
status->state = runtime->status->state; status->state = runtime->status->state;
...@@ -593,10 +600,11 @@ int snd_pcm_status(snd_pcm_substream_t *substream, ...@@ -593,10 +600,11 @@ int snd_pcm_status(snd_pcm_substream_t *substream,
return 0; return 0;
} }
static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t __user * _status) static int snd_pcm_status_user(struct snd_pcm_substream *substream,
struct snd_pcm_status __user * _status)
{ {
snd_pcm_status_t status; struct snd_pcm_status status;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int res; int res;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -610,9 +618,10 @@ static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t ...@@ -610,9 +618,10 @@ static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t
return 0; return 0;
} }
static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * info) static int snd_pcm_channel_info(struct snd_pcm_substream *substream,
struct snd_pcm_channel_info * info)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
unsigned int channel; unsigned int channel;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -631,9 +640,10 @@ static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel ...@@ -631,9 +640,10 @@ static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel
return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info); return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info);
} }
static int snd_pcm_channel_info_user(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info) static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
struct snd_pcm_channel_info __user * _info)
{ {
snd_pcm_channel_info_t info; struct snd_pcm_channel_info info;
int res; int res;
if (copy_from_user(&info, _info, sizeof(info))) if (copy_from_user(&info, _info, sizeof(info)))
...@@ -646,9 +656,9 @@ static int snd_pcm_channel_info_user(snd_pcm_substream_t * substream, snd_pcm_ch ...@@ -646,9 +656,9 @@ static int snd_pcm_channel_info_user(snd_pcm_substream_t * substream, snd_pcm_ch
return 0; return 0;
} }
static void snd_pcm_trigger_tstamp(snd_pcm_substream_t *substream) static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->trigger_master == NULL) if (runtime->trigger_master == NULL)
return; return;
if (runtime->trigger_master == substream) { if (runtime->trigger_master == substream) {
...@@ -661,10 +671,10 @@ static void snd_pcm_trigger_tstamp(snd_pcm_substream_t *substream) ...@@ -661,10 +671,10 @@ static void snd_pcm_trigger_tstamp(snd_pcm_substream_t *substream)
} }
struct action_ops { struct action_ops {
int (*pre_action)(snd_pcm_substream_t *substream, int state); int (*pre_action)(struct snd_pcm_substream *substream, int state);
int (*do_action)(snd_pcm_substream_t *substream, int state); int (*do_action)(struct snd_pcm_substream *substream, int state);
void (*undo_action)(snd_pcm_substream_t *substream, int state); void (*undo_action)(struct snd_pcm_substream *substream, int state);
void (*post_action)(snd_pcm_substream_t *substream, int state); void (*post_action)(struct snd_pcm_substream *substream, int state);
}; };
/* /*
...@@ -673,12 +683,12 @@ struct action_ops { ...@@ -673,12 +683,12 @@ struct action_ops {
* Note2: call with calling stream lock + link lock * Note2: call with calling stream lock + link lock
*/ */
static int snd_pcm_action_group(struct action_ops *ops, static int snd_pcm_action_group(struct action_ops *ops,
snd_pcm_substream_t *substream, struct snd_pcm_substream *substream,
int state, int do_lock) int state, int do_lock)
{ {
struct list_head *pos; struct list_head *pos;
snd_pcm_substream_t *s = NULL; struct snd_pcm_substream *s = NULL;
snd_pcm_substream_t *s1; struct snd_pcm_substream *s1;
int res = 0; int res = 0;
snd_pcm_group_for_each(pos, substream) { snd_pcm_group_for_each(pos, substream) {
...@@ -727,7 +737,7 @@ static int snd_pcm_action_group(struct action_ops *ops, ...@@ -727,7 +737,7 @@ static int snd_pcm_action_group(struct action_ops *ops,
* Note: call with stream lock * Note: call with stream lock
*/ */
static int snd_pcm_action_single(struct action_ops *ops, static int snd_pcm_action_single(struct action_ops *ops,
snd_pcm_substream_t *substream, struct snd_pcm_substream *substream,
int state) int state)
{ {
int res; int res;
...@@ -747,7 +757,7 @@ static int snd_pcm_action_single(struct action_ops *ops, ...@@ -747,7 +757,7 @@ static int snd_pcm_action_single(struct action_ops *ops,
* Note: call with stream lock * Note: call with stream lock
*/ */
static int snd_pcm_action(struct action_ops *ops, static int snd_pcm_action(struct action_ops *ops,
snd_pcm_substream_t *substream, struct snd_pcm_substream *substream,
int state) int state)
{ {
int res; int res;
...@@ -770,7 +780,7 @@ static int snd_pcm_action(struct action_ops *ops, ...@@ -770,7 +780,7 @@ static int snd_pcm_action(struct action_ops *ops,
* Note: don't use any locks before * Note: don't use any locks before
*/ */
static int snd_pcm_action_lock_irq(struct action_ops *ops, static int snd_pcm_action_lock_irq(struct action_ops *ops,
snd_pcm_substream_t *substream, struct snd_pcm_substream *substream,
int state) int state)
{ {
int res; int res;
...@@ -794,7 +804,7 @@ static int snd_pcm_action_lock_irq(struct action_ops *ops, ...@@ -794,7 +804,7 @@ static int snd_pcm_action_lock_irq(struct action_ops *ops,
/* /*
*/ */
static int snd_pcm_action_nonatomic(struct action_ops *ops, static int snd_pcm_action_nonatomic(struct action_ops *ops,
snd_pcm_substream_t *substream, struct snd_pcm_substream *substream,
int state) int state)
{ {
int res; int res;
...@@ -811,9 +821,9 @@ static int snd_pcm_action_nonatomic(struct action_ops *ops, ...@@ -811,9 +821,9 @@ static int snd_pcm_action_nonatomic(struct action_ops *ops,
/* /*
* start callbacks * start callbacks
*/ */
static int snd_pcm_pre_start(snd_pcm_substream_t *substream, int state) static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) if (runtime->status->state != SNDRV_PCM_STATE_PREPARED)
return -EBADFD; return -EBADFD;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
...@@ -823,22 +833,22 @@ static int snd_pcm_pre_start(snd_pcm_substream_t *substream, int state) ...@@ -823,22 +833,22 @@ static int snd_pcm_pre_start(snd_pcm_substream_t *substream, int state)
return 0; return 0;
} }
static int snd_pcm_do_start(snd_pcm_substream_t *substream, int state) static int snd_pcm_do_start(struct snd_pcm_substream *substream, int state)
{ {
if (substream->runtime->trigger_master != substream) if (substream->runtime->trigger_master != substream)
return 0; return 0;
return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START); return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START);
} }
static void snd_pcm_undo_start(snd_pcm_substream_t *substream, int state) static void snd_pcm_undo_start(struct snd_pcm_substream *substream, int state)
{ {
if (substream->runtime->trigger_master == substream) if (substream->runtime->trigger_master == substream)
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP);
} }
static void snd_pcm_post_start(snd_pcm_substream_t *substream, int state) static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_trigger_tstamp(substream); snd_pcm_trigger_tstamp(substream);
runtime->status->state = state; runtime->status->state = state;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
...@@ -847,7 +857,8 @@ static void snd_pcm_post_start(snd_pcm_substream_t *substream, int state) ...@@ -847,7 +857,8 @@ static void snd_pcm_post_start(snd_pcm_substream_t *substream, int state)
if (runtime->sleep_min) if (runtime->sleep_min)
snd_pcm_tick_prepare(substream); snd_pcm_tick_prepare(substream);
if (substream->timer) if (substream->timer)
snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, &runtime->trigger_tstamp); snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART,
&runtime->trigger_tstamp);
} }
static struct action_ops snd_pcm_action_start = { static struct action_ops snd_pcm_action_start = {
...@@ -863,24 +874,25 @@ static struct action_ops snd_pcm_action_start = { ...@@ -863,24 +874,25 @@ static struct action_ops snd_pcm_action_start = {
* *
* Start all linked streams. * Start all linked streams.
*/ */
int snd_pcm_start(snd_pcm_substream_t *substream) int snd_pcm_start(struct snd_pcm_substream *substream)
{ {
return snd_pcm_action(&snd_pcm_action_start, substream, SNDRV_PCM_STATE_RUNNING); return snd_pcm_action(&snd_pcm_action_start, substream,
SNDRV_PCM_STATE_RUNNING);
} }
/* /*
* stop callbacks * stop callbacks
*/ */
static int snd_pcm_pre_stop(snd_pcm_substream_t *substream, int state) static int snd_pcm_pre_stop(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN) if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD; return -EBADFD;
runtime->trigger_master = substream; runtime->trigger_master = substream;
return 0; return 0;
} }
static int snd_pcm_do_stop(snd_pcm_substream_t *substream, int state) static int snd_pcm_do_stop(struct snd_pcm_substream *substream, int state)
{ {
if (substream->runtime->trigger_master == substream && if (substream->runtime->trigger_master == substream &&
snd_pcm_running(substream)) snd_pcm_running(substream))
...@@ -888,13 +900,14 @@ static int snd_pcm_do_stop(snd_pcm_substream_t *substream, int state) ...@@ -888,13 +900,14 @@ static int snd_pcm_do_stop(snd_pcm_substream_t *substream, int state)
return 0; /* unconditonally stop all substreams */ return 0; /* unconditonally stop all substreams */
} }
static void snd_pcm_post_stop(snd_pcm_substream_t *substream, int state) static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->status->state != state) { if (runtime->status->state != state) {
snd_pcm_trigger_tstamp(substream); snd_pcm_trigger_tstamp(substream);
if (substream->timer) if (substream->timer)
snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, &runtime->trigger_tstamp); snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP,
&runtime->trigger_tstamp);
runtime->status->state = state; runtime->status->state = state;
snd_pcm_tick_set(substream, 0); snd_pcm_tick_set(substream, 0);
} }
...@@ -915,7 +928,7 @@ static struct action_ops snd_pcm_action_stop = { ...@@ -915,7 +928,7 @@ static struct action_ops snd_pcm_action_stop = {
* Try to stop all running streams in the substream group. * Try to stop all running streams in the substream group.
* The state of each stream is changed to the given value after that unconditionally. * The state of each stream is changed to the given value after that unconditionally.
*/ */
int snd_pcm_stop(snd_pcm_substream_t *substream, int state) int snd_pcm_stop(struct snd_pcm_substream *substream, int state)
{ {
return snd_pcm_action(&snd_pcm_action_stop, substream, state); return snd_pcm_action(&snd_pcm_action_stop, substream, state);
} }
...@@ -928,17 +941,18 @@ int snd_pcm_stop(snd_pcm_substream_t *substream, int state) ...@@ -928,17 +941,18 @@ int snd_pcm_stop(snd_pcm_substream_t *substream, int state)
* The state is changed to SETUP. * The state is changed to SETUP.
* Unlike snd_pcm_stop(), this affects only the given stream. * Unlike snd_pcm_stop(), this affects only the given stream.
*/ */
int snd_pcm_drain_done(snd_pcm_substream_t *substream) int snd_pcm_drain_done(struct snd_pcm_substream *substream)
{ {
return snd_pcm_action_single(&snd_pcm_action_stop, substream, SNDRV_PCM_STATE_SETUP); return snd_pcm_action_single(&snd_pcm_action_stop, substream,
SNDRV_PCM_STATE_SETUP);
} }
/* /*
* pause callbacks * pause callbacks
*/ */
static int snd_pcm_pre_pause(snd_pcm_substream_t *substream, int push) static int snd_pcm_pre_pause(struct snd_pcm_substream *substream, int push)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) if (!(runtime->info & SNDRV_PCM_INFO_PAUSE))
return -ENOSYS; return -ENOSYS;
if (push) { if (push) {
...@@ -950,7 +964,7 @@ static int snd_pcm_pre_pause(snd_pcm_substream_t *substream, int push) ...@@ -950,7 +964,7 @@ static int snd_pcm_pre_pause(snd_pcm_substream_t *substream, int push)
return 0; return 0;
} }
static int snd_pcm_do_pause(snd_pcm_substream_t *substream, int push) static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push)
{ {
if (substream->runtime->trigger_master != substream) if (substream->runtime->trigger_master != substream)
return 0; return 0;
...@@ -959,7 +973,7 @@ static int snd_pcm_do_pause(snd_pcm_substream_t *substream, int push) ...@@ -959,7 +973,7 @@ static int snd_pcm_do_pause(snd_pcm_substream_t *substream, int push)
SNDRV_PCM_TRIGGER_PAUSE_RELEASE); SNDRV_PCM_TRIGGER_PAUSE_RELEASE);
} }
static void snd_pcm_undo_pause(snd_pcm_substream_t *substream, int push) static void snd_pcm_undo_pause(struct snd_pcm_substream *substream, int push)
{ {
if (substream->runtime->trigger_master == substream) if (substream->runtime->trigger_master == substream)
substream->ops->trigger(substream, substream->ops->trigger(substream,
...@@ -967,14 +981,16 @@ static void snd_pcm_undo_pause(snd_pcm_substream_t *substream, int push) ...@@ -967,14 +981,16 @@ static void snd_pcm_undo_pause(snd_pcm_substream_t *substream, int push)
SNDRV_PCM_TRIGGER_PAUSE_PUSH); SNDRV_PCM_TRIGGER_PAUSE_PUSH);
} }
static void snd_pcm_post_pause(snd_pcm_substream_t *substream, int push) static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_trigger_tstamp(substream); snd_pcm_trigger_tstamp(substream);
if (push) { if (push) {
runtime->status->state = SNDRV_PCM_STATE_PAUSED; runtime->status->state = SNDRV_PCM_STATE_PAUSED;
if (substream->timer) if (substream->timer)
snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); snd_timer_notify(substream->timer,
SNDRV_TIMER_EVENT_MPAUSE,
&runtime->trigger_tstamp);
snd_pcm_tick_set(substream, 0); snd_pcm_tick_set(substream, 0);
wake_up(&runtime->sleep); wake_up(&runtime->sleep);
} else { } else {
...@@ -982,7 +998,9 @@ static void snd_pcm_post_pause(snd_pcm_substream_t *substream, int push) ...@@ -982,7 +998,9 @@ static void snd_pcm_post_pause(snd_pcm_substream_t *substream, int push)
if (runtime->sleep_min) if (runtime->sleep_min)
snd_pcm_tick_prepare(substream); snd_pcm_tick_prepare(substream);
if (substream->timer) if (substream->timer)
snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, &runtime->trigger_tstamp); snd_timer_notify(substream->timer,
SNDRV_TIMER_EVENT_MCONTINUE,
&runtime->trigger_tstamp);
} }
} }
...@@ -996,7 +1014,7 @@ static struct action_ops snd_pcm_action_pause = { ...@@ -996,7 +1014,7 @@ static struct action_ops snd_pcm_action_pause = {
/* /*
* Push/release the pause for all linked streams. * Push/release the pause for all linked streams.
*/ */
static int snd_pcm_pause(snd_pcm_substream_t *substream, int push) static int snd_pcm_pause(struct snd_pcm_substream *substream, int push)
{ {
return snd_pcm_action(&snd_pcm_action_pause, substream, push); return snd_pcm_action(&snd_pcm_action_pause, substream, push);
} }
...@@ -1004,18 +1022,18 @@ static int snd_pcm_pause(snd_pcm_substream_t *substream, int push) ...@@ -1004,18 +1022,18 @@ static int snd_pcm_pause(snd_pcm_substream_t *substream, int push)
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* suspend */ /* suspend */
static int snd_pcm_pre_suspend(snd_pcm_substream_t *substream, int state) static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
return -EBUSY; return -EBUSY;
runtime->trigger_master = substream; runtime->trigger_master = substream;
return 0; return 0;
} }
static int snd_pcm_do_suspend(snd_pcm_substream_t *substream, int state) static int snd_pcm_do_suspend(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->trigger_master != substream) if (runtime->trigger_master != substream)
return 0; return 0;
if (! snd_pcm_running(substream)) if (! snd_pcm_running(substream))
...@@ -1024,12 +1042,13 @@ static int snd_pcm_do_suspend(snd_pcm_substream_t *substream, int state) ...@@ -1024,12 +1042,13 @@ static int snd_pcm_do_suspend(snd_pcm_substream_t *substream, int state)
return 0; /* suspend unconditionally */ return 0; /* suspend unconditionally */
} }
static void snd_pcm_post_suspend(snd_pcm_substream_t *substream, int state) static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_trigger_tstamp(substream); snd_pcm_trigger_tstamp(substream);
if (substream->timer) if (substream->timer)
snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, &runtime->trigger_tstamp); snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND,
&runtime->trigger_tstamp);
runtime->status->suspended_state = runtime->status->state; runtime->status->suspended_state = runtime->status->state;
runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; runtime->status->state = SNDRV_PCM_STATE_SUSPENDED;
snd_pcm_tick_set(substream, 0); snd_pcm_tick_set(substream, 0);
...@@ -1049,7 +1068,7 @@ static struct action_ops snd_pcm_action_suspend = { ...@@ -1049,7 +1068,7 @@ static struct action_ops snd_pcm_action_suspend = {
* Trigger SUSPEND to all linked streams. * Trigger SUSPEND to all linked streams.
* After this call, all streams are changed to SUSPENDED state. * After this call, all streams are changed to SUSPENDED state.
*/ */
int snd_pcm_suspend(snd_pcm_substream_t *substream) int snd_pcm_suspend(struct snd_pcm_substream *substream)
{ {
int err; int err;
unsigned long flags; unsigned long flags;
...@@ -1067,13 +1086,14 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream) ...@@ -1067,13 +1086,14 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream)
* Trigger SUSPEND to all substreams in the given pcm. * Trigger SUSPEND to all substreams in the given pcm.
* After this call, all streams are changed to SUSPENDED state. * After this call, all streams are changed to SUSPENDED state.
*/ */
int snd_pcm_suspend_all(snd_pcm_t *pcm) int snd_pcm_suspend_all(struct snd_pcm *pcm)
{ {
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
int stream, err = 0; int stream, err = 0;
for (stream = 0; stream < 2; stream++) { for (stream = 0; stream < 2; stream++) {
for (substream = pcm->streams[stream].substream; substream; substream = substream->next) { for (substream = pcm->streams[stream].substream;
substream; substream = substream->next) {
/* FIXME: the open/close code should lock this as well */ /* FIXME: the open/close code should lock this as well */
if (substream->runtime == NULL) if (substream->runtime == NULL)
continue; continue;
...@@ -1087,18 +1107,18 @@ int snd_pcm_suspend_all(snd_pcm_t *pcm) ...@@ -1087,18 +1107,18 @@ int snd_pcm_suspend_all(snd_pcm_t *pcm)
/* resume */ /* resume */
static int snd_pcm_pre_resume(snd_pcm_substream_t *substream, int state) static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) if (!(runtime->info & SNDRV_PCM_INFO_RESUME))
return -ENOSYS; return -ENOSYS;
runtime->trigger_master = substream; runtime->trigger_master = substream;
return 0; return 0;
} }
static int snd_pcm_do_resume(snd_pcm_substream_t *substream, int state) static int snd_pcm_do_resume(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->trigger_master != substream) if (runtime->trigger_master != substream)
return 0; return 0;
/* DMA not running previously? */ /* DMA not running previously? */
...@@ -1109,19 +1129,20 @@ static int snd_pcm_do_resume(snd_pcm_substream_t *substream, int state) ...@@ -1109,19 +1129,20 @@ static int snd_pcm_do_resume(snd_pcm_substream_t *substream, int state)
return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME); return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME);
} }
static void snd_pcm_undo_resume(snd_pcm_substream_t *substream, int state) static void snd_pcm_undo_resume(struct snd_pcm_substream *substream, int state)
{ {
if (substream->runtime->trigger_master == substream && if (substream->runtime->trigger_master == substream &&
snd_pcm_running(substream)) snd_pcm_running(substream))
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND);
} }
static void snd_pcm_post_resume(snd_pcm_substream_t *substream, int state) static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_trigger_tstamp(substream); snd_pcm_trigger_tstamp(substream);
if (substream->timer) if (substream->timer)
snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME,
&runtime->trigger_tstamp);
runtime->status->state = runtime->status->suspended_state; runtime->status->state = runtime->status->suspended_state;
if (runtime->sleep_min) if (runtime->sleep_min)
snd_pcm_tick_prepare(substream); snd_pcm_tick_prepare(substream);
...@@ -1134,9 +1155,9 @@ static struct action_ops snd_pcm_action_resume = { ...@@ -1134,9 +1155,9 @@ static struct action_ops snd_pcm_action_resume = {
.post_action = snd_pcm_post_resume .post_action = snd_pcm_post_resume
}; };
static int snd_pcm_resume(snd_pcm_substream_t *substream) static int snd_pcm_resume(struct snd_pcm_substream *substream)
{ {
snd_card_t *card = substream->pcm->card; struct snd_card *card = substream->pcm->card;
int res; int res;
snd_power_lock(card); snd_power_lock(card);
...@@ -1148,7 +1169,7 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream) ...@@ -1148,7 +1169,7 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream)
#else #else
static int snd_pcm_resume(snd_pcm_substream_t *substream) static int snd_pcm_resume(struct snd_pcm_substream *substream)
{ {
return -ENOSYS; return -ENOSYS;
} }
...@@ -1160,10 +1181,10 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream) ...@@ -1160,10 +1181,10 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream)
* *
* Change the RUNNING stream(s) to XRUN state. * Change the RUNNING stream(s) to XRUN state.
*/ */
static int snd_pcm_xrun(snd_pcm_substream_t *substream) static int snd_pcm_xrun(struct snd_pcm_substream *substream)
{ {
snd_card_t *card = substream->pcm->card; struct snd_card *card = substream->pcm->card;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int result; int result;
snd_power_lock(card); snd_power_lock(card);
...@@ -1193,9 +1214,9 @@ static int snd_pcm_xrun(snd_pcm_substream_t *substream) ...@@ -1193,9 +1214,9 @@ static int snd_pcm_xrun(snd_pcm_substream_t *substream)
/* /*
* reset ioctl * reset ioctl
*/ */
static int snd_pcm_pre_reset(snd_pcm_substream_t * substream, int state) static int snd_pcm_pre_reset(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
switch (runtime->status->state) { switch (runtime->status->state) {
case SNDRV_PCM_STATE_RUNNING: case SNDRV_PCM_STATE_RUNNING:
case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_PREPARED:
...@@ -1207,23 +1228,24 @@ static int snd_pcm_pre_reset(snd_pcm_substream_t * substream, int state) ...@@ -1207,23 +1228,24 @@ static int snd_pcm_pre_reset(snd_pcm_substream_t * substream, int state)
} }
} }
static int snd_pcm_do_reset(snd_pcm_substream_t * substream, int state) static int snd_pcm_do_reset(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL); int err = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL);
if (err < 0) if (err < 0)
return err; return err;
// snd_assert(runtime->status->hw_ptr < runtime->buffer_size, ); // snd_assert(runtime->status->hw_ptr < runtime->buffer_size, );
runtime->hw_ptr_base = 0; runtime->hw_ptr_base = 0;
runtime->hw_ptr_interrupt = runtime->status->hw_ptr - runtime->status->hw_ptr % runtime->period_size; runtime->hw_ptr_interrupt = runtime->status->hw_ptr -
runtime->status->hw_ptr % runtime->period_size;
runtime->silence_start = runtime->status->hw_ptr; runtime->silence_start = runtime->status->hw_ptr;
runtime->silence_filled = 0; runtime->silence_filled = 0;
return 0; return 0;
} }
static void snd_pcm_post_reset(snd_pcm_substream_t * substream, int state) static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
runtime->control->appl_ptr = runtime->status->hw_ptr; runtime->control->appl_ptr = runtime->status->hw_ptr;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
runtime->silence_size > 0) runtime->silence_size > 0)
...@@ -1236,7 +1258,7 @@ static struct action_ops snd_pcm_action_reset = { ...@@ -1236,7 +1258,7 @@ static struct action_ops snd_pcm_action_reset = {
.post_action = snd_pcm_post_reset .post_action = snd_pcm_post_reset
}; };
static int snd_pcm_reset(snd_pcm_substream_t *substream) static int snd_pcm_reset(struct snd_pcm_substream *substream)
{ {
return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0); return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0);
} }
...@@ -1244,9 +1266,9 @@ static int snd_pcm_reset(snd_pcm_substream_t *substream) ...@@ -1244,9 +1266,9 @@ static int snd_pcm_reset(snd_pcm_substream_t *substream)
/* /*
* prepare ioctl * prepare ioctl
*/ */
static int snd_pcm_pre_prepare(snd_pcm_substream_t * substream, int state) static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN) if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD; return -EBADFD;
if (snd_pcm_running(substream)) if (snd_pcm_running(substream))
...@@ -1254,7 +1276,7 @@ static int snd_pcm_pre_prepare(snd_pcm_substream_t * substream, int state) ...@@ -1254,7 +1276,7 @@ static int snd_pcm_pre_prepare(snd_pcm_substream_t * substream, int state)
return 0; return 0;
} }
static int snd_pcm_do_prepare(snd_pcm_substream_t * substream, int state) static int snd_pcm_do_prepare(struct snd_pcm_substream *substream, int state)
{ {
int err; int err;
err = substream->ops->prepare(substream); err = substream->ops->prepare(substream);
...@@ -1263,9 +1285,9 @@ static int snd_pcm_do_prepare(snd_pcm_substream_t * substream, int state) ...@@ -1263,9 +1285,9 @@ static int snd_pcm_do_prepare(snd_pcm_substream_t * substream, int state)
return snd_pcm_do_reset(substream, 0); return snd_pcm_do_reset(substream, 0);
} }
static void snd_pcm_post_prepare(snd_pcm_substream_t * substream, int state) static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
runtime->control->appl_ptr = runtime->status->hw_ptr; runtime->control->appl_ptr = runtime->status->hw_ptr;
runtime->status->state = SNDRV_PCM_STATE_PREPARED; runtime->status->state = SNDRV_PCM_STATE_PREPARED;
} }
...@@ -1282,10 +1304,10 @@ static struct action_ops snd_pcm_action_prepare = { ...@@ -1282,10 +1304,10 @@ static struct action_ops snd_pcm_action_prepare = {
* *
* Prepare the PCM substream to be triggerable. * Prepare the PCM substream to be triggerable.
*/ */
int snd_pcm_prepare(snd_pcm_substream_t *substream) int snd_pcm_prepare(struct snd_pcm_substream *substream)
{ {
int res; int res;
snd_card_t *card = substream->pcm->card; struct snd_card *card = substream->pcm->card;
snd_power_lock(card); snd_power_lock(card);
if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0) if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0)
...@@ -1298,7 +1320,7 @@ int snd_pcm_prepare(snd_pcm_substream_t *substream) ...@@ -1298,7 +1320,7 @@ int snd_pcm_prepare(snd_pcm_substream_t *substream)
* drain ioctl * drain ioctl
*/ */
static int snd_pcm_pre_drain_init(snd_pcm_substream_t * substream, int state) static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, int state)
{ {
if (substream->ffile->f_flags & O_NONBLOCK) if (substream->ffile->f_flags & O_NONBLOCK)
return -EAGAIN; return -EAGAIN;
...@@ -1306,9 +1328,9 @@ static int snd_pcm_pre_drain_init(snd_pcm_substream_t * substream, int state) ...@@ -1306,9 +1328,9 @@ static int snd_pcm_pre_drain_init(snd_pcm_substream_t * substream, int state)
return 0; return 0;
} }
static int snd_pcm_do_drain_init(snd_pcm_substream_t * substream, int state) static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
switch (runtime->status->state) { switch (runtime->status->state) {
case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_PREPARED:
...@@ -1336,7 +1358,7 @@ static int snd_pcm_do_drain_init(snd_pcm_substream_t * substream, int state) ...@@ -1336,7 +1358,7 @@ static int snd_pcm_do_drain_init(snd_pcm_substream_t * substream, int state)
return 0; return 0;
} }
static void snd_pcm_post_drain_init(snd_pcm_substream_t * substream, int state) static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int state)
{ {
} }
...@@ -1347,12 +1369,12 @@ static struct action_ops snd_pcm_action_drain_init = { ...@@ -1347,12 +1369,12 @@ static struct action_ops snd_pcm_action_drain_init = {
}; };
struct drain_rec { struct drain_rec {
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
wait_queue_t wait; wait_queue_t wait;
snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t stop_threshold;
}; };
static int snd_pcm_drop(snd_pcm_substream_t *substream); static int snd_pcm_drop(struct snd_pcm_substream *substream);
/* /*
* Drain the stream(s). * Drain the stream(s).
...@@ -1361,10 +1383,10 @@ static int snd_pcm_drop(snd_pcm_substream_t *substream); ...@@ -1361,10 +1383,10 @@ static int snd_pcm_drop(snd_pcm_substream_t *substream);
* After this call, all streams are supposed to be either SETUP or DRAINING * After this call, all streams are supposed to be either SETUP or DRAINING
* (capture only) state. * (capture only) state.
*/ */
static int snd_pcm_drain(snd_pcm_substream_t *substream) static int snd_pcm_drain(struct snd_pcm_substream *substream)
{ {
snd_card_t *card; struct snd_card *card;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
struct list_head *pos; struct list_head *pos;
int result = 0; int result = 0;
int i, num_drecs; int i, num_drecs;
...@@ -1401,7 +1423,7 @@ static int snd_pcm_drain(snd_pcm_substream_t *substream) ...@@ -1401,7 +1423,7 @@ static int snd_pcm_drain(snd_pcm_substream_t *substream)
/* count only playback streams */ /* count only playback streams */
num_drecs = 0; num_drecs = 0;
snd_pcm_group_for_each(pos, substream) { snd_pcm_group_for_each(pos, substream) {
snd_pcm_substream_t *s = snd_pcm_group_substream_entry(pos); struct snd_pcm_substream *s = snd_pcm_group_substream_entry(pos);
runtime = s->runtime; runtime = s->runtime;
if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
d = &drec[num_drecs++]; d = &drec[num_drecs++];
...@@ -1487,10 +1509,10 @@ static int snd_pcm_drain(snd_pcm_substream_t *substream) ...@@ -1487,10 +1509,10 @@ static int snd_pcm_drain(snd_pcm_substream_t *substream)
* *
* Immediately put all linked substreams into SETUP state. * Immediately put all linked substreams into SETUP state.
*/ */
static int snd_pcm_drop(snd_pcm_substream_t *substream) static int snd_pcm_drop(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_card_t *card; struct snd_card *card;
int result = 0; int result = 0;
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -1548,12 +1570,12 @@ static struct file *snd_pcm_file_fd(int fd) ...@@ -1548,12 +1570,12 @@ static struct file *snd_pcm_file_fd(int fd)
/* /*
* PCM link handling * PCM link handling
*/ */
static int snd_pcm_link(snd_pcm_substream_t *substream, int fd) static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
{ {
int res = 0; int res = 0;
struct file *file; struct file *file;
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream1; struct snd_pcm_substream *substream1;
file = snd_pcm_file_fd(fd); file = snd_pcm_file_fd(fd);
if (!file) if (!file)
...@@ -1572,7 +1594,7 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd) ...@@ -1572,7 +1594,7 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd)
goto _end; goto _end;
} }
if (!snd_pcm_stream_linked(substream)) { if (!snd_pcm_stream_linked(substream)) {
substream->group = kmalloc(sizeof(snd_pcm_group_t), GFP_ATOMIC); substream->group = kmalloc(sizeof(struct snd_pcm_group), GFP_ATOMIC);
if (substream->group == NULL) { if (substream->group == NULL) {
res = -ENOMEM; res = -ENOMEM;
goto _end; goto _end;
...@@ -1592,14 +1614,14 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd) ...@@ -1592,14 +1614,14 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd)
return res; return res;
} }
static void relink_to_local(snd_pcm_substream_t *substream) static void relink_to_local(struct snd_pcm_substream *substream)
{ {
substream->group = &substream->self_group; substream->group = &substream->self_group;
INIT_LIST_HEAD(&substream->self_group.substreams); INIT_LIST_HEAD(&substream->self_group.substreams);
list_add_tail(&substream->link_list, &substream->self_group.substreams); list_add_tail(&substream->link_list, &substream->self_group.substreams);
} }
static int snd_pcm_unlink(snd_pcm_substream_t *substream) static int snd_pcm_unlink(struct snd_pcm_substream *substream)
{ {
struct list_head *pos; struct list_head *pos;
int res = 0; int res = 0;
...@@ -1629,51 +1651,51 @@ static int snd_pcm_unlink(snd_pcm_substream_t *substream) ...@@ -1629,51 +1651,51 @@ static int snd_pcm_unlink(snd_pcm_substream_t *substream)
/* /*
* hw configurator * hw configurator
*/ */
static int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_mul(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_interval_t t; struct snd_interval t;
snd_interval_mul(hw_param_interval_c(params, rule->deps[0]), snd_interval_mul(hw_param_interval_c(params, rule->deps[0]),
hw_param_interval_c(params, rule->deps[1]), &t); hw_param_interval_c(params, rule->deps[1]), &t);
return snd_interval_refine(hw_param_interval(params, rule->var), &t); return snd_interval_refine(hw_param_interval(params, rule->var), &t);
} }
static int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_div(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_interval_t t; struct snd_interval t;
snd_interval_div(hw_param_interval_c(params, rule->deps[0]), snd_interval_div(hw_param_interval_c(params, rule->deps[0]),
hw_param_interval_c(params, rule->deps[1]), &t); hw_param_interval_c(params, rule->deps[1]), &t);
return snd_interval_refine(hw_param_interval(params, rule->var), &t); return snd_interval_refine(hw_param_interval(params, rule->var), &t);
} }
static int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_muldivk(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_interval_t t; struct snd_interval t;
snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]), snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]),
hw_param_interval_c(params, rule->deps[1]), hw_param_interval_c(params, rule->deps[1]),
(unsigned long) rule->private, &t); (unsigned long) rule->private, &t);
return snd_interval_refine(hw_param_interval(params, rule->var), &t); return snd_interval_refine(hw_param_interval(params, rule->var), &t);
} }
static int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_mulkdiv(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_interval_t t; struct snd_interval t;
snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]), snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]),
(unsigned long) rule->private, (unsigned long) rule->private,
hw_param_interval_c(params, rule->deps[1]), &t); hw_param_interval_c(params, rule->deps[1]), &t);
return snd_interval_refine(hw_param_interval(params, rule->var), &t); return snd_interval_refine(hw_param_interval(params, rule->var), &t);
} }
static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
unsigned int k; unsigned int k;
snd_interval_t *i = hw_param_interval(params, rule->deps[0]); struct snd_interval *i = hw_param_interval(params, rule->deps[0]);
snd_mask_t m; struct snd_mask m;
snd_mask_t *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); struct snd_mask *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
snd_mask_any(&m); snd_mask_any(&m);
for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) { for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) {
int bits; int bits;
...@@ -1688,10 +1710,10 @@ static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params, ...@@ -1688,10 +1710,10 @@ static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
return snd_mask_refine(mask, &m); return snd_mask_refine(mask, &m);
} }
static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_interval_t t; struct snd_interval t;
unsigned int k; unsigned int k;
t.min = UINT_MAX; t.min = UINT_MAX;
t.max = 0; t.max = 0;
...@@ -1720,19 +1742,19 @@ static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params, ...@@ -1720,19 +1742,19 @@ static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params,
static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100,
48000, 64000, 88200, 96000, 176400, 192000 }; 48000, 64000, 88200, 96000, 176400, 192000 };
static int snd_pcm_hw_rule_rate(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_pcm_hardware_t *hw = rule->private; struct snd_pcm_hardware *hw = rule->private;
return snd_interval_list(hw_param_interval(params, rule->var), return snd_interval_list(hw_param_interval(params, rule->var),
ARRAY_SIZE(rates), rates, hw->rates); ARRAY_SIZE(rates), rates, hw->rates);
} }
static int snd_pcm_hw_rule_buffer_bytes_max(snd_pcm_hw_params_t *params, static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
snd_pcm_hw_rule_t *rule) struct snd_pcm_hw_rule *rule)
{ {
snd_interval_t t; struct snd_interval t;
snd_pcm_substream_t *substream = rule->private; struct snd_pcm_substream *substream = rule->private;
t.min = 0; t.min = 0;
t.max = substream->buffer_bytes_max; t.max = substream->buffer_bytes_max;
t.openmin = 0; t.openmin = 0;
...@@ -1741,10 +1763,10 @@ static int snd_pcm_hw_rule_buffer_bytes_max(snd_pcm_hw_params_t *params, ...@@ -1741,10 +1763,10 @@ static int snd_pcm_hw_rule_buffer_bytes_max(snd_pcm_hw_params_t *params,
return snd_interval_refine(hw_param_interval(params, rule->var), &t); return snd_interval_refine(hw_param_interval(params, rule->var), &t);
} }
int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream) int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_hw_constraints_t *constrs = &runtime->hw_constraints; struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
int k, err; int k, err;
for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) { for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) {
...@@ -1865,10 +1887,10 @@ int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream) ...@@ -1865,10 +1887,10 @@ int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream)
return 0; return 0;
} }
int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream) int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_hardware_t *hw = &runtime->hw; struct snd_pcm_hardware *hw = &runtime->hw;
int err; int err;
unsigned int mask = 0; unsigned int mask = 0;
...@@ -1941,17 +1963,17 @@ int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream) ...@@ -1941,17 +1963,17 @@ int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream)
return 0; return 0;
} }
static void snd_pcm_add_file(snd_pcm_str_t *str, static void snd_pcm_add_file(struct snd_pcm_str *str,
snd_pcm_file_t *pcm_file) struct snd_pcm_file *pcm_file)
{ {
pcm_file->next = str->files; pcm_file->next = str->files;
str->files = pcm_file; str->files = pcm_file;
} }
static void snd_pcm_remove_file(snd_pcm_str_t *str, static void snd_pcm_remove_file(struct snd_pcm_str *str,
snd_pcm_file_t *pcm_file) struct snd_pcm_file *pcm_file)
{ {
snd_pcm_file_t * pcm_file1; struct snd_pcm_file * pcm_file1;
if (str->files == pcm_file) { if (str->files == pcm_file) {
str->files = pcm_file->next; str->files = pcm_file->next;
} else { } else {
...@@ -1963,11 +1985,11 @@ static void snd_pcm_remove_file(snd_pcm_str_t *str, ...@@ -1963,11 +1985,11 @@ static void snd_pcm_remove_file(snd_pcm_str_t *str,
} }
} }
static int snd_pcm_release_file(snd_pcm_file_t * pcm_file) static int snd_pcm_release_file(struct snd_pcm_file * pcm_file)
{ {
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_pcm_str_t * str; struct snd_pcm_str * str;
snd_assert(pcm_file != NULL, return -ENXIO); snd_assert(pcm_file != NULL, return -ENXIO);
substream = pcm_file->substream; substream = pcm_file->substream;
...@@ -1988,14 +2010,14 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file) ...@@ -1988,14 +2010,14 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file)
} }
static int snd_pcm_open_file(struct file *file, static int snd_pcm_open_file(struct file *file,
snd_pcm_t *pcm, struct snd_pcm *pcm,
int stream, int stream,
snd_pcm_file_t **rpcm_file) struct snd_pcm_file **rpcm_file)
{ {
int err = 0; int err = 0;
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_str_t *str; struct snd_pcm_str *str;
snd_assert(rpcm_file != NULL, return -EINVAL); snd_assert(rpcm_file != NULL, return -EINVAL);
*rpcm_file = NULL; *rpcm_file = NULL;
...@@ -2048,8 +2070,8 @@ static int snd_pcm_open(struct inode *inode, struct file *file) ...@@ -2048,8 +2070,8 @@ static int snd_pcm_open(struct inode *inode, struct file *file)
int cardnum = SNDRV_MINOR_CARD(iminor(inode)); int cardnum = SNDRV_MINOR_CARD(iminor(inode));
int device = SNDRV_MINOR_DEVICE(iminor(inode)); int device = SNDRV_MINOR_DEVICE(iminor(inode));
int err; int err;
snd_pcm_t *pcm; struct snd_pcm *pcm;
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
wait_queue_t wait; wait_queue_t wait;
if (device < SNDRV_MINOR_PCM_PLAYBACK || device >= SNDRV_MINOR_DEVICES) if (device < SNDRV_MINOR_PCM_PLAYBACK || device >= SNDRV_MINOR_DEVICES)
...@@ -2105,9 +2127,9 @@ static int snd_pcm_open(struct inode *inode, struct file *file) ...@@ -2105,9 +2127,9 @@ static int snd_pcm_open(struct inode *inode, struct file *file)
static int snd_pcm_release(struct inode *inode, struct file *file) static int snd_pcm_release(struct inode *inode, struct file *file)
{ {
snd_pcm_t *pcm; struct snd_pcm *pcm;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
pcm_file = file->private_data; pcm_file = file->private_data;
substream = pcm_file->substream; substream = pcm_file->substream;
...@@ -2125,9 +2147,10 @@ static int snd_pcm_release(struct inode *inode, struct file *file) ...@@ -2125,9 +2147,10 @@ static int snd_pcm_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static snd_pcm_sframes_t snd_pcm_playback_rewind(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *substream,
snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t appl_ptr; snd_pcm_sframes_t appl_ptr;
snd_pcm_sframes_t ret; snd_pcm_sframes_t ret;
snd_pcm_sframes_t hw_avail; snd_pcm_sframes_t hw_avail;
...@@ -2174,9 +2197,10 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(snd_pcm_substream_t *substream, ...@@ -2174,9 +2197,10 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(snd_pcm_substream_t *substream,
return ret; return ret;
} }
static snd_pcm_sframes_t snd_pcm_capture_rewind(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substream,
snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t appl_ptr; snd_pcm_sframes_t appl_ptr;
snd_pcm_sframes_t ret; snd_pcm_sframes_t ret;
snd_pcm_sframes_t hw_avail; snd_pcm_sframes_t hw_avail;
...@@ -2223,9 +2247,10 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(snd_pcm_substream_t *substream, ...@@ -2223,9 +2247,10 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(snd_pcm_substream_t *substream,
return ret; return ret;
} }
static snd_pcm_sframes_t snd_pcm_playback_forward(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *substream,
snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t appl_ptr; snd_pcm_sframes_t appl_ptr;
snd_pcm_sframes_t ret; snd_pcm_sframes_t ret;
snd_pcm_sframes_t avail; snd_pcm_sframes_t avail;
...@@ -2273,9 +2298,10 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(snd_pcm_substream_t *substream ...@@ -2273,9 +2298,10 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(snd_pcm_substream_t *substream
return ret; return ret;
} }
static snd_pcm_sframes_t snd_pcm_capture_forward(snd_pcm_substream_t *substream, snd_pcm_uframes_t frames) static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *substream,
snd_pcm_uframes_t frames)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t appl_ptr; snd_pcm_sframes_t appl_ptr;
snd_pcm_sframes_t ret; snd_pcm_sframes_t ret;
snd_pcm_sframes_t avail; snd_pcm_sframes_t avail;
...@@ -2323,9 +2349,9 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(snd_pcm_substream_t *substream, ...@@ -2323,9 +2349,9 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(snd_pcm_substream_t *substream,
return ret; return ret;
} }
static int snd_pcm_hwsync(snd_pcm_substream_t *substream) static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
...@@ -2353,9 +2379,10 @@ static int snd_pcm_hwsync(snd_pcm_substream_t *substream) ...@@ -2353,9 +2379,10 @@ static int snd_pcm_hwsync(snd_pcm_substream_t *substream)
return err; return err;
} }
static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __user *res) static int snd_pcm_delay(struct snd_pcm_substream *substream,
snd_pcm_sframes_t __user *res)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int err; int err;
snd_pcm_sframes_t n = 0; snd_pcm_sframes_t n = 0;
...@@ -2391,18 +2418,19 @@ static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __use ...@@ -2391,18 +2418,19 @@ static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __use
return err; return err;
} }
static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr __user *_sync_ptr) static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,
struct snd_pcm_sync_ptr __user *_sync_ptr)
{ {
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct sndrv_pcm_sync_ptr sync_ptr; struct snd_pcm_sync_ptr sync_ptr;
volatile struct sndrv_pcm_mmap_status *status; volatile struct snd_pcm_mmap_status *status;
volatile struct sndrv_pcm_mmap_control *control; volatile struct snd_pcm_mmap_control *control;
int err; int err;
memset(&sync_ptr, 0, sizeof(sync_ptr)); memset(&sync_ptr, 0, sizeof(sync_ptr));
if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags)))
return -EFAULT; return -EFAULT;
if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct sndrv_pcm_mmap_control))) if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control)))
return -EFAULT; return -EFAULT;
status = runtime->status; status = runtime->status;
control = runtime->control; control = runtime->control;
...@@ -2430,12 +2458,12 @@ static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_syn ...@@ -2430,12 +2458,12 @@ static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_syn
return 0; return 0;
} }
static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, static int snd_pcm_playback_ioctl1(struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg); unsigned int cmd, void __user *arg);
static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, static int snd_pcm_capture_ioctl1(struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg); unsigned int cmd, void __user *arg);
static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, static int snd_pcm_common_ioctl1(struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg) unsigned int cmd, void __user *arg)
{ {
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2492,7 +2520,7 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, ...@@ -2492,7 +2520,7 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream,
return -ENOTTY; return -ENOTTY;
} }
static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, static int snd_pcm_playback_ioctl1(struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg) unsigned int cmd, void __user *arg)
{ {
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2500,9 +2528,9 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, ...@@ -2500,9 +2528,9 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
switch (cmd) { switch (cmd) {
case SNDRV_PCM_IOCTL_WRITEI_FRAMES: case SNDRV_PCM_IOCTL_WRITEI_FRAMES:
{ {
snd_xferi_t xferi; struct snd_xferi xferi;
snd_xferi_t __user *_xferi = arg; struct snd_xferi __user *_xferi = arg;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN) if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD; return -EBADFD;
...@@ -2516,9 +2544,9 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, ...@@ -2516,9 +2544,9 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
} }
case SNDRV_PCM_IOCTL_WRITEN_FRAMES: case SNDRV_PCM_IOCTL_WRITEN_FRAMES:
{ {
snd_xfern_t xfern; struct snd_xfern xfern;
snd_xfern_t __user *_xfern = arg; struct snd_xfern __user *_xfern = arg;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
void __user **bufs; void __user **bufs;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN) if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
...@@ -2579,7 +2607,7 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, ...@@ -2579,7 +2607,7 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
return snd_pcm_common_ioctl1(substream, cmd, arg); return snd_pcm_common_ioctl1(substream, cmd, arg);
} }
static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, static int snd_pcm_capture_ioctl1(struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg) unsigned int cmd, void __user *arg)
{ {
snd_assert(substream != NULL, return -ENXIO); snd_assert(substream != NULL, return -ENXIO);
...@@ -2587,9 +2615,9 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, ...@@ -2587,9 +2615,9 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
switch (cmd) { switch (cmd) {
case SNDRV_PCM_IOCTL_READI_FRAMES: case SNDRV_PCM_IOCTL_READI_FRAMES:
{ {
snd_xferi_t xferi; struct snd_xferi xferi;
snd_xferi_t __user *_xferi = arg; struct snd_xferi __user *_xferi = arg;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN) if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD; return -EBADFD;
...@@ -2603,9 +2631,9 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, ...@@ -2603,9 +2631,9 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
} }
case SNDRV_PCM_IOCTL_READN_FRAMES: case SNDRV_PCM_IOCTL_READN_FRAMES:
{ {
snd_xfern_t xfern; struct snd_xfern xfern;
snd_xfern_t __user *_xfern = arg; struct snd_xfern __user *_xfern = arg;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
void *bufs; void *bufs;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN) if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
...@@ -2658,9 +2686,10 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, ...@@ -2658,9 +2686,10 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
return snd_pcm_common_ioctl1(substream, cmd, arg); return snd_pcm_common_ioctl1(substream, cmd, arg);
} }
static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
pcm_file = file->private_data; pcm_file = file->private_data;
...@@ -2670,9 +2699,10 @@ static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd, unsigned ...@@ -2670,9 +2699,10 @@ static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd, unsigned
return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg); return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
} }
static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
pcm_file = file->private_data; pcm_file = file->private_data;
...@@ -2682,7 +2712,7 @@ static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, unsigned ...@@ -2682,7 +2712,7 @@ static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, unsigned
return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg); return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
} }
int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
mm_segment_t fs; mm_segment_t fs;
...@@ -2694,7 +2724,7 @@ int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, ...@@ -2694,7 +2724,7 @@ int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream,
return result; return result;
} }
int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
mm_segment_t fs; mm_segment_t fs;
...@@ -2706,7 +2736,7 @@ int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, ...@@ -2706,7 +2736,7 @@ int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream,
return result; return result;
} }
int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
switch (substream->stream) { switch (substream->stream) {
...@@ -2719,11 +2749,12 @@ int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, ...@@ -2719,11 +2749,12 @@ int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream,
} }
} }
static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, loff_t * offset) static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count,
loff_t * offset)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
pcm_file = file->private_data; pcm_file = file->private_data;
...@@ -2741,11 +2772,12 @@ static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, l ...@@ -2741,11 +2772,12 @@ static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, l
return result; return result;
} }
static ssize_t snd_pcm_write(struct file *file, const char __user *buf, size_t count, loff_t * offset) static ssize_t snd_pcm_write(struct file *file, const char __user *buf,
size_t count, loff_t * offset)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
pcm_file = file->private_data; pcm_file = file->private_data;
...@@ -2772,9 +2804,9 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, ...@@ -2772,9 +2804,9 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
unsigned long count, loff_t * offset) unsigned long count, loff_t * offset)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
unsigned long i; unsigned long i;
void __user **bufs; void __user **bufs;
...@@ -2806,9 +2838,9 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, ...@@ -2806,9 +2838,9 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
unsigned long count, loff_t * offset) unsigned long count, loff_t * offset)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
unsigned long i; unsigned long i;
void __user **bufs; void __user **bufs;
...@@ -2843,9 +2875,9 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, ...@@ -2843,9 +2875,9 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
unsigned int mask; unsigned int mask;
snd_pcm_uframes_t avail; snd_pcm_uframes_t avail;
...@@ -2881,9 +2913,9 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) ...@@ -2881,9 +2913,9 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait) static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)
{ {
snd_pcm_file_t *pcm_file; struct snd_pcm_file *pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
unsigned int mask; unsigned int mask;
snd_pcm_uframes_t avail; snd_pcm_uframes_t avail;
...@@ -2933,10 +2965,11 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait) ...@@ -2933,10 +2965,11 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)
/* /*
* mmap status record * mmap status record
*/ */
static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area, unsigned long address, int *type) static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area,
unsigned long address, int *type)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; struct snd_pcm_substream *substream = area->vm_private_data;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
struct page * page; struct page * page;
if (substream == NULL) if (substream == NULL)
...@@ -2954,17 +2987,17 @@ static struct vm_operations_struct snd_pcm_vm_ops_status = ...@@ -2954,17 +2987,17 @@ static struct vm_operations_struct snd_pcm_vm_ops_status =
.nopage = snd_pcm_mmap_status_nopage, .nopage = snd_pcm_mmap_status_nopage,
}; };
static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file, static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file,
struct vm_area_struct *area) struct vm_area_struct *area)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
long size; long size;
if (!(area->vm_flags & VM_READ)) if (!(area->vm_flags & VM_READ))
return -EINVAL; return -EINVAL;
runtime = substream->runtime; runtime = substream->runtime;
snd_assert(runtime != NULL, return -EAGAIN); snd_assert(runtime != NULL, return -EAGAIN);
size = area->vm_end - area->vm_start; size = area->vm_end - area->vm_start;
if (size != PAGE_ALIGN(sizeof(snd_pcm_mmap_status_t))) if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)))
return -EINVAL; return -EINVAL;
area->vm_ops = &snd_pcm_vm_ops_status; area->vm_ops = &snd_pcm_vm_ops_status;
area->vm_private_data = substream; area->vm_private_data = substream;
...@@ -2975,10 +3008,11 @@ static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file ...@@ -2975,10 +3008,11 @@ static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file
/* /*
* mmap control record * mmap control record
*/ */
static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area, unsigned long address, int *type) static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area,
unsigned long address, int *type)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; struct snd_pcm_substream *substream = area->vm_private_data;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
struct page * page; struct page * page;
if (substream == NULL) if (substream == NULL)
...@@ -2996,17 +3030,17 @@ static struct vm_operations_struct snd_pcm_vm_ops_control = ...@@ -2996,17 +3030,17 @@ static struct vm_operations_struct snd_pcm_vm_ops_control =
.nopage = snd_pcm_mmap_control_nopage, .nopage = snd_pcm_mmap_control_nopage,
}; };
static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *file, static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file,
struct vm_area_struct *area) struct vm_area_struct *area)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
long size; long size;
if (!(area->vm_flags & VM_READ)) if (!(area->vm_flags & VM_READ))
return -EINVAL; return -EINVAL;
runtime = substream->runtime; runtime = substream->runtime;
snd_assert(runtime != NULL, return -EAGAIN); snd_assert(runtime != NULL, return -EAGAIN);
size = area->vm_end - area->vm_start; size = area->vm_end - area->vm_start;
if (size != PAGE_ALIGN(sizeof(snd_pcm_mmap_control_t))) if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)))
return -EINVAL; return -EINVAL;
area->vm_ops = &snd_pcm_vm_ops_control; area->vm_ops = &snd_pcm_vm_ops_control;
area->vm_private_data = substream; area->vm_private_data = substream;
...@@ -3017,12 +3051,12 @@ static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *fil ...@@ -3017,12 +3051,12 @@ static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *fil
/* /*
* don't support mmap for status and control records. * don't support mmap for status and control records.
*/ */
static int snd_pcm_mmap_status(snd_pcm_substream_t *substream, struct file *file, static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file,
struct vm_area_struct *area) struct vm_area_struct *area)
{ {
return -ENXIO; return -ENXIO;
} }
static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *file, static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file,
struct vm_area_struct *area) struct vm_area_struct *area)
{ {
return -ENXIO; return -ENXIO;
...@@ -3032,10 +3066,11 @@ static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *fil ...@@ -3032,10 +3066,11 @@ static int snd_pcm_mmap_control(snd_pcm_substream_t *substream, struct file *fil
/* /*
* nopage callback for mmapping a RAM page * nopage callback for mmapping a RAM page
*/ */
static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area, unsigned long address, int *type) static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
unsigned long address, int *type)
{ {
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; struct snd_pcm_substream *substream = area->vm_private_data;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
unsigned long offset; unsigned long offset;
struct page * page; struct page * page;
void *vaddr; void *vaddr;
...@@ -3074,7 +3109,8 @@ static struct vm_operations_struct snd_pcm_vm_ops_data = ...@@ -3074,7 +3109,8 @@ static struct vm_operations_struct snd_pcm_vm_ops_data =
/* /*
* mmap the DMA buffer on RAM * mmap the DMA buffer on RAM
*/ */
static int snd_pcm_default_mmap(snd_pcm_substream_t *substream, struct vm_area_struct *area) static int snd_pcm_default_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *area)
{ {
area->vm_ops = &snd_pcm_vm_ops_data; area->vm_ops = &snd_pcm_vm_ops_data;
area->vm_private_data = substream; area->vm_private_data = substream;
...@@ -3093,7 +3129,8 @@ static struct vm_operations_struct snd_pcm_vm_ops_data_mmio = ...@@ -3093,7 +3129,8 @@ static struct vm_operations_struct snd_pcm_vm_ops_data_mmio =
.close = snd_pcm_mmap_data_close, .close = snd_pcm_mmap_data_close,
}; };
int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area) int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
struct vm_area_struct *area)
{ {
long size; long size;
unsigned long offset; unsigned long offset;
...@@ -3118,10 +3155,10 @@ int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct ...@@ -3118,10 +3155,10 @@ int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct
/* /*
* mmap DMA buffer * mmap DMA buffer
*/ */
int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file,
struct vm_area_struct *area) struct vm_area_struct *area)
{ {
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
long size; long size;
unsigned long offset; unsigned long offset;
size_t dma_bytes; size_t dma_bytes;
...@@ -3158,8 +3195,8 @@ int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, ...@@ -3158,8 +3195,8 @@ int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file,
static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
{ {
snd_pcm_file_t * pcm_file; struct snd_pcm_file * pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
unsigned long offset; unsigned long offset;
pcm_file = file->private_data; pcm_file = file->private_data;
...@@ -3184,9 +3221,9 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) ...@@ -3184,9 +3221,9 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
static int snd_pcm_fasync(int fd, struct file * file, int on) static int snd_pcm_fasync(int fd, struct file * file, int on)
{ {
snd_pcm_file_t * pcm_file; struct snd_pcm_file * pcm_file;
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
snd_pcm_runtime_t *runtime; struct snd_pcm_runtime *runtime;
int err; int err;
pcm_file = file->private_data; pcm_file = file->private_data;
...@@ -3216,7 +3253,8 @@ static int snd_pcm_fasync(int fd, struct file * file, int on) ...@@ -3216,7 +3253,8 @@ static int snd_pcm_fasync(int fd, struct file * file, int on)
#define __OLD_TO_NEW_MASK(x) ((x&7)|((x&0x07fffff8)<<5)) #define __OLD_TO_NEW_MASK(x) ((x&7)|((x&0x07fffff8)<<5))
#define __NEW_TO_OLD_MASK(x) ((x&7)|((x&0xffffff00)>>5)) #define __NEW_TO_OLD_MASK(x) ((x&7)|((x&0xffffff00)>>5))
static void snd_pcm_hw_convert_from_old_params(snd_pcm_hw_params_t *params, struct sndrv_pcm_hw_params_old *oparams) static void snd_pcm_hw_convert_from_old_params(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_params_old *oparams)
{ {
unsigned int i; unsigned int i;
...@@ -3234,7 +3272,8 @@ static void snd_pcm_hw_convert_from_old_params(snd_pcm_hw_params_t *params, stru ...@@ -3234,7 +3272,8 @@ static void snd_pcm_hw_convert_from_old_params(snd_pcm_hw_params_t *params, stru
params->fifo_size = oparams->fifo_size; params->fifo_size = oparams->fifo_size;
} }
static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *oparams, snd_pcm_hw_params_t *params) static void snd_pcm_hw_convert_to_old_params(struct snd_pcm_hw_params_old *oparams,
struct snd_pcm_hw_params *params)
{ {
unsigned int i; unsigned int i;
...@@ -3252,10 +3291,11 @@ static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *opa ...@@ -3252,10 +3291,11 @@ static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *opa
oparams->fifo_size = params->fifo_size; oparams->fifo_size = params->fifo_size;
} }
static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params_old __user * _oparams)
{ {
snd_pcm_hw_params_t *params; struct snd_pcm_hw_params *params;
struct sndrv_pcm_hw_params_old *oparams = NULL; struct snd_pcm_hw_params_old *oparams = NULL;
int err; int err;
params = kmalloc(sizeof(*params), GFP_KERNEL); params = kmalloc(sizeof(*params), GFP_KERNEL);
...@@ -3286,10 +3326,11 @@ static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sn ...@@ -3286,10 +3326,11 @@ static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sn
return err; return err;
} }
static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams) static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params_old __user * _oparams)
{ {
snd_pcm_hw_params_t *params; struct snd_pcm_hw_params *params;
struct sndrv_pcm_hw_params_old *oparams = NULL; struct snd_pcm_hw_params_old *oparams = NULL;
int err; int err;
params = kmalloc(sizeof(*params), GFP_KERNEL); params = kmalloc(sizeof(*params), GFP_KERNEL);
...@@ -3349,7 +3390,7 @@ static struct file_operations snd_pcm_f_ops_capture = { ...@@ -3349,7 +3390,7 @@ static struct file_operations snd_pcm_f_ops_capture = {
.fasync = snd_pcm_fasync, .fasync = snd_pcm_fasync,
}; };
snd_minor_t snd_pcm_reg[2] = struct snd_minor snd_pcm_reg[2] =
{ {
{ {
.comment = "digital audio playback", .comment = "digital audio playback",
......
...@@ -45,10 +45,10 @@ static unsigned long gcd(unsigned long a, unsigned long b) ...@@ -45,10 +45,10 @@ static unsigned long gcd(unsigned long a, unsigned long b)
return b; return b;
} }
void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream) void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
{ {
unsigned long rate, mult, fsize, l, post; unsigned long rate, mult, fsize, l, post;
snd_pcm_runtime_t *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
mult = 1000000000; mult = 1000000000;
rate = runtime->rate; rate = runtime->rate;
...@@ -74,18 +74,18 @@ void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream) ...@@ -74,18 +74,18 @@ void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream)
runtime->timer_resolution = (mult * fsize / rate) * post; runtime->timer_resolution = (mult * fsize / rate) * post;
} }
static unsigned long snd_pcm_timer_resolution(snd_timer_t * timer) static unsigned long snd_pcm_timer_resolution(struct snd_timer * timer)
{ {
snd_pcm_substream_t * substream; struct snd_pcm_substream *substream;
substream = timer->private_data; substream = timer->private_data;
return substream->runtime ? substream->runtime->timer_resolution : 0; return substream->runtime ? substream->runtime->timer_resolution : 0;
} }
static int snd_pcm_timer_start(snd_timer_t * timer) static int snd_pcm_timer_start(struct snd_timer * timer)
{ {
unsigned long flags; unsigned long flags;
snd_pcm_substream_t * substream; struct snd_pcm_substream *substream;
substream = snd_timer_chip(timer); substream = snd_timer_chip(timer);
spin_lock_irqsave(&substream->timer_lock, flags); spin_lock_irqsave(&substream->timer_lock, flags);
...@@ -94,10 +94,10 @@ static int snd_pcm_timer_start(snd_timer_t * timer) ...@@ -94,10 +94,10 @@ static int snd_pcm_timer_start(snd_timer_t * timer)
return 0; return 0;
} }
static int snd_pcm_timer_stop(snd_timer_t * timer) static int snd_pcm_timer_stop(struct snd_timer * timer)
{ {
unsigned long flags; unsigned long flags;
snd_pcm_substream_t * substream; struct snd_pcm_substream *substream;
substream = snd_timer_chip(timer); substream = snd_timer_chip(timer);
spin_lock_irqsave(&substream->timer_lock, flags); spin_lock_irqsave(&substream->timer_lock, flags);
...@@ -106,7 +106,7 @@ static int snd_pcm_timer_stop(snd_timer_t * timer) ...@@ -106,7 +106,7 @@ static int snd_pcm_timer_stop(snd_timer_t * timer)
return 0; return 0;
} }
static struct _snd_timer_hardware snd_pcm_timer = static struct snd_timer_hardware snd_pcm_timer =
{ {
.flags = SNDRV_TIMER_HW_AUTO | SNDRV_TIMER_HW_SLAVE, .flags = SNDRV_TIMER_HW_AUTO | SNDRV_TIMER_HW_SLAVE,
.resolution = 0, .resolution = 0,
...@@ -120,16 +120,16 @@ static struct _snd_timer_hardware snd_pcm_timer = ...@@ -120,16 +120,16 @@ static struct _snd_timer_hardware snd_pcm_timer =
* Init functions * Init functions
*/ */
static void snd_pcm_timer_free(snd_timer_t *timer) static void snd_pcm_timer_free(struct snd_timer *timer)
{ {
snd_pcm_substream_t *substream = timer->private_data; struct snd_pcm_substream *substream = timer->private_data;
substream->timer = NULL; substream->timer = NULL;
} }
void snd_pcm_timer_init(snd_pcm_substream_t *substream) void snd_pcm_timer_init(struct snd_pcm_substream *substream)
{ {
snd_timer_id_t tid; struct snd_timer_id tid;
snd_timer_t *timer; struct snd_timer *timer;
tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
tid.dev_class = SNDRV_TIMER_CLASS_PCM; tid.dev_class = SNDRV_TIMER_CLASS_PCM;
...@@ -152,7 +152,7 @@ void snd_pcm_timer_init(snd_pcm_substream_t *substream) ...@@ -152,7 +152,7 @@ void snd_pcm_timer_init(snd_pcm_substream_t *substream)
substream->timer = timer; substream->timer = timer;
} }
void snd_pcm_timer_done(snd_pcm_substream_t *substream) void snd_pcm_timer_done(struct snd_pcm_substream *substream)
{ {
if (substream->timer) { if (substream->timer) {
snd_device_free(substream->pcm->card, substream->timer); snd_device_free(substream->pcm->card, substream->timer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册