Hi Ben, (Ben, sorry for double-post, I accidently dropped the CC)
On Tue, Jul 15, 2008 at 09:26:23PM +0100, Ben Dooks wrote:
The two typos I mentioned before are still here.
[...]
> +Update the detatch method, by changing the name to _remove and
Typo: detach
> +to delete the i2c_detach_client call.
> +
> +- static int __devexit example_detach(struct i2c_client *client)
> ++ static int __devexit example_remove(struct i2c_client *client)
> +{
> + struct example_state *state = i2c_get_clientdata(client);
> +
> +- i2c_detach_client(client);
> +
> +And finally ensure that we have the correct ID table for the i2c-core
> +and other utilties:
Typo: utilities
> +
> ++ struct i2c_device_id example_idtable[] = {
> ++ { "example", 0 },
> ++ { }
> ++};
> ++
> ++MODULE_DEVICE_TABLE(i2c, example_idtable);
> +
> +static struct i2c_driver example_driver = {
> + .driver = {
> + .owner = THIS_MODULE,
> + .name = "example",
> + },
> ++ .id_table = example_ids,
> +
> +
> +Our driver should now look like this:
> +
> +struct example_state {
> + struct i2c_client *client;
> + ....
> +};
> +
> +static int example_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct example_state *state;
> + struct device *dev = &client->dev;
> + int ret;
ret is unused now. This could be mentioned. If you disagree, please
leave a short comment, so I know it was not overlooked.
> +
> + state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
> + if (state == NULL) {
> + dev_err(dev, "failed to create our state\n");
> + return -ENOMEM;
> + }
> +
> + state->client = client;
> + i2c_set_clientdata(client, state);
> +
> + /* rest of the initialisation goes here. */
> +
> + dev_info(dev, "example client created\n");
> +
> + return 0;
> +}
> +
> +static int example_remove(struct i2c_client *client)
__devexit
All the best,
Wolfram
--
Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
signature.asc
Description: Digital signature
_______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
