User: Password:
|
|
Subscribe / Log in / New account

Drivers as documentation

Drivers as documentation

Posted Nov 24, 2011 13:21 UTC (Thu) by juliank (subscriber, #45896)
Parent article: Drivers as documentation

Documentation or self-documenting code is important. For example, for the nvec driver (in staging), I have added code documentation (mostly kernel-doc-style function documentation) and am now working on moving the magic constants and stuff into enums with readable and understandable names.

It looks fairly out of place compared to the rest of the kernel, but since we don't have any documentation on that device at the moment, and implement the driver in the community, having the documentation makes it easier to understand the driver and fix bugs.

We also have some strange things, like having to add an udelay() somewhere because the device otherwise locks up, and we don't know why. NVIDIA's original Android driver did not have those things and worked. Maybe there documentation has information about this, but we don't have it (although it might be made public if we're lucky).


(Log in to post comments)

Drivers as documentation

Posted Nov 25, 2011 6:02 UTC (Fri) by jzbiciak (subscriber, #5246) [Link]

Ok, this is somewhat offtopic, but it piqued my curiosity...

We also have some strange things, like having to add an udelay() somewhere because the device otherwise locks up, and we don't know why

Memory ordering issue, and a barrier of some sort is required? Does the lockup happen on the same chip as the original usleep-less Android implementation?

Drivers as documentation

Posted Nov 25, 2011 14:44 UTC (Fri) by juliank (subscriber, #45896) [Link]

> Memory ordering issue, and a barrier of some sort is required?
> Does the lockup happen on the same chip as the original
> usleep-less Android implementation?

Seems I misremembered. It does not lock up, it just sends
incomplete messages. I added an udelay(100) in commit
de839b8f06bc5dd3f5037c4409a720cbb9bf21c3 [1] which seems to
prevent that.

[1] https://git.kernel.org/?p=linux/kernel/git/torvalds/linux...


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds