From: Roel Kluin <12o3l@tiscali.nl>
To: adaplas@gmail.com, linux-fbdev-devel@lists.sourceforge.net,
lkml <linux-kernel@vger.kernel.org>,
Joe Perches <joe@perches.com>
Subject: [PATCH v2] aty128fb: test below 0 on unsigned pll->post_divider
Date: Wed, 23 Apr 2008 21:24:58 +0200 [thread overview]
Message-ID: <480F8D0A.8080808@tiscali.nl> (raw)
In-Reply-To: <480F81DC.5010505@tiscali.nl>
Joe Perches wrote:
>
> In both uses, sizeof(post_dividers) should be ARRAY_SIZE(post_dividers)
> Yes, it's an unsigned char array, it works, but it's unsightly.
>
> cheers, Joe
Thanks Joe, updated patch below
---
pll->post_divider is unsigned, so the test fails
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..5049228 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1339,10 +1339,8 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
if (vclk * 12 < c.ppll_min)
vclk = c.ppll_min/12;
- pll->post_divider = -1;
-
/* now, find an acceptable divider */
- for (i = 0; i < sizeof(post_dividers); i++) {
+ for (i = 0; i < ARRAY_SIZE(post_dividers); i++) {
output_freq = post_dividers[i] * vclk;
if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) {
pll->post_divider = post_dividers[i];
@@ -1350,7 +1348,7 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
}
}
- if (pll->post_divider < 0)
+ if (i == ARRAY_SIZE(post_dividers))
return -EINVAL;
/* calculate feedback divider */
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
WARNING: multiple messages have this Message-ID (diff)
From: Roel Kluin <12o3l@tiscali.nl>
To: adaplas@gmail.com, linux-fbdev-devel@lists.sourceforge.net,
lkml <linux-kernel@vger.kernel.org>,
Joe Perches <joe@perches.com>
Subject: [PATCH v2] aty128fb: test below 0 on unsigned pll->post_divider
Date: Wed, 23 Apr 2008 21:24:58 +0200 [thread overview]
Message-ID: <480F8D0A.8080808@tiscali.nl> (raw)
In-Reply-To: <480F81DC.5010505@tiscali.nl>
Joe Perches wrote:
>
> In both uses, sizeof(post_dividers) should be ARRAY_SIZE(post_dividers)
> Yes, it's an unsigned char array, it works, but it's unsightly.
>
> cheers, Joe
Thanks Joe, updated patch below
---
pll->post_divider is unsigned, so the test fails
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..5049228 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1339,10 +1339,8 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
if (vclk * 12 < c.ppll_min)
vclk = c.ppll_min/12;
- pll->post_divider = -1;
-
/* now, find an acceptable divider */
- for (i = 0; i < sizeof(post_dividers); i++) {
+ for (i = 0; i < ARRAY_SIZE(post_dividers); i++) {
output_freq = post_dividers[i] * vclk;
if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) {
pll->post_divider = post_dividers[i];
@@ -1350,7 +1348,7 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
}
}
- if (pll->post_divider < 0)
+ if (i == ARRAY_SIZE(post_dividers))
return -EINVAL;
/* calculate feedback divider */
next prev parent reply other threads:[~2008-04-23 19:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-23 18:37 [PATCH] aty128fb: test below 0 on unsigned pll->post_divider Roel Kluin
2008-04-23 18:37 ` Roel Kluin
2008-04-23 19:24 ` Roel Kluin [this message]
2008-04-23 19:24 ` [PATCH v2] " Roel Kluin
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=480F8D0A.8080808@tiscali.nl \
--to=12o3l@tiscali.nl \
--cc=adaplas@gmail.com \
--cc=joe@perches.com \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.