@@ -453,48 +453,46 @@ int acpi_processor_pstate_control(void)
453
453
int acpi_processor_notify_smm (struct module * calling_module )
454
454
{
455
455
static int is_done ;
456
- int result ;
456
+ int result = 0 ;
457
457
458
458
if (!acpi_processor_cpufreq_init )
459
459
return - EBUSY ;
460
460
461
461
if (!try_module_get (calling_module ))
462
462
return - EINVAL ;
463
463
464
- /* is_done is set to negative if an error occurred,
465
- * and to postitive if _no_ error occurred, but SMM
466
- * was already notified. This avoids double notification
467
- * which might lead to unexpected results.. .
464
+ /*
465
+ * is_done is set to negative if an error occurs and to 1 if no error
466
+ * occurrs, but SMM has been notified already . This avoids repeated
467
+ * notification which might lead to unexpected results.
468
468
*/
469
- if (is_done > 0 ) {
470
- module_put (calling_module );
471
- return 0 ;
472
- } else if (is_done < 0 ) {
473
- module_put (calling_module );
474
- return is_done ;
475
- }
469
+ if (is_done != 0 ) {
470
+ if (is_done < 0 )
471
+ result = is_done ;
476
472
477
- is_done = - EIO ;
473
+ goto out_put ;
474
+ }
478
475
479
476
result = acpi_processor_pstate_control ();
480
- if (!result ) {
481
- pr_debug ("No SMI port or pstate_control\n" );
482
- module_put (calling_module );
483
- return 0 ;
484
- }
485
- if (result < 0 ) {
486
- module_put (calling_module );
487
- return result ;
477
+ if (result <= 0 ) {
478
+ if (!result )
479
+ pr_debug ("No SMI port or pstate_control\n" );
480
+
481
+ is_done = - EIO ;
482
+ goto out_put ;
488
483
}
489
484
490
- /* Success. If there's no _PPC, we need to fear nothing, so
491
- * we can allow the cpufreq driver to be rmmod'ed. */
492
485
is_done = 1 ;
486
+ /*
487
+ * Success. If there _PPC, unloading the cpufreq driver would be risky,
488
+ * so disallow it in that case.
489
+ */
490
+ if (acpi_processor_ppc_in_use )
491
+ return 0 ;
493
492
494
- if (!acpi_processor_ppc_in_use )
495
- module_put (calling_module );
496
-
497
- return 0 ;
493
+ out_put :
494
+ module_put (calling_module );
495
+ return result ;
498
496
}
499
497
EXPORT_SYMBOL (acpi_processor_notify_smm );
500
498
0 commit comments