From patchwork Mon Jul 25 00:05:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 9245097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A295A607D3 for ; Mon, 25 Jul 2016 00:06:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8921225F3E for ; Mon, 25 Jul 2016 00:06:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D7A1262FF; Mon, 25 Jul 2016 00:06:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08EB325F3E for ; Mon, 25 Jul 2016 00:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752477AbcGYAGH (ORCPT ); Sun, 24 Jul 2016 20:06:07 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:32836 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752434AbcGYAGH (ORCPT ); Sun, 24 Jul 2016 20:06:07 -0400 Received: by mail-pf0-f196.google.com with SMTP id i6so10837590pfe.0 for ; Sun, 24 Jul 2016 17:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=zrj09mZ/yIcEJIMP59IZqzxoQZQwRL3lRyBRCRmO3Lg=; b=voQl5LgruhyhPgvn9FhHWA1MZmzsrUN1z7dxtnDMjHZIjO4lmiXbxxD07H34vOlJV2 sm+xuRzOWo28ncXWdy5jcypKQpWpgUQcZOjqtunhR67Lf8lyW0GopfiBn/LODJ1CFStF f5e3BSWUx+DtMcvCWaRryESWBkg7zS49mQ7FLzJV387SAYP9JVPHsYfxX5De9h8S17KU Ya3wNrDmmOurnt3orE17vBkpu0V9iyp75Zq81rBHcsuKUx9/P3OCDXy1r3TlFEvZdj6g vasRyhdwxzgbZ7sMffVN+LF8QMiFtsk3ylTVsYM8KkhN9f/aVgdjta82DJA3oOeIgo9J THeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zrj09mZ/yIcEJIMP59IZqzxoQZQwRL3lRyBRCRmO3Lg=; b=b/wEi/ktsNN2SuuxLCD90hYg+M9YDe/ITVsoAfx0NjDc4JcR+8MUP5ncLESDXx90l2 xvfjzEnrULahBXrPRJimnOH1b9e31fuYLNeKFTlVuOzUoDta+UA3vndyJ9ywgdnw5ziy c3Dq7iPGZUQCIXulYJT5iB10JLwSg2AQ/wymjl1GDkOyLShZFCb6wg1WdtM8WgJL1tfC 1PGrZoUA4L5FrUkpVxECcJocqiVsPBuv3EiYz+7S0adbDlvqnuYuolFuvhoNmpBeK7z8 HUU4AU2lGE5298tu27S5OPwdXnXm3YVqKU+wkONIbr/GkK/45lu2gNKkUwdgBIKBMN7c tu9w== X-Gm-Message-State: AEkoouv68q4/GUPNarpR34VD8QOlbcSyFIiJavZp+aRIBhXPh5bcNztuh3kiiSrYmVwqOw== X-Received: by 10.98.70.199 with SMTP id o68mr24671283pfi.17.1469405165561; Sun, 24 Jul 2016 17:06:05 -0700 (PDT) Received: from localhost.localdomain (c-73-25-156-150.hsd1.or.comcast.net. [73.25.156.150]) by smtp.gmail.com with ESMTPSA id p14sm35068470par.32.2016.07.24.17.06.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Jul 2016 17:06:04 -0700 (PDT) From: Matt Ranostay To: linux-hwmon@vger.kernel.org Cc: jdelvare@suse.de, Matt Ranostay , Guenter Roeck , David Frey Subject: [PATCH v2] hwmon: (sht3x) set initial jiffies to last_update Date: Sun, 24 Jul 2016 17:05:32 -0700 Message-Id: <1469405132-7044-1-git-send-email-mranostay@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Handling the wraparound requires the data->last_update to be set to an initial jiffies value. Otherwise on 32-bit systems you will not be able to request a reading till the 5 minute jiffies rollover happens. Cc: Guenter Roeck Cc: David Frey Signed-off-by: Matt Ranostay Reviewed-by: Jean Delvare --- Changes from v1: * document more in commit message the reason for the patch * mark last sample before driver load so initial reading can happen shortly after boot drivers/hwmon/sht3x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index b73a48832732..6ea99cd6ae79 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -720,7 +720,7 @@ static int sht3x_probe(struct i2c_client *client, data->setup.blocking_io = false; data->setup.high_precision = true; data->mode = 0; - data->last_update = 0; + data->last_update = jiffies - msecs_to_jiffies(3000); data->client = client; crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL);