V4L/DVB (10333): gspca - main and many subdrivers: Remove the epaddr variable.
authorJean-Francois Moine <moinejf@free.fr>
Wed, 31 Dec 2008 11:13:46 +0000 (08:13 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:29 +0000 (12:42 -0300)
The transfer endpoint address is now automatically chosen.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
26 files changed:
drivers/media/video/gspca/conex.c
drivers/media/video/gspca/etoms.c
drivers/media/video/gspca/finepix.c
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/gspca.h
drivers/media/video/gspca/m5602/m5602_core.c
drivers/media/video/gspca/mars.c
drivers/media/video/gspca/ov519.c
drivers/media/video/gspca/ov534.c
drivers/media/video/gspca/pac207.c
drivers/media/video/gspca/pac7311.c
drivers/media/video/gspca/sonixb.c
drivers/media/video/gspca/sonixj.c
drivers/media/video/gspca/spca500.c
drivers/media/video/gspca/spca501.c
drivers/media/video/gspca/spca505.c
drivers/media/video/gspca/spca506.c
drivers/media/video/gspca/spca508.c
drivers/media/video/gspca/spca561.c
drivers/media/video/gspca/stk014.c
drivers/media/video/gspca/stv06xx/stv06xx.c
drivers/media/video/gspca/sunplus.c
drivers/media/video/gspca/t613.c
drivers/media/video/gspca/tv8532.c
drivers/media/video/gspca/vc032x.c
drivers/media/video/gspca/zc3xx.c

index 1753f5bb35444c7db2fba72d05016e2b06e36a2d..a7088f60bcd05c373297036ba8e7c3bbbaf096f6 100644 (file)
@@ -815,7 +815,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
 
index f3cd8ff5cc923b07a4b97367bd5ee99b750127ba..ca888ac969d0d6ef1bb2ac7f420b7325b58d2cf2 100644 (file)
@@ -658,7 +658,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 1;
        sd->sensor = id->driver_info;
        if (sd->sensor == SENSOR_PAS106) {
                cam->cam_mode = sif_mode;
index afc8b2dd307bb36df8b40886def1cdef96cb1dd8..76c6e03cb6c945da0cc2a07a9ee5ff27aafe5b05 100644 (file)
@@ -259,7 +259,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        cam->cam_mode = fpix_mode;
        cam->nmodes = 1;
-       cam->epaddr = 0x01;     /* todo: correct for all cams? */
        cam->bulk_size = FPIX_MAX_TRANSFER;
 
 /*     gspca_dev->nbalt = 1;    * use bulk transfer */
@@ -335,8 +334,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
        /* Read the result of the command. Ignore the result, for it
         * varies with the device. */
        ret = usb_bulk_msg(gspca_dev->dev,
-                       usb_rcvbulkpipe(gspca_dev->dev,
-                                       gspca_dev->cam.epaddr),
+                       gspca_dev->urb[0]->pipe,
                        gspca_dev->usb_buf, FPIX_MAX_TRANSFER, &size_ret,
                        FPIX_TIMEOUT);
        if (ret != 0) {
@@ -363,7 +361,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
        }
 
        /* Again, reset bulk in endpoint */
-       usb_clear_halt(gspca_dev->dev, gspca_dev->cam.epaddr);
+       usb_clear_halt(gspca_dev->dev, gspca_dev->urb[0]->pipe);
 
        /* Allocate a control URB */
        dev->control_urb = usb_alloc_urb(0, GFP_KERNEL);
index 9b77ebbd875d69216250dfd58e887b6aece4e339..e13833b8ed67f3c6165209de3e77b2780184def5 100644 (file)
@@ -439,22 +439,16 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
  * look for an input transfer endpoint in an alternate setting
  */
 static struct usb_host_endpoint *alt_xfer(struct usb_host_interface *alt,
-                                         __u8 epaddr,
                                          __u8 xfer)
 {
        struct usb_host_endpoint *ep;
        int i, attr;
 
-       epaddr |= USB_DIR_IN;
        for (i = 0; i < alt->desc.bNumEndpoints; i++) {
                ep = &alt->endpoint[i];
-               if (ep->desc.bEndpointAddress == epaddr) {
-                       attr = ep->desc.bmAttributes
-                                               & USB_ENDPOINT_XFERTYPE_MASK;
-                       if (attr == xfer)
-                               return ep;
-                       break;
-               }
+               attr = ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+               if (attr == xfer)
+                       return ep;
        }
        return NULL;
 }
@@ -480,7 +474,6 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
        /* try isoc */
        while (--i > 0) {                       /* alt 0 is unusable */
                ep = alt_xfer(&intf->altsetting[i],
-                               gspca_dev->cam.epaddr,
                                USB_ENDPOINT_XFER_ISOC);
                if (ep)
                        break;
@@ -489,7 +482,6 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev)
        /* if no isoc, try bulk */
        if (ep == NULL) {
                ep = alt_xfer(&intf->altsetting[0],
-                               gspca_dev->cam.epaddr,
                                USB_ENDPOINT_XFER_BULK);
                if (ep == NULL) {
                        err("no transfer endpoint found");
@@ -618,8 +610,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
                /* clear the bulk endpoint */
                if (gspca_dev->alt == 0)        /* if bulk transfer */
                        usb_clear_halt(gspca_dev->dev,
-                                       usb_rcvintpipe(gspca_dev->dev,
-                                                gspca_dev->cam.epaddr));
+                                       gspca_dev->urb[0]->pipe);
 
                /* start the cam */
                ret = gspca_dev->sd_desc->start(gspca_dev);
index c90af9cb1e079b6c3aaa322c0ff739a2652207dc..e5c8eb7090369bdcefed3a97214144f04a74a07c 100644 (file)
@@ -62,7 +62,6 @@ struct cam {
                                 * - cannot be > MAX_NURBS
                                 * - when 0 and bulk_size != 0 means
                                 *   1 URB and submit done by subdriver */
-       __u8 epaddr;
 };
 
 struct gspca_dev;
index ed906fe31287d4350fe16f1b860b966187ed30f3..37a47db2903df3d92a1e8fd8a0cc8734e37bf5d0 100644 (file)
@@ -332,7 +332,6 @@ static int m5602_configure(struct gspca_dev *gspca_dev,
        int err;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = M5602_ISOC_ENDPOINT_ADDR;
        sd->desc = &sd_desc;
 
        if (dump_bridge)
index 3d2090e67a633046417738ce1e14b4d6ec451295..ba79afbf8b39020c8f6ee26373565812bd336d31 100644 (file)
@@ -121,7 +121,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = ARRAY_SIZE(vga_mode);
        sd->qindex = 1;                 /* set the quantization table */
index ee232956c812523aa050fa77d7f129b257f3db79..ac9b4dc064d6044e6e8f6d7f5cd65ee7d8650f7b 100644 (file)
@@ -1360,7 +1360,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        }
 
        cam = &gspca_dev->cam;
-       cam->epaddr = OV511_ENDPOINT_ADDRESS;
        if (!sd->sif) {
                cam->cam_mode = vga_mode;
                cam->nmodes = ARRAY_SIZE(vga_mode);
index 3bf15e4016933ca3b651621cbf29cbb4c36b7873..01314e9995f0efa809a1631daf91067c18759fdb 100644 (file)
@@ -379,7 +379,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
 
        cam = &gspca_dev->cam;
 
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = ARRAY_SIZE(vga_mode);
 
index c90ac852bac07eace63ab95756796d8a804f3693..546820f52c0271eb69ef2908c761faef9e4a9ca5 100644 (file)
@@ -256,7 +256,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
                " (vid/pid 0x%04X:0x%04X)", id->idVendor, id->idProduct);
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x05;
        cam->cam_mode = sif_mode;
        cam->nmodes = ARRAY_SIZE(sif_mode);
        sd->brightness = PAC207_BRIGHTNESS_DEFAULT;
index a9c95cba710e350e14fb70df6121d2a721700fa1..f34bbc5db50117a338540bb7928354e481dc0c0f 100644 (file)
@@ -498,7 +498,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x05;
 
        sd->sensor = id->driver_info;
        if (sd->sensor == SENSOR_PAC7302) {
index b3e4e0677b683546135400609c373a81d879974d..5ec361c779beddc549e8f3ae2ff6c31c1ab18a8b 100644 (file)
@@ -870,7 +870,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        gspca_dev->ctrl_dis = sensor_data[sd->sensor].ctrl_dis;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        if (!(sensor_data[sd->sensor].flags & F_SIF)) {
                cam->cam_mode = vga_mode;
                cam->nmodes = ARRAY_SIZE(vga_mode);
index 3373b8d9d2a88fa92c8ec40feb5d4d207d9b17ab..5c159d89bd82913063447562eefbd70aa5358b80 100644 (file)
@@ -1018,7 +1018,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = ARRAY_SIZE(vga_mode);
 
index 942f04cd44dd4c9e46a28e272fd558a189bf67a3..94ed469a3ada7666e5069a0ccb016cf0a0252b2e 100644 (file)
@@ -629,7 +629,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        sd->subtype = id->driver_info;
        if (sd->subtype != LogitechClickSmart310) {
                cam->cam_mode = vga_mode;
index 82e3e3e2ada1434cf4d0fa36f7d2df81e8121f3f..766da90e6eb712586227558aa01567aec4c45dad 100644 (file)
@@ -1934,7 +1934,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
        sd->subtype = id->driver_info;
index 2a33a29010ee59f62ca2efed92dc874a23b86e30..90d555361ae7cee3f89284b6972e76de30caf113 100644 (file)
@@ -636,7 +636,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        sd->subtype = id->driver_info;
        if (sd->subtype != IntelPCCameraPro)
index 96e2512e0621df5e1cebfaafbb98e436676301d1..99fa3fc1cb622f6471c0ad4b3493d2c34ab6fdbd 100644 (file)
@@ -303,7 +303,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
        sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
index be5d740a315d614b95f7077bcb11b4137e65e32e..f5c0459673790acb2a921448b90d46ba9cc02277 100644 (file)
@@ -1487,7 +1487,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = sif_mode;
        cam->nmodes = ARRAY_SIZE(sif_mode);
 
index 3c9288019e96faea92d22ab0b630404f6c5be0a0..d64e7d64d0531c2838dfcd6c740c7e754888ae74 100644 (file)
@@ -541,7 +541,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        }
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        gspca_dev->nbalt = 7 + 1;       /* choose alternate 7 first */
 
        sd->chip_revision = id->driver_info;
index 60de9af87fbbe02504aec63ca6891881d7283f26..cd1fbff0c94c184b18ab973f342a0699904e0e47 100644 (file)
@@ -180,7 +180,7 @@ static int rcv_val(struct gspca_dev *gspca_dev,
        reg_w(gspca_dev, 0x63b, 0);
        reg_w(gspca_dev, 0x630, 5);
        ret = usb_bulk_msg(dev,
-                       usb_rcvbulkpipe(dev, 5),
+                       usb_rcvbulkpipe(dev, 0x05),
                        gspca_dev->usb_buf,
                        4,              /* length */
                        &alen,
@@ -294,9 +294,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
                        const struct usb_device_id *id)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       struct cam *cam = &gspca_dev->cam;
 
-       cam->epaddr = 0x02;
        gspca_dev->cam.cam_mode = vga_mode;
        gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
        sd->brightness = BRIGHTNESS_DEF;
index 13a021e3cbb7b5d5f613688ca7880a8dac232bae..c60b163335c52b873c8e30159a8c79748b35f562 100644 (file)
@@ -429,7 +429,6 @@ static int stv06xx_config(struct gspca_dev *gspca_dev,
        PDEBUG(D_PROBE, "Configuring camera");
 
        cam = &gspca_dev->cam;
-       cam->epaddr = STV_ISOC_ENDPOINT_ADDR;
        sd->desc = sd_desc;
        gspca_dev->sd_desc = &sd->desc;
 
index 6d904d5e4c74ef9cd02204e4eabd312652213396..1f07476a990591811e85e5279a604838062f6221 100644 (file)
@@ -812,7 +812,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
 
        sd->bridge = id->driver_info >> 8;
        sd->subtype = id->driver_info;
index 6ee111a3cbd1e5889a3e7c44c6bdcd847be24b1b..74ca17845223e297c6087d423dd8745824ef2994 100644 (file)
@@ -538,7 +538,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
 
        cam->cam_mode = vga_mode_t16;
        cam->nmodes = ARRAY_SIZE(vga_mode_t16);
index 94163cceb28ae0bb6ec051294420288ddbc0816a..1da292ea1c779ae78ff35a9b78bc88201b69bbbd 100644 (file)
@@ -241,7 +241,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        tv_8532WriteEEprom(gspca_dev);
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 1;
        cam->cam_mode = sif_mode;
        cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
 
index 0525ea51a6dea95f54311933616e7f15bd825f8a..ab5a25cfc69e7c4dee3e96fd72f27e99773c08d9 100644 (file)
@@ -1979,7 +1979,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        int sensor;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x02;
        sd->bridge = id->driver_info;
 
        vc0321_reset(gspca_dev);
index ec2a53d53fe269c3886a0ad3bad92a693777f36a..c32477db3babd9565c8f41e015c13b0206d92c42 100644 (file)
@@ -7147,7 +7147,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        }
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
 /*fixme:test*/
        gspca_dev->nbalt--;
        if (vga) {