Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2511217imm; Wed, 16 May 2018 14:11:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqJjDyBSSEd7VHmiHIgmGt+/7PHHOrwsKv8p2/Y+y9Nece9Hymd5ZuwHQlLD0mMjIQ/ssQF X-Received: by 2002:a17:902:9a08:: with SMTP id v8-v6mr2516264plp.148.1526505108924; Wed, 16 May 2018 14:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526505108; cv=none; d=google.com; s=arc-20160816; b=WXnYuHy9ajTWzXmpXnc6q6TTjtHO3hL95cvyTVzFHeHAlLYD7R6A0g5mhz0qR9Iohk tEQupd3TkNEWm3bTG7FJOxlAeMh42rgtcd/CDm7+MwFMLOqiPcvbcdtj6lyLhyE1WZnr xLk78s0b3nZSUnB/byT6dcYsUL+IjqbBWZHFm6VUrU3WnPcrC2kld0QsNlNFmAx5nF6p cTedU3ZVMpXARJqqCXiFi+9rbLFyG3u4tQ2FBfoa0ibw/hT3x+9oDUVaOb85RQ8TQqEk kD/ch5oYtjxxdsG6TwlcdiPrWePw/EgDZEk0LMdR8jSqAnllOQUCe5HAYjyw6bBkIsym XBsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=MC7Y15WCJ/xTNuXBHCxMgWfWKjbk/sl+FD9YbYK7a94=; b=0UTqv+T2kdtrBlI8x2ilkhiuMBP9TgzLnI+l0kngCLBYFexjQSyTOmCcPh6UizzbBl kp1E/Pten4wkulr4Tep2Adpy57ewHHvDn+XUbahjzMlQPxBfTYCADnBEofE2MbL1Zs4F 9OwLSghNRWLbLeTsopaBGB8T2WgIILiMXomNxtY2+v1BA625vriBZ3W/spZ/o796XLEn IURXa+zoTDcgKVdUzDSnJZBIUvl8y8z43za5Hmw98nxv3eHYd1Ha3dkteA55u4YdDrd0 vqU4LGNbWpeWNrXFRAh/NUGi2MLSbFT1GjH0UScXXMoExz3VC1kGiqnq6GtrvUojFZIC N34A== 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 y25-v6si3418374pfn.248.2018.05.16.14.11.34; Wed, 16 May 2018 14:11:48 -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 S1752080AbeEPVKF (ORCPT + 99 others); Wed, 16 May 2018 17:10:05 -0400 Received: from mail.bootlin.com ([62.4.15.54]:59932 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752226AbeEPVKD (ORCPT ); Wed, 16 May 2018 17:10:03 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id A39E220741; Wed, 16 May 2018 23:10:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [88.191.26.124]) by mail.bootlin.com (Postfix) with ESMTPSA id 76B052036F; Wed, 16 May 2018 23:10:00 +0200 (CEST) Date: Wed, 16 May 2018 23:10:01 +0200 From: Alexandre Belloni To: Giulio Benetti Cc: Andy Shevchenko , Alessandro Zummo , Rob Herring , Mark Rutland , linux-rtc@vger.kernel.org, devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v5 4/4] rtc: ds1307: add frequency_test_enable sysfs attribute to check tick on m41txx Message-ID: <20180516211001.GC24496@piout.net> References: <20180516103251.74707-1-giulio.benetti@micronovasrl.com> <20180516103251.74707-4-giulio.benetti@micronovasrl.com> <836407b4-8c51-5efa-8e29-f487bbcb528d@micronovasrl.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <836407b4-8c51-5efa-8e29-f487bbcb528d@micronovasrl.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/05/2018 23:02:16+0200, Giulio Benetti wrote: > > > +static ssize_t frequency_test_enable_show(struct device *dev, > > > + struct device_attribute *attr, > > > + char *buf) > > > +{ > > > > > + int freq_test_en = 0; > > > > > + if (ctrl_reg & M41TXX_BIT_FT) > > > + freq_test_en = true; > > > + else > > > + freq_test_en = false; > > > + > > > + return sprintf(buf, "%d\n", freq_test_en); > > > > So, is it boolean or integer? This code makes it confusing a lot. > > It is a boolean, so now I've updated with this: > > if (ctrl_reg & M41TXX_BIT_FT) > return scnprintf(buf, PAGE_SIZE, "on\n"); > else > return scnprintf(buf, PAGE_SIZE, "off\n"); > No, it has to be consistent with what you write. Here, you'd write 0 or 1 in the file and read off or on... -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com