aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-03-14 17:34:55 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-15 13:21:36 -0400
commit9472316b6eab3500ded544f6e86700c33541ef4e (patch)
treef155121d72e4881793113ff1890fcc79f37a2c71 /drivers/firewire
parenteb0306eac0aad0b7da18d8fbfb777f155b2c010d (diff)
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')
-rw-r--r--drivers/firewire/fw-device-cdev.c28
-rw-r--r--drivers/firewire/fw-device-cdev.h17
2 files changed, 39 insertions, 6 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)
467 return 0; 467 return 0;
468} 468}
469 469
470static int ioctl_deallocate(struct client *client, void __user *arg)
471{
472 struct fw_cdev_deallocate request;
473 struct address_handler *handler;
474 unsigned long flags;
475
476 if (copy_from_user(&request, arg, sizeof request))
477 return -EFAULT;
478
479 spin_lock_irqsave(&client->lock, flags);
480 list_for_each_entry(handler, &client->handler_list, link) {
481 if (handler->handler.offset == request.offset) {
482 list_del(&handler->link);
483 break;
484 }
485 }
486 spin_unlock_irqrestore(&client->lock, flags);
487
488 if (&handler->link == &client->handler_list)
489 return -EINVAL;
490
491 fw_core_remove_address_handler(&handler->handler);
492
493 return 0;
494}
495
470static int ioctl_send_response(struct client *client, void __user *arg) 496static int ioctl_send_response(struct client *client, void __user *arg)
471{ 497{
472 struct fw_cdev_send_response request; 498 struct fw_cdev_send_response request;
@@ -696,6 +722,8 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
696 return ioctl_send_request(client, arg); 722 return ioctl_send_request(client, arg);
697 case FW_CDEV_IOC_ALLOCATE: 723 case FW_CDEV_IOC_ALLOCATE:
698 return ioctl_allocate(client, arg); 724 return ioctl_allocate(client, arg);
725 case FW_CDEV_IOC_DEALLOCATE:
726 return ioctl_deallocate(client, arg);
699 case FW_CDEV_IOC_SEND_RESPONSE: 727 case FW_CDEV_IOC_SEND_RESPONSE:
700 return ioctl_send_response(client, arg); 728 return ioctl_send_response(client, arg);
701 case FW_CDEV_IOC_INITIATE_BUS_RESET: 729 case FW_CDEV_IOC_INITIATE_BUS_RESET:
diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h
index 3437a360d7dc..10b83222db69 100644
--- a/drivers/firewire/fw-device-cdev.h
+++ b/drivers/firewire/fw-device-cdev.h
@@ -113,12 +113,13 @@ struct fw_cdev_event_iso_interrupt {
113#define FW_CDEV_IOC_GET_INFO _IO('#', 0x00) 113#define FW_CDEV_IOC_GET_INFO _IO('#', 0x00)
114#define FW_CDEV_IOC_SEND_REQUEST _IO('#', 0x01) 114#define FW_CDEV_IOC_SEND_REQUEST _IO('#', 0x01)
115#define FW_CDEV_IOC_ALLOCATE _IO('#', 0x02) 115#define FW_CDEV_IOC_ALLOCATE _IO('#', 0x02)
116#define FW_CDEV_IOC_SEND_RESPONSE _IO('#', 0x03) 116#define FW_CDEV_IOC_DEALLOCATE _IO('#', 0x03)
117#define FW_CDEV_IOC_INITIATE_BUS_RESET _IO('#', 0x04) 117#define FW_CDEV_IOC_SEND_RESPONSE _IO('#', 0x04)
118#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IO('#', 0x05) 118#define FW_CDEV_IOC_INITIATE_BUS_RESET _IO('#', 0x05)
119#define FW_CDEV_IOC_QUEUE_ISO _IO('#', 0x06) 119#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IO('#', 0x06)
120#define FW_CDEV_IOC_START_ISO _IO('#', 0x07) 120#define FW_CDEV_IOC_QUEUE_ISO _IO('#', 0x07)
121#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x08) 121#define FW_CDEV_IOC_START_ISO _IO('#', 0x08)
122#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x09)
122 123
123/* FW_CDEV_VERSION History 124/* FW_CDEV_VERSION History
124 * 125 *
@@ -173,6 +174,10 @@ struct fw_cdev_allocate {
173 __u32 length; 174 __u32 length;
174}; 175};
175 176
177struct fw_cdev_deallocate {
178 __u64 offset;
179};
180
176#define FW_CDEV_LONG_RESET 0 181#define FW_CDEV_LONG_RESET 0
177#define FW_CDEV_SHORT_RESET 1 182#define FW_CDEV_SHORT_RESET 1
178 183