diff options
author | Jean Delvare <khali@linux-fr.org> | 2012-07-24 12:13:57 (GMT) |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2012-07-24 12:13:57 (GMT) |
commit | 9cd3f2e8496ce97a9218d8b0ace06c4d8f0c6bf5 (patch) | |
tree | ab1eb7484deb0a304696f2cf7ace856a5b6716a3 /Documentation/i2c/writing-clients | |
parent | 2a2f7404a1946be62290292ca5d6438c4b50567f (diff) | |
download | linux-fsl-qoriq-9cd3f2e8496ce97a9218d8b0ace06c4d8f0c6bf5.tar.xz |
i2c/writing-clients: Mention module_i2c_driver()
Based on a previous patch from Peter Meerwald.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Diffstat (limited to 'Documentation/i2c/writing-clients')
-rw-r--r-- | Documentation/i2c/writing-clients | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 5aa5337..3a94b0e 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients @@ -245,21 +245,17 @@ static int __init foo_init(void) { return i2c_add_driver(&foo_driver); } +module_init(foo_init); static void __exit foo_cleanup(void) { i2c_del_driver(&foo_driver); } +module_exit(foo_cleanup); -/* Substitute your own name and email address */ -MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>" -MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); - -/* a few non-GPL license types are also allowed */ -MODULE_LICENSE("GPL"); +The module_i2c_driver() macro can be used to reduce above code. -module_init(foo_init); -module_exit(foo_cleanup); +module_i2c_driver(foo_driver); Note that some functions are marked by `__init'. These functions can be removed after kernel booting (or module loading) is completed. @@ -267,6 +263,17 @@ Likewise, functions marked by `__exit' are dropped by the compiler when the code is built into the kernel, as they would never be called. +Driver Information +================== + +/* Substitute your own name and email address */ +MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>" +MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); + +/* a few non-GPL license types are also allowed */ +MODULE_LICENSE("GPL"); + + Power Management ================ |