aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-25 10:17:41 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-21 10:45:40 -0500
commit3af2f4f15a61b55469a8512d186221eaf7652eec (patch)
tree19159935bb870acdf526431ba8bcf5b479547c1d /drivers/media/dvb
parent81091144ebdb7bdc6197559cd3547d8be7e4e18e (diff)
[media] az6007: Change the az6007 read/write routine parameter
Use usb_device for those routines, as it allows using them on all places. While there, rename to better express the meaning. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/az6007.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/media/dvb/dvb-usb/az6007.c b/drivers/media/dvb/dvb-usb/az6007.c
index 03e318d2d4bf..f098e47102ee 100644
--- a/drivers/media/dvb/dvb-usb/az6007.c
+++ b/drivers/media/dvb/dvb-usb/az6007.c
@@ -96,13 +96,13 @@ static struct mt2063_config az6007_mt2063_config = {
96}; 96};
97 97
98/* check for mutex FIXME */ 98/* check for mutex FIXME */
99static int az6007_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, 99static int az6007_read(struct usb_device *udev, u8 req, u16 value,
100 u16 index, u8 *b, int blen) 100 u16 index, u8 *b, int blen)
101{ 101{
102 int ret = -1; 102 int ret = -1;
103 103
104 ret = usb_control_msg(d->udev, 104 ret = usb_control_msg(udev,
105 usb_rcvctrlpipe(d->udev, 0), 105 usb_rcvctrlpipe(udev, 0),
106 req, 106 req,
107 USB_TYPE_VENDOR | USB_DIR_IN, 107 USB_TYPE_VENDOR | USB_DIR_IN,
108 value, index, b, blen, 5000); 108 value, index, b, blen, 5000);
@@ -119,7 +119,7 @@ static int az6007_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,
119 return ret; 119 return ret;
120} 120}
121 121
122static int az6007_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, 122static int az6007_write(struct usb_device *udev, u8 req, u16 value,
123 u16 index, u8 *b, int blen) 123 u16 index, u8 *b, int blen)
124{ 124{
125 int ret; 125 int ret;
@@ -134,8 +134,8 @@ static int az6007_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
134 return -EOPNOTSUPP; 134 return -EOPNOTSUPP;
135 } 135 }
136 136
137 ret = usb_control_msg(d->udev, 137 ret = usb_control_msg(udev,
138 usb_sndctrlpipe(d->udev, 0), 138 usb_sndctrlpipe(udev, 0),
139 req, 139 req,
140 USB_TYPE_VENDOR | USB_DIR_OUT, 140 USB_TYPE_VENDOR | USB_DIR_OUT,
141 value, index, b, blen, 5000); 141 value, index, b, blen, 5000);
@@ -168,7 +168,7 @@ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
168 168
169 /* remove the following return to enabled remote querying */ 169 /* remove the following return to enabled remote querying */
170 170
171 az6007_usb_in_op(d, READ_REMOTE_REQ, 0, 0, key, 10); 171 az6007_read(d->udev, READ_REMOTE_REQ, 0, 0, key, 10);
172 172
173 deb_rc("remote query key: %x %d\n", key[1], key[1]); 173 deb_rc("remote query key: %x %d\n", key[1], key[1]);
174 174
@@ -191,13 +191,13 @@ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
191int az6007_power_ctrl(struct dvb_usb_device *d, int onoff) 191int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
192{ 192{
193 u8 v = onoff; 193 u8 v = onoff;
194 return az6007_usb_out_op(d,0xBC,v,3,NULL,1); 194 return az6007_write(d->udev,0xBC,v,3,NULL,1);
195} 195}
196*/ 196*/
197 197
198static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6]) 198static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
199{ 199{
200 az6007_usb_in_op(d, 0xb7, 6, 0, &mac[0], 6); 200 az6007_read(d->udev, 0xb7, 6, 0, &mac[0], 6);
201 return 0; 201 return 0;
202} 202}
203 203
@@ -212,19 +212,19 @@ static int az6007_frontend_poweron(struct dvb_usb_adapter *adap)
212 deb_info("az6007_frontend_poweron adap=%p adap->dev=%p\n", 212 deb_info("az6007_frontend_poweron adap=%p adap->dev=%p\n",
213 adap, adap->dev); 213 adap, adap->dev);
214 214
215 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 0, 2, NULL, 0); 215 az6007_write(d->udev, AZ6007_POWER /* 0xbc */, 0, 2, NULL, 0);
216 msleep(150); 216 msleep(150);
217 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 1, 4, NULL, 0); 217 az6007_write(d->udev, AZ6007_POWER /* 0xbc */, 1, 4, NULL, 0);
218 msleep(100); 218 msleep(100);
219 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 1, 3, NULL, 0); 219 az6007_write(d->udev, AZ6007_POWER /* 0xbc */, 1, 3, NULL, 0);
220 msleep(100); 220 msleep(100);
221 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 1, 4, NULL, 0); 221 az6007_write(d->udev, AZ6007_POWER /* 0xbc */, 1, 4, NULL, 0);
222 msleep(100); 222 msleep(100);
223 az6007_usb_out_op(d, FX2_SCON1 /* 0xc0 */, 0, 3, NULL, 0); 223 az6007_write(d->udev, FX2_SCON1 /* 0xc0 */, 0, 3, NULL, 0);
224 msleep (10); 224 msleep (10);
225 az6007_usb_out_op(d, FX2_SCON1 /* 0xc0 */, 1, 3, NULL, 0); 225 az6007_write(d->udev, FX2_SCON1 /* 0xc0 */, 1, 3, NULL, 0);
226 msleep (10); 226 msleep (10);
227 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 0, 0, NULL, 0); 227 az6007_write(d->udev, AZ6007_POWER /* 0xbc */, 0, 0, NULL, 0);
228 228
229 deb_info("az6007_frontend_poweron: OK\n"); 229 deb_info("az6007_frontend_poweron: OK\n");
230 230
@@ -246,7 +246,7 @@ static int az6007_frontend_reset(struct dvb_usb_adapter *adap)
246 value = 1; /* high */ 246 value = 1; /* high */
247 index = 3; 247 index = 3;
248 blen = 0; 248 blen = 0;
249 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen); 249 ret = az6007_write(adap->dev->udev, req, value, index, NULL, blen);
250 if (ret != 0) { 250 if (ret != 0) {
251 err("az6007_frontend_reset failed 1 !!!"); 251 err("az6007_frontend_reset failed 1 !!!");
252 return -EIO; 252 return -EIO;
@@ -257,7 +257,7 @@ static int az6007_frontend_reset(struct dvb_usb_adapter *adap)
257 index = 3; 257 index = 3;
258 blen = 0; 258 blen = 0;
259 msleep_interruptible(200); 259 msleep_interruptible(200);
260 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen); 260 ret = az6007_write(adap->dev->udev, req, value, index, NULL, blen);
261 if (ret != 0) { 261 if (ret != 0) {
262 err("az6007_frontend_reset failed 2 !!!"); 262 err("az6007_frontend_reset failed 2 !!!");
263 return -EIO; 263 return -EIO;
@@ -268,7 +268,7 @@ static int az6007_frontend_reset(struct dvb_usb_adapter *adap)
268 index = 3; 268 index = 3;
269 blen = 0; 269 blen = 0;
270 270
271 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen); 271 ret = az6007_write(adap->dev->udev, req, value, index, NULL, blen);
272 if (ret != 0) { 272 if (ret != 0) {
273 err("az6007_frontend_reset failed 3 !!!"); 273 err("az6007_frontend_reset failed 3 !!!");
274 return -EIO; 274 return -EIO;
@@ -377,15 +377,15 @@ int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
377 377
378 info("Sending poweron sequence"); 378 info("Sending poweron sequence");
379 379
380 az6007_usb_out_op(d, AZ6007_TS_THROUGH /* 0xc7 */, 0, 0, NULL, 0); 380 az6007_write(d->udev, AZ6007_TS_THROUGH /* 0xc7 */, 0, 0, NULL, 0);
381 381
382#if 0 382#if 0
383 // Seems to be a poweroff sequence 383 // Seems to be a poweroff sequence
384 az6007_usb_out_op(d, 0xbc, 1, 3, NULL, 0); 384 az6007_write(d->udev, 0xbc, 1, 3, NULL, 0);
385 az6007_usb_out_op(d, 0xbc, 1, 4, NULL, 0); 385 az6007_write(d->udev, 0xbc, 1, 4, NULL, 0);
386 az6007_usb_out_op(d, 0xc0, 0, 3, NULL, 0); 386 az6007_write(d->udev, 0xc0, 0, 3, NULL, 0);
387 az6007_usb_out_op(d, 0xc0, 1, 3, NULL, 0); 387 az6007_write(d->udev, 0xc0, 1, 3, NULL, 0);
388 az6007_usb_out_op(d, 0xbc, 0, 1, NULL, 0); 388 az6007_write(d->udev, 0xbc, 0, 1, NULL, 0);
389#endif 389#endif
390 return 0; 390 return 0;
391} 391}
@@ -434,7 +434,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
434 value = addr | (1 << 8); 434 value = addr | (1 << 8);
435 length = 6 + msgs[i + 1].len; 435 length = 6 + msgs[i + 1].len;
436 len = msgs[i + 1].len; 436 len = msgs[i + 1].len;
437 ret = az6007_usb_in_op(d, req, value, index, data, 437 ret = az6007_read(d->udev, req, value, index, data,
438 length); 438 length);
439 if (ret >= len) { 439 if (ret >= len) {
440 for (j = 0; j < len; j++) { 440 for (j = 0; j < len; j++) {
@@ -465,7 +465,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
465 if (dvb_usb_az6007_debug & 2) 465 if (dvb_usb_az6007_debug & 2)
466 printk(KERN_CONT "0x%02x ", data[j]); 466 printk(KERN_CONT "0x%02x ", data[j]);
467 } 467 }
468 ret = az6007_usb_out_op(d, req, value, index, data, 468 ret = az6007_write(d->udev, req, value, index, data,
469 length); 469 length);
470 } else { 470 } else {
471 /* read bytes */ 471 /* read bytes */
@@ -478,7 +478,7 @@ static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
478 value = addr; 478 value = addr;
479 length = msgs[i].len + 6; 479 length = msgs[i].len + 6;
480 len = msgs[i].len; 480 len = msgs[i].len;
481 ret = az6007_usb_in_op(d, req, value, index, data, 481 ret = az6007_read(d->udev, req, value, index, data,
482 length); 482 length);
483 for (j = 0; j < len; j++) { 483 for (j = 0; j < len; j++) {
484 msgs[i].buf[j] = data[j + 5]; 484 msgs[i].buf[j] = data[j + 5];