Thread (27 messages) 27 messages, 3 authors, 2014-12-08

[PATCHv6 4/5] hwspinlock/core: add common OF helpers

From: Ohad Ben-Cohen <hidden>
Date: 2014-11-14 07:11:38
Also in: linux-devicetree, linux-omap, lkml

Hi Suman,

On Thu, Nov 13, 2014 at 11:02 PM, Suman Anna [off-list ref] wrote:
OK, lets take an example. I have say 2 device instances, say
        hwlock1: hwlock at 0 {
                hwlock-num-locks = <32>
                hwlock-base-id = <0>;
                #hwlock-cells = <1>;
        };
        hwlock2: hwlock at 0 {
                hwlock-num-locks = <32>
                hwlock-base-id = <32>;
                #hwlock-cells = <1>;
        };

        some-client {
                hwlocks = <&hwlock1 32>, <&hwlock2 0>;
        };

The first args value is incorrect, and I expect the API to return an
error. I don't think the API can make assumptions that all passed in
values will be correct. What do you suggest that the API do here?
I think this is just one example of many potential mistakes the DT
developer can have, and that there's nothing really special about it.

What if the '5' digit below is a typo, and the actual hardware
assignment was supposed to be '4' ?

         some-client {
                 hwlocks = <&hwlock1 5>, <&hwlock2 5>;
         };

I don't see how much different this mistake is from the one you
mentioned above. There's a limit to how much we can really catch DT
mistakes in the code, just like we couldn't really catch past mistakes
in the platform data structures.

If we can easily add some validations then great, but if we have to go
to great lengths just to gain very limited validations, then I'd vote
against doing so.
One solution to handle #1 is to also make the hwlock-num-locks property
also mandatory (even though it could have been read from a register
Yeah, this is awkward. We shouldn't impose this on implementations
like OMAP which don't need it.

Again I think for the very limited validation this buys us - it's not worth it.
And, how do you propose we solve the problem of deferred probing?
It seems to me that hwspin_lock_request_specific failures should be
used by clients to defer their probing. Why wouldn't such a simple
solution work?

Thanks,
Ohad.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help