summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-device.c')
-rw-r--r--drivers/firewire/fw-device.c37
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[] = {
__ATTR_NULL,
};
-struct read_quadlet_callback_data {
- struct completion done;
- int rcode;
- u32 data;
-};
-
-static void
-complete_transaction(struct fw_card *card, int rcode,
- void *payload, size_t length, void *data)
-{
- struct read_quadlet_callback_data *callback_data = data;
-
- if (rcode == RCODE_COMPLETE)
- callback_data->data = be32_to_cpu(*(__be32 *)payload);
- callback_data->rcode = rcode;
- complete(&callback_data->done);
-}
-
static int
read_rom(struct fw_device *device, int generation, int index, u32 *data)
{
- struct read_quadlet_callback_data callback_data;
- struct fw_transaction t;
- u64 offset;
+ int rcode;
/* device->node_id, accessed below, must not be older than generation */
smp_rmb();
- init_completion(&callback_data.done);
-
- offset = (CSR_REGISTER_BASE | CSR_CONFIG_ROM) + index * 4;
- fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST,
+ rcode = fw_run_transaction(device->card, TCODE_READ_QUADLET_REQUEST,
device->node_id, generation, device->max_speed,
- offset, NULL, 4, complete_transaction, &callback_data);
-
- wait_for_completion(&callback_data.done);
-
- *data = callback_data.data;
+ (CSR_REGISTER_BASE | CSR_CONFIG_ROM) + index * 4,
+ data, 4);
+ be32_to_cpus(data);
- return callback_data.rcode;
+ return rcode;
}
#define READ_BIB_ROM_SIZE 256