Skip to contentSkip to conversation

staging/serqt_usb2: Refactor qt_status_change_check() in serqt_usb2.c

PATCH In review YAMANE Toshiaki 3 participants 5 messages Nov 29, 2012 – Nov 30, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/serqt_usb2: Refactor qt_status_change_check() in serqt_usb2.c

Improved position to increment variable i,
And typo fixes.

---
 drivers/staging/serqt_usb2/serqt_usb2.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/serqt_usb2/serqt_usb2.c +6 -6
index 1b3e995..095d6f2 100644
@@ -309,26 +309,26 @@ static void qt_status_change_check(struct tty_struct *tty,
 			case 0x00:
 				if (i > (RxCount - 4)) {
 					dev_dbg(&port->dev,
-						"Illegal escape seuences in received data\n");
+						"Illegal escape sequence in received data\n");
 					break;
 				}
 
-				ProcessLineStatus(qt_port, data[i + 3]);
-
 				i += 3;
+				ProcessLineStatus(qt_port, data[i]);
+
 				flag = 1;
 				break;
 
 			case 0x01:
 				if (i > (RxCount - 4)) {
 					dev_dbg(&port->dev,
-						"Illegal escape seuences in received data\n");
+						"Illegal escape sequence in received data\n");
 					break;
 				}
 
-				ProcessModemStatus(qt_port, data[i + 3]);
-
 				i += 3;
+				ProcessModemStatus(qt_port, data[i]);
+
 				flag = 1;
 				break;
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 13 lines · YAMANE Toshiaki

Improved position to increment variable i,
And typo fixes.

---
 drivers/staging/serqt_usb2/serqt_usb2.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/serqt_usb2/serqt_usb2.c +0 -0
index 1b3e995..095d6f2 100644

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 312

Quoted 5 lines
drivers/staging/serqt_usb2/serqt_usb2.c +1 -1
@@ -309,26 +309,26 @@ static void qt_status_change_check(struct tty_struct *tty,
 			case 0x00:
 				if (i > (RxCount - 4)) {
 					dev_dbg(&port->dev,
-						"Illegal escape seuences in received data\n");
+						"Illegal escape sequence in received data\n");

This is a different type of fix from:

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 317

Quoted 7 lines
drivers/staging/serqt_usb2/serqt_usb2.c +1 -2
 					break;
 				}
 
-				ProcessLineStatus(qt_port, data[i + 3]);
-
 				i += 3;
+				ProcessLineStatus(qt_port, data[i]);

I think you just changed the logic in this function, didn't you?

Quoted 6 lines
drivers/staging/serqt_usb2/serqt_usb2.c +1 -0
+
 				flag = 1;
 				break;
 
 			case 0x01:
 				if (i > (RxCount - 4)) {

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 330

Quoted 10 lines
drivers/staging/serqt_usb2/serqt_usb2.c +2 -3
 					dev_dbg(&port->dev,
-						"Illegal escape seuences in received data\n");
+						"Illegal escape sequence in received data\n");
 					break;
 				}
 
-				ProcessModemStatus(qt_port, data[i + 3]);
-
 				i += 3;
+				ProcessModemStatus(qt_port, data[i]);

Same here, what happens to i after this?

Please break into two patches, and verify that you didn't break anything here.

thanks,

greg k-h

#2 lore raw
Quoted 51 lines · Greg Kroah-Hartman
Quoted 13 lines · YAMANE Toshiaki

Improved position to increment variable i,
And typo fixes.

---
 drivers/staging/serqt_usb2/serqt_usb2.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/serqt_usb2/serqt_usb2.c +0 -0
index 1b3e995..095d6f2 100644

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 312

Quoted 5 lines
drivers/staging/serqt_usb2/serqt_usb2.c +1 -1
@@ -309,26 +309,26 @@ static void qt_status_change_check(struct tty_struct *tty,
                      case 0x00:
                              if (i > (RxCount - 4)) {
                                      dev_dbg(&port->dev,
-                                             "Illegal escape seuences in received data\n");
+                                             "Illegal escape sequence in received data\n");

This is a different type of fix from:

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 317

Quoted 7 lines
drivers/staging/serqt_usb2/serqt_usb2.c +1 -2
                                      break;
                              }
 
-                             ProcessLineStatus(qt_port, data[i + 3]);
-
                              i += 3;
+                             ProcessLineStatus(qt_port, data[i]);

I think you just changed the logic in this function, didn't you?

Quoted 6 lines
drivers/staging/serqt_usb2/serqt_usb2.c +1 -0
+
                              flag = 1;
                              break;
 
                      case 0x01:
                              if (i > (RxCount - 4)) {

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 330

Quoted 10 lines
drivers/staging/serqt_usb2/serqt_usb2.c +2 -3
                                      dev_dbg(&port->dev,
-                                             "Illegal escape seuences in received data\n");
+                                             "Illegal escape sequence in received data\n");
                                      break;
                              }
 
-                             ProcessModemStatus(qt_port, data[i + 3]);
-
                              i += 3;
+                             ProcessModemStatus(qt_port, data[i]);

Same here, what happens to i after this?

Quoted 2 lines

Please break into two patches, and verify that you didn't break anything here.

Greg-san,

I am sorry for confusion.
I sent the patch twice since following patch was applied (gregkh/staging-next)

commit 9d36976fad3008fcc4209789566f7f3e7763f212 Modify qt_status_change_check() and delete qt_status_change().

-Incorporate comment of Mr.Joe Perches (sent Nov.17) -I sent yesterday

Please discard the patches.

Thanks,

YAMANE Toshiaki

#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

drivers/staging/serqt_usb2/serqt_usb2.c static void qt_status_change_check(struct tty_struct *tty, · line 317

Quoted 5 lines · YAMANE Toshiaki
drivers/staging/serqt_usb2/serqt_usb2.c +1 -2
-				ProcessLineStatus(qt_port, data[i + 3]);
-
 				i += 3;
+				ProcessLineStatus(qt_port, data[i]);

I think you just changed the logic in this function, didn't you?

This should be ok. The i += 3 was there in the original, it's just moved up a line.

regards,
dan carpenter

#4 lore raw
Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Greg Kroah-Hartman
Quoted 5 lines · YAMANE Toshiaki
drivers/staging/serqt_usb2/serqt_usb2.c +1 -2
-                           ProcessLineStatus(qt_port, data[i + 3]);
-
                            i += 3;
+                           ProcessLineStatus(qt_port, data[i]);
Quoted 4 lines
Quoted 1 line

I think you just changed the logic in this function, didn't you?

This should be ok. The i += 3 was there in the original, it's just moved up a line.

Thanks for your kindness reply.

But please discard this patch.
Let me consider this patch again.

Regards,

YAMANE Toshiaki