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: Wed, 21 Mar 2012 16:53:57 +0800 [thread overview]
Message-ID: <4F699725.3080404@intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1203200957260.3013-100000@netrider.rowland.org>
On 2012年03月20日 22:04, Alan Stern wrote:
> On Tue, 20 Mar 2012, Lan Tianyu wrote:
>
>> 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?
>
> Yes, that's what I mean. It's a natural thing to do; the child device
> is directly associated with the port. It's better than allocating a
> separate array for hdev->children.
OK. That' mean that I should replace the hdev->children with
port_data->child_device.
In the hub.c, the struct usb_hub_port can be visited and the child_device can be
accessed
directly. Out of hub.c, I should provide function to return child pointer. Is
that right?
>
>>> 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?*/
>> }
>> ...
>> }
>
> That's the right idea, but the wrong place. The right place to fill
> in the pointer is a few lines higher, where the code already does
>
> hdev->children[port1-1] = udev;
>
> while holding the device_state_lock.
>
> 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
next prev parent reply other threads:[~2012-03-21 8:56 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
2012-03-20 14:04 ` Alan Stern
2012-03-21 8:53 ` Lan Tianyu [this message]
[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=4F699725.3080404@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.