USB: core, devio: use to_usb_device
authorGeliang Tang <geliangtang@163.com>
Wed, 23 Dec 2015 13:26:50 +0000 (21:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jan 2016 05:00:33 +0000 (21:00 -0800)
Use to_usb_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/devio.c
drivers/usb/core/usb.c

index 054eb534c4953d72f70962548a51eaac722dda0c..13a4b9f4873941379a41b94c0295a5af1b8a8857 100644 (file)
@@ -848,7 +848,7 @@ static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
                              (void *) (unsigned long) devt, match_devt);
        if (!dev)
                return NULL;
-       return container_of(dev, struct usb_device, dev);
+       return to_usb_device(dev);
 }
 
 /*
index ebb29caa3fe40d716833715e48ac102173753028..49b011f951b309f6ad7d1e89fc1a63c24f69f8ed 100644 (file)
@@ -241,7 +241,7 @@ static int __each_dev(struct device *dev, void *data)
        if (!is_usb_device(dev))
                return 0;
 
-       return arg->fn(container_of(dev, struct usb_device, dev), arg->data);
+       return arg->fn(to_usb_device(dev), arg->data);
 }
 
 /**