Skip to content

Commit

Permalink
V4L/DVB (3306): Fixed i2c return value, conversion mdelay to msleep
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Rechberger authored and Mauro Carvalho Chehab committed Feb 7, 2006
1 parent 0dfd812 commit 9f38724
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 13 additions & 2 deletions drivers/media/video/em28xx/em28xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
{
int ret, byte;

if (dev->state & DEV_DISCONNECTED)
return(-ENODEV);

em28xx_regdbg("req=%02x, reg=%02x ", req, reg);

ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
Expand All @@ -165,6 +168,9 @@ int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg)
u8 val;
int ret;

if (dev->state & DEV_DISCONNECTED)
return(-ENODEV);

em28xx_regdbg("req=%02x, reg=%02x:", req, reg);

ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req,
Expand Down Expand Up @@ -195,7 +201,12 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
int ret;

/*usb_control_msg seems to expect a kmalloced buffer */
unsigned char *bufs = kmalloc(len, GFP_KERNEL);
unsigned char *bufs;

if (dev->state & DEV_DISCONNECTED)
return(-ENODEV);

bufs = kmalloc(len, GFP_KERNEL);

em28xx_regdbg("req=%02x reg=%02x:", req, reg);

Expand All @@ -212,7 +223,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0x0000, reg, bufs, len, HZ);
mdelay(5); /* FIXME: magic number */
msleep(5); /* FIXME: magic number */
kfree(bufs);
return ret;
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/video/em28xx/em28xx-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr,
ret = dev->em28xx_read_reg(dev, 0x05);
if (ret == 0x80 + len - 1)
return len;
mdelay(5);
msleep(5);
}
em28xx_warn("i2c write timed out\n");
return -EIO;
Expand Down Expand Up @@ -138,7 +138,7 @@ static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr)
return -ENODEV;
else if (msg == 0x84)
return 0;
mdelay(5);
msleep(5);
}
return -ENODEV;
}
Expand Down Expand Up @@ -278,9 +278,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
msgs[i].buf,
msgs[i].len,
i == num - 1);
if (rc < 0)
goto err;
}
if (rc < 0)
goto err;
if (i2c_debug>=2)
printk("\n");
}
Expand Down

0 comments on commit 9f38724

Please sign in to comment.