aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/core-card.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-10-07 18:42:53 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-10-14 17:10:48 -0400
commitcb7c96da3651111efbe088fa12f9bed61836ea93 (patch)
treed31d9ba7e321206cd5b32753f444aabc2c76efeb /drivers/firewire/core-card.c
parentfe242579e9f33150868f1bb79c7e262ad7953f17 (diff)
firewire: core: optimize Topology Map creation
The Topology Map of the local node was created in CPU byte order, then a temporary big endian copy was created to compute the CRC, and when a read request to the Topology Map arrived it had to be converted to big endian byte order again. We now generate it in big endian byte order in the first place. This also rids us of 1000 bytes stack usage in tasklet context. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/core-card.c')
-rw-r--r--drivers/firewire/core-card.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index f58130789990..7083bcc1b9c7 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -38,7 +38,7 @@
38 38
39#include "core.h" 39#include "core.h"
40 40
41static int __compute_block_crc(__be32 *block) 41int fw_compute_block_crc(__be32 *block)
42{ 42{
43 int length; 43 int length;
44 u16 crc; 44 u16 crc;
@@ -50,19 +50,6 @@ static int __compute_block_crc(__be32 *block)
50 return length; 50 return length;
51} 51}
52 52
53int fw_compute_block_crc(u32 *block)
54{
55 __be32 be32_block[256];
56 int i, length;
57
58 length = (*block >> 16) & 0xff;
59 for (i = 0; i < length; i++)
60 be32_block[i] = cpu_to_be32(block[i + 1]);
61 *block |= crc_itu_t(0, (u8 *) be32_block, length * 4);
62
63 return length;
64}
65
66static DEFINE_MUTEX(card_mutex); 53static DEFINE_MUTEX(card_mutex);
67static LIST_HEAD(card_list); 54static LIST_HEAD(card_list);
68 55
@@ -141,7 +128,7 @@ static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom)
141 * the bus info block, which is always the case for this 128 * the bus info block, which is always the case for this
142 * implementation. */ 129 * implementation. */
143 for (i = 0; i < j; i += length + 1) 130 for (i = 0; i < j; i += length + 1)
144 length = __compute_block_crc(config_rom + i); 131 length = fw_compute_block_crc(config_rom + i);
145 132
146 return j; 133 return j;
147} 134}