git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
sound
/
core
/
seq
/
seq_memory.c
diff --git
a/sound/core/seq/seq_memory.c
b/sound/core/seq/seq_memory.c
index
00d841e
..
a3dc5e0
100644
(file)
--- a/
sound/core/seq/seq_memory.c
+++ b/
sound/core/seq/seq_memory.c
@@
-32,16
+32,12
@@
#include "seq_info.h"
#include "seq_lock.h"
#include "seq_info.h"
#include "seq_lock.h"
-/* semaphore in struct file record */
-#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem)
-
-
-inline static int snd_seq_pool_available(pool_t *pool)
+static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
{
return pool->total_elements - atomic_read(&pool->counter);
}
{
return pool->total_elements - atomic_read(&pool->counter);
}
-
inline static int snd_seq_output_ok(pool_t
*pool)
+
static inline int snd_seq_output_ok(struct snd_seq_pool
*pool)
{
return snd_seq_pool_available(pool) >= pool->room;
}
{
return snd_seq_pool_available(pool) >= pool->room;
}
@@
-72,7
+68,7
@@
inline static int snd_seq_output_ok(pool_t *pool)
* call dump function to expand external data.
*/
* call dump function to expand external data.
*/
-static int get_var_len(const s
nd_seq_event_
t *event)
+static int get_var_len(const s
truct snd_seq_even
t *event)
{
if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
return -EINVAL;
{
if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
return -EINVAL;
@@
-80,10
+76,11
@@
static int get_var_len(const snd_seq_event_t *event)
return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
}
return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
}
-int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data)
+int snd_seq_dump_var_event(const struct snd_seq_event *event,
+ snd_seq_dump_func_t func, void *private_data)
{
int len, err;
{
int len, err;
- s
nd_seq_event_cell_t
*cell;
+ s
truct snd_seq_event_cell
*cell;
if ((len = get_var_len(event)) <= 0)
return len;
if ((len = get_var_len(event)) <= 0)
return len;
@@
-108,9
+105,9
@@
int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
return func(private_data, event->data.ext.ptr, len);
}
return func(private_data, event->data.ext.ptr, len);
}
- cell = (s
nd_seq_event_cell_t
*)event->data.ext.ptr;
+ cell = (s
truct snd_seq_event_cell
*)event->data.ext.ptr;
for (; len > 0 && cell; cell = cell->next) {
for (; len > 0 && cell; cell = cell->next) {
- int size = sizeof(s
nd_seq_event_
t);
+ int size = sizeof(s
truct snd_seq_even
t);
if (len < size)
size = len;
err = func(private_data, &cell->event, size);
if (len < size)
size = len;
err = func(private_data, &cell->event, size);
@@
-121,6
+118,8
@@
int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
return 0;
}
return 0;
}
+EXPORT_SYMBOL(snd_seq_dump_var_event);
+
/*
* exported:
/*
* exported:
@@
-142,7
+141,8
@@
static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
return 0;
}
return 0;
}
-int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned)
+int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
+ int in_kernel, int size_aligned)
{
int len, newlen;
int err;
{
int len, newlen;
int err;
@@
-151,7
+151,7
@@
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
return len;
newlen = len;
if (size_aligned > 0)
return len;
newlen = len;
if (size_aligned > 0)
- newlen =
((len + size_aligned - 1) / size_aligned) * size_aligned
;
+ newlen =
roundup(len, size_aligned)
;
if (count < newlen)
return -EAGAIN;
if (count < newlen)
return -EAGAIN;
@@
-169,22
+169,24
@@
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
return err < 0 ? err : newlen;
}
return err < 0 ? err : newlen;
}
+EXPORT_SYMBOL(snd_seq_expand_var_event);
/*
* release this cell, free extended data if available
*/
/*
* release this cell, free extended data if available
*/
-static inline void free_cell(pool_t *pool, snd_seq_event_cell_t *cell)
+static inline void free_cell(struct snd_seq_pool *pool,
+ struct snd_seq_event_cell *cell)
{
cell->next = pool->free;
pool->free = cell;
atomic_dec(&pool->counter);
}
{
cell->next = pool->free;
pool->free = cell;
atomic_dec(&pool->counter);
}
-void snd_seq_cell_free(s
nd_seq_event_cell_t
* cell)
+void snd_seq_cell_free(s
truct snd_seq_event_cell
* cell)
{
unsigned long flags;
{
unsigned long flags;
-
pool_t
*pool;
+
struct snd_seq_pool
*pool;
snd_assert(cell != NULL, return);
pool = cell->pool;
snd_assert(cell != NULL, return);
pool = cell->pool;
@@
-194,7
+196,7
@@
void snd_seq_cell_free(snd_seq_event_cell_t * cell)
free_cell(pool, cell);
if (snd_seq_ev_is_variable(&cell->event)) {
if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) {
free_cell(pool, cell);
if (snd_seq_ev_is_variable(&cell->event)) {
if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) {
- s
nd_seq_event_cell_t
*curp, *nextptr;
+ s
truct snd_seq_event_cell
*curp, *nextptr;
curp = cell->event.data.ext.ptr;
for (; curp; curp = nextptr) {
nextptr = curp->next;
curp = cell->event.data.ext.ptr;
for (; curp; curp = nextptr) {
nextptr = curp->next;
@@
-215,9
+217,11
@@
void snd_seq_cell_free(snd_seq_event_cell_t * cell)
/*
* allocate an event cell.
*/
/*
* allocate an event cell.
*/
-static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int nonblock, struct file *file)
+static int snd_seq_cell_alloc(struct snd_seq_pool *pool,
+ struct snd_seq_event_cell **cellp,
+ int nonblock, struct file *file)
{
{
- s
nd_seq_event_cell_t
*cell;
+ s
truct snd_seq_event_cell
*cell;
unsigned long flags;
int err = -EAGAIN;
wait_queue_t wait;
unsigned long flags;
int err = -EAGAIN;
wait_queue_t wait;
@@
-280,11
+284,13
@@
__error:
* if the event has external data, the data is decomposed to additional
* cells.
*/
* if the event has external data, the data is decomposed to additional
* cells.
*/
-int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t **cellp, int nonblock, struct file *file)
+int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
+ struct snd_seq_event_cell **cellp, int nonblock,
+ struct file *file)
{
int ncells, err;
unsigned int extlen;
{
int ncells, err;
unsigned int extlen;
- s
nd_seq_event_cell_t
*cell;
+ s
truct snd_seq_event_cell
*cell;
*cellp = NULL;
*cellp = NULL;
@@
-292,7
+298,7
@@
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
extlen = 0;
if (snd_seq_ev_is_variable(event)) {
extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
extlen = 0;
if (snd_seq_ev_is_variable(event)) {
extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
- ncells = (extlen + sizeof(s
nd_seq_event_t) - 1) / sizeof(snd_seq_event_
t);
+ ncells = (extlen + sizeof(s
truct snd_seq_event) - 1) / sizeof(struct snd_seq_even
t);
}
if (ncells >= pool->total_elements)
return -ENOMEM;
}
if (ncells >= pool->total_elements)
return -ENOMEM;
@@
-309,18
+315,18
@@
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
int len = extlen;
int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED;
int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR;
int len = extlen;
int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED;
int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR;
- s
nd_seq_event_cell_t
*src, *tmp, *tail;
+ s
truct snd_seq_event_cell
*src, *tmp, *tail;
char *buf;
cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED;
cell->event.data.ext.ptr = NULL;
char *buf;
cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED;
cell->event.data.ext.ptr = NULL;
- src = (s
nd_seq_event_cell_t
*)event->data.ext.ptr;
+ src = (s
truct snd_seq_event_cell
*)event->data.ext.ptr;
buf = (char *)event->data.ext.ptr;
tail = NULL;
while (ncells-- > 0) {
buf = (char *)event->data.ext.ptr;
tail = NULL;
while (ncells-- > 0) {
- int size = sizeof(s
nd_seq_event_
t);
+ int size = sizeof(s
truct snd_seq_even
t);
if (len < size)
size = len;
err = snd_seq_cell_alloc(pool, &tmp, nonblock, file);
if (len < size)
size = len;
err = snd_seq_cell_alloc(pool, &tmp, nonblock, file);
@@
-358,7
+364,8
@@
__error:
/* poll wait */
/* poll wait */
-int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait)
+int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file,
+ poll_table *wait)
{
poll_wait(file, &pool->output_sleep, wait);
return snd_seq_output_ok(pool);
{
poll_wait(file, &pool->output_sleep, wait);
return snd_seq_output_ok(pool);
@@
-366,17
+373,17
@@
int snd_seq_pool_poll_wait(pool_t *pool, struct file *file, poll_table *wait)
/* allocate room specified number of events */
/* allocate room specified number of events */
-int snd_seq_pool_init(
pool_t
*pool)
+int snd_seq_pool_init(
struct snd_seq_pool
*pool)
{
int cell;
{
int cell;
- s
nd_seq_event_cell_t
*cellptr;
+ s
truct snd_seq_event_cell
*cellptr;
unsigned long flags;
snd_assert(pool != NULL, return -EINVAL);
if (pool->ptr) /* should be atomic? */
return 0;
unsigned long flags;
snd_assert(pool != NULL, return -EINVAL);
if (pool->ptr) /* should be atomic? */
return 0;
- pool->ptr = vmalloc(sizeof(s
nd_seq_event_cell_t
) * pool->size);
+ pool->ptr = vmalloc(sizeof(s
truct snd_seq_event_cell
) * pool->size);
if (pool->ptr == NULL) {
snd_printd("seq: malloc for sequencer events failed\n");
return -ENOMEM;
if (pool->ptr == NULL) {
snd_printd("seq: malloc for sequencer events failed\n");
return -ENOMEM;
@@
-402,10
+409,10
@@
int snd_seq_pool_init(pool_t *pool)
}
/* remove events */
}
/* remove events */
-int snd_seq_pool_done(
pool_t
*pool)
+int snd_seq_pool_done(
struct snd_seq_pool
*pool)
{
unsigned long flags;
{
unsigned long flags;
- s
nd_seq_event_cell_t
*ptr;
+ s
truct snd_seq_event_cell
*ptr;
int max_count = 5 * HZ;
snd_assert(pool != NULL, return -EINVAL);
int max_count = 5 * HZ;
snd_assert(pool != NULL, return -EINVAL);
@@
-423,8
+430,7
@@
int snd_seq_pool_done(pool_t *pool)
snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
break;
}
snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
break;
}
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
max_count--;
}
max_count--;
}
@@
-447,12
+453,12
@@
int snd_seq_pool_done(pool_t *pool)
/* init new memory pool */
/* init new memory pool */
-
pool_t
*snd_seq_pool_new(int poolsize)
+
struct snd_seq_pool
*snd_seq_pool_new(int poolsize)
{
{
-
pool_t
*pool;
+
struct snd_seq_pool
*pool;
/* create pool block */
/* create pool block */
- pool = k
calloc(1,
sizeof(*pool), GFP_KERNEL);
+ pool = k
zalloc(
sizeof(*pool), GFP_KERNEL);
if (pool == NULL) {
snd_printd("seq: malloc failed for pool\n");
return NULL;
if (pool == NULL) {
snd_printd("seq: malloc failed for pool\n");
return NULL;
@@
-473,9
+479,9
@@
pool_t *snd_seq_pool_new(int poolsize)
}
/* remove memory pool */
}
/* remove memory pool */
-int snd_seq_pool_delete(
pool_t
**ppool)
+int snd_seq_pool_delete(
struct snd_seq_pool
**ppool)
{
{
-
pool_t
*pool = *ppool;
+
struct snd_seq_pool
*pool = *ppool;
*ppool = NULL;
if (pool == NULL)
*ppool = NULL;
if (pool == NULL)
@@
-498,7
+504,8
@@
void __exit snd_sequencer_memory_done(void)
/* exported to seq_clientmgr.c */
/* exported to seq_clientmgr.c */
-void snd_seq_info_pool(snd_info_buffer_t * buffer, pool_t *pool, char *space)
+void snd_seq_info_pool(struct snd_info_buffer *buffer,
+ struct snd_seq_pool *pool, char *space)
{
if (pool == NULL)
return;
{
if (pool == NULL)
return;