Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9472316b6eab3500ded544f6e86700c33541ef4e Commit: 9472316b6eab3500ded544f6e86700c33541ef4e Parent: eb0306eac0aad0b7da18d8fbfb777f155b2c010d Author: Kristian Høgsberg <[EMAIL PROTECTED]> AuthorDate: Wed Mar 14 17:34:55 2007 -0400 Committer: Stefan Richter <[EMAIL PROTECTED]> CommitDate: Thu Mar 15 18:21:36 2007 +0100
firewire: Implement deallocation of address ranges. Signed-off-by: Kristian Høgsberg <[EMAIL PROTECTED]> Signed-off-by: Stefan Richter <[EMAIL PROTECTED]> --- drivers/firewire/fw-device-cdev.c | 28 ++++++++++++++++++++++++++++ drivers/firewire/fw-device-cdev.h | 17 +++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index 175ea04..ebf0d10 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: diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h index 3437a36..10b8322 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 { #define FW_CDEV_IOC_GET_INFO _IO('#', 0x00) #define FW_CDEV_IOC_SEND_REQUEST _IO('#', 0x01) #define FW_CDEV_IOC_ALLOCATE _IO('#', 0x02) -#define FW_CDEV_IOC_SEND_RESPONSE _IO('#', 0x03) -#define FW_CDEV_IOC_INITIATE_BUS_RESET _IO('#', 0x04) -#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IO('#', 0x05) -#define FW_CDEV_IOC_QUEUE_ISO _IO('#', 0x06) -#define FW_CDEV_IOC_START_ISO _IO('#', 0x07) -#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x08) +#define FW_CDEV_IOC_DEALLOCATE _IO('#', 0x03) +#define FW_CDEV_IOC_SEND_RESPONSE _IO('#', 0x04) +#define FW_CDEV_IOC_INITIATE_BUS_RESET _IO('#', 0x05) +#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IO('#', 0x06) +#define FW_CDEV_IOC_QUEUE_ISO _IO('#', 0x07) +#define FW_CDEV_IOC_START_ISO _IO('#', 0x08) +#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x09) /* FW_CDEV_VERSION History * @@ -173,6 +174,10 @@ struct fw_cdev_allocate { __u32 length; }; +struct fw_cdev_deallocate { + __u64 offset; +}; + #define FW_CDEV_LONG_RESET 0 #define FW_CDEV_SHORT_RESET 1 - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html