Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292165
b: refs/heads/master
c: 4d387df
h: refs/heads/master
i:
  292163: 512d9c6
v: v3
  • Loading branch information
Guenter Roeck authored and Guenter Roeck committed Mar 19, 2012
1 parent eb4db28 commit 63bef89
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85a0c0d1a17cd83f4c2cec09c3ae69ed210f23b2
refs/heads/master: 4d387df74e175659ad9c8a16ae8e5b364b7d3f56
71 changes: 44 additions & 27 deletions trunk/drivers/hwmon/thmc50.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*
thmc50.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (C) 2007 Krzysztof Helt <krzysztof.h1@wp.pl>
Based on 2.4 driver by Frodo Looijaard <frodol@dds.nl> and
Philip Edelbrock <phil@netroedge.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
* thmc50.c - Part of lm_sensors, Linux kernel modules for hardware
* monitoring
* Copyright (C) 2007 Krzysztof Helt <krzysztof.h1@wp.pl>
* Based on 2.4 driver by Frodo Looijaard <frodol@dds.nl> and
* Philip Edelbrock <phil@netroedge.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <linux/module.h>
#include <linux/init.h>
Expand Down Expand Up @@ -124,8 +124,13 @@ static ssize_t set_analog_out(struct device *dev,
{
struct i2c_client *client = to_i2c_client(dev);
struct thmc50_data *data = i2c_get_clientdata(client);
int tmp = simple_strtoul(buf, NULL, 10);
int config;
unsigned long tmp;
int err;

err = kstrtoul(buf, 10, &tmp);
if (err)
return err;

mutex_lock(&data->update_lock);
data->analog_out = SENSORS_LIMIT(tmp, 0, 255);
Expand Down Expand Up @@ -173,7 +178,12 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
int nr = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev);
struct thmc50_data *data = i2c_get_clientdata(client);
int val = simple_strtol(buf, NULL, 10);
long val;
int err;

err = kstrtol(buf, 10, &val);
if (err)
return err;

mutex_lock(&data->update_lock);
data->temp_min[nr] = SENSORS_LIMIT(val / 1000, -128, 127);
Expand All @@ -197,7 +207,12 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
int nr = to_sensor_dev_attr(attr)->index;
struct i2c_client *client = to_i2c_client(dev);
struct thmc50_data *data = i2c_get_clientdata(client);
int val = simple_strtol(buf, NULL, 10);
long val;
int err;

err = kstrtol(buf, 10, &val);
if (err)
return err;

mutex_lock(&data->update_lock);
data->temp_max[nr] = SENSORS_LIMIT(val / 1000, -128, 127);
Expand Down Expand Up @@ -360,14 +375,16 @@ static int thmc50_probe(struct i2c_client *client,
thmc50_init_client(client);

/* Register sysfs hooks */
if ((err = sysfs_create_group(&client->dev.kobj, &thmc50_group)))
err = sysfs_create_group(&client->dev.kobj, &thmc50_group);
if (err)
goto exit_free;

/* Register ADM1022 sysfs hooks */
if (data->has_temp3)
if ((err = sysfs_create_group(&client->dev.kobj,
&temp3_group)))
if (data->has_temp3) {
err = sysfs_create_group(&client->dev.kobj, &temp3_group);
if (err)
goto exit_remove_sysfs_thmc50;
}

/* Register a new directory entry with module sensors */
data->hwmon_dev = hwmon_device_register(&client->dev);
Expand Down

0 comments on commit 63bef89

Please sign in to comment.