From patchwork Fri Jul 8 02:46:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 9219983 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 959106048B for ; Fri, 8 Jul 2016 02:46:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AFA527F54 for ; Fri, 8 Jul 2016 02:46:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FB7027F7F; Fri, 8 Jul 2016 02:46:25 +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 8BD0C27F54 for ; Fri, 8 Jul 2016 02:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753817AbcGHCqY (ORCPT ); Thu, 7 Jul 2016 22:46:24 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36459 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753672AbcGHCqX (ORCPT ); Thu, 7 Jul 2016 22:46:23 -0400 Received: by mail-pf0-f193.google.com with SMTP id i123so3308434pfg.3 for ; Thu, 07 Jul 2016 19:46:23 -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=f0RuScOQU/UliLIo6mQfU57BAa9vA81rjHIsmWhTnDI=; b=LVUvjpIGTTn9hIrYSjrnacd76egYPbbix5Ojxqmgcn9n/CqUBfUErTPRSDwEQGBpIr +dKf1ggEYPpAMdpUbKJSwjMq0QUAwIzm5yht3oQo94AJqb6kmYy6W+2S7xbVqw5/zahY 3mv0ZarLma/HtbqJDsGi6AwECFWzdnlkNeE9uZiy5KnwuNILKzsKWwJM5AuMqudOMyxK mdFZKEpyA4AszqcnEahOGkOCH+Cgzf/Ck9/G9ugY4HHPLImpL0jBKVQ6AsziLc17Gdkn Qn7ieVVIqr4PBGrXq96DokTuULoGWwkXBvfGeayKrJf4WqKuKzD+1xyxhVwQAa6wYm5h JeMg== 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=f0RuScOQU/UliLIo6mQfU57BAa9vA81rjHIsmWhTnDI=; b=lJ4GqRi2wVzZf6UtOe3zLyxocEHvhc+xuJS4AdnDVR8J2qj3YaXylBpYW0HDEqSQua 77b3J5CbtFqJA25dEKi3BFz79bThG2I2qYKP5rZgpLSO/6K0QCk6VNIKwTZTcGVoxtPK gcNKtqUnOdSHLpIGNXFxTyVLdGVLbE2PN2XzCAOAF7Jf68inzVcjHXCJlb+PgtxPUtn9 EZuOffrV79U2b1uULfmX/OgH8qUZ2mrDbLYYvb10LjcDieEoS+7ilh8PgAsluhJX0rgE GkRkGtZKC3MtH55VZEcZWxL0tFdYXDJLhHdlb/5Y0iiK/0ShiFP5kVcPuSsE7JDuDDcd bZLw== X-Gm-Message-State: ALyK8tIy/VA9oNDorS59T5L7LBKH96ke3+0kctnobupcodQ6JkaON9EG+RMM8wwe8J/Npw== X-Received: by 10.98.109.134 with SMTP id i128mr5821647pfc.72.1467945982333; Thu, 07 Jul 2016 19:46:22 -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 tt1sm3094143pac.35.2016.07.07.19.46.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 19:46:21 -0700 (PDT) From: Matt Ranostay To: linux-hwmon@vger.kernel.org Cc: Matt Ranostay , Guenter Roeck , David Frey Subject: [PATCH] hwmon: sht3x: set initial jiffies to last_update Date: Thu, 7 Jul 2016 19:46:11 -0700 Message-Id: <1467945971-23798-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 you can start in a state where the sensor will never request a reading. Cc: Guenter Roeck Cc: David Frey Signed-off-by: Matt Ranostay --- 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 450645b6053d..05a925257938 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -722,7 +722,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; data->client = client; crc8_populate_msb(sht3x_crc8_table, SHT3X_CRC8_POLYNOMIAL);