Commit 9cd3f2e8 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

i2c/writing-clients: Mention module_i2c_driver()

Based on a previous patch from Peter Meerwald.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatarPeter Meerwald <p.meerwald@bct-electronic.com>
parent 2a2f7404
...@@ -245,21 +245,17 @@ static int __init foo_init(void) ...@@ -245,21 +245,17 @@ static int __init foo_init(void)
{ {
return i2c_add_driver(&foo_driver); return i2c_add_driver(&foo_driver);
} }
module_init(foo_init);
static void __exit foo_cleanup(void) static void __exit foo_cleanup(void)
{ {
i2c_del_driver(&foo_driver); i2c_del_driver(&foo_driver);
} }
module_exit(foo_cleanup);
/* Substitute your own name and email address */ The module_i2c_driver() macro can be used to reduce above code.
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");
module_init(foo_init); module_i2c_driver(foo_driver);
module_exit(foo_cleanup);
Note that some functions are marked by `__init'. These functions can Note that some functions are marked by `__init'. These functions can
be removed after kernel booting (or module loading) is completed. 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 ...@@ -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. 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 Power Management
================ ================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment