提交 961f80f9 编写于 作者: J Jean Delvare 提交者: Jean Delvare

i2c: Drivers stop using the redundant client list

The redundant i2c client list maintained by i2c-core is going away
soon, so drivers should stop using it now. Instead, they can use the
standard iterator provided by the device driver model
(device_for_each_child).
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Michael Hunold <michael@mihu.de>
上级 9b766b81
...@@ -87,11 +87,24 @@ struct dpc ...@@ -87,11 +87,24 @@ struct dpc
int cur_input; /* current input */ int cur_input; /* current input */
}; };
static int dpc_check_clients(struct device *dev, void *data)
{
struct dpc* dpc = data;
struct i2c_client *client = i2c_verify_client(dev);
if( !client )
return 0;
if( I2C_SAA7111A == client->addr )
dpc->saa7111a = client;
return 0;
}
/* fixme: add vbi stuff here */ /* fixme: add vbi stuff here */
static int dpc_probe(struct saa7146_dev* dev) static int dpc_probe(struct saa7146_dev* dev)
{ {
struct dpc* dpc = NULL; struct dpc* dpc = NULL;
struct i2c_client *client;
dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL); dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL);
if( NULL == dpc ) { if( NULL == dpc ) {
...@@ -115,9 +128,7 @@ static int dpc_probe(struct saa7146_dev* dev) ...@@ -115,9 +128,7 @@ static int dpc_probe(struct saa7146_dev* dev)
} }
/* loop through all i2c-devices on the bus and look who is there */ /* loop through all i2c-devices on the bus and look who is there */
list_for_each_entry(client, &dpc->i2c_adapter.clients, list) device_for_each_child(&dpc->i2c_adapter.dev, dpc, dpc_check_clients);
if( I2C_SAA7111A == client->addr )
dpc->saa7111a = client;
/* check if all devices are present */ /* check if all devices are present */
if( 0 == dpc->saa7111a ) { if( 0 == dpc->saa7111a ) {
......
...@@ -149,10 +149,33 @@ struct mxb ...@@ -149,10 +149,33 @@ struct mxb
static struct saa7146_extension extension; static struct saa7146_extension extension;
static int mxb_check_clients(struct device *dev, void *data)
{
struct mxb* mxb = data;
struct i2c_client *client = i2c_verify_client(dev);
if( !client )
return 0;
if( I2C_ADDR_TEA6420_1 == client->addr )
mxb->tea6420_1 = client;
if( I2C_ADDR_TEA6420_2 == client->addr )
mxb->tea6420_2 = client;
if( I2C_TEA6415C_2 == client->addr )
mxb->tea6415c = client;
if( I2C_ADDR_TDA9840 == client->addr )
mxb->tda9840 = client;
if( I2C_SAA7111 == client->addr )
mxb->saa7111a = client;
if( 0x60 == client->addr )
mxb->tuner = client;
return 0;
}
static int mxb_probe(struct saa7146_dev* dev) static int mxb_probe(struct saa7146_dev* dev)
{ {
struct mxb* mxb = NULL; struct mxb* mxb = NULL;
struct i2c_client *client;
int result; int result;
if ((result = request_module("saa7111")) < 0) { if ((result = request_module("saa7111")) < 0) {
...@@ -195,20 +218,7 @@ static int mxb_probe(struct saa7146_dev* dev) ...@@ -195,20 +218,7 @@ static int mxb_probe(struct saa7146_dev* dev)
} }
/* loop through all i2c-devices on the bus and look who is there */ /* loop through all i2c-devices on the bus and look who is there */
list_for_each_entry(client, &mxb->i2c_adapter.clients, list) { device_for_each_child(&mxb->i2c_adapter.dev, mxb, mxb_check_clients);
if( I2C_ADDR_TEA6420_1 == client->addr )
mxb->tea6420_1 = client;
if( I2C_ADDR_TEA6420_2 == client->addr )
mxb->tea6420_2 = client;
if( I2C_TEA6415C_2 == client->addr )
mxb->tea6415c = client;
if( I2C_ADDR_TDA9840 == client->addr )
mxb->tda9840 = client;
if( I2C_SAA7111 == client->addr )
mxb->saa7111a = client;
if( 0x60 == client->addr )
mxb->tuner = client;
}
/* check if all devices are present */ /* check if all devices are present */
if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册