aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-09-21 15:33:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-09-21 15:33:31 -0400
commit6d77987fe62eb97479f27426d12f33ef97145c5b (patch)
treecfe26b77adee0589798cf09fdfad7ce6d0448a56
parent06b050eb81b877c7a4adb6be8624ad3890fee9f2 (diff)
parent263a523d18bca306016d75f5c8d5c57c37fe52fb (diff)
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - Add missing 'name' sysfs attributes to ad7314 and ads7871 drivers - Bump maximum wait time for applesmc driver (again) - Fix build warning seen with W=1 in include/linux/kernel.h, introduced with commit b6d86d3d6d6e ("Fix DIV_ROUND_CLOSEST to support negative dividends") * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: linux/kernel.h: Fix warning seen with W=1 due to change in DIV_ROUND_CLOSEST hwmon: (applesmc) Bump max wait hwmon: (ad7314) Add 'name' sysfs attribute hwmon: (ads7871) Add 'name' sysfs attribute
-rw-r--r--drivers/hwmon/ad7314.c8
-rw-r--r--drivers/hwmon/ads7871.c9
-rw-r--r--drivers/hwmon/applesmc.c4
-rw-r--r--include/linux/kernel.h2
4 files changed, 20 insertions, 3 deletions
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c
index cfec802cf9ca..f915eb1c29f7 100644
--- a/drivers/hwmon/ad7314.c
+++ b/drivers/hwmon/ad7314.c
@@ -87,10 +87,18 @@ static ssize_t ad7314_show_temperature(struct device *dev,
87 } 87 }
88} 88}
89 89
90static ssize_t ad7314_show_name(struct device *dev,
91 struct device_attribute *devattr, char *buf)
92{
93 return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
94}
95
96static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL);
90static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, 97static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
91 ad7314_show_temperature, NULL, 0); 98 ad7314_show_temperature, NULL, 0);
92 99
93static struct attribute *ad7314_attributes[] = { 100static struct attribute *ad7314_attributes[] = {
101 &dev_attr_name.attr,
94 &sensor_dev_attr_temp1_input.dev_attr.attr, 102 &sensor_dev_attr_temp1_input.dev_attr.attr,
95 NULL, 103 NULL,
96}; 104};
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
index e65c6e45d36b..7bf4ce3d405e 100644
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -139,6 +139,12 @@ static ssize_t show_voltage(struct device *dev,
139 } 139 }
140} 140}
141 141
142static ssize_t ads7871_show_name(struct device *dev,
143 struct device_attribute *devattr, char *buf)
144{
145 return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
146}
147
142static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); 148static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0);
143static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); 149static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1);
144static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); 150static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
@@ -148,6 +154,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5);
148static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); 154static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6);
149static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); 155static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7);
150 156
157static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL);
158
151static struct attribute *ads7871_attributes[] = { 159static struct attribute *ads7871_attributes[] = {
152 &sensor_dev_attr_in0_input.dev_attr.attr, 160 &sensor_dev_attr_in0_input.dev_attr.attr,
153 &sensor_dev_attr_in1_input.dev_attr.attr, 161 &sensor_dev_attr_in1_input.dev_attr.attr,
@@ -157,6 +165,7 @@ static struct attribute *ads7871_attributes[] = {
157 &sensor_dev_attr_in5_input.dev_attr.attr, 165 &sensor_dev_attr_in5_input.dev_attr.attr,
158 &sensor_dev_attr_in6_input.dev_attr.attr, 166 &sensor_dev_attr_in6_input.dev_attr.attr,
159 &sensor_dev_attr_in7_input.dev_attr.attr, 167 &sensor_dev_attr_in7_input.dev_attr.attr,
168 &dev_attr_name.attr,
160 NULL 169 NULL
161}; 170};
162 171
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 282708860517..8f3f6f2c45fd 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -53,10 +53,10 @@
53 53
54#define APPLESMC_MAX_DATA_LENGTH 32 54#define APPLESMC_MAX_DATA_LENGTH 32
55 55
56/* wait up to 32 ms for a status change. */ 56/* wait up to 128 ms for a status change. */
57#define APPLESMC_MIN_WAIT 0x0010 57#define APPLESMC_MIN_WAIT 0x0010
58#define APPLESMC_RETRY_WAIT 0x0100 58#define APPLESMC_RETRY_WAIT 0x0100
59#define APPLESMC_MAX_WAIT 0x8000 59#define APPLESMC_MAX_WAIT 0x20000
60 60
61#define APPLESMC_READ_CMD 0x10 61#define APPLESMC_READ_CMD 0x10
62#define APPLESMC_WRITE_CMD 0x11 62#define APPLESMC_WRITE_CMD 0x11
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 594b419b7d20..2451f1f7a1d9 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -91,7 +91,7 @@
91{ \ 91{ \
92 typeof(x) __x = x; \ 92 typeof(x) __x = x; \
93 typeof(divisor) __d = divisor; \ 93 typeof(divisor) __d = divisor; \
94 (((typeof(x))-1) >= 0 || (__x) >= 0) ? \ 94 (((typeof(x))-1) > 0 || (__x) > 0) ? \
95 (((__x) + ((__d) / 2)) / (__d)) : \ 95 (((__x) + ((__d) / 2)) / (__d)) : \
96 (((__x) - ((__d) / 2)) / (__d)); \ 96 (((__x) - ((__d) / 2)) / (__d)); \
97} \ 97} \