aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMarkus Rechberger <mrechberger@gmail.com>2006-02-07 03:49:11 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-07 03:51:36 -0500
commit9f38724a6f9a436ce25cb0dfceea4a615ee44fb6 (patch)
treee3f04f9cab42d8b20256ab655ba1979da599afa4 /drivers/media
parent0dfd812d4b2afc797310943b451608d347854e76 (diff)
V4L/DVB (3306): Fixed i2c return value, conversion mdelay to msleep
fixed i2c return value, conversion mdelay to msleep Signed-off-by: Markus Rechberger <mrechberger@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c15
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c8
2 files changed, 17 insertions, 6 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 82f0c5fb2417..e5ee8bceb210 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -139,6 +139,9 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
139{ 139{
140 int ret, byte; 140 int ret, byte;
141 141
142 if (dev->state & DEV_DISCONNECTED)
143 return(-ENODEV);
144
142 em28xx_regdbg("req=%02x, reg=%02x ", req, reg); 145 em28xx_regdbg("req=%02x, reg=%02x ", req, reg);
143 146
144 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, 147 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
@@ -165,6 +168,9 @@ int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg)
165 u8 val; 168 u8 val;
166 int ret; 169 int ret;
167 170
171 if (dev->state & DEV_DISCONNECTED)
172 return(-ENODEV);
173
168 em28xx_regdbg("req=%02x, reg=%02x:", req, reg); 174 em28xx_regdbg("req=%02x, reg=%02x:", req, reg);
169 175
170 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, 176 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
@@ -195,7 +201,12 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
195 int ret; 201 int ret;
196 202
197 /*usb_control_msg seems to expect a kmalloced buffer */ 203 /*usb_control_msg seems to expect a kmalloced buffer */
198 unsigned char *bufs = kmalloc(len, GFP_KERNEL); 204 unsigned char *bufs;
205
206 if (dev->state & DEV_DISCONNECTED)
207 return(-ENODEV);
208
209 bufs = kmalloc(len, GFP_KERNEL);
199 210
200 em28xx_regdbg("req=%02x reg=%02x:", req, reg); 211 em28xx_regdbg("req=%02x reg=%02x:", req, reg);
201 212
@@ -212,7 +223,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
212 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, 223 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req,
213 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 224 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
214 0x0000, reg, bufs, len, HZ); 225 0x0000, reg, bufs, len, HZ);
215 mdelay(5); /* FIXME: magic number */ 226 msleep(5); /* FIXME: magic number */
216 kfree(bufs); 227 kfree(bufs);
217 return ret; 228 return ret;
218} 229}
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 0591a705b7a1..6ca8631bc36d 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -78,7 +78,7 @@ static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr,
78 ret = dev->em28xx_read_reg(dev, 0x05); 78 ret = dev->em28xx_read_reg(dev, 0x05);
79 if (ret == 0x80 + len - 1) 79 if (ret == 0x80 + len - 1)
80 return len; 80 return len;
81 mdelay(5); 81 msleep(5);
82 } 82 }
83 em28xx_warn("i2c write timed out\n"); 83 em28xx_warn("i2c write timed out\n");
84 return -EIO; 84 return -EIO;
@@ -138,7 +138,7 @@ static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr)
138 return -ENODEV; 138 return -ENODEV;
139 else if (msg == 0x84) 139 else if (msg == 0x84)
140 return 0; 140 return 0;
141 mdelay(5); 141 msleep(5);
142 } 142 }
143 return -ENODEV; 143 return -ENODEV;
144} 144}
@@ -278,9 +278,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
278 msgs[i].buf, 278 msgs[i].buf,
279 msgs[i].len, 279 msgs[i].len,
280 i == num - 1); 280 i == num - 1);
281 if (rc < 0)
282 goto err;
283 } 281 }
282 if (rc < 0)
283 goto err;
284 if (i2c_debug>=2) 284 if (i2c_debug>=2)
285 printk("\n"); 285 printk("\n");
286 } 286 }