From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] I2C patches for 2.6.10
Date: Fri, 7 Jan 2005 21:39:34 -0800 [thread overview]
Message-ID: <11051627742463@kroah.com> (raw)
In-Reply-To: <110516277494@kroah.com>
ChangeSet 1.1938.439.50, 2005/01/06 15:05:25-08:00, khali@linux-fr.org
[PATCH] I2C: Update fscher pwm functionality
This is a small update to the fscher hardware monitoring chip driver.
More specifically it fixes two aspects of pwm:
1* Use the new sysfs names (e.g. pwm1 instead of fan1_pwm).
2* Better handling of out-of-range pwm values.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/chips/fscher.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff -Nru a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c
--- a/drivers/i2c/chips/fscher.c 2005-01-07 14:54:10 -08:00
+++ b/drivers/i2c/chips/fscher.c 2005-01-07 14:54:10 -08:00
@@ -198,7 +198,7 @@
static DEVICE_ATTR(kind, S_IRUGO, show_##kind##0##sub, NULL);
#define sysfs_fan(offset, reg_status, reg_min, reg_ripple, reg_act) \
-sysfs_rw_n(fan, _pwm , offset, reg_min) \
+sysfs_rw_n(pwm, , offset, reg_min) \
sysfs_rw_n(fan, _status, offset, reg_status) \
sysfs_rw_n(fan, _div , offset, reg_ripple) \
sysfs_ro_n(fan, _input , offset, reg_act)
@@ -247,7 +247,7 @@
#define device_create_file_fan(client, offset) \
do { \
device_create_file(&client->dev, &dev_attr_fan##offset##_status); \
- device_create_file(&client->dev, &dev_attr_fan##offset##_pwm); \
+ device_create_file(&client->dev, &dev_attr_pwm##offset); \
device_create_file(&client->dev, &dev_attr_fan##offset##_div); \
device_create_file(&client->dev, &dev_attr_fan##offset##_input); \
} while (0)
@@ -483,16 +483,17 @@
return sprintf(buf, "%u\n", data->fan_status[FAN_INDEX_FROM_NUM(nr)] & 0x04);
}
-static ssize_t set_fan_pwm(struct i2c_client *client, struct fscher_data *data,
+static ssize_t set_pwm(struct i2c_client *client, struct fscher_data *data,
const char *buf, size_t count, int nr, int reg)
{
- data->fan_min[FAN_INDEX_FROM_NUM(nr)] = simple_strtoul(buf, NULL, 10) & 0xff;
+ unsigned long v = simple_strtoul(buf, NULL, 10);
+ data->fan_min[FAN_INDEX_FROM_NUM(nr)] = v > 0xff ? 0xff : v;
fscher_write_value(client, reg, data->fan_min[FAN_INDEX_FROM_NUM(nr)]);
return count;
}
-static ssize_t show_fan_pwm (struct fscher_data *data, char *buf, int nr)
+static ssize_t show_pwm(struct fscher_data *data, char *buf, int nr)
{
return sprintf(buf, "%u\n", data->fan_min[FAN_INDEX_FROM_NUM(nr)]);
}
next prev parent reply other threads:[~2005-01-08 8:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-08 5:38 [BK PATCH] I2C patches for 2.6.10 Greg KH
2005-01-08 5:39 ` [PATCH] " Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH [this message]
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 5:39 ` Greg KH
2005-01-08 6:22 ` Mark M. Hoffman
2005-01-08 10:15 ` Jean Delvare
2005-01-08 15:37 ` Greg KH
2005-01-08 19:09 ` [BK PATCH] " Christoph Hellwig
2005-01-08 22:28 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11051627742463@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sensors@stimpy.netroedge.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).