Commit 5dae603d authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

[media] gspca: Check dev->actconfig rather than dev->config

Check dev->actconfig rather than dev->config when checking various
configuration things. dev->config points to the array of configs for the
device so dev->config->foo boils down to dev->config[0].foo and the first
config is not necessarily always the active config.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 1153f04d
...@@ -2313,12 +2313,12 @@ int gspca_dev_probe2(struct usb_interface *intf, ...@@ -2313,12 +2313,12 @@ int gspca_dev_probe2(struct usb_interface *intf,
gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber; gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber;
/* check if any audio device */ /* check if any audio device */
if (dev->config->desc.bNumInterfaces != 1) { if (dev->actconfig->desc.bNumInterfaces != 1) {
int i; int i;
struct usb_interface *intf2; struct usb_interface *intf2;
for (i = 0; i < dev->config->desc.bNumInterfaces; i++) { for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
intf2 = dev->config->interface[i]; intf2 = dev->actconfig->interface[i];
if (intf2 != NULL if (intf2 != NULL
&& intf2->altsetting != NULL && intf2->altsetting != NULL
&& intf2->altsetting->desc.bInterfaceClass == && intf2->altsetting->desc.bInterfaceClass ==
...@@ -2399,7 +2399,7 @@ int gspca_dev_probe(struct usb_interface *intf, ...@@ -2399,7 +2399,7 @@ int gspca_dev_probe(struct usb_interface *intf,
} }
/* the USB video interface must be the first one */ /* the USB video interface must be the first one */
if (dev->config->desc.bNumInterfaces != 1 if (dev->actconfig->desc.bNumInterfaces != 1
&& intf->cur_altsetting->desc.bInterfaceNumber != 0) && intf->cur_altsetting->desc.bInterfaceNumber != 0)
return -ENODEV; return -ENODEV;
......
...@@ -304,7 +304,7 @@ static int stv06xx_isoc_init(struct gspca_dev *gspca_dev) ...@@ -304,7 +304,7 @@ static int stv06xx_isoc_init(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
/* Start isoc bandwidth "negotiation" at max isoc bandwidth */ /* Start isoc bandwidth "negotiation" at max isoc bandwidth */
alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1]; alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
alt->endpoint[0].desc.wMaxPacketSize = alt->endpoint[0].desc.wMaxPacketSize =
cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]); cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]);
...@@ -317,7 +317,7 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev) ...@@ -317,7 +317,7 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev)
struct usb_host_interface *alt; struct usb_host_interface *alt;
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1]; alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode]; min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode];
if (packet_size <= min_packet_size) if (packet_size <= min_packet_size)
......
...@@ -2789,7 +2789,7 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev) ...@@ -2789,7 +2789,7 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev)
} }
/* Start isoc bandwidth "negotiation" at max isoc bandwidth */ /* Start isoc bandwidth "negotiation" at max isoc bandwidth */
alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1]; alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(max_packet_size); alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(max_packet_size);
return 0; return 0;
...@@ -2812,7 +2812,7 @@ static int sd_isoc_nego(struct gspca_dev *gspca_dev) ...@@ -2812,7 +2812,7 @@ static int sd_isoc_nego(struct gspca_dev *gspca_dev)
break; break;
} }
alt = &gspca_dev->dev->config->intf_cache[0]->altsetting[1]; alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
if (packet_size <= min_packet_size) if (packet_size <= min_packet_size)
return -EIO; return -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment