aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/firewire/firedtv-fw.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-11-18 14:00:55 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:43 -0500
commita8aeb7836edac3e0cce1286eefbca793c54cbad0 (patch)
treeb7ad2ec41da83dd3b1689dfcf3f58f8f5fe57f89 /drivers/media/dvb/firewire/firedtv-fw.c
parentb699c2712b1ddcc3ef4491adde00a47a880fde97 (diff)
V4L/DVB (13408): firedtv: shrink buffer pointer table
Cache only addresses of whole pages, not of each buffer chunk. Besides, page addresses can be obtained by page_address() instead of kmap() since they were allocated in lowmem. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/firewire/firedtv-fw.c')
-rw-r--r--drivers/media/dvb/firewire/firedtv-fw.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-fw.c b/drivers/media/dvb/firewire/firedtv-fw.c
index 208e5b59e830..6954848b5803 100644
--- a/drivers/media/dvb/firewire/firedtv-fw.c
+++ b/drivers/media/dvb/firewire/firedtv-fw.c
@@ -6,9 +6,9 @@
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/firewire.h> 7#include <linux/firewire.h>
8#include <linux/firewire-constants.h> 8#include <linux/firewire-constants.h>
9#include <linux/highmem.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/mm.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/types.h> 14#include <linux/types.h>
@@ -73,7 +73,7 @@ struct firedtv_receive_context {
73 struct fw_iso_buffer buffer; 73 struct fw_iso_buffer buffer;
74 int interrupt_packet; 74 int interrupt_packet;
75 int current_packet; 75 int current_packet;
76 char *packets[N_PACKETS]; 76 char *pages[N_PAGES];
77}; 77};
78 78
79static int queue_iso(struct firedtv_receive_context *ctx, int index) 79static int queue_iso(struct firedtv_receive_context *ctx, int index)
@@ -100,7 +100,7 @@ static void handle_iso(struct fw_iso_context *context, u32 cycle,
100 struct firedtv *fdtv = data; 100 struct firedtv *fdtv = data;
101 struct firedtv_receive_context *ctx = fdtv->backend_data; 101 struct firedtv_receive_context *ctx = fdtv->backend_data;
102 __be32 *h, *h_end; 102 __be32 *h, *h_end;
103 int i = ctx->current_packet, length, err; 103 int length, err, i = ctx->current_packet;
104 char *p, *p_end; 104 char *p, *p_end;
105 105
106 for (h = header, h_end = h + header_length / 4; h < h_end; h++) { 106 for (h = header, h_end = h + header_length / 4; h < h_end; h++) {
@@ -110,7 +110,8 @@ static void handle_iso(struct fw_iso_context *context, u32 cycle,
110 length = MAX_PACKET_SIZE; 110 length = MAX_PACKET_SIZE;
111 } 111 }
112 112
113 p = ctx->packets[i]; 113 p = ctx->pages[i / PACKETS_PER_PAGE]
114 + (i % PACKETS_PER_PAGE) * MAX_PACKET_SIZE;
114 p_end = p + length; 115 p_end = p + length;
115 116
116 for (p += CIP_HEADER_SIZE + MPEG2_TS_HEADER_SIZE; p < p_end; 117 for (p += CIP_HEADER_SIZE + MPEG2_TS_HEADER_SIZE; p < p_end;
@@ -130,8 +131,7 @@ static int start_iso(struct firedtv *fdtv)
130{ 131{
131 struct firedtv_receive_context *ctx; 132 struct firedtv_receive_context *ctx;
132 struct fw_device *device = device_of(fdtv); 133 struct fw_device *device = device_of(fdtv);
133 char *p; 134 int i, err;
134 int i, j, k, err;
135 135
136 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); 136 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
137 if (!ctx) 137 if (!ctx)
@@ -153,11 +153,8 @@ static int start_iso(struct firedtv *fdtv)
153 ctx->interrupt_packet = 1; 153 ctx->interrupt_packet = 1;
154 ctx->current_packet = 0; 154 ctx->current_packet = 0;
155 155
156 for (i = 0, k = 0; k < N_PAGES; k++) { 156 for (i = 0; i < N_PAGES; i++)
157 p = kmap(ctx->buffer.pages[k]); 157 ctx->pages[i] = page_address(ctx->buffer.pages[i]);
158 for (j = 0; j < PACKETS_PER_PAGE && i < N_PACKETS; j++, i++)
159 ctx->packets[i] = p + j * MAX_PACKET_SIZE;
160 }
161 158
162 for (i = 0; i < N_PACKETS; i++) { 159 for (i = 0; i < N_PACKETS; i++) {
163 err = queue_iso(ctx, i); 160 err = queue_iso(ctx, i);