2009-11-01 21:48:12

by Thiago Farina

[permalink] [raw]
Subject: [PATCH] trivial: Make use of ARRAY_SIZE.

Cleanup the usage of DBE_VT_SIZE since the kernel already defines the
same macro for the same propose.

Signed-off-by: Thiago Farina <[email protected]>
---
drivers/video/sgivwfb.c | 4 ++--
include/video/sgivw.h | 11 +++++------
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c
index bba5371..f860122 100644
--- a/drivers/video/sgivwfb.c
+++ b/drivers/video/sgivwfb.c
@@ -260,13 +260,13 @@ static int sgivwfb_check_var(struct fb_var_screeninfo *var,
var->grayscale = 0; /* No grayscale for now */

/* determine valid resolution and timing */
- for (min_mode = 0; min_mode < DBE_VT_SIZE; min_mode++) {
+ for (min_mode = 0; min_mode < ARRAY_SIZE(dbeVTimings); min_mode++) {
if (dbeVTimings[min_mode].width >= var->xres &&
dbeVTimings[min_mode].height >= var->yres)
break;
}

- if (min_mode == DBE_VT_SIZE)
+ if (min_mode == ARRAY_SIZE(dbeVTimings))
return -EINVAL; /* Resolution to high */

/* XXX FIXME - should try to pick best refresh rate */
diff --git a/include/video/sgivw.h b/include/video/sgivw.h
index 55f2a7c..f6aa569 100644
--- a/include/video/sgivw.h
+++ b/include/video/sgivw.h
@@ -351,7 +351,7 @@ typedef enum {
struct dbe_timing_info
{
dbe_timing_t type;
- int flags;
+ int flags;
short width; /* Monitor resolution */
short height;
int fields_sec; /* fields/sec (Hz -3 dec. places */
@@ -389,11 +389,11 @@ struct dbe_timing_info dbeVTimings[] = {
{
DBE_VT_640_480_60,
/* flags, width, height, fields_sec, cfreq */
- 0, 640, 480, 59940, 25175,
+ 0, 640, 480, 59940, 25175,
/* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
- 800, 640, 800, 656, 752,
+ 800, 640, 800, 656, 752,
/* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
- 525, 480, 525, 490, 492,
+ 525, 480, 525, 490, 492,
/* pll_m, pll_n, pll_p */
15, 2, 3
},
@@ -650,7 +650,7 @@ struct dbe_timing_info dbeVTimings[] = {
/* pll_m, pll_n, pll_p */
6, 1, 0
},
-
+
{
DBE_VT_1920_1200_60,
/* flags, width, height, fields_sec, cfreq */
@@ -676,7 +676,6 @@ struct dbe_timing_info dbeVTimings[] = {
}
};

-#define DBE_VT_SIZE (sizeof(dbeVTimings)/sizeof(dbeVTimings[0]))
#endif // INCLUDE_TIMING_TABLE_DATA

#endif // ! __SGIVWFB_H__
--
1.6.5.1.61.ge79999


2009-11-02 16:05:48

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] trivial: Make use of ARRAY_SIZE.

On Sun, 1 Nov 2009, Thiago Farina wrote:

> Cleanup the usage of DBE_VT_SIZE since the kernel already defines the
> same macro for the same propose.
>
> Signed-off-by: Thiago Farina <[email protected]>
> ---
> drivers/video/sgivwfb.c | 4 ++--
> include/video/sgivw.h | 11 +++++------
> 2 files changed, 7 insertions(+), 8 deletions(-)

I have update the changelog with the fact that your patch also cleans up
the whitespace in the immediate neighbourhood of the changes.

Applied, thanks.

--
Jiri Kosina
SUSE Labs, Novell Inc.