Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5695063imm; Mon, 27 Aug 2018 02:35:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY3w+bgIccmkdeddHvloEvC24B/+apUWGH9T6JQs1OAt+KY0NXlxFHzD/48yrqRKl+XpQPd X-Received: by 2002:a63:f616:: with SMTP id m22-v6mr11704786pgh.293.1535362513123; Mon, 27 Aug 2018 02:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535362513; cv=none; d=google.com; s=arc-20160816; b=aLWl0lb2jddA0eSwFV8LpWLhJuaYpJCr9TYOUD0/UslUo/PiX5o/+u9piYJE9clThM cwl8YRzcV028xVuPclBizHhTiRRlWWqcuz3cgUXgJ07u9Pn5JwllS31XyYkvcpJg8rxB 7bChVN7VdUQLrnqciSML5qtRcU01VR1IexgYtvkYgre3SLYXeLgGL5BmM7CDWIozlv7n wxGsjdx9ckejeQoqQ5u6UpgYtGIMCgSkGiJs9QcT49z64gn/iO38JFg2H5XdXKUhglxp N2nhG/ASlaKEH/2DvlRH3MiDV3SC/iGA8K5xXcLKAuw8NdtiIXELJZLl4hQvf0iFFQYY 0AOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=omWmwHFNeuu113Jv/MnSmr1AmQA0NepUUtxhBRmz/B4=; b=jXfTnhdID6thNoUHCPqiRu9F1mDCRMECSRqP4+uGkn7mN0u6u7Xc8B0+Zjjk4V3Qu3 8hk0lWBUSyYcyK4QCNPlV2bTEzCi+OFAgfZ1FrstsWQmcxlUPwzZ7da3DGTDYyXBD4Vn vFIgR7fIaKlKTnjlaIicsDo7yetah7mDTgsZlXWPDWcO1Qw16GCyA7uD7x3HAe8/RmIY 6AjTiosaK3jmlwe/0Ym/JfqzD81E+dRXP39mJQQdtNHVmDZ/rA5o3uMPm1fT05/0pVUC PzsVwD/dmi2DW55XQOmUxmFDur+U5ieP2CQ/2upm+88CsYFUo7ftXo3/y9OsM0SciUfQ WmMQ== 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 l24-v6si11321154pgj.158.2018.08.27.02.34.57; Mon, 27 Aug 2018 02:35:13 -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 S1727478AbeH0NTh (ORCPT + 99 others); Mon, 27 Aug 2018 09:19:37 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:38110 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbeH0NTh (ORCPT ); Mon, 27 Aug 2018 09:19:37 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee45b83c572a65-1185d; Mon, 27 Aug 2018 17:33:38 +0800 (CST) X-RM-TRANSID: 2ee45b83c572a65-1185d X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from bclinux72.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea5b83c572302-06af4; Mon, 27 Aug 2018 17:33:38 +0800 (CST) X-RM-TRANSID: 2eea5b83c572302-06af4 From: Ding Xiang To: sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] power: supply: ab8500_fg: fix obsolete function Date: Mon, 27 Aug 2018 06:49:15 -0400 Message-Id: <1535366955-12733-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org simple_strtoul is obsolete, and use kstrtoint instead Signed-off-by: Ding Xiang --- drivers/power/supply/ab8500_fg.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 02356f9..2bdadb5 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -2582,11 +2582,12 @@ static ssize_t ab8505_powercut_flagtime_write(struct device *dev, const char *buf, size_t count) { int ret; - long unsigned reg_value; + int reg_value; struct power_supply *psy = dev_get_drvdata(dev); struct ab8500_fg *di = power_supply_get_drvdata(psy); - reg_value = simple_strtoul(buf, NULL, 10); + if (kstrtoint(buf, 10, ®_value)) + goto fail; if (reg_value > 0x7F) { dev_err(dev, "Incorrect parameter, echo 0 (1.98s) - 127 (15.625ms) for flagtime\n"); @@ -2636,7 +2637,9 @@ static ssize_t ab8505_powercut_maxtime_write(struct device *dev, struct power_supply *psy = dev_get_drvdata(dev); struct ab8500_fg *di = power_supply_get_drvdata(psy); - reg_value = simple_strtoul(buf, NULL, 10); + if (kstrtoint(buf, 10, ®_value)) + goto fail; + if (reg_value > 0x7F) { dev_err(dev, "Incorrect parameter, echo 0 (0.0s) - 127 (1.98s) for maxtime\n"); goto fail; @@ -2684,7 +2687,9 @@ static ssize_t ab8505_powercut_restart_write(struct device *dev, struct power_supply *psy = dev_get_drvdata(dev); struct ab8500_fg *di = power_supply_get_drvdata(psy); - reg_value = simple_strtoul(buf, NULL, 10); + if (kstrtoint(buf, 10, ®_value)) + goto fail; + if (reg_value > 0xF) { dev_err(dev, "Incorrect parameter, echo 0 - 15 for number of restart\n"); goto fail; @@ -2777,7 +2782,9 @@ static ssize_t ab8505_powercut_write(struct device *dev, struct power_supply *psy = dev_get_drvdata(dev); struct ab8500_fg *di = power_supply_get_drvdata(psy); - reg_value = simple_strtoul(buf, NULL, 10); + if (kstrtoint(buf, 10, ®_value)) + goto fail; + if (reg_value > 0x1) { dev_err(dev, "Incorrect parameter, echo 0/1 to disable/enable Pcut feature\n"); goto fail; @@ -2849,7 +2856,9 @@ static ssize_t ab8505_powercut_debounce_write(struct device *dev, struct power_supply *psy = dev_get_drvdata(dev); struct ab8500_fg *di = power_supply_get_drvdata(psy); - reg_value = simple_strtoul(buf, NULL, 10); + if (kstrtoint(buf, 10, ®_value)) + goto fail; + if (reg_value > 0x7) { dev_err(dev, "Incorrect parameter, echo 0 to 7 for debounce setting\n"); goto fail; -- 1.8.3.1