Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDCBEC83001 for ; Tue, 28 Apr 2020 13:38:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF4C62072A for ; Tue, 28 Apr 2020 13:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbgD1Ni1 (ORCPT ); Tue, 28 Apr 2020 09:38:27 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:46552 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726846AbgD1Ni1 (ORCPT ); Tue, 28 Apr 2020 09:38:27 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 840A11DD02B8EA81E182; Tue, 28 Apr 2020 21:38:24 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Tue, 28 Apr 2020 21:38:18 +0800 From: Wei Yongjun To: Felipe Balbi , Greg Kroah-Hartman , zhengbin CC: Wei Yongjun , , Subject: [PATCH -next] usb: gadget: mass_storage: use module_usb_composite_driver to simplify the code Date: Tue, 28 Apr 2020 13:39:34 +0000 Message-ID: <20200428133934.73637-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org module_usb_composite_driver() makes the code simpler by eliminating boilerplate code. Signed-off-by: Wei Yongjun --- drivers/usb/gadget/legacy/mass_storage.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index f18f77584fc2..9ed22c5fb7fe 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c @@ -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);