aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/csr1212.c159
-rw-r--r--drivers/ieee1394/csr1212.h90
-rw-r--r--drivers/ieee1394/ieee1394_transactions.c1
-rw-r--r--drivers/ieee1394/nodemgr.c2
4 files changed, 84 insertions, 168 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index ff5a01ecfcaa..f5867236255b 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -33,9 +33,9 @@
33 * parameter expect size to be in bytes. 33 * parameter expect size to be in bytes.
34 */ 34 */
35 35
36#ifndef __KERNEL__ 36#include <linux/errno.h>
37#include <string.h> 37#include <linux/string.h>
38#endif 38#include <asm/byteorder.h>
39 39
40#include "csr1212.h" 40#include "csr1212.h"
41 41
@@ -100,7 +100,7 @@ static u_int16_t csr1212_crc16(const u_int32_t *buffer, size_t length)
100 u_int16_t sum, crc = 0; 100 u_int16_t sum, crc = 0;
101 101
102 for (; length; length--) { 102 for (; length; length--) {
103 data = CSR1212_BE32_TO_CPU(*buffer); 103 data = be32_to_cpu(*buffer);
104 buffer++; 104 buffer++;
105 for (shift = 28; shift >= 0; shift -= 4 ) { 105 for (shift = 28; shift >= 0; shift -= 4 ) {
106 sum = ((crc >> 12) ^ (data >> shift)) & 0xf; 106 sum = ((crc >> 12) ^ (data >> shift)) & 0xf;
@@ -109,7 +109,7 @@ static u_int16_t csr1212_crc16(const u_int32_t *buffer, size_t length)
109 crc &= 0xffff; 109 crc &= 0xffff;
110 } 110 }
111 111
112 return CSR1212_CPU_TO_BE16(crc); 112 return cpu_to_be16(crc);
113} 113}
114 114
115#if 0 115#if 0
@@ -123,7 +123,7 @@ static u_int16_t csr1212_msft_crc16(const u_int32_t *buffer, size_t length)
123 u_int16_t sum, crc = 0; 123 u_int16_t sum, crc = 0;
124 124
125 for (; length; length--) { 125 for (; length; length--) {
126 data = CSR1212_LE32_TO_CPU(*buffer); 126 data = le32_to_cpu(*buffer);
127 buffer++; 127 buffer++;
128 for (shift = 28; shift >= 0; shift -= 4 ) { 128 for (shift = 28; shift >= 0; shift -= 4 ) {
129 sum = ((crc >> 12) ^ (data >> shift)) & 0xf; 129 sum = ((crc >> 12) ^ (data >> shift)) & 0xf;
@@ -132,7 +132,7 @@ static u_int16_t csr1212_msft_crc16(const u_int32_t *buffer, size_t length)
132 crc &= 0xffff; 132 crc &= 0xffff;
133 } 133 }
134 134
135 return CSR1212_CPU_TO_BE16(crc); 135 return cpu_to_be16(crc);
136} 136}
137#endif 137#endif
138 138
@@ -206,15 +206,8 @@ void csr1212_init_local_csr(struct csr1212_csr *csr,
206{ 206{
207 static const int mr_map[] = { 4, 64, 1024, 0 }; 207 static const int mr_map[] = { 4, 64, 1024, 0 };
208 208
209#ifdef __KERNEL__
210 BUG_ON(max_rom & ~0x3); 209 BUG_ON(max_rom & ~0x3);
211 csr->max_rom = mr_map[max_rom]; 210 csr->max_rom = mr_map[max_rom];
212#else
213 if (max_rom & ~0x3) /* caller supplied invalid argument */
214 csr->max_rom = 0;
215 else
216 csr->max_rom = mr_map[max_rom];
217#endif
218 memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len); 211 memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len);
219} 212}
220 213
@@ -316,7 +309,7 @@ int csr1212_associate_keyval(struct csr1212_keyval *kv,
316 struct csr1212_keyval *associate) 309 struct csr1212_keyval *associate)
317{ 310{
318 if (!kv || !associate) 311 if (!kv || !associate)
319 return CSR1212_EINVAL; 312 return -EINVAL;
320 313
321 if (kv->key.id == CSR1212_KV_ID_DESCRIPTOR || 314 if (kv->key.id == CSR1212_KV_ID_DESCRIPTOR ||
322 (associate->key.id != CSR1212_KV_ID_DESCRIPTOR && 315 (associate->key.id != CSR1212_KV_ID_DESCRIPTOR &&
@@ -324,23 +317,23 @@ int csr1212_associate_keyval(struct csr1212_keyval *kv,
324 associate->key.id != CSR1212_KV_ID_EXTENDED_KEY && 317 associate->key.id != CSR1212_KV_ID_EXTENDED_KEY &&
325 associate->key.id != CSR1212_KV_ID_EXTENDED_DATA && 318 associate->key.id != CSR1212_KV_ID_EXTENDED_DATA &&
326 associate->key.id < 0x30)) 319 associate->key.id < 0x30))
327 return CSR1212_EINVAL; 320 return -EINVAL;
328 321
329 if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID && 322 if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID &&
330 associate->key.id != CSR1212_KV_ID_EXTENDED_KEY) 323 associate->key.id != CSR1212_KV_ID_EXTENDED_KEY)
331 return CSR1212_EINVAL; 324 return -EINVAL;
332 325
333 if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY && 326 if (kv->key.id == CSR1212_KV_ID_EXTENDED_KEY &&
334 associate->key.id != CSR1212_KV_ID_EXTENDED_DATA) 327 associate->key.id != CSR1212_KV_ID_EXTENDED_DATA)
335 return CSR1212_EINVAL; 328 return -EINVAL;
336 329
337 if (associate->key.id == CSR1212_KV_ID_EXTENDED_KEY && 330 if (associate->key.id == CSR1212_KV_ID_EXTENDED_KEY &&
338 kv->key.id != CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) 331 kv->key.id != CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID)
339 return CSR1212_EINVAL; 332 return -EINVAL;
340 333
341 if (associate->key.id == CSR1212_KV_ID_EXTENDED_DATA && 334 if (associate->key.id == CSR1212_KV_ID_EXTENDED_DATA &&
342 kv->key.id != CSR1212_KV_ID_EXTENDED_KEY) 335 kv->key.id != CSR1212_KV_ID_EXTENDED_KEY)
343 return CSR1212_EINVAL; 336 return -EINVAL;
344 337
345 if (kv->associate) 338 if (kv->associate)
346 csr1212_release_keyval(kv->associate); 339 csr1212_release_keyval(kv->associate);
@@ -357,11 +350,11 @@ int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir,
357 struct csr1212_dentry *dentry; 350 struct csr1212_dentry *dentry;
358 351
359 if (!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY) 352 if (!kv || !dir || dir->key.type != CSR1212_KV_TYPE_DIRECTORY)
360 return CSR1212_EINVAL; 353 return -EINVAL;
361 354
362 dentry = CSR1212_MALLOC(sizeof(*dentry)); 355 dentry = CSR1212_MALLOC(sizeof(*dentry));
363 if (!dentry) 356 if (!dentry)
364 return CSR1212_ENOMEM; 357 return -ENOMEM;
365 358
366 dentry->kv = kv; 359 dentry->kv = kv;
367 360
@@ -385,13 +378,13 @@ int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir,
385 378
386#define CSR1212_DESCRIPTOR_LEAF_SET_TYPE(kv, type) \ 379#define CSR1212_DESCRIPTOR_LEAF_SET_TYPE(kv, type) \
387 ((kv)->value.leaf.data[0] = \ 380 ((kv)->value.leaf.data[0] = \
388 CSR1212_CPU_TO_BE32(CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) | \ 381 cpu_to_be32(CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) | \
389 ((type) << CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT))) 382 ((type) << CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT)))
390#define CSR1212_DESCRIPTOR_LEAF_SET_SPECIFIER_ID(kv, spec_id) \ 383#define CSR1212_DESCRIPTOR_LEAF_SET_SPECIFIER_ID(kv, spec_id) \
391 ((kv)->value.leaf.data[0] = \ 384 ((kv)->value.leaf.data[0] = \
392 CSR1212_CPU_TO_BE32((CSR1212_DESCRIPTOR_LEAF_TYPE(kv) << \ 385 cpu_to_be32((CSR1212_DESCRIPTOR_LEAF_TYPE(kv) << \
393 CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT) | \ 386 CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT) | \
394 ((spec_id) & CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK))) 387 ((spec_id) & CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK)))
395 388
396static struct csr1212_keyval * 389static struct csr1212_keyval *
397csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id, 390csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id,
@@ -417,27 +410,26 @@ csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id,
417#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_SET_WIDTH(kv, width) \ 410#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_SET_WIDTH(kv, width) \
418 ((kv)->value.leaf.data[1] = \ 411 ((kv)->value.leaf.data[1] = \
419 ((kv)->value.leaf.data[1] & \ 412 ((kv)->value.leaf.data[1] & \
420 CSR1212_CPU_TO_BE32(~(CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_MASK << \ 413 cpu_to_be32(~(CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_MASK << \
421 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_SHIFT))) | \ 414 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_SHIFT))) | \
422 CSR1212_CPU_TO_BE32(((width) & \ 415 cpu_to_be32(((width) & CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_MASK) << \
423 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_MASK) << \ 416 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_SHIFT))
424 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_SHIFT))
425 417
426#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_SET_CHAR_SET(kv, char_set) \ 418#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_SET_CHAR_SET(kv, char_set) \
427 ((kv)->value.leaf.data[1] = \ 419 ((kv)->value.leaf.data[1] = \
428 ((kv)->value.leaf.data[1] & \ 420 ((kv)->value.leaf.data[1] & \
429 CSR1212_CPU_TO_BE32(~(CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK << \ 421 cpu_to_be32(~(CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK << \
430 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT))) | \ 422 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT))) | \
431 CSR1212_CPU_TO_BE32(((char_set) & \ 423 cpu_to_be32(((char_set) & \
432 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK) << \ 424 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK) << \
433 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT)) 425 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT))
434 426
435#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_SET_LANGUAGE(kv, language) \ 427#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_SET_LANGUAGE(kv, language) \
436 ((kv)->value.leaf.data[1] = \ 428 ((kv)->value.leaf.data[1] = \
437 ((kv)->value.leaf.data[1] & \ 429 ((kv)->value.leaf.data[1] & \
438 CSR1212_CPU_TO_BE32(~(CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK))) | \ 430 cpu_to_be32(~(CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK))) | \
439 CSR1212_CPU_TO_BE32(((language) & \ 431 cpu_to_be32(((language) & \
440 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK))) 432 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK)))
441 433
442static struct csr1212_keyval * 434static struct csr1212_keyval *
443csr1212_new_textual_descriptor_leaf(u_int8_t cwidth, u_int16_t cset, 435csr1212_new_textual_descriptor_leaf(u_int8_t cwidth, u_int16_t cset,
@@ -622,39 +614,39 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize)
622 614
623 if (!csr || !csr->ops || !csr->ops->allocate_addr_range || 615 if (!csr || !csr->ops || !csr->ops->allocate_addr_range ||
624 !csr->ops->release_addr || csr->max_rom < 1) 616 !csr->ops->release_addr || csr->max_rom < 1)
625 return CSR1212_EINVAL; 617 return -EINVAL;
626 618
627 /* ROM size must be a multiple of csr->max_rom */ 619 /* ROM size must be a multiple of csr->max_rom */
628 romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1); 620 romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1);
629 621
630 csr_addr = csr->ops->allocate_addr_range(romsize, csr->max_rom, csr->private); 622 csr_addr = csr->ops->allocate_addr_range(romsize, csr->max_rom, csr->private);
631 if (csr_addr == CSR1212_INVALID_ADDR_SPACE) { 623 if (csr_addr == CSR1212_INVALID_ADDR_SPACE) {
632 return CSR1212_ENOMEM; 624 return -ENOMEM;
633 } 625 }
634 if (csr_addr < CSR1212_REGISTER_SPACE_BASE) { 626 if (csr_addr < CSR1212_REGISTER_SPACE_BASE) {
635 /* Invalid address returned from allocate_addr_range(). */ 627 /* Invalid address returned from allocate_addr_range(). */
636 csr->ops->release_addr(csr_addr, csr->private); 628 csr->ops->release_addr(csr_addr, csr->private);
637 return CSR1212_ENOMEM; 629 return -ENOMEM;
638 } 630 }
639 631
640 cache = csr1212_rom_cache_malloc(csr_addr - CSR1212_REGISTER_SPACE_BASE, romsize); 632 cache = csr1212_rom_cache_malloc(csr_addr - CSR1212_REGISTER_SPACE_BASE, romsize);
641 if (!cache) { 633 if (!cache) {
642 csr->ops->release_addr(csr_addr, csr->private); 634 csr->ops->release_addr(csr_addr, csr->private);
643 return CSR1212_ENOMEM; 635 return -ENOMEM;
644 } 636 }
645 637
646 cache->ext_rom = csr1212_new_keyval(CSR1212_KV_TYPE_LEAF, CSR1212_KV_ID_EXTENDED_ROM); 638 cache->ext_rom = csr1212_new_keyval(CSR1212_KV_TYPE_LEAF, CSR1212_KV_ID_EXTENDED_ROM);
647 if (!cache->ext_rom) { 639 if (!cache->ext_rom) {
648 csr->ops->release_addr(csr_addr, csr->private); 640 csr->ops->release_addr(csr_addr, csr->private);
649 CSR1212_FREE(cache); 641 CSR1212_FREE(cache);
650 return CSR1212_ENOMEM; 642 return -ENOMEM;
651 } 643 }
652 644
653 if (csr1212_attach_keyval_to_directory(csr->root_kv, cache->ext_rom) != CSR1212_SUCCESS) { 645 if (csr1212_attach_keyval_to_directory(csr->root_kv, cache->ext_rom) != CSR1212_SUCCESS) {
654 csr1212_release_keyval(cache->ext_rom); 646 csr1212_release_keyval(cache->ext_rom);
655 csr->ops->release_addr(csr_addr, csr->private); 647 csr->ops->release_addr(csr_addr, csr->private);
656 CSR1212_FREE(cache); 648 CSR1212_FREE(cache);
657 return CSR1212_ENOMEM; 649 return -ENOMEM;
658 } 650 }
659 cache->ext_rom->offset = csr_addr - CSR1212_REGISTER_SPACE_BASE; 651 cache->ext_rom->offset = csr_addr - CSR1212_REGISTER_SPACE_BASE;
660 cache->ext_rom->value.leaf.len = -1; 652 cache->ext_rom->value.leaf.len = -1;
@@ -890,7 +882,7 @@ csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer)
890 value |= (a->key.id & CSR1212_KV_KEY_ID_MASK) << CSR1212_KV_KEY_SHIFT; 882 value |= (a->key.id & CSR1212_KV_KEY_ID_MASK) << CSR1212_KV_KEY_SHIFT;
891 value |= (a->key.type & CSR1212_KV_KEY_TYPE_MASK) << 883 value |= (a->key.type & CSR1212_KV_KEY_TYPE_MASK) <<
892 (CSR1212_KV_KEY_SHIFT + CSR1212_KV_KEY_TYPE_SHIFT); 884 (CSR1212_KV_KEY_SHIFT + CSR1212_KV_KEY_TYPE_SHIFT);
893 data_buffer[index] = CSR1212_CPU_TO_BE32(value); 885 data_buffer[index] = cpu_to_be32(value);
894 index++; 886 index++;
895 } 887 }
896 } 888 }
@@ -926,14 +918,14 @@ static void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache)
926 memcpy(kvi->data, kv->value.leaf.data, 918 memcpy(kvi->data, kv->value.leaf.data,
927 quads_to_bytes(kv->value.leaf.len)); 919 quads_to_bytes(kv->value.leaf.len));
928 920
929 kvi->length = CSR1212_CPU_TO_BE16(kv->value.leaf.len); 921 kvi->length = cpu_to_be16(kv->value.leaf.len);
930 kvi->crc = csr1212_crc16(kvi->data, kv->value.leaf.len); 922 kvi->crc = csr1212_crc16(kvi->data, kv->value.leaf.len);
931 break; 923 break;
932 924
933 case CSR1212_KV_TYPE_DIRECTORY: 925 case CSR1212_KV_TYPE_DIRECTORY:
934 csr1212_generate_tree_subdir(kv, kvi->data); 926 csr1212_generate_tree_subdir(kv, kvi->data);
935 927
936 kvi->length = CSR1212_CPU_TO_BE16(kv->value.directory.len); 928 kvi->length = cpu_to_be16(kv->value.directory.len);
937 kvi->crc = csr1212_crc16(kvi->data, kv->value.directory.len); 929 kvi->crc = csr1212_crc16(kvi->data, kv->value.directory.len);
938 break; 930 break;
939 } 931 }
@@ -960,7 +952,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
960 int init_offset; 952 int init_offset;
961 953
962 if (!csr) 954 if (!csr)
963 return CSR1212_EINVAL; 955 return -EINVAL;
964 956
965 cache = csr->cache_head; 957 cache = csr->cache_head;
966 958
@@ -1021,7 +1013,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
1021 /* Make sure the Extended ROM leaf is a multiple of 1013 /* Make sure the Extended ROM leaf is a multiple of
1022 * max_rom in size. */ 1014 * max_rom in size. */
1023 if (csr->max_rom < 1) 1015 if (csr->max_rom < 1)
1024 return CSR1212_EINVAL; 1016 return -EINVAL;
1025 leaf_size = (cache->len + (csr->max_rom - 1)) & 1017 leaf_size = (cache->len + (csr->max_rom - 1)) &
1026 ~(csr->max_rom - 1); 1018 ~(csr->max_rom - 1);
1027 1019
@@ -1048,11 +1040,10 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
1048 /* Set the length and CRC of the extended ROM. */ 1040 /* Set the length and CRC of the extended ROM. */
1049 struct csr1212_keyval_img *kvi = 1041 struct csr1212_keyval_img *kvi =
1050 (struct csr1212_keyval_img*)cache->data; 1042 (struct csr1212_keyval_img*)cache->data;
1043 u_int16_t len = bytes_to_quads(cache->len) - 1;
1051 1044
1052 kvi->length = CSR1212_CPU_TO_BE16(bytes_to_quads(cache->len) - 1); 1045 kvi->length = cpu_to_be16(len);
1053 kvi->crc = csr1212_crc16(kvi->data, 1046 kvi->crc = csr1212_crc16(kvi->data, len);
1054 bytes_to_quads(cache->len) - 1);
1055
1056 } 1047 }
1057 } 1048 }
1058 1049
@@ -1072,7 +1063,7 @@ int csr1212_read(struct csr1212_csr *csr, u_int32_t offset, void *buffer, u_int3
1072 return CSR1212_SUCCESS; 1063 return CSR1212_SUCCESS;
1073 } 1064 }
1074 } 1065 }
1075 return CSR1212_ENOENT; 1066 return -ENOENT;
1076} 1067}
1077 1068
1078 1069
@@ -1100,9 +1091,9 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1100 1091
1101 /* check ROM header's info_length */ 1092 /* check ROM header's info_length */
1102 if (i == 0 && 1093 if (i == 0 &&
1103 CSR1212_BE32_TO_CPU(csr->cache_head->data[0]) >> 24 != 1094 be32_to_cpu(csr->cache_head->data[0]) >> 24 !=
1104 bytes_to_quads(csr->bus_info_len) - 1) 1095 bytes_to_quads(csr->bus_info_len) - 1)
1105 return CSR1212_EINVAL; 1096 return -EINVAL;
1106 } 1097 }
1107 1098
1108 bi = (struct csr1212_bus_info_block_img*)csr->cache_head->data; 1099 bi = (struct csr1212_bus_info_block_img*)csr->cache_head->data;
@@ -1124,12 +1115,12 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1124 * CRC algorithm that verifying them is moot. */ 1115 * CRC algorithm that verifying them is moot. */
1125 if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) && 1116 if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) &&
1126 (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc)) 1117 (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc))
1127 return CSR1212_EINVAL; 1118 return -EINVAL;
1128#endif 1119#endif
1129 1120
1130 cr = CSR1212_MALLOC(sizeof(*cr)); 1121 cr = CSR1212_MALLOC(sizeof(*cr));
1131 if (!cr) 1122 if (!cr)
1132 return CSR1212_ENOMEM; 1123 return -ENOMEM;
1133 1124
1134 cr->next = NULL; 1125 cr->next = NULL;
1135 cr->prev = NULL; 1126 cr->prev = NULL;
@@ -1142,11 +1133,11 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1142 return CSR1212_SUCCESS; 1133 return CSR1212_SUCCESS;
1143} 1134}
1144 1135
1145#define CSR1212_KV_KEY(q) (CSR1212_BE32_TO_CPU(q) >> CSR1212_KV_KEY_SHIFT) 1136#define CSR1212_KV_KEY(q) (be32_to_cpu(q) >> CSR1212_KV_KEY_SHIFT)
1146#define CSR1212_KV_KEY_TYPE(q) (CSR1212_KV_KEY(q) >> CSR1212_KV_KEY_TYPE_SHIFT) 1137#define CSR1212_KV_KEY_TYPE(q) (CSR1212_KV_KEY(q) >> CSR1212_KV_KEY_TYPE_SHIFT)
1147#define CSR1212_KV_KEY_ID(q) (CSR1212_KV_KEY(q) & CSR1212_KV_KEY_ID_MASK) 1138#define CSR1212_KV_KEY_ID(q) (CSR1212_KV_KEY(q) & CSR1212_KV_KEY_ID_MASK)
1148#define CSR1212_KV_VAL_MASK 0xffffff 1139#define CSR1212_KV_VAL_MASK 0xffffff
1149#define CSR1212_KV_VAL(q) (CSR1212_BE32_TO_CPU(q) & CSR1212_KV_VAL_MASK) 1140#define CSR1212_KV_VAL(q) (be32_to_cpu(q) & CSR1212_KV_VAL_MASK)
1150 1141
1151static int csr1212_parse_dir_entry(struct csr1212_keyval *dir, 1142static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
1152 csr1212_quad_t ki, 1143 csr1212_quad_t ki,
@@ -1161,7 +1152,7 @@ static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
1161 k = csr1212_new_immediate(CSR1212_KV_KEY_ID(ki), 1152 k = csr1212_new_immediate(CSR1212_KV_KEY_ID(ki),
1162 CSR1212_KV_VAL(ki)); 1153 CSR1212_KV_VAL(ki));
1163 if (!k) { 1154 if (!k) {
1164 ret = CSR1212_ENOMEM; 1155 ret = -ENOMEM;
1165 goto fail; 1156 goto fail;
1166 } 1157 }
1167 1158
@@ -1172,7 +1163,7 @@ static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
1172 k = csr1212_new_csr_offset(CSR1212_KV_KEY_ID(ki), 1163 k = csr1212_new_csr_offset(CSR1212_KV_KEY_ID(ki),
1173 CSR1212_KV_VAL(ki)); 1164 CSR1212_KV_VAL(ki));
1174 if (!k) { 1165 if (!k) {
1175 ret = CSR1212_ENOMEM; 1166 ret = -ENOMEM;
1176 goto fail; 1167 goto fail;
1177 } 1168 }
1178 k->refcnt = 0; /* Don't keep local reference when parsing. */ 1169 k->refcnt = 0; /* Don't keep local reference when parsing. */
@@ -1185,7 +1176,7 @@ static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
1185 /* Uh-oh. Can't have a relative offset of 0 for Leaves 1176 /* Uh-oh. Can't have a relative offset of 0 for Leaves
1186 * or Directories. The Config ROM image is most likely 1177 * or Directories. The Config ROM image is most likely
1187 * messed up, so we'll just abort here. */ 1178 * messed up, so we'll just abort here. */
1188 ret = CSR1212_EIO; 1179 ret = -EIO;
1189 goto fail; 1180 goto fail;
1190 } 1181 }
1191 1182
@@ -1200,7 +1191,7 @@ static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
1200 k = csr1212_new_leaf(CSR1212_KV_KEY_ID(ki), NULL, 0); 1191 k = csr1212_new_leaf(CSR1212_KV_KEY_ID(ki), NULL, 0);
1201 } 1192 }
1202 if (!k) { 1193 if (!k) {
1203 ret = CSR1212_ENOMEM; 1194 ret = -ENOMEM;
1204 goto fail; 1195 goto fail;
1205 } 1196 }
1206 k->refcnt = 0; /* Don't keep local reference when parsing. */ 1197 k->refcnt = 0; /* Don't keep local reference when parsing. */
@@ -1230,14 +1221,14 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
1230 1221
1231 kvi = (struct csr1212_keyval_img*)&cache->data[bytes_to_quads(kv->offset - 1222 kvi = (struct csr1212_keyval_img*)&cache->data[bytes_to_quads(kv->offset -
1232 cache->offset)]; 1223 cache->offset)];
1233 kvi_len = CSR1212_BE16_TO_CPU(kvi->length); 1224 kvi_len = be16_to_cpu(kvi->length);
1234 1225
1235#if 0 1226#if 0
1236 /* Apparently there are too many differnt wrong implementations of the 1227 /* Apparently there are too many differnt wrong implementations of the
1237 * CRC algorithm that verifying them is moot. */ 1228 * CRC algorithm that verifying them is moot. */
1238 if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) && 1229 if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) &&
1239 (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc)) { 1230 (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc)) {
1240 ret = CSR1212_EINVAL; 1231 ret = -EINVAL;
1241 goto fail; 1232 goto fail;
1242 } 1233 }
1243#endif 1234#endif
@@ -1263,7 +1254,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
1263 if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) { 1254 if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) {
1264 kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len)); 1255 kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len));
1265 if (!kv->value.leaf.data) { 1256 if (!kv->value.leaf.data) {
1266 ret = CSR1212_ENOMEM; 1257 ret = -ENOMEM;
1267 goto fail; 1258 goto fail;
1268 } 1259 }
1269 1260
@@ -1290,7 +1281,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1290 u_int16_t kv_len = 0; 1281 u_int16_t kv_len = 0;
1291 1282
1292 if (!csr || !kv || csr->max_rom < 1) 1283 if (!csr || !kv || csr->max_rom < 1)
1293 return CSR1212_EINVAL; 1284 return -EINVAL;
1294 1285
1295 /* First find which cache the data should be in (or go in if not read 1286 /* First find which cache the data should be in (or go in if not read
1296 * yet). */ 1287 * yet). */
@@ -1306,22 +1297,22 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1306 1297
1307 /* Only create a new cache for Extended ROM leaves. */ 1298 /* Only create a new cache for Extended ROM leaves. */
1308 if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) 1299 if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM)
1309 return CSR1212_EINVAL; 1300 return -EINVAL;
1310 1301
1311 if (csr->ops->bus_read(csr, 1302 if (csr->ops->bus_read(csr,
1312 CSR1212_REGISTER_SPACE_BASE + kv->offset, 1303 CSR1212_REGISTER_SPACE_BASE + kv->offset,
1313 sizeof(csr1212_quad_t), &q, csr->private)) { 1304 sizeof(csr1212_quad_t), &q, csr->private)) {
1314 return CSR1212_EIO; 1305 return -EIO;
1315 } 1306 }
1316 1307
1317 kv->value.leaf.len = CSR1212_BE32_TO_CPU(q) >> 16; 1308 kv->value.leaf.len = be32_to_cpu(q) >> 16;
1318 1309
1319 cache_size = (quads_to_bytes(kv->value.leaf.len + 1) + 1310 cache_size = (quads_to_bytes(kv->value.leaf.len + 1) +
1320 (csr->max_rom - 1)) & ~(csr->max_rom - 1); 1311 (csr->max_rom - 1)) & ~(csr->max_rom - 1);
1321 1312
1322 cache = csr1212_rom_cache_malloc(kv->offset, cache_size); 1313 cache = csr1212_rom_cache_malloc(kv->offset, cache_size);
1323 if (!cache) 1314 if (!cache)
1324 return CSR1212_ENOMEM; 1315 return -ENOMEM;
1325 1316
1326 kv->value.leaf.data = &cache->data[1]; 1317 kv->value.leaf.data = &cache->data[1];
1327 csr->cache_tail->next = cache; 1318 csr->cache_tail->next = cache;
@@ -1331,7 +1322,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1331 cache->filled_head = 1322 cache->filled_head =
1332 CSR1212_MALLOC(sizeof(*cache->filled_head)); 1323 CSR1212_MALLOC(sizeof(*cache->filled_head));
1333 if (!cache->filled_head) { 1324 if (!cache->filled_head) {
1334 return CSR1212_ENOMEM; 1325 return -ENOMEM;
1335 } 1326 }
1336 1327
1337 cache->filled_head->offset_start = 0; 1328 cache->filled_head->offset_start = 0;
@@ -1353,7 +1344,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1353 if (cache_index < cr->offset_start) { 1344 if (cache_index < cr->offset_start) {
1354 newcr = CSR1212_MALLOC(sizeof(*newcr)); 1345 newcr = CSR1212_MALLOC(sizeof(*newcr));
1355 if (!newcr) 1346 if (!newcr)
1356 return CSR1212_ENOMEM; 1347 return -ENOMEM;
1357 1348
1358 newcr->offset_start = cache_index & ~(csr->max_rom - 1); 1349 newcr->offset_start = cache_index & ~(csr->max_rom - 1);
1359 newcr->offset_end = newcr->offset_start; 1350 newcr->offset_end = newcr->offset_start;
@@ -1366,8 +1357,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1366 (cache_index < cr->offset_end)) { 1357 (cache_index < cr->offset_end)) {
1367 kvi = (struct csr1212_keyval_img*) 1358 kvi = (struct csr1212_keyval_img*)
1368 (&cache->data[bytes_to_quads(cache_index)]); 1359 (&cache->data[bytes_to_quads(cache_index)]);
1369 kv_len = quads_to_bytes(CSR1212_BE16_TO_CPU(kvi->length) + 1360 kv_len = quads_to_bytes(be16_to_cpu(kvi->length) + 1);
1370 1);
1371 break; 1361 break;
1372 } else if (cache_index == cr->offset_end) 1362 } else if (cache_index == cr->offset_end)
1373 break; 1363 break;
@@ -1377,7 +1367,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1377 cr = cache->filled_tail; 1367 cr = cache->filled_tail;
1378 newcr = CSR1212_MALLOC(sizeof(*newcr)); 1368 newcr = CSR1212_MALLOC(sizeof(*newcr));
1379 if (!newcr) 1369 if (!newcr)
1380 return CSR1212_ENOMEM; 1370 return -ENOMEM;
1381 1371
1382 newcr->offset_start = cache_index & ~(csr->max_rom - 1); 1372 newcr->offset_start = cache_index & ~(csr->max_rom - 1);
1383 newcr->offset_end = newcr->offset_start; 1373 newcr->offset_end = newcr->offset_start;
@@ -1399,7 +1389,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1399 csr->private)) { 1389 csr->private)) {
1400 if (csr->max_rom == 4) 1390 if (csr->max_rom == 4)
1401 /* We've got problems! */ 1391 /* We've got problems! */
1402 return CSR1212_EIO; 1392 return -EIO;
1403 1393
1404 /* Apperently the max_rom value was a lie, set it to 1394 /* Apperently the max_rom value was a lie, set it to
1405 * do quadlet reads and try again. */ 1395 * do quadlet reads and try again. */
@@ -1413,8 +1403,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1413 if (!kvi && (cr->offset_end > cache_index)) { 1403 if (!kvi && (cr->offset_end > cache_index)) {
1414 kvi = (struct csr1212_keyval_img*) 1404 kvi = (struct csr1212_keyval_img*)
1415 (&cache->data[bytes_to_quads(cache_index)]); 1405 (&cache->data[bytes_to_quads(cache_index)]);
1416 kv_len = quads_to_bytes(CSR1212_BE16_TO_CPU(kvi->length) + 1406 kv_len = quads_to_bytes(be16_to_cpu(kvi->length) + 1);
1417 1);
1418 } 1407 }
1419 1408
1420 if ((kv_len + (kv->offset - cache->offset)) > cache->size) { 1409 if ((kv_len + (kv->offset - cache->offset)) > cache->size) {
@@ -1422,7 +1411,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
1422 * beyond the ConfigROM image region and thus beyond the 1411 * beyond the ConfigROM image region and thus beyond the
1423 * end of our cache region. Therefore, we abort now 1412 * end of our cache region. Therefore, we abort now
1424 * rather than seg faulting later. */ 1413 * rather than seg faulting later. */
1425 return CSR1212_EIO; 1414 return -EIO;
1426 } 1415 }
1427 1416
1428 ncr = cr->next; 1417 ncr = cr->next;
@@ -1451,7 +1440,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr)
1451 int ret; 1440 int ret;
1452 1441
1453 if (!csr || !csr->ops || !csr->ops->bus_read) 1442 if (!csr || !csr->ops || !csr->ops->bus_read)
1454 return CSR1212_EINVAL; 1443 return -EINVAL;
1455 1444
1456 ret = csr1212_parse_bus_info_block(csr); 1445 ret = csr1212_parse_bus_info_block(csr);
1457 if (ret != CSR1212_SUCCESS) 1446 if (ret != CSR1212_SUCCESS)
@@ -1463,7 +1452,7 @@ int csr1212_parse_csr(struct csr1212_csr *csr)
1463 int i = csr->ops->get_max_rom(csr->bus_info_data, 1452 int i = csr->ops->get_max_rom(csr->bus_info_data,
1464 csr->private); 1453 csr->private);
1465 if (i & ~0x3) 1454 if (i & ~0x3)
1466 return CSR1212_EINVAL; 1455 return -EINVAL;
1467 csr->max_rom = mr_map[i]; 1456 csr->max_rom = mr_map[i];
1468 } 1457 }
1469 1458
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
index 86f23d6bba86..f42e12e58ae7 100644
--- a/drivers/ieee1394/csr1212.h
+++ b/drivers/ieee1394/csr1212.h
@@ -30,87 +30,13 @@
30#ifndef __CSR1212_H__ 30#ifndef __CSR1212_H__
31#define __CSR1212_H__ 31#define __CSR1212_H__
32 32
33
34/* Compatibility layer */
35#ifdef __KERNEL__
36
37#include <linux/types.h> 33#include <linux/types.h>
38#include <linux/slab.h>
39#include <linux/interrupt.h>
40#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
41#include <asm/pgalloc.h>
42 35
43#define CSR1212_MALLOC(size) vmalloc((size)) 36#define CSR1212_MALLOC(size) vmalloc((size))
44#define CSR1212_FREE(ptr) vfree(ptr) 37#define CSR1212_FREE(ptr) vfree(ptr)
45#define CSR1212_BE16_TO_CPU(quad) be16_to_cpu(quad)
46#define CSR1212_CPU_TO_BE16(quad) cpu_to_be16(quad)
47#define CSR1212_BE32_TO_CPU(quad) be32_to_cpu(quad)
48#define CSR1212_CPU_TO_BE32(quad) cpu_to_be32(quad)
49#define CSR1212_BE64_TO_CPU(quad) be64_to_cpu(quad)
50#define CSR1212_CPU_TO_BE64(quad) cpu_to_be64(quad)
51
52#define CSR1212_LE16_TO_CPU(quad) le16_to_cpu(quad)
53#define CSR1212_CPU_TO_LE16(quad) cpu_to_le16(quad)
54#define CSR1212_LE32_TO_CPU(quad) le32_to_cpu(quad)
55#define CSR1212_CPU_TO_LE32(quad) cpu_to_le32(quad)
56#define CSR1212_LE64_TO_CPU(quad) le64_to_cpu(quad)
57#define CSR1212_CPU_TO_LE64(quad) cpu_to_le64(quad)
58
59#include <linux/errno.h>
60#define CSR1212_SUCCESS (0)
61#define CSR1212_EINVAL (-EINVAL)
62#define CSR1212_ENOMEM (-ENOMEM)
63#define CSR1212_ENOENT (-ENOENT)
64#define CSR1212_EIO (-EIO)
65#define CSR1212_EBUSY (-EBUSY)
66
67#else /* Userspace */
68
69#include <sys/types.h>
70#include <malloc.h>
71#define CSR1212_MALLOC(size) malloc(size)
72#define CSR1212_FREE(ptr) free(ptr)
73#include <endian.h>
74#if __BYTE_ORDER == __LITTLE_ENDIAN
75#include <byteswap.h>
76#define CSR1212_BE16_TO_CPU(quad) bswap_16(quad)
77#define CSR1212_CPU_TO_BE16(quad) bswap_16(quad)
78#define CSR1212_BE32_TO_CPU(quad) bswap_32(quad)
79#define CSR1212_CPU_TO_BE32(quad) bswap_32(quad)
80#define CSR1212_BE64_TO_CPU(quad) bswap_64(quad)
81#define CSR1212_CPU_TO_BE64(quad) bswap_64(quad)
82
83#define CSR1212_LE16_TO_CPU(quad) (quad)
84#define CSR1212_CPU_TO_LE16(quad) (quad)
85#define CSR1212_LE32_TO_CPU(quad) (quad)
86#define CSR1212_CPU_TO_LE32(quad) (quad)
87#define CSR1212_LE64_TO_CPU(quad) (quad)
88#define CSR1212_CPU_TO_LE64(quad) (quad)
89#else
90#define CSR1212_BE16_TO_CPU(quad) (quad)
91#define CSR1212_CPU_TO_BE16(quad) (quad)
92#define CSR1212_BE32_TO_CPU(quad) (quad)
93#define CSR1212_CPU_TO_BE32(quad) (quad)
94#define CSR1212_BE64_TO_CPU(quad) (quad)
95#define CSR1212_CPU_TO_BE64(quad) (quad)
96
97#define CSR1212_LE16_TO_CPU(quad) bswap_16(quad)
98#define CSR1212_CPU_TO_LE16(quad) bswap_16(quad)
99#define CSR1212_LE32_TO_CPU(quad) bswap_32(quad)
100#define CSR1212_CPU_TO_LE32(quad) bswap_32(quad)
101#define CSR1212_LE64_TO_CPU(quad) bswap_64(quad)
102#define CSR1212_CPU_TO_LE64(quad) bswap_64(quad)
103#endif
104
105#include <errno.h>
106#define CSR1212_SUCCESS (0)
107#define CSR1212_EINVAL (EINVAL)
108#define CSR1212_ENOMEM (ENOMEM)
109#define CSR1212_ENOENT (ENOENT)
110#define CSR1212_EIO (EIO)
111#define CSR1212_EBUSY (EBUSY)
112 38
113#endif 39#define CSR1212_SUCCESS (0)
114 40
115 41
116/* CSR 1212 key types */ 42/* CSR 1212 key types */
@@ -302,9 +228,9 @@ struct csr1212_bus_ops {
302#define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t)) 228#define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t))
303 229
304#define CSR1212_DESCRIPTOR_LEAF_TYPE(kv) \ 230#define CSR1212_DESCRIPTOR_LEAF_TYPE(kv) \
305 (CSR1212_BE32_TO_CPU((kv)->value.leaf.data[0]) >> CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT) 231 (be32_to_cpu((kv)->value.leaf.data[0]) >> CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT)
306#define CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) \ 232#define CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) \
307 (CSR1212_BE32_TO_CPU((kv)->value.leaf.data[0]) & \ 233 (be32_to_cpu((kv)->value.leaf.data[0]) & \
308 CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK) 234 CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK)
309 235
310 236
@@ -317,14 +243,14 @@ struct csr1212_bus_ops {
317#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t)) 243#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t))
318 244
319#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) \ 245#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) \
320 (CSR1212_BE32_TO_CPU((kv)->value.leaf.data[1]) >> \ 246 (be32_to_cpu((kv)->value.leaf.data[1]) >> \
321 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_SHIFT) 247 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH_SHIFT)
322#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET(kv) \ 248#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET(kv) \
323 ((CSR1212_BE32_TO_CPU((kv)->value.leaf.data[1]) >> \ 249 ((be32_to_cpu((kv)->value.leaf.data[1]) >> \
324 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT) & \ 250 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT) & \
325 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK) 251 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK)
326#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE(kv) \ 252#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE(kv) \
327 (CSR1212_BE32_TO_CPU((kv)->value.leaf.data[1]) & \ 253 (be32_to_cpu((kv)->value.leaf.data[1]) & \
328 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK) 254 CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK)
329#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(kv) \ 255#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(kv) \
330 (&((kv)->value.leaf.data[2])) 256 (&((kv)->value.leaf.data[2]))
diff --git a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c
index 6f07cd8835a3..d1a0d3cb97d0 100644
--- a/drivers/ieee1394/ieee1394_transactions.c
+++ b/drivers/ieee1394/ieee1394_transactions.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/hardirq.h>
13#include <linux/spinlock.h> 14#include <linux/spinlock.h>
14#include <linux/wait.h> 15#include <linux/wait.h>
15 16
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 629a9d88a0da..faaa5c94fb07 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -115,7 +115,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
115 115
116static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci) 116static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci)
117{ 117{
118 return (CSR1212_BE32_TO_CPU(bus_info_data[2]) >> 8) & 0x3; 118 return (be32_to_cpu(bus_info_data[2]) >> 8) & 0x3;
119} 119}
120 120
121static struct csr1212_bus_ops nodemgr_csr_ops = { 121static struct csr1212_bus_ops nodemgr_csr_ops = {