我正在研究 i2c 驱动程序的电源管理,并注意到一些奇怪的事情。
include/linux/i2c.h
struct i2c_driver {
//...
int (*suspend)(struct i2c_client *, pm_message_t mesg);
int (*resume)(struct i2c_client *);
//...
struct device_driver driver;
//...
}
include/linux/device.h
struct device_driver {
//...
int (*suspend) (struct device *dev, pm_message_t state);
int (*resume) (struct device *dev);
//...
const struct dev_pm_ops *pm;
//...
}
include/linux/pm.h
struct dev_pm_ops {
//...
int (*suspend)(struct device *dev);
int (*resume)(struct device *dev);
//...
}
为什么会有这么多挂起和恢复函数指针?某种遗产?我应该为我的驱动程序使用哪一个?
我使用的是旧内核(2.6.35)
谢谢!