Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115181
b: refs/heads/master
c: 10963ea
h: refs/heads/master
i:
  115179: abb2896
v: v3
  • Loading branch information
Stefan Richter committed Oct 15, 2008
1 parent ce7a419 commit bb81d42
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ed6ffd08084c68e9c3911e27706dec9d4c9a4175
refs/heads/master: 10963ea1bd966ba46a46178c4d6abcdf3c23538d
1 change: 1 addition & 0 deletions trunk/drivers/ieee1394/raw1394-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum raw1394_iso_state { RAW1394_ISO_INACTIVE = 0,
struct file_info {
struct list_head list;

struct mutex state_mutex;
enum { opened, initialized, connected } state;
unsigned int protocol_version;

Expand Down
23 changes: 17 additions & 6 deletions trunk/drivers/ieee1394/raw1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
Expand Down Expand Up @@ -2541,11 +2542,18 @@ static int raw1394_read_cycle_timer(struct file_info *fi, void __user * uaddr)
static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
{
struct file_info *fi = file->private_data;
int ret;

mutex_lock(&fi->state_mutex);

if (fi->iso_state == RAW1394_ISO_INACTIVE)
return -EINVAL;
ret = -EINVAL;
else
ret = dma_region_mmap(&fi->iso_handle->data_buf, file, vma);

mutex_unlock(&fi->state_mutex);

return dma_region_mmap(&fi->iso_handle->data_buf, file, vma);
return ret;
}

/* ioctl is only used for rawiso operations */
Expand Down Expand Up @@ -2659,10 +2667,12 @@ static long do_raw1394_ioctl(struct file *file, unsigned int cmd,
static long raw1394_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct file_info *fi = file->private_data;
long ret;
lock_kernel();

mutex_lock(&fi->state_mutex);
ret = do_raw1394_ioctl(file, cmd, arg);
unlock_kernel();
mutex_unlock(&fi->state_mutex);
return ret;
}

Expand Down Expand Up @@ -2724,7 +2734,7 @@ static long raw1394_compat_ioctl(struct file *file,
void __user *argp = (void __user *)arg;
long err;

lock_kernel();
mutex_lock(&fi->state_mutex);
switch (cmd) {
/* These requests have same format as long as 'int' has same size. */
case RAW1394_IOC_ISO_RECV_INIT:
Expand Down Expand Up @@ -2757,7 +2767,7 @@ static long raw1394_compat_ioctl(struct file *file,
err = -EINVAL;
break;
}
unlock_kernel();
mutex_unlock(&fi->state_mutex);

return err;
}
Expand Down Expand Up @@ -2791,6 +2801,7 @@ static int raw1394_open(struct inode *inode, struct file *file)
fi->notification = (u8) RAW1394_NOTIFY_ON; /* busreset notification */

INIT_LIST_HEAD(&fi->list);
mutex_init(&fi->state_mutex);
fi->state = opened;
INIT_LIST_HEAD(&fi->req_pending);
INIT_LIST_HEAD(&fi->req_complete);
Expand Down

0 comments on commit bb81d42

Please sign in to comment.