All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: eajames <eajames@linux.vnet.ibm.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
	jdelvare@suse.com, corbet@lwn.net,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	Wolfram Sang <wsa@the-dreams.de>,
	Andrew Jeffery <andrew@aj.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	"Edward A. James" <eajames@us.ibm.com>
Subject: Re: [PATCH linux v7 6/6] hwmon: occ: Add callbacks for parsing P9 OCC datastructures
Date: Fri, 10 Feb 2017 16:01:58 +1030	[thread overview]
Message-ID: <CACPK8XeX12cQgJ2HqHFqvZmFh7TNWMJq3ysaOOmnh-kp02D+YA@mail.gmail.com> (raw)
In-Reply-To: <1486509056-25838-7-git-send-email-eajames@linux.vnet.ibm.com>

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 POWER9 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    |   3 +
>  drivers/hwmon/occ/occ_p9.c | 309 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/hwmon/occ/occ_p9.h |  30 +++++
>  3 files changed, 342 insertions(+)
>  create mode 100644 drivers/hwmon/occ/occ_p9.c
>  create mode 100644 drivers/hwmon/occ/occ_p9.h

> diff --git a/drivers/hwmon/occ/occ_p9.c b/drivers/hwmon/occ/occ_p9.c
> new file mode 100644
> index 0000000..9c1283c
> --- /dev/null
> +++ b/drivers/hwmon/occ/occ_p9.c
> @@ -0,0 +1,309 @@
> +/*
> + * occ_p9.c - OCC hwmon driver
> + *
> + * This file contains the Power9-specific methods and data structures for
> + * the OCC hwmon driver.
> + *
> + * Copyright 2016 IBM Corp.

It's 2017.

> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.

We generally just include the first paragraph. Same goes for all of the files.

> +
> +static const u32 p9_sensor_hwmon_configs[MAX_OCC_SENSOR_TYPE] = {
> +       HWMON_I_INPUT | HWMON_I_LABEL,  /* freq: value | label */
> +       /* temp: value | label | fru_type */
> +       HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_TYPE,
> +       /* power: value | label | accum[0] | accum[1] | update_tag |
> +        *       (function_id | (apss_channel << 8))
> +        */
> +       HWMON_P_INPUT | HWMON_P_LABEL | HWMON_P_AVERAGE_MIN |
> +               HWMON_P_AVERAGE_MAX | HWMON_P_AVERAGE_INTERVAL |
> +               HWMON_P_RESET_HISTORY,
> +       /* caps: curr | max | min | norm | user | source */
> +       HWMON_P_CAP | HWMON_P_CAP_MAX | HWMON_P_CAP_MIN | HWMON_P_MAX |
> +               HWMON_P_ALARM | HWMON_P_CAP_ALARM,

I find this really hard to read. Perhaps something like this:


#define FREQ_CONFIG        (HWMON_I_INPUT | HWMON_I_LABEL)
#deifne TEMP_CONFIG        (HWMON_T_INPUT | HWMON_T_LABEL | HWMON_T_TYPE)
#define POWER_CONFIG    ( HWMON_P_INPUT | HWMON_P_LABEL |
HWMON_P_AVERAGE_MIN | \
                                                 HWMON_P_AVERAGE_MAX |
HWMON_P_AVERAGE_INTERVAL | \
                                                 HWMON_P_RESET_HISTORY)

etc. Do the same in the p8 driver.


> diff --git a/drivers/hwmon/occ/occ_p9.h b/drivers/hwmon/occ/occ_p9.h
> new file mode 100644
> index 0000000..18ca16a
> --- /dev/null
> +++ b/drivers/hwmon/occ/occ_p9.h

> +
> +#ifndef __OCC_P9_H__
> +#define __OCC_P9_H__
> +
> +#include "scom.h"
> +
> +struct device;

Include the header for struct device instead.

Did you consider the one header file for all of your shared functions?
I don't think there's much value in having a whole heap of small ones.

> +
> +const u32 *p9_get_sensor_hwmon_configs(void);
> +struct occ *p9_occ_start(struct device *dev, void *bus,
> +                        struct occ_bus_ops *bus_ops);
> +
> +#endif /* __OCC_P9_H__ */
> --
> 1.8.3.1
>

  reply	other threads:[~2017-02-10  5:31 UTC|newest]

Thread overview: 23+ 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
2017-02-07 23:10 ` [PATCH linux v7 3/6] hwmon: occ: Add I2C transport implementation for SCOM operations eajames
2017-02-07 23:10   ` 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
2017-02-13  1:17       ` Andrew Jeffery
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 [this message]
2017-02-13  1:29     ` Andrew Jeffery
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=CACPK8XeX12cQgJ2HqHFqvZmFh7TNWMJq3ysaOOmnh-kp02D+YA@mail.gmail.com \
    --to=joel@jms.id.au \
    --cc=andrew@aj.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=eajames@linux.vnet.ibm.com \
    --cc=eajames@us.ibm.com \
    --cc=jdelvare@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=wsa@the-dreams.de \
    /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.