diff options
| author | Daniel Willerud <daniel.willerud@stericsson.com> | 2011-08-26 10:49:11 +0200 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 16:07:26 +0200 |
| commit | f5c0880bbbe348b9521a888d305579c8e0d57923 (patch) | |
| tree | c922c3d5abe4ec39ded8e07ce499ac8b4a428ee8 | |
| parent | 064174531ae3a0312163540df73aba9c6157f942 (diff) | |
hwmon: Adding notifiers to hwmon
ST-Ericsson ID: 354533
ST-Ericsson Linux next: Not tested
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I068a3c801405b6f7ca2b78df7cd9f7461ed8738b
Signed-off-by: Daniel Willerud <daniel.willerud@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/29502
Reviewed-by: QABUILD
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
| -rw-r--r-- | drivers/hwmon/hwmon.c | 21 | ||||
| -rw-r--r-- | include/linux/hwmon.h | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index a61e7815a2a..b3c62f84b0b 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -21,6 +21,7 @@ #include <linux/gfp.h> #include <linux/spinlock.h> #include <linux/pci.h> +#include <linux/notifier.h> #define HWMON_ID_PREFIX "hwmon" #define HWMON_ID_FORMAT HWMON_ID_PREFIX "%d" @@ -29,7 +30,7 @@ static struct class *hwmon_class; static DEFINE_IDR(hwmon_idr); static DEFINE_SPINLOCK(idr_lock); - +static BLOCKING_NOTIFIER_HEAD(hwmon_notifier_list); /** * hwmon_device_register - register w/ hwmon * @dev: the device to register @@ -89,6 +90,24 @@ void hwmon_device_unregister(struct device *dev) "hwmon_device_unregister() failed: bad class ID!\n"); } +int hwmon_notifier_register(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&hwmon_notifier_list, nb); +} +EXPORT_SYMBOL(hwmon_notifier_register); + +int hwmon_notifier_unregister(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&hwmon_notifier_list, nb); +} +EXPORT_SYMBOL(hwmon_notifier_unregister); + +void hwmon_notify(unsigned long val, void *v) +{ + blocking_notifier_call_chain(&hwmon_notifier_list, val, v); +} +EXPORT_SYMBOL(hwmon_notify); + static void __init hwmon_pci_quirks(void) { #if defined CONFIG_X86 && defined CONFIG_PCI diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 6b6ee702b00..8e891b5a777 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h @@ -15,11 +15,16 @@ #define _HWMON_H_ #include <linux/device.h> +#include <linux/notifier.h> struct device *hwmon_device_register(struct device *dev); void hwmon_device_unregister(struct device *dev); +int hwmon_notifier_register(struct notifier_block *nb); +int hwmon_notifier_unregister(struct notifier_block *nb); +void hwmon_notify(unsigned long val, void *v); + /* Scale user input to sensible values */ static inline int SENSORS_LIMIT(long value, long low, long high) { |
