aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-card.c13
-rw-r--r--drivers/firewire/core-transaction.c2
-rw-r--r--drivers/firewire/core.h14
-rw-r--r--drivers/firewire/ohci.c4
-rw-r--r--drivers/firewire/sbp2.c16
5 files changed, 30 insertions, 19 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index f74edae5cb4c..e4864e894e4f 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -444,16 +444,13 @@ int fw_card_add(struct fw_card *card,
444 card->guid = guid; 444 card->guid = guid;
445 445
446 mutex_lock(&card_mutex); 446 mutex_lock(&card_mutex);
447 config_rom = generate_config_rom(card, &length);
448 list_add_tail(&card->link, &card_list);
449 mutex_unlock(&card_mutex);
450 447
448 config_rom = generate_config_rom(card, &length);
451 ret = card->driver->enable(card, config_rom, length); 449 ret = card->driver->enable(card, config_rom, length);
452 if (ret < 0) { 450 if (ret == 0)
453 mutex_lock(&card_mutex); 451 list_add_tail(&card->link, &card_list);
454 list_del(&card->link); 452
455 mutex_unlock(&card_mutex); 453 mutex_unlock(&card_mutex);
456 }
457 454
458 return ret; 455 return ret;
459} 456}
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 479b22f5a1eb..da628c72a462 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -834,7 +834,7 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request
834} 834}
835 835
836static struct fw_address_handler topology_map = { 836static struct fw_address_handler topology_map = {
837 .length = 0x200, 837 .length = 0x400,
838 .address_callback = handle_topology_map, 838 .address_callback = handle_topology_map,
839}; 839};
840 840
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h
index 6052816be353..7ff6e7585152 100644
--- a/drivers/firewire/core.h
+++ b/drivers/firewire/core.h
@@ -96,6 +96,20 @@ int fw_core_initiate_bus_reset(struct fw_card *card, int short_reset);
96int fw_compute_block_crc(u32 *block); 96int fw_compute_block_crc(u32 *block);
97void fw_schedule_bm_work(struct fw_card *card, unsigned long delay); 97void fw_schedule_bm_work(struct fw_card *card, unsigned long delay);
98 98
99static inline struct fw_card *fw_card_get(struct fw_card *card)
100{
101 kref_get(&card->kref);
102
103 return card;
104}
105
106void fw_card_release(struct kref *kref);
107
108static inline void fw_card_put(struct fw_card *card)
109{
110 kref_put(&card->kref, fw_card_release);
111}
112
99 113
100/* -cdev */ 114/* -cdev */
101 115
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 76b321bb73f9..5d524254499e 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -1279,8 +1279,8 @@ static void bus_reset_tasklet(unsigned long data)
1279 * the inverted quadlets and a header quadlet, we shift one 1279 * the inverted quadlets and a header quadlet, we shift one
1280 * bit extra to get the actual number of self IDs. 1280 * bit extra to get the actual number of self IDs.
1281 */ 1281 */
1282 self_id_count = (reg >> 3) & 0x3ff; 1282 self_id_count = (reg >> 3) & 0xff;
1283 if (self_id_count == 0) { 1283 if (self_id_count == 0 || self_id_count > 252) {
1284 fw_notify("inconsistent self IDs\n"); 1284 fw_notify("inconsistent self IDs\n");
1285 return; 1285 return;
1286 } 1286 }
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index e5df822a8130..50f0176de615 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -354,8 +354,7 @@ static const struct {
354 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ { 354 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
355 .firmware_revision = 0x002800, 355 .firmware_revision = 0x002800,
356 .model = 0x000000, 356 .model = 0x000000,
357 .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY | 357 .workarounds = SBP2_WORKAROUND_POWER_CONDITION,
358 SBP2_WORKAROUND_POWER_CONDITION,
359 }, 358 },
360 /* Initio bridges, actually only needed for some older ones */ { 359 /* Initio bridges, actually only needed for some older ones */ {
361 .firmware_revision = 0x000200, 360 .firmware_revision = 0x000200,
@@ -425,19 +424,20 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
425 struct sbp2_logical_unit *lu = callback_data; 424 struct sbp2_logical_unit *lu = callback_data;
426 struct sbp2_orb *orb; 425 struct sbp2_orb *orb;
427 struct sbp2_status status; 426 struct sbp2_status status;
428 size_t header_size;
429 unsigned long flags; 427 unsigned long flags;
430 428
431 if (tcode != TCODE_WRITE_BLOCK_REQUEST || 429 if (tcode != TCODE_WRITE_BLOCK_REQUEST ||
432 length == 0 || length > sizeof(status)) { 430 length < 8 || length > sizeof(status)) {
433 fw_send_response(card, request, RCODE_TYPE_ERROR); 431 fw_send_response(card, request, RCODE_TYPE_ERROR);
434 return; 432 return;
435 } 433 }
436 434
437 header_size = min(length, 2 * sizeof(u32)); 435 status.status = be32_to_cpup(payload);
438 fw_memcpy_from_be32(&status, payload, header_size); 436 status.orb_low = be32_to_cpup(payload + 4);
439 if (length > header_size) 437 memset(status.data, 0, sizeof(status.data));
440 memcpy(status.data, payload + 8, length - header_size); 438 if (length > 8)
439 memcpy(status.data, payload + 8, length - 8);
440
441 if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) { 441 if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) {
442 fw_notify("non-orb related status write, not handled\n"); 442 fw_notify("non-orb related status write, not handled\n");
443 fw_send_response(card, request, RCODE_COMPLETE); 443 fw_send_response(card, request, RCODE_COMPLETE);