diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-03-14 17:34:55 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-15 18:21:36 +0100 |
commit | 9472316b6eab3500ded544f6e86700c33541ef4e (patch) | |
tree | f155121d72e4881793113ff1890fcc79f37a2c71 /drivers/firewire/fw-device-cdev.c | |
parent | eb0306eac0aad0b7da18d8fbfb777f155b2c010d (diff) | |
download | lwn-9472316b6eab3500ded544f6e86700c33541ef4e.tar.gz lwn-9472316b6eab3500ded544f6e86700c33541ef4e.zip |
firewire: Implement deallocation of address ranges.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-device-cdev.c')
-rw-r--r-- | drivers/firewire/fw-device-cdev.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index 175ea042ba3f..ebf0d100805e 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c @@ -467,6 +467,32 @@ static int ioctl_allocate(struct client *client, void __user *arg) return 0; } +static int ioctl_deallocate(struct client *client, void __user *arg) +{ + struct fw_cdev_deallocate request; + struct address_handler *handler; + unsigned long flags; + + if (copy_from_user(&request, arg, sizeof request)) + return -EFAULT; + + spin_lock_irqsave(&client->lock, flags); + list_for_each_entry(handler, &client->handler_list, link) { + if (handler->handler.offset == request.offset) { + list_del(&handler->link); + break; + } + } + spin_unlock_irqrestore(&client->lock, flags); + + if (&handler->link == &client->handler_list) + return -EINVAL; + + fw_core_remove_address_handler(&handler->handler); + + return 0; +} + static int ioctl_send_response(struct client *client, void __user *arg) { struct fw_cdev_send_response request; @@ -696,6 +722,8 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) return ioctl_send_request(client, arg); case FW_CDEV_IOC_ALLOCATE: return ioctl_allocate(client, arg); + case FW_CDEV_IOC_DEALLOCATE: + return ioctl_deallocate(client, arg); case FW_CDEV_IOC_SEND_RESPONSE: return ioctl_send_response(client, arg); case FW_CDEV_IOC_INITIATE_BUS_RESET: |