git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vsprintf: split out '%p' handling logic
[pandora-kernel.git]
/
drivers
/
hwmon
/
lm77.c
diff --git
a/drivers/hwmon/lm77.c
b/drivers/hwmon/lm77.c
index
dd969f1
..
36d5a8c
100644
(file)
--- a/
drivers/hwmon/lm77.c
+++ b/
drivers/hwmon/lm77.c
@@
-31,11
+31,13
@@
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
/* Addresses to scan */
#include <linux/err.h>
#include <linux/mutex.h>
/* Addresses to scan */
-static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, I2C_CLIENT_END };
+static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
+ I2C_CLIENT_END };
/* Insmod parameters */
I2C_CLIENT_INSMOD_1(lm77);
/* Insmod parameters */
I2C_CLIENT_INSMOD_1(lm77);
@@
-51,7
+53,7
@@
I2C_CLIENT_INSMOD_1(lm77);
/* Each client has this additional data */
struct lm77_data {
struct i2c_client client;
/* Each client has this additional data */
struct lm77_data {
struct i2c_client client;
- struct
class_device *class
_dev;
+ struct
device *hwmon
_dev;
struct mutex update_lock;
char valid;
unsigned long last_updated; /* In jiffies */
struct mutex update_lock;
char valid;
unsigned long last_updated; /* In jiffies */
@@
-113,7
+115,6
@@
show(temp_input);
show(temp_crit);
show(temp_min);
show(temp_max);
show(temp_crit);
show(temp_min);
show(temp_max);
-show(alarms);
/* read routines for hysteresis values */
static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf)
/* read routines for hysteresis values */
static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf)
@@
-138,7
+139,7
@@
static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co
{ \
struct i2c_client *client = to_i2c_client(dev); \
struct lm77_data *data = i2c_get_clientdata(client); \
{ \
struct i2c_client *client = to_i2c_client(dev); \
struct lm77_data *data = i2c_get_clientdata(client); \
- long val = simple_strto
ul(buf, NULL, 10);
\
+ long val = simple_strto
l(buf, NULL, 10);
\
\
mutex_lock(&data->update_lock); \
data->value = val; \
\
mutex_lock(&data->update_lock); \
data->value = val; \
@@
-186,6
+187,14
@@
static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
return count;
}
return count;
}
+static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ int bitnr = to_sensor_dev_attr(attr)->index;
+ struct lm77_data *data = lm77_update_device(dev);
+ return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
+}
+
static DEVICE_ATTR(temp1_input, S_IRUGO,
show_temp_input, NULL);
static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO,
static DEVICE_ATTR(temp1_input, S_IRUGO,
show_temp_input, NULL);
static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO,
@@
-202,8
+211,9
@@
static DEVICE_ATTR(temp1_min_hyst, S_IRUGO,
static DEVICE_ATTR(temp1_max_hyst, S_IRUGO,
show_temp_max_hyst, NULL);
static DEVICE_ATTR(temp1_max_hyst, S_IRUGO,
show_temp_max_hyst, NULL);
-static DEVICE_ATTR(alarms, S_IRUGO,
- show_alarms, NULL);
+static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2);
+static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0);
+static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1);
static int lm77_attach_adapter(struct i2c_adapter *adapter)
{
static int lm77_attach_adapter(struct i2c_adapter *adapter)
{
@@
-220,8
+230,9
@@
static struct attribute *lm77_attributes[] = {
&dev_attr_temp1_crit_hyst.attr,
&dev_attr_temp1_min_hyst.attr,
&dev_attr_temp1_max_hyst.attr,
&dev_attr_temp1_crit_hyst.attr,
&dev_attr_temp1_min_hyst.attr,
&dev_attr_temp1_max_hyst.attr,
- &dev_attr_alarms.attr,
-
+ &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
+ &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
+ &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
NULL
};
NULL
};
@@
-337,9
+348,9
@@
static int lm77_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = sysfs_create_group(&new_client->dev.kobj, &lm77_group)))
goto exit_detach;
if ((err = sysfs_create_group(&new_client->dev.kobj, &lm77_group)))
goto exit_detach;
- data->
class
_dev = hwmon_device_register(&new_client->dev);
- if (IS_ERR(data->
class
_dev)) {
- err = PTR_ERR(data->
class
_dev);
+ data->
hwmon
_dev = hwmon_device_register(&new_client->dev);
+ if (IS_ERR(data->
hwmon
_dev)) {
+ err = PTR_ERR(data->
hwmon
_dev);
goto exit_remove;
}
goto exit_remove;
}
@@
-358,7
+369,7
@@
exit:
static int lm77_detach_client(struct i2c_client *client)
{
struct lm77_data *data = i2c_get_clientdata(client);
static int lm77_detach_client(struct i2c_client *client)
{
struct lm77_data *data = i2c_get_clientdata(client);
- hwmon_device_unregister(data->
class
_dev);
+ hwmon_device_unregister(data->
hwmon
_dev);
sysfs_remove_group(&client->dev.kobj, &lm77_group);
i2c_detach_client(client);
kfree(data);
sysfs_remove_group(&client->dev.kobj, &lm77_group);
i2c_detach_client(client);
kfree(data);