]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/firewire/fw-ohci.c
musb_hdrc cleanup -- cppi and sparse
[linux-2.6-omap-h63xx.git] / drivers / firewire / fw-ohci.c
index 0d08bf9b78c21d8f1811a317e5145ae577e4cc98..7e427b4c74b5fe0ea5a8c87e9250a4c0b576fe95 100644 (file)
@@ -224,6 +224,7 @@ ohci_update_phy_reg(struct fw_card *card, int addr,
        u32 val, old;
 
        reg_write(ohci, OHCI1394_PhyControl, OHCI1394_PhyControl_Read(addr));
+       flush_writes(ohci);
        msleep(2);
        val = reg_read(ohci, OHCI1394_PhyControl);
        if ((val & OHCI1394_PhyControl_ReadDone) == 0) {
@@ -373,8 +374,8 @@ static void ar_context_tasklet(unsigned long data)
 
                offset = offsetof(struct ar_buffer, data);
                dma_unmap_single(ohci->card.device,
-                                ab->descriptor.data_address - offset,
-                                PAGE_SIZE, DMA_BIDIRECTIONAL);
+                       le32_to_cpu(ab->descriptor.data_address) - offset,
+                       PAGE_SIZE, DMA_BIDIRECTIONAL);
 
                buffer = ab;
                ab = ab->next;
@@ -427,7 +428,7 @@ static void ar_context_run(struct ar_context *ctx)
        size_t offset;
 
        offset = offsetof(struct ar_buffer, data);
-       ab_bus = ab->descriptor.data_address - offset;
+       ab_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
 
        reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab_bus | 1);
        reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN);
@@ -586,7 +587,7 @@ static void context_stop(struct context *ctx)
                        break;
 
                fw_notify("context_stop: still active (0x%08x)\n", reg);
-               msleep(1);
+               mdelay(1);
        }
 }
 
@@ -906,6 +907,8 @@ static void bus_reset_tasklet(unsigned long data)
        int self_id_count, i, j, reg;
        int generation, new_generation;
        unsigned long flags;
+       void *free_rom = NULL;
+       dma_addr_t free_rom_bus = 0;
 
        reg = reg_read(ohci, OHCI1394_NodeID);
        if (!(reg & OHCI1394_NodeID_idValid)) {
@@ -969,8 +972,8 @@ static void bus_reset_tasklet(unsigned long data)
         */
 
        if (ohci->next_config_rom != NULL) {
-               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
-                                 ohci->config_rom, ohci->config_rom_bus);
+               free_rom     = ohci->config_rom;
+               free_rom_bus = ohci->config_rom_bus;
                ohci->config_rom      = ohci->next_config_rom;
                ohci->config_rom_bus  = ohci->next_config_rom_bus;
                ohci->next_config_rom = NULL;
@@ -989,6 +992,10 @@ static void bus_reset_tasklet(unsigned long data)
 
        spin_unlock_irqrestore(&ohci->lock, flags);
 
+       if (free_rom)
+               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
+                                 free_rom, free_rom_bus);
+
        fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation,
                                 self_id_count, ohci->self_id_buffer);
 }
@@ -1001,7 +1008,7 @@ static irqreturn_t irq_handler(int irq, void *data)
 
        event = reg_read(ohci, OHCI1394_IntEventClear);
 
-       if (!event)
+       if (!event || !~event)
                return IRQ_NONE;
 
        reg_write(ohci, OHCI1394_IntEventClear, event);
@@ -1185,7 +1192,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
 {
        struct fw_ohci *ohci;
        unsigned long flags;
-       int retval = 0;
+       int retval = -EBUSY;
        __be32 *next_config_rom;
        dma_addr_t next_config_rom_bus;
 
@@ -1239,10 +1246,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
 
                reg_write(ohci, OHCI1394_ConfigROMmap,
                          ohci->next_config_rom_bus);
-       } else {
-               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
-                                 next_config_rom, next_config_rom_bus);
-               retval = -EBUSY;
+               retval = 0;
        }
 
        spin_unlock_irqrestore(&ohci->lock, flags);
@@ -1256,6 +1260,9 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
         */
        if (retval == 0)
                fw_core_initiate_bus_reset(&ohci->card, 1);
+       else
+               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
+                                 next_config_rom, next_config_rom_bus);
 
        return retval;
 }
@@ -1934,12 +1941,12 @@ static int pci_suspend(struct pci_dev *pdev, pm_message_t state)
        free_irq(pdev->irq, ohci);
        err = pci_save_state(pdev);
        if (err) {
-               fw_error("pci_save_state failed with %d", err);
+               fw_error("pci_save_state failed\n");
                return err;
        }
        err = pci_set_power_state(pdev, pci_choose_state(pdev, state));
        if (err) {
-               fw_error("pci_set_power_state failed with %d", err);
+               fw_error("pci_set_power_state failed\n");
                return err;
        }
 
@@ -1955,7 +1962,7 @@ static int pci_resume(struct pci_dev *pdev)
        pci_restore_state(pdev);
        err = pci_enable_device(pdev);
        if (err) {
-               fw_error("pci_enable_device failed with %d", err);
+               fw_error("pci_enable_device failed\n");
                return err;
        }