diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-02-21 11:56:42 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-02-24 14:36:55 -0500 |
commit | 64582298b9c29535188380f488873e7d2196a2eb (patch) | |
tree | 6478773259ee39594d8cabfa300eb5cc665051c4 /drivers/firewire | |
parent | 6e95dea728f4af36c033fcf2318529bd46dae540 (diff) |
firewire: core: combine a bit of repeated code
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/core-cdev.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index d7de17a0f250..8be720b278b7 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -1349,6 +1349,9 @@ static int dispatch_ioctl(struct client *client, | |||
1349 | union ioctl_arg buffer; | 1349 | union ioctl_arg buffer; |
1350 | int ret; | 1350 | int ret; |
1351 | 1351 | ||
1352 | if (fw_device_is_shutdown(client->device)) | ||
1353 | return -ENODEV; | ||
1354 | |||
1352 | if (_IOC_TYPE(cmd) != '#' || | 1355 | if (_IOC_TYPE(cmd) != '#' || |
1353 | _IOC_NR(cmd) >= ARRAY_SIZE(ioctl_handlers)) | 1356 | _IOC_NR(cmd) >= ARRAY_SIZE(ioctl_handlers)) |
1354 | return -EINVAL; | 1357 | return -EINVAL; |
@@ -1375,24 +1378,14 @@ static int dispatch_ioctl(struct client *client, | |||
1375 | static long fw_device_op_ioctl(struct file *file, | 1378 | static long fw_device_op_ioctl(struct file *file, |
1376 | unsigned int cmd, unsigned long arg) | 1379 | unsigned int cmd, unsigned long arg) |
1377 | { | 1380 | { |
1378 | struct client *client = file->private_data; | 1381 | return dispatch_ioctl(file->private_data, cmd, (void __user *)arg); |
1379 | |||
1380 | if (fw_device_is_shutdown(client->device)) | ||
1381 | return -ENODEV; | ||
1382 | |||
1383 | return dispatch_ioctl(client, cmd, (void __user *) arg); | ||
1384 | } | 1382 | } |
1385 | 1383 | ||
1386 | #ifdef CONFIG_COMPAT | 1384 | #ifdef CONFIG_COMPAT |
1387 | static long fw_device_op_compat_ioctl(struct file *file, | 1385 | static long fw_device_op_compat_ioctl(struct file *file, |
1388 | unsigned int cmd, unsigned long arg) | 1386 | unsigned int cmd, unsigned long arg) |
1389 | { | 1387 | { |
1390 | struct client *client = file->private_data; | 1388 | return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg)); |
1391 | |||
1392 | if (fw_device_is_shutdown(client->device)) | ||
1393 | return -ENODEV; | ||
1394 | |||
1395 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); | ||
1396 | } | 1389 | } |
1397 | #endif | 1390 | #endif |
1398 | 1391 | ||