All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: YAMANE Toshiaki <yamanetoshi@gmail.com>
Cc: devel@driverdev.osuosl.org,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [PATCH 2/4] staging/serqt_usb2: refactor qt_read_bulk_callback() in serqt_usb2.c
Date: Thu, 15 Nov 2012 23:18:17 +0300	[thread overview]
Message-ID: <20121115201817.GO11515@mwanda> (raw)
In-Reply-To: <CAOTypNR_dDjg=XA-yP2OhyrLs3LEBPDFSRBORZUPh6Qzo4w8xA@mail.gmail.com>

On Fri, Nov 16, 2012 at 05:01:55AM +0900, YAMANE Toshiaki wrote:
> On Wed, Nov 14, 2012 at 9:41 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > Why can't we test whether i == (RxCount - 3) earlier and handle
> > the errors there?  That way we wouldn't need to pass the limit
> > variable.
> >
> > In fact, this whole function is sort of nasty.  We start by doing
> > a switch (data[i + 2]) { then we combine the 0x00 and 0x01 and call
> > this function which separates them out and sets a function pointer
> > and then calls the function point?  Get rid of this whole function.
> >
> > You shouldn't need to use function pointers to do this; that's too
> > many levels of abstraction.
> 
> I feel it so diffcult to consider the fixing this patch more.
> 
> There are some reasons why I have become such a description.
> - The purpose of this patch is the resolution of the
>   line over 80 characters issue
> - I Wrote the code to be aware of the following:
> -- Do not change the procedure
> -- The shallow nest
> -- To avoid the redundancy
> 
> If I do not use a function pointer, which take the form below.
> 
>         if (0x00 == data[i + 2])
>                 dev_dbg(&port->dev, "Line status status.\n");
>         else
>                 dev_dbg(&port->dev, "Modem status status.\n");
> 
>         if (i > limit) {
>                 dev_dbg(&port->dev,
>                         "Illegal escape seuences in received data\n");
>                 return 0;
>         }
> 
>         if (0x00 == data[i + 2])
>                 ProcessLineStatus(qt_port, data[i + 3]);
>         else
>                 ProcessModemStatus(qt_port, data[i + 3]);
> 
> 	return 1;
> 
> I also feel it may be...
> 
> And I am against to move the dev_dbg procedure call to
> qt_status_change_check procedure because the nesting will be so deep.

In the end, the new version is more confusing than the original
code.  Checkpatch.pl is not a king which must be obeyed.  The only
thing which matters is how easy it is for a human to understand the
code.

> 
> >>       if (urb->status) {
> >>               qt_port->ReadBulkStopped = 1;
> >> -             dev_dbg(&urb->dev->dev, "%s - nonzero write bulk status received: %d\n",
> >> +             dev_dbg(&urb->dev->dev,
> >> +                     "%s - nonzero write bulk status received: %d\n",
> >>                       __func__, urb->status);
> >
> > Don't mix in these unrelated 80 character limit changes.
> 
> I think the purpose of refactoring is the resolution of the line over 80
> characters issue. I think that the separation of the patch should stop taking
> because they are already applied in the linux-next tree.
> 

Yes, once it is merged into linux-next then it is too late to send a
version 2 patch.

I'm explaining that as a reviewer it is confusing for me to figure
out when you do unrelated things in the same patch and mix
everything up.

regards,
dan carpenter


  reply	other threads:[~2012-11-15 20:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 21:33 [PATCH 1/4] staging/serqt_usb2: fixed line over issue in serqt_usb2.c YAMANE Toshiaki
2012-11-09 21:33 ` [PATCH 2/4] staging/serqt_usb2: refactor qt_read_bulk_callback() " YAMANE Toshiaki
2012-11-14 12:41   ` Dan Carpenter
2012-11-14 20:09     ` YAMANE Toshiaki
2012-11-15 20:01     ` YAMANE Toshiaki
2012-11-15 20:18       ` Dan Carpenter [this message]
2012-11-15 20:32         ` YAMANE Toshiaki
2012-11-15 20:43           ` Dan Carpenter
2012-11-15 20:53             ` YAMANE Toshiaki
2012-11-09 21:34 ` [PATCH 3/4] staging/serqt_usb2: refactor qt_open() " YAMANE Toshiaki
2012-11-09 21:34 ` [PATCH 4/4] staging/serqt_usb2: refactor qt_unthrottle() " 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=20121115201817.GO11515@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=stern@rowland.harvard.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.