USB: use bus_to_hdc instead of container_of
authorYuanhan Liu <yliu.null@gmail.com>
Sat, 6 Oct 2012 07:23:17 +0000 (15:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Oct 2012 21:40:50 +0000 (14:40 -0700)
We defined bus_to_hdc for that, use it.

Signed-off-by: Yuanhan Liu <yliu.null@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/usb.c

index cd8fb44..7d3de09 100644 (file)
@@ -370,14 +370,14 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
                                 struct usb_bus *bus, unsigned port1)
 {
        struct usb_device *dev;
-       struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self);
+       struct usb_hcd *usb_hcd = bus_to_hcd(bus);
        unsigned root_hub = 0;
 
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (!dev)
                return NULL;
 
-       if (!usb_get_hcd(bus_to_hcd(bus))) {
+       if (!usb_get_hcd(usb_hcd)) {
                kfree(dev);
                return NULL;
        }