.. extrapolating from my own 'needs' ;-)
it would be nice to have a set of pages which have code snippets that.
- coders can cut-paste,
- express important rules concretely
(too generic.. An example)
1. proper balancing of do/undo operations
kzalloc & kfree
cdev_add & cdev_del
kobject_get & kobject_put
module_init & module_exit
mutex_lock & mutex_unlock
*_seize & *_release (anyone paying attention? ;)
(very long list)
this list can be 'filed', then used in a grep -nf <file> <code>
to allow easier sanity checking of code.
it also identifies calls that newbie code may have omitted
and with other annotations, could identify where in the device-model its
handled
(which hints whether newbie code will need to deal with it, or not (more
likely))
<wondering aloud>
Are there code annotations that make this balancing explicit ?
ex: gcc __attribute()s?
sparse annotations ?
I cannot start this page for a while yet, (no tuits) but would welcome
ML responses
that start collecting the balanced function pairs.
2. proper stacking/unstacking of those calls
this would help (me to easily) evaluate whether this is correct..
undo_request_region:
release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE);
undo_superio_enter:
superio_exit(gate);
superio_release(gate);
undo_platform_dev_add:
platform_device_del(pdev);
undo_platform_dev_alloc:
platform_device_put(pdev);
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/