diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-03-27 01:43:39 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-28 15:30:14 -0400 |
commit | da8ecffaed434a12930f652898f9e86d1c2abc3e (patch) | |
tree | 161e315bc69decc44cf141f019db2122b75a2360 /drivers/firewire/fw-device-cdev.c | |
parent | 20d11673112f7fa2087ae2eaf8896c8d2d8ccb07 (diff) |
firewire: Streamline userspace interface structs.
Make event struct layout common part include the closure and add a
union for all event types; provide a mechanism for setting the
bus reset event closure.
Shuffle struct fw_cdev_queue_iso fields around to be 64-bit safe.
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 | 14 |
1 files changed, 8 insertions, 6 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 | } |