From patchwork Wed Nov 18 19:00:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Richter X-Patchwork-Id: 2109 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Wed, 18 Nov 2009 19:04:27 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Wed, 18 Nov 2009 17:06:39 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NAppL-00047x-M8; Wed, 18 Nov 2009 19:04:27 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758324AbZKRTBI (ORCPT + 1 other); Wed, 18 Nov 2009 14:01:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758311AbZKRTBI (ORCPT ); Wed, 18 Nov 2009 14:01:08 -0500 Received: from einhorn.in-berlin.de ([192.109.42.8]:35610 "EHLO einhorn.in-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753872AbZKRTBH (ORCPT ); Wed, 18 Nov 2009 14:01:07 -0500 X-Envelope-From: stefanr@s5r6.in-berlin.de Received: from stein ([83.221.231.7]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id nAIJ0uKi006392; Wed, 18 Nov 2009 20:00:57 +0100 Date: Wed, 18 Nov 2009 20:00:55 +0100 (CET) From: Stefan Richter Subject: [PATCH 1/6] firedtv: shrink buffer pointer table To: linux-media@vger.kernel.org cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Disposition: INLINE X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/dvb/firewire/firedtv-fw.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) Index: linux-2.6.32-rc7/drivers/media/dvb/firewire/firedtv-fw.c =================================================================== --- linux-2.6.32-rc7.orig/drivers/media/dvb/firewire/firedtv-fw.c +++ linux-2.6.32-rc7/drivers/media/dvb/firewire/firedtv-fw.c @@ -6,9 +6,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -73,7 +73,7 @@ struct firedtv_receive_context { struct fw_iso_buffer buffer; int interrupt_packet; int current_packet; - char *packets[N_PACKETS]; + char *pages[N_PAGES]; }; static int queue_iso(struct firedtv_receive_context *ctx, int index) @@ -100,7 +100,7 @@ static void handle_iso(struct fw_iso_con struct firedtv *fdtv = data; struct firedtv_receive_context *ctx = fdtv->backend_data; __be32 *h, *h_end; - int i = ctx->current_packet, length, err; + int length, err, i = ctx->current_packet; char *p, *p_end; for (h = header, h_end = h + header_length / 4; h < h_end; h++) { @@ -110,7 +110,8 @@ static void handle_iso(struct fw_iso_con length = MAX_PACKET_SIZE; } - p = ctx->packets[i]; + p = ctx->pages[i / PACKETS_PER_PAGE] + + (i % PACKETS_PER_PAGE) * MAX_PACKET_SIZE; p_end = p + length; for (p += CIP_HEADER_SIZE + MPEG2_TS_HEADER_SIZE; p < p_end; @@ -130,8 +131,7 @@ static int start_iso(struct firedtv *fdt { struct firedtv_receive_context *ctx; struct fw_device *device = device_of(fdtv); - char *p; - int i, j, k, err; + int i, err; ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) @@ -153,11 +153,8 @@ static int start_iso(struct firedtv *fdt ctx->interrupt_packet = 1; ctx->current_packet = 0; - for (i = 0, k = 0; k < N_PAGES; k++) { - p = kmap(ctx->buffer.pages[k]); - for (j = 0; j < PACKETS_PER_PAGE && i < N_PACKETS; j++, i++) - ctx->packets[i] = p + j * MAX_PACKET_SIZE; - } + for (i = 0; i < N_PAGES; i++) + ctx->pages[i] = page_address(ctx->buffer.pages[i]); for (i = 0; i < N_PACKETS; i++) { err = queue_iso(ctx, i);