diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-09-19 05:40:31 -0400 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-12 17:41:08 -0400 |
commit | 05432837ae0dfc6c7de93d081b1377ced4eb866b (patch) | |
tree | 63fa348d96185a59395e04009aec0238f5e9f030 /drivers | |
parent | d272f428fac77ec57049a3293583ab3353928b1c (diff) |
fbdev: sh_mobile_meram: Make variables unsigned where applicable
Many variables, such as loop counters, sizes and offsets, should be
unsigned integers. Make them so.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/sh_mobile_meram.c | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c index 2ad5a454fa2e..548f70096124 100644 --- a/drivers/video/sh_mobile_meram.c +++ b/drivers/video/sh_mobile_meram.c | |||
@@ -104,7 +104,7 @@ struct sh_mobile_meram_priv { | |||
104 | void __iomem *base; | 104 | void __iomem *base; |
105 | struct mutex lock; | 105 | struct mutex lock; |
106 | unsigned long used_icb; | 106 | unsigned long used_icb; |
107 | int used_meram_cache_regions; | 107 | unsigned int used_meram_cache_regions; |
108 | unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM]; | 108 | unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM]; |
109 | unsigned long cmn_saved_regs[CMN_REGS_SIZE]; | 109 | unsigned long cmn_saved_regs[CMN_REGS_SIZE]; |
110 | unsigned long icb_saved_regs[ICB_REGS_SIZE * SH_MOBILE_MERAM_ICB_NUM]; | 110 | unsigned long icb_saved_regs[ICB_REGS_SIZE * SH_MOBILE_MERAM_ICB_NUM]; |
@@ -120,24 +120,25 @@ struct sh_mobile_meram_priv { | |||
120 | 120 | ||
121 | #define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20) | 121 | #define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20) |
122 | 122 | ||
123 | static inline void meram_write_icb(void __iomem *base, int idx, int off, | 123 | static inline void meram_write_icb(void __iomem *base, unsigned int idx, |
124 | unsigned long val) | 124 | unsigned int off, unsigned long val) |
125 | { | 125 | { |
126 | iowrite32(val, MERAM_ICB_OFFSET(base, idx, off)); | 126 | iowrite32(val, MERAM_ICB_OFFSET(base, idx, off)); |
127 | } | 127 | } |
128 | 128 | ||
129 | static inline unsigned long meram_read_icb(void __iomem *base, int idx, int off) | 129 | static inline unsigned long meram_read_icb(void __iomem *base, unsigned int idx, |
130 | unsigned int off) | ||
130 | { | 131 | { |
131 | return ioread32(MERAM_ICB_OFFSET(base, idx, off)); | 132 | return ioread32(MERAM_ICB_OFFSET(base, idx, off)); |
132 | } | 133 | } |
133 | 134 | ||
134 | static inline void meram_write_reg(void __iomem *base, int off, | 135 | static inline void meram_write_reg(void __iomem *base, unsigned int off, |
135 | unsigned long val) | 136 | unsigned long val) |
136 | { | 137 | { |
137 | iowrite32(val, base + off); | 138 | iowrite32(val, base + off); |
138 | } | 139 | } |
139 | 140 | ||
140 | static inline unsigned long meram_read_reg(void __iomem *base, int off) | 141 | static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off) |
141 | { | 142 | { |
142 | return ioread32(base + off); | 143 | return ioread32(base + off); |
143 | } | 144 | } |
@@ -158,8 +159,8 @@ static inline unsigned long meram_read_reg(void __iomem *base, int off) | |||
158 | static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv, | 159 | static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv, |
159 | struct sh_mobile_meram_icb_cfg *new) | 160 | struct sh_mobile_meram_icb_cfg *new) |
160 | { | 161 | { |
161 | int i; | 162 | unsigned int used_start, used_end, meram_start, meram_end; |
162 | int used_start, used_end, meram_start, meram_end; | 163 | unsigned int i; |
163 | 164 | ||
164 | /* valid ICB? */ | 165 | /* valid ICB? */ |
165 | if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f) | 166 | if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f) |
@@ -190,7 +191,7 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv, | |||
190 | static inline void meram_mark(struct sh_mobile_meram_priv *priv, | 191 | static inline void meram_mark(struct sh_mobile_meram_priv *priv, |
191 | struct sh_mobile_meram_icb_cfg *new) | 192 | struct sh_mobile_meram_icb_cfg *new) |
192 | { | 193 | { |
193 | int n; | 194 | unsigned int n; |
194 | 195 | ||
195 | if (new->marker_icb < 0 || new->cache_icb < 0) | 196 | if (new->marker_icb < 0 || new->cache_icb < 0) |
196 | return; | 197 | return; |
@@ -213,8 +214,8 @@ static inline void meram_mark(struct sh_mobile_meram_priv *priv, | |||
213 | static inline void meram_unmark(struct sh_mobile_meram_priv *priv, | 214 | static inline void meram_unmark(struct sh_mobile_meram_priv *priv, |
214 | struct sh_mobile_meram_icb_cfg *icb) | 215 | struct sh_mobile_meram_icb_cfg *icb) |
215 | { | 216 | { |
216 | int i; | ||
217 | unsigned long pattern; | 217 | unsigned long pattern; |
218 | unsigned int i; | ||
218 | 219 | ||
219 | if (icb->marker_icb < 0 || icb->cache_icb < 0) | 220 | if (icb->marker_icb < 0 || icb->cache_icb < 0) |
220 | return; | 221 | return; |
@@ -304,12 +305,15 @@ static inline void meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata, | |||
304 | 305 | ||
305 | static int meram_init(struct sh_mobile_meram_priv *priv, | 306 | static int meram_init(struct sh_mobile_meram_priv *priv, |
306 | struct sh_mobile_meram_icb_cfg *icb, | 307 | struct sh_mobile_meram_icb_cfg *icb, |
307 | int xres, int yres, int *out_pitch) | 308 | unsigned int xres, unsigned int yres, |
309 | unsigned int *out_pitch) | ||
308 | { | 310 | { |
309 | unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres); | 311 | unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres); |
310 | unsigned long bnm; | 312 | unsigned long bnm; |
311 | int lcdc_pitch, xpitch, line_cnt; | 313 | unsigned int lcdc_pitch; |
312 | int save_lines; | 314 | unsigned int xpitch; |
315 | unsigned int line_cnt; | ||
316 | unsigned int save_lines; | ||
313 | 317 | ||
314 | /* adjust pitch to 1024, 2048, 4096 or 8192 */ | 318 | /* adjust pitch to 1024, 2048, 4096 or 8192 */ |
315 | lcdc_pitch = (xres - 1) | 1023; | 319 | lcdc_pitch = (xres - 1) | 1023; |
@@ -386,16 +390,18 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv, | |||
386 | 390 | ||
387 | static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata, | 391 | static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata, |
388 | struct sh_mobile_meram_cfg *cfg, | 392 | struct sh_mobile_meram_cfg *cfg, |
389 | int xres, int yres, int pixelformat, | 393 | unsigned int xres, unsigned int yres, |
394 | unsigned int pixelformat, | ||
390 | unsigned long base_addr_y, | 395 | unsigned long base_addr_y, |
391 | unsigned long base_addr_c, | 396 | unsigned long base_addr_c, |
392 | unsigned long *icb_addr_y, | 397 | unsigned long *icb_addr_y, |
393 | unsigned long *icb_addr_c, | 398 | unsigned long *icb_addr_c, |
394 | int *pitch) | 399 | unsigned int *pitch) |
395 | { | 400 | { |
396 | struct platform_device *pdev; | 401 | struct platform_device *pdev; |
397 | struct sh_mobile_meram_priv *priv; | 402 | struct sh_mobile_meram_priv *priv; |
398 | int n, out_pitch; | 403 | unsigned int out_pitch; |
404 | unsigned int n; | ||
399 | int error = 0; | 405 | int error = 0; |
400 | 406 | ||
401 | if (!pdata || !pdata->priv || !pdata->pdev || !cfg) | 407 | if (!pdata || !pdata->priv || !pdata->pdev || !cfg) |
@@ -538,21 +544,21 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev) | |||
538 | { | 544 | { |
539 | struct platform_device *pdev = to_platform_device(dev); | 545 | struct platform_device *pdev = to_platform_device(dev); |
540 | struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); | 546 | struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); |
541 | int k, j; | 547 | unsigned int i, j; |
542 | 548 | ||
543 | for (k = 0; k < CMN_REGS_SIZE; k++) | 549 | for (i = 0; i < CMN_REGS_SIZE; i++) |
544 | priv->cmn_saved_regs[k] = meram_read_reg(priv->base, | 550 | priv->cmn_saved_regs[i] = meram_read_reg(priv->base, |
545 | common_regs[k]); | 551 | common_regs[i]); |
546 | 552 | ||
547 | for (j = 0; j < 32; j++) { | 553 | for (i = 0; i < 32; i++) { |
548 | if (!test_bit(j, &priv->used_icb)) | 554 | if (!test_bit(i, &priv->used_icb)) |
549 | continue; | 555 | continue; |
550 | for (k = 0; k < ICB_REGS_SIZE; k++) { | 556 | for (j = 0; j < ICB_REGS_SIZE; j++) { |
551 | priv->icb_saved_regs[j * ICB_REGS_SIZE + k] = | 557 | priv->icb_saved_regs[i * ICB_REGS_SIZE + j] = |
552 | meram_read_icb(priv->base, j, icb_regs[k]); | 558 | meram_read_icb(priv->base, i, icb_regs[j]); |
553 | /* Reset ICB on resume */ | 559 | /* Reset ICB on resume */ |
554 | if (icb_regs[k] == MExxCTL) | 560 | if (icb_regs[j] == MExxCTL) |
555 | priv->icb_saved_regs[j * ICB_REGS_SIZE + k] |= | 561 | priv->icb_saved_regs[i * ICB_REGS_SIZE + j] |= |
556 | MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF; | 562 | MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF; |
557 | } | 563 | } |
558 | } | 564 | } |
@@ -563,20 +569,20 @@ static int sh_mobile_meram_runtime_resume(struct device *dev) | |||
563 | { | 569 | { |
564 | struct platform_device *pdev = to_platform_device(dev); | 570 | struct platform_device *pdev = to_platform_device(dev); |
565 | struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); | 571 | struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); |
566 | int k, j; | 572 | unsigned int i, j; |
567 | 573 | ||
568 | for (j = 0; j < 32; j++) { | 574 | for (i = 0; i < 32; i++) { |
569 | if (!test_bit(j, &priv->used_icb)) | 575 | if (!test_bit(i, &priv->used_icb)) |
570 | continue; | 576 | continue; |
571 | for (k = 0; k < ICB_REGS_SIZE; k++) { | 577 | for (j = 0; j < ICB_REGS_SIZE; j++) { |
572 | meram_write_icb(priv->base, j, icb_regs[k], | 578 | meram_write_icb(priv->base, i, icb_regs[j], |
573 | priv->icb_saved_regs[j * ICB_REGS_SIZE + k]); | 579 | priv->icb_saved_regs[i * ICB_REGS_SIZE + j]); |
574 | } | 580 | } |
575 | } | 581 | } |
576 | 582 | ||
577 | for (k = 0; k < CMN_REGS_SIZE; k++) | 583 | for (i = 0; i < CMN_REGS_SIZE; i++) |
578 | meram_write_reg(priv->base, common_regs[k], | 584 | meram_write_reg(priv->base, common_regs[i], |
579 | priv->cmn_saved_regs[k]); | 585 | priv->cmn_saved_regs[i]); |
580 | return 0; | 586 | return 0; |
581 | } | 587 | } |
582 | 588 | ||