aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/core-transaction.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-transaction.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-transaction.c')
-rw-r--r--drivers/firewire/core-transaction.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index da628c72a46..203e6428bad 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -810,8 +810,7 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request
810 int speed, unsigned long long offset, 810 int speed, unsigned long long offset,
811 void *payload, size_t length, void *callback_data) 811 void *payload, size_t length, void *callback_data)
812{ 812{
813 int i, start, end; 813 int start;
814 __be32 *map;
815 814
816 if (!TCODE_IS_READ_REQUEST(tcode)) { 815 if (!TCODE_IS_READ_REQUEST(tcode)) {
817 fw_send_response(card, request, RCODE_TYPE_ERROR); 816 fw_send_response(card, request, RCODE_TYPE_ERROR);
@@ -824,11 +823,7 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request
824 } 823 }
825 824
826 start = (offset - topology_map_region.start) / 4; 825 start = (offset - topology_map_region.start) / 4;
827 end = start + length / 4; 826 memcpy(payload, &card->topology_map[start], length);
828 map = payload;
829
830 for (i = 0; i < length / 4; i++)
831 map[i] = cpu_to_be32(card->topology_map[start + i]);
832 827
833 fw_send_response(card, request, RCODE_COMPLETE); 828 fw_send_response(card, request, RCODE_COMPLETE);
834} 829}