Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tpetazzoni/51b280e54a9384952e35fad6e14423ba to your computer and use it in GitHub Desktop.
Save tpetazzoni/51b280e54a9384952e35fad6e14423ba to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: GPL-2.0
#include <linux/init.h>
#include <linux/module.h>
#include <linux/i2c.h>
static int nunchuk_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
pr_info("Coucou from %s\n", __func__);
return 0;
}
static int nunchuk_remove(struct i2c_client *client)
{
pr_info("Coucou from %s\n", __func__);
return 0;
}
static const struct of_device_id nunchuk_of_ids[] = {
{ .compatible = "nintendo,nunchuk" },
{ /* sentinel */ },
};
static struct i2c_driver nunchuk_driver = {
.probe = nunchuk_probe,
.remove = nunchuk_remove,
.driver = {
.name = "nunchuk",
.of_match_table = nunchuk_of_ids,
},
};
module_i2c_driver(nunchuk_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Thomas Petazzoni");
MODULE_DESCRIPTION("Nunchuk driver");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment