usb: hub: keep hub->dev reference all the time when struct usb_hub lives
authorPetr Mladek <pmladek@suse.cz>
Fri, 19 Sep 2014 15:32:19 +0000 (17:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 05:31:11 +0000 (22:31 -0700)
commit5d14f323834eeb0cd428bcec4a9cd8d8839467fb
tree3ba33ad527e7d931635594a7b6727e4888415bc2
parent3512e7bfea6a459cad84712a021d856bd78cd7e4
usb: hub: keep hub->dev reference all the time when struct usb_hub lives

This is just a small optimization of the fix from the commit c605f3cdff53a743f6
("usb: hub: take hub->hdev reference when processing from eventlist).

We do not need to take the reference for each event. Instead we could get it
when struct usb_hub is allocated and put it when it is released. By other words,
we could handle it the same way as the reference for hub->intfdev.

The motivation is that it will make the life easier when switching from khubd
kthread to a workqueue.

Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c