diff options
| -rw-r--r-- | drivers/hwmon/ad7314.c | 8 | ||||
| -rw-r--r-- | drivers/hwmon/ads7871.c | 9 | ||||
| -rw-r--r-- | drivers/hwmon/applesmc.c | 4 | ||||
| -rw-r--r-- | include/linux/kernel.h | 2 |
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 | ||
| 90 | static 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 | |||
| 96 | static DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL); | ||
| 90 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, | 97 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, |
| 91 | ad7314_show_temperature, NULL, 0); | 98 | ad7314_show_temperature, NULL, 0); |
| 92 | 99 | ||
| 93 | static struct attribute *ad7314_attributes[] = { | 100 | static 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 | ||
| 142 | static 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 | |||
| 142 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); | 148 | static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); |
| 143 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); | 149 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); |
| 144 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); | 150 | static 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); | |||
| 148 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); | 154 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); |
| 149 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); | 155 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); |
| 150 | 156 | ||
| 157 | static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); | ||
| 158 | |||
| 151 | static struct attribute *ads7871_attributes[] = { | 159 | static 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 | } \ |
