diff options
author | Thierry MERLE <thierry.merle@free.fr> | 2007-04-14 15:23:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:37 -0400 |
commit | 1ff16c2091a557f8080eb62c087465a87e4330e9 (patch) | |
tree | 8ef85a69b53ea0f3c45118d1b24005b297338d3f /drivers/media/video/usbvision | |
parent | d3df9c4fa13db14cb9f6cd4cf31bd2a61c0e9911 (diff) |
V4L/DVB (5522): Usbvision: i2c function cleanups
usbvision-i2c function renamings, code cleanup
Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvision')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-core.c | 2 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision-i2c.c | 136 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 12 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision.h | 6 |
4 files changed, 66 insertions, 90 deletions
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index fee4548a9cc7..bcb551adb7e6 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c | |||
@@ -2238,7 +2238,7 @@ static void call_usbvision_power_off(struct work_struct *work) | |||
2238 | PDEBUG(DBG_FUNC, ""); | 2238 | PDEBUG(DBG_FUNC, ""); |
2239 | down_interruptible(&usbvision->lock); | 2239 | down_interruptible(&usbvision->lock); |
2240 | if(usbvision->user == 0) { | 2240 | if(usbvision->user == 0) { |
2241 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 2241 | usbvision_i2c_unregister(usbvision); |
2242 | 2242 | ||
2243 | usbvision_power_off(usbvision); | 2243 | usbvision_power_off(usbvision); |
2244 | usbvision->initialized = 0; | 2244 | usbvision->initialized = 0; |
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index 609e1fd9c784..7a28081eb934 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * I2C_ALGO_USB.C | 2 | * usbvision_i2c.c |
3 | * i2c algorithm for USB-I2C Bridges | 3 | * i2c algorithm for USB-I2C Bridges |
4 | * | 4 | * |
5 | * Copyright (c) 1999-2005 Joerg Heckenbach <joerg@heckenbach-aw.de> | 5 | * Copyright (c) 1999-2007 Joerg Heckenbach <joerg@heckenbach-aw.de> |
6 | * Dwaine Garden <dwainegarden@rogers.com> | 6 | * Dwaine Garden <dwainegarden@rogers.com> |
7 | * | 7 | * |
8 | * This module is part of usbvision driver project. | 8 | * This module is part of usbvision driver project. |
@@ -39,7 +39,6 @@ | |||
39 | #include "usbvision.h" | 39 | #include "usbvision.h" |
40 | 40 | ||
41 | #define DBG_I2C 1<<0 | 41 | #define DBG_I2C 1<<0 |
42 | #define DBG_ALGO 1<<1 | ||
43 | 42 | ||
44 | static int i2c_debug = 0; | 43 | static int i2c_debug = 0; |
45 | 44 | ||
@@ -49,22 +48,22 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); | |||
49 | #define PDEBUG(level, fmt, args...) \ | 48 | #define PDEBUG(level, fmt, args...) \ |
50 | if (i2c_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) | 49 | if (i2c_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) |
51 | 50 | ||
52 | static int usbvision_i2c_write(void *data, unsigned char addr, char *buf, | 51 | static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf, |
53 | short len); | 52 | short len); |
54 | static int usbvision_i2c_read(void *data, unsigned char addr, char *buf, | 53 | static int usbvision_i2c_read(struct usb_usbvision *usbvision, unsigned char addr, char *buf, |
55 | short len); | 54 | short len); |
56 | 55 | ||
57 | static inline int try_write_address(struct i2c_adapter *i2c_adap, | 56 | static inline int try_write_address(struct i2c_adapter *i2c_adap, |
58 | unsigned char addr, int retries) | 57 | unsigned char addr, int retries) |
59 | { | 58 | { |
60 | void *data; | 59 | struct usb_usbvision *usbvision; |
61 | int i, ret = -1; | 60 | int i, ret = -1; |
62 | char buf[4]; | 61 | char buf[4]; |
63 | 62 | ||
64 | data = i2c_get_adapdata(i2c_adap); | 63 | usbvision = i2c_get_adapdata(i2c_adap); |
65 | buf[0] = 0x00; | 64 | buf[0] = 0x00; |
66 | for (i = 0; i <= retries; i++) { | 65 | for (i = 0; i <= retries; i++) { |
67 | ret = (usbvision_i2c_write(data, addr, buf, 1)); | 66 | ret = (usbvision_i2c_write(usbvision, addr, buf, 1)); |
68 | if (ret == 1) | 67 | if (ret == 1) |
69 | break; /* success! */ | 68 | break; /* success! */ |
70 | udelay(5); | 69 | udelay(5); |
@@ -73,8 +72,8 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap, | |||
73 | udelay(10); | 72 | udelay(10); |
74 | } | 73 | } |
75 | if (i) { | 74 | if (i) { |
76 | PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr); | 75 | PDEBUG(DBG_I2C,"Needed %d retries for address %#2x", i, addr); |
77 | PDEBUG(DBG_ALGO,"Maybe there's no device at this address"); | 76 | PDEBUG(DBG_I2C,"Maybe there's no device at this address"); |
78 | } | 77 | } |
79 | return ret; | 78 | return ret; |
80 | } | 79 | } |
@@ -82,13 +81,13 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap, | |||
82 | static inline int try_read_address(struct i2c_adapter *i2c_adap, | 81 | static inline int try_read_address(struct i2c_adapter *i2c_adap, |
83 | unsigned char addr, int retries) | 82 | unsigned char addr, int retries) |
84 | { | 83 | { |
85 | void *data; | 84 | struct usb_usbvision *usbvision; |
86 | int i, ret = -1; | 85 | int i, ret = -1; |
87 | char buf[4]; | 86 | char buf[4]; |
88 | 87 | ||
89 | data = i2c_get_adapdata(i2c_adap); | 88 | usbvision = i2c_get_adapdata(i2c_adap); |
90 | for (i = 0; i <= retries; i++) { | 89 | for (i = 0; i <= retries; i++) { |
91 | ret = (usbvision_i2c_read(data, addr, buf, 1)); | 90 | ret = (usbvision_i2c_read(usbvision, addr, buf, 1)); |
92 | if (ret == 1) | 91 | if (ret == 1) |
93 | break; /* success! */ | 92 | break; /* success! */ |
94 | udelay(5); | 93 | udelay(5); |
@@ -97,8 +96,8 @@ static inline int try_read_address(struct i2c_adapter *i2c_adap, | |||
97 | udelay(10); | 96 | udelay(10); |
98 | } | 97 | } |
99 | if (i) { | 98 | if (i) { |
100 | PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr); | 99 | PDEBUG(DBG_I2C,"Needed %d retries for address %#2x", i, addr); |
101 | PDEBUG(DBG_ALGO,"Maybe there's no device at this address"); | 100 | PDEBUG(DBG_I2C,"Maybe there's no device at this address"); |
102 | } | 101 | } |
103 | return ret; | 102 | return ret; |
104 | } | 103 | } |
@@ -152,32 +151,31 @@ static inline int usb_find_address(struct i2c_adapter *i2c_adap, | |||
152 | } | 151 | } |
153 | 152 | ||
154 | static int | 153 | static int |
155 | usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) | 154 | usbvision_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) |
156 | { | 155 | { |
157 | struct i2c_msg *pmsg; | 156 | struct i2c_msg *pmsg; |
158 | void *data; | 157 | struct usb_usbvision *usbvision; |
159 | int i, ret; | 158 | int i, ret; |
160 | unsigned char addr; | 159 | unsigned char addr; |
161 | 160 | ||
162 | data = i2c_get_adapdata(i2c_adap); | 161 | usbvision = i2c_get_adapdata(i2c_adap); |
163 | |||
164 | for (i = 0; i < num; i++) { | 162 | for (i = 0; i < num; i++) { |
165 | pmsg = &msgs[i]; | 163 | pmsg = &msgs[i]; |
166 | ret = usb_find_address(i2c_adap, pmsg, i2c_adap->retries, &addr); | 164 | ret = usb_find_address(i2c_adap, pmsg, i2c_adap->retries, &addr); |
167 | if (ret != 0) { | 165 | if (ret != 0) { |
168 | PDEBUG(DBG_ALGO,"got NAK from device, message #%d", i); | 166 | PDEBUG(DBG_I2C,"got NAK from device, message #%d", i); |
169 | return (ret < 0) ? ret : -EREMOTEIO; | 167 | return (ret < 0) ? ret : -EREMOTEIO; |
170 | } | 168 | } |
171 | 169 | ||
172 | if (pmsg->flags & I2C_M_RD) { | 170 | if (pmsg->flags & I2C_M_RD) { |
173 | /* read bytes into buffer */ | 171 | /* read bytes into buffer */ |
174 | ret = (usbvision_i2c_read(data, addr, pmsg->buf, pmsg->len)); | 172 | ret = (usbvision_i2c_read(usbvision, addr, pmsg->buf, pmsg->len)); |
175 | if (ret < pmsg->len) { | 173 | if (ret < pmsg->len) { |
176 | return (ret < 0) ? ret : -EREMOTEIO; | 174 | return (ret < 0) ? ret : -EREMOTEIO; |
177 | } | 175 | } |
178 | } else { | 176 | } else { |
179 | /* write bytes from buffer */ | 177 | /* write bytes from buffer */ |
180 | ret = (usbvision_i2c_write(data, addr, pmsg->buf, pmsg->len)); | 178 | ret = (usbvision_i2c_write(usbvision, addr, pmsg->buf, pmsg->len)); |
181 | if (ret < pmsg->len) { | 179 | if (ret < pmsg->len) { |
182 | return (ret < 0) ? ret : -EREMOTEIO; | 180 | return (ret < 0) ? ret : -EREMOTEIO; |
183 | } | 181 | } |
@@ -191,7 +189,7 @@ static int algo_control(struct i2c_adapter *adapter, unsigned int cmd, unsigned | |||
191 | return 0; | 189 | return 0; |
192 | } | 190 | } |
193 | 191 | ||
194 | static u32 usb_func(struct i2c_adapter *adap) | 192 | static u32 functionality(struct i2c_adapter *adap) |
195 | { | 193 | { |
196 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; | 194 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; |
197 | } | 195 | } |
@@ -199,73 +197,44 @@ static u32 usb_func(struct i2c_adapter *adap) | |||
199 | 197 | ||
200 | /* -----exported algorithm data: ------------------------------------- */ | 198 | /* -----exported algorithm data: ------------------------------------- */ |
201 | 199 | ||
202 | static struct i2c_algorithm i2c_usb_algo = { | 200 | static struct i2c_algorithm usbvision_algo = { |
203 | .master_xfer = usb_xfer, | 201 | .master_xfer = usbvision_i2c_xfer, |
204 | .smbus_xfer = NULL, | 202 | .smbus_xfer = NULL, |
205 | .algo_control = algo_control, | 203 | .algo_control = algo_control, |
206 | .functionality = usb_func, | 204 | .functionality = functionality, |
207 | }; | 205 | }; |
208 | 206 | ||
209 | 207 | ||
210 | /* | ||
211 | * registering functions to load algorithms at runtime | ||
212 | */ | ||
213 | static int usbvision_i2c_usb_add_bus(struct i2c_adapter *adap) | ||
214 | { | ||
215 | PDEBUG(DBG_I2C, "I2C debugging is enabled [i2c]"); | ||
216 | PDEBUG(DBG_ALGO, "ALGO debugging is enabled [i2c]"); | ||
217 | |||
218 | /* register new adapter to i2c module... */ | ||
219 | |||
220 | adap->algo = &i2c_usb_algo; | ||
221 | |||
222 | adap->timeout = 100; /* default values, should */ | ||
223 | adap->retries = 3; /* be replaced by defines */ | ||
224 | |||
225 | i2c_add_adapter(adap); | ||
226 | |||
227 | PDEBUG(DBG_ALGO,"i2c bus for %s registered", adap->name); | ||
228 | |||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | |||
233 | int usbvision_i2c_usb_del_bus(struct i2c_adapter *adap) | ||
234 | { | ||
235 | |||
236 | i2c_del_adapter(adap); | ||
237 | |||
238 | PDEBUG(DBG_ALGO,"i2c bus for %s unregistered", adap->name); | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | |||
244 | /* ----------------------------------------------------------------------- */ | 208 | /* ----------------------------------------------------------------------- */ |
245 | /* usbvision specific I2C functions */ | 209 | /* usbvision specific I2C functions */ |
246 | /* ----------------------------------------------------------------------- */ | 210 | /* ----------------------------------------------------------------------- */ |
247 | static struct i2c_adapter i2c_adap_template; | 211 | static struct i2c_adapter i2c_adap_template; |
248 | static struct i2c_client i2c_client_template; | 212 | static struct i2c_client i2c_client_template; |
249 | 213 | ||
250 | int usbvision_init_i2c(struct usb_usbvision *usbvision) | 214 | int usbvision_i2c_register(struct usb_usbvision *usbvision) |
251 | { | 215 | { |
252 | memcpy(&usbvision->i2c_adap, &i2c_adap_template, | 216 | int ret; |
253 | sizeof(struct i2c_adapter)); | ||
254 | memcpy(&usbvision->i2c_client, &i2c_client_template, | ||
255 | sizeof(struct i2c_client)); | ||
256 | 217 | ||
257 | sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name), | 218 | usbvision->i2c_adap = i2c_adap_template; |
258 | " #%d", usbvision->vdev->minor & 0x1f); | ||
259 | PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name); | ||
260 | usbvision->i2c_adap.dev.parent = &usbvision->dev->dev; | 219 | usbvision->i2c_adap.dev.parent = &usbvision->dev->dev; |
261 | 220 | ||
262 | i2c_set_adapdata(&usbvision->i2c_adap, usbvision); | 221 | PDEBUG(DBG_I2C, "I2C debugging is enabled [i2c]"); |
263 | i2c_set_clientdata(&usbvision->i2c_client, usbvision); | ||
264 | 222 | ||
223 | sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name), | ||
224 | " #%d", usbvision->vdev->minor & 0x1f); | ||
225 | PDEBUG(DBG_I2C,"I2C Registering adaptername: %s", usbvision->i2c_adap.name); | ||
226 | i2c_set_adapdata(&usbvision->i2c_adap,usbvision); | ||
227 | if ((ret = i2c_add_adapter(&usbvision->i2c_adap)) < 0) { | ||
228 | PDEBUG(DBG_I2C,"could not add I2C adapter %s", usbvision->i2c_adap.name); | ||
229 | return ret; | ||
230 | } | ||
231 | |||
232 | /* TODO: use i2c_client for eeprom detection as an example... */ | ||
233 | usbvision->i2c_client = i2c_client_template; | ||
265 | usbvision->i2c_client.adapter = &usbvision->i2c_adap; | 234 | usbvision->i2c_client.adapter = &usbvision->i2c_adap; |
266 | 235 | ||
267 | if (usbvision_write_reg(usbvision, USBVISION_SER_MODE, USBVISION_IIC_LRNACK) < 0) { | 236 | if (usbvision_write_reg(usbvision, USBVISION_SER_MODE, USBVISION_IIC_LRNACK) < 0) { |
268 | printk(KERN_ERR "usbvision_init_i2c: can't write reg\n"); | 237 | printk(KERN_ERR "usbvision_i2c_register: can't write reg\n"); |
269 | return -EBUSY; | 238 | return -EBUSY; |
270 | } | 239 | } |
271 | 240 | ||
@@ -284,7 +253,17 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision) | |||
284 | } | 253 | } |
285 | #endif | 254 | #endif |
286 | 255 | ||
287 | return usbvision_i2c_usb_add_bus(&usbvision->i2c_adap); | 256 | return 0; |
257 | } | ||
258 | |||
259 | int usbvision_i2c_unregister(struct usb_usbvision *usbvision) | ||
260 | { | ||
261 | |||
262 | i2c_del_adapter(&(usbvision->i2c_adap)); | ||
263 | |||
264 | PDEBUG(DBG_I2C,"i2c bus for %s unregistered", usbvision->i2c_adap.name); | ||
265 | |||
266 | return 0; | ||
288 | } | 267 | } |
289 | 268 | ||
290 | void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd, | 269 | void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd, |
@@ -297,8 +276,7 @@ static int attach_inform(struct i2c_client *client) | |||
297 | { | 276 | { |
298 | struct usb_usbvision *usbvision; | 277 | struct usb_usbvision *usbvision; |
299 | 278 | ||
300 | usbvision = (struct usb_usbvision *)i2c_get_adapdata(client->adapter); | 279 | usbvision = i2c_get_adapdata(client->adapter); |
301 | |||
302 | switch (client->addr << 1) { | 280 | switch (client->addr << 1) { |
303 | case 0x43: | 281 | case 0x43: |
304 | case 0x4b: | 282 | case 0x4b: |
@@ -349,7 +327,7 @@ static int detach_inform(struct i2c_client *client) | |||
349 | { | 327 | { |
350 | struct usb_usbvision *usbvision; | 328 | struct usb_usbvision *usbvision; |
351 | 329 | ||
352 | usbvision = (struct usb_usbvision *)i2c_get_adapdata(client->adapter); | 330 | usbvision = i2c_get_adapdata(client->adapter); |
353 | 331 | ||
354 | PDEBUG(DBG_I2C,"usbvision[%d] detaches %s", usbvision->nr, client->name); | 332 | PDEBUG(DBG_I2C,"usbvision[%d] detaches %s", usbvision->nr, client->name); |
355 | return 0; | 333 | return 0; |
@@ -480,7 +458,7 @@ static int usbvision_i2c_write_max4(struct usb_usbvision *usbvision, | |||
480 | return len; | 458 | return len; |
481 | } | 459 | } |
482 | 460 | ||
483 | static int usbvision_i2c_write(void *data, unsigned char addr, char *buf, | 461 | static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf, |
484 | short len) | 462 | short len) |
485 | { | 463 | { |
486 | char *bufPtr = buf; | 464 | char *bufPtr = buf; |
@@ -488,7 +466,6 @@ static int usbvision_i2c_write(void *data, unsigned char addr, char *buf, | |||
488 | int wrcount = 0; | 466 | int wrcount = 0; |
489 | int count; | 467 | int count; |
490 | int maxLen = 4; | 468 | int maxLen = 4; |
491 | struct usb_usbvision *usbvision = (struct usb_usbvision *) data; | ||
492 | 469 | ||
493 | while (len > 0) { | 470 | while (len > 0) { |
494 | count = (len > maxLen) ? maxLen : len; | 471 | count = (len > maxLen) ? maxLen : len; |
@@ -503,14 +480,13 @@ static int usbvision_i2c_write(void *data, unsigned char addr, char *buf, | |||
503 | return wrcount; | 480 | return wrcount; |
504 | } | 481 | } |
505 | 482 | ||
506 | static int usbvision_i2c_read(void *data, unsigned char addr, char *buf, | 483 | static int usbvision_i2c_read(struct usb_usbvision *usbvision, unsigned char addr, char *buf, |
507 | short len) | 484 | short len) |
508 | { | 485 | { |
509 | char temp[4]; | 486 | char temp[4]; |
510 | int retval, i; | 487 | int retval, i; |
511 | int rdcount = 0; | 488 | int rdcount = 0; |
512 | int count; | 489 | int count; |
513 | struct usb_usbvision *usbvision = (struct usb_usbvision *) data; | ||
514 | 490 | ||
515 | while (len > 0) { | 491 | while (len > 0) { |
516 | count = (len > 3) ? 4 : len; | 492 | count = (len > 3) ? 4 : len; |
@@ -530,6 +506,8 @@ static struct i2c_adapter i2c_adap_template = { | |||
530 | .owner = THIS_MODULE, | 506 | .owner = THIS_MODULE, |
531 | .name = "usbvision", | 507 | .name = "usbvision", |
532 | .id = I2C_HW_B_BT848, /* FIXME */ | 508 | .id = I2C_HW_B_BT848, /* FIXME */ |
509 | .algo = &usbvision_algo, | ||
510 | .algo_data = NULL, | ||
533 | .client_register = attach_inform, | 511 | .client_register = attach_inform, |
534 | .client_unregister = detach_inform, | 512 | .client_unregister = detach_inform, |
535 | #ifdef I2C_ADAP_CLASS_TV_ANALOG | 513 | #ifdef I2C_ADAP_CLASS_TV_ANALOG |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 5fb89e407f08..04131cebf395 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -410,7 +410,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
410 | down(&usbvision->lock); | 410 | down(&usbvision->lock); |
411 | if (usbvision->power == 0) { | 411 | if (usbvision->power == 0) { |
412 | usbvision_power_on(usbvision); | 412 | usbvision_power_on(usbvision); |
413 | usbvision_init_i2c(usbvision); | 413 | usbvision_i2c_register(usbvision); |
414 | } | 414 | } |
415 | 415 | ||
416 | /* Send init sequence only once, it's large! */ | 416 | /* Send init sequence only once, it's large! */ |
@@ -432,7 +432,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
432 | } | 432 | } |
433 | else { | 433 | else { |
434 | if (PowerOnAtOpen) { | 434 | if (PowerOnAtOpen) { |
435 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 435 | usbvision_i2c_unregister(usbvision); |
436 | usbvision_power_off(usbvision); | 436 | usbvision_power_off(usbvision); |
437 | usbvision->initialized = 0; | 437 | usbvision->initialized = 0; |
438 | } | 438 | } |
@@ -1240,7 +1240,7 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) | |||
1240 | usbvision_reset_powerOffTimer(usbvision); | 1240 | usbvision_reset_powerOffTimer(usbvision); |
1241 | if (usbvision->power == 0) { | 1241 | if (usbvision->power == 0) { |
1242 | usbvision_power_on(usbvision); | 1242 | usbvision_power_on(usbvision); |
1243 | usbvision_init_i2c(usbvision); | 1243 | usbvision_i2c_register(usbvision); |
1244 | } | 1244 | } |
1245 | } | 1245 | } |
1246 | 1246 | ||
@@ -1262,7 +1262,7 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) | |||
1262 | 1262 | ||
1263 | if (errCode) { | 1263 | if (errCode) { |
1264 | if (PowerOnAtOpen) { | 1264 | if (PowerOnAtOpen) { |
1265 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 1265 | usbvision_i2c_unregister(usbvision); |
1266 | usbvision_power_off(usbvision); | 1266 | usbvision_power_off(usbvision); |
1267 | usbvision->initialized = 0; | 1267 | usbvision->initialized = 0; |
1268 | } | 1268 | } |
@@ -1765,7 +1765,7 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) | |||
1765 | usbvision_audio_off(usbvision); //first switch off audio | 1765 | usbvision_audio_off(usbvision); //first switch off audio |
1766 | if (!PowerOnAtOpen) { | 1766 | if (!PowerOnAtOpen) { |
1767 | usbvision_power_on(usbvision); //and then power up the noisy tuner | 1767 | usbvision_power_on(usbvision); //and then power up the noisy tuner |
1768 | usbvision_init_i2c(usbvision); | 1768 | usbvision_i2c_register(usbvision); |
1769 | } | 1769 | } |
1770 | } | 1770 | } |
1771 | 1771 | ||
@@ -1913,7 +1913,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) | |||
1913 | usbvision_stop_isoc(usbvision); | 1913 | usbvision_stop_isoc(usbvision); |
1914 | 1914 | ||
1915 | if (usbvision->power) { | 1915 | if (usbvision->power) { |
1916 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 1916 | usbvision_i2c_unregister(usbvision); |
1917 | usbvision_power_off(usbvision); | 1917 | usbvision_power_off(usbvision); |
1918 | } | 1918 | } |
1919 | usbvision->remove_pending = 1; // Now all ISO data will be ignored | 1919 | usbvision->remove_pending = 1; // Now all ISO data will be ignored |
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index 9cad77733400..bd6f6422ed54 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h | |||
@@ -482,13 +482,11 @@ struct usb_usbvision { | |||
482 | /* i2c-algo-usb declaration */ | 482 | /* i2c-algo-usb declaration */ |
483 | /* --------------------------------------------------------------- */ | 483 | /* --------------------------------------------------------------- */ |
484 | 484 | ||
485 | int usbvision_i2c_usb_del_bus(struct i2c_adapter *); | ||
486 | |||
487 | |||
488 | /* ----------------------------------------------------------------------- */ | 485 | /* ----------------------------------------------------------------------- */ |
489 | /* usbvision specific I2C functions */ | 486 | /* usbvision specific I2C functions */ |
490 | /* ----------------------------------------------------------------------- */ | 487 | /* ----------------------------------------------------------------------- */ |
491 | int usbvision_init_i2c(struct usb_usbvision *usbvision); | 488 | int usbvision_i2c_register(struct usb_usbvision *usbvision); |
489 | int usbvision_i2c_unregister(struct usb_usbvision *usbvision); | ||
492 | void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd,void *arg); | 490 | void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd,void *arg); |
493 | 491 | ||
494 | /* defined in usbvision-core.c */ | 492 | /* defined in usbvision-core.c */ |