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.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html