usb: gadget: mass_storage: use module_usb_composite_driver to simplify the code
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 28 Apr 2020 13:39:34 +0000 (13:39 +0000)
committerFelipe Balbi <balbi@kernel.org>
Mon, 25 May 2020 08:09:40 +0000 (11:09 +0300)
module_usb_composite_driver() makes the code simpler by
eliminating boilerplate code.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/gadget/legacy/mass_storage.c

index f18f77584fc21ae43a6a11524e7288578a155ea5..9ed22c5fb7fe27f20df25edeabd19500414a3928 100644 (file)
@@ -229,18 +229,8 @@ static struct usb_composite_driver msg_driver = {
        .unbind         = msg_unbind,
 };
 
+module_usb_composite_driver(msg_driver);
+
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_AUTHOR("Michal Nazarewicz");
 MODULE_LICENSE("GPL");
-
-static int __init msg_init(void)
-{
-       return usb_composite_probe(&msg_driver);
-}
-module_init(msg_init);
-
-static void __exit msg_cleanup(void)
-{
-       usb_composite_unregister(&msg_driver);
-}
-module_exit(msg_cleanup);