On Wed, Jan 23, 2013 at 12:58:09AM +0800, Lan Tianyu wrote:
> On 2013/1/23 0:02, Greg KH wrote:
> >On Tue, Jan 22, 2013 at 11:32:13PM +0800, Lan Tianyu wrote:
> >>On 2013/1/22 5:30, Greg KH wrote:
> >>>>@@ -3758,7 +3805,9 @@ static int hub_port_debounce(struct usb_hub *hub, 
> >>>>int port1)
> >>>>
> >>>>                  if (!(portchange & USB_PORT_STAT_C_CONNECTION) &&
> >>>>                       (portstatus & USB_PORT_STAT_CONNECTION) == 
> >>>> connection) {
> >>>>-                 stable_time += HUB_DEBOUNCE_STEP;
> >>>>+                 if (!must_be_connected || (connection
> >>>>+                                 == USB_PORT_STAT_CONNECTION))
> >>>
> >>>Please do:
> >>>                   if (!must_be_connected ||
> >>>                       (connection == USB_PORT_STAT_CONNECTION))
> >>>
> >>>instead, that makes it much more readable.
> >>Oh. I originally do the same thing. But there is following code
> >>which requires this line to be more indention. This will cause this
> >>line over 80 characters. So I had to break this line.
> >
> >The above line, as written is under 80 characters, so I don't understand
> >the issue.
> If I do following, scripts/checkpatch.pl will complain over 80 characters.
> 
> @@ -3767,7 +3814,9 @@
> 
>                 if (!(portchange & USB_PORT_STAT_C_CONNECTION) &&
>                      (portstatus & USB_PORT_STAT_CONNECTION) == connection) {
> -                       stable_time += HUB_DEBOUNCE_STEP;
> +                       if (!must_be_connected ||
> +                                       (connection == 
> USB_PORT_STAT_CONNECTION))
> +                               stable_time += HUB_DEBOUNCE_STEP;
>                         if (stable_time >= HUB_DEBOUNCE_STABLE)
>                                 break;
>                 } else {
> 
> WARNING: line over 80 characters
> #203: FILE: drivers/usb/core/hub.c:3818:
> +                                       (connection == 
> USB_PORT_STAT_CONNECTION))

Of course, which is why I didn't say to do that :)

See above for where to line up the line with the previous one, showing
that it all can fit just fine within 80 characters.

> If I use (connection & USB_PORT_STAT_CONNECTION)), that will be ok.
> I am curious about that checkpatch.pl considers a space or tab as a character?

It understands the difference between tabs and spaces properly.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to