diff options
Diffstat (limited to 'drivers/firewire/fw-device.c')
-rw-r--r-- | drivers/firewire/fw-device.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index 0855fb5568e8..3fccdd484100 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -381,46 +381,21 @@ static struct device_attribute fw_device_attributes[] = { | |||
381 | __ATTR_NULL, | 381 | __ATTR_NULL, |
382 | }; | 382 | }; |
383 | 383 | ||
384 | struct read_quadlet_callback_data { | ||
385 | struct completion done; | ||
386 | int rcode; | ||
387 | u32 data; | ||
388 | }; | ||
389 | |||
390 | static void | ||
391 | complete_transaction(struct fw_card *card, int rcode, | ||
392 | void *payload, size_t length, void *data) | ||
393 | { | ||
394 | struct read_quadlet_callback_data *callback_data = data; | ||
395 | |||
396 | if (rcode == RCODE_COMPLETE) | ||
397 | callback_data->data = be32_to_cpu(*(__be32 *)payload); | ||
398 | callback_data->rcode = rcode; | ||
399 | complete(&callback_data->done); | ||
400 | } | ||
401 | |||
402 | static int | 384 | static int |
403 | read_rom(struct fw_device *device, int generation, int index, u32 *data) | 385 | read_rom(struct fw_device *device, int generation, int index, u32 *data) |
404 | { | 386 | { |
405 | struct read_quadlet_callback_data callback_data; | 387 | int rcode; |
406 | struct fw_transaction t; | ||
407 | u64 offset; | ||
408 | 388 | ||
409 | /* device->node_id, accessed below, must not be older than generation */ | 389 | /* device->node_id, accessed below, must not be older than generation */ |
410 | smp_rmb(); | 390 | smp_rmb(); |
411 | 391 | ||
412 | init_completion(&callback_data.done); | 392 | rcode = fw_run_transaction(device->card, TCODE_READ_QUADLET_REQUEST, |
413 | |||
414 | offset = (CSR_REGISTER_BASE | CSR_CONFIG_ROM) + index * 4; | ||
415 | fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST, | ||
416 | device->node_id, generation, device->max_speed, | 393 | device->node_id, generation, device->max_speed, |
417 | offset, NULL, 4, complete_transaction, &callback_data); | 394 | (CSR_REGISTER_BASE | CSR_CONFIG_ROM) + index * 4, |
418 | 395 | data, 4); | |
419 | wait_for_completion(&callback_data.done); | 396 | be32_to_cpus(data); |
420 | |||
421 | *data = callback_data.data; | ||
422 | 397 | ||
423 | return callback_data.rcode; | 398 | return rcode; |
424 | } | 399 | } |
425 | 400 | ||
426 | #define READ_BIB_ROM_SIZE 256 | 401 | #define READ_BIB_ROM_SIZE 256 |