Hi David, On 8 July 2018 at 21:28, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote: [..] >> > > class FdtException(Exception): >> > > @@ -693,6 +706,275 @@ class Property(bytearray): >> > > if 0 in self[:-1]: >> > > raise ValueError('Property contains embedded nul characters') >> > > return self[:-1].decode('utf-8') >> > > + >> > > + >> > > +class FdtSw(object): >> > >> > So I realized one drawback of having a completely separate FdtSw >> > object is that the read-only methods of class Fdt won't be usable on >> > it, whereas the read only functions in libfdt do (by design) work on >> > sw mode trees. >> >> Yes - it never occurred to be to use those functions in that way. >> >> What do you suggest here? People can use the function to convert it to >> one. I don't think it's a great idea to make FdtSw a subclass, since >> Fdt has read-write functions which will not work on the sw tree. >> >> I could just combine the two classes and add comments about the two >> ways to use them. > > That's one option. Another would be to make both FdtRw and FdtSw > subclasses of an FdtRo class which has only the read-only functions. OK I've tried that for v6. I didn't move the tests around too much, and obviously now it is not possible to keep the python functions in the same order as libfdt.h, but it seems to work OK. Regards, Simon -- To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html