Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1350916imm; Tue, 2 Oct 2018 06:57:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV60F8u6NQwUDNvWD/gp4uey8sXD89E7VJTokZ7h8gCPQnFnxPOxtkNikBVi8k+ojBIe58gYS X-Received: by 2002:a17:902:bd06:: with SMTP id p6-v6mr16743700pls.226.1538488667815; Tue, 02 Oct 2018 06:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488667; cv=none; d=google.com; s=arc-20160816; b=lISls0zSHZWUEPpR3jU/dRTvcze6KFJGpXZd7nN18Mwakrv1F2NMuJmbgQxRzQlkUy OzyCfRGRZcvB4el8CW8qyJNT563Q7SS2IE3400jenU27OAY5fGvh7qe5dA+lK1DFUbEU QQEgXqQumpxnUv3+rFB7CljRebzAdv43goPVkMqsdozyBlzg3wW52pXJxAUdYIBnJdKI klhfxF37R2yqaj9N/theXTTUfZ3l4sQdgSYAFKwbLiikSc3EGwq6RTUEiEzah8UdTMah +RQZ7nKjEcgU5lrV8cdlJcJiWbx2ZPtoIs9nrQE/tLIZvzzTrrm1uIGHsbVHSu8P/kVo ldtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=klG8yDzMco6Nz6p1zQfX/Qe8t+UB3K1tPBdw9SiiA8E=; b=jzlFS78ecAykEuWR1yMyFQg2DttFyqsqqn6giQbgknYxnz/b8vwNZcWwGGgqEKbwD1 eDlfUlBBuTc5SNNqg5boZ2uF5q2ip1hRvrDhep7tt5ISZtEn6i1e0mYbfn5KFORe1Esz u6G+P0eTOZnLxhbBjvGNouSo8lLeq5BZPV+JZpTdaltJrUslOGLO+qpa78A6mlecs6+k VxBP8fnYOOYmnnpAT1cFmdBM+8hFmUcmqWraQCs8FS3AzMNigfZ59hKyBWoB1bEMmZ3a MYTfFCKfWqZnoj55M/yUoaqokj//v7AxemNv7J4ybUy76+72EbnenXysu2DzF5n+wiko TmuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13-v6si11925346ply.279.2018.10.02.06.57.33; Tue, 02 Oct 2018 06:57:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731012AbeJBUOu (ORCPT + 99 others); Tue, 2 Oct 2018 16:14:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34128 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730036AbeJBUOu (ORCPT ); Tue, 2 Oct 2018 16:14:50 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3495EC3F; Tue, 2 Oct 2018 13:31:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lothar Felten , Guenter Roeck , Sasha Levin Subject: [PATCH 4.18 211/228] hwmon: (ina2xx) fix sysfs shunt resistor read access Date: Tue, 2 Oct 2018 06:25:08 -0700 Message-Id: <20181002132511.971050411@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132459.032960735@linuxfoundation.org> References: <20181002132459.032960735@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lothar Felten [ Upstream commit 3ad867001c91657c46dcf6656d52eb6080286fd5 ] fix the sysfs shunt resistor read access: return the shunt resistor value, not the calibration register contents. update email address Signed-off-by: Lothar Felten Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- Documentation/hwmon/ina2xx | 2 +- drivers/hwmon/ina2xx.c | 13 +++++++++++-- include/linux/platform_data/ina2xx.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) --- a/Documentation/hwmon/ina2xx +++ b/Documentation/hwmon/ina2xx @@ -32,7 +32,7 @@ Supported chips: Datasheet: Publicly available at the Texas Instruments website http://www.ti.com/ -Author: Lothar Felten +Author: Lothar Felten Description ----------- --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -17,7 +17,7 @@ * Bi-directional Current/Power Monitor with I2C Interface * Datasheet: http://www.ti.com/product/ina230 * - * Copyright (C) 2012 Lothar Felten + * Copyright (C) 2012 Lothar Felten * Thanks to Jan Volkering * * This program is free software; you can redistribute it and/or modify @@ -329,6 +329,15 @@ static int ina2xx_set_shunt(struct ina2x return 0; } +static ssize_t ina2xx_show_shunt(struct device *dev, + struct device_attribute *da, + char *buf) +{ + struct ina2xx_data *data = dev_get_drvdata(dev); + + return snprintf(buf, PAGE_SIZE, "%li\n", data->rshunt); +} + static ssize_t ina2xx_store_shunt(struct device *dev, struct device_attribute *da, const char *buf, size_t count) @@ -403,7 +412,7 @@ static SENSOR_DEVICE_ATTR(power1_input, /* shunt resistance */ static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR, - ina2xx_show_value, ina2xx_store_shunt, + ina2xx_show_shunt, ina2xx_store_shunt, INA2XX_CALIBRATION); /* update interval (ina226 only) */ --- a/include/linux/platform_data/ina2xx.h +++ b/include/linux/platform_data/ina2xx.h @@ -1,7 +1,7 @@ /* * Driver for Texas Instruments INA219, INA226 power monitor chips * - * Copyright (C) 2012 Lothar Felten + * Copyright (C) 2012 Lothar Felten * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as