On Thu, 18 Jan 2007, Oliver Neukum wrote:

> > > +static ssize_t
> > > +show_autosuspend (struct device *dev, struct device_attribute *attr, 
> > > char *buf)
> > 
> > The current convention is that we will not put a blank between the
> > function name and the following open paren in new code.  Old code can be 
> > cleaned up whenever someone feels like doing it (i.e., probably not for a 
> > long time).
> 
> I chose to keep the code uniform. I can change that if you like.

Andrew Morton has expressed displeasure at new code containing these 
extra spaces.

> [..]
> > > + device_remove_file(dev, &dev_attr_autosuspend);
> > >   device_remove_file(dev, &dev_attr_manufacturer);
> > >   device_remove_file(dev, &dev_attr_product);
> > >   device_remove_file(dev, &dev_attr_serial);
> > 
> > This isn't necessary.  Simply add &dev_attr_autosuspend.attr to the end of
> > the dev_attrs array.
> 
> Is that clean? Strictly speaking it is not an attribute of the device as such,
> but of usbcore's power management.

I think it's okay.  Certainly it's cleaner than adding special-purpose 
code to add and remove the attribute.  If you like, stick a comment in the 
initializer -- there already are two comments, separating out config 
attributes from device attributes.


> > What happened to the code that actually checks the flag?
> 
> It got deleted as unnecessary. Indeed they existed :-;
> usb_autoresume_device() and usb_autosuspend_device() go to:
> status = usb_autopm_do_device(udev, -1);
> which goes to:
> udev->pm_usage_cnt += inc_usage_cnt;

Now I'm starting to forget how my own APIs work...

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