[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1353115941.6139.10.camel@joe-AO722>
Date: Fri, 16 Nov 2012 17:32:21 -0800
From: Joe Perches <joe@...ches.com>
To: YAMANE Toshiaki <yamanetoshi@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging/serqt_usb2: Refactor qt_status_change_check()
in serqt_usb2.c
On Sat, 2012-11-17 at 05:19 +0900, YAMANE Toshiaki wrote:
> Modify qt_status_change_check() and delete qt_status_change().
>
> Signed-off-by: YAMANE Toshiaki <yamanetoshi@...il.com>
> ---
> drivers/staging/serqt_usb2/serqt_usb2.c | 53 +++++++++++++------------------
> 1 file changed, 22 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
[]
> @@ -334,11 +307,29 @@ static void qt_status_change_check(struct tty_struct *tty,
> flag = 0;
> switch (data[i + 2]) {
> case 0x00:
> + if (i > (RxCount - 4)) {
> + dev_dbg(&port->dev,
> + "Illegal escape seuences in received data\n");
trivia: seuences/sequence
> + break;
> + }
> +
> + ProcessLineStatus(qt_port, data[i + 3]);
> +
> + i += 3;
you could move the i += 3 before the ProcessLineStatus
and use data[i]
> + flag = 1;
> + break;
> +
> case 0x01:
> - flag = qt_status_change((RxCount - 4), data, i,
> - qt_port, port);
> - if (flag == 1)
> - i += 3;
> + if (i > (RxCount - 4)) {
> + dev_dbg(&port->dev,
> + "Illegal escape seuences in received data\n");
typo here too
> + break;
> + }
> +
> + ProcessModemStatus(qt_port, data[i + 3]);
> +
> + i += 3;
same i += 3
> + flag = 1;
> break;
>
> case 0xff:
What about something like:
case 0x0:
case 0x1:
if (i > (RxCount - 4)) {
dev_dbg(&port->dev,
"Illegal escape sequence in received data\n");
break;
}
if (data[i + 2] == 0x0)
ProcessLineStatus(qt_port, data[i + 3]);
else
ProcessModemStatus(qt_port, data[i + 3]);
i += 3;
flag = 1;
break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists