revert android-tegra-2.6.36-honeycomb-mr1-9001adc to v2.6.36
[firefly-linux-kernel-4.4.55.git] / drivers / firewire / ohci.c
index a03cb6acaedaf71123f89a2e6a64b9ae646599d6..9dcb17d51aee737bcbb4ac478807c04311588d6c 100644 (file)
@@ -242,7 +242,6 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
 
 static char ohci_driver_name[] = KBUILD_MODNAME;
 
-#define PCI_DEVICE_ID_AGERE_FW643      0x5901
 #define PCI_DEVICE_ID_JMICRON_JMB38X_FW        0x2380
 #define PCI_DEVICE_ID_TI_TSB12LV22     0x8009
 
@@ -254,34 +253,18 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
 
 /* In case of multiple matches in ohci_quirks[], only the first one is used. */
 static const struct {
-       unsigned short vendor, device, revision, flags;
+       unsigned short vendor, device, flags;
 } ohci_quirks[] = {
-       {PCI_VENDOR_ID_AL, PCI_ANY_ID, PCI_ANY_ID,
-               QUIRK_CYCLE_TIMER},
-
-       {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, PCI_ANY_ID,
-               QUIRK_BE_HEADERS},
-
-       {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6,
-               QUIRK_NO_MSI},
-
-       {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID,
-               QUIRK_NO_MSI},
-
-       {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID,
-               QUIRK_CYCLE_TIMER},
-
-       {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID,
-               QUIRK_CYCLE_TIMER},
-
-       {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID,
-               QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A},
-
-       {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID,
-               QUIRK_RESET_PACKET},
-
-       {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID,
-               QUIRK_CYCLE_TIMER | QUIRK_NO_MSI},
+       {PCI_VENDOR_ID_TI,      PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER |
+                                                           QUIRK_RESET_PACKET |
+                                                           QUIRK_NO_1394A},
+       {PCI_VENDOR_ID_TI,      PCI_ANY_ID,     QUIRK_RESET_PACKET},
+       {PCI_VENDOR_ID_AL,      PCI_ANY_ID,     QUIRK_CYCLE_TIMER},
+       {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI},
+       {PCI_VENDOR_ID_NEC,     PCI_ANY_ID,     QUIRK_CYCLE_TIMER},
+       {PCI_VENDOR_ID_VIA,     PCI_ANY_ID,     QUIRK_CYCLE_TIMER},
+       {PCI_VENDOR_ID_RICOH,   PCI_ANY_ID,     QUIRK_CYCLE_TIMER},
+       {PCI_VENDOR_ID_APPLE,   PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS},
 };
 
 /* This overrides anything that was found in ohci_quirks[]. */
@@ -756,7 +739,7 @@ static void ar_context_tasklet(unsigned long data)
        d = &ab->descriptor;
 
        if (d->res_count == 0) {
-               size_t size, size2, rest, pktsize, size3, offset;
+               size_t size, rest, offset;
                dma_addr_t start_bus;
                void *start;
 
@@ -767,61 +750,25 @@ static void ar_context_tasklet(unsigned long data)
                 */
 
                offset = offsetof(struct ar_buffer, data);
-               start = ab;
+               start = buffer = ab;
                start_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
-               buffer = ab->data;
 
                ab = ab->next;
                d = &ab->descriptor;
-               size = start + PAGE_SIZE - ctx->pointer;
-               /* valid buffer data in the next page */
+               size = buffer + PAGE_SIZE - ctx->pointer;
                rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count);
-               /* what actually fits in this page */
-               size2 = min(rest, (size_t)PAGE_SIZE - offset - size);
                memmove(buffer, ctx->pointer, size);
-               memcpy(buffer + size, ab->data, size2);
-
-               while (size > 0) {
-                       void *next = handle_ar_packet(ctx, buffer);
-                       pktsize = next - buffer;
-                       if (pktsize >= size) {
-                               /*
-                                * We have handled all the data that was
-                                * originally in this page, so we can now
-                                * continue in the next page.
-                                */
-                               buffer = next;
-                               break;
-                       }
-                       /* move the next packet to the start of the buffer */
-                       memmove(buffer, next, size + size2 - pktsize);
-                       size -= pktsize;
-                       /* fill up this page again */
-                       size3 = min(rest - size2,
-                                   (size_t)PAGE_SIZE - offset - size - size2);
-                       memcpy(buffer + size + size2,
-                              (void *) ab->data + size2, size3);
-                       size2 += size3;
-               }
-
-               if (rest > 0) {
-                       /* handle the packets that are fully in the next page */
-                       buffer = (void *) ab->data +
-                                       (buffer - (start + offset + size));
-                       end = (void *) ab->data + rest;
+               memcpy(buffer + size, ab->data, rest);
+               ctx->current_buffer = ab;
+               ctx->pointer = (void *) ab->data + rest;
+               end = buffer + size + rest;
 
-                       while (buffer < end)
-                               buffer = handle_ar_packet(ctx, buffer);
-
-                       ctx->current_buffer = ab;
-                       ctx->pointer = end;
+               while (buffer < end)
+                       buffer = handle_ar_packet(ctx, buffer);
 
-                       dma_free_coherent(ohci->card.device, PAGE_SIZE,
-                                         start, start_bus);
-                       ar_context_add_page(ctx);
-               } else {
-                       ctx->pointer = start + PAGE_SIZE;
-               }
+               dma_free_coherent(ohci->card.device, PAGE_SIZE,
+                                 start, start_bus);
+               ar_context_add_page(ctx);
        } else {
                buffer = ctx->pointer;
                ctx->pointer = end =
@@ -2938,11 +2885,9 @@ static int __devinit pci_probe(struct pci_dev *dev,
        }
 
        for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++)
-               if ((ohci_quirks[i].vendor == dev->vendor) &&
-                   (ohci_quirks[i].device == (unsigned short)PCI_ANY_ID ||
-                    ohci_quirks[i].device == dev->device) &&
-                   (ohci_quirks[i].revision == (unsigned short)PCI_ANY_ID ||
-                    ohci_quirks[i].revision >= dev->revision)) {
+               if (ohci_quirks[i].vendor == dev->vendor &&
+                   (ohci_quirks[i].device == dev->device ||
+                    ohci_quirks[i].device == (unsigned short)PCI_ANY_ID)) {
                        ohci->quirks = ohci_quirks[i].flags;
                        break;
                }