From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 7/7] hwmon: (lm90) Add support for max6695 and max6696
Date: Wed, 15 Sep 2010 07:29:27 -0700 [thread overview]
Message-ID: <20100915142927.GB9707@ericsson.com> (raw)
In-Reply-To: <20100915132029.4c708c7d@hyperion.delvare>
Hi Jean,
On Wed, Sep 15, 2010 at 07:20:29AM -0400, Jean Delvare wrote:
> Hi Guenter,
>
> Sorry for the slow review, I am in the process of reinstalling my
> workstation entirely, and this keeps be busy.
>
No problem. I appreciate your time.
> On Thu, 9 Sep 2010 06:25:50 -0700, Guenter Roeck wrote:
[...]
> > +MAX6695 and MAX6696:
> > + * Better local resolution
> > + * Selectable address
>
> MAX6696 only?
>
yes
[...]
> > enum chips { lm90, adm1032, lm99, lm86, max6657, adt7461, max6680, max6646,
> > - w83l771, max6659 };
> > + w83l771, max6659, max6695 };
>
> How much time before we mix max6659 and max6695? ;) It might make sense
> to decide to go with max6696 for the latter, to work around this
> potential issue.
>
ok with me.
> >
> > /*
> > * The LM90 registers
> > @@ -135,9 +140,10 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, adt7461, max6680, max6646,
> > #define LM90_REG_R_TCRIT_HYST 0x21
> > #define LM90_REG_W_TCRIT_HYST 0x21
> >
> > -/* MAX6646/6647/6649/6657/6658/6659 registers */
> > +/* MAX6646/6647/6649/6657/6658/6659/6695/6696 registers */
> >
> > #define MAX6657_REG_R_LOCAL_TEMPL 0x11
> > +#define MAX6695_REG_R_STATUS2 0x12
> > #define MAX6659_REG_R_REMOTE_EMERG 0x16
> > #define MAX6659_REG_W_REMOTE_EMERG 0x16
> > #define MAX6659_REG_R_LOCAL_EMERG 0x17
> > @@ -152,6 +158,8 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, adt7461, max6680, max6646,
> > #define LM90_HAVE_LOCAL_EXT 0x04 /* extended local temperature */
> > #define LM90_HAVE_REM_LIMIT_EXT 0x08 /* extended remote limit */
> > #define LM90_HAVE_EMERGENCY 0x10 /* 3rd upper (emergency) limit */
> > +#define LM90_HAVE_EMERGENCY_ALARM 0x20 /* emergency alarm */
> > +#define LM90_HAVE_TEMP3 0x40 /* 3rd temperature sensor */
>
> Use one space after #define.
>
Did that already after the comment in the earlier patch of the series.
> >
> > /*
> > * Functions declaration
> > @@ -164,6 +172,10 @@ static void lm90_init_client(struct i2c_client *client);
> > static void lm90_alert(struct i2c_client *client, unsigned int flag);
> > static int lm90_remove(struct i2c_client *client);
> > static struct lm90_data *lm90_update_device(struct device *dev);
> > +static int lm90_read_reg(struct i2c_client *client, u8 reg, u8 *value);
> > +static inline void lm90_select_remote_channel(struct i2c_client *client,
> > + struct lm90_data *data,
> > + int channel);
>
> Would it be possible to simply place these functions at the right
> location so that forward declarations are not needed? Ideally I would
> like to get rid of all these forward declarations.
>
I moved lm90_select_remote_channel() so the lm90_read_reg() declaration
is no longer needed.
Code structure is such that sensor show/set functions come first, followed by
"real" code. Unfortunately, that implies that local functions called from
those functions have to be forward declarated.
We can move that around to avoid forward declarations, but I would prefer
to do that in a separate patch if we decide to go that way.
[...]
> > +/*
> > + * Additional attributes for devices with 3 temperature sensors
> > + */
> > +static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp11, NULL, 0, 5);
> > +static SENSOR_DEVICE_ATTR_2(temp3_min, S_IWUSR | S_IRUGO, show_temp11,
> > + set_temp11, 3, 6);
> > +static SENSOR_DEVICE_ATTR_2(temp3_max, S_IWUSR | S_IRUGO, show_temp11,
> > + set_temp11, 4, 7);
> > +static SENSOR_DEVICE_ATTR(temp3_crit, S_IWUSR | S_IRUGO, show_temp8,
> > + set_temp8, 6);
> > +static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO, show_temphyst, NULL, 4);
>
> 4, really? Remote 2 critical limit is 6.
>
I am impressed. Good catch.
> (That's what we get for using bare numbers instead of defining proper
> symbols, sigh.)
>
> Also it seems that the hysteresis register applies to both critical and
> emergency limits, so it would probably make sense to create (read-only)
> temp[1-3]_emergency_hyst attributes.
>
Makes sense. That will be in patch #6 (previously patch #5), though,
with additional code here, and yet another attribute in the ABI.
[...]
>
> Please document the fact that the following function must be called
> with data->update_lock held.
>
Done.
[...]
>
> Code looks overall pretty clean. Great job!
>
Thanks!
Guenter
next prev parent reply other threads:[~2010-09-15 14:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 13:25 [PATCH v2 0/7] hwmon: Add support for MAX6695/6696 to lm90 driver Guenter Roeck
2010-09-09 13:25 ` [PATCH v2 1/7] hwmon: Add tempX_emergency_alarm attribute to sysfs ABI Guenter Roeck
2010-09-13 16:17 ` Jean Delvare
2010-09-13 16:54 ` Guenter Roeck
2010-09-09 13:25 ` [PATCH v2 2/7] hwmon: (lm90) Introduce device feature bits Guenter Roeck
2010-09-13 19:30 ` Jean Delvare
2010-09-13 20:32 ` Guenter Roeck
2010-09-09 13:25 ` [PATCH v2 3/7] hwmon: (lm90) Introduce function to delete sysfs files Guenter Roeck
2010-09-13 19:48 ` Jean Delvare
2010-09-09 13:25 ` [PATCH v2 4/7] hwmon: (lm90) Simplify set_temp11 register calculations Guenter Roeck
2010-09-14 9:18 ` Jean Delvare
2010-09-09 13:25 ` [PATCH v2 5/7] hwmon: (lm90) Introduce 3rd set of upper temperature limits Guenter Roeck
2010-09-14 10:51 ` Jean Delvare
2010-09-14 11:46 ` Guenter Roeck
2010-09-14 11:46 ` [lm-sensors] " Jean Delvare
2010-09-14 12:38 ` Guenter Roeck
2010-09-09 13:25 ` [PATCH v2 6/7] hwmon: (lm90) Add support for additional features of max6659 Guenter Roeck
2010-09-14 11:52 ` Jean Delvare
2010-09-14 16:08 ` Guenter Roeck
2010-09-09 13:25 ` [PATCH v2 7/7] hwmon: (lm90) Add support for max6695 and max6696 Guenter Roeck
2010-09-15 11:20 ` Jean Delvare
2010-09-15 14:29 ` Guenter Roeck [this message]
2010-09-15 14:34 ` 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=20100915142927.GB9707@ericsson.com \
--to=guenter.roeck@ericsson.com \
--cc=akpm@linux-foundation.org \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
/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