diff options
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f9bc21c74b59..d1b6d4e7495d 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/if_ether.h> | 35 | #include <linux/if_ether.h> |
36 | #include <linux/notifier.h> | 36 | #include <linux/notifier.h> |
37 | #include <linux/reboot.h> | 37 | #include <linux/reboot.h> |
38 | #include <linux/memory.h> | ||
38 | #include <asm/kexec.h> | 39 | #include <asm/kexec.h> |
39 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
40 | 41 | ||
@@ -3503,6 +3504,24 @@ void ehea_crash_handler(void) | |||
3503 | 0, H_DEREG_BCMC); | 3504 | 0, H_DEREG_BCMC); |
3504 | } | 3505 | } |
3505 | 3506 | ||
3507 | static int ehea_mem_notifier(struct notifier_block *nb, | ||
3508 | unsigned long action, void *data) | ||
3509 | { | ||
3510 | switch (action) { | ||
3511 | case MEM_OFFLINE: | ||
3512 | ehea_info("memory has been removed"); | ||
3513 | ehea_rereg_mrs(NULL); | ||
3514 | break; | ||
3515 | default: | ||
3516 | break; | ||
3517 | } | ||
3518 | return NOTIFY_OK; | ||
3519 | } | ||
3520 | |||
3521 | static struct notifier_block ehea_mem_nb = { | ||
3522 | .notifier_call = ehea_mem_notifier, | ||
3523 | }; | ||
3524 | |||
3506 | static int ehea_reboot_notifier(struct notifier_block *nb, | 3525 | static int ehea_reboot_notifier(struct notifier_block *nb, |
3507 | unsigned long action, void *unused) | 3526 | unsigned long action, void *unused) |
3508 | { | 3527 | { |
@@ -3581,6 +3600,10 @@ int __init ehea_module_init(void) | |||
3581 | if (ret) | 3600 | if (ret) |
3582 | ehea_info("failed registering reboot notifier"); | 3601 | ehea_info("failed registering reboot notifier"); |
3583 | 3602 | ||
3603 | ret = register_memory_notifier(&ehea_mem_nb); | ||
3604 | if (ret) | ||
3605 | ehea_info("failed registering memory remove notifier"); | ||
3606 | |||
3584 | ret = crash_shutdown_register(&ehea_crash_handler); | 3607 | ret = crash_shutdown_register(&ehea_crash_handler); |
3585 | if (ret) | 3608 | if (ret) |
3586 | ehea_info("failed registering crash handler"); | 3609 | ehea_info("failed registering crash handler"); |
@@ -3604,6 +3627,7 @@ int __init ehea_module_init(void) | |||
3604 | out3: | 3627 | out3: |
3605 | ibmebus_unregister_driver(&ehea_driver); | 3628 | ibmebus_unregister_driver(&ehea_driver); |
3606 | out2: | 3629 | out2: |
3630 | unregister_memory_notifier(&ehea_mem_nb); | ||
3607 | unregister_reboot_notifier(&ehea_reboot_nb); | 3631 | unregister_reboot_notifier(&ehea_reboot_nb); |
3608 | crash_shutdown_unregister(&ehea_crash_handler); | 3632 | crash_shutdown_unregister(&ehea_crash_handler); |
3609 | out: | 3633 | out: |
@@ -3621,6 +3645,7 @@ static void __exit ehea_module_exit(void) | |||
3621 | ret = crash_shutdown_unregister(&ehea_crash_handler); | 3645 | ret = crash_shutdown_unregister(&ehea_crash_handler); |
3622 | if (ret) | 3646 | if (ret) |
3623 | ehea_info("failed unregistering crash handler"); | 3647 | ehea_info("failed unregistering crash handler"); |
3648 | unregister_memory_notifier(&ehea_mem_nb); | ||
3624 | kfree(ehea_fw_handles.arr); | 3649 | kfree(ehea_fw_handles.arr); |
3625 | kfree(ehea_bcmc_regs.arr); | 3650 | kfree(ehea_bcmc_regs.arr); |
3626 | ehea_destroy_busmap(); | 3651 | ehea_destroy_busmap(); |