From: "Darrick J. Wong" <djwong@us.ibm.com>
To: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org,
haveblue@us.ibm.com
Subject: Re: [PATCH] v3 of IBM power meter driver
Date: Tue, 11 Sep 2007 18:11:38 -0700 [thread overview]
Message-ID: <20070912011137.GF30825@tree.beaverton.ibm.com> (raw)
In-Reply-To: <20070911132335.GJ31992@jupiter.solarsys.private>
[-- Attachment #1: Type: text/plain, Size: 3296 bytes --]
On Tue, Sep 11, 2007 at 09:23:35AM -0400, Mark M. Hoffman wrote:
> I am not an IPMI expert, so I would appreciate getting an Acked-by from
> someone who knows more about that subsystem.
>
> Anyway, some comments are below. This is nowhere near a complete review yet.
Thank you for the review! Comments interspersed below, though for
brevity the one-liners have been fixed.
> > +config SENSORS_IBMPEX
> > + tristate "IBM PowerExecutive temperature/power sensors"
> > + depends on IPMI_SI
>
> Open question: can we use "select" here? As written, it took some hunting to
> even get this driver to show up as an option in menuconfig.
Changed, since it seems reasonable that someone looking for PEx support
might not necessarily know that it is based upon IPMI.
> > +struct ibmpex_bmc_data {
> > + struct list_head list;
> > + struct class_device *class_dev;
>
> My current stack of patches includes one which requires that this be changed
> to 'struct device *hwmon_dev', as 'struct class_device' is going away soon.
> You may rebase on my testing tree[1], or else I will just follow up with a
> patch to fix this up after I eventually merge yours.
>
> [1] http://lm-sensors.org/kernel?p=kernel/mhoffman/hwmon-2.6.git;a=shortlog;h=testing
Done.
> > +static ssize_t ibmpex_show_sensor(struct device *dev,
> > + struct device_attribute *devattr,
> > + char *buf)
> > +{
> > + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
> > + int iface = PEX_INTERFACE(attr->index);
> > + int sensor = PEX_SENSOR(attr->index);
> > + int func = PEX_FUNC(attr->index);
> > + struct ibmpex_bmc_data *data = get_bmc_data(iface);
>
> ... especially given how many times you're going to call it. Is there any
> reason you can't use the driver_data field of struct device *dev for that?
I can (and did) update the code to use dev_get/set_drvdata for the
accessors. However, the "iface" field exists as a mechanism to map
interface numbers to struct ibmpex_bmc_data/struct device data because
the callback that IPMI uses to notify clients that BMCs are going away
only passes the interface number, not the struct device itself.
Unfortunately, this means that get_bmc_data() must remain, but now it is
only used once at the end of life.
> E.g. i2c based hwmon drivers do this at some point during the probe:
>
> i2c_set_clientdata(new_client, data);
>
> (which becomes)
>
> dev_set_drvdata(&new_client->dev, data);
>
> If you could do that, then you no longer need 'iface' at all in the function
> above... *that* may allow you to use the SENSOR_ATTR_2 mechanism from
> hwmon-sysfs.h - much easier to read than the manual number packing for 'sensor'
> and 'func'.
Doesn't look too hard; I'll have a go at it and see how it does.
> > + err = ibmpex_query_sensor_count(data);
> > + if (err < 0)
> > + return -ENOENT;
> > + data->num_sensors = err;
> > +
>
> Did you mean 'if (err <= 0)' ?
Yes.
> > + /* Create attributes */
> > + for (j = 0; j < PEX_NUM_SENSOR_FUNCS; j++)
> > + if (create_sensor(data, sensor_type, sensor_counter,
> > + i, j))
>
> Why not 'err = create_sensor(...)' and propagate the actual error here?
Rough draft syndrome? 'tis fixed. :)
--D
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-09-12 1:11 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-27 21:14 [PATCH] v1 " Darrick J. Wong
2007-08-28 1:50 ` Henrique de Moraes Holschuh
2007-08-28 11:19 ` [lm-sensors] " Jean Delvare
2007-08-28 16:28 ` Darrick J. Wong
2007-08-29 9:49 ` Jean Delvare
2007-08-29 12:45 ` Frank Phillips
2007-08-28 16:44 ` [PATCH] hwmon: Add power meters to Documentation/hwmon/sysfs-interface Darrick J. Wong
2007-08-29 9:10 ` Jean Delvare
2007-08-29 14:50 ` Darrick J. Wong
2007-08-30 9:57 ` Jean Delvare
2007-09-11 16:43 ` Darrick J. Wong
2007-09-01 17:10 ` Pavel Machek
2007-09-01 18:05 ` Shem Multinymous
2007-09-01 19:44 ` [lm-sensors] " Henrique de Moraes Holschuh
2007-09-02 19:38 ` Jean Delvare
2007-09-03 2:02 ` Henrique de Moraes Holschuh
2007-09-03 16:06 ` Jean Delvare
2007-09-03 23:22 ` Henrique de Moraes Holschuh
2007-09-06 9:34 ` Jean Delvare
2007-09-06 16:29 ` Henrique de Moraes Holschuh
2007-08-28 16:49 ` [PATCH] v2 of IBM power meter driver Darrick J. Wong
2007-08-28 23:25 ` [PATCH] v3 " Darrick J. Wong
2007-09-11 13:23 ` Mark M. Hoffman
2007-09-11 13:59 ` Jean Delvare
2007-09-12 1:11 ` Darrick J. Wong [this message]
2007-09-14 19:29 ` [PATCH v2] hwmon: Update Documentation/hwmon/sysfs-interface Darrick J. Wong
2007-09-17 17:28 ` Jean Delvare
2007-09-17 18:43 ` Darrick J. Wong
2007-09-21 8:43 ` Jean Delvare
2007-09-14 19:33 ` [PATCH v4] IBM power meter driver Darrick J. Wong
2007-10-09 12:00 ` Mark M. Hoffman
2007-10-09 16:44 ` Roel Kluin
2007-10-09 20:40 ` Darrick J. Wong
2007-10-09 22:08 ` [PATCH] ibmpex: Release IPMI user if hwmon registration fails Darrick J. Wong
2007-10-11 11:45 ` Mark M. Hoffman
2007-10-13 0:29 ` [PATCH v4] IBM power meter driver Darrick J. Wong
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=20070912011137.GF30825@tree.beaverton.ibm.com \
--to=djwong@us.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=hmh@hmh.eng.br \
--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
Powered by JetHome