Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Mar 2012 03:31:15 +0000 (20:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Mar 2012 03:31:15 +0000 (20:31 -0700)
Pull IEEE 1394 (FireWire) subsystem updates post v3.3 from Stefan Richter:

 - Some SBP-2 initiator fixes, side product from ongoing work on a target.

 - Reintroduction of an isochronous I/O feature of the older ieee1394 driver
   stack (flush buffer completions); it was evidently rarely used but not
   actually unused.  Matching libraw1394 code is already available.

 - Be sure to prefix all kernel log messages with device name or card name,
   and other logging related cleanups.

 - Misc other small cleanups, among them a small API change that affects
   sound/firewire/ too. Clemens Ladisch is aware of it.

* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: (26 commits)
  firewire: allow explicit flushing of iso packet completions
  firewire: prevent dropping of completed iso packet header data
  firewire: ohci: factor out iso completion flushing code
  firewire: ohci: simplify iso header pointer arithmetic
  firewire: ohci: optimize control bit checks
  firewire: ohci: remove unused excess_bytes field
  firewire: ohci: copy_iso_headers(): make comment match the code
  firewire: cdev: fix IR multichannel event documentation
  firewire: ohci: fix too-early completion of IR multichannel buffers
  firewire: ohci: move runtime debug facility out of #ifdef
  firewire: tone down some diagnostic log messages
  firewire: sbp2: replace a GFP_ATOMIC allocation
  firewire: sbp2: Fix SCSI sense data mangling
  firewire: sbp2: Ignore SBP-2 targets on the local node
  firewire: sbp2: Take into account Unit_Unique_ID
  firewire: nosy: Use the macro DMA_BIT_MASK().
  firewire: core: convert AR-req handler lock from _irqsave to _bh
  firewire: core: fix race at address_handler unregistration
  firewire: core: remove obsolete comment
  firewire: core: prefix log messages with card name
  ...

1  2 
drivers/firewire/core-iso.c
drivers/firewire/ohci.c
drivers/firewire/sbp2.c
sound/firewire/isight.c
sound/firewire/speakers.c

@@@ -29,7 -29,6 +29,7 @@@
  #include <linux/slab.h>
  #include <linux/spinlock.h>
  #include <linux/vmalloc.h>
 +#include <linux/export.h>
  
  #include <asm/byteorder.h>
  
@@@ -192,6 -191,12 +192,12 @@@ void fw_iso_context_queue_flush(struct 
  }
  EXPORT_SYMBOL(fw_iso_context_queue_flush);
  
+ int fw_iso_context_flush_completions(struct fw_iso_context *ctx)
+ {
+       return ctx->card->driver->flush_iso_completions(ctx);
+ }
+ EXPORT_SYMBOL(fw_iso_context_flush_completions);
  int fw_iso_context_stop(struct fw_iso_context *ctx)
  {
        return ctx->card->driver->stop_iso(ctx);
diff --combined drivers/firewire/ohci.c
@@@ -170,10 -170,12 +170,12 @@@ struct context 
  struct iso_context {
        struct fw_iso_context base;
        struct context context;
-       int excess_bytes;
        void *header;
        size_t header_length;
+       unsigned long flushing_completions;
+       u32 mc_buffer_bus;
+       u16 mc_completed;
+       u16 last_timestamp;
        u8 sync;
        u8 tags;
  };
@@@ -263,7 -265,6 +265,7 @@@ static inline struct fw_ohci *fw_ohci(s
  static char ohci_driver_name[] = KBUILD_MODNAME;
  
  #define PCI_DEVICE_ID_AGERE_FW643     0x5901
 +#define PCI_DEVICE_ID_CREATIVE_SB1394 0x4001
  #define PCI_DEVICE_ID_JMICRON_JMB38X_FW       0x2380
  #define PCI_DEVICE_ID_TI_TSB12LV22    0x8009
  #define PCI_DEVICE_ID_TI_TSB12LV26    0x8020
@@@ -290,9 -291,6 +292,9 @@@ static const struct 
        {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
                QUIRK_NO_MSI},
  
 +      {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID,
 +              QUIRK_RESET_PACKET},
 +
        {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID,
                QUIRK_NO_MSI},
  
                QUIRK_NO_MSI},
  
        {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID,
 -              QUIRK_CYCLE_TIMER},
 +              QUIRK_CYCLE_TIMER | QUIRK_NO_MSI},
  
        {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID,
                QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A},
@@@ -338,8 -336,6 +340,6 @@@ MODULE_PARM_DESC(quirks, "Chip quirks (
  #define OHCI_PARAM_DEBUG_IRQS         4
  #define OHCI_PARAM_DEBUG_BUSRESETS    8 /* only effective before chip init */
  
- #ifdef CONFIG_FIREWIRE_OHCI_DEBUG
  static int param_debug;
  module_param_named(debug, param_debug, int, 0644);
  MODULE_PARM_DESC(debug, "Verbose logging (default = 0"
        ", busReset events = "  __stringify(OHCI_PARAM_DEBUG_BUSRESETS)
        ", or a combination, or all = -1)");
  
- static void log_irqs(u32 evt)
+ static void log_irqs(struct fw_ohci *ohci, u32 evt)
  {
        if (likely(!(param_debug &
                        (OHCI_PARAM_DEBUG_IRQS | OHCI_PARAM_DEBUG_BUSRESETS))))
            !(evt & OHCI1394_busReset))
                return;
  
-       fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
+       dev_notice(ohci->card.device,
+           "IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
            evt & OHCI1394_selfIDComplete       ? " selfID"             : "",
            evt & OHCI1394_RQPkt                ? " AR_req"             : "",
            evt & OHCI1394_RSPkt                ? " AR_resp"            : "",
@@@ -398,24 -395,29 +399,29 @@@ static char _p(u32 *s, int shift
        return port[*s >> shift & 3];
  }
  
- static void log_selfids(int node_id, int generation, int self_id_count, u32 *s)
+ static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count)
  {
+       u32 *s;
        if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS)))
                return;
  
-       fw_notify("%d selfIDs, generation %d, local node ID %04x\n",
-                 self_id_count, generation, node_id);
+       dev_notice(ohci->card.device,
+                  "%d selfIDs, generation %d, local node ID %04x\n",
+                  self_id_count, generation, ohci->node_id);
  
-       for (; self_id_count--; ++s)
+       for (s = ohci->self_id_buffer; self_id_count--; ++s)
                if ((*s & 1 << 23) == 0)
-                       fw_notify("selfID 0: %08x, phy %d [%c%c%c] "
+                       dev_notice(ohci->card.device,
+                           "selfID 0: %08x, phy %d [%c%c%c] "
                            "%s gc=%d %s %s%s%s\n",
                            *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2),
                            speed[*s >> 14 & 3], *s >> 16 & 63,
                            power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "",
                            *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : "");
                else
-                       fw_notify("selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n",
+                       dev_notice(ohci->card.device,
+                           "selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n",
                            *s, *s >> 24 & 63,
                            _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10),
                            _p(s,  8), _p(s,  6), _p(s,  4), _p(s,  2));
@@@ -451,7 -453,8 +457,8 @@@ static const char *tcodes[] = 
        [0xe] = "link internal",        [0xf] = "-reserved-",
  };
  
- static void log_ar_at_event(char dir, int speed, u32 *header, int evt)
+ static void log_ar_at_event(struct fw_ohci *ohci,
+                           char dir, int speed, u32 *header, int evt)
  {
        int tcode = header[0] >> 4 & 0xf;
        char specific[12];
                        evt = 0x1f;
  
        if (evt == OHCI1394_evt_bus_reset) {
-               fw_notify("A%c evt_bus_reset, generation %d\n",
-                   dir, (header[2] >> 16) & 0xff);
+               dev_notice(ohci->card.device,
+                          "A%c evt_bus_reset, generation %d\n",
+                          dir, (header[2] >> 16) & 0xff);
                return;
        }
  
  
        switch (tcode) {
        case 0xa:
-               fw_notify("A%c %s, %s\n", dir, evts[evt], tcodes[tcode]);
+               dev_notice(ohci->card.device,
+                          "A%c %s, %s\n",
+                          dir, evts[evt], tcodes[tcode]);
                break;
        case 0xe:
-               fw_notify("A%c %s, PHY %08x %08x\n",
-                         dir, evts[evt], header[1], header[2]);
+               dev_notice(ohci->card.device,
+                          "A%c %s, PHY %08x %08x\n",
+                          dir, evts[evt], header[1], header[2]);
                break;
        case 0x0: case 0x1: case 0x4: case 0x5: case 0x9:
-               fw_notify("A%c spd %x tl %02x, "
-                   "%04x -> %04x, %s, "
-                   "%s, %04x%08x%s\n",
-                   dir, speed, header[0] >> 10 & 0x3f,
-                   header[1] >> 16, header[0] >> 16, evts[evt],
-                   tcodes[tcode], header[1] & 0xffff, header[2], specific);
+               dev_notice(ohci->card.device,
+                          "A%c spd %x tl %02x, "
+                          "%04x -> %04x, %s, "
+                          "%s, %04x%08x%s\n",
+                          dir, speed, header[0] >> 10 & 0x3f,
+                          header[1] >> 16, header[0] >> 16, evts[evt],
+                          tcodes[tcode], header[1] & 0xffff, header[2], specific);
                break;
        default:
-               fw_notify("A%c spd %x tl %02x, "
-                   "%04x -> %04x, %s, "
-                   "%s%s\n",
-                   dir, speed, header[0] >> 10 & 0x3f,
-                   header[1] >> 16, header[0] >> 16, evts[evt],
-                   tcodes[tcode], specific);
+               dev_notice(ohci->card.device,
+                          "A%c spd %x tl %02x, "
+                          "%04x -> %04x, %s, "
+                          "%s%s\n",
+                          dir, speed, header[0] >> 10 & 0x3f,
+                          header[1] >> 16, header[0] >> 16, evts[evt],
+                          tcodes[tcode], specific);
        }
  }
  
- #else
- #define param_debug 0
- static inline void log_irqs(u32 evt) {}
- static inline void log_selfids(int node_id, int generation, int self_id_count, u32 *s) {}
- static inline void log_ar_at_event(char dir, int speed, u32 *header, int evt) {}
- #endif /* CONFIG_FIREWIRE_OHCI_DEBUG */
  static inline void reg_write(const struct fw_ohci *ohci, int offset, u32 data)
  {
        writel(data, ohci->registers + offset);
@@@ -559,7 -559,7 +563,7 @@@ static int read_phy_reg(struct fw_ohci 
                if (i >= 3)
                        msleep(1);
        }
-       fw_error("failed to read phy reg\n");
+       dev_err(ohci->card.device, "failed to read phy reg\n");
  
        return -EBUSY;
  }
@@@ -581,7 -581,7 +585,7 @@@ static int write_phy_reg(const struct f
                if (i >= 3)
                        msleep(1);
        }
-       fw_error("failed to write phy reg\n");
+       dev_err(ohci->card.device, "failed to write phy reg\n");
  
        return -EBUSY;
  }
@@@ -680,11 -680,14 +684,14 @@@ static void ar_context_release(struct a
  
  static void ar_context_abort(struct ar_context *ctx, const char *error_msg)
  {
-       if (reg_read(ctx->ohci, CONTROL_CLEAR(ctx->regs)) & CONTEXT_RUN) {
-               reg_write(ctx->ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN);
-               flush_writes(ctx->ohci);
+       struct fw_ohci *ohci = ctx->ohci;
+       if (reg_read(ohci, CONTROL_CLEAR(ctx->regs)) & CONTEXT_RUN) {
+               reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN);
+               flush_writes(ohci);
  
-               fw_error("AR error: %s; DMA stopped\n", error_msg);
+               dev_err(ohci->card.device, "AR error: %s; DMA stopped\n",
+                       error_msg);
        }
        /* FIXME: restart? */
  }
@@@ -854,7 -857,7 +861,7 @@@ static __le32 *handle_ar_packet(struct 
        p.timestamp  = status & 0xffff;
        p.generation = ohci->request_generation;
  
-       log_ar_at_event('R', p.speed, p.header, evt);
+       log_ar_at_event(ohci, 'R', p.speed, p.header, evt);
  
        /*
         * Several controllers, notably from NEC and VIA, forget to
@@@ -1226,21 -1229,22 +1233,22 @@@ static void context_append(struct conte
  
  static void context_stop(struct context *ctx)
  {
+       struct fw_ohci *ohci = ctx->ohci;
        u32 reg;
        int i;
  
-       reg_write(ctx->ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN);
+       reg_write(ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN);
        ctx->running = false;
  
        for (i = 0; i < 1000; i++) {
-               reg = reg_read(ctx->ohci, CONTROL_SET(ctx->regs));
+               reg = reg_read(ohci, CONTROL_SET(ctx->regs));
                if ((reg & CONTEXT_ACTIVE) == 0)
                        return;
  
                if (i)
                        udelay(10);
        }
-       fw_error("Error: DMA context still active (0x%08x)\n", reg);
+       dev_err(ohci->card.device, "DMA context still active (0x%08x)\n", reg);
  }
  
  struct driver_data {
@@@ -1420,7 -1424,7 +1428,7 @@@ static int handle_at_packet(struct cont
        evt = le16_to_cpu(last->transfer_status) & 0x1f;
        packet->timestamp = le16_to_cpu(last->res_count);
  
-       log_ar_at_event('T', packet->speed, packet->header, evt);
+       log_ar_at_event(ohci, 'T', packet->speed, packet->header, evt);
  
        switch (evt) {
        case OHCI1394_evt_timeout:
@@@ -1549,7 -1553,7 +1557,7 @@@ static void handle_local_lock(struct fw
                        goto out;
                }
  
-       fw_error("swap not done (CSR lock timeout)\n");
+       dev_err(ohci->card.device, "swap not done (CSR lock timeout)\n");
        fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0);
  
   out:
@@@ -1623,15 -1627,10 +1631,10 @@@ static void detect_dead_context(struct 
        u32 ctl;
  
        ctl = reg_read(ohci, CONTROL_SET(regs));
-       if (ctl & CONTEXT_DEAD) {
- #ifdef CONFIG_FIREWIRE_OHCI_DEBUG
-               fw_error("DMA context %s has stopped, error code: %s\n",
-                        name, evts[ctl & 0x1f]);
- #else
-               fw_error("DMA context %s has stopped, error code: %#x\n",
-                        name, ctl & 0x1f);
- #endif
-       }
+       if (ctl & CONTEXT_DEAD)
+               dev_err(ohci->card.device,
+                       "DMA context %s has stopped, error code: %s\n",
+                       name, evts[ctl & 0x1f]);
  }
  
  static void handle_dead_contexts(struct fw_ohci *ohci)
@@@ -1781,7 -1780,8 +1784,8 @@@ static int find_and_insert_self_id(stru
  
        reg = reg_read(ohci, OHCI1394_NodeID);
        if (!(reg & OHCI1394_NodeID_idValid)) {
-               fw_notify("node ID not valid, new bus reset in progress\n");
+               dev_notice(ohci->card.device,
+                          "node ID not valid, new bus reset in progress\n");
                return -EBUSY;
        }
        self_id |= ((reg & 0x3f) << 24); /* phy ID */
@@@ -1827,11 -1827,12 +1831,12 @@@ static void bus_reset_work(struct work_
  
        reg = reg_read(ohci, OHCI1394_NodeID);
        if (!(reg & OHCI1394_NodeID_idValid)) {
-               fw_notify("node ID not valid, new bus reset in progress\n");
+               dev_notice(ohci->card.device,
+                          "node ID not valid, new bus reset in progress\n");
                return;
        }
        if ((reg & OHCI1394_NodeID_nodeNumber) == 63) {
-               fw_notify("malconfigured bus\n");
+               dev_notice(ohci->card.device, "malconfigured bus\n");
                return;
        }
        ohci->node_id = reg & (OHCI1394_NodeID_busNumber |
  
        reg = reg_read(ohci, OHCI1394_SelfIDCount);
        if (reg & OHCI1394_SelfIDCount_selfIDError) {
-               fw_notify("inconsistent self IDs\n");
+               dev_notice(ohci->card.device, "inconsistent self IDs\n");
                return;
        }
        /*
        self_id_count = (reg >> 3) & 0xff;
  
        if (self_id_count > 252) {
-               fw_notify("inconsistent self IDs\n");
+               dev_notice(ohci->card.device, "inconsistent self IDs\n");
                return;
        }
  
                         */
                        if (cond_le32_to_cpu(ohci->self_id_cpu[i])
                                                        == 0xffff008f) {
-                               fw_notify("ignoring spurious self IDs\n");
+                               dev_notice(ohci->card.device,
+                                          "ignoring spurious self IDs\n");
                                self_id_count = j;
                                break;
                        } else {
-                               fw_notify("inconsistent self IDs\n");
+                               dev_notice(ohci->card.device,
+                                          "inconsistent self IDs\n");
                                return;
                        }
                }
        if (ohci->quirks & QUIRK_TI_SLLZ059) {
                self_id_count = find_and_insert_self_id(ohci, self_id_count);
                if (self_id_count < 0) {
-                       fw_notify("could not construct local self ID\n");
+                       dev_notice(ohci->card.device,
+                                  "could not construct local self ID\n");
                        return;
                }
        }
  
        if (self_id_count == 0) {
-               fw_notify("inconsistent self IDs\n");
+               dev_notice(ohci->card.device, "inconsistent self IDs\n");
                return;
        }
        rmb();
  
        new_generation = (reg_read(ohci, OHCI1394_SelfIDCount) >> 16) & 0xff;
        if (new_generation != generation) {
-               fw_notify("recursive bus reset detected, "
-                         "discarding self ids\n");
+               dev_notice(ohci->card.device,
+                          "new bus reset, discarding self ids\n");
                return;
        }
  
                dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
                                  free_rom, free_rom_bus);
  
-       log_selfids(ohci->node_id, generation,
-                   self_id_count, ohci->self_id_buffer);
+       log_selfids(ohci, generation, self_id_count);
  
        fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation,
                                 self_id_count, ohci->self_id_buffer,
@@@ -2015,7 -2018,7 +2022,7 @@@ static irqreturn_t irq_handler(int irq
         */
        reg_write(ohci, OHCI1394_IntEventClear,
                  event & ~(OHCI1394_busReset | OHCI1394_postedWriteErr));
-       log_irqs(event);
+       log_irqs(ohci, event);
  
        if (event & OHCI1394_selfIDComplete)
                queue_work(fw_workqueue, &ohci->bus_reset_work);
        }
  
        if (unlikely(event & OHCI1394_regAccessFail))
-               fw_error("Register access failure - "
-                        "please notify linux1394-devel@lists.sf.net\n");
+               dev_err(ohci->card.device, "register access failure\n");
  
        if (unlikely(event & OHCI1394_postedWriteErr)) {
                reg_read(ohci, OHCI1394_PostedWriteAddressHi);
                reg_write(ohci, OHCI1394_IntEventClear,
                          OHCI1394_postedWriteErr);
                if (printk_ratelimit())
-                       fw_error("PCI posted write error\n");
+                       dev_err(ohci->card.device, "PCI posted write error\n");
        }
  
        if (unlikely(event & OHCI1394_cycleTooLong)) {
                if (printk_ratelimit())
-                       fw_notify("isochronous cycle too long\n");
+                       dev_notice(ohci->card.device,
+                                  "isochronous cycle too long\n");
                reg_write(ohci, OHCI1394_LinkControlSet,
                          OHCI1394_LinkControl_cycleMaster);
        }
                 * them at least two cycles later.  (FIXME?)
                 */
                if (printk_ratelimit())
-                       fw_notify("isochronous cycle inconsistent\n");
+                       dev_notice(ohci->card.device,
+                                  "isochronous cycle inconsistent\n");
        }
  
        if (unlikely(event & OHCI1394_unrecoverableError))
@@@ -2211,7 -2215,7 +2219,7 @@@ static int ohci_enable(struct fw_card *
        int i, ret;
  
        if (software_reset(ohci)) {
-               fw_error("Failed to reset ohci card.\n");
+               dev_err(card->device, "failed to reset ohci card\n");
                return -EBUSY;
        }
  
        }
  
        if (!lps) {
-               fw_error("Failed to set Link Power Status\n");
+               dev_err(card->device, "failed to set Link Power Status\n");
                return -EIO;
        }
  
                if (ret < 0)
                        return ret;
                if (ret)
-                       fw_notify("local TSB41BA3D phy\n");
+                       dev_notice(card->device, "local TSB41BA3D phy\n");
                else
                        ohci->quirks &= ~QUIRK_TI_SLLZ059;
        }
        if (request_irq(dev->irq, irq_handler,
                        pci_dev_msi_enabled(dev) ? 0 : IRQF_SHARED,
                        ohci_driver_name, ohci)) {
-               fw_error("Failed to allocate interrupt %d.\n", dev->irq);
+               dev_err(card->device, "failed to allocate interrupt %d\n",
+                       dev->irq);
                pci_disable_msi(dev);
  
                if (config_rom) {
@@@ -2509,7 -2514,7 +2518,7 @@@ static int ohci_cancel_packet(struct fw
                dma_unmap_single(ohci->card.device, packet->payload_bus,
                                 packet->payload_length, DMA_TO_DEVICE);
  
-       log_ar_at_event('T', packet->speed, packet->header, 0x20);
+       log_ar_at_event(ohci, 'T', packet->speed, packet->header, 0x20);
        driver_data->packet = NULL;
        packet->ack = RCODE_CANCELLED;
        packet->callback(packet, &ohci->card, packet->ack);
@@@ -2674,25 -2679,35 +2683,35 @@@ static void ohci_write_csr(struct fw_ca
        }
  }
  
- static void copy_iso_headers(struct iso_context *ctx, void *p)
+ static void flush_iso_completions(struct iso_context *ctx)
  {
-       int i = ctx->header_length;
+       ctx->base.callback.sc(&ctx->base, ctx->last_timestamp,
+                             ctx->header_length, ctx->header,
+                             ctx->base.callback_data);
+       ctx->header_length = 0;
+ }
  
-       if (i + ctx->base.header_size > PAGE_SIZE)
-               return;
+ static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr)
+ {
+       u32 *ctx_hdr;
+       if (ctx->header_length + ctx->base.header_size > PAGE_SIZE)
+               flush_iso_completions(ctx);
+       ctx_hdr = ctx->header + ctx->header_length;
+       ctx->last_timestamp = (u16)le32_to_cpu((__force __le32)dma_hdr[0]);
  
        /*
-        * The iso header is byteswapped to little endian by
-        * the controller, but the remaining header quadlets
-        * are big endian.  We want to present all the headers
-        * as big endian, so we have to swap the first quadlet.
+        * The two iso header quadlets are byteswapped to little
+        * endian by the controller, but we want to present them
+        * as big endian for consistency with the bus endianness.
         */
        if (ctx->base.header_size > 0)
-               *(u32 *) (ctx->header + i) = __swab32(*(u32 *) (p + 4));
+               ctx_hdr[0] = swab32(dma_hdr[1]); /* iso packet header */
        if (ctx->base.header_size > 4)
-               *(u32 *) (ctx->header + i + 4) = __swab32(*(u32 *) p);
+               ctx_hdr[1] = swab32(dma_hdr[0]); /* timestamp */
        if (ctx->base.header_size > 8)
-               memcpy(ctx->header + i + 8, p + 8, ctx->base.header_size - 8);
+               memcpy(&ctx_hdr[2], &dma_hdr[2], ctx->base.header_size - 8);
        ctx->header_length += ctx->base.header_size;
  }
  
@@@ -2704,8 -2719,6 +2723,6 @@@ static int handle_ir_packet_per_buffer(
                container_of(context, struct iso_context, context);
        struct descriptor *pd;
        u32 buffer_dma;
-       __le32 *ir_header;
-       void *p;
  
        for (pd = d; pd <= last; pd++)
                if (pd->transfer_status)
                                              DMA_FROM_DEVICE);
        }
  
-       p = last + 1;
-       copy_iso_headers(ctx, p);
+       copy_iso_headers(ctx, (u32 *) (last + 1));
  
-       if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) {
-               ir_header = (__le32 *) p;
-               ctx->base.callback.sc(&ctx->base,
-                                     le32_to_cpu(ir_header[0]) & 0xffff,
-                                     ctx->header_length, ctx->header,
-                                     ctx->base.callback_data);
-               ctx->header_length = 0;
-       }
+       if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS))
+               flush_iso_completions(ctx);
  
        return 1;
  }
@@@ -2746,29 -2752,51 +2756,51 @@@ static int handle_ir_buffer_fill(struc
  {
        struct iso_context *ctx =
                container_of(context, struct iso_context, context);
+       unsigned int req_count, res_count, completed;
        u32 buffer_dma;
  
-       if (!last->transfer_status)
+       req_count = le16_to_cpu(last->req_count);
+       res_count = le16_to_cpu(ACCESS_ONCE(last->res_count));
+       completed = req_count - res_count;
+       buffer_dma = le32_to_cpu(last->data_address);
+       if (completed > 0) {
+               ctx->mc_buffer_bus = buffer_dma;
+               ctx->mc_completed = completed;
+       }
+       if (res_count != 0)
                /* Descriptor(s) not done yet, stop iteration */
                return 0;
  
-       buffer_dma = le32_to_cpu(last->data_address);
        dma_sync_single_range_for_cpu(context->ohci->card.device,
                                      buffer_dma & PAGE_MASK,
                                      buffer_dma & ~PAGE_MASK,
-                                     le16_to_cpu(last->req_count),
-                                     DMA_FROM_DEVICE);
+                                     completed, DMA_FROM_DEVICE);
  
-       if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS)
+       if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) {
                ctx->base.callback.mc(&ctx->base,
-                                     le32_to_cpu(last->data_address) +
-                                     le16_to_cpu(last->req_count) -
-                                     le16_to_cpu(last->res_count),
+                                     buffer_dma + completed,
                                      ctx->base.callback_data);
+               ctx->mc_completed = 0;
+       }
  
        return 1;
  }
  
+ static void flush_ir_buffer_fill(struct iso_context *ctx)
+ {
+       dma_sync_single_range_for_cpu(ctx->context.ohci->card.device,
+                                     ctx->mc_buffer_bus & PAGE_MASK,
+                                     ctx->mc_buffer_bus & ~PAGE_MASK,
+                                     ctx->mc_completed, DMA_FROM_DEVICE);
+       ctx->base.callback.mc(&ctx->base,
+                             ctx->mc_buffer_bus + ctx->mc_completed,
+                             ctx->base.callback_data);
+       ctx->mc_completed = 0;
+ }
  static inline void sync_it_packet_for_cpu(struct context *context,
                                          struct descriptor *pd)
  {
@@@ -2812,8 -2840,8 +2844,8 @@@ static int handle_it_packet(struct cont
  {
        struct iso_context *ctx =
                container_of(context, struct iso_context, context);
-       int i;
        struct descriptor *pd;
+       __be32 *ctx_hdr;
  
        for (pd = d; pd <= last; pd++)
                if (pd->transfer_status)
  
        sync_it_packet_for_cpu(context, d);
  
-       i = ctx->header_length;
-       if (i + 4 < PAGE_SIZE) {
-               /* Present this value as big-endian to match the receive code */
-               *(__be32 *)(ctx->header + i) = cpu_to_be32(
-                               ((u32)le16_to_cpu(pd->transfer_status) << 16) |
-                               le16_to_cpu(pd->res_count));
-               ctx->header_length += 4;
-       }
-       if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) {
-               ctx->base.callback.sc(&ctx->base, le16_to_cpu(last->res_count),
-                                     ctx->header_length, ctx->header,
-                                     ctx->base.callback_data);
-               ctx->header_length = 0;
-       }
+       if (ctx->header_length + 4 > PAGE_SIZE)
+               flush_iso_completions(ctx);
+       ctx_hdr = ctx->header + ctx->header_length;
+       ctx->last_timestamp = le16_to_cpu(last->res_count);
+       /* Present this value as big-endian to match the receive code */
+       *ctx_hdr = cpu_to_be32((le16_to_cpu(pd->transfer_status) << 16) |
+                              le16_to_cpu(pd->res_count));
+       ctx->header_length += 4;
+       if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS))
+               flush_iso_completions(ctx);
        return 1;
  }
  
@@@ -2924,8 -2951,10 +2955,10 @@@ static struct fw_iso_context *ohci_allo
        if (ret < 0)
                goto out_with_header;
  
-       if (type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
+       if (type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) {
                set_multichannel_mask(ohci, 0);
+               ctx->mc_completed = 0;
+       }
  
        return &ctx->base;
  
@@@ -3387,6 -3416,39 +3420,39 @@@ static void ohci_flush_queue_iso(struc
        reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE);
  }
  
+ static int ohci_flush_iso_completions(struct fw_iso_context *base)
+ {
+       struct iso_context *ctx = container_of(base, struct iso_context, base);
+       int ret = 0;
+       tasklet_disable(&ctx->context.tasklet);
+       if (!test_and_set_bit_lock(0, &ctx->flushing_completions)) {
+               context_tasklet((unsigned long)&ctx->context);
+               switch (base->type) {
+               case FW_ISO_CONTEXT_TRANSMIT:
+               case FW_ISO_CONTEXT_RECEIVE:
+                       if (ctx->header_length != 0)
+                               flush_iso_completions(ctx);
+                       break;
+               case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
+                       if (ctx->mc_completed != 0)
+                               flush_ir_buffer_fill(ctx);
+                       break;
+               default:
+                       ret = -ENOSYS;
+               }
+               clear_bit_unlock(0, &ctx->flushing_completions);
+               smp_mb__after_clear_bit();
+       }
+       tasklet_enable(&ctx->context.tasklet);
+       return ret;
+ }
  static const struct fw_card_driver ohci_driver = {
        .enable                 = ohci_enable,
        .read_phy_reg           = ohci_read_phy_reg,
        .set_iso_channels       = ohci_set_iso_channels,
        .queue_iso              = ohci_queue_iso,
        .flush_queue_iso        = ohci_flush_queue_iso,
+       .flush_iso_completions  = ohci_flush_iso_completions,
        .start_iso              = ohci_start_iso,
        .stop_iso               = ohci_stop_iso,
  };
@@@ -3463,7 -3526,7 +3530,7 @@@ static int __devinit pci_probe(struct p
  
        err = pci_enable_device(dev);
        if (err) {
-               fw_error("Failed to enable OHCI hardware\n");
+               dev_err(&dev->dev, "failed to enable OHCI hardware\n");
                goto fail_free;
        }
  
  
        err = pci_request_region(dev, 0, ohci_driver_name);
        if (err) {
-               fw_error("MMIO resource unavailable\n");
+               dev_err(&dev->dev, "MMIO resource unavailable\n");
                goto fail_disable;
        }
  
        ohci->registers = pci_iomap(dev, 0, OHCI1394_REGISTER_SIZE);
        if (ohci->registers == NULL) {
-               fw_error("Failed to remap registers\n");
+               dev_err(&dev->dev, "failed to remap registers\n");
                err = -ENXIO;
                goto fail_iomem;
        }
                goto fail_contexts;
  
        version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff;
-       fw_notify("Added fw-ohci device %s, OHCI v%x.%x, "
+       dev_notice(&dev->dev,
+                 "added OHCI v%x.%x device as card %d, "
                  "%d IR + %d IT contexts, quirks 0x%x\n",
-                 dev_name(&dev->dev), version >> 16, version & 0xff,
+                 version >> 16, version & 0xff, ohci->card.index,
                  ohci->n_ir, ohci->n_it, ohci->quirks);
  
        return 0;
        pmac_ohci_off(dev);
   fail:
        if (err == -ENOMEM)
-               fw_error("Out of memory\n");
+               dev_err(&dev->dev, "out of memory\n");
  
        return err;
  }
@@@ -3648,7 -3712,7 +3716,7 @@@ static void pci_remove(struct pci_dev *
        kfree(ohci);
        pmac_ohci_off(dev);
  
-       fw_notify("Removed fw-ohci device.\n");
+       dev_notice(&dev->dev, "removed fw-ohci device\n");
  }
  
  #ifdef CONFIG_PM
@@@ -3662,12 -3726,12 +3730,12 @@@ static int pci_suspend(struct pci_dev *
        pci_disable_msi(dev);
        err = pci_save_state(dev);
        if (err) {
-               fw_error("pci_save_state failed\n");
+               dev_err(&dev->dev, "pci_save_state failed\n");
                return err;
        }
        err = pci_set_power_state(dev, pci_choose_state(dev, state));
        if (err)
-               fw_error("pci_set_power_state failed with %d\n", err);
+               dev_err(&dev->dev, "pci_set_power_state failed with %d\n", err);
        pmac_ohci_off(dev);
  
        return 0;
@@@ -3683,7 -3747,7 +3751,7 @@@ static int pci_resume(struct pci_dev *d
        pci_restore_state(dev);
        err = pci_enable_device(dev);
        if (err) {
-               fw_error("pci_enable_device failed\n");
+               dev_err(&dev->dev, "pci_enable_device failed\n");
                return err;
        }
  
diff --combined drivers/firewire/sbp2.c
@@@ -66,7 -66,7 +66,7 @@@
   *
   * Concurrent logins are useful together with cluster filesystems.
   */
 -static int sbp2_param_exclusive_login = 1;
 +static bool sbp2_param_exclusive_login = 1;
  module_param_named(exclusive_login, sbp2_param_exclusive_login, bool, 0644);
  MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device "
                 "(default = Y, use N for concurrent initiators)");
@@@ -125,8 -125,6 +125,6 @@@ MODULE_PARM_DESC(workarounds, "Work aro
        ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
        ", or a combination)");
  
- static const char sbp2_driver_name[] = "sbp2";
  /*
   * We create one struct sbp2_logical_unit per SBP-2 Logical Unit Number Entry
   * and one struct scsi_device per sbp2_logical_unit.
@@@ -165,7 -163,6 +163,6 @@@ static void sbp2_queue_work(struct sbp2
   */
  struct sbp2_target {
        struct fw_unit *unit;
-       const char *bus_id;
        struct list_head lu_list;
  
        u64 management_agent_address;
        int blocked;    /* ditto */
  };
  
- static struct fw_device *target_device(struct sbp2_target *tgt)
+ static struct fw_device *target_parent_device(struct sbp2_target *tgt)
  {
        return fw_parent_device(tgt->unit);
  }
  
+ static const struct device *tgt_dev(const struct sbp2_target *tgt)
+ {
+       return &tgt->unit->device;
+ }
+ static const struct device *lu_dev(const struct sbp2_logical_unit *lu)
+ {
+       return &lu->tgt->unit->device;
+ }
  /* Impossible login_id, to detect logout attempt before successful login */
  #define INVALID_LOGIN_ID 0x10000
  
  #define SBP2_CSR_UNIT_CHARACTERISTICS 0x3a
  #define SBP2_CSR_FIRMWARE_REVISION    0x3c
  #define SBP2_CSR_LOGICAL_UNIT_NUMBER  0x14
+ #define SBP2_CSR_UNIT_UNIQUE_ID               0x8d
  #define SBP2_CSR_LOGICAL_UNIT_DIRECTORY       0xd4
  
  /* Management orb opcodes */
@@@ -430,7 -438,8 +438,8 @@@ static void sbp2_status_write(struct fw
                memcpy(status.data, payload + 8, length - 8);
  
        if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) {
-               fw_notify("non-orb related status write, not handled\n");
+               dev_notice(lu_dev(lu),
+                          "non-ORB related status write, not handled\n");
                fw_send_response(card, request, RCODE_COMPLETE);
                return;
        }
                orb->callback(orb, &status);
                kref_put(&orb->kref, free_orb); /* orb callback reference */
        } else {
-               fw_error("status write for unknown orb\n");
+               dev_err(lu_dev(lu), "status write for unknown ORB\n");
        }
  
        fw_send_response(card, request, RCODE_COMPLETE);
@@@ -492,7 -501,7 +501,7 @@@ static void complete_transaction(struc
  static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
                          int node_id, int generation, u64 offset)
  {
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        struct sbp2_pointer orb_pointer;
        unsigned long flags;
  
  
  static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
  {
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        struct sbp2_orb *orb, *next;
        struct list_head list;
        unsigned long flags;
@@@ -552,7 -561,7 +561,7 @@@ static int sbp2_send_management_orb(str
                                    int generation, int function,
                                    int lun_or_login_id, void *response)
  {
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        struct sbp2_management_orb *orb;
        unsigned int timeout;
        int retval = -ENOMEM;
        if (function == SBP2_LOGOUT_REQUEST && fw_device_is_shutdown(device))
                return 0;
  
-       orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
+       orb = kzalloc(sizeof(*orb), GFP_NOIO);
        if (orb == NULL)
                return -ENOMEM;
  
  
        retval = -EIO;
        if (sbp2_cancel_orbs(lu) == 0) {
-               fw_error("%s: orb reply timed out, rcode=0x%02x\n",
-                        lu->tgt->bus_id, orb->base.rcode);
+               dev_err(lu_dev(lu), "ORB reply timed out, rcode 0x%02x\n",
+                       orb->base.rcode);
                goto out;
        }
  
        if (orb->base.rcode != RCODE_COMPLETE) {
-               fw_error("%s: management write failed, rcode 0x%02x\n",
-                        lu->tgt->bus_id, orb->base.rcode);
+               dev_err(lu_dev(lu), "management write failed, rcode 0x%02x\n",
+                       orb->base.rcode);
                goto out;
        }
  
        if (STATUS_GET_RESPONSE(orb->status) != 0 ||
            STATUS_GET_SBP_STATUS(orb->status) != 0) {
-               fw_error("%s: error status: %d:%d\n", lu->tgt->bus_id,
+               dev_err(lu_dev(lu), "error status: %d:%d\n",
                         STATUS_GET_RESPONSE(orb->status),
                         STATUS_GET_SBP_STATUS(orb->status));
                goto out;
  
  static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
  {
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        __be32 d = 0;
  
        fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@@ -665,7 -674,7 +674,7 @@@ static void complete_agent_reset_write_
  
  static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
  {
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        struct fw_transaction *t;
        static __be32 d;
  
@@@ -704,7 -713,7 +713,7 @@@ static inline void sbp2_allow_block(str
  static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
  {
        struct sbp2_target *tgt = lu->tgt;
-       struct fw_card *card = target_device(tgt)->card;
+       struct fw_card *card = target_parent_device(tgt)->card;
        struct Scsi_Host *shost =
                container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
        unsigned long flags;
  static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
  {
        struct sbp2_target *tgt = lu->tgt;
-       struct fw_card *card = target_device(tgt)->card;
+       struct fw_card *card = target_parent_device(tgt)->card;
        struct Scsi_Host *shost =
                container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
        unsigned long flags;
   */
  static void sbp2_unblock(struct sbp2_target *tgt)
  {
-       struct fw_card *card = target_device(tgt)->card;
+       struct fw_card *card = target_parent_device(tgt)->card;
        struct Scsi_Host *shost =
                container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
        unsigned long flags;
@@@ -794,7 -803,7 +803,7 @@@ static int sbp2_lun2int(u16 lun
   */
  static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
  {
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        __be32 d = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT);
  
        fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@@ -809,7 -818,7 +818,7 @@@ static void sbp2_login(struct work_stru
        struct sbp2_logical_unit *lu =
                container_of(work, struct sbp2_logical_unit, work.work);
        struct sbp2_target *tgt = lu->tgt;
-       struct fw_device *device = target_device(tgt);
+       struct fw_device *device = target_parent_device(tgt);
        struct Scsi_Host *shost;
        struct scsi_device *sdev;
        struct sbp2_login_response response;
                if (lu->retries++ < 5) {
                        sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
                } else {
-                       fw_error("%s: failed to login to LUN %04x\n",
-                                tgt->bus_id, lu->lun);
+                       dev_err(tgt_dev(tgt), "failed to login to LUN %04x\n",
+                               lu->lun);
                        /* Let any waiting I/O fail from now on. */
                        sbp2_unblock(lu->tgt);
                }
                      << 32) | be32_to_cpu(response.command_block_agent.low);
        lu->login_id = be32_to_cpu(response.misc) & 0xffff;
  
-       fw_notify("%s: logged in to LUN %04x (%d retries)\n",
-                 tgt->bus_id, lu->lun, lu->retries);
+       dev_notice(tgt_dev(tgt), "logged in to LUN %04x (%d retries)\n",
+                  lu->lun, lu->retries);
  
        /* set appropriate retry limit(s) in BUSY_TIMEOUT register */
        sbp2_set_busy_timeout(lu);
@@@ -919,7 -928,7 +928,7 @@@ static void sbp2_reconnect(struct work_
        struct sbp2_logical_unit *lu =
                container_of(work, struct sbp2_logical_unit, work.work);
        struct sbp2_target *tgt = lu->tgt;
-       struct fw_device *device = target_device(tgt);
+       struct fw_device *device = target_parent_device(tgt);
        int generation, node_id, local_node_id;
  
        if (fw_device_is_shutdown(device))
                smp_rmb(); /* get current card generation */
                if (generation == device->card->generation ||
                    lu->retries++ >= 5) {
-                       fw_error("%s: failed to reconnect\n", tgt->bus_id);
+                       dev_err(tgt_dev(tgt), "failed to reconnect\n");
                        lu->retries = 0;
                        PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
                }
        smp_wmb();        /* node IDs must not be older than generation */
        lu->generation    = generation;
  
-       fw_notify("%s: reconnected to LUN %04x (%d retries)\n",
-                 tgt->bus_id, lu->lun, lu->retries);
+       dev_notice(tgt_dev(tgt), "reconnected to LUN %04x (%d retries)\n",
+                  lu->lun, lu->retries);
  
        sbp2_agent_reset(lu);
        sbp2_cancel_orbs(lu);
@@@ -997,6 -1006,13 +1006,13 @@@ static int sbp2_add_logical_unit(struc
        return 0;
  }
  
+ static void sbp2_get_unit_unique_id(struct sbp2_target *tgt,
+                                   const u32 *leaf)
+ {
+       if ((leaf[0] & 0xffff0000) == 0x00020000)
+               tgt->guid = (u64)leaf[1] << 32 | leaf[2];
+ }
  static int sbp2_scan_logical_unit_dir(struct sbp2_target *tgt,
                                      const u32 *directory)
  {
@@@ -1048,6 -1064,10 +1064,10 @@@ static int sbp2_scan_unit_dir(struct sb
                                return -ENOMEM;
                        break;
  
+               case SBP2_CSR_UNIT_UNIQUE_ID:
+                       sbp2_get_unit_unique_id(tgt, ci.p - 1 + value);
+                       break;
                case SBP2_CSR_LOGICAL_UNIT_DIRECTORY:
                        /* Adjust for the increment in the iterator */
                        if (sbp2_scan_logical_unit_dir(tgt, ci.p - 1 + value) < 0)
@@@ -1068,8 -1088,8 +1088,8 @@@ static void sbp2_clamp_management_orb_t
        unsigned int timeout = tgt->mgt_orb_timeout;
  
        if (timeout > 40000)
-               fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n",
-                         tgt->bus_id, timeout / 1000);
+               dev_notice(tgt_dev(tgt), "%ds mgt_ORB_timeout limited to 40s\n",
+                          timeout / 1000);
  
        tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000);
  }
@@@ -1081,9 -1101,9 +1101,9 @@@ static void sbp2_init_workarounds(struc
        unsigned int w = sbp2_param_workarounds;
  
        if (w)
-               fw_notify("Please notify linux1394-devel@lists.sourceforge.net "
-                         "if you need the workarounds parameter for %s\n",
-                         tgt->bus_id);
+               dev_notice(tgt_dev(tgt),
+                          "Please notify linux1394-devel@lists.sf.net "
+                          "if you need the workarounds parameter\n");
  
        if (w & SBP2_WORKAROUND_OVERRIDE)
                goto out;
        }
   out:
        if (w)
-               fw_notify("Workarounds for %s: 0x%x "
-                         "(firmware_revision 0x%06x, model_id 0x%06x)\n",
-                         tgt->bus_id, w, firmware_revision, model);
+               dev_notice(tgt_dev(tgt), "workarounds 0x%x "
+                          "(firmware_revision 0x%06x, model_id 0x%06x)\n",
+                          w, firmware_revision, model);
        tgt->workarounds = w;
  }
  
@@@ -1121,6 -1141,10 +1141,10 @@@ static int sbp2_probe(struct device *de
        struct Scsi_Host *shost;
        u32 model, firmware_revision;
  
+       /* cannot (or should not) handle targets on the local node */
+       if (device->is_local)
+               return -ENODEV;
        if (dma_get_max_seg_size(device->card->device) > SBP2_MAX_SEG_SIZE)
                BUG_ON(dma_set_max_seg_size(device->card->device,
                                            SBP2_MAX_SEG_SIZE));
        dev_set_drvdata(&unit->device, tgt);
        tgt->unit = unit;
        INIT_LIST_HEAD(&tgt->lu_list);
-       tgt->bus_id = dev_name(&unit->device);
        tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4];
  
        if (fw_device_enable_phys_dma(device) < 0)
@@@ -1239,7 -1262,7 +1262,7 @@@ static int sbp2_remove(struct device *d
                kfree(lu);
        }
        scsi_remove_host(shost);
-       fw_notify("released %s, target %d:0:0\n", tgt->bus_id, shost->host_no);
+       dev_notice(dev, "released target %d:0:0\n", shost->host_no);
  
        scsi_host_put(shost);
        return 0;
@@@ -1261,7 -1284,7 +1284,7 @@@ static const struct ieee1394_device_id 
  static struct fw_driver sbp2_driver = {
        .driver   = {
                .owner  = THIS_MODULE,
-               .name   = sbp2_driver_name,
+               .name   = KBUILD_MODNAME,
                .bus    = &fw_bus_type,
                .probe  = sbp2_probe,
                .remove = sbp2_remove,
@@@ -1286,10 -1309,19 +1309,19 @@@ static void sbp2_unmap_scatterlist(stru
  static unsigned int sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
  {
        int sam_status;
+       int sfmt = (sbp2_status[0] >> 6) & 0x03;
+       if (sfmt == 2 || sfmt == 3) {
+               /*
+                * Reserved for future standardization (2) or
+                * Status block format vendor-dependent (3)
+                */
+               return DID_ERROR << 16;
+       }
  
-       sense_data[0] = 0x70;
+       sense_data[0] = 0x70 | sfmt | (sbp2_status[1] & 0x80);
        sense_data[1] = 0x0;
-       sense_data[2] = sbp2_status[1];
+       sense_data[2] = ((sbp2_status[1] << 1) & 0xe0) | (sbp2_status[1] & 0x0f);
        sense_data[3] = sbp2_status[4];
        sense_data[4] = sbp2_status[5];
        sense_data[5] = sbp2_status[6];
@@@ -1325,7 -1357,7 +1357,7 @@@ static void complete_command_orb(struc
  {
        struct sbp2_command_orb *orb =
                container_of(base_orb, struct sbp2_command_orb, base);
-       struct fw_device *device = target_device(orb->lu->tgt);
+       struct fw_device *device = target_parent_device(orb->lu->tgt);
        int result;
  
        if (status != NULL) {
@@@ -1433,7 -1465,7 +1465,7 @@@ static int sbp2_scsi_queuecommand(struc
                                  struct scsi_cmnd *cmd)
  {
        struct sbp2_logical_unit *lu = cmd->device->hostdata;
-       struct fw_device *device = target_device(lu->tgt);
+       struct fw_device *device = target_parent_device(lu->tgt);
        struct sbp2_command_orb *orb;
        int generation, retval = SCSI_MLQUEUE_HOST_BUSY;
  
         * transfer direction not handled.
         */
        if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) {
-               fw_error("Can't handle DMA_BIDIRECTIONAL, rejecting command\n");
+               dev_err(lu_dev(lu), "cannot handle bidirectional command\n");
                cmd->result = DID_ERROR << 16;
                cmd->scsi_done(cmd);
                return 0;
  
        orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
        if (orb == NULL) {
-               fw_notify("failed to alloc orb\n");
+               dev_notice(lu_dev(lu), "failed to alloc ORB\n");
                return SCSI_MLQUEUE_HOST_BUSY;
        }
  
@@@ -1550,7 -1582,7 +1582,7 @@@ static int sbp2_scsi_abort(struct scsi_
  {
        struct sbp2_logical_unit *lu = cmd->device->hostdata;
  
-       fw_notify("%s: sbp2_scsi_abort\n", lu->tgt->bus_id);
+       dev_notice(lu_dev(lu), "sbp2_scsi_abort\n");
        sbp2_agent_reset(lu);
        sbp2_cancel_orbs(lu);
  
@@@ -1590,7 -1622,7 +1622,7 @@@ static struct device_attribute *sbp2_sc
  static struct scsi_host_template scsi_driver_template = {
        .module                 = THIS_MODULE,
        .name                   = "SBP-2 IEEE-1394",
-       .proc_name              = sbp2_driver_name,
+       .proc_name              = "sbp2",
        .queuecommand           = sbp2_scsi_queuecommand,
        .slave_alloc            = sbp2_scsi_slave_alloc,
        .slave_configure        = sbp2_scsi_slave_configure,
diff --combined sound/firewire/isight.c
@@@ -51,6 -51,7 +51,6 @@@ struct isight 
        struct fw_unit *unit;
        struct fw_device *device;
        u64 audio_base;
 -      struct fw_address_handler iris_handler;
        struct snd_pcm_substream *pcm;
        struct mutex mutex;
        struct iso_packets_buffer buffer;
@@@ -611,7 -612,6 +611,6 @@@ static void isight_card_free(struct snd
  
        fw_iso_resources_destroy(&isight->resources);
        fw_unit_put(isight->unit);
-       fw_device_put(isight->device);
        mutex_destroy(&isight->mutex);
  }
  
@@@ -644,7 -644,7 +643,7 @@@ static int isight_probe(struct device *
        isight->card = card;
        mutex_init(&isight->mutex);
        isight->unit = fw_unit_get(unit);
-       isight->device = fw_device_get(fw_dev);
+       isight->device = fw_dev;
        isight->audio_base = get_unit_base(unit);
        if (!isight->audio_base) {
                dev_err(&unit->device, "audio unit base not found\n");
  
  err_unit:
        fw_unit_put(isight->unit);
-       fw_device_put(isight->device);
        mutex_destroy(&isight->mutex);
  error:
        snd_card_free(card);
@@@ -656,12 -656,10 +656,10 @@@ static u32 fwspk_read_firmware_version(
  static void fwspk_card_free(struct snd_card *card)
  {
        struct fwspk *fwspk = card->private_data;
-       struct fw_device *dev = fw_parent_device(fwspk->unit);
  
        amdtp_out_stream_destroy(&fwspk->stream);
        cmp_connection_destroy(&fwspk->connection);
        fw_unit_put(fwspk->unit);
-       fw_device_put(dev);
        mutex_destroy(&fwspk->mutex);
  }
  
@@@ -718,7 -716,6 +716,6 @@@ static int __devinit fwspk_probe(struc
        fwspk = card->private_data;
        fwspk->card = card;
        mutex_init(&fwspk->mutex);
-       fw_device_get(fw_dev);
        fwspk->unit = fw_unit_get(unit);
        fwspk->device_info = fwspk_detect(fw_dev);
        if (!fwspk->device_info) {
@@@ -767,7 -764,6 +764,6 @@@ err_connection
        cmp_connection_destroy(&fwspk->connection);
  err_unit:
        fw_unit_put(fwspk->unit);
-       fw_device_put(fw_dev);
        mutex_destroy(&fwspk->mutex);
  error:
        snd_card_free(card);
@@@ -778,10 -774,9 +774,10 @@@ static int __devexit fwspk_remove(struc
  {
        struct fwspk *fwspk = dev_get_drvdata(dev);
  
 -      mutex_lock(&fwspk->mutex);
        amdtp_out_stream_pcm_abort(&fwspk->stream);
        snd_card_disconnect(fwspk->card);
 +
 +      mutex_lock(&fwspk->mutex);
        fwspk_stop_stream(fwspk);
        mutex_unlock(&fwspk->mutex);
  
@@@ -797,8 -792,8 +793,8 @@@ static void fwspk_bus_reset(struct fw_u
        fcp_bus_reset(fwspk->unit);
  
        if (cmp_connection_update(&fwspk->connection) < 0) {
 -              mutex_lock(&fwspk->mutex);
                amdtp_out_stream_pcm_abort(&fwspk->stream);
 +              mutex_lock(&fwspk->mutex);
                fwspk_stop_stream(fwspk);
                mutex_unlock(&fwspk->mutex);
                return;