ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2014年2月26日 星期三

i2c bus, id match

wm8580.
static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
                                                const struct i2c_client *client)
{
        while (id->name[0]) {
                if (strcmp(client->name, id->name) == 0)
                        return id;
                id++;
        }
        return NULL;
}
所以是比較 name

static int i2c_device_probe(struct device *dev)
{
        struct i2c_client       *client = i2c_verify_client(dev);
        struct i2c_driver       *driver;
        int status;

        printk("i2c_device_probe\n");

        if (!client)
                return 0;

        driver = to_i2c_driver(dev->driver);
        if (!driver->probe || !driver->id_table)
                return -ENODEV;
        client->driver = driver;
        if (!device_can_wakeup(&client->dev))
                device_init_wakeup(&client->dev,
                                        client->flags & I2C_CLIENT_WAKE);
        dev_dbg(dev, "probe\n");

        status = driver->probe(client, i2c_match_id(driver->id_table, client));
        if (status) {
                client->driver = NULL;
                i2c_set_clientdata(client, NULL);
        }
        return status;
}

沒有留言:

標籤

網誌存檔