netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: phy: aquantia: add hwmon support
Date: Sun, 24 Feb 2019 21:29:52 +0100	[thread overview]
Message-ID: <20190224202952.GA20855@lunn.ch> (raw)
In-Reply-To: <590d1e26-999e-3b09-fcd9-6d570cadb3bf@gmail.com>

> diff --git a/drivers/net/phy/aquantia_hwmon.c b/drivers/net/phy/aquantia_hwmon.c
> new file mode 100644
> index 000000000..c0dd695f6
> --- /dev/null
> +++ b/drivers/net/phy/aquantia_hwmon.c
> @@ -0,0 +1,263 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* HWMON driver for Aquantia PHY
> + *
> + * Author: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> + * Author: Andrew Lunn <andrew@lunn.ch>
> + * Author: Heiner Kallweit <hkallweit1@gmail.com>
> + */
> +
> +#include <linux/phy.h>
> +#include <linux/device.h>
> +#include <linux/ctype.h>
> +#include <linux/hwmon.h>
> +
> +#include "aquantia_hwmon.h"
> +
> +/* Vendor specific 1, MDIO_MMD_VEND1 */
> +#define VEND1_THERMAL_PROV_HIGH_TEMP_FAIL	0xc421
> +#define VEND1_THERMAL_PROV_LOW_TEMP_FAIL	0xc422
> +#define VEND1_THERMAL_PROV_HIGH_TEMP_WARN	0xc423
> +#define VEND1_THERMAL_PROV_LOW_TEMP_WARN	0xc424
> +#define VEND1_THERMAL_STAT1			0xc820
> +#define VEND1_THERMAL_STAT2			0xc821
> +#define VEND1_THERMAL_STAT2_VALID		BIT(0)
> +#define VEND1_GENERAL_STAT1			0xc830
> +#define VEND1_GENERAL_STAT1_HIGH_TEMP_FAIL	BIT(14)
> +#define VEND1_GENERAL_STAT1_LOW_TEMP_FAIL	BIT(13)
> +#define VEND1_GENERAL_STAT1_HIGH_TEMP_WARN	BIT(12)
> +#define VEND1_GENERAL_STAT1_LOW_TEMP_WARN	BIT(11)
> +
> +struct aqr_priv {
> +	struct device *hwmon_dev;
> +	char *hwmon_name;
> +};

Hi Heiner

It seems a bit odd having the driver private structure here. I expect
with time we are going to need other things in it which are not
HWMON. e.g many of the statistics counters are clear on read. So we
need to keep the running totals somewhere.

I would keep the probe code and the allocation of this structure in
the main driver file.

    Andrew

  reply	other threads:[~2019-02-24 20:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 20:06 [PATCH net-next 0/2] net: phy: aquantia: add hwmon support Heiner Kallweit
2019-02-24 20:07 ` [PATCH net-next 1/2] net: phy: aquantia: rename aquantia.c to aquantia_main.c Heiner Kallweit
2019-02-24 20:09 ` [PATCH net-next 2/2] net: phy: aquantia: add hwmon support Heiner Kallweit
2019-02-24 20:29   ` Andrew Lunn [this message]
2019-02-24 21:14     ` Heiner Kallweit
2019-02-24 21:46       ` Andrew Lunn

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=20190224202952.GA20855@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=netdev@vger.kernel.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).