驅動中id table的分析 Input I2C

2021-09-30 07:36:37 字數 1522 閱讀 9019

驅動中

id_table

的分析

一、i2c

驅動probe

***i2c_device_id

用於device

與drive

配對static const struct i2c_device_id tps65010_id = , ,

, ,,/* tps65011 charging at 6.5v max */

}; module_device_table(i2c, tps65010_id);

static struct i2c_driver tps65010_driver = ,

.probe= tps65010_probe,/* bus->match

成功後呼叫*/

.remove= __exit_p(tps65010_remove),

.id_table = tps65010_id,/*

用於i2c driver

的probe

函式呼叫*/

};struct bus_type i2c_bus_type = ;

int device_add(struct device *dev)->

bus_probe_device(dev)->

device_attach(dev)->

__device_attach->driver_match_device(drv, dev)

static inline int driver_match_device(struct device_driver *drv,

struct device *dev)

->driver_probe_device->really_probe->dev->bus->probe(dev)

二、input driver probe

機制input driver

與input handler

配對機制

static struct input_handler evbug_handler = ;

static int __init evbug_init(void)

input_attach_handler(dev, handler)->

input_match_device(handler, dev)->

handler->connect(handler, dev, id)

***handler & input driver

連線成功

id_table作用:

先看一下函式定義, 第二個引數為const struct i2c_device_id, id_table作用所在

static int tps65010_probe(struct i2c_client *client,

const struct i2c_device_id *id)

根據匹配的引數來確定型號

switch (tps->model)

author : woodpecker

南京 2010-09-25 21:06

關於platform中的id table

核心版本 linux 3.4.67 platform的match函式如下 platform match bind platform device to platform driver.dev device.drv driver.platform device ids are assumed to b...

驅動中的poll機制分析

核心 sys poll struct pollfd ufds,unsigned int nfds,long timeout mesecs do sys poll ufds,nfds,to poll initwait table 初始化乙個poll wqueues 變數table init poll ...

Linux中驅動程式的分析

核心中字元裝置結構體的定義 struct cdev linux核心對檔案操作file operations結構體的定義 struct file operations file operations 成員大部分是檔案指標,裝置不支援的指標置為null。驅動程式的檔案操作編寫如下 struct file...