Patchwork SuperH IrDA: correct Baud rate error correction

login
register
mail settings
Submitter Nicolas Kaiser
Date Nov. 19, 2010, 12:24 a.m.
Message ID <20101119012402.43e9aa61@absol.kitzblitz>
Download mbox | patch
Permalink /patch/72179/
State Accepted
Delegated to: David Miller
Headers show

Comments

Nicolas Kaiser - Nov. 19, 2010, 12:24 a.m.
It looks to me as if the second value of rate_err_array is intended
to be a decimal 625. However, with a leading 0 it becomes an octal
constant, and as such evaluates to a decimal 405.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 drivers/net/irda/sh_sir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
stephen hemminger - Nov. 19, 2010, 12:41 a.m.
On Fri, 19 Nov 2010 01:24:02 +0100
Nicolas Kaiser <nikai@nikai.net> wrote:

>  	u32 rate_err_array[] = {
> -		0000, 0625, 1250, 1875,
> +		   0,  625, 1250, 1875,
>  		2500, 3125, 3750, 4375,
>  		5000, 5625, 6250, 6875,
>  		7500, 8125, 8750, 9375,

While you are at it make that table const.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches - Nov. 19, 2010, 1:05 a.m.
On Thu, 2010-11-18 at 16:41 -0800, Stephen Hemminger wrote:
> On Fri, 19 Nov 2010 01:24:02 +0100
> Nicolas Kaiser <nikai@nikai.net> wrote:
> >  	u32 rate_err_array[] = {
> > -		0000, 0625, 1250, 1875,
> > +		   0,  625, 1250, 1875,
> >  		2500, 3125, 3750, 4375,
> >  		5000, 5625, 6250, 6875,
> >  		7500, 8125, 8750, 9375,
> While you are at it make that table const.

Good find Nicolas.

static const might be better still.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c
index 00b38bc..52a7c86 100644
--- a/drivers/net/irda/sh_sir.c
+++ b/drivers/net/irda/sh_sir.c
@@ -258,7 +258,7 @@  static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate)
 
 	/* Baud Rate Error Correction x 10000 */
 	u32 rate_err_array[] = {
-		0000, 0625, 1250, 1875,
+		   0,  625, 1250, 1875,
 		2500, 3125, 3750, 4375,
 		5000, 5625, 6250, 6875,
 		7500, 8125, 8750, 9375,