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?)

        David

N�����r��y����b�X��ǧv�^�)޺{.n�+����{������^n�r���z���h�����&���G���h�(�階�ݢj"���m������z�ޖ���f���h���~�m�

Reply via email to