From patchwork Thu Jun 30 03:43:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9206585 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 7CE9A60757 for ; Thu, 30 Jun 2016 03:44:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FBCF2866B for ; Thu, 30 Jun 2016 03:44:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64ABF28673; Thu, 30 Jun 2016 03:44:37 +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_SIGNED, 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 1CEDD2866B for ; Thu, 30 Jun 2016 03:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751999AbcF3Dnw (ORCPT ); Wed, 29 Jun 2016 23:43:52 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:37316 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997AbcF3Dnv (ORCPT ); Wed, 29 Jun 2016 23:43:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=aatjLP5kQ2BCnFo27b7/9CKFCGH0gKXwh0PtyqRPsLs=; b=JH0QVpPrBjxTLk uc+24K3kJ9rKJxeGeMEIaTpOZWpFZ4yMj8R6SBtkXsd/EdBPZBVq47UBxQyFj5OKKXkU3/NGa9HKG OhGxb0YisE8UtfAMVXJEJWSGhfDx8A3g3VKfDape4ZHr+EqZ3NaIN54jig9sewjptGfnA4W5TP2zd 1F88h6yL1lMSL2n1efYP2YsBERjfbUiJZckqf1q0orVCdxTeY/tsub+9UDimMWM5k4tQBBreVt3Hi wJn5lMGDzzZl7TbpAUsiZZAff8RSuWvxSYTWN2EMoEHyTxFyM7Zuf6melrJrHxLrkRMaidMO730xp gnvh/DjZFWw3RXkYzykw==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:51706 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1bIStI-000ZM8-Fe; Thu, 30 Jun 2016 03:43:48 +0000 From: Guenter Roeck To: Jean Delvare Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH v2 3/4] hwmon: (lm75) Add update_interval attribute Date: Wed, 29 Jun 2016 20:43:40 -0700 Message-Id: <1467258221-3742-3-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1467258221-3742-1-git-send-email-linux@roeck-us.net> References: <1467258221-3742-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: 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 Since we know the chip's update interval, let's make it available to the user. Signed-off-by: Guenter Roeck --- v2: No change drivers/hwmon/lm75.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 7b18cbd4a5ec..fe83f70ba62a 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -159,16 +159,29 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, return count; } +static ssize_t show_update_interval(struct device *dev, + struct device_attribute *da, char *buf) +{ + struct lm75_data *data = lm75_update_device(dev); + + if (IS_ERR(data)) + return PTR_ERR(data); + + return sprintf(buf, "%u\n", jiffies_to_msecs(data->sample_time)); +} + static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, 1); static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, show_temp, set_temp, 2); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); +static DEVICE_ATTR(update_interval, S_IRUGO, show_update_interval, NULL); static struct attribute *lm75_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_max.dev_attr.attr, &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, + &dev_attr_update_interval.attr, NULL };