aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-11-08 09:53:35 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-04-03 19:31:43 -0400
commitad0c381a8b3a15b8edfca0996729ea45692470ca (patch)
tree0c693b5259fc2150182999a1aa06a807ecf04263
parente38b1485fde832f72ab478f947f6e78a8e28c58b (diff)
ARM: omap: remove almost-const variables
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. Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-omap1/dma.c14
-rw-r--r--arch/arm/mach-omap2/dma.c14
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 @@
36 36
37static u32 errata; 37static u32 errata;
38static u32 enable_1510_mode; 38static u32 enable_1510_mode;
39static u8 dma_stride;
40static enum omap_reg_offsets dma_common_ch_start, dma_common_ch_end;
41 39
42static u16 reg_map[] = { 40static u16 reg_map[] = {
43 [GCR] = 0x400, 41 [GCR] = 0x400,
@@ -184,7 +182,7 @@ static inline void dma_write(u32 val, int reg, int lch)
184 u8 stride; 182 u8 stride;
185 u32 offset; 183 u32 offset;
186 184
187 stride = (reg >= dma_common_ch_start) ? dma_stride : 0; 185 stride = (reg >= CPC) ? OMAP1_DMA_STRIDE : 0;
188 offset = reg_map[reg] + (stride * lch); 186 offset = reg_map[reg] + (stride * lch);
189 187
190 __raw_writew(val, dma_base + offset); 188 __raw_writew(val, dma_base + offset);
@@ -200,7 +198,7 @@ static inline u32 dma_read(int reg, int lch)
200 u8 stride; 198 u8 stride;
201 u32 offset, val; 199 u32 offset, val;
202 200
203 stride = (reg >= dma_common_ch_start) ? dma_stride : 0; 201 stride = (reg >= CPC) ? OMAP1_DMA_STRIDE : 0;
204 offset = reg_map[reg] + (stride * lch); 202 offset = reg_map[reg] + (stride * lch);
205 203
206 val = __raw_readw(dma_base + offset); 204 val = __raw_readw(dma_base + offset);
@@ -216,9 +214,9 @@ static inline u32 dma_read(int reg, int lch)
216 214
217static void omap1_clear_lch_regs(int lch) 215static void omap1_clear_lch_regs(int lch)
218{ 216{
219 int i = dma_common_ch_start; 217 int i;
220 218
221 for (; i <= dma_common_ch_end; i += 1) 219 for (i = CPC; i <= COLOR; i += 1)
222 dma_write(0, i, lch); 220 dma_write(0, i, lch);
223} 221}
224 222
@@ -380,10 +378,6 @@ static int __init omap1_system_dma_init(void)
380 goto exit_release_chan; 378 goto exit_release_chan;
381 } 379 }
382 380
383 dma_stride = OMAP1_DMA_STRIDE;
384 dma_common_ch_start = CPC;
385 dma_common_ch_end = COLOR;
386
387 dma_pdev = platform_device_register_full(&omap_dma_dev_info); 381 dma_pdev = platform_device_register_full(&omap_dma_dev_info);
388 if (IS_ERR(dma_pdev)) { 382 if (IS_ERR(dma_pdev)) {
389 ret = PTR_ERR(dma_pdev); 383 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 @@
38#define OMAP2_DMA_STRIDE 0x60 38#define OMAP2_DMA_STRIDE 0x60
39 39
40static u32 errata; 40static u32 errata;
41static u8 dma_stride;
42 41
43static struct omap_dma_dev_attr *d; 42static struct omap_dma_dev_attr *d;
44 43
45static enum omap_reg_offsets dma_common_ch_start, dma_common_ch_end; 44static enum omap_reg_offsets dma_common_ch_end;
46 45
47static u16 reg_map[] = { 46static u16 reg_map[] = {
48 [REVISION] = 0x00, 47 [REVISION] = 0x00,
@@ -96,7 +95,7 @@ static inline void dma_write(u32 val, int reg, int lch)
96 u8 stride; 95 u8 stride;
97 u32 offset; 96 u32 offset;
98 97
99 stride = (reg >= dma_common_ch_start) ? dma_stride : 0; 98 stride = (reg >= CSDP) ? OMAP2_DMA_STRIDE : 0;
100 offset = reg_map[reg] + (stride * lch); 99 offset = reg_map[reg] + (stride * lch);
101 __raw_writel(val, dma_base + offset); 100 __raw_writel(val, dma_base + offset);
102} 101}
@@ -106,7 +105,7 @@ static inline u32 dma_read(int reg, int lch)
106 u8 stride; 105 u8 stride;
107 u32 offset, val; 106 u32 offset, val;
108 107
109 stride = (reg >= dma_common_ch_start) ? dma_stride : 0; 108 stride = (reg >= CSDP) ? OMAP2_DMA_STRIDE : 0;
110 offset = reg_map[reg] + (stride * lch); 109 offset = reg_map[reg] + (stride * lch);
111 val = __raw_readl(dma_base + offset); 110 val = __raw_readl(dma_base + offset);
112 return val; 111 return val;
@@ -114,9 +113,9 @@ static inline u32 dma_read(int reg, int lch)
114 113
115static void omap2_clear_dma(int lch) 114static void omap2_clear_dma(int lch)
116{ 115{
117 int i = dma_common_ch_start; 116 int i;
118 117
119 for (; i <= dma_common_ch_end; i += 1) 118 for (i = CSDP; i <= dma_common_ch_end; i += 1)
120 dma_write(0, i, lch); 119 dma_write(0, i, lch);
121} 120}
122 121
@@ -219,9 +218,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
219 struct resource *mem; 218 struct resource *mem;
220 char *name = "omap_dma_system"; 219 char *name = "omap_dma_system";
221 220
222 dma_stride = OMAP2_DMA_STRIDE;
223 dma_common_ch_start = CSDP;
224
225 p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL); 221 p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL);
226 if (!p) { 222 if (!p) {
227 pr_err("%s: Unable to allocate pdata for %s:%s\n", 223 pr_err("%s: Unable to allocate pdata for %s:%s\n",