From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C506EC43381 for ; Sun, 24 Feb 2019 20:29:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B72C20663 for ; Sun, 24 Feb 2019 20:29:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="xISito80" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727971AbfBXU36 (ORCPT ); Sun, 24 Feb 2019 15:29:58 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:37003 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbfBXU36 (ORCPT ); Sun, 24 Feb 2019 15:29:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=a43to0bv/pPZWHQwxPjXhJV9bPoIzDM0R6vq7Y9uV/s=; b=xISito80sNaQbYVq7Xpgoafwu7 BFvNgL3RSETQZP4hWGIGf/gpowy6V0XzHPvp8HCYMDGgKJKY0groGLOMO7YcBuFx0D/I8QkPE1akS pDKTGDw61s1LbUrJUA9FnKRHTHn8azTlZMrJc2iaxYwcIqvNyHcf1WmwbH2jWpFA+JPU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1gy0PJ-0005fD-0G; Sun, 24 Feb 2019 21:29:53 +0100 Date: Sun, 24 Feb 2019 21:29:52 +0100 From: Andrew Lunn To: Heiner Kallweit Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" Subject: Re: [PATCH net-next 2/2] net: phy: aquantia: add hwmon support Message-ID: <20190224202952.GA20855@lunn.ch> References: <0a05279a-ab9e-a978-df4d-f09869c3bba2@gmail.com> <590d1e26-999e-3b09-fcd9-6d570cadb3bf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <590d1e26-999e-3b09-fcd9-6d570cadb3bf@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > 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 > + * Author: Andrew Lunn > + * Author: Heiner Kallweit > + */ > + > +#include > +#include > +#include > +#include > + > +#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