Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp756633pxk; Wed, 9 Sep 2020 19:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeQ6u24KDV4yyCoX6Wsv+MM2EnMHCLun5eTLwEDj+mfuAbnhyKktC1vPh8Zb/X8kxN2UR3 X-Received: by 2002:a17:906:3785:: with SMTP id n5mr6988496ejc.218.1599704183404; Wed, 09 Sep 2020 19:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599704183; cv=none; d=google.com; s=arc-20160816; b=DGUxxYj0/gNCXf//yAWUijRufjfPI9Vxb+FIxJ5t+Diwcu3LTe+S2OgsFdzQm5ew+o UdJ2+3lZyuAAnFSpClA6StStc4j6tg+aSyv/arLHytTmKQtd35kcUrlV+Zq6BJ9fAC7m o8iN1kRgkPzWxA+E1ZAEsEGjpsK5x6NYfYU8WEL7hrucD1p46CzyLsXzDNzpMWmiWjI+ anUXMOaI876XlRQfEAMXi7pDy0T8Gu2PqJALEDPuhe0EfmqEpDGI4kASyPDGMpT0xL5z LNfAr6PBkKHxs3SySHlMRP+kmCWfxSFg2U0paSndT5DDoKAR70ORgfZxSsrIgydPs254 +wqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:cc:to:from:date:references :in-reply-to:message-id:mime-version:user-agent:dkim-signature :dkim-signature; bh=HckUuM4up1+hrv2p57Agpc2r033Xop1H6JnAlq3zBCU=; b=mIkCmHPSHiA4xMJm9t96mvibLVwpwLaZ9cX8QTvqNO/FkMpV+P3OvFv+pubk56KFai rMoOpXnXz6OBsb/8BpkPLEkmx4Ci4+dcDwkM4qobbIptiAWvKNhaqGSHki9GyHLkBM59 V2+wAEI0up/Ja5s5gRIShl7AYRsccXTr/uyXjp51P3vPHu3fqHS2zbze+hvM+8Nd9giu XYZVYh5VOejOy2IjK8upwHC2HdG7HtbegKWKtOg+M5OavJpN6bxtkmDUSvcdLSGHMjKS WUvGSNGvn8190nyE4zf380ToE0gOtHC9or55Fqh/uSNJhTPpCeeNSmSE4kXwK8BtGNll KFnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm3 header.b=Scp8KEq5; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=C8wmE0Ze; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si2543873ejd.473.2020.09.09.19.16.00; Wed, 09 Sep 2020 19:16:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm3 header.b=Scp8KEq5; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=C8wmE0Ze; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbgIJCPQ (ORCPT + 99 others); Wed, 9 Sep 2020 22:15:16 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:39691 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730469AbgIJCNA (ORCPT ); Wed, 9 Sep 2020 22:13:00 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A4DA95C00C9; Wed, 9 Sep 2020 22:12:56 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Wed, 09 Sep 2020 22:12:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm3; bh=HckUuM4up1+hrv2p57Agpc2r033Xop1 H6JnAlq3zBCU=; b=Scp8KEq5+XaNWIzu37zalER5/GfPwnWsWzBFti5s9JUxI10 hQrJCy49sDfEp27lbGO8wcpv7CxmWoBaU9Oy/PCEoi0yUNu0eIURk68sLMLGUzoi 9N/d5zk3MfRO5hiTpjGPiuSO82b6NX9e2i8C5wdXgDM/8bBAYVLmgd6hruERI2OD oCywMdn8R2ZPq6BFgikOMGrcDRieyA60pxZKIf2827kvJGbsSnzwcpSNNAlsKFC0 /ux0Etc/WqKm/z4GysjIE4ChctSDGX7wxab3z78Kw5pu37Ocs2w7I7mTJRBJU5r4 MnDix4ecAnCQWRGjB3MrpHU6jGYfJrSTiPEnY8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=HckUuM 4up1+hrv2p57Agpc2r033Xop1H6JnAlq3zBCU=; b=C8wmE0Zea0bG/Bt8GaSfDu Rlwzj6x3tzrTmjKnzI+cbLG/EakziIC7s7Fyy9EWd306zcoqjpoZD9IGy8neGh3i r9kRgLkxNAKR86bkhXM9gvprLuxlPNmEzZP0yE4BPGrDr+tNgQRuBE9lt6Xy7p5J aUPII/xl6EQb8gHSGJJuMADQXN8xg5bSLwWaRG/VOAVeOVP4vB55TQLXE7siLthd UlJljhN8OnrMgZVJKP0ZkQDXiC/akXOyhcBW+omKTcf8lX9eKlI3g0JLqcpjMeYh fUOTZ5uOJQLDnnWr2YKC39XHf5pP7nhE8h3m6ePBFURwLlGfyqcXN4fryuwmzimg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudehiedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgu rhgvficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecuggftrf grthhtvghrnhephefhfeekgfekudevheffheeihedujeefjeevjeefudfgfeeutdeuvdeh hfevueffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvgifsegrjhdrihgurdgruh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id AF09DE00A6; Wed, 9 Sep 2020 22:12:55 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-259-g88fbbfa-fm-20200903.003-g88fbbfa3 Mime-Version: 1.0 Message-Id: <9eea0291-f225-466a-ba01-df3210bd8ead@www.fastmail.com> In-Reply-To: <4f2de881-1391-b1b1-18b3-8d3a06653da9@roeck-us.net> References: <20200909132411.2906159-1-andrew@aj.id.au> <4f2de881-1391-b1b1-18b3-8d3a06653da9@roeck-us.net> Date: Thu, 10 Sep 2020 11:42:34 +0930 From: "Andrew Jeffery" To: "Guenter Roeck" , linux-hwmon@vger.kernel.org Cc: "Jean Delvare" , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 Sep 2020, at 01:01, Guenter Roeck wrote: > On 9/9/20 6:24 AM, Andrew Jeffery wrote: > > Enable runtime debug control of whether the PEC byte is exchanged with > > the PMBus device. > > > > Some manufacturers have asked for the PEC to be disabled as part of > > debugging driver communication issues with devices. > > > > Signed-off-by: Andrew Jeffery > > --- > > drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++ > > 1 file changed, 39 insertions(+) > > > > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c > > index 44535add3a4a..51c8502b35e9 100644 > > --- a/drivers/hwmon/pmbus/pmbus_core.c > > +++ b/drivers/hwmon/pmbus/pmbus_core.c > > @@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val) > > DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status, > > NULL, "0x%04llx\n"); > > > > +static int pmbus_debugfs_get_pec(void *data, u64 *val) > > +{ > > + struct i2c_client *client = data; > > + > > + *val = !!(client->flags & I2C_CLIENT_PEC); > > + > > + return 0; > > +} > > + > > +static int pmbus_debugfs_set_pec(void *data, u64 val) > > +{ > > + int rc; > > + struct i2c_client *client = data; > > + > > + if (!val) { > > + client->flags &= ~I2C_CLIENT_PEC; > > + return 0; > > + } > > + > > + if (val != 1) > > + return -EINVAL; > > + > > + rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY); > > + if (rc < 0) > > + return rc; > > + > > + if (!(rc & PB_CAPABILITY_ERROR_CHECK)) > > + return -ENOTSUPP; > > WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP > > > + > > + client->flags |= I2C_CLIENT_PEC; > > + > > + return 0; > > +} > > +DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec, > > + pmbus_debugfs_set_pec, "0x%1llu\n"); > > ERROR: Prefixing 0x with decimal output is defective > > (since the displayed value is a boolean, it is also quite useless). Indeed. I overlooked running checkpatch, sorry for the noise. I've sent v2 which checkpatch claims to be clean. Andrew