aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f75375s.c
diff options
context:
space:
mode:
authorRiku Voipio <riku.voipio@iki.fi>2007-10-26 07:14:23 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-11-08 08:42:47 -0500
commit76e83bef15a11413e9f3da986c6e869a8192675e (patch)
tree48417c4dd1a70b9338ab35d6aea1ee9a4e1e7f36 /drivers/hwmon/f75375s.c
parent9aa69338924266ca0b1aceb0ab943e8842449b0a (diff)
hwmon: (f75375s) pwmX_mode sysfs files writable for f75375 variant
Fix value check in set_pwm_mode(). Instead of checking for chip variant there, make pwmX_mode sysfs nodes only writable on f75375 variant. Signed-off-by: Riku Voipio <riku.voipio@movial.fi> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/f75375s.c')
-rw-r--r--drivers/hwmon/f75375s.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 472b052770d3..6892f76fc18a 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -343,7 +343,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
343 int val = simple_strtoul(buf, NULL, 10); 343 int val = simple_strtoul(buf, NULL, 10);
344 u8 conf = 0; 344 u8 conf = 0;
345 345
346 if (!(val == 0 || val == 1) || data->kind == f75373) 346 if (!(val == 0 || val == 1))
347 return -EINVAL; 347 return -EINVAL;
348 348
349 mutex_lock(&data->update_lock); 349 mutex_lock(&data->update_lock);
@@ -549,13 +549,13 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR,
549 show_pwm, set_pwm, 0); 549 show_pwm, set_pwm, 0);
550static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, 550static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR,
551 show_pwm_enable, set_pwm_enable, 0); 551 show_pwm_enable, set_pwm_enable, 0);
552static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO|S_IWUSR, 552static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO,
553 show_pwm_mode, set_pwm_mode, 0); 553 show_pwm_mode, set_pwm_mode, 0);
554static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, 554static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR,
555 show_pwm, set_pwm, 1); 555 show_pwm, set_pwm, 1);
556static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, 556static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR,
557 show_pwm_enable, set_pwm_enable, 1); 557 show_pwm_enable, set_pwm_enable, 1);
558static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO|S_IWUSR, 558static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO,
559 show_pwm_mode, set_pwm_mode, 1); 559 show_pwm_mode, set_pwm_mode, 1);
560 560
561static struct attribute *f75375_attributes[] = { 561static struct attribute *f75375_attributes[] = {
@@ -656,6 +656,19 @@ static int f75375_probe(struct i2c_client *client)
656 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) 656 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group)))
657 goto exit_free; 657 goto exit_free;
658 658
659 if (data->kind == f75375) {
660 err = sysfs_chmod_file(&client->dev.kobj,
661 &sensor_dev_attr_pwm1_mode.dev_attr.attr,
662 S_IRUGO | S_IWUSR);
663 if (err)
664 goto exit_remove;
665 err = sysfs_chmod_file(&client->dev.kobj,
666 &sensor_dev_attr_pwm2_mode.dev_attr.attr,
667 S_IRUGO | S_IWUSR);
668 if (err)
669 goto exit_remove;
670 }
671
659 data->hwmon_dev = hwmon_device_register(&client->dev); 672 data->hwmon_dev = hwmon_device_register(&client->dev);
660 if (IS_ERR(data->hwmon_dev)) { 673 if (IS_ERR(data->hwmon_dev)) {
661 err = PTR_ERR(data->hwmon_dev); 674 err = PTR_ERR(data->hwmon_dev);