aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--drivers/ieee1394/raw1394.c4
-rw-r--r--drivers/ieee1394/sbp2.c3
-rw-r--r--include/linux/firewire.h14
8 files changed, 34 insertions, 36 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);
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index da5f8829b503..0bc3d78ce7b1 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -2272,8 +2272,10 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer,
2272 return -EFAULT; 2272 return -EFAULT;
2273 } 2273 }
2274 2274
2275 if (!mutex_trylock(&fi->state_mutex)) 2275 if (!mutex_trylock(&fi->state_mutex)) {
2276 free_pending_request(req);
2276 return -EAGAIN; 2277 return -EAGAIN;
2278 }
2277 2279
2278 switch (fi->state) { 2280 switch (fi->state) {
2279 case opened: 2281 case opened:
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 52b25f8b111d..f199896c4113 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -372,8 +372,7 @@ static const struct {
372 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ { 372 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
373 .firmware_revision = 0x002800, 373 .firmware_revision = 0x002800,
374 .model = 0x000000, 374 .model = 0x000000,
375 .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY | 375 .workarounds = SBP2_WORKAROUND_POWER_CONDITION,
376 SBP2_WORKAROUND_POWER_CONDITION,
377 }, 376 },
378 /* Initio bridges, actually only needed for some older ones */ { 377 /* Initio bridges, actually only needed for some older ones */ {
379 .firmware_revision = 0x000200, 378 .firmware_revision = 0x000200,
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 192d1e43c43c..7e1d4dec83e7 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -134,20 +134,6 @@ struct fw_card {
134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
135}; 135};
136 136
137static inline struct fw_card *fw_card_get(struct fw_card *card)
138{
139 kref_get(&card->kref);
140
141 return card;
142}
143
144void fw_card_release(struct kref *kref);
145
146static inline void fw_card_put(struct fw_card *card)
147{
148 kref_put(&card->kref, fw_card_release);
149}
150
151struct fw_attribute_group { 137struct fw_attribute_group {
152 struct attribute_group *groups[2]; 138 struct attribute_group *groups[2];
153 struct attribute_group group; 139 struct attribute_group group;