]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/media/video/em28xx/em28xx-core.c
V4L/DVB (3963): Em28xx/: possible cleanups
[karo-tx-linux.git] / drivers / media / video / em28xx / em28xx-core.c
index dff3893f32fdaa18d940f5309bd18354dbc8b3e5..4350cc75b025a0ffcf24252fb1af9d5517dad938 100644 (file)
@@ -3,7 +3,7 @@
 
    Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
                      Markus Rechberger <mrechberger@gmail.com>
-                     Mauro Carvalho Chehab <mchehab@brturbo.com.br>
+                     Mauro Carvalho Chehab <mchehab@infradead.org>
                      Sascha Sommer <saschasommer@freenet.de>
 
    This program is free software; you can redistribute it and/or modify
@@ -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,
@@ -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,
@@ -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);
 
@@ -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;
 }
@@ -253,7 +264,7 @@ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val)
        if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
                return ret;
        else if (((u8) ret) & 0x01) {
-               em28xx_warn ("AC97 command still being exectuted: not handled properly!\n");
+               em28xx_warn ("AC97 command still being executed: not handled properly!\n");
        }
        return 0;
 }
@@ -306,8 +317,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev)
        return em28xx_write_regs(dev, VINCTRL_REG, "\x11", 1);
 }
 
-int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin,
-                                 u8 ymax)
+static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
+                                 u8 ymin, u8 ymax)
 {
        em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax);
 
@@ -317,7 +328,7 @@ int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin,
        return em28xx_write_regs(dev, YMAX_REG, &ymax, 1);
 }
 
-int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
+static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
                                   u16 width, u16 height)
 {
        u8 cwidth = width;
@@ -334,7 +345,7 @@ int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
        return em28xx_write_regs(dev, OFLOW_REG, &overflow, 1);
 }
 
-int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
+static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
 {
        u8 mode;
        /* the em2800 scaler only supports scaling down to 50% */
@@ -523,7 +534,7 @@ static inline void em28xx_isoc_video_copy(struct em28xx *dev,
  * em28xx_isoIrq()
  * handles the incoming isoc urbs and fills the frames from our inqueue
  */
-void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs)
+static void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs)
 {
        struct em28xx *dev = urb->context;
        int i, status;