Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f835cef authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Wolfram Sang
Browse files

Documentation: i2c: Use PM ops instead of legacy suspend/resume



New drivers should use PM ops instead of the legacy suspend/resume
callbacks. Update the I2C device driver guides to reflect this.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 530834b1
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -79,11 +79,10 @@ static struct i2c_driver example_driver = {
 	.driver		= {
 	.driver		= {
		.owner		= THIS_MODULE,
		.owner		= THIS_MODULE,
		.name		= "example",
		.name		= "example",
		.pm		= &example_pm_ops,
	},
	},
	.attach_adapter = example_attach_adapter,
	.attach_adapter = example_attach_adapter,
	.detach_client	= example_detach,
	.detach_client	= example_detach,
	.suspend	= example_suspend,
	.resume		= example_resume,
};
};




@@ -272,10 +271,9 @@ static struct i2c_driver example_driver = {
 	.driver		= {
 	.driver		= {
		.owner		= THIS_MODULE,
		.owner		= THIS_MODULE,
		.name		= "example",
		.name		= "example",
		.pm		= &example_pm_ops,
	},
	},
	.id_table	= example_idtable,
	.id_table	= example_idtable,
	.probe		= example_probe,
	.probe		= example_probe,
	.remove		= example_remove,
	.remove		= example_remove,
	.suspend	= example_suspend,
	.resume		= example_resume,
};
};
+4 −4
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ MODULE_DEVICE_TABLE(i2c, foo_idtable);
static struct i2c_driver foo_driver = {
static struct i2c_driver foo_driver = {
	.driver = {
	.driver = {
		.name	= "foo",
		.name	= "foo",
		.pm	= &foo_pm_ops,	/* optional */
	},
	},


	.id_table	= foo_idtable,
	.id_table	= foo_idtable,
@@ -47,8 +48,6 @@ static struct i2c_driver foo_driver = {
	.address_list	= normal_i2c,
	.address_list	= normal_i2c,


	.shutdown	= foo_shutdown,	/* optional */
	.shutdown	= foo_shutdown,	/* optional */
	.suspend	= foo_suspend,	/* optional */
	.resume		= foo_resume,	/* optional */
	.command	= foo_command,	/* optional, deprecated */
	.command	= foo_command,	/* optional, deprecated */
}
}


@@ -279,8 +278,9 @@ Power Management


If your I2C device needs special handling when entering a system low
If your I2C device needs special handling when entering a system low
power state -- like putting a transceiver into a low power mode, or
power state -- like putting a transceiver into a low power mode, or
activating a system wakeup mechanism -- do that in the suspend() method.
activating a system wakeup mechanism -- do that by implementing the
The resume() method should reverse what the suspend() method does.
appropriate callbacks for the dev_pm_ops of the driver (like suspend
and resume).


These are standard driver model calls, and they work just like they
These are standard driver model calls, and they work just like they
would for any other driver stack.  The calls can sleep, and can use
would for any other driver stack.  The calls can sleep, and can use