i2c-at91: Use struct dev_pm_ops for power management
Make the AT91 Two-Wire Interface driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
This commit is contained in:
committed by
Wolfram Sang
parent
02d8bf8dc6
commit
f277d27cc4
@@ -279,30 +279,31 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* NOTE: could save a few mA by keeping clock off outside of at91_xfer... */
|
/* NOTE: could save a few mA by keeping clock off outside of at91_xfer... */
|
||||||
|
|
||||||
static int at91_i2c_suspend(struct platform_device *pdev, pm_message_t mesg)
|
static int at91_i2c_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
clk_disable(twi_clk);
|
clk_disable(twi_clk);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int at91_i2c_resume(struct platform_device *pdev)
|
static int at91_i2c_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
return clk_enable(twi_clk);
|
return clk_enable(twi_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(at91_i2c_pm, at91_i2c_suspend, at91_i2c_resume);
|
||||||
|
#define AT91_I2C_PM (&at91_i2c_pm)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define at91_i2c_suspend NULL
|
#define AT91_I2C_PM NULL
|
||||||
#define at91_i2c_resume NULL
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct platform_driver at91_i2c_driver = {
|
static struct platform_driver at91_i2c_driver = {
|
||||||
.probe = at91_i2c_probe,
|
.probe = at91_i2c_probe,
|
||||||
.remove = __devexit_p(at91_i2c_remove),
|
.remove = __devexit_p(at91_i2c_remove),
|
||||||
.suspend = at91_i2c_suspend,
|
|
||||||
.resume = at91_i2c_resume,
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "at91_i2c",
|
.name = "at91_i2c",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = AT91_I2C_PM,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user