aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index 3366d1d44e25..a35c50c06f93 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -17,7 +17,7 @@ module_param_named(debug,dvb_usb_gl861_debug, int, 0644);
17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
18 18
19static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr, 19static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
20 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) 20 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
21{ 21{
22 u16 index; 22 u16 index;
23 u16 value = addr << 8; 23 u16 value = addr << 8;
@@ -33,25 +33,25 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
33 } 33 }
34 34
35 switch (wlen) { 35 switch (wlen) {
36 case 1: 36 case 1:
37 index = wbuf[0]; 37 index = wbuf[0];
38 break; 38 break;
39 case 2: 39 case 2:
40 index = wbuf[0]; 40 index = wbuf[0];
41 value = value + wbuf[1]; 41 value = value + wbuf[1];
42 break; 42 break;
43 default: 43 default:
44 warn("wlen = %x, aborting.", wlen); 44 warn("wlen = %x, aborting.", wlen);
45 return -EINVAL; 45 return -EINVAL;
46 } 46 }
47 47
48 return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type, 48 return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
49 value, index, rbuf, rlen, 2000); 49 value, index, rbuf, rlen, 2000);
50} 50}
51 51
52/* I2C */ 52/* I2C */
53static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], 53static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
54 int num) 54 int num)
55{ 55{
56 struct dvb_usb_device *d = i2c_get_adapdata(adap); 56 struct dvb_usb_device *d = i2c_get_adapdata(adap);
57 int i; 57 int i;
@@ -66,12 +66,12 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
66 /* write/read request */ 66 /* write/read request */
67 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { 67 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
68 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf, 68 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf,
69 msg[i].len, msg[i+1].buf, msg[i+1].len) < 0) 69 msg[i].len, msg[i+1].buf, msg[i+1].len) < 0)
70 break; 70 break;
71 i++; 71 i++;
72 } else 72 } else
73 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf, 73 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf,
74 msg[i].len, NULL, 0) < 0) 74 msg[i].len, NULL, 0) < 0)
75 break; 75 break;
76 } 76 }
77 77
@@ -108,7 +108,7 @@ static struct zl10353_config gl861_zl10353_config = {
108static int gl861_frontend_attach(struct dvb_usb_adapter *adap) 108static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
109{ 109{
110 if ((adap->fe = dvb_attach(zl10353_attach, &gl861_zl10353_config, 110 if ((adap->fe = dvb_attach(zl10353_attach, &gl861_zl10353_config,
111 &adap->dev->i2c_adap)) != NULL) { 111 &adap->dev->i2c_adap)) != NULL) {
112 return 0; 112 return 0;
113 } 113 }
114 114
@@ -119,7 +119,7 @@ static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
119static struct dvb_usb_device_properties gl861_properties; 119static struct dvb_usb_device_properties gl861_properties;
120 120
121static int gl861_probe(struct usb_interface *intf, 121static int gl861_probe(struct usb_interface *intf,
122 const struct usb_device_id *id) 122 const struct usb_device_id *id)
123{ 123{
124 struct dvb_usb_device *d; 124 struct dvb_usb_device *d;
125 struct usb_host_interface *alt; 125 struct usb_host_interface *alt;
@@ -128,8 +128,7 @@ static int gl861_probe(struct usb_interface *intf,
128 if (intf->num_altsetting < 2) 128 if (intf->num_altsetting < 2)
129 return -ENODEV; 129 return -ENODEV;
130 130
131 if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, 131 if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d)) == 0) {
132 &d)) == 0) {
133 alt = usb_altnum_to_altsetting(intf, 0); 132 alt = usb_altnum_to_altsetting(intf, 0);
134 133
135 if (alt == NULL) { 134 if (alt == NULL) {
@@ -138,7 +137,7 @@ static int gl861_probe(struct usb_interface *intf,
138 } 137 }
139 138
140 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, 139 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
141 alt->desc.bAlternateSetting); 140 alt->desc.bAlternateSetting);
142 } 141 }
143 142
144 return ret; 143 return ret;
@@ -146,7 +145,7 @@ static int gl861_probe(struct usb_interface *intf,
146 145
147static struct usb_device_id gl861_table [] = { 146static struct usb_device_id gl861_table [] = {
148 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580_55801) }, 147 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580_55801) },
149 {} /* Terminating entry */ 148 { } /* Terminating entry */
150}; 149};
151MODULE_DEVICE_TABLE (usb, gl861_table); 150MODULE_DEVICE_TABLE (usb, gl861_table);
152 151