Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755885AbcC2G4v (ORCPT ); Tue, 29 Mar 2016 02:56:51 -0400 Received: from down.free-electrons.com ([37.187.137.238]:42948 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752138AbcC2G4q (ORCPT ); Tue, 29 Mar 2016 02:56:46 -0400 From: =?UTF-8?q?Myl=C3=A8ne=20Josserand?= To: alexandre.belloni@free-electrons.com, rtc-linux@googlegroups.com Cc: Alessandro Zummo , linux-kernel@vger.kernel.org, mylene.josserand@free-electrons.com Subject: [PATCH 5/8] rtc: m41t80: remove warnings and replace obsolete function Date: Tue, 29 Mar 2016 08:56:02 +0200 Message-Id: <3d756d63af27c4b369783eae322e53eb73361d38.1459233897.git.mylene.josserand@free-electrons.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3457 Lines: 112 Replace the obsolete "simple_strtoul" function to "kstrtoul". Remove some checkpatch's errors, warnings and checks : - alignment with open parenthesis - spaces around '<' and '<<' - blank line after structure - quoted string split across lines Signed-off-by: Mylène Josserand --- drivers/rtc/rtc-m41t80.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index f991433..1575b08 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c @@ -226,7 +226,11 @@ static ssize_t sqwfreq_store(struct device *dev, struct i2c_client *client = to_i2c_client(dev); struct m41t80_data *clientdata = i2c_get_clientdata(client); int almon, sqw, reg_sqw, rc; - int val = simple_strtoul(buf, NULL, 0); + unsigned long val; + + rc = kstrtoul(buf, 0, &val); + if (rc < 0) + return rc; if (!(clientdata->features & M41T80_FEATURE_SQ)) return -EINVAL; @@ -255,7 +259,7 @@ static ssize_t sqwfreq_store(struct device *dev, sqw = (sqw & 0x0f) | (val << 4); rc = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, - almon & ~M41T80_ALMON_SQWE); + almon & ~M41T80_ALMON_SQWE); if (rc < 0) return rc; @@ -265,8 +269,8 @@ static ssize_t sqwfreq_store(struct device *dev, return rc; rc = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, - almon | M41T80_ALMON_SQWE); - if (rc <0) + almon | M41T80_ALMON_SQWE); + if (rc < 0) return rc; } return count; @@ -278,6 +282,7 @@ static struct attribute *attrs[] = { &dev_attr_sqwfreq.attr, NULL, }; + static struct attribute_group attr_group = { .attrs = attrs, }; @@ -329,7 +334,7 @@ static void wdt_ping(void) /* * WDS = 1 (0x80), mulitplier = WD_TIMO, resolution = 1s (0x02) */ - i2c_data[1] = wdt_margin<<2 | 0x82; + i2c_data[1] = wdt_margin << 2 | 0x82; /* * M41T65 has three bits for watchdog resolution. Don't set bit 7, as @@ -595,7 +600,7 @@ static int m41t80_probe(struct i2c_client *client, } clientdata = devm_kzalloc(&client->dev, sizeof(*clientdata), - GFP_KERNEL); + GFP_KERNEL); if (!clientdata) return -ENOMEM; @@ -603,7 +608,7 @@ static int m41t80_probe(struct i2c_client *client, i2c_set_clientdata(client, clientdata); rtc = devm_rtc_device_register(&client->dev, client->name, - &m41t80_rtc_ops, THIS_MODULE); + &m41t80_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) return PTR_ERR(rtc); @@ -617,14 +622,13 @@ static int m41t80_probe(struct i2c_client *client, m41t80_get_datetime(client, &tm); dev_info(&client->dev, "HT bit was set!\n"); dev_info(&client->dev, - "Power Down at " - "%04i-%02i-%02i %02i:%02i:%02i\n", + "Power Down at %04i-%02i-%02i %02i:%02i:%02i\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); } rc = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_HOUR, - rc & ~M41T80_ALHOUR_HT); + rc & ~M41T80_ALHOUR_HT); } if (rc < 0) { @@ -637,7 +641,7 @@ static int m41t80_probe(struct i2c_client *client, if (rc >= 0 && rc & M41T80_SEC_ST) rc = i2c_smbus_write_byte_data(client, M41T80_REG_SEC, - rc & ~M41T80_SEC_ST); + rc & ~M41T80_SEC_ST); if (rc < 0) { dev_err(&client->dev, "Can't clear ST bit\n"); return rc; -- 2.8.0.rc3