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 kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[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
fbcfd3c
..
40b4f67
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,22
+76,23
@@
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 (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
char buf[32];
if ((len = get_var_len(event)) <= 0)
return len;
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
char buf[32];
- char __user *curptr = event->data.ext.ptr;
+ char __user *curptr =
(char __user *)
event->data.ext.ptr;
while (len > 0) {
int size = sizeof(buf);
if (len < size)
size = len;
while (len > 0) {
int size = sizeof(buf);
if (len < size)
size = len;
- if (copy_from_user(buf, curptr, size)
< 0
)
+ if (copy_from_user(buf, curptr, size))
return -EFAULT;
err = func(private_data, buf, size);
if (err < 0)
return -EFAULT;
err = func(private_data, buf, size);
if (err < 0)
@@
-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);
@@
-134,7
+131,7
@@
static int seq_copy_in_kernel(char **bufptr, const void *src, int size)
return 0;
}
return 0;
}
-static int seq_copy_in_user(char **bufptr, const void *src, int size)
+static int seq_copy_in_user(char
__user
**bufptr, const void *src, int size)
{
if (copy_to_user(*bufptr, src, size))
return -EFAULT;
{
if (copy_to_user(*bufptr, src, size))
return -EFAULT;
@@
-142,7
+139,8
@@
static int seq_copy_in_user(char **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;
@@
-158,7
+156,7
@@
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
if (! in_kernel)
return -EINVAL;
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
if (! in_kernel)
return -EINVAL;
- if (copy_from_user(buf,
event->data.ext.ptr, len) < 0
)
+ if (copy_from_user(buf,
(void __user *)event->data.ext.ptr, len)
)
return -EFAULT;
return newlen;
}
return -EFAULT;
return newlen;
}
@@
-174,17
+172,18
@@
int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
* 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
+193,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
+214,11
@@
void snd_seq_cell_free(snd_seq_event_cell_t * cell)
/*
* allocate an event cell.
*/
/*
* allocate an event cell.
*/
-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
+281,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
+295,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
+312,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);
@@
-336,7
+339,7
@@
int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
tmp->event = src->event;
src = src->next;
} else if (is_usrptr) {
tmp->event = src->event;
src = src->next;
} else if (is_usrptr) {
- if (copy_from_user(&tmp->event, buf, size)) {
+ if (copy_from_user(&tmp->event,
(char __user *)
buf, size)) {
err = -EFAULT;
goto __error;
}
err = -EFAULT;
goto __error;
}
@@
-358,7
+361,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
+370,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
+406,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
+427,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--;
}
@@
-436,8
+439,7
@@
int snd_seq_pool_done(pool_t *pool)
pool->total_elements = 0;
spin_unlock_irqrestore(&pool->lock, flags);
pool->total_elements = 0;
spin_unlock_irqrestore(&pool->lock, flags);
- if (ptr)
- vfree(ptr);
+ vfree(ptr);
spin_lock_irqsave(&pool->lock, flags);
pool->closing = 0;
spin_lock_irqsave(&pool->lock, flags);
pool->closing = 0;
@@
-448,12
+450,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 =
snd_kcalloc(sizeof(pool_t
), GFP_KERNEL);
+ pool =
kzalloc(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;
@@
-474,9
+476,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)
@@
-499,7
+501,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;