From: Riku Voipio <riku.voipio@iki.fi>
To: Jean Delvare <khali@linux-fr.org>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>,
Adrian Bunk <bunk@kernel.org>,
linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] hwmon/f75375s.c: buggy if()
Date: Fri, 26 Oct 2007 14:14:23 +0300 [thread overview]
Message-ID: <20071026111423.GA16559@kos.to> (raw)
In-Reply-To: <20071026103647.78f44826@hyperion.delvare>
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
On Fri, Oct 26, 2007 at 10:36:47AM +0200, Jean Delvare wrote:
> Patch looks correct, however it doesn't apply on top of Mark's tree. I
> was able to get it to apply by reverting "(f75375s) fix pwm mode
> setting" first, but then the build fails. Presumably the other f75375s
> patches interact badly. Can you please respin this patch on top of
> Mark's tree (i.e. on top the the 4 other f75375s patches you sent since
> the -rc1 merge)? Thanks.
The surrounding code had wandered to another function, so it's suprising
it applied at all. Here's respin.
--
"rm -rf" only sounds scary if you don't have backups
[-- Attachment #2: hwmon-f75375s-fix-buggy-if-properly.patch --]
[-- Type: text/plain, Size: 2289 bytes --]
>From 4de69e3ab5b5833cddb503f0dcb2a3ccc2d5b328 Mon Sep 17 00:00:00 2001
From: Riku Voipio <riku.voipio@movial.fi>
Date: Fri, 26 Oct 2007 13:53:50 +0300
Subject: [PATCH] hwmon (f75375s) fix buggy if() properly
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>
---
drivers/hwmon/f75375s.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 472b052..6892f76 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,
int val = simple_strtoul(buf, NULL, 10);
u8 conf = 0;
- if (!(val == 0 || val == 1) || data->kind == f75373)
+ if (!(val == 0 || val == 1))
return -EINVAL;
mutex_lock(&data->update_lock);
@@ -549,13 +549,13 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR,
show_pwm, set_pwm, 0);
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR,
show_pwm_enable, set_pwm_enable, 0);
-static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO|S_IWUSR,
+static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO,
show_pwm_mode, set_pwm_mode, 0);
static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR,
show_pwm, set_pwm, 1);
static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR,
show_pwm_enable, set_pwm_enable, 1);
-static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO|S_IWUSR,
+static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO,
show_pwm_mode, set_pwm_mode, 1);
static struct attribute *f75375_attributes[] = {
@@ -656,6 +656,19 @@ static int f75375_probe(struct i2c_client *client)
if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group)))
goto exit_free;
+ if (data->kind == f75375) {
+ err = sysfs_chmod_file(&client->dev.kobj,
+ &sensor_dev_attr_pwm1_mode.dev_attr.attr,
+ S_IRUGO | S_IWUSR);
+ if (err)
+ goto exit_remove;
+ err = sysfs_chmod_file(&client->dev.kobj,
+ &sensor_dev_attr_pwm2_mode.dev_attr.attr,
+ S_IRUGO | S_IWUSR);
+ if (err)
+ goto exit_remove;
+ }
+
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
--
1.5.3.1
next prev parent reply other threads:[~2007-10-26 11:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-17 19:54 hwmon/f75375s.c: buggy if() Adrian Bunk
2007-10-17 20:45 ` Riku Voipio
2007-10-18 13:37 ` Mark M. Hoffman
2007-10-19 12:37 ` [lm-sensors] " Jean Delvare
2007-10-24 11:50 ` Riku Voipio
2007-10-25 2:25 ` Mark M. Hoffman
2007-10-25 11:48 ` Riku Voipio
2007-10-26 8:36 ` Jean Delvare
2007-10-26 11:14 ` Riku Voipio [this message]
2007-10-26 21:15 ` Jean Delvare
2007-10-28 17:33 ` Mark M. Hoffman
2007-10-25 11:09 ` Jean Delvare
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=20071026111423.GA16559@kos.to \
--to=riku.voipio@iki.fi \
--cc=bunk@kernel.org \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=mhoffman@lightlink.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