Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2515957imm; Wed, 16 May 2018 14:17:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpD+BJPZ3M22L3tMySHuPP24OjTUCdGkZ77H9xFD8jX0B/vWo0DwyFteGG3UNTEvT4WvMTr X-Received: by 2002:a65:5b4d:: with SMTP id y13-v6mr1999471pgr.152.1526505442187; Wed, 16 May 2018 14:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526505442; cv=none; d=google.com; s=arc-20160816; b=Ndg+FV4sJ+KKZAfdimZzfrx7HjfyhxaQ6pyZEEhIfWzyvLQYVFpZC8F9krvWKkMbj7 0sZNlZYWOvG0xzw/BWaOfMMah/THpuQCrrt3BDo0mzkAhzMxqjb5O1ux4Aea0sL0OTLt 43d/5PgTmbLNCLdiL1ggh+W6+29x/RLITJeKdcx7i+OFQmo22yCYkWKVY9llHmqyhsbl 8OwbeSf7NGaVfsXt25tN1ayo5HMkqM3osAjQwIdq/WjIoyO9LT7O+YZi/C5bn8ASUpjs c+vqiFwFChOBjGnq5HS5QAaJkeApi8CyN7lWSUSV83aq5Pk47PrRrQGf0Ps7Blm1FwpQ U+qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=f3lihV/mmMqNNAkUNTxpuLNHFyErMdtLkR5f4I+oHnI=; b=o3ub6ZXUnydNKrC1kFnfKLhNQys43+E83IKQbd74oHU6uYTHVNhLfDZCwGz02AA+DL wtAbpYWHKpqVZ3zaQieJm+Zn1LUTMhLHcelztZpgEAyfX/fqtsOaGcH7aLIXY2/xNkQr Ct4/Th9cFWQC6f4CJoWmrQkrisWl0vKV4I9Hxu3/5mRgDkZiLcFHAWJvBm2mYg/HhX+b ty0nqv5v0rqDGb/xqw6Ox3wt5atf+hBgRkuLO+GkpYwYNaYpOXDPgL8rCfnXNundo0sz MnESxIxe1aVpdYmaX0HVt71mvgSn0Itz8xK5dB1G8AZBaOxiCeXHIeZZ9Zd4nT3nkUFi EUQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=TspqSwWf; 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 q17-v6si3451434pff.301.2018.05.16.14.17.07; Wed, 16 May 2018 14:17:22 -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; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=TspqSwWf; 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 S1752130AbeEPVPr (ORCPT + 99 others); Wed, 16 May 2018 17:15:47 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:55710 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbeEPVPp (ORCPT ); Wed, 16 May 2018 17:15:45 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 314DDB000D8 for ; Wed, 16 May 2018 23:15:44 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:to:subject:subject; s=dkim; t= 1526505343; x=1527369344; bh=FuZkBZyZlmED6g64ynmeu2YJAb1MUp3Pj+I Q9s0G5WM=; b=TspqSwWfjcfIEqp7KaXxtu8yGdu2YwxJVGyeU2WbWzbuHS3C5Wr KzEJTUyfbmfTrFZqoOUr4fz/dJ8xTZbYmpTTC5dqDcQXLjPMDguzoCi7WqvBzqun 0+39JkaR4dB6E/soM3BzMdtDa5aDuswhwBMeuD6gNubhWpuKUpcw9P08= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZuxmpgFMcvDJ for ; Wed, 16 May 2018 23:15:43 +0200 (CEST) Received: from [192.168.123.79] (unknown [192.168.123.79]) by mail.micronovasrl.com (Postfix) with ESMTPSA id C8643B00074; Wed, 16 May 2018 23:15:41 +0200 (CEST) Subject: Re: [PATCH v5 4/4] rtc: ds1307: add frequency_test_enable sysfs attribute to check tick on m41txx To: Alexandre Belloni Cc: Andy Shevchenko , Alessandro Zummo , Rob Herring , Mark Rutland , linux-rtc@vger.kernel.org, devicetree , Linux Kernel Mailing List References: <20180516103251.74707-1-giulio.benetti@micronovasrl.com> <20180516103251.74707-4-giulio.benetti@micronovasrl.com> <836407b4-8c51-5efa-8e29-f487bbcb528d@micronovasrl.com> <20180516211001.GC24496@piout.net> From: Giulio Benetti Message-ID: Date: Wed, 16 May 2018 23:15:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180516211001.GC24496@piout.net> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: it Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Il 16/05/2018 23:10, Alexandre Belloni ha scritto: > 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... I'm submitting too many patches, without waiting, sorry. I've submitted v6 patchset(too early), can you please take a look there and tell if I'm on the right path? On that I've change also _store function with kstrtobool(). I'm sorry I'm doing so much confusion. I'm trying to learn to make it the best way. > >