firewire: core: combine a bit of repeated code
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 21 Feb 2010 16:56:42 +0000 (17:56 +0100)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Wed, 24 Feb 2010 19:36:55 +0000 (20:36 +0100)
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/core-cdev.c

index d7de17a0f250a7b8913a471999eb98fe4cb07d0d..8be720b278b7a435d2c106794c2cd663438c92a7 100644 (file)
@@ -1349,6 +1349,9 @@ static int dispatch_ioctl(struct client *client,
        union ioctl_arg buffer;
        int ret;
 
+       if (fw_device_is_shutdown(client->device))
+               return -ENODEV;
+
        if (_IOC_TYPE(cmd) != '#' ||
            _IOC_NR(cmd) >= ARRAY_SIZE(ioctl_handlers))
                return -EINVAL;
@@ -1375,24 +1378,14 @@ static int dispatch_ioctl(struct client *client,
 static long fw_device_op_ioctl(struct file *file,
                               unsigned int cmd, unsigned long arg)
 {
-       struct client *client = file->private_data;
-
-       if (fw_device_is_shutdown(client->device))
-               return -ENODEV;
-
-       return dispatch_ioctl(client, cmd, (void __user *) arg);
+       return dispatch_ioctl(file->private_data, cmd, (void __user *)arg);
 }
 
 #ifdef CONFIG_COMPAT
 static long fw_device_op_compat_ioctl(struct file *file,
                                      unsigned int cmd, unsigned long arg)
 {
-       struct client *client = file->private_data;
-
-       if (fw_device_is_shutdown(client->device))
-               return -ENODEV;
-
-       return dispatch_ioctl(client, cmd, compat_ptr(arg));
+       return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg));
 }
 #endif