devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jeffery <andrew-zrmu5oMJ5Fs@public.gmane.org>
To: Joel Stanley <joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>,
	eajames
	<eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-hwmon-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jdelvare-IBi9RG/b67k@public.gmane.org,
	corbet-T1hC0tSOHrs@public.gmane.org,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Benjamin Herrenschmidt
	<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
	"Edward A. James"
	<eajames-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH linux v7 4/6] hwmon: occ: Add callbacks for parsing P8 OCC datastructures
Date: Mon, 13 Feb 2017 11:47:22 +1030	[thread overview]
Message-ID: <1486948642.3661.3.camel@aj.id.au> (raw)
In-Reply-To: <CACPK8Xf+YFuGydAMxcqD3eTYkgfgHtg743kkd-J_EshnYZ1J=Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4389 bytes --]

On Fri, 2017-02-10 at 16:01 +1030, Joel Stanley wrote:
> > On Wed, Feb 8, 2017 at 9:40 AM,  <eajames@linux.vnet.ibm.com> wrote:
> > > > From: "Edward A. James" <eajames@us.ibm.com>
> > 
> > Add functions to parse the data structures that are specific to the OCC on
> > the POWER8 processor. These are the sensor data structures, including
> > temperature, frequency, power, and "caps."
> > 
> > > > Signed-off-by: Edward A. James <eajames@us.ibm.com>
> > > > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > ---
> >  Documentation/hwmon/occ    |   9 ++
> >  drivers/hwmon/occ/occ_p8.c | 248 +++++++++++++++++++++++++++++++++++++++++++++
> >  drivers/hwmon/occ/occ_p8.h |  30 ++++++
> >  3 files changed, 287 insertions(+)
> >  create mode 100644 drivers/hwmon/occ/occ_p8.c
> >  create mode 100644 drivers/hwmon/occ/occ_p8.h
> > 
> > diff --git a/drivers/hwmon/occ/occ_p8.c b/drivers/hwmon/occ/occ_p8.c
> > new file mode 100644
> > index 0000000..5c61fc4
> > --- /dev/null
> > +++ b/drivers/hwmon/occ/occ_p8.c
> > +void p8_parse_sensor(u8 *data, void *sensor, int sensor_type, int off,
> > +                    int snum)
> > +{
> > +       switch (sensor_type) {
> > +       case FREQ:
> > +       case TEMP:
> > +       {
> > +               struct p8_occ_sensor *os =
> > +                       &(((struct p8_occ_sensor *)sensor)[snum]);
> > +
> > +               os->sensor_id = be16_to_cpu(get_unaligned((u16 *)&data[off]));
> > +               os->value = be16_to_cpu(get_unaligned((u16 *)&data[off + 2]));
> > +       }
> > +               break;
> > +       case POWER:
> > +       {
> > +               struct p8_power_sensor *ps =
> > +                       &(((struct p8_power_sensor *)sensor)[snum]);
> > +
> > +               ps->sensor_id = be16_to_cpu(get_unaligned((u16 *)&data[off]));
> > +               ps->update_tag =
> > +                       be32_to_cpu(get_unaligned((u32 *)&data[off + 2]));
> 
> This might be more readable if you wrote a
> cast_get_unaliged_be32_to_cpu() macro.
> 
> > +               ps->accumulator =
> > +                       be32_to_cpu(get_unaligned((u32 *)&data[off + 6]));
> > +               ps->value = be16_to_cpu(get_unaligned((u16 *)&data[off + 10]));
> > +       }
> > +               break;
> > +       case CAPS:
> > +       {
> > +const u32 *p8_get_sensor_hwmon_configs()
> > +{
> > +       return p8_sensor_hwmon_configs;
> > +}
> > +EXPORT_SYMBOL(p8_get_sensor_hwmon_configs);
> > +
> > +struct occ *p8_occ_start(struct device *dev, void *bus,
> > +                        struct occ_bus_ops *bus_ops)
> > +{
> > +       return occ_start(dev, bus, bus_ops, &p8_ops, &p8_config);
> > +}
> > +EXPORT_SYMBOL(p8_occ_start);
> 
> We don't need to export these symbols; they're not used outside of the
> OCC module. The same goes for all of the exports you've made in this
> series.

Sorry, this was my doing in an attempt to get everything to build as
modules rather than just built-in. I should have studied
Documentation/kbuild/modules.txt a bit more.

> 
> I suggest we re-architect the drivers so we build all of the objects
> and link them into one module for each platform, instead of having an
> occ module and occ-p8/occ-p9 modules and i2c modules that all depend
> on each other. The Makefile could look like this:
> 
> obj-$(CONFIG_SENSORS_PPC_OCC_P8_I2C) += hwmon_occ_p8.o
> obj-$(CONFIG_SENSORS_PPC_OCC_P9) += hwmon_occ_p9.o
> 
> hwmon_occ_p8-$(CONFIG_SENSORS_PPC_OCC_P8_I2C) += occ_scom_i2c.o
> occ_p8.o p8_occ_i2c.o occ_sysfs.o occ.o
> hwmon_occ_p9-$(CONFIG_SENSORS_PPC_OCC_P9) += occ_p9.o occ_sysfs.o occ.o
> 
> And the Kbuild like this:
> 
> menuconfig SENSORS_PPC_OCC
>         bool "PPC On-Chip Controller"
> 
> if SENSORS_PPC_OCC
> 
> config SENSORS_PPC_OCC_P8_I2C
>         bool "POWER8 OCC hwmon support"
>         depends on I2C
> 
> config SENSORS_PPC_OCC_P9
>         bool "POWER9 OCC hwmon support"
> 
> endif

Given we can drop the exports that's a much more sensible idea.

Andrew

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2017-02-13  1:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 23:10 [PATCH linux v7 0/6] drivers: hwmon: Add On-Chip Controller driver eajames
2017-02-07 23:10 ` [PATCH linux v7 1/6] hwmon: Add core On-Chip Controller support for POWER CPUs eajames
2017-02-10  5:31   ` Joel Stanley
2017-02-10 21:02     ` Eddie James
2017-02-14 15:36     ` Eddie James
2017-02-07 23:10 ` [PATCH linux v7 2/6] hwmon: occ: Add sysfs interface eajames
2017-02-10  5:31   ` Joel Stanley
     [not found] ` <1486509056-25838-1-git-send-email-eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-02-07 23:10   ` [PATCH linux v7 3/6] hwmon: occ: Add I2C transport implementation for SCOM operations eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
2017-02-10  5:31     ` Joel Stanley
2017-02-10 21:05       ` Eddie James
2017-02-13  1:12         ` Andrew Jeffery
2017-02-07 23:10 ` [PATCH linux v7 4/6] hwmon: occ: Add callbacks for parsing P8 OCC datastructures eajames
2017-02-10  5:31   ` Joel Stanley
2017-02-13  1:17     ` Andrew Jeffery [this message]
2017-02-13 17:01       ` Guenter Roeck
2017-02-07 23:10 ` [PATCH linux v7 5/6] hwmon: occ: Add hwmon implementation for the P8 OCC eajames
2017-02-10  5:31   ` Joel Stanley
2017-02-07 23:10 ` [PATCH linux v7 6/6] hwmon: occ: Add callbacks for parsing P9 OCC datastructures eajames
2017-02-10  5:31   ` Joel Stanley
     [not found]     ` <CACPK8XeX12cQgJ2HqHFqvZmFh7TNWMJq3ysaOOmnh-kp02D+YA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-13  1:29       ` Andrew Jeffery

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=1486948642.3661.3.camel@aj.id.au \
    --to=andrew-zrmu5omj5fs@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=corbet-T1hC0tSOHrs@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=eajames-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=jdelvare-IBi9RG/b67k@public.gmane.org \
    --cc=joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org \
    --cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-hwmon-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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;
as well as URLs for NNTP newsgroup(s).