From: Joe Perches <joe@perches.com>
To: YAMANE Toshiaki <yamanetoshi@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging/serqt_usb2: Refactor qt_status_change_check() in serqt_usb2.c
Date: Fri, 16 Nov 2012 17:32:21 -0800 [thread overview]
Message-ID: <1353115941.6139.10.camel@joe-AO722> (raw)
In-Reply-To: <1353097162-4479-1-git-send-email-yamanetoshi@gmail.com>
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@gmail.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;
next prev parent reply other threads:[~2012-11-17 1:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 20:19 YAMANE Toshiaki
2012-11-16 20:58 ` Dan Carpenter
2012-11-17 1:32 ` Joe Perches [this message]
2012-11-17 6:48 ` [PATCH v2] " YAMANE Toshiaki
2012-11-29 4:57 [PATCH] " YAMANE Toshiaki
2012-11-30 2:10 ` Greg Kroah-Hartman
2012-11-30 5:25 ` YAMANE Toshiaki
2012-11-30 8:25 ` Dan Carpenter
2012-11-30 12:53 ` YAMANE Toshiaki
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=1353115941.6139.10.camel@joe-AO722 \
--to=joe@perches.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yamanetoshi@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®