public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ACPI: SBS: Simplify the driver init code
@ 2020-11-13  2:25 Hanjun Guo
  2020-11-13  2:25 ` [PATCH 2/2] ACPI: SBS: Simplify the code using module_acpi_driver() Hanjun Guo
  0 siblings, 1 reply; 2+ messages in thread
From: Hanjun Guo @ 2020-11-13  2:25 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, Hanjun Guo

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 <guohanjun@huawei.com>
---
 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)
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] ACPI: SBS: Simplify the code using module_acpi_driver()
  2020-11-13  2:25 [PATCH 1/2] ACPI: SBS: Simplify the driver init code Hanjun Guo
@ 2020-11-13  2:25 ` Hanjun Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Hanjun Guo @ 2020-11-13  2:25 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, Hanjun Guo

Using the module_acpi_driver() to simplify the code.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
 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);
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-13  2:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-13  2:25 [PATCH 1/2] ACPI: SBS: Simplify the driver init code Hanjun Guo
2020-11-13  2:25 ` [PATCH 2/2] ACPI: SBS: Simplify the code using module_acpi_driver() Hanjun Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox