aboutsummaryrefslogtreecommitdiff
path: root/drivers/firewire/core-card.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-10-08 00:42:53 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-10-14 23:10:48 +0200
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 f5813078999..7083bcc1b9c 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -38,7 +38,7 @@
#include "core.h"
-static int __compute_block_crc(__be32 *block)
+int fw_compute_block_crc(__be32 *block)
{
int length;
u16 crc;
@@ -50,19 +50,6 @@ static int __compute_block_crc(__be32 *block)
return length;
}
-int fw_compute_block_crc(u32 *block)
-{
- __be32 be32_block[256];
- int i, length;
-
- length = (*block >> 16) & 0xff;
- for (i = 0; i < length; i++)
- be32_block[i] = cpu_to_be32(block[i + 1]);
- *block |= crc_itu_t(0, (u8 *) be32_block, length * 4);
-
- return length;
-}
-
static DEFINE_MUTEX(card_mutex);
static LIST_HEAD(card_list);
@@ -141,7 +128,7 @@ static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom)
* the bus info block, which is always the case for this
* implementation. */
for (i = 0; i < j; i += length + 1)
- length = __compute_block_crc(config_rom + i);
+ length = fw_compute_block_crc(config_rom + i);
return j;
}