From: Andrew Morton <akpm@linux-foundation.org>
To: Steven King <sfking@fdwdc.com>
Cc: Jean Delvare <khali@linux-fr.org>,
lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature
Date: Thu, 04 Feb 2010 18:22:03 +0000 [thread overview]
Message-ID: <20100204102203.ecf4bbb5.akpm@linux-foundation.org> (raw)
In-Reply-To: <201002031723.49976.sfking@fdwdc.com>
On Wed, 3 Feb 2010 17:23:49 -0800
Steven King <sfking@fdwdc.com> wrote:
> The TI TMP102 is similar to the lm75. It differs from the lm75 by having a 16 bit conf register
> and the temp registers have a minimum resolution of 12bits; the extended conf register
> can select 13 bit resolution (which this driver does) and also change the update rate (which this
> driver currently doesn't use).
>
A neat little driver.
checkpatch spits this warning:
WARNING: struct dev_pm_ops should normally be const
#387: FILE: drivers/hwmon/tmp102.c:300:
+static struct dev_pm_ops tmp102_dev_pm_ops = {
which seems truthful enough.
--- a/drivers/hwmon/tmp102.c~hwmon-driver-for-ti-tmp102-temperature-sensor-checkpatch-fixes
+++ a/drivers/hwmon/tmp102.c
@@ -297,7 +297,7 @@ static int tmp102_resume(struct device *
return 0;
}
-static struct dev_pm_ops tmp102_dev_pm_ops = {
+static const struct dev_pm_ops tmp102_dev_pm_ops = {
.suspend = tmp102_suspend,
.resume = tmp102_resume,
};
_
And doing this will hurt readers' brains less:
Use conventional array-walk loop.
--- a/drivers/hwmon/tmp102.c~hwmon-driver-for-ti-tmp102-temperature-sensor-fix
+++ a/drivers/hwmon/tmp102.c
@@ -91,13 +91,14 @@ static struct tmp102 *tmp102_update_devi
mutex_lock(&tmp102->lock);
if (time_after(jiffies, tmp102->last_update + HZ / 4)) {
- int i = 0;
- do {
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(tmp102->temp); i++) {
int status = tmp102_read_reg(client, tmp102_reg[i]);
if (status > -1)
tmp102->temp[i] = tmp102_reg_to_mC(status);
- } while (++i < ARRAY_SIZE(tmp102->temp));
+ }
tmp102->last_update = jiffies;
}
mutex_unlock(&tmp102->lock);
_
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Steven King <sfking@fdwdc.com>
Cc: Jean Delvare <khali@linux-fr.org>,
lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: driver for TI tmp102 temperature sensor
Date: Thu, 4 Feb 2010 10:22:03 -0800 [thread overview]
Message-ID: <20100204102203.ecf4bbb5.akpm@linux-foundation.org> (raw)
In-Reply-To: <201002031723.49976.sfking@fdwdc.com>
On Wed, 3 Feb 2010 17:23:49 -0800
Steven King <sfking@fdwdc.com> wrote:
> The TI TMP102 is similar to the lm75. It differs from the lm75 by having a 16 bit conf register
> and the temp registers have a minimum resolution of 12bits; the extended conf register
> can select 13 bit resolution (which this driver does) and also change the update rate (which this
> driver currently doesn't use).
>
A neat little driver.
checkpatch spits this warning:
WARNING: struct dev_pm_ops should normally be const
#387: FILE: drivers/hwmon/tmp102.c:300:
+static struct dev_pm_ops tmp102_dev_pm_ops = {
which seems truthful enough.
--- a/drivers/hwmon/tmp102.c~hwmon-driver-for-ti-tmp102-temperature-sensor-checkpatch-fixes
+++ a/drivers/hwmon/tmp102.c
@@ -297,7 +297,7 @@ static int tmp102_resume(struct device *
return 0;
}
-static struct dev_pm_ops tmp102_dev_pm_ops = {
+static const struct dev_pm_ops tmp102_dev_pm_ops = {
.suspend = tmp102_suspend,
.resume = tmp102_resume,
};
_
And doing this will hurt readers' brains less:
Use conventional array-walk loop.
--- a/drivers/hwmon/tmp102.c~hwmon-driver-for-ti-tmp102-temperature-sensor-fix
+++ a/drivers/hwmon/tmp102.c
@@ -91,13 +91,14 @@ static struct tmp102 *tmp102_update_devi
mutex_lock(&tmp102->lock);
if (time_after(jiffies, tmp102->last_update + HZ / 4)) {
- int i = 0;
- do {
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(tmp102->temp); i++) {
int status = tmp102_read_reg(client, tmp102_reg[i]);
if (status > -1)
tmp102->temp[i] = tmp102_reg_to_mC(status);
- } while (++i < ARRAY_SIZE(tmp102->temp));
+ }
tmp102->last_update = jiffies;
}
mutex_unlock(&tmp102->lock);
_
next prev parent reply other threads:[~2010-02-04 18:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 1:23 [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature sensor Steven King
2010-02-04 1:23 ` Steven King
2010-02-04 18:22 ` Andrew Morton [this message]
2010-02-04 18:22 ` Andrew Morton
2010-02-04 21:17 ` [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature Steven King
2010-02-04 21:17 ` [PATCH] hwmon: driver for TI tmp102 temperature sensor Steven King
2010-02-04 21:26 ` [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature Andrew Morton
2010-02-04 21:26 ` [PATCH] hwmon: driver for TI tmp102 temperature sensor Andrew Morton
2010-02-04 18:37 ` [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature Jean Delvare
2010-02-04 18:37 ` [PATCH] hwmon: driver for TI tmp102 temperature sensor Jean Delvare
2010-02-04 21:57 ` [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature Steven King
2010-02-04 21:57 ` [PATCH] hwmon: driver for TI tmp102 temperature sensor Steven King
2010-02-05 8:12 ` [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature Jean Delvare
2010-02-05 8:12 ` [PATCH] hwmon: driver for TI tmp102 temperature sensor Jean Delvare
2010-03-06 8:35 ` [lm-sensors] [PATCH] hwmon: driver for TI tmp102 temperature Jean Delvare
2010-03-06 16:16 ` Steven King
2010-03-07 12:23 ` Jean Delvare
2010-03-14 3:29 ` Steven King
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=20100204102203.ecf4bbb5.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=sfking@fdwdc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.