]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ieee1394/raw1394.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[linux-2.6-omap-h63xx.git] / drivers / ieee1394 / raw1394.c
index d1594427601f98ce1df78d0e1551077830b340c2..bf7e761c12b1c50ba711ade60eef3e003b767a8e 100644 (file)
@@ -2268,6 +2268,9 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer,
                return -EFAULT;
        }
 
+       if (!mutex_trylock(&fi->state_mutex))
+               return -EAGAIN;
+
        switch (fi->state) {
        case opened:
                retval = state_opened(fi, req);
@@ -2282,6 +2285,8 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer,
                break;
        }
 
+       mutex_unlock(&fi->state_mutex);
+
        if (retval < 0) {
                free_pending_request(req);
        } else {
@@ -2544,7 +2549,8 @@ 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 (!mutex_trylock(&fi->state_mutex))
+               return -EAGAIN;
 
        if (fi->iso_state == RAW1394_ISO_INACTIVE)
                ret = -EINVAL;
@@ -2665,7 +2671,8 @@ static long raw1394_ioctl(struct file *file, unsigned int cmd,
                break;
        }
 
-       mutex_lock(&fi->state_mutex);
+       if (!mutex_trylock(&fi->state_mutex))
+               return -EAGAIN;
 
        switch (fi->iso_state) {
        case RAW1394_ISO_INACTIVE:
@@ -3030,10 +3037,10 @@ static int __init init_raw1394(void)
        hpsb_register_highlevel(&raw1394_highlevel);
 
        if (IS_ERR
-           (device_create_drvdata(
-             hpsb_protocol_class, NULL,
-             MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
-             NULL, RAW1394_DEVICE_NAME))) {
+           (device_create(hpsb_protocol_class, NULL,
+                          MKDEV(IEEE1394_MAJOR,
+                                IEEE1394_MINOR_BLOCK_RAW1394 * 16),
+                          NULL, RAW1394_DEVICE_NAME))) {
                ret = -EFAULT;
                goto out_unreg;
        }