On Tue, 29 Apr 2014, David Laight wrote:

> From: Dan Williams
> > Before we add another 2 bitfields to the port state, convert it to an
> > unsigned long and use bitops helpers to manipulate it.  This later
> > enables setting bits to request action without worrying about colliding
> > updates.  In particular, a flag to request that the child device be
> > woken up when the port restores power is added in a later patch.
> ...
> >  struct usb_port {
> >     struct usb_device *child;
> > @@ -96,8 +95,9 @@ struct usb_port {
> >     enum usb_port_connect_type connect_type;
> >     usb_port_location_t location;
> >     u8 portnum;
> > -   unsigned power_is_on:1;
> > -   unsigned did_runtime_put:1;
> > +   #define USB_PORTDEV_POWER 0
> > +   #define USB_PORTDEV_DID_RUNTIME_PUT 1
> > +   unsigned long flags;
> >  };
> ...
> 
> 
> An alternative is to 'waste' 7 bits and use byte-sized fields
> for the separate flags.
> I doubt the size of the data structure matters.
> (Or do we have to worry about cpus that use RMW cycles for byte writes?)

We do.

Another way to avoid the waste is to move the flags into the usb_hub 
structure.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to