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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 May 2018 23:10:01 +0200
From:   Alexandre Belloni <alexandre.belloni@...tlin.com>
To:     Giulio Benetti <giulio.benetti@...ronovasrl.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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ