Re: [RFC PATCH 1/4] usb: add struct usb_hub_port to store port related members.

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

 



On Mon, 19 Mar 2012, Lan Tianyu wrote:

> Add struct usb_hub_port pointer port_data in the struct usb_hub and allocate
> struct usb_hub_port perspectively for each ports to store private data.

You might as well add the child device pointer into your new data 
structure.  This will require changes to at least three other files in 
addition to hub.c:

	devices.c, host/r8a66597-hcd.c,
	drivers/staging/usbip/usbip_common.c

Maybe some others; I didn't look through the entire kernel source.  It 
also means you will have to export a function to get a pointer to the 
child device, given the port number.

> @@ -1451,13 +1456,12 @@ void usb_hub_release_all_ports(struct usb_device *hdev, void *owner)
>  	int n;
>  	void **powner;
>  
> -	n = find_port_owner(hdev, 1, &powner);
> -	if (n == 0) {
> -		for (; n < hdev->maxchild; (++n, ++powner)) {
> -			if (*powner == owner)
> -				*powner = NULL;
> -		}
> +	for (n = 1; n <= hdev->maxchild; n++) {
> +		find_port_owner(hdev, n, &powner);
> +		if (*powner == owner)
> +			*powner = NULL;
>  	}

This is wrong; find_port_owner() doesn't set powner to anything if an 
error occurs.

You can just set the pointer field directly to NULL, instead of looking
it up in find_port_owner().  I don't remember why it was written that
way originally.

Alan Stern

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


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

  Powered by Linux