diff options
-rw-r--r-- | drivers/firewire/fw-device-cdev.c | 14 | ||||
-rw-r--r-- | drivers/firewire/fw-device-cdev.h | 28 |
2 files changed, 31 insertions, 11 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index f9f268861418..12471444f1bd 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c | |||
@@ -79,6 +79,7 @@ struct client { | |||
79 | u32 request_serial; | 79 | u32 request_serial; |
80 | struct list_head event_list; | 80 | struct list_head event_list; |
81 | wait_queue_head_t wait; | 81 | wait_queue_head_t wait; |
82 | u64 bus_reset_closure; | ||
82 | 83 | ||
83 | struct fw_iso_context *iso_context; | 84 | struct fw_iso_context *iso_context; |
84 | struct fw_iso_buffer buffer; | 85 | struct fw_iso_buffer buffer; |
@@ -199,12 +200,13 @@ fw_device_op_read(struct file *file, | |||
199 | 200 | ||
200 | static void | 201 | static void |
201 | fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, | 202 | fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, |
202 | struct fw_device *device) | 203 | struct client *client) |
203 | { | 204 | { |
204 | struct fw_card *card = device->card; | 205 | struct fw_card *card = client->device->card; |
205 | 206 | ||
207 | event->closure = client->bus_reset_closure; | ||
206 | event->type = FW_CDEV_EVENT_BUS_RESET; | 208 | event->type = FW_CDEV_EVENT_BUS_RESET; |
207 | event->node_id = device->node_id; | 209 | event->node_id = client->device->node_id; |
208 | event->local_node_id = card->local_node->node_id; | 210 | event->local_node_id = card->local_node->node_id; |
209 | event->bm_node_id = 0; /* FIXME: We don't track the BM. */ | 211 | event->bm_node_id = 0; /* FIXME: We don't track the BM. */ |
210 | event->irm_node_id = card->irm_node->node_id; | 212 | event->irm_node_id = card->irm_node->node_id; |
@@ -232,7 +234,6 @@ static void | |||
232 | queue_bus_reset_event(struct client *client) | 234 | queue_bus_reset_event(struct client *client) |
233 | { | 235 | { |
234 | struct bus_reset *bus_reset; | 236 | struct bus_reset *bus_reset; |
235 | struct fw_device *device = client->device; | ||
236 | 237 | ||
237 | bus_reset = kzalloc(sizeof *bus_reset, GFP_ATOMIC); | 238 | bus_reset = kzalloc(sizeof *bus_reset, GFP_ATOMIC); |
238 | if (bus_reset == NULL) { | 239 | if (bus_reset == NULL) { |
@@ -240,7 +241,7 @@ queue_bus_reset_event(struct client *client) | |||
240 | return; | 241 | return; |
241 | } | 242 | } |
242 | 243 | ||
243 | fill_bus_reset_event(&bus_reset->reset, device); | 244 | fill_bus_reset_event(&bus_reset->reset, client); |
244 | 245 | ||
245 | queue_event(client, &bus_reset->event, | 246 | queue_event(client, &bus_reset->event, |
246 | &bus_reset->reset, sizeof bus_reset->reset, NULL, 0); | 247 | &bus_reset->reset, sizeof bus_reset->reset, NULL, 0); |
@@ -283,10 +284,11 @@ static int ioctl_get_info(struct client *client, void __user *arg) | |||
283 | } | 284 | } |
284 | get_info.rom_length = client->device->config_rom_length * 4; | 285 | get_info.rom_length = client->device->config_rom_length * 4; |
285 | 286 | ||
287 | client->bus_reset_closure = get_info.bus_reset_closure; | ||
286 | if (get_info.bus_reset != 0) { | 288 | if (get_info.bus_reset != 0) { |
287 | void __user *uptr = u64_to_uptr(get_info.bus_reset); | 289 | void __user *uptr = u64_to_uptr(get_info.bus_reset); |
288 | 290 | ||
289 | fill_bus_reset_event(&bus_reset, client->device); | 291 | fill_bus_reset_event(&bus_reset, client); |
290 | if (copy_to_user(uptr, &bus_reset, sizeof bus_reset)) | 292 | if (copy_to_user(uptr, &bus_reset, sizeof bus_reset)) |
291 | return -EFAULT; | 293 | return -EFAULT; |
292 | } | 294 | } |
diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h index 10b83222db69..72befda989ba 100644 --- a/drivers/firewire/fw-device-cdev.h +++ b/drivers/firewire/fw-device-cdev.h | |||
@@ -74,7 +74,13 @@ | |||
74 | * event. It's a 64-bit type so that it's a fixed size type big | 74 | * event. It's a 64-bit type so that it's a fixed size type big |
75 | * enough to hold a pointer on all platforms. */ | 75 | * enough to hold a pointer on all platforms. */ |
76 | 76 | ||
77 | struct fw_cdev_event_common { | ||
78 | __u64 closure; | ||
79 | __u32 type; | ||
80 | }; | ||
81 | |||
77 | struct fw_cdev_event_bus_reset { | 82 | struct fw_cdev_event_bus_reset { |
83 | __u64 closure; | ||
78 | __u32 type; | 84 | __u32 type; |
79 | __u32 node_id; | 85 | __u32 node_id; |
80 | __u32 local_node_id; | 86 | __u32 local_node_id; |
@@ -85,31 +91,39 @@ struct fw_cdev_event_bus_reset { | |||
85 | }; | 91 | }; |
86 | 92 | ||
87 | struct fw_cdev_event_response { | 93 | struct fw_cdev_event_response { |
94 | __u64 closure; | ||
88 | __u32 type; | 95 | __u32 type; |
89 | __u32 rcode; | 96 | __u32 rcode; |
90 | __u64 closure; | ||
91 | __u32 length; | 97 | __u32 length; |
92 | __u32 data[0]; | 98 | __u32 data[0]; |
93 | }; | 99 | }; |
94 | 100 | ||
95 | struct fw_cdev_event_request { | 101 | struct fw_cdev_event_request { |
102 | __u64 closure; | ||
96 | __u32 type; | 103 | __u32 type; |
97 | __u32 tcode; | 104 | __u32 tcode; |
98 | __u64 offset; | 105 | __u64 offset; |
99 | __u64 closure; | ||
100 | __u32 serial; | 106 | __u32 serial; |
101 | __u32 length; | 107 | __u32 length; |
102 | __u32 data[0]; | 108 | __u32 data[0]; |
103 | }; | 109 | }; |
104 | 110 | ||
105 | struct fw_cdev_event_iso_interrupt { | 111 | struct fw_cdev_event_iso_interrupt { |
112 | __u64 closure; | ||
106 | __u32 type; | 113 | __u32 type; |
107 | __u32 cycle; | 114 | __u32 cycle; |
108 | __u64 closure; | ||
109 | __u32 header_length; /* Length in bytes of following headers. */ | 115 | __u32 header_length; /* Length in bytes of following headers. */ |
110 | __u32 header[0]; | 116 | __u32 header[0]; |
111 | }; | 117 | }; |
112 | 118 | ||
119 | union fw_cdev_event { | ||
120 | struct fw_cdev_event_common common; | ||
121 | struct fw_cdev_event_bus_reset bus_reset; | ||
122 | struct fw_cdev_event_response response; | ||
123 | struct fw_cdev_event_request request; | ||
124 | struct fw_cdev_event_iso_interrupt iso_interrupt; | ||
125 | }; | ||
126 | |||
113 | #define FW_CDEV_IOC_GET_INFO _IO('#', 0x00) | 127 | #define FW_CDEV_IOC_GET_INFO _IO('#', 0x00) |
114 | #define FW_CDEV_IOC_SEND_REQUEST _IO('#', 0x01) | 128 | #define FW_CDEV_IOC_SEND_REQUEST _IO('#', 0x01) |
115 | #define FW_CDEV_IOC_ALLOCATE _IO('#', 0x02) | 129 | #define FW_CDEV_IOC_ALLOCATE _IO('#', 0x02) |
@@ -145,8 +159,12 @@ struct fw_cdev_get_info { | |||
145 | __u64 rom; | 159 | __u64 rom; |
146 | 160 | ||
147 | /* If non-zero, a fw_cdev_event_bus_reset struct will be | 161 | /* If non-zero, a fw_cdev_event_bus_reset struct will be |
148 | * copied here with the current state of the bus. */ | 162 | * copied here with the current state of the bus. This does |
163 | * not cause a bus reset to happen. The value of closure in | ||
164 | * this and sub-sequent bus reset events is set to | ||
165 | * bus_reset_closure. */ | ||
149 | __u64 bus_reset; | 166 | __u64 bus_reset; |
167 | __u64 bus_reset_closure; | ||
150 | 168 | ||
151 | /* The index of the card this devices belongs to. */ | 169 | /* The index of the card this devices belongs to. */ |
152 | __u32 card; | 170 | __u32 card; |
@@ -212,9 +230,9 @@ struct fw_cdev_iso_packet { | |||
212 | }; | 230 | }; |
213 | 231 | ||
214 | struct fw_cdev_queue_iso { | 232 | struct fw_cdev_queue_iso { |
215 | __u32 size; | ||
216 | __u64 packets; | 233 | __u64 packets; |
217 | __u64 data; | 234 | __u64 data; |
235 | __u32 size; | ||
218 | }; | 236 | }; |
219 | 237 | ||
220 | struct fw_cdev_start_iso { | 238 | struct fw_cdev_start_iso { |