Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1340725imm; Tue, 2 Oct 2018 06:47:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Hu9UcnLOna3ugMAqKfdkLkOCtAJqfr3Ijt7aaeN081XH46dZdVcScpQzK0xtiogFcY/cU X-Received: by 2002:a63:7744:: with SMTP id s65-v6mr14644823pgc.197.1538488079515; Tue, 02 Oct 2018 06:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488079; cv=none; d=google.com; s=arc-20160816; b=Odn5Rx60reybGJHbaJWhMs0H4hIqaXrgu+IFHU1jViJr2pe8xVMq76F5y/wunmTCLZ 5KUovBjmNmlPOoKKQoHnfZS+4WbUc/CvDsVpV/dh3Mlv++cpv/vj4NZZjPUhupmpbwZI NzGayoKrgW7TQR85P9M3/j7BjAv2MDzAxiPxG5qw2CM2ayJ8oGq3rg4QtN85lJVicnBE 4CpybDPYQzSWqsT2KZYXXvR3C4TBRvFM7BmrG+3D3ZnTS5ohW7nibK7AMliAE9R1TxjF Zk4TTxrH/EmmyZp7KeJKir+FVp63FlonDQ1luH81yQ5ThcyEQKTdg8M3T6nNDjus9VUs n1KQ== 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=BDSV7y8YqhRIwd9RkS56GeIVD8QjANaM1/66xE3bOlg=; b=tF037wcNvlTVI4QpcC7Ipojgxy+d8yEmKrtwdAag5lQ18abxGTaRO2m6M/ZHNTn5u0 WTIz4F5ZLT5NZBg99B0e/dzv4OWl1YHrR7ZMthxT3PniCdQWG4ZcLuOJwTOFDZNpBNER 8cZi2Ajx5jp4P4BBi7xQFEQqA9lQ5NCVOhINilmv/KqWDaKyG39+EWiF/WC6/Jt5m1sC iZ33cKyumzZN3zeNR4ml3MAt56K/I6JJfNTRXK1+Es/EPudx6QDG1mUpGK91dDYxn7Vx npyqATBnXZriUktutnMBbj0IoAsctn9wfMFsaBIYShfhK5IlDvcDTlBo+E3EBHiuHlYb z6ig== 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 a6-v6si11761473pgw.391.2018.10.02.06.47.44; Tue, 02 Oct 2018 06:47:59 -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 S1732490AbeJBUSZ (ORCPT + 99 others); Tue, 2 Oct 2018 16:18:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35486 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730235AbeJBUSY (ORCPT ); Tue, 2 Oct 2018 16:18:24 -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 4863BC2B; Tue, 2 Oct 2018 13:35:00 +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.14 126/137] hwmon: (ina2xx) fix sysfs shunt resistor read access Date: Tue, 2 Oct 2018 06:25:27 -0700 Message-Id: <20181002132507.331148396@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132458.446916963@linuxfoundation.org> References: <20181002132458.446916963@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.14-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