linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem
@ 2006-01-30 15:29 V. Ananda Krishnan
  2006-01-30 18:58 ` Greg KH
  2006-02-01  0:01 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: V. Ananda Krishnan @ 2006-01-30 15:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Alan Cox, Adrian Bunk, Greg KH, Scott_Kilau

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

Digi serial port console doesn't work when baud rates are set higher 
than 38400.  So the lookup table and code in jsm_neo.c has been modified 
and tested.  Please let me have the feed-back.

Thanks,
V. Ananda Krishnan



Authors: Scott Kilau and V. Ananda Krishnan
Signed-off-by: V.Ananda Krishnan

...



[-- Attachment #2: neo_patch --]
[-- Type: text/plain, Size: 2238 bytes --]

diff -Naur linux-2.6.16-rc1/drivers/serial/jsm/jsm_neo.c linux-2.6.16-rc1-mod/drivers/serial/jsm/jsm_neo.c
--- linux-2.6.16-rc1/drivers/serial/jsm/jsm_neo.c	2006-01-27 21:19:45.000000000 -0600
+++ linux-2.6.16-rc1-mod/drivers/serial/jsm/jsm_neo.c	2006-01-27 21:43:28.000000000 -0600
@@ -966,47 +966,41 @@
			if (ch->ch_flags & CH_BAUD0)
				ch->ch_flags &= ~(CH_BAUD0);
		} else {
-			int iindex = 0;
-			int jindex = 0;
-
-			const u64 bauds[4][16] = {
-				{
-					0,	50,	75,	110,
-					134,	150,	200,	300,
-					600,	1200,	1800,	2400,
-					4800,	9600,	19200,	38400 },
-				{
-					0,	57600,	115200, 230400,
-					460800, 150,	200,	921600,
-					600,	1200,	1800,	2400,
-					4800,	9600,	19200,	38400 },
-				{
-					0,	57600,	76800, 115200,
-					131657, 153600, 230400, 460800,
-					921600, 1200,	1800,	2400,
-					4800,	9600,	19200,	38400 },
-				{
-					0,	57600,	115200, 230400,
-					460800, 150,	200,	921600,
-					600,	1200,	1800,	2400,
-					4800,	9600,	19200,	38400 }
+			int i= 0;
+			struct baud_rates {
+				unsigned int rate;
+				unsigned int cflag;
+			};
+			static struct baud_rates baud_rates[] = {
+				{ 921600, B921600 },
+				{ 460800, B460800 },
+				{ 230400, B230400 },
+				{ 115200, B115200 },
+				{  57600, B57600  },
+				{  38400, B38400  },
+				{  19200, B19200  },
+				{   9600, B9600   },
+				{   4800, B4800   },
+				{   2400, B2400   },
+				{   1200, B1200   },
+				{    600, B600    },
+				{    300, B300    },
+				{    200, B200    },
+				{    150, B150    },
+				{    134, B134    },
+				{    110, B110    },
+				{     75, B75     },
+				{     50, B50     },
+				{      0, B600	  }
			};

-			baud = C_BAUD(ch->uart_port.info->tty) & 0xff;
-
-			if (ch->ch_c_cflag & CBAUDEX)
-				iindex = 1;
-
-			jindex = baud;
+			baud = C_BAUD(ch->uart_port.info->tty);

-			if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16))
-				baud = bauds[iindex][jindex];
-			else {
-				jsm_printk(IOCTL, DEBUG, &ch->ch_bd->pci_dev,
-					"baud indices were out of range (%d)(%d)",
-				iindex, jindex);
-				baud = 0;
+			for (i = 0; baud_rates[i].rate; i++) {
+				if (baud_rates[i].cflag == baud)
+					break;
			}
+			baud = baud_rates[i].rate;

			if (baud == 0)
				baud = 9600;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem
  2006-01-30 15:29 [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem V. Ananda Krishnan
@ 2006-01-30 18:58 ` Greg KH
  2006-01-30 23:17   ` V. Ananda Krishnan
  2006-02-01  0:01 ` Andrew Morton
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2006-01-30 18:58 UTC (permalink / raw)
  To: V. Ananda Krishnan
  Cc: linux-kernel, Andrew Morton, Alan Cox, Adrian Bunk, Scott_Kilau

On Mon, Jan 30, 2006 at 09:29:53AM -0600, V. Ananda Krishnan wrote:
> Digi serial port console doesn't work when baud rates are set higher 
> than 38400.  So the lookup table and code in jsm_neo.c has been modified 
> and tested.  Please let me have the feed-back.
> 
> Thanks,
> V. Ananda Krishnan
> 
> 
> 
> Authors: Scott Kilau and V. Ananda Krishnan
> Signed-off-by: V.Ananda Krishnan

Wrong Signed-off-by: format :(


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem
  2006-01-30 18:58 ` Greg KH
@ 2006-01-30 23:17   ` V. Ananda Krishnan
  0 siblings, 0 replies; 4+ messages in thread
From: V. Ananda Krishnan @ 2006-01-30 23:17 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, Andrew Morton, Alan Cox, Adrian Bunk, Scott_Kilau

Greg KH wrote:
> On Mon, Jan 30, 2006 at 09:29:53AM -0600, V. Ananda Krishnan wrote:
>> Digi serial port console doesn't work when baud rates are set higher 
>> than 38400.  So the lookup table and code in jsm_neo.c has been modified 
>> and tested.  Please let me have the feed-back.
>>
>> Thanks,
>> V. Ananda Krishnan
>>
>>
>>
>> Authors: Scott Kilau and V. Ananda Krishnan
>> Signed-off-by: V.Ananda Krishnan
> 
> Wrong Signed-off-by: format :(
> 
> 
Sorry for the error.  Signing off again. Hope this format is o.k.
Signed-off-by: V. Ananda Krishnan <mansarov@us.ibm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem
  2006-01-30 15:29 [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem V. Ananda Krishnan
  2006-01-30 18:58 ` Greg KH
@ 2006-02-01  0:01 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2006-02-01  0:01 UTC (permalink / raw)
  To: V. Ananda Krishnan; +Cc: linux-kernel, alan, bunk, gregkh, Scott_Kilau

"V. Ananda Krishnan" <mansarov@us.ibm.com> wrote:
>
> igi serial port console doesn't work when baud rates are set higher 
> than 38400.  So the lookup table and code in jsm_neo.c has been modified 
> and tested.

- All the code you've added is one tabstop too far to the right.

- We can simplify the definition of baud_rates[]

- Using local variable `baud' as a temporary cflag is confusing.

- The baud_rates[] scanning can be simplified.

- local `i' doesn't need the initialiser.



How's this look?

--- 25/drivers/serial/jsm/jsm_neo.c~jsm-fix-for-high-baud-rates-problem-tidy	Tue Jan 31 15:57:46 2006
+++ 25-akpm/drivers/serial/jsm/jsm_neo.c	Tue Jan 31 15:57:46 2006
@@ -965,50 +965,47 @@ static void neo_param(struct jsm_channel
 			baud = ch->ch_custom_speed;
 			if (ch->ch_flags & CH_BAUD0)
 				ch->ch_flags &= ~(CH_BAUD0);
-		} else {
-			int i= 0;
-			struct baud_rates {
-				unsigned int rate;
-				unsigned int cflag;
-			};
-			static struct baud_rates baud_rates[] = {
-				{ 921600, B921600 },
-				{ 460800, B460800 },
-				{ 230400, B230400 },
-				{ 115200, B115200 },
-				{  57600, B57600  },
-				{  38400, B38400  },
-				{  19200, B19200  },
-				{   9600, B9600   },
-				{   4800, B4800   },
-				{   2400, B2400   },
-				{   1200, B1200   },
-				{    600, B600    },
-				{    300, B300    },
-				{    200, B200    },
-				{    150, B150    },
-				{    134, B134    },
-				{    110, B110    },
-				{     75, B75     },
-				{     50, B50     },
-				{      0, B600	  }
-			};
+	} else {
+		int i;
+		unsigned int cflag;
+		static struct {
+			unsigned int rate;
+			unsigned int cflag;
+		} baud_rates[] = {
+			{ 921600, B921600 },
+			{ 460800, B460800 },
+			{ 230400, B230400 },
+			{ 115200, B115200 },
+			{  57600, B57600  },
+			{  38400, B38400  },
+			{  19200, B19200  },
+			{   9600, B9600   },
+			{   4800, B4800   },
+			{   2400, B2400   },
+			{   1200, B1200   },
+			{    600, B600    },
+			{    300, B300    },
+			{    200, B200    },
+			{    150, B150    },
+			{    134, B134    },
+			{    110, B110    },
+			{     75, B75     },
+			{     50, B50     },
+		};
 
-			baud = C_BAUD(ch->uart_port.info->tty);
-
-			for (i = 0; baud_rates[i].rate; i++) {
-				if (baud_rates[i].cflag == baud)
-					break;
+		cflag = C_BAUD(ch->uart_port.info->tty);
+		baud = 9600;
+		for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
+			if (baud_rates[i].cflag == cflag) {
+				baud = baud_rates[i].rate;
+				break;
 			}
-			baud = baud_rates[i].rate;
-
-			if (baud == 0)
-				baud = 9600;
-
-			if (ch->ch_flags & CH_BAUD0)
-				ch->ch_flags &= ~(CH_BAUD0);
 		}
 
+		if (ch->ch_flags & CH_BAUD0)
+			ch->ch_flags &= ~(CH_BAUD0);
+	}
+
 	if (ch->ch_c_cflag & PARENB)
 		lcr |= UART_LCR_PARITY;
 
_


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-01  0:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-30 15:29 [RFC: linux-2.6.16-rc1 patch] jsm: fix for high baud rates problem V. Ananda Krishnan
2006-01-30 18:58 ` Greg KH
2006-01-30 23:17   ` V. Ananda Krishnan
2006-02-01  0:01 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).