aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-09 13:11:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-09 13:11:48 -0400
commitf78089e87e576f91396a5d428d14b552178dfb17 (patch)
treeb1fdef744c0f24959c173660c233bb871d2f6edc
parent7462543abb87f55b530dfbb8d857645f1cebd756 (diff)
parent6fe9efb9c9fbce690018c31e652924ae28019868 (diff)
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewure updates from Stefan Richter: - fix controller removal when controller is in suspended state - fix video reception on VIA VT6306 with gstreamer, MythTV, and maybe dv4l - fix a startup issue with Agere/LSI FW643-e2 - error logging improvements and other small updates * tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: firewire: ohci: dump_stack() for PHY regs read/write failures firewire: ohci: Improve bus reset error messages firewire: ohci: Alias dev_* log functions firewire: ohci: Fix 'failed to read phy reg' on FW643 rev8 firewire: ohci: fix VIA VT6306 video reception firewire: ohci: Check LPS before register access on pci removal firewire: ohci: Fix double free_irq() firewire: remove unnecessary alloc/OOM messages firewire: sbp2: replace BUG_ON by WARN_ON firewire: core: remove an always false test firewire: Remove two unneeded checks for macros
-rw-r--r--drivers/firewire/core-cdev.c27
-rw-r--r--drivers/firewire/core-device.c4
-rw-r--r--drivers/firewire/net.c7
-rw-r--r--drivers/firewire/ohci.c270
-rw-r--r--drivers/firewire/sbp2.c10
5 files changed, 166 insertions, 152 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 27ac423ab25e..7ef316fdc4d9 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -389,10 +389,8 @@ static void queue_bus_reset_event(struct client *client)
389 struct bus_reset_event *e; 389 struct bus_reset_event *e;
390 390
391 e = kzalloc(sizeof(*e), GFP_KERNEL); 391 e = kzalloc(sizeof(*e), GFP_KERNEL);
392 if (e == NULL) { 392 if (e == NULL)
393 fw_notice(client->device->card, "out of memory when allocating event\n");
394 return; 393 return;
395 }
396 394
397 fill_bus_reset_event(&e->reset, client); 395 fill_bus_reset_event(&e->reset, client);
398 396
@@ -693,10 +691,9 @@ static void handle_request(struct fw_card *card, struct fw_request *request,
693 691
694 r = kmalloc(sizeof(*r), GFP_ATOMIC); 692 r = kmalloc(sizeof(*r), GFP_ATOMIC);
695 e = kmalloc(sizeof(*e), GFP_ATOMIC); 693 e = kmalloc(sizeof(*e), GFP_ATOMIC);
696 if (r == NULL || e == NULL) { 694 if (r == NULL || e == NULL)
697 fw_notice(card, "out of memory when allocating event\n");
698 goto failed; 695 goto failed;
699 } 696
700 r->card = card; 697 r->card = card;
701 r->request = request; 698 r->request = request;
702 r->data = payload; 699 r->data = payload;
@@ -930,10 +927,9 @@ static void iso_callback(struct fw_iso_context *context, u32 cycle,
930 struct iso_interrupt_event *e; 927 struct iso_interrupt_event *e;
931 928
932 e = kmalloc(sizeof(*e) + header_length, GFP_ATOMIC); 929 e = kmalloc(sizeof(*e) + header_length, GFP_ATOMIC);
933 if (e == NULL) { 930 if (e == NULL)
934 fw_notice(context->card, "out of memory when allocating event\n");
935 return; 931 return;
936 } 932
937 e->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT; 933 e->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT;
938 e->interrupt.closure = client->iso_closure; 934 e->interrupt.closure = client->iso_closure;
939 e->interrupt.cycle = cycle; 935 e->interrupt.cycle = cycle;
@@ -950,10 +946,9 @@ static void iso_mc_callback(struct fw_iso_context *context,
950 struct iso_interrupt_mc_event *e; 946 struct iso_interrupt_mc_event *e;
951 947
952 e = kmalloc(sizeof(*e), GFP_ATOMIC); 948 e = kmalloc(sizeof(*e), GFP_ATOMIC);
953 if (e == NULL) { 949 if (e == NULL)
954 fw_notice(context->card, "out of memory when allocating event\n");
955 return; 950 return;
956 } 951
957 e->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL; 952 e->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL;
958 e->interrupt.closure = client->iso_closure; 953 e->interrupt.closure = client->iso_closure;
959 e->interrupt.completed = fw_iso_buffer_lookup(&client->buffer, 954 e->interrupt.completed = fw_iso_buffer_lookup(&client->buffer,
@@ -1366,8 +1361,7 @@ static int init_iso_resource(struct client *client,
1366 int ret; 1361 int ret;
1367 1362
1368 if ((request->channels == 0 && request->bandwidth == 0) || 1363 if ((request->channels == 0 && request->bandwidth == 0) ||
1369 request->bandwidth > BANDWIDTH_AVAILABLE_INITIAL || 1364 request->bandwidth > BANDWIDTH_AVAILABLE_INITIAL)
1370 request->bandwidth < 0)
1371 return -EINVAL; 1365 return -EINVAL;
1372 1366
1373 r = kmalloc(sizeof(*r), GFP_KERNEL); 1367 r = kmalloc(sizeof(*r), GFP_KERNEL);
@@ -1582,10 +1576,9 @@ void fw_cdev_handle_phy_packet(struct fw_card *card, struct fw_packet *p)
1582 1576
1583 list_for_each_entry(client, &card->phy_receiver_list, phy_receiver_link) { 1577 list_for_each_entry(client, &card->phy_receiver_list, phy_receiver_link) {
1584 e = kmalloc(sizeof(*e) + 8, GFP_ATOMIC); 1578 e = kmalloc(sizeof(*e) + 8, GFP_ATOMIC);
1585 if (e == NULL) { 1579 if (e == NULL)
1586 fw_notice(card, "out of memory when allocating event\n");
1587 break; 1580 break;
1588 } 1581
1589 e->phy_packet.closure = client->phy_receiver_closure; 1582 e->phy_packet.closure = client->phy_receiver_closure;
1590 e->phy_packet.type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED; 1583 e->phy_packet.type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED;
1591 e->phy_packet.rcode = RCODE_COMPLETE; 1584 e->phy_packet.rcode = RCODE_COMPLETE;
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 03ce7d980c6a..664a6ff0a823 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -692,10 +692,8 @@ static void create_units(struct fw_device *device)
692 * match the drivers id_tables against it. 692 * match the drivers id_tables against it.
693 */ 693 */
694 unit = kzalloc(sizeof(*unit), GFP_KERNEL); 694 unit = kzalloc(sizeof(*unit), GFP_KERNEL);
695 if (unit == NULL) { 695 if (unit == NULL)
696 fw_err(device->card, "out of memory for unit\n");
697 continue; 696 continue;
698 }
699 697
700 unit->directory = ci.p + value - 1; 698 unit->directory = ci.p + value - 1;
701 unit->device.bus = &fw_bus_type; 699 unit->device.bus = &fw_bus_type;
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 4d565365e476..815b0fcbe918 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -356,10 +356,8 @@ static struct fwnet_fragment_info *fwnet_frag_new(
356 } 356 }
357 357
358 new = kmalloc(sizeof(*new), GFP_ATOMIC); 358 new = kmalloc(sizeof(*new), GFP_ATOMIC);
359 if (!new) { 359 if (!new)
360 dev_err(&pd->skb->dev->dev, "out of memory\n");
361 return NULL; 360 return NULL;
362 }
363 361
364 new->offset = offset; 362 new->offset = offset;
365 new->len = len; 363 new->len = len;
@@ -402,8 +400,6 @@ fail_w_fi:
402fail_w_new: 400fail_w_new:
403 kfree(new); 401 kfree(new);
404fail: 402fail:
405 dev_err(&net->dev, "out of memory\n");
406
407 return NULL; 403 return NULL;
408} 404}
409 405
@@ -609,7 +605,6 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
609 605
610 skb = dev_alloc_skb(len + LL_RESERVED_SPACE(net)); 606 skb = dev_alloc_skb(len + LL_RESERVED_SPACE(net));
611 if (unlikely(!skb)) { 607 if (unlikely(!skb)) {
612 dev_err(&net->dev, "out of memory\n");
613 net->stats.rx_dropped++; 608 net->stats.rx_dropped++;
614 609
615 return -ENOMEM; 610 return -ENOMEM;
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 45912e6e0ac2..9e1db6490b9a 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -54,6 +54,10 @@
54#include "core.h" 54#include "core.h"
55#include "ohci.h" 55#include "ohci.h"
56 56
57#define ohci_info(ohci, f, args...) dev_info(ohci->card.device, f, ##args)
58#define ohci_notice(ohci, f, args...) dev_notice(ohci->card.device, f, ##args)
59#define ohci_err(ohci, f, args...) dev_err(ohci->card.device, f, ##args)
60
57#define DESCRIPTOR_OUTPUT_MORE 0 61#define DESCRIPTOR_OUTPUT_MORE 0
58#define DESCRIPTOR_OUTPUT_LAST (1 << 12) 62#define DESCRIPTOR_OUTPUT_LAST (1 << 12)
59#define DESCRIPTOR_INPUT_MORE (2 << 12) 63#define DESCRIPTOR_INPUT_MORE (2 << 12)
@@ -68,6 +72,8 @@
68#define DESCRIPTOR_BRANCH_ALWAYS (3 << 2) 72#define DESCRIPTOR_BRANCH_ALWAYS (3 << 2)
69#define DESCRIPTOR_WAIT (3 << 0) 73#define DESCRIPTOR_WAIT (3 << 0)
70 74
75#define DESCRIPTOR_CMD (0xf << 12)
76
71struct descriptor { 77struct descriptor {
72 __le16 req_count; 78 __le16 req_count;
73 __le16 control; 79 __le16 control;
@@ -149,10 +155,11 @@ struct context {
149 struct descriptor *last; 155 struct descriptor *last;
150 156
151 /* 157 /*
152 * The last descriptor in the DMA program. It contains the branch 158 * The last descriptor block in the DMA program. It contains the branch
153 * address that must be updated upon appending a new descriptor. 159 * address that must be updated upon appending a new descriptor.
154 */ 160 */
155 struct descriptor *prev; 161 struct descriptor *prev;
162 int prev_z;
156 163
157 descriptor_callback_t callback; 164 descriptor_callback_t callback;
158 165
@@ -270,7 +277,9 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
270#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 277#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
271#define PCI_DEVICE_ID_TI_TSB12LV26 0x8020 278#define PCI_DEVICE_ID_TI_TSB12LV26 0x8020
272#define PCI_DEVICE_ID_TI_TSB82AA2 0x8025 279#define PCI_DEVICE_ID_TI_TSB82AA2 0x8025
280#define PCI_DEVICE_ID_VIA_VT630X 0x3044
273#define PCI_VENDOR_ID_PINNACLE_SYSTEMS 0x11bd 281#define PCI_VENDOR_ID_PINNACLE_SYSTEMS 0x11bd
282#define PCI_REV_ID_VIA_VT6306 0x46
274 283
275#define QUIRK_CYCLE_TIMER 1 284#define QUIRK_CYCLE_TIMER 1
276#define QUIRK_RESET_PACKET 2 285#define QUIRK_RESET_PACKET 2
@@ -278,6 +287,8 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
278#define QUIRK_NO_1394A 8 287#define QUIRK_NO_1394A 8
279#define QUIRK_NO_MSI 16 288#define QUIRK_NO_MSI 16
280#define QUIRK_TI_SLLZ059 32 289#define QUIRK_TI_SLLZ059 32
290#define QUIRK_IR_WAKE 64
291#define QUIRK_PHY_LCTRL_TIMEOUT 128
281 292
282/* In case of multiple matches in ohci_quirks[], only the first one is used. */ 293/* In case of multiple matches in ohci_quirks[], only the first one is used. */
283static const struct { 294static const struct {
@@ -290,7 +301,10 @@ static const struct {
290 QUIRK_BE_HEADERS}, 301 QUIRK_BE_HEADERS},
291 302
292 {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, 303 {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
293 QUIRK_NO_MSI}, 304 QUIRK_PHY_LCTRL_TIMEOUT | QUIRK_NO_MSI},
305
306 {PCI_VENDOR_ID_ATT, PCI_ANY_ID, PCI_ANY_ID,
307 QUIRK_PHY_LCTRL_TIMEOUT},
294 308
295 {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, 309 {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID,
296 QUIRK_RESET_PACKET}, 310 QUIRK_RESET_PACKET},
@@ -319,6 +333,9 @@ static const struct {
319 {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID, 333 {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID,
320 QUIRK_RESET_PACKET}, 334 QUIRK_RESET_PACKET},
321 335
336 {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT630X, PCI_REV_ID_VIA_VT6306,
337 QUIRK_CYCLE_TIMER | QUIRK_IR_WAKE},
338
322 {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID, 339 {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID,
323 QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, 340 QUIRK_CYCLE_TIMER | QUIRK_NO_MSI},
324}; 341};
@@ -333,6 +350,8 @@ MODULE_PARM_DESC(quirks, "Chip quirks (default = 0"
333 ", no 1394a enhancements = " __stringify(QUIRK_NO_1394A) 350 ", no 1394a enhancements = " __stringify(QUIRK_NO_1394A)
334 ", disable MSI = " __stringify(QUIRK_NO_MSI) 351 ", disable MSI = " __stringify(QUIRK_NO_MSI)
335 ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) 352 ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059)
353 ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE)
354 ", phy LCtrl timeout = " __stringify(QUIRK_PHY_LCTRL_TIMEOUT)
336 ")"); 355 ")");
337 356
338#define OHCI_PARAM_DEBUG_AT_AR 1 357#define OHCI_PARAM_DEBUG_AT_AR 1
@@ -359,8 +378,7 @@ static void log_irqs(struct fw_ohci *ohci, u32 evt)
359 !(evt & OHCI1394_busReset)) 378 !(evt & OHCI1394_busReset))
360 return; 379 return;
361 380
362 dev_notice(ohci->card.device, 381 ohci_notice(ohci, "IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
363 "IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
364 evt & OHCI1394_selfIDComplete ? " selfID" : "", 382 evt & OHCI1394_selfIDComplete ? " selfID" : "",
365 evt & OHCI1394_RQPkt ? " AR_req" : "", 383 evt & OHCI1394_RQPkt ? " AR_req" : "",
366 evt & OHCI1394_RSPkt ? " AR_resp" : "", 384 evt & OHCI1394_RSPkt ? " AR_resp" : "",
@@ -406,21 +424,19 @@ static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count)
406 if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS))) 424 if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS)))
407 return; 425 return;
408 426
409 dev_notice(ohci->card.device, 427 ohci_notice(ohci, "%d selfIDs, generation %d, local node ID %04x\n",
410 "%d selfIDs, generation %d, local node ID %04x\n", 428 self_id_count, generation, ohci->node_id);
411 self_id_count, generation, ohci->node_id);
412 429
413 for (s = ohci->self_id_buffer; self_id_count--; ++s) 430 for (s = ohci->self_id_buffer; self_id_count--; ++s)
414 if ((*s & 1 << 23) == 0) 431 if ((*s & 1 << 23) == 0)
415 dev_notice(ohci->card.device, 432 ohci_notice(ohci,
416 "selfID 0: %08x, phy %d [%c%c%c] " 433 "selfID 0: %08x, phy %d [%c%c%c] %s gc=%d %s %s%s%s\n",
417 "%s gc=%d %s %s%s%s\n",
418 *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2), 434 *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2),
419 speed[*s >> 14 & 3], *s >> 16 & 63, 435 speed[*s >> 14 & 3], *s >> 16 & 63,
420 power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "", 436 power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "",
421 *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : ""); 437 *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : "");
422 else 438 else
423 dev_notice(ohci->card.device, 439 ohci_notice(ohci,
424 "selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n", 440 "selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n",
425 *s, *s >> 24 & 63, 441 *s, *s >> 24 & 63,
426 _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10), 442 _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10),
@@ -470,9 +486,8 @@ static void log_ar_at_event(struct fw_ohci *ohci,
470 evt = 0x1f; 486 evt = 0x1f;
471 487
472 if (evt == OHCI1394_evt_bus_reset) { 488 if (evt == OHCI1394_evt_bus_reset) {
473 dev_notice(ohci->card.device, 489 ohci_notice(ohci, "A%c evt_bus_reset, generation %d\n",
474 "A%c evt_bus_reset, generation %d\n", 490 dir, (header[2] >> 16) & 0xff);
475 dir, (header[2] >> 16) & 0xff);
476 return; 491 return;
477 } 492 }
478 493
@@ -491,32 +506,26 @@ static void log_ar_at_event(struct fw_ohci *ohci,
491 506
492 switch (tcode) { 507 switch (tcode) {
493 case 0xa: 508 case 0xa:
494 dev_notice(ohci->card.device, 509 ohci_notice(ohci, "A%c %s, %s\n",
495 "A%c %s, %s\n", 510 dir, evts[evt], tcodes[tcode]);
496 dir, evts[evt], tcodes[tcode]);
497 break; 511 break;
498 case 0xe: 512 case 0xe:
499 dev_notice(ohci->card.device, 513 ohci_notice(ohci, "A%c %s, PHY %08x %08x\n",
500 "A%c %s, PHY %08x %08x\n", 514 dir, evts[evt], header[1], header[2]);
501 dir, evts[evt], header[1], header[2]);
502 break; 515 break;
503 case 0x0: case 0x1: case 0x4: case 0x5: case 0x9: 516 case 0x0: case 0x1: case 0x4: case 0x5: case 0x9:
504 dev_notice(ohci->card.device, 517 ohci_notice(ohci,
505 "A%c spd %x tl %02x, " 518 "A%c spd %x tl %02x, %04x -> %04x, %s, %s, %04x%08x%s\n",
506 "%04x -> %04x, %s, " 519 dir, speed, header[0] >> 10 & 0x3f,
507 "%s, %04x%08x%s\n", 520 header[1] >> 16, header[0] >> 16, evts[evt],
508 dir, speed, header[0] >> 10 & 0x3f, 521 tcodes[tcode], header[1] & 0xffff, header[2], specific);
509 header[1] >> 16, header[0] >> 16, evts[evt],
510 tcodes[tcode], header[1] & 0xffff, header[2], specific);
511 break; 522 break;
512 default: 523 default:
513 dev_notice(ohci->card.device, 524 ohci_notice(ohci,
514 "A%c spd %x tl %02x, " 525 "A%c spd %x tl %02x, %04x -> %04x, %s, %s%s\n",
515 "%04x -> %04x, %s, " 526 dir, speed, header[0] >> 10 & 0x3f,
516 "%s%s\n", 527 header[1] >> 16, header[0] >> 16, evts[evt],
517 dir, speed, header[0] >> 10 & 0x3f, 528 tcodes[tcode], specific);
518 header[1] >> 16, header[0] >> 16, evts[evt],
519 tcodes[tcode], specific);
520 } 529 }
521} 530}
522 531
@@ -563,7 +572,8 @@ static int read_phy_reg(struct fw_ohci *ohci, int addr)
563 if (i >= 3) 572 if (i >= 3)
564 msleep(1); 573 msleep(1);
565 } 574 }
566 dev_err(ohci->card.device, "failed to read phy reg\n"); 575 ohci_err(ohci, "failed to read phy reg %d\n", addr);
576 dump_stack();
567 577
568 return -EBUSY; 578 return -EBUSY;
569} 579}
@@ -585,7 +595,8 @@ static int write_phy_reg(const struct fw_ohci *ohci, int addr, u32 val)
585 if (i >= 3) 595 if (i >= 3)
586 msleep(1); 596 msleep(1);
587 } 597 }
588 dev_err(ohci->card.device, "failed to write phy reg\n"); 598 ohci_err(ohci, "failed to write phy reg %d, val %u\n", addr, val);
599 dump_stack();
589 600
590 return -EBUSY; 601 return -EBUSY;
591} 602}
@@ -690,8 +701,7 @@ static void ar_context_abort(struct ar_context *ctx, const char *error_msg)
690 reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); 701 reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN);
691 flush_writes(ohci); 702 flush_writes(ohci);
692 703
693 dev_err(ohci->card.device, "AR error: %s; DMA stopped\n", 704 ohci_err(ohci, "AR error: %s; DMA stopped\n", error_msg);
694 error_msg);
695 } 705 }
696 /* FIXME: restart? */ 706 /* FIXME: restart? */
697} 707}
@@ -1157,6 +1167,7 @@ static int context_init(struct context *ctx, struct fw_ohci *ohci,
1157 ctx->buffer_tail->used += sizeof(*ctx->buffer_tail->buffer); 1167 ctx->buffer_tail->used += sizeof(*ctx->buffer_tail->buffer);
1158 ctx->last = ctx->buffer_tail->buffer; 1168 ctx->last = ctx->buffer_tail->buffer;
1159 ctx->prev = ctx->buffer_tail->buffer; 1169 ctx->prev = ctx->buffer_tail->buffer;
1170 ctx->prev_z = 1;
1160 1171
1161 return 0; 1172 return 0;
1162} 1173}
@@ -1221,14 +1232,35 @@ static void context_append(struct context *ctx,
1221{ 1232{
1222 dma_addr_t d_bus; 1233 dma_addr_t d_bus;
1223 struct descriptor_buffer *desc = ctx->buffer_tail; 1234 struct descriptor_buffer *desc = ctx->buffer_tail;
1235 struct descriptor *d_branch;
1224 1236
1225 d_bus = desc->buffer_bus + (d - desc->buffer) * sizeof(*d); 1237 d_bus = desc->buffer_bus + (d - desc->buffer) * sizeof(*d);
1226 1238
1227 desc->used += (z + extra) * sizeof(*d); 1239 desc->used += (z + extra) * sizeof(*d);
1228 1240
1229 wmb(); /* finish init of new descriptors before branch_address update */ 1241 wmb(); /* finish init of new descriptors before branch_address update */
1230 ctx->prev->branch_address = cpu_to_le32(d_bus | z); 1242
1231 ctx->prev = find_branch_descriptor(d, z); 1243 d_branch = find_branch_descriptor(ctx->prev, ctx->prev_z);
1244 d_branch->branch_address = cpu_to_le32(d_bus | z);
1245
1246 /*
1247 * VT6306 incorrectly checks only the single descriptor at the
1248 * CommandPtr when the wake bit is written, so if it's a
1249 * multi-descriptor block starting with an INPUT_MORE, put a copy of
1250 * the branch address in the first descriptor.
1251 *
1252 * Not doing this for transmit contexts since not sure how it interacts
1253 * with skip addresses.
1254 */
1255 if (unlikely(ctx->ohci->quirks & QUIRK_IR_WAKE) &&
1256 d_branch != ctx->prev &&
1257 (ctx->prev->control & cpu_to_le16(DESCRIPTOR_CMD)) ==
1258 cpu_to_le16(DESCRIPTOR_INPUT_MORE)) {
1259 ctx->prev->branch_address = cpu_to_le32(d_bus | z);
1260 }
1261
1262 ctx->prev = d;
1263 ctx->prev_z = z;
1232} 1264}
1233 1265
1234static void context_stop(struct context *ctx) 1266static void context_stop(struct context *ctx)
@@ -1248,7 +1280,7 @@ static void context_stop(struct context *ctx)
1248 if (i) 1280 if (i)
1249 udelay(10); 1281 udelay(10);
1250 } 1282 }
1251 dev_err(ohci->card.device, "DMA context still active (0x%08x)\n", reg); 1283 ohci_err(ohci, "DMA context still active (0x%08x)\n", reg);
1252} 1284}
1253 1285
1254struct driver_data { 1286struct driver_data {
@@ -1557,7 +1589,7 @@ static void handle_local_lock(struct fw_ohci *ohci,
1557 goto out; 1589 goto out;
1558 } 1590 }
1559 1591
1560 dev_err(ohci->card.device, "swap not done (CSR lock timeout)\n"); 1592 ohci_err(ohci, "swap not done (CSR lock timeout)\n");
1561 fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0); 1593 fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0);
1562 1594
1563 out: 1595 out:
@@ -1632,8 +1664,7 @@ static void detect_dead_context(struct fw_ohci *ohci,
1632 1664
1633 ctl = reg_read(ohci, CONTROL_SET(regs)); 1665 ctl = reg_read(ohci, CONTROL_SET(regs));
1634 if (ctl & CONTEXT_DEAD) 1666 if (ctl & CONTEXT_DEAD)
1635 dev_err(ohci->card.device, 1667 ohci_err(ohci, "DMA context %s has stopped, error code: %s\n",
1636 "DMA context %s has stopped, error code: %s\n",
1637 name, evts[ctl & 0x1f]); 1668 name, evts[ctl & 0x1f]);
1638} 1669}
1639 1670
@@ -1815,8 +1846,8 @@ static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count)
1815 1846
1816 reg = reg_read(ohci, OHCI1394_NodeID); 1847 reg = reg_read(ohci, OHCI1394_NodeID);
1817 if (!(reg & OHCI1394_NodeID_idValid)) { 1848 if (!(reg & OHCI1394_NodeID_idValid)) {
1818 dev_notice(ohci->card.device, 1849 ohci_notice(ohci,
1819 "node ID not valid, new bus reset in progress\n"); 1850 "node ID not valid, new bus reset in progress\n");
1820 return -EBUSY; 1851 return -EBUSY;
1821 } 1852 }
1822 self_id |= ((reg & 0x3f) << 24); /* phy ID */ 1853 self_id |= ((reg & 0x3f) << 24); /* phy ID */
@@ -1863,12 +1894,12 @@ static void bus_reset_work(struct work_struct *work)
1863 1894
1864 reg = reg_read(ohci, OHCI1394_NodeID); 1895 reg = reg_read(ohci, OHCI1394_NodeID);
1865 if (!(reg & OHCI1394_NodeID_idValid)) { 1896 if (!(reg & OHCI1394_NodeID_idValid)) {
1866 dev_notice(ohci->card.device, 1897 ohci_notice(ohci,
1867 "node ID not valid, new bus reset in progress\n"); 1898 "node ID not valid, new bus reset in progress\n");
1868 return; 1899 return;
1869 } 1900 }
1870 if ((reg & OHCI1394_NodeID_nodeNumber) == 63) { 1901 if ((reg & OHCI1394_NodeID_nodeNumber) == 63) {
1871 dev_notice(ohci->card.device, "malconfigured bus\n"); 1902 ohci_notice(ohci, "malconfigured bus\n");
1872 return; 1903 return;
1873 } 1904 }
1874 ohci->node_id = reg & (OHCI1394_NodeID_busNumber | 1905 ohci->node_id = reg & (OHCI1394_NodeID_busNumber |
@@ -1882,7 +1913,7 @@ static void bus_reset_work(struct work_struct *work)
1882 1913
1883 reg = reg_read(ohci, OHCI1394_SelfIDCount); 1914 reg = reg_read(ohci, OHCI1394_SelfIDCount);
1884 if (reg & OHCI1394_SelfIDCount_selfIDError) { 1915 if (reg & OHCI1394_SelfIDCount_selfIDError) {
1885 dev_notice(ohci->card.device, "inconsistent self IDs\n"); 1916 ohci_notice(ohci, "self ID receive error\n");
1886 return; 1917 return;
1887 } 1918 }
1888 /* 1919 /*
@@ -1894,7 +1925,7 @@ static void bus_reset_work(struct work_struct *work)
1894 self_id_count = (reg >> 3) & 0xff; 1925 self_id_count = (reg >> 3) & 0xff;
1895 1926
1896 if (self_id_count > 252) { 1927 if (self_id_count > 252) {
1897 dev_notice(ohci->card.device, "inconsistent self IDs\n"); 1928 ohci_notice(ohci, "bad selfIDSize (%08x)\n", reg);
1898 return; 1929 return;
1899 } 1930 }
1900 1931
@@ -1902,7 +1933,10 @@ static void bus_reset_work(struct work_struct *work)
1902 rmb(); 1933 rmb();
1903 1934
1904 for (i = 1, j = 0; j < self_id_count; i += 2, j++) { 1935 for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
1905 if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) { 1936 u32 id = cond_le32_to_cpu(ohci->self_id_cpu[i]);
1937 u32 id2 = cond_le32_to_cpu(ohci->self_id_cpu[i + 1]);
1938
1939 if (id != ~id2) {
1906 /* 1940 /*
1907 * If the invalid data looks like a cycle start packet, 1941 * If the invalid data looks like a cycle start packet,
1908 * it's likely to be the result of the cycle master 1942 * it's likely to be the result of the cycle master
@@ -1910,33 +1944,30 @@ static void bus_reset_work(struct work_struct *work)
1910 * so far are valid and should be processed so that the 1944 * so far are valid and should be processed so that the
1911 * bus manager can then correct the gap count. 1945 * bus manager can then correct the gap count.
1912 */ 1946 */
1913 if (cond_le32_to_cpu(ohci->self_id_cpu[i]) 1947 if (id == 0xffff008f) {
1914 == 0xffff008f) { 1948 ohci_notice(ohci, "ignoring spurious self IDs\n");
1915 dev_notice(ohci->card.device,
1916 "ignoring spurious self IDs\n");
1917 self_id_count = j; 1949 self_id_count = j;
1918 break; 1950 break;
1919 } else {
1920 dev_notice(ohci->card.device,
1921 "inconsistent self IDs\n");
1922 return;
1923 } 1951 }
1952
1953 ohci_notice(ohci, "bad self ID %d/%d (%08x != ~%08x)\n",
1954 j, self_id_count, id, id2);
1955 return;
1924 } 1956 }
1925 ohci->self_id_buffer[j] = 1957 ohci->self_id_buffer[j] = id;
1926 cond_le32_to_cpu(ohci->self_id_cpu[i]);
1927 } 1958 }
1928 1959
1929 if (ohci->quirks & QUIRK_TI_SLLZ059) { 1960 if (ohci->quirks & QUIRK_TI_SLLZ059) {
1930 self_id_count = find_and_insert_self_id(ohci, self_id_count); 1961 self_id_count = find_and_insert_self_id(ohci, self_id_count);
1931 if (self_id_count < 0) { 1962 if (self_id_count < 0) {
1932 dev_notice(ohci->card.device, 1963 ohci_notice(ohci,
1933 "could not construct local self ID\n"); 1964 "could not construct local self ID\n");
1934 return; 1965 return;
1935 } 1966 }
1936 } 1967 }
1937 1968
1938 if (self_id_count == 0) { 1969 if (self_id_count == 0) {
1939 dev_notice(ohci->card.device, "inconsistent self IDs\n"); 1970 ohci_notice(ohci, "no self IDs\n");
1940 return; 1971 return;
1941 } 1972 }
1942 rmb(); 1973 rmb();
@@ -1957,8 +1988,7 @@ static void bus_reset_work(struct work_struct *work)
1957 1988
1958 new_generation = (reg_read(ohci, OHCI1394_SelfIDCount) >> 16) & 0xff; 1989 new_generation = (reg_read(ohci, OHCI1394_SelfIDCount) >> 16) & 0xff;
1959 if (new_generation != generation) { 1990 if (new_generation != generation) {
1960 dev_notice(ohci->card.device, 1991 ohci_notice(ohci, "new bus reset, discarding self ids\n");
1961 "new bus reset, discarding self ids\n");
1962 return; 1992 return;
1963 } 1993 }
1964 1994
@@ -2096,7 +2126,7 @@ static irqreturn_t irq_handler(int irq, void *data)
2096 } 2126 }
2097 2127
2098 if (unlikely(event & OHCI1394_regAccessFail)) 2128 if (unlikely(event & OHCI1394_regAccessFail))
2099 dev_err(ohci->card.device, "register access failure\n"); 2129 ohci_err(ohci, "register access failure\n");
2100 2130
2101 if (unlikely(event & OHCI1394_postedWriteErr)) { 2131 if (unlikely(event & OHCI1394_postedWriteErr)) {
2102 reg_read(ohci, OHCI1394_PostedWriteAddressHi); 2132 reg_read(ohci, OHCI1394_PostedWriteAddressHi);
@@ -2104,13 +2134,12 @@ static irqreturn_t irq_handler(int irq, void *data)
2104 reg_write(ohci, OHCI1394_IntEventClear, 2134 reg_write(ohci, OHCI1394_IntEventClear,
2105 OHCI1394_postedWriteErr); 2135 OHCI1394_postedWriteErr);
2106 if (printk_ratelimit()) 2136 if (printk_ratelimit())
2107 dev_err(ohci->card.device, "PCI posted write error\n"); 2137 ohci_err(ohci, "PCI posted write error\n");
2108 } 2138 }
2109 2139
2110 if (unlikely(event & OHCI1394_cycleTooLong)) { 2140 if (unlikely(event & OHCI1394_cycleTooLong)) {
2111 if (printk_ratelimit()) 2141 if (printk_ratelimit())
2112 dev_notice(ohci->card.device, 2142 ohci_notice(ohci, "isochronous cycle too long\n");
2113 "isochronous cycle too long\n");
2114 reg_write(ohci, OHCI1394_LinkControlSet, 2143 reg_write(ohci, OHCI1394_LinkControlSet,
2115 OHCI1394_LinkControl_cycleMaster); 2144 OHCI1394_LinkControl_cycleMaster);
2116 } 2145 }
@@ -2123,8 +2152,7 @@ static irqreturn_t irq_handler(int irq, void *data)
2123 * them at least two cycles later. (FIXME?) 2152 * them at least two cycles later. (FIXME?)
2124 */ 2153 */
2125 if (printk_ratelimit()) 2154 if (printk_ratelimit())
2126 dev_notice(ohci->card.device, 2155 ohci_notice(ohci, "isochronous cycle inconsistent\n");
2127 "isochronous cycle inconsistent\n");
2128 } 2156 }
2129 2157
2130 if (unlikely(event & OHCI1394_unrecoverableError)) 2158 if (unlikely(event & OHCI1394_unrecoverableError))
@@ -2246,12 +2274,11 @@ static int ohci_enable(struct fw_card *card,
2246 const __be32 *config_rom, size_t length) 2274 const __be32 *config_rom, size_t length)
2247{ 2275{
2248 struct fw_ohci *ohci = fw_ohci(card); 2276 struct fw_ohci *ohci = fw_ohci(card);
2249 struct pci_dev *dev = to_pci_dev(card->device);
2250 u32 lps, version, irqs; 2277 u32 lps, version, irqs;
2251 int i, ret; 2278 int i, ret;
2252 2279
2253 if (software_reset(ohci)) { 2280 if (software_reset(ohci)) {
2254 dev_err(card->device, "failed to reset ohci card\n"); 2281 ohci_err(ohci, "failed to reset ohci card\n");
2255 return -EBUSY; 2282 return -EBUSY;
2256 } 2283 }
2257 2284
@@ -2262,20 +2289,31 @@ static int ohci_enable(struct fw_card *card,
2262 * will lock up the machine. Wait 50msec to make sure we have 2289 * will lock up the machine. Wait 50msec to make sure we have
2263 * full link enabled. However, with some cards (well, at least 2290 * full link enabled. However, with some cards (well, at least
2264 * a JMicron PCIe card), we have to try again sometimes. 2291 * a JMicron PCIe card), we have to try again sometimes.
2292 *
2293 * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but
2294 * cannot actually use the phy at that time. These need tens of
2295 * millisecods pause between LPS write and first phy access too.
2296 *
2297 * But do not wait for 50msec on Agere/LSI cards. Their phy
2298 * arbitration state machine may time out during such a long wait.
2265 */ 2299 */
2300
2266 reg_write(ohci, OHCI1394_HCControlSet, 2301 reg_write(ohci, OHCI1394_HCControlSet,
2267 OHCI1394_HCControl_LPS | 2302 OHCI1394_HCControl_LPS |
2268 OHCI1394_HCControl_postedWriteEnable); 2303 OHCI1394_HCControl_postedWriteEnable);
2269 flush_writes(ohci); 2304 flush_writes(ohci);
2270 2305
2271 for (lps = 0, i = 0; !lps && i < 3; i++) { 2306 if (!(ohci->quirks & QUIRK_PHY_LCTRL_TIMEOUT))
2272 msleep(50); 2307 msleep(50);
2308
2309 for (lps = 0, i = 0; !lps && i < 150; i++) {
2310 msleep(1);
2273 lps = reg_read(ohci, OHCI1394_HCControlSet) & 2311 lps = reg_read(ohci, OHCI1394_HCControlSet) &
2274 OHCI1394_HCControl_LPS; 2312 OHCI1394_HCControl_LPS;
2275 } 2313 }
2276 2314
2277 if (!lps) { 2315 if (!lps) {
2278 dev_err(card->device, "failed to set Link Power Status\n"); 2316 ohci_err(ohci, "failed to set Link Power Status\n");
2279 return -EIO; 2317 return -EIO;
2280 } 2318 }
2281 2319
@@ -2284,7 +2322,7 @@ static int ohci_enable(struct fw_card *card,
2284 if (ret < 0) 2322 if (ret < 0)
2285 return ret; 2323 return ret;
2286 if (ret) 2324 if (ret)
2287 dev_notice(card->device, "local TSB41BA3D phy\n"); 2325 ohci_notice(ohci, "local TSB41BA3D phy\n");
2288 else 2326 else
2289 ohci->quirks &= ~QUIRK_TI_SLLZ059; 2327 ohci->quirks &= ~QUIRK_TI_SLLZ059;
2290 } 2328 }
@@ -2382,24 +2420,6 @@ static int ohci_enable(struct fw_card *card,
2382 2420
2383 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); 2421 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000);
2384 2422
2385 if (!(ohci->quirks & QUIRK_NO_MSI))
2386 pci_enable_msi(dev);
2387 if (request_irq(dev->irq, irq_handler,
2388 pci_dev_msi_enabled(dev) ? 0 : IRQF_SHARED,
2389 ohci_driver_name, ohci)) {
2390 dev_err(card->device, "failed to allocate interrupt %d\n",
2391 dev->irq);
2392 pci_disable_msi(dev);
2393
2394 if (config_rom) {
2395 dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
2396 ohci->next_config_rom,
2397 ohci->next_config_rom_bus);
2398 ohci->next_config_rom = NULL;
2399 }
2400 return -EIO;
2401 }
2402
2403 irqs = OHCI1394_reqTxComplete | OHCI1394_respTxComplete | 2423 irqs = OHCI1394_reqTxComplete | OHCI1394_respTxComplete |
2404 OHCI1394_RQPkt | OHCI1394_RSPkt | 2424 OHCI1394_RQPkt | OHCI1394_RSPkt |
2405 OHCI1394_isochTx | OHCI1394_isochRx | 2425 OHCI1394_isochTx | OHCI1394_isochRx |
@@ -3578,20 +3598,20 @@ static int pci_probe(struct pci_dev *dev,
3578 3598
3579 if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM) || 3599 if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM) ||
3580 pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) { 3600 pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) {
3581 dev_err(&dev->dev, "invalid MMIO resource\n"); 3601 ohci_err(ohci, "invalid MMIO resource\n");
3582 err = -ENXIO; 3602 err = -ENXIO;
3583 goto fail_disable; 3603 goto fail_disable;
3584 } 3604 }
3585 3605
3586 err = pci_request_region(dev, 0, ohci_driver_name); 3606 err = pci_request_region(dev, 0, ohci_driver_name);
3587 if (err) { 3607 if (err) {
3588 dev_err(&dev->dev, "MMIO resource unavailable\n"); 3608 ohci_err(ohci, "MMIO resource unavailable\n");
3589 goto fail_disable; 3609 goto fail_disable;
3590 } 3610 }
3591 3611
3592 ohci->registers = pci_iomap(dev, 0, OHCI1394_REGISTER_SIZE); 3612 ohci->registers = pci_iomap(dev, 0, OHCI1394_REGISTER_SIZE);
3593 if (ohci->registers == NULL) { 3613 if (ohci->registers == NULL) {
3594 dev_err(&dev->dev, "failed to remap registers\n"); 3614 ohci_err(ohci, "failed to remap registers\n");
3595 err = -ENXIO; 3615 err = -ENXIO;
3596 goto fail_iomem; 3616 goto fail_iomem;
3597 } 3617 }
@@ -3675,19 +3695,33 @@ static int pci_probe(struct pci_dev *dev,
3675 guid = ((u64) reg_read(ohci, OHCI1394_GUIDHi) << 32) | 3695 guid = ((u64) reg_read(ohci, OHCI1394_GUIDHi) << 32) |
3676 reg_read(ohci, OHCI1394_GUIDLo); 3696 reg_read(ohci, OHCI1394_GUIDLo);
3677 3697
3698 if (!(ohci->quirks & QUIRK_NO_MSI))
3699 pci_enable_msi(dev);
3700 if (request_irq(dev->irq, irq_handler,
3701 pci_dev_msi_enabled(dev) ? 0 : IRQF_SHARED,
3702 ohci_driver_name, ohci)) {
3703 ohci_err(ohci, "failed to allocate interrupt %d\n", dev->irq);
3704 err = -EIO;
3705 goto fail_msi;
3706 }
3707
3678 err = fw_card_add(&ohci->card, max_receive, link_speed, guid); 3708 err = fw_card_add(&ohci->card, max_receive, link_speed, guid);
3679 if (err) 3709 if (err)
3680 goto fail_contexts; 3710 goto fail_irq;
3681 3711
3682 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; 3712 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff;
3683 dev_notice(&dev->dev, 3713 ohci_notice(ohci,
3684 "added OHCI v%x.%x device as card %d, " 3714 "added OHCI v%x.%x device as card %d, "
3685 "%d IR + %d IT contexts, quirks 0x%x\n", 3715 "%d IR + %d IT contexts, quirks 0x%x\n",
3686 version >> 16, version & 0xff, ohci->card.index, 3716 version >> 16, version & 0xff, ohci->card.index,
3687 ohci->n_ir, ohci->n_it, ohci->quirks); 3717 ohci->n_ir, ohci->n_it, ohci->quirks);
3688 3718
3689 return 0; 3719 return 0;
3690 3720
3721 fail_irq:
3722 free_irq(dev->irq, ohci);
3723 fail_msi:
3724 pci_disable_msi(dev);
3691 fail_contexts: 3725 fail_contexts:
3692 kfree(ohci->ir_context_list); 3726 kfree(ohci->ir_context_list);
3693 kfree(ohci->it_context_list); 3727 kfree(ohci->it_context_list);
@@ -3711,19 +3745,21 @@ static int pci_probe(struct pci_dev *dev,
3711 kfree(ohci); 3745 kfree(ohci);
3712 pmac_ohci_off(dev); 3746 pmac_ohci_off(dev);
3713 fail: 3747 fail:
3714 if (err == -ENOMEM)
3715 dev_err(&dev->dev, "out of memory\n");
3716
3717 return err; 3748 return err;
3718} 3749}
3719 3750
3720static void pci_remove(struct pci_dev *dev) 3751static void pci_remove(struct pci_dev *dev)
3721{ 3752{
3722 struct fw_ohci *ohci; 3753 struct fw_ohci *ohci = pci_get_drvdata(dev);
3723 3754
3724 ohci = pci_get_drvdata(dev); 3755 /*
3725 reg_write(ohci, OHCI1394_IntMaskClear, ~0); 3756 * If the removal is happening from the suspend state, LPS won't be
3726 flush_writes(ohci); 3757 * enabled and host registers (eg., IntMaskClear) won't be accessible.
3758 */
3759 if (reg_read(ohci, OHCI1394_HCControlSet) & OHCI1394_HCControl_LPS) {
3760 reg_write(ohci, OHCI1394_IntMaskClear, ~0);
3761 flush_writes(ohci);
3762 }
3727 cancel_work_sync(&ohci->bus_reset_work); 3763 cancel_work_sync(&ohci->bus_reset_work);
3728 fw_core_remove_card(&ohci->card); 3764 fw_core_remove_card(&ohci->card);
3729 3765
@@ -3766,16 +3802,14 @@ static int pci_suspend(struct pci_dev *dev, pm_message_t state)
3766 int err; 3802 int err;
3767 3803
3768 software_reset(ohci); 3804 software_reset(ohci);
3769 free_irq(dev->irq, ohci);
3770 pci_disable_msi(dev);
3771 err = pci_save_state(dev); 3805 err = pci_save_state(dev);
3772 if (err) { 3806 if (err) {
3773 dev_err(&dev->dev, "pci_save_state failed\n"); 3807 ohci_err(ohci, "pci_save_state failed\n");
3774 return err; 3808 return err;
3775 } 3809 }
3776 err = pci_set_power_state(dev, pci_choose_state(dev, state)); 3810 err = pci_set_power_state(dev, pci_choose_state(dev, state));
3777 if (err) 3811 if (err)
3778 dev_err(&dev->dev, "pci_set_power_state failed with %d\n", err); 3812 ohci_err(ohci, "pci_set_power_state failed with %d\n", err);
3779 pmac_ohci_off(dev); 3813 pmac_ohci_off(dev);
3780 3814
3781 return 0; 3815 return 0;
@@ -3791,7 +3825,7 @@ static int pci_resume(struct pci_dev *dev)
3791 pci_restore_state(dev); 3825 pci_restore_state(dev);
3792 err = pci_enable_device(dev); 3826 err = pci_enable_device(dev);
3793 if (err) { 3827 if (err) {
3794 dev_err(&dev->dev, "pci_enable_device failed\n"); 3828 ohci_err(ohci, "pci_enable_device failed\n");
3795 return err; 3829 return err;
3796 } 3830 }
3797 3831
@@ -3837,6 +3871,4 @@ MODULE_DESCRIPTION("Driver for PCI OHCI IEEE1394 controllers");
3837MODULE_LICENSE("GPL"); 3871MODULE_LICENSE("GPL");
3838 3872
3839/* Provide a module alias so root-on-sbp2 initrds don't break. */ 3873/* Provide a module alias so root-on-sbp2 initrds don't break. */
3840#ifndef CONFIG_IEEE1394_OHCI1394_MODULE
3841MODULE_ALIAS("ohci1394"); 3874MODULE_ALIAS("ohci1394");
3842#endif
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 1162d6b3bf85..47674b913843 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -1144,8 +1144,8 @@ static int sbp2_probe(struct device *dev)
1144 return -ENODEV; 1144 return -ENODEV;
1145 1145
1146 if (dma_get_max_seg_size(device->card->device) > SBP2_MAX_SEG_SIZE) 1146 if (dma_get_max_seg_size(device->card->device) > SBP2_MAX_SEG_SIZE)
1147 BUG_ON(dma_set_max_seg_size(device->card->device, 1147 WARN_ON(dma_set_max_seg_size(device->card->device,
1148 SBP2_MAX_SEG_SIZE)); 1148 SBP2_MAX_SEG_SIZE));
1149 1149
1150 shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); 1150 shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt));
1151 if (shost == NULL) 1151 if (shost == NULL)
@@ -1475,10 +1475,8 @@ static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1475 } 1475 }
1476 1476
1477 orb = kzalloc(sizeof(*orb), GFP_ATOMIC); 1477 orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
1478 if (orb == NULL) { 1478 if (orb == NULL)
1479 dev_notice(lu_dev(lu), "failed to alloc ORB\n");
1480 return SCSI_MLQUEUE_HOST_BUSY; 1479 return SCSI_MLQUEUE_HOST_BUSY;
1481 }
1482 1480
1483 /* Initialize rcode to something not RCODE_COMPLETE. */ 1481 /* Initialize rcode to something not RCODE_COMPLETE. */
1484 orb->base.rcode = -1; 1482 orb->base.rcode = -1;
@@ -1636,9 +1634,7 @@ MODULE_LICENSE("GPL");
1636MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table); 1634MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table);
1637 1635
1638/* Provide a module alias so root-on-sbp2 initrds don't break. */ 1636/* Provide a module alias so root-on-sbp2 initrds don't break. */
1639#ifndef CONFIG_IEEE1394_SBP2_MODULE
1640MODULE_ALIAS("sbp2"); 1637MODULE_ALIAS("sbp2");
1641#endif
1642 1638
1643static int __init sbp2_init(void) 1639static int __init sbp2_init(void)
1644{ 1640{