aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/usbvision/usbvision-i2c.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c
index 92bf9a1f1e2c..0f3fba7ea6fe 100644
--- a/drivers/media/video/usbvision/usbvision-i2c.c
+++ b/drivers/media/video/usbvision/usbvision-i2c.c
@@ -50,6 +50,11 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
50#define PDEBUG(level, fmt, args...) \ 50#define PDEBUG(level, fmt, args...) \
51 if (i2c_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) 51 if (i2c_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args)
52 52
53static int usbvision_i2c_write(void *data, unsigned char addr, char *buf,
54 short len);
55static int usbvision_i2c_read(void *data, unsigned char addr, char *buf,
56 short len);
57
53static inline int try_write_address(struct i2c_adapter *i2c_adap, 58static inline int try_write_address(struct i2c_adapter *i2c_adap,
54 unsigned char addr, int retries) 59 unsigned char addr, int retries)
55{ 60{
@@ -61,7 +66,7 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap,
61 data = i2c_get_adapdata(i2c_adap); 66 data = i2c_get_adapdata(i2c_adap);
62 buf[0] = 0x00; 67 buf[0] = 0x00;
63 for (i = 0; i <= retries; i++) { 68 for (i = 0; i <= retries; i++) {
64 ret = (adap->outb(data, addr, buf, 1)); 69 ret = (usbvision_i2c_write(data, addr, buf, 1));
65 if (ret == 1) 70 if (ret == 1)
66 break; /* success! */ 71 break; /* success! */
67 udelay(5 /*adap->udelay */ ); 72 udelay(5 /*adap->udelay */ );
@@ -86,7 +91,7 @@ static inline int try_read_address(struct i2c_adapter *i2c_adap,
86 91
87 data = i2c_get_adapdata(i2c_adap); 92 data = i2c_get_adapdata(i2c_adap);
88 for (i = 0; i <= retries; i++) { 93 for (i = 0; i <= retries; i++) {
89 ret = (adap->inb(data, addr, buf, 1)); 94 ret = (usbvision_i2c_read(data, addr, buf, 1));
90 if (ret == 1) 95 if (ret == 1)
91 break; /* success! */ 96 break; /* success! */
92 udelay(5 /*adap->udelay */ ); 97 udelay(5 /*adap->udelay */ );
@@ -153,7 +158,6 @@ static int
153usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) 158usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
154{ 159{
155 struct i2c_msg *pmsg; 160 struct i2c_msg *pmsg;
156 struct i2c_algo_usb_data *adap = i2c_adap->algo_data;
157 void *data; 161 void *data;
158 int i, ret; 162 int i, ret;
159 unsigned char addr; 163 unsigned char addr;
@@ -170,13 +174,13 @@ usb_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
170 174
171 if (pmsg->flags & I2C_M_RD) { 175 if (pmsg->flags & I2C_M_RD) {
172 /* read bytes into buffer */ 176 /* read bytes into buffer */
173 ret = (adap->inb(data, addr, pmsg->buf, pmsg->len)); 177 ret = (usbvision_i2c_read(data, addr, pmsg->buf, pmsg->len));
174 if (ret < pmsg->len) { 178 if (ret < pmsg->len) {
175 return (ret < 0) ? ret : -EREMOTEIO; 179 return (ret < 0) ? ret : -EREMOTEIO;
176 } 180 }
177 } else { 181 } else {
178 /* write bytes from buffer */ 182 /* write bytes from buffer */
179 ret = (adap->outb(data, addr, pmsg->buf, pmsg->len)); 183 ret = (usbvision_i2c_write(data, addr, pmsg->buf, pmsg->len));
180 if (ret < pmsg->len) { 184 if (ret < pmsg->len) {
181 return (ret < 0) ? ret : -EREMOTEIO; 185 return (ret < 0) ? ret : -EREMOTEIO;
182 } 186 }