container_of 报出 warning: initialization from incompatible pointer type 解决办法

来源:互联网 发布:java工作经历怎么写 编辑:程序博客网 时间:2024/06/11 05:31

调试input 设备某sensor时候遇到一个有关container_of 报出 warning: initialization from incompatible pointer type 的警告。


这一切都是struct delayed_work work;惹的祸!


解决办法:

struct pcap_ts *pcap_ts = container_of(work, struct pcap_ts, work);


修改成


struct delayed_work *dw = container_of(work, struct delayed_work, work);
struct pcap_ts *pcap_ts = container_of(dw, struct pcap_ts, work);

或者

struct pcap_ts *pcap_ts = container_of(work, struct pcap_ts,work.work);

1 0
原创粉丝点击