Skip to content

Commit

Permalink
i2c/writing-clients: Mention module_i2c_driver()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Jul 24, 2012
1 parent 2a2f740 commit 9cd3f2e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Documentation/i2c/writing-clients
Original file line number Diff line number Diff line change
Expand Up @@ -245,28 +245,35 @@ 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.
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
================

Expand Down

0 comments on commit 9cd3f2e

Please sign in to comment.