From patchwork Tue Mar 7 19:57:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 65832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2637156wrd; Tue, 7 Mar 2023 12:09:44 -0800 (PST) X-Google-Smtp-Source: AK7set+EANrLgTYUeVFiIY+JGtYpKuDHHWLotnZjSxDLb7L0HUKW1AyXkX+SkkbPDjMHWfmuIa9f X-Received: by 2002:a05:6a20:258a:b0:cc:868f:37b3 with SMTP id k10-20020a056a20258a00b000cc868f37b3mr14711247pzd.58.1678219783967; Tue, 07 Mar 2023 12:09:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678219783; cv=none; d=google.com; s=arc-20160816; b=qeEvuOKODBSpXxYx6dl9YE5aIwPUV/vh2pEBcAfFExF3OxYm1mhtZoif+vfRFK7ig5 YHx1Teg/5/OwuAVtA4OI2gta7vKIbMQ80ByAqgACVBew1mazm6a1fZBx+WmTki9rKEIb YqM3rX2RgOiYTmtKHAxGFd3PBPKyEP7D2FwV/ZG2YvSsT2ldHK1Rnn0/AHr6OBFBP8kV muo4zP26fyGnl8RbWaQ1DYj6sUOuo+vkyBI0w3G2hNfk5ZdJDKn0kQwap0t9BVdmtZ8n OptKXclC3gCj786ixIDK4avpD0P0JjbYYTeNFZR3B/08bSzvhLKF0pTMEicGuFgH3pD5 VGEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wBR+vNuMY+RtgkKRypeHJblgSMNn3Y/YznWO81V1tGw=; b=LIt89B/h0leWGq5pvB4xmVqZqEw+FeTVdNtX0Gxz9rYqM1cl4JTqg6kDNP9zw6kxpt WM3jtJr2YeoUO7Y3N3HoPARTrxM6MByhwnYwz2xgt42QXreKjgUsNoTiKTgHoEFgMiuS RyQbefoWRspEcU1PmRwP+d5fXZj8DbwDAgV0PEst6YrGmrq6Ok5nYKuSu1tKDkzgAqeJ vm08UAfDB5RbLkFuuCj4+uwZRodQcCngyYwDjvEz6V/+U1nGEBpvmoEA27jxeXhnLZ+M o+SSNMtZwh2o31GTK9M9FSrcp7ch3dYmRtCNSO0ohI4RBfeFEcCNsAqg32551t86Y3vv D9HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a626205000000b005a8aef3567bsi11849466pfb.100.2023.03.07.12.09.30; Tue, 07 Mar 2023 12:09:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbjCGUBC (ORCPT + 99 others); Tue, 7 Mar 2023 15:01:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbjCGUAh (ORCPT ); Tue, 7 Mar 2023 15:00:37 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C3447685; Tue, 7 Mar 2023 11:58:01 -0800 (PST) Received: from dslb-188-097-045-043.188.097.pools.vodafone-ip.de ([188.97.45.43] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pZdRR-0008QZ-4e; Tue, 07 Mar 2023 20:57:45 +0100 From: Martin Kaiser To: Jes Sorensen , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Martin Kaiser , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] wifi: rtl8xxxu: use module_usb_driver Date: Tue, 7 Mar 2023 20:57:17 +0100 Message-Id: <20230307195718.168021-1-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759740987936574890?= X-GMAIL-MSGID: =?utf-8?q?1759740987936574890?= We can use the module_usb_driver macro instead of open-coding the driver's init and exit functions. This is simpler and saves some lines of code. Other realtek wireless drivers use module_usb_driver as well. Signed-off-by: Martin Kaiser Reviewed-by: Ping-Ke Shih Tested-by: Philipp Hortmann # Edimax N150 --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index e619ed21fbfe..58dbad9a14c2 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -7455,24 +7455,6 @@ static struct usb_driver rtl8xxxu_driver = { .disable_hub_initiated_lpm = 1, }; -static int __init rtl8xxxu_module_init(void) -{ - int res; - - res = usb_register(&rtl8xxxu_driver); - if (res < 0) - pr_err(DRIVER_NAME ": usb_register() failed (%i)\n", res); - - return res; -} - -static void __exit rtl8xxxu_module_exit(void) -{ - usb_deregister(&rtl8xxxu_driver); -} - - MODULE_DEVICE_TABLE(usb, dev_table); -module_init(rtl8xxxu_module_init); -module_exit(rtl8xxxu_module_exit); +module_usb_driver(rtl8xxxu_driver);