lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b6e9be1c-3f69-cec9-909b-48d8167a2a54@micronovasrl.com>
Date:   Wed, 16 May 2018 23:15:43 +0200
From:   Giulio Benetti <giulio.benetti@...ronovasrl.com>
To:     Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc:     Andy Shevchenko <andy.shevchenko@...il.com>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>, linux-rtc@...r.kernel.org,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 4/4] rtc: ds1307: add frequency_test_enable sysfs
 attribute to check tick on m41txx

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.

> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ