nfsd: track last inode only in use_wgather case
[safe/jmp/linux-2.6] / include / sound / pcm.h
index 5315b53..c172968 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <sound/asound.h>
 #include <sound/memalloc.h>
+#include <sound/minors.h>
 #include <linux/poll.h>
 #include <linux/mm.h>
 #include <linux/bitops.h>
@@ -84,7 +85,11 @@ struct snd_pcm_ops {
  *
  */
 
-#define SNDRV_PCM_DEVICES              8
+#if defined(CONFIG_SND_DYNAMIC_MINORS)
+#define SNDRV_PCM_DEVICES      (SNDRV_OS_MINORS-2)
+#else
+#define SNDRV_PCM_DEVICES      8
+#endif
 
 #define SNDRV_PCM_IOCTL1_FALSE         ((void *)0)
 #define SNDRV_PCM_IOCTL1_TRUE          ((void *)1)
@@ -209,10 +214,10 @@ struct snd_pcm_hw_rule {
 };
 
 struct snd_pcm_hw_constraints {
-       struct snd_mask masks[
-               SNDRV_PCM_HW_PARAM_MASK_INDEX(SNDRV_PCM_HW_PARAM_LAST_MASK) + 1];
-       struct snd_interval intervals[
-               SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(SNDRV_PCM_HW_PARAM_LAST_INTERVAL) + 1];
+       struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 
+                        SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
+       struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
+                            SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
        unsigned int rules_num;
        unsigned int rules_all;
        struct snd_pcm_hw_rule *rules;
@@ -221,13 +226,13 @@ struct snd_pcm_hw_constraints {
 static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
                                            snd_pcm_hw_param_t var)
 {
-       return &constrs->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)];
+       return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
 }
 
 static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
                                                    snd_pcm_hw_param_t var)
 {
-       return &constrs->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)];
+       return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
 }
 
 struct snd_ratnum {
@@ -263,7 +268,8 @@ struct snd_pcm_runtime {
        int overrange;
        snd_pcm_uframes_t avail_max;
        snd_pcm_uframes_t hw_ptr_base;  /* Position at buffer restart */
-       snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/
+       snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
+       unsigned long hw_ptr_jiffies;   /* Time when hw_ptr is updated */
 
        /* -- HW params -- */
        snd_pcm_access_t access;        /* access mode */
@@ -359,7 +365,6 @@ struct snd_pcm_substream {
         /* -- timer section -- */
        struct snd_timer *timer;                /* timer */
        unsigned timer_running: 1;      /* time is running */
-       spinlock_t timer_lock;
        /* -- next substream -- */
        struct snd_pcm_substream *next;
        /* -- linked substreams -- */
@@ -416,7 +421,7 @@ struct snd_pcm_str {
 struct snd_pcm {
        struct snd_card *card;
        struct list_head list;
-       unsigned int device;    /* device number */
+       int device; /* device number */
        unsigned int info_flags;
        unsigned short dev_class;
        unsigned short dev_subclass;
@@ -446,7 +451,7 @@ struct snd_pcm_notify {
 
 extern const struct file_operations snd_pcm_f_ops[2];
 
-int snd_pcm_new(struct snd_card *card, char *id, int device,
+int snd_pcm_new(struct snd_card *card, const char *id, int device,
                int playback_count, int capture_count,
                struct snd_pcm **rpcm);
 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
@@ -761,40 +766,40 @@ static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
        substream->runtime->trigger_master = master;
 }
 
-static inline int hw_is_mask(snd_pcm_hw_param_t var)
+static inline int hw_is_mask(int var)
 {
-       return (__force int)var >= (__force int)SNDRV_PCM_HW_PARAM_FIRST_MASK &&
-               (__force int)var <= (__force int)SNDRV_PCM_HW_PARAM_LAST_MASK;
+       return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK &&
+               var <= SNDRV_PCM_HW_PARAM_LAST_MASK;
 }
 
-static inline int hw_is_interval(snd_pcm_hw_param_t var)
+static inline int hw_is_interval(int var)
 {
-       return (__force int)var >= (__force int)SNDRV_PCM_HW_PARAM_FIRST_INTERVAL &&
-               (__force int)var <= (__force int)SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
+       return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL &&
+               var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
 }
 
 static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
                                     snd_pcm_hw_param_t var)
 {
-       return &params->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)];
+       return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
 }
 
 static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
                                             snd_pcm_hw_param_t var)
 {
-       return &params->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)];
+       return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
 }
 
 static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
                                             snd_pcm_hw_param_t var)
 {
-       return &params->masks[SNDRV_PCM_HW_PARAM_MASK_INDEX(var)];
+       return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
 }
 
 static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
                                                     snd_pcm_hw_param_t var)
 {
-       return &params->intervals[SNDRV_PCM_HW_PARAM_INTERVAL_INDEX(var)];
+       return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
 }
 
 #define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))
@@ -969,10 +974,30 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
 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_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
-#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
-struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
+/*
+ * SG-buffer handling
+ */
+#define snd_pcm_substream_sgbuf(substream) \
+       ((substream)->runtime->dma_buffer_p->private_data)
+
+static inline dma_addr_t
+snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
+{
+       struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
+       return snd_sgbuf_get_addr(sg, ofs);
+}
+
+static inline void *
+snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
+{
+       struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
+       return snd_sgbuf_get_ptr(sg, ofs);
+}
+
+struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
+                                   unsigned long offset);
+unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
+                                         unsigned int ofs, unsigned int size);
 
 /* handle mmap counter - PCM mmap callback should handle this counter properly */
 static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
@@ -1010,4 +1035,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
                                         (IEC958_AES1_CON_PCM_CODER<<8)|\
                                         (IEC958_AES3_CON_FS_48000<<24))
 
+#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
+
 #endif /* __SOUND_PCM_H */