linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: rmk+kernel@arm.linux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 19/26] ARM: omap: remove almost-const variables
Date: Thu, 02 Jan 2014 15:12:01 +0000	[thread overview]
Message-ID: <E1VyjwH-0005FD-Na@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20140102150836.GA3826@n2100.arm.linux.org.uk>

dma_stride and dma_common_ch_start are only ever initialised to one
known value at initialisation, and are private to each of these files.
There's no point these being variables at all.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/dma.c |   14 ++++----------
 arch/arm/mach-omap2/dma.c |   14 +++++---------
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index d292055d3117..11f0b0ee67a3 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -36,8 +36,6 @@
 
 static u32 errata;
 static u32 enable_1510_mode;
-static u8 dma_stride;
-static enum omap_reg_offsets dma_common_ch_start, dma_common_ch_end;
 
 static u16 reg_map[] = {
 	[GCR]		= 0x400,
@@ -184,7 +182,7 @@ static inline void dma_write(u32 val, int reg, int lch)
 	u8  stride;
 	u32 offset;
 
-	stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
+	stride = (reg >= CPC) ? OMAP1_DMA_STRIDE : 0;
 	offset = reg_map[reg] + (stride * lch);
 
 	__raw_writew(val, dma_base + offset);
@@ -200,7 +198,7 @@ static inline u32 dma_read(int reg, int lch)
 	u8 stride;
 	u32 offset, val;
 
-	stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
+	stride = (reg >= CPC) ? OMAP1_DMA_STRIDE : 0;
 	offset = reg_map[reg] + (stride * lch);
 
 	val = __raw_readw(dma_base + offset);
@@ -216,9 +214,9 @@ static inline u32 dma_read(int reg, int lch)
 
 static void omap1_clear_lch_regs(int lch)
 {
-	int i = dma_common_ch_start;
+	int i;
 
-	for (; i <= dma_common_ch_end; i += 1)
+	for (i = CPC; i <= COLOR; i += 1)
 		dma_write(0, i, lch);
 }
 
@@ -380,10 +378,6 @@ static int __init omap1_system_dma_init(void)
 		goto exit_release_chan;
 	}
 
-	dma_stride		= OMAP1_DMA_STRIDE;
-	dma_common_ch_start	= CPC;
-	dma_common_ch_end	= COLOR;
-
 	dma_pdev = platform_device_register_full(&omap_dma_dev_info);
 	if (IS_ERR(dma_pdev)) {
 		ret = PTR_ERR(dma_pdev);
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index 81c2d3383bc5..e4ac7ac9a228 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -38,11 +38,10 @@
 #define OMAP2_DMA_STRIDE	0x60
 
 static u32 errata;
-static u8 dma_stride;
 
 static struct omap_dma_dev_attr *d;
 
-static enum omap_reg_offsets dma_common_ch_start, dma_common_ch_end;
+static enum omap_reg_offsets dma_common_ch_end;
 
 static u16 reg_map[] = {
 	[REVISION]		= 0x00,
@@ -96,7 +95,7 @@ static inline void dma_write(u32 val, int reg, int lch)
 	u8  stride;
 	u32 offset;
 
-	stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
+	stride = (reg >= CSDP) ? OMAP2_DMA_STRIDE : 0;
 	offset = reg_map[reg] + (stride * lch);
 	__raw_writel(val, dma_base + offset);
 }
@@ -106,7 +105,7 @@ static inline u32 dma_read(int reg, int lch)
 	u8 stride;
 	u32 offset, val;
 
-	stride = (reg >= dma_common_ch_start) ? dma_stride : 0;
+	stride = (reg >= CSDP) ? OMAP2_DMA_STRIDE : 0;
 	offset = reg_map[reg] + (stride * lch);
 	val = __raw_readl(dma_base + offset);
 	return val;
@@ -114,9 +113,9 @@ static inline u32 dma_read(int reg, int lch)
 
 static void omap2_clear_dma(int lch)
 {
-	int i = dma_common_ch_start;
+	int i;
 
-	for (; i <= dma_common_ch_end; i += 1)
+	for (i = CSDP; i <= dma_common_ch_end; i += 1)
 		dma_write(0, i, lch);
 }
 
@@ -219,9 +218,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	struct resource				*mem;
 	char					*name = "omap_dma_system";
 
-	dma_stride		= OMAP2_DMA_STRIDE;
-	dma_common_ch_start	= CSDP;
-
 	p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL);
 	if (!p) {
 		pr_err("%s: Unable to allocate pdata for %s:%s\n",
-- 
1.7.4.4

  parent reply	other threads:[~2014-01-02 15:12 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-02 15:08 [PATCH RFC 00/26] Migrate more OMAP DMA code to DMA engine Russell King - ARM Linux
2014-01-02 15:08 ` [PATCH RFC 01/26] dmaengine: omap-dma: use devm_kzalloc() to allocate omap_dmadev Russell King
2014-01-02 15:09 ` [PATCH RFC 02/26] dmaengine: omap-dma: provide a hook to get the underlying DMA platform ops Russell King
2014-01-02 15:09 ` [PATCH RFC 03/26] dmaengine: omap-dma: program hardware directly Russell King
2014-01-22 12:54   ` Sricharan R
2014-01-22 14:13     ` Russell King - ARM Linux
2014-01-02 15:09 ` [PATCH RFC 04/26] dmaengine: omap-dma: consolidate writes to DMA registers Russell King
2014-01-02 15:09 ` [PATCH RFC 05/26] dmaengine: omap-dma: control start/stop directly Russell King
2014-01-13 22:18   ` Tony Lindgren
2014-01-02 15:09 ` [PATCH RFC 06/26] dmaengine: omap-dma: move reading of dma position to omap-dma.c Russell King
2014-01-02 15:10 ` [PATCH RFC 07/26] dmaengine: omap-dma: consolidate setup of CSDP Russell King
2014-01-02 15:10 ` [PATCH RFC 08/26] dmaengine: omap-dma: consolidate setup of CCR Russell King
2014-01-13 22:14   ` Tony Lindgren
2014-01-13 23:12     ` Russell King - ARM Linux
2014-01-14 13:39       ` Russell King - ARM Linux
2014-01-14 17:04         ` Tony Lindgren
2014-01-22 12:55   ` Sricharan R
2014-01-22 14:19     ` Russell King - ARM Linux
2014-01-22 14:39       ` Santosh Shilimkar
2014-01-02 15:10 ` [PATCH RFC 09/26] dmaengine: omap-dma: provide register definitions Russell King
2014-01-02 15:10 ` [PATCH RFC 10/26] dmaengine: omap-dma: move CCR buffering disable errata out of the fast path Russell King
2014-01-02 15:10 ` [PATCH RFC 11/26] dmaengine: omap-dma: consolidate clearing channel status register Russell King
2014-01-02 15:10 ` [PATCH RFC 12/26] dmaengine: omap-dma: improve efficiency loading C.SA/C.EI/C.FI registers Russell King
2014-01-02 15:11 ` [PATCH RFC 13/26] dmaengine: omap-dma: move clnk_ctrl setting to preparation functions Russell King
2014-01-02 15:11 ` [PATCH RFC 14/26] dmaengine: omap-dma: move barrier to omap_dma_start_desc() Russell King
2014-01-02 15:11 ` [PATCH RFC 15/26] dmaengine: omap-dma: use cached CCR value when enabling DMA Russell King
2014-01-02 15:11 ` [PATCH RFC 16/26] dmaengine: omap-dma: provide register read/write functions Russell King
2014-01-02 15:11 ` [PATCH RFC 17/26] dmaengine: omap-dma: cleanup errata 3.3 handling Russell King
2014-01-02 15:11 ` [PATCH RFC 18/26] ARM: omap: remove references to disable_irq_lch Russell King
2014-01-02 15:12 ` Russell King [this message]
2014-01-02 15:12 ` [PATCH RFC 20/26] ARM: omap: clean up DMA register accesses Russell King
2014-01-02 15:49   ` Andy Shevchenko
2014-01-02 16:07     ` Russell King - ARM Linux
2014-01-02 15:12 ` [PATCH RFC 21/26] ARM: omap: dma: get rid of errata global Russell King
2014-01-02 15:12 ` [PATCH RFC 22/26] ARM: omap: move dma channel allocation into plat-omap code Russell King
2014-01-02 15:46   ` Andy Shevchenko
2014-01-02 15:12 ` [PATCH RFC 23/26] ARM: omap: dma: get rid of 'p' allocation and clean up Russell King
2014-01-02 15:12 ` [PATCH RFC 24/26] dmaengine: omap-dma: move register read/writes into omap-dma.c Russell King
2014-01-02 15:13 ` [PATCH RFC 25/26] dmaengine: omap-dma: move IRQ handling to omap-dma Russell King
2014-01-02 15:13 ` [PATCH RFC 26/26] ARM: omap2: ensure dma platform device has resources Russell King
2014-01-08  1:21 ` [PATCH RFC 00/26] Migrate more OMAP DMA code to DMA engine Tony Lindgren
2014-01-09 15:24   ` Russell King - ARM Linux
2014-01-13 14:18     ` Russell King - ARM Linux
2014-01-13 17:37       ` Tony Lindgren
2014-01-13 18:55         ` Russell King - ARM Linux
2014-01-13 19:26           ` Tony Lindgren
2014-01-13 20:34             ` Russell King - ARM Linux
2014-01-13 21:02               ` Tony Lindgren
2014-01-13 21:11                 ` Russell King - ARM Linux
2014-01-13 21:21                   ` Tony Lindgren
2014-01-13 21:28                     ` Russell King - ARM Linux
2014-01-13 22:03                       ` Tony Lindgren
2014-01-09 12:37 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1VyjwH-0005FD-Na@rmk-PC.arm.linux.org.uk \
    --to=rmk+kernel@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).