ACPI: SBS: Simplify the driver init code
PATCH 1/2 ACPI: SBS: Simplify the driver init code
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 <[email protected]>
--- drivers/acpi/sbs.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/acpi/sbs.c +1 -10
@@ -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)
Signature · 1 line
1.7.12.4
PATCH 2/2 ACPI: SBS: Simplify the code using module_acpi_driver()
Using the module_acpi_driver() to simplify the code.
Signed-off-by Hanjun Guo <[email protected]>
--- drivers/acpi/sbs.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/acpi/sbs.c +1 -14
@@ -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);
Signature · 1 line
1.7.12.4