diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-15 15:39:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-15 15:39:13 -0400 |
commit | 849c529f57020cc47085400edd5e641d95cd4faf (patch) | |
tree | 5f2d1add9f98995bf8c22cdfc6ade3e02869e1ac /drivers/ieee1394/csr1212.c | |
parent | b9d2252c1e44fa83a4e65fdc9eb93db6297c55af (diff) | |
parent | a7ea67823af4a7e442e92064b0fab46603a588f6 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
firewire: don't respond to broadcast write requests
firewire: clean up fw_card reference counting
firewire: clean up some includes
firewire: remove unused struct members
firewire: implement broadcast_channel CSR for 1394a compliance
ieee1394: dump mmapped iso buffers in core files
ieee1394: raw1394: Push the BKL down into the driver ioctls
ieee1394: video1394: reorder module init, prepare BKL removal
ieee1394: reduce log noise about config ROM CRC errors
Diffstat (limited to 'drivers/ieee1394/csr1212.c')
-rw-r--r-- | drivers/ieee1394/csr1212.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index e8122def164d..9f95337139e3 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -1049,6 +1049,24 @@ int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer, u32 len) | |||
1049 | return -ENOENT; | 1049 | return -ENOENT; |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | /* | ||
1053 | * Apparently there are many different wrong implementations of the CRC | ||
1054 | * algorithm. We don't fail, we just warn... approximately once per GUID. | ||
1055 | */ | ||
1056 | static void | ||
1057 | csr1212_check_crc(const u32 *buffer, size_t length, u16 crc, __be32 *guid) | ||
1058 | { | ||
1059 | static u64 last_bad_eui64; | ||
1060 | u64 eui64 = ((u64)be32_to_cpu(guid[0]) << 32) | be32_to_cpu(guid[1]); | ||
1061 | |||
1062 | if (csr1212_crc16(buffer, length) == crc || | ||
1063 | csr1212_msft_crc16(buffer, length) == crc || | ||
1064 | eui64 == last_bad_eui64) | ||
1065 | return; | ||
1066 | |||
1067 | printk(KERN_DEBUG "ieee1394: config ROM CRC error\n"); | ||
1068 | last_bad_eui64 = eui64; | ||
1069 | } | ||
1052 | 1070 | ||
1053 | /* Parse a chunk of data as a Config ROM */ | 1071 | /* Parse a chunk of data as a Config ROM */ |
1054 | 1072 | ||
@@ -1092,11 +1110,8 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1092 | return ret; | 1110 | return ret; |
1093 | } | 1111 | } |
1094 | 1112 | ||
1095 | /* Apparently there are many different wrong implementations of the CRC | 1113 | csr1212_check_crc(bi->data, bi->crc_length, bi->crc, |
1096 | * algorithm. We don't fail, we just warn. */ | 1114 | &csr->bus_info_data[3]); |
1097 | if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) && | ||
1098 | (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc)) | ||
1099 | printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n"); | ||
1100 | 1115 | ||
1101 | cr = CSR1212_MALLOC(sizeof(*cr)); | 1116 | cr = CSR1212_MALLOC(sizeof(*cr)); |
1102 | if (!cr) | 1117 | if (!cr) |
@@ -1205,11 +1220,8 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv, | |||
1205 | &cache->data[bytes_to_quads(kv->offset - cache->offset)]; | 1220 | &cache->data[bytes_to_quads(kv->offset - cache->offset)]; |
1206 | kvi_len = be16_to_cpu(kvi->length); | 1221 | kvi_len = be16_to_cpu(kvi->length); |
1207 | 1222 | ||
1208 | /* Apparently there are many different wrong implementations of the CRC | 1223 | /* GUID is wrong in here in case of extended ROM. We don't care. */ |
1209 | * algorithm. We don't fail, we just warn. */ | 1224 | csr1212_check_crc(kvi->data, kvi_len, kvi->crc, &cache->data[3]); |
1210 | if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) && | ||
1211 | (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc)) | ||
1212 | printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n"); | ||
1213 | 1225 | ||
1214 | switch (kv->key.type) { | 1226 | switch (kv->key.type) { |
1215 | case CSR1212_KV_TYPE_DIRECTORY: | 1227 | case CSR1212_KV_TYPE_DIRECTORY: |