aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/lm78.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/lm78.c')
-rw-r--r--drivers/i2c/chips/lm78.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
index 6d52d14eb31c..29241469dcba 100644
--- a/drivers/i2c/chips/lm78.c
+++ b/drivers/i2c/chips/lm78.c
@@ -18,7 +18,6 @@
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/ 19*/
20 20
21#include <linux/config.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
@@ -224,28 +223,28 @@ static ssize_t set_in_max(struct device *dev, const char *buf,
224 223
225#define show_in_offset(offset) \ 224#define show_in_offset(offset) \
226static ssize_t \ 225static ssize_t \
227 show_in##offset (struct device *dev, char *buf) \ 226 show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \
228{ \ 227{ \
229 return show_in(dev, buf, offset); \ 228 return show_in(dev, buf, offset); \
230} \ 229} \
231static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ 230static DEVICE_ATTR(in##offset##_input, S_IRUGO, \
232 show_in##offset, NULL); \ 231 show_in##offset, NULL); \
233static ssize_t \ 232static ssize_t \
234 show_in##offset##_min (struct device *dev, char *buf) \ 233 show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \
235{ \ 234{ \
236 return show_in_min(dev, buf, offset); \ 235 return show_in_min(dev, buf, offset); \
237} \ 236} \
238static ssize_t \ 237static ssize_t \
239 show_in##offset##_max (struct device *dev, char *buf) \ 238 show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \
240{ \ 239{ \
241 return show_in_max(dev, buf, offset); \ 240 return show_in_max(dev, buf, offset); \
242} \ 241} \
243static ssize_t set_in##offset##_min (struct device *dev, \ 242static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \
244 const char *buf, size_t count) \ 243 const char *buf, size_t count) \
245{ \ 244{ \
246 return set_in_min(dev, buf, count, offset); \ 245 return set_in_min(dev, buf, count, offset); \
247} \ 246} \
248static ssize_t set_in##offset##_max (struct device *dev, \ 247static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \
249 const char *buf, size_t count) \ 248 const char *buf, size_t count) \
250{ \ 249{ \
251 return set_in_max(dev, buf, count, offset); \ 250 return set_in_max(dev, buf, count, offset); \
@@ -264,19 +263,19 @@ show_in_offset(5);
264show_in_offset(6); 263show_in_offset(6);
265 264
266/* Temperature */ 265/* Temperature */
267static ssize_t show_temp(struct device *dev, char *buf) 266static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf)
268{ 267{
269 struct lm78_data *data = lm78_update_device(dev); 268 struct lm78_data *data = lm78_update_device(dev);
270 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); 269 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp));
271} 270}
272 271
273static ssize_t show_temp_over(struct device *dev, char *buf) 272static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf)
274{ 273{
275 struct lm78_data *data = lm78_update_device(dev); 274 struct lm78_data *data = lm78_update_device(dev);
276 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); 275 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over));
277} 276}
278 277
279static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) 278static ssize_t set_temp_over(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
280{ 279{
281 struct i2c_client *client = to_i2c_client(dev); 280 struct i2c_client *client = to_i2c_client(dev);
282 struct lm78_data *data = i2c_get_clientdata(client); 281 struct lm78_data *data = i2c_get_clientdata(client);
@@ -289,13 +288,13 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count)
289 return count; 288 return count;
290} 289}
291 290
292static ssize_t show_temp_hyst(struct device *dev, char *buf) 291static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *attr, char *buf)
293{ 292{
294 struct lm78_data *data = lm78_update_device(dev); 293 struct lm78_data *data = lm78_update_device(dev);
295 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); 294 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst));
296} 295}
297 296
298static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) 297static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
299{ 298{
300 struct i2c_client *client = to_i2c_client(dev); 299 struct i2c_client *client = to_i2c_client(dev);
301 struct lm78_data *data = i2c_get_clientdata(client); 300 struct lm78_data *data = i2c_get_clientdata(client);
@@ -398,19 +397,19 @@ static ssize_t set_fan_div(struct device *dev, const char *buf,
398} 397}
399 398
400#define show_fan_offset(offset) \ 399#define show_fan_offset(offset) \
401static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 400static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
402{ \ 401{ \
403 return show_fan(dev, buf, offset - 1); \ 402 return show_fan(dev, buf, offset - 1); \
404} \ 403} \
405static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 404static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \
406{ \ 405{ \
407 return show_fan_min(dev, buf, offset - 1); \ 406 return show_fan_min(dev, buf, offset - 1); \
408} \ 407} \
409static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 408static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \
410{ \ 409{ \
411 return show_fan_div(dev, buf, offset - 1); \ 410 return show_fan_div(dev, buf, offset - 1); \
412} \ 411} \
413static ssize_t set_fan_##offset##_min (struct device *dev, \ 412static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \
414 const char *buf, size_t count) \ 413 const char *buf, size_t count) \
415{ \ 414{ \
416 return set_fan_min(dev, buf, count, offset - 1); \ 415 return set_fan_min(dev, buf, count, offset - 1); \
@@ -419,13 +418,13 @@ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL);\
419static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ 418static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
420 show_fan_##offset##_min, set_fan_##offset##_min); 419 show_fan_##offset##_min, set_fan_##offset##_min);
421 420
422static ssize_t set_fan_1_div(struct device *dev, const char *buf, 421static ssize_t set_fan_1_div(struct device *dev, struct device_attribute *attr, const char *buf,
423 size_t count) 422 size_t count)
424{ 423{
425 return set_fan_div(dev, buf, count, 0) ; 424 return set_fan_div(dev, buf, count, 0) ;
426} 425}
427 426
428static ssize_t set_fan_2_div(struct device *dev, const char *buf, 427static ssize_t set_fan_2_div(struct device *dev, struct device_attribute *attr, const char *buf,
429 size_t count) 428 size_t count)
430{ 429{
431 return set_fan_div(dev, buf, count, 1) ; 430 return set_fan_div(dev, buf, count, 1) ;
@@ -443,7 +442,7 @@ static DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR,
443static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); 442static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL);
444 443
445/* VID */ 444/* VID */
446static ssize_t show_vid(struct device *dev, char *buf) 445static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
447{ 446{
448 struct lm78_data *data = lm78_update_device(dev); 447 struct lm78_data *data = lm78_update_device(dev);
449 return sprintf(buf, "%d\n", VID_FROM_REG(data->vid)); 448 return sprintf(buf, "%d\n", VID_FROM_REG(data->vid));
@@ -451,7 +450,7 @@ static ssize_t show_vid(struct device *dev, char *buf)
451static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 450static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
452 451
453/* Alarms */ 452/* Alarms */
454static ssize_t show_alarms(struct device *dev, char *buf) 453static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
455{ 454{
456 struct lm78_data *data = lm78_update_device(dev); 455 struct lm78_data *data = lm78_update_device(dev);
457 return sprintf(buf, "%u\n", data->alarms); 456 return sprintf(buf, "%u\n", data->alarms);
@@ -671,7 +670,7 @@ static int lm78_detach_client(struct i2c_client *client)
671 return 0; 670 return 0;
672} 671}
673 672
674/* The SMBus locks itself, but ISA access must be locked explicitely! 673/* The SMBus locks itself, but ISA access must be locked explicitly!
675 We don't want to lock the whole ISA bus, so we lock each client 674 We don't want to lock the whole ISA bus, so we lock each client
676 separately. 675 separately.
677 We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks, 676 We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks,
@@ -690,7 +689,7 @@ static int lm78_read_value(struct i2c_client *client, u8 reg)
690 return i2c_smbus_read_byte_data(client, reg); 689 return i2c_smbus_read_byte_data(client, reg);
691} 690}
692 691
693/* The SMBus locks itself, but ISA access muse be locked explicitely! 692/* The SMBus locks itself, but ISA access muse be locked explicitly!
694 We don't want to lock the whole ISA bus, so we lock each client 693 We don't want to lock the whole ISA bus, so we lock each client
695 separately. 694 separately.
696 We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks, 695 We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks,