From patchwork Fri Nov 13 02:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 11902405 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=-12.7 required=3.0 tests=BAYES_00, 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 49700C2D0E4 for ; Fri, 13 Nov 2020 02:33:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E265C21D46 for ; Fri, 13 Nov 2020 02:33:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726045AbgKMCdi (ORCPT ); Thu, 12 Nov 2020 21:33:38 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7528 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgKMCdi (ORCPT ); Thu, 12 Nov 2020 21:33:38 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CXMw53ZgLzhl1y; Fri, 13 Nov 2020 10:33:25 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Fri, 13 Nov 2020 10:33:28 +0800 From: Hanjun Guo To: "Rafael J. Wysocki" CC: , Hanjun Guo Subject: [PATCH 1/2] ACPI: SBS: Simplify the driver init code Date: Fri, 13 Nov 2020 10:25:10 +0800 Message-ID: <1605234311-29912-1-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org acpi_bus_register_driver() will check acpi_disable and return -ENODEV, so the acpi_disable check outside the acpi_bus_register_driver() is duplicated, can be removed. Also we can just return from acpi_bus_register_driver() then we can simplify the code further. Signed-off-by: Hanjun Guo --- drivers/acpi/sbs.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index e6d9f4d..cbd1af7 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -714,16 +714,7 @@ static int acpi_sbs_resume(struct device *dev) static int __init acpi_sbs_init(void) { - int result = 0; - - if (acpi_disabled) - return -ENODEV; - - result = acpi_bus_register_driver(&acpi_sbs_driver); - if (result < 0) - return -ENODEV; - - return 0; + return acpi_bus_register_driver(&acpi_sbs_driver); } static void __exit acpi_sbs_exit(void) From patchwork Fri Nov 13 02:25:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 11902407 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=-12.7 required=3.0 tests=BAYES_00, 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 C84FDC5519F for ; Fri, 13 Nov 2020 02:33:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77067221E9 for ; Fri, 13 Nov 2020 02:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726024AbgKMCdj (ORCPT ); Thu, 12 Nov 2020 21:33:39 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7529 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbgKMCdi (ORCPT ); Thu, 12 Nov 2020 21:33:38 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CXMw53QH8zhl1s; Fri, 13 Nov 2020 10:33:25 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Fri, 13 Nov 2020 10:33:29 +0800 From: Hanjun Guo To: "Rafael J. Wysocki" CC: , Hanjun Guo Subject: [PATCH 2/2] ACPI: SBS: Simplify the code using module_acpi_driver() Date: Fri, 13 Nov 2020 10:25:11 +0800 Message-ID: <1605234311-29912-2-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1605234311-29912-1-git-send-email-guohanjun@huawei.com> References: <1605234311-29912-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Using the module_acpi_driver() to simplify the code. Signed-off-by: Hanjun Guo --- drivers/acpi/sbs.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index cbd1af7..3b0b6dd 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -711,17 +711,4 @@ static int acpi_sbs_resume(struct device *dev) }, .drv.pm = &acpi_sbs_pm, }; - -static int __init acpi_sbs_init(void) -{ - return acpi_bus_register_driver(&acpi_sbs_driver); -} - -static void __exit acpi_sbs_exit(void) -{ - acpi_bus_unregister_driver(&acpi_sbs_driver); - return; -} - -module_init(acpi_sbs_init); -module_exit(acpi_sbs_exit); +module_acpi_driver(acpi_sbs_driver);