RE: [PATCH v8 08/18] usb: make usb_port flags atomic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux