All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan@intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: lenb@kernel.org, gregkh@linuxfoundation.org,
	linux-acpi@vger.kernel.org, mjg@redhat.com,
	linux-usb@vger.kernel.org, sarah.a.sharp@intel.com
Subject: Re: [RFC PATCH 1/4] usb: add struct usb_hub_port to store port related members.
Date: Tue, 20 Mar 2012 14:16:17 +0800	[thread overview]
Message-ID: <4F6820B1.6070004@intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1203191156280.1641-100000@iolanthe.rowland.org>

On 2012年03月20日 00:04, Alan Stern wrote:
> 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:
hi alan:
	Great thanks for your review.
	But I still confuse about "You might as well add the child device pointer
into your new data structure." Could you help me to make it clear? :)
	Do you mean add struct usb_device pointer toward the device attached to the 
port in the
struct usb_hub_port? If yes,Why?
>
> 	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.
	If it was necessary, could I fill the child pointer in the 
hub_port_connect_change()? just
after a new usb device being created.

static void hub_port_connect_change(struct usb_hub *hub, int port1,
					u16 portstatus, u16 portchange) {
		...
		/* Run it through the hoops (find a driver, etc) */
		if (!status) {
			status = usb_new_device(udev);
			if (status) {
				spin_lock_irq(&device_state_lock);
				hdev->children[port1-1] = NULL;
				spin_unlock_irq(&device_state_lock);
			}
			/* like here?*/
		}
		...
}

Thanks again. Look forward for your reply.
>
>> @@ -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
>
>

-- 
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-03-20  6:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 14:33 [RFC PATCH 1/4] usb: add struct usb_hub_port to store port related members Lan Tianyu
     [not found] ` <1332167626-5806-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-03-19 14:33   ` [RFC PATCH 2/4] usb: add platform_data in the struct usb_hub_port Lan Tianyu
2012-03-19 16:07     ` Alan Stern
2012-03-19 14:33 ` [RFC PATCH 3/4] usb/acpi: add the support of usb hub ports' acpi binding without attached devices Lan Tianyu
2012-03-19 16:10   ` Alan Stern
2012-03-19 14:33 ` [RFC PATCH 4/4] usb/acpi: add usb check for the connect type of usb port Lan Tianyu
2012-03-19 16:13   ` Alan Stern
2012-03-19 16:04 ` [RFC PATCH 1/4] usb: add struct usb_hub_port to store port related members Alan Stern
2012-03-20  6:16   ` Lan Tianyu [this message]
2012-03-20 14:04     ` Alan Stern
2012-03-21  8:53       ` Lan Tianyu
     [not found]         ` <4F699725.3080404-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-03-21 14:38           ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F6820B1.6070004@intel.com \
    --to=tianyu.lan@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=sarah.a.sharp@intel.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.