The patch titled ieee1394: ohci1394: more obvious endianess handling has been added to the -mm tree. Its filename is ieee1394-ohci1394-more-obvious-endianess-handling.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: ieee1394: ohci1394: more obvious endianess handling From: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx> Rename ohci1394's packet_swab to header_le32_to_cpu to better reflect what it actually does. Also, define a constant array as 'const' and check the array index properly. Signed-off-by: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/ieee1394/ohci1394.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff -puN drivers/ieee1394/ohci1394.c~ieee1394-ohci1394-more-obvious-endianess-handling drivers/ieee1394/ohci1394.c --- a/drivers/ieee1394/ohci1394.c~ieee1394-ohci1394-more-obvious-endianess-handling +++ a/drivers/ieee1394/ohci1394.c @@ -181,36 +181,35 @@ static int alloc_dma_trm_ctx(struct ti_o static void ohci1394_pci_remove(struct pci_dev *pdev); #ifndef __LITTLE_ENDIAN -static unsigned hdr_sizes[] = -{ +const static size_t hdr_sizes[] = { 3, /* TCODE_WRITEQ */ 4, /* TCODE_WRITEB */ 3, /* TCODE_WRITE_RESPONSE */ - 0, /* ??? */ + 0, /* reserved */ 3, /* TCODE_READQ */ 4, /* TCODE_READB */ 3, /* TCODE_READQ_RESPONSE */ 4, /* TCODE_READB_RESPONSE */ - 1, /* TCODE_CYCLE_START (???) */ + 1, /* TCODE_CYCLE_START */ 4, /* TCODE_LOCK_REQUEST */ 2, /* TCODE_ISO_DATA */ 4, /* TCODE_LOCK_RESPONSE */ + /* rest is reserved or link-internal */ }; -/* Swap headers */ -static inline void packet_swab(quadlet_t *data, int tcode) +static inline void header_le32_to_cpu(quadlet_t *data, unsigned char tcode) { - size_t size = hdr_sizes[tcode]; + size_t size; - if (tcode > TCODE_LOCK_RESPONSE || hdr_sizes[tcode] == 0) + if (unlikely(tcode >= ARRAY_SIZE(hdr_sizes))) return; + size = hdr_sizes[tcode]; while (size--) - data[size] = swab32(data[size]); + data[size] = le32_to_cpu(data[size]); } #else -/* Don't waste cycles on same sex byte swaps */ -#define packet_swab(w,x) do {} while (0) +#define header_le32_to_cpu(w,x) do {} while (0) #endif /* !LITTLE_ENDIAN */ /*********************************** @@ -701,7 +700,7 @@ static void insert_packet(struct ti_ohci d->prg_cpu[idx]->data[2] = packet->header[2]; d->prg_cpu[idx]->data[3] = packet->header[3]; } - packet_swab(d->prg_cpu[idx]->data, packet->tcode); + header_le32_to_cpu(d->prg_cpu[idx]->data, packet->tcode); } if (packet->data_size) { /* block transmit */ @@ -777,7 +776,7 @@ static void insert_packet(struct ti_ohci d->prg_cpu[idx]->data[0] = packet->speed_code<<16 | (packet->header[0] & 0xFFFF); d->prg_cpu[idx]->data[1] = packet->header[0] & 0xFFFF0000; - packet_swab(d->prg_cpu[idx]->data, packet->tcode); + header_le32_to_cpu(d->prg_cpu[idx]->data, packet->tcode); d->prg_cpu[idx]->begin.control = cpu_to_le32(DMA_CTL_OUTPUT_MORE | @@ -2731,7 +2730,7 @@ static void dma_rcv_tasklet (unsigned lo * bus reset. We always ignore it. */ if (tcode != OHCI1394_TCODE_PHY) { if (!ohci->no_swap_incoming) - packet_swab(d->spb, tcode); + header_le32_to_cpu(d->spb, tcode); DBGMSG("Packet received from node" " %d ack=0x%02X spd=%d tcode=0x%X" " length=%d ctx=%d tlabel=%d", _ Patches currently in -mm which might be from stefanr@xxxxxxxxxxxxxxxxx are git-ieee1394.patch ieee1394-fix-kerneldoc-of-hpsb_alloc_host.patch ieee1394-shrink-tlabel-pools-remove-tpool-semaphores.patch ieee1394-remove-include-asm-semaphoreh.patch ieee1394-sbp2-safer-last_orb-and.patch ieee1394-sbp2-discard-return-value-of.patch ieee1394-sbp2-optimize-dma-direction-of.patch ieee1394-sbp2-safer-initialization-of.patch ieee1394-sbp2-more-checks-of-status.patch ieee1394-sbp2-convert.patch ieee1394-safer-definition-of-empty-macros.patch ieee1394-sbp2-enable-auto-spin-up-for-all-sbp-2-devices.patch config_pm=n-slim-drivers-ieee1394-ohci1394c.patch the-scheduled-removal-of-drivers-ieee1394-sbp2cforce_inquiry_hack.patch ieee1394-sbp2-handle-sbp2util_node_write_no_wait-failed.patch ieee1394-sbp2-safer-agent-reset-in-error-handlers.patch ieee1394-sbp2-recheck-node-generation-in-sbp2_update.patch ieee1394-sbp2-better-handling-of-transport-errors.patch ieee1394-sbp2-update-includes.patch ieee1394-sbp2-prevent-rare-deadlock-in-shutdown.patch initialize-ieee1394-early-when-built-in.patch ieee1394-sbp2-more-help-in-kconfig.patch ieee1394-nodemgr-fix-rwsem-recursion.patch ieee1394-nodemgr-grab-classsubsysrwsem-in.patch ieee1394-sbp2-dont-prefer-mode-sense-10.patch ieee1394-ohci1394-fix-endianess-bug-in-debug-message.patch ieee1394-ohci1394-more-obvious-endianess-handling.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html