0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/kernel.h>
0013 #include <linux/module.h>
0014 #include <linux/init.h>
0015 #include <linux/acpi.h>
0016 #include <acpi/hed.h>
0017
0018 static const struct acpi_device_id acpi_hed_ids[] = {
0019 {"PNP0C33", 0},
0020 {"", 0},
0021 };
0022 MODULE_DEVICE_TABLE(acpi, acpi_hed_ids);
0023
0024 static acpi_handle hed_handle;
0025
0026 static BLOCKING_NOTIFIER_HEAD(acpi_hed_notify_list);
0027
0028 int register_acpi_hed_notifier(struct notifier_block *nb)
0029 {
0030 return blocking_notifier_chain_register(&acpi_hed_notify_list, nb);
0031 }
0032 EXPORT_SYMBOL_GPL(register_acpi_hed_notifier);
0033
0034 void unregister_acpi_hed_notifier(struct notifier_block *nb)
0035 {
0036 blocking_notifier_chain_unregister(&acpi_hed_notify_list, nb);
0037 }
0038 EXPORT_SYMBOL_GPL(unregister_acpi_hed_notifier);
0039
0040
0041
0042
0043
0044
0045 static void acpi_hed_notify(struct acpi_device *device, u32 event)
0046 {
0047 blocking_notifier_call_chain(&acpi_hed_notify_list, 0, NULL);
0048 }
0049
0050 static int acpi_hed_add(struct acpi_device *device)
0051 {
0052
0053 if (hed_handle)
0054 return -EINVAL;
0055 hed_handle = device->handle;
0056 return 0;
0057 }
0058
0059 static int acpi_hed_remove(struct acpi_device *device)
0060 {
0061 hed_handle = NULL;
0062 return 0;
0063 }
0064
0065 static struct acpi_driver acpi_hed_driver = {
0066 .name = "hardware_error_device",
0067 .class = "hardware_error",
0068 .ids = acpi_hed_ids,
0069 .ops = {
0070 .add = acpi_hed_add,
0071 .remove = acpi_hed_remove,
0072 .notify = acpi_hed_notify,
0073 },
0074 };
0075 module_acpi_driver(acpi_hed_driver);
0076
0077 MODULE_AUTHOR("Huang Ying");
0078 MODULE_DESCRIPTION("ACPI Hardware Error Device Driver");
0079 MODULE_LICENSE("GPL");