From: scottwood@freescale.com (Scott Wood)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] of: introduce helper to manage boolean
Date: Mon, 12 Mar 2012 14:39:06 -0500 [thread overview]
Message-ID: <4F5E50DA.6080000@freescale.com> (raw)
In-Reply-To: <20120309163608.GQ27213@game.jcrosoft.org>
On 03/09/2012 10:36 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>> Ugh. so any value other than 1 returns false? I think that will surprise
>>>> most people.
>>>>
>>>> I don't like this api or binding. If it is a bool property, then why isn't
>>>> simply testing for the property existance sufficient?
>>> no if you want to disable it
>>>
>>> if a bool is define in the dtsi and want to disable it int the dts
>>>
>>> if you we can do the the invert
>>>
>>> if !0 => true
>>>
>>> is-ok; => true
>>> is-ok = <val != 0>; => true
>>> is-ok = <0>; => false
>>
>> This is a failure of the dtc tool, not the binding. Accepting this binding
>> means we have to live with it for a very long time. It needs to be fixed
>> in dtc instead so that properties can be deleted instead of only modified.
> I understand your idea but today if you put and value in the property it's true.
>
> So is-ok = <0>; is true also which is illogical as in any language a boolean is
> true (1) or false (0). When I read the property I will understand false not true
You could say similar things about is-ok = "no" or is-ok = "" or is-ok =
"I'd rather you didn't"... it's expected that violating the binding may
produce illogical results.
> And I see no good way to add the "delete" in dtc.
It shouldn't be that hard, just needs a new keyword and/or bit of syntax
to express what you want it to do.
-Scott
WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Jean-Christophe PLAGNIOL-VILLARD
<plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 1/1] of: introduce helper to manage boolean
Date: Mon, 12 Mar 2012 14:39:06 -0500 [thread overview]
Message-ID: <4F5E50DA.6080000@freescale.com> (raw)
In-Reply-To: <20120309163608.GQ27213-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
On 03/09/2012 10:36 AM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>> Ugh. so any value other than 1 returns false? I think that will surprise
>>>> most people.
>>>>
>>>> I don't like this api or binding. If it is a bool property, then why isn't
>>>> simply testing for the property existance sufficient?
>>> no if you want to disable it
>>>
>>> if a bool is define in the dtsi and want to disable it int the dts
>>>
>>> if you we can do the the invert
>>>
>>> if !0 => true
>>>
>>> is-ok; => true
>>> is-ok = <val != 0>; => true
>>> is-ok = <0>; => false
>>
>> This is a failure of the dtc tool, not the binding. Accepting this binding
>> means we have to live with it for a very long time. It needs to be fixed
>> in dtc instead so that properties can be deleted instead of only modified.
> I understand your idea but today if you put and value in the property it's true.
>
> So is-ok = <0>; is true also which is illogical as in any language a boolean is
> true (1) or false (0). When I read the property I will understand false not true
You could say similar things about is-ok = "no" or is-ok = "" or is-ok =
"I'd rather you didn't"... it's expected that violating the binding may
produce illogical results.
> And I see no good way to add the "delete" in dtc.
It shouldn't be that hard, just needs a new keyword and/or bit of syntax
to express what you want it to do.
-Scott
next prev parent reply other threads:[~2012-03-12 19:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 4:13 [PATCH 1/1] of: introduce helper to manage boolean Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 4:13 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 15:13 ` Rob Herring
2012-02-07 15:13 ` Rob Herring
2012-02-07 16:14 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-07 16:14 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09 1:44 ` Grant Likely
2012-03-09 1:44 ` Grant Likely
2012-03-09 10:04 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09 10:04 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09 16:26 ` Grant Likely
2012-03-09 16:26 ` Grant Likely
2012-03-09 16:36 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09 16:36 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-12 19:39 ` Scott Wood [this message]
2012-03-12 19:39 ` Scott Wood
2012-03-13 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13 3:17 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13 4:16 ` Grant Likely
2012-03-13 4:16 ` Grant Likely
2012-03-13 7:03 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13 7:03 ` Jean-Christophe PLAGNIOL-VILLARD
2012-07-10 12:10 ` Simon Glass
2012-07-10 12:10 ` Simon Glass
2012-07-10 21:23 ` Scott Wood
2012-07-10 21:23 ` Scott Wood
2012-07-10 22:53 ` Simon Glass
2012-07-10 22:53 ` Simon Glass
2012-07-10 23:11 ` Scott Wood
2012-07-10 23:11 ` Scott Wood
2012-07-12 5:27 ` Simon Glass
2012-07-12 5:27 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F5E50DA.6080000@freescale.com \
--to=scottwood@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.