On Fri, 19 Jan 2007, Oliver Neukum wrote:

> Hi,
> 
> this is the second take of the patch to switch off autosuspend
> through sysfs to allow battery powered devices to recharge of the
> bus. It includes the cleanups Alan suggested.
> In addition, likewise at Alan's request, it cleans up coding style in
> the rest of sysfs.c
> 
>       Regards
>               Oliver
> 
> Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
> --
> 
> --- a/include/linux/usb.h     2007-01-18 13:15:25.000000000 +0100
> +++ b/include/linux/usb.h     2007-01-17 15:42:11.000000000 +0100
> @@ -364,6 +364,7 @@
>  
>       unsigned discon_suspended:1;    /* Disconnected while suspended */
>       unsigned have_langid:1;         /* whether string_langid is valid */
> +     unsigned can_autosuspend;       /* whether it should autosuspend */

You didn't make this a bitfield, and you didn't change the name.  It 
should be:

        unsigned may_autosuspend:1;     /* allowed to autosuspend? */

with the corresponding name change throughout the rest of the patch.


> --- a/drivers/usb/core/sysfs.c        2007-01-18 13:13:35.000000000 +0100
> +++ b/drivers/usb/core/sysfs.c        2007-01-19 09:47:30.000000000 +0100
...
> @@ -148,6 +148,41 @@
>  }
>  static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
>  
> +static ssize_t
> +show_autosuspend(struct device *dev, struct device_attribute *attr, char 
> *buf)
> +{
> +     int autosusp;
> +     struct usb_device *udev;
> +
> +     udev = to_usb_device (dev);
> +     autosusp = udev->can_autosuspend;
> +     return sprintf (buf, "%d\n", autosusp);

You didn't understand the point I was trying to make.  The matter of a 
space between the function name and the following open paren doesn't apply 
only to function definitions; it applies to function calls as well.  So 
for instance, you should not put a space after "to_usb_device" or 
"sprintf".

(The same applies throughout the whole file.  The edits you made to the
function definition lines are fine, but there still remain extra spaces
in many function calls.)

Also you don't need the "autosusp" local variable.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to