summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Willerud <daniel.willerud@stericsson.com>2011-08-26 10:49:11 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:00:51 +0200
commit1232e887f97a3e9ea82b6193cda5e58ba7605736 (patch)
tree14d73952885e3c90f6cb87ac661d3033a59f9bf8
parentc03cd4e6ffe661108ab97eae9b245702ad8e5cf5 (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.c21
-rw-r--r--include/linux/hwmon.h6
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index c3c471ca202..8957bbac7a7 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,6 +30,8 @@ static struct class *hwmon_class;
static DEFINE_IDA(hwmon_ida);
+static BLOCKING_NOTIFIER_HEAD(hwmon_notifier_list);
+
/**
* hwmon_device_register - register w/ hwmon
* @dev: the device to register
@@ -75,6 +78,24 @@ void hwmon_device_unregister(struct device *dev)
}
EXPORT_SYMBOL_GPL(hwmon_device_unregister);
+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 82b29ae6ebb..6cb4d26bf60 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -14,12 +14,18 @@
#ifndef _HWMON_H_
#define _HWMON_H_
+#include <linux/notifier.h>
+
struct device;
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)
{