diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-27 12:14:51 -0500 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-01-27 12:14:51 -0500 |
commit | 961f80f9c0c0f7c45d7818f9c9969dfaa9e4463d (patch) | |
tree | d3ff59a63689c933a0cdf2f975b5b354eb888588 /drivers/media | |
parent | 9b766b814d6a5f31ca1e9da1ebc08164b9352941 (diff) |
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: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Michael Hunold <michael@mihu.de>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/dpc7146.c | 19 | ||||
-rw-r--r-- | drivers/media/video/mxb.c | 40 |
2 files changed, 40 insertions, 19 deletions
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c index 255dae303708..566e479e2629 100644 --- a/drivers/media/video/dpc7146.c +++ b/drivers/media/video/dpc7146.c | |||
@@ -87,11 +87,24 @@ struct dpc | |||
87 | int cur_input; /* current input */ | 87 | int cur_input; /* current input */ |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static int dpc_check_clients(struct device *dev, void *data) | ||
91 | { | ||
92 | struct dpc* dpc = data; | ||
93 | struct i2c_client *client = i2c_verify_client(dev); | ||
94 | |||
95 | if( !client ) | ||
96 | return 0; | ||
97 | |||
98 | if( I2C_SAA7111A == client->addr ) | ||
99 | dpc->saa7111a = client; | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
90 | /* fixme: add vbi stuff here */ | 104 | /* fixme: add vbi stuff here */ |
91 | static int dpc_probe(struct saa7146_dev* dev) | 105 | static int dpc_probe(struct saa7146_dev* dev) |
92 | { | 106 | { |
93 | struct dpc* dpc = NULL; | 107 | struct dpc* dpc = NULL; |
94 | struct i2c_client *client; | ||
95 | 108 | ||
96 | dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL); | 109 | dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL); |
97 | if( NULL == dpc ) { | 110 | if( NULL == dpc ) { |
@@ -115,9 +128,7 @@ static int dpc_probe(struct saa7146_dev* dev) | |||
115 | } | 128 | } |
116 | 129 | ||
117 | /* loop through all i2c-devices on the bus and look who is there */ | 130 | /* loop through all i2c-devices on the bus and look who is there */ |
118 | list_for_each_entry(client, &dpc->i2c_adapter.clients, list) | 131 | device_for_each_child(&dpc->i2c_adapter.dev, dpc, dpc_check_clients); |
119 | if( I2C_SAA7111A == client->addr ) | ||
120 | dpc->saa7111a = client; | ||
121 | 132 | ||
122 | /* check if all devices are present */ | 133 | /* check if all devices are present */ |
123 | if( 0 == dpc->saa7111a ) { | 134 | if( 0 == dpc->saa7111a ) { |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 98ad3092a079..add6d0d680be 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -149,10 +149,33 @@ struct mxb | |||
149 | 149 | ||
150 | static struct saa7146_extension extension; | 150 | static struct saa7146_extension extension; |
151 | 151 | ||
152 | static int mxb_check_clients(struct device *dev, void *data) | ||
153 | { | ||
154 | struct mxb* mxb = data; | ||
155 | struct i2c_client *client = i2c_verify_client(dev); | ||
156 | |||
157 | if( !client ) | ||
158 | return 0; | ||
159 | |||
160 | if( I2C_ADDR_TEA6420_1 == client->addr ) | ||
161 | mxb->tea6420_1 = client; | ||
162 | if( I2C_ADDR_TEA6420_2 == client->addr ) | ||
163 | mxb->tea6420_2 = client; | ||
164 | if( I2C_TEA6415C_2 == client->addr ) | ||
165 | mxb->tea6415c = client; | ||
166 | if( I2C_ADDR_TDA9840 == client->addr ) | ||
167 | mxb->tda9840 = client; | ||
168 | if( I2C_SAA7111 == client->addr ) | ||
169 | mxb->saa7111a = client; | ||
170 | if( 0x60 == client->addr ) | ||
171 | mxb->tuner = client; | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
152 | static int mxb_probe(struct saa7146_dev* dev) | 176 | static int mxb_probe(struct saa7146_dev* dev) |
153 | { | 177 | { |
154 | struct mxb* mxb = NULL; | 178 | struct mxb* mxb = NULL; |
155 | struct i2c_client *client; | ||
156 | int result; | 179 | int result; |
157 | 180 | ||
158 | if ((result = request_module("saa7111")) < 0) { | 181 | if ((result = request_module("saa7111")) < 0) { |
@@ -195,20 +218,7 @@ static int mxb_probe(struct saa7146_dev* dev) | |||
195 | } | 218 | } |
196 | 219 | ||
197 | /* loop through all i2c-devices on the bus and look who is there */ | 220 | /* loop through all i2c-devices on the bus and look who is there */ |
198 | list_for_each_entry(client, &mxb->i2c_adapter.clients, list) { | 221 | device_for_each_child(&mxb->i2c_adapter.dev, mxb, mxb_check_clients); |
199 | if( I2C_ADDR_TEA6420_1 == client->addr ) | ||
200 | mxb->tea6420_1 = client; | ||
201 | if( I2C_ADDR_TEA6420_2 == client->addr ) | ||
202 | mxb->tea6420_2 = client; | ||
203 | if( I2C_TEA6415C_2 == client->addr ) | ||
204 | mxb->tea6415c = client; | ||
205 | if( I2C_ADDR_TDA9840 == client->addr ) | ||
206 | mxb->tda9840 = client; | ||
207 | if( I2C_SAA7111 == client->addr ) | ||
208 | mxb->saa7111a = client; | ||
209 | if( 0x60 == client->addr ) | ||
210 | mxb->tuner = client; | ||
211 | } | ||
212 | 222 | ||
213 | /* check if all devices are present */ | 223 | /* check if all devices are present */ |
214 | if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c | 224 | if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c |