From 2671461bba45e354a63f98318c2bd75aae6dc8c8 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <greg@kroah.com>
Date: Mon, 28 Jul 2003 21:40:22 -0700
Subject: [PATCH] [PATCH] USB: changes due to struct usb_interface changing
 from a pointer to an array of pointers.

---
 drivers/media/video/cpia_usb.c  |  2 +-
 drivers/usb/class/audio.c       | 14 +++++++-------
 drivers/usb/class/cdc-acm.c     | 14 +++++++-------
 drivers/usb/class/usb-midi.c    | 12 ++++++------
 drivers/usb/class/usblp.c       |  2 +-
 drivers/usb/core/usb-debug.c    |  2 +-
 drivers/usb/image/scanner.c     |  2 +-
 drivers/usb/media/ibmcam.c      |  4 ++--
 drivers/usb/media/konicawc.c    |  2 +-
 drivers/usb/media/ov511.c       |  2 +-
 drivers/usb/media/pwc-if.c      |  2 +-
 drivers/usb/misc/brlvger.c      |  2 +-
 drivers/usb/net/usbnet.c        |  2 +-
 drivers/usb/serial/io_ti.c      |  2 +-
 drivers/usb/serial/kobil_sct.c  |  2 +-
 drivers/usb/serial/usb-serial.c |  4 ++--
 sound/usb/usbaudio.c            | 10 +++++-----
 sound/usb/usbmixer.c            |  2 +-
 18 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c
index 7ee19192036b..6b602be7f712 100644
--- a/drivers/media/video/cpia_usb.c
+++ b/drivers/media/video/cpia_usb.c
@@ -621,7 +621,7 @@ static void cpia_disconnect(struct usb_interface *intf)
 
 	udev = interface_to_usbdev(intf);
 	usb_driver_release_interface(&cpia_driver,
-				     &udev->actconfig->interface[0]);
+				     udev->actconfig->interface[0]);
 
 	ucpia->curbuff = ucpia->workbuff = NULL;
 
diff --git a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c
index da94bc8a9310..6be004076e63 100644
--- a/drivers/usb/class/audio.c
+++ b/drivers/usb/class/audio.c
@@ -1524,7 +1524,7 @@ static int set_format_in(struct usb_audiodev *as)
 
 	if (u->interface < 0 || u->interface >= config->desc.bNumInterfaces)
 		return 0;
-	iface = &config->interface[u->interface];
+	iface = config->interface[u->interface];
 
 	fmtnr = find_format(as->fmtin, as->numfmtin, d->format, d->srate);
 	if (fmtnr < 0) {
@@ -1612,7 +1612,7 @@ static int set_format_out(struct usb_audiodev *as)
 
 	if (u->interface < 0 || u->interface >= config->desc.bNumInterfaces)
 		return 0;
-	iface = &config->interface[u->interface];
+	iface = config->interface[u->interface];
 
 	fmtnr = find_format(as->fmtout, as->numfmtout, d->format, d->srate);
 	if (fmtnr < 0) {
@@ -2704,7 +2704,7 @@ static int usb_audio_release(struct inode *inode, struct file *file)
 	if (file->f_mode & FMODE_WRITE) {
 		usbout_stop(as);
 		if (dev && as->usbout.interface >= 0) {
-			iface = &dev->actconfig->interface[as->usbout.interface];
+			iface = dev->actconfig->interface[as->usbout.interface];
 			usb_set_interface(dev, iface->altsetting->desc.bInterfaceNumber, 0);
 		}
 		dmabuf_release(&as->usbout.dma);
@@ -2713,7 +2713,7 @@ static int usb_audio_release(struct inode *inode, struct file *file)
 	if (file->f_mode & FMODE_READ) {
 		usbin_stop(as);
 		if (dev && as->usbin.interface >= 0) {
-			iface = &dev->actconfig->interface[as->usbin.interface];
+			iface = dev->actconfig->interface[as->usbin.interface];
 			usb_set_interface(dev, iface->altsetting->desc.bInterfaceNumber, 0);
 		}
 		dmabuf_release(&as->usbin.dma);
@@ -2866,7 +2866,7 @@ static void usb_audio_parsestreaming(struct usb_audio_state *s, unsigned char *b
 	/* search for input formats */
 	if (asifin >= 0) {
 		as->usbin.flags = FLG_CONNECTED;
-		iface = &config->interface[asifin];
+		iface = config->interface[asifin];
 		for (i = 0; i < iface->num_altsetting; i++) {
 			alts = &iface->altsetting[i];
 			if (alts->desc.bInterfaceClass != USB_CLASS_AUDIO || alts->desc.bInterfaceSubClass != 2)
@@ -2947,7 +2947,7 @@ static void usb_audio_parsestreaming(struct usb_audio_state *s, unsigned char *b
 	/* search for output formats */
 	if (asifout >= 0) {
 		as->usbout.flags = FLG_CONNECTED;
-		iface = &config->interface[asifout];
+		iface = config->interface[asifout];
 		for (i = 0; i < iface->num_altsetting; i++) {
 			alts = &iface->altsetting[i];
 			if (alts->desc.bInterfaceClass != USB_CLASS_AUDIO || alts->desc.bInterfaceSubClass != 2)
@@ -3684,7 +3684,7 @@ static struct usb_audio_state *usb_audio_parsecontrol(struct usb_device *dev, un
 			       dev->devnum, ctrlif, j);
 			continue;
 		}
-		iface = &config->interface[j];
+		iface = config->interface[j];
 		if (iface->altsetting[0].desc.bInterfaceClass != USB_CLASS_AUDIO) {
 			printk(KERN_ERR "usbaudio: device %d audiocontrol interface %u interface %u is not an AudioClass interface\n",
 			       dev->devnum, ctrlif, j);
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 6f5c820cd57c..a1170a1d32db 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -560,16 +560,16 @@ static int acm_probe (struct usb_interface *intf,
 
 		for (j = 0; j < cfacm->desc.bNumInterfaces - 1; j++) {
 		    
-			if (usb_interface_claimed(cfacm->interface + j) ||
-			    usb_interface_claimed(cfacm->interface + j + 1))
+			if (usb_interface_claimed(cfacm->interface[j]) ||
+			    usb_interface_claimed(cfacm->interface[j + 1]))
 			continue;
 
-			ifcom = cfacm->interface[j].altsetting + 0;
-			ifdata = cfacm->interface[j + 1].altsetting + 0;
+			ifcom = cfacm->interface[j]->altsetting + 0;
+			ifdata = cfacm->interface[j + 1]->altsetting + 0;
 
 			if (ifdata->desc.bInterfaceClass != 10 || ifdata->desc.bNumEndpoints < 2) {
-				ifcom = cfacm->interface[j + 1].altsetting + 0;
-				ifdata = cfacm->interface[j].altsetting + 0;
+				ifcom = cfacm->interface[j + 1]->altsetting + 0;
+				ifdata = cfacm->interface[j]->altsetting + 0;
 				if (ifdata->desc.bInterfaceClass != 10 || ifdata->desc.bNumEndpoints < 2)
 					continue;
 			}
@@ -610,7 +610,7 @@ static int acm_probe (struct usb_interface *intf,
 			ctrlsize = epctrl->wMaxPacketSize;
 			readsize = epread->wMaxPacketSize;
 			acm->writesize = epwrite->wMaxPacketSize;
-			acm->iface = cfacm->interface + j;
+			acm->iface = cfacm->interface[j];
 			acm->minor = minor;
 			acm->dev = dev;
 
diff --git a/drivers/usb/class/usb-midi.c b/drivers/usb/class/usb-midi.c
index 29ce4d9f8006..7cd4ab7e1dc4 100644
--- a/drivers/usb/class/usb-midi.c
+++ b/drivers/usb/class/usb-midi.c
@@ -1524,10 +1524,10 @@ static int get_alt_setting( struct usb_device *d, int ifnum )
 	int epin, epout;
 	int i;
 
-	alts = d->actconfig->interface[ifnum].num_altsetting;
+	alts = d->actconfig->interface[ifnum]->num_altsetting;
 
 	for ( alt=0 ; alt<alts ; alt++ ) {
-		interface = &d->actconfig->interface[ifnum].altsetting[alt];
+		interface = &d->actconfig->interface[ifnum]->altsetting[alt];
 		epin = -1;
 		epout = -1;
 
@@ -1795,8 +1795,8 @@ static int detect_yamaha_device( struct usb_device *d, unsigned int ifnum, struc
 		return -EINVAL;
 	}
 
-	for ( i=0 ; i < c->interface[ifnum].num_altsetting; i++ ) {
-		interface = c->interface[ifnum].altsetting + i;
+	for ( i=0 ; i < c->interface[ifnum]->num_altsetting; i++ ) {
+		interface = c->interface[ifnum]->altsetting + i;
 
 		if ( interface->desc.bInterfaceClass != 255 ||
 		     interface->desc.bInterfaceSubClass != 0 )
@@ -1889,8 +1889,8 @@ static int detect_midi_subclass(struct usb_device *d, unsigned int ifnum, struct
 	int alts=-1;
 	int ret;
 
-	for ( i=0 ; i < c->interface[ifnum].num_altsetting; i++ ) {
-		interface = c->interface[ifnum].altsetting + i;
+	for ( i=0 ; i < c->interface[ifnum]->num_altsetting; i++ ) {
+		interface = c->interface[ifnum]->altsetting + i;
 
 		if ( interface->desc.bInterfaceClass != USB_CLASS_AUDIO ||
 		     interface->desc.bInterfaceSubClass != USB_SUBCLASS_MIDISTREAMING )
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 989325fbc736..fddcaa5e8671 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -966,7 +966,7 @@ static int usblp_select_alts(struct usblp *usblp)
 	struct usb_endpoint_descriptor *epd, *epwrite, *epread;
 	int p, i, e;
 
-	if_alt = &usblp->dev->actconfig->interface[usblp->ifnum];
+	if_alt = usblp->dev->actconfig->interface[usblp->ifnum];
 
 	for (p = 0; p < USBLP_MAX_PROTOCOLS; p++)
 		usblp->protocol[p].alt_setting = -1;
diff --git a/drivers/usb/core/usb-debug.c b/drivers/usb/core/usb-debug.c
index 91bea396940f..b7683f917fa0 100644
--- a/drivers/usb/core/usb-debug.c
+++ b/drivers/usb/core/usb-debug.c
@@ -37,7 +37,7 @@ static void usb_show_config(struct usb_host_config *config)
 
 	usb_show_config_descriptor(&config->desc);
 	for (i = 0; i < config->desc.bNumInterfaces; i++) {
-		ifp = config->interface + i;
+		ifp = config->interface[i];
 
 		if (!ifp)
 			break;
diff --git a/drivers/usb/image/scanner.c b/drivers/usb/image/scanner.c
index d56c9ab82dc5..e9dcb02a846d 100644
--- a/drivers/usb/image/scanner.c
+++ b/drivers/usb/image/scanner.c
@@ -847,7 +847,7 @@ static void destroy_scanner (struct kobject *kobj)
 	down (&(scn->sem));
 
 	usb_driver_release_interface(&scanner_driver,
-		&scn->scn_dev->actconfig->interface[scn->ifnum]);
+		scn->scn_dev->actconfig->interface[scn->ifnum]);
 
 	kfree(scn->ibuf);
 	kfree(scn->obuf);
diff --git a/drivers/usb/media/ibmcam.c b/drivers/usb/media/ibmcam.c
index ab73717e1020..0d5d7181fe9b 100644
--- a/drivers/usb/media/ibmcam.c
+++ b/drivers/usb/media/ibmcam.c
@@ -3718,7 +3718,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
 	} while (0);
 
 	/* Validate found interface: must have one ISO endpoint */
-	nas = dev->actconfig->interface[ifnum].num_altsetting;
+	nas = dev->actconfig->interface[ifnum]->num_altsetting;
 	if (debug > 0)
 		info("Number of alternate settings=%d.", nas);
 	if (nas < 2) {
@@ -3730,7 +3730,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
 		const struct usb_host_interface *interface;
 		const struct usb_endpoint_descriptor *endpoint;
 
-		interface = &dev->actconfig->interface[ifnum].altsetting[i];
+		interface = &dev->actconfig->interface[ifnum]->altsetting[i];
 		if (interface->desc.bNumEndpoints != 1) {
 			err("Interface %d. has %u. endpoints!",
 			    ifnum, (unsigned)(interface->desc.bNumEndpoints));
diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c
index e128c6800da1..8fafc27d4000 100644
--- a/drivers/usb/media/konicawc.c
+++ b/drivers/usb/media/konicawc.c
@@ -383,7 +383,7 @@ static int konicawc_start_data(struct uvd *uvd)
 	int pktsz;
 	struct usb_host_interface *interface;
 
-	interface = &dev->actconfig->interface[uvd->iface].altsetting[spd_to_iface[cam->speed]];
+	interface = &dev->actconfig->interface[uvd->iface]->altsetting[spd_to_iface[cam->speed]];
 	pktsz = interface->endpoint[1].desc.wMaxPacketSize;
 	DEBUG(1, "pktsz = %d", pktsz);
 	if (!CAMERA_IS_OPERATIONAL(uvd)) {
diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c
index 8b73eb596ebc..5b0e61718d56 100644
--- a/drivers/usb/media/ov511.c
+++ b/drivers/usb/media/ov511.c
@@ -6088,7 +6088,7 @@ ov518_configure(struct usb_ov511 *ov)
 
 	if (ov->bridge == BRG_OV518)
 	{
-		struct usb_interface *ifp = &ov->dev->config[0].interface[0];
+		struct usb_interface *ifp = ov->dev->config[0].interface[0];
 		__u16 mxps = ifp->altsetting[7].endpoint[0].desc.wMaxPacketSize;
 
 		/* Some OV518s have packet numbering by default, some don't */
diff --git a/drivers/usb/media/pwc-if.c b/drivers/usb/media/pwc-if.c
index a69515d36b88..9660c3af2b7e 100644
--- a/drivers/usb/media/pwc-if.c
+++ b/drivers/usb/media/pwc-if.c
@@ -796,7 +796,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
 	/* Get the current alternate interface, adjust packet size */
 	if (!udev->actconfig)
 		return -EFAULT;
-	idesc = &udev->actconfig->interface[0].altsetting[pdev->valternate];
+	idesc = &udev->actconfig->interface[0]->altsetting[pdev->valternate];
 	if (!idesc)
 		return -EFAULT;
 
diff --git a/drivers/usb/misc/brlvger.c b/drivers/usb/misc/brlvger.c
index 46b790ce857a..d9128c13f457 100644
--- a/drivers/usb/misc/brlvger.c
+++ b/drivers/usb/misc/brlvger.c
@@ -289,7 +289,7 @@ brlvger_probe (struct usb_interface *intf,
 	   we reserve it.*/
 	static DECLARE_MUTEX(reserve_sem);
 
-	actifsettings = dev->actconfig->interface->altsetting;
+	actifsettings = dev->actconfig->interface[0]->altsetting;
 
 	if( dev->descriptor.bNumConfigurations != 1
 			|| dev->config->desc.bNumInterfaces != 1 
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 4c6479aaa40c..117d199fd90d 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -547,7 +547,7 @@ static int cdc_bind (struct usbnet *dev, struct usb_interface *intf)
 			d = &intf->altsetting->desc;
 			if (info->u->bMasterInterface0 != d->bInterfaceNumber)
 				goto bad_desc;
-			info->data = dev->udev->actconfig->interface;
+			info->data = dev->udev->actconfig->interface[0];
 			if (intf != (info->data + info->u->bMasterInterface0))
 				goto bad_desc;
 
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 93a42263dcc3..fd06933b61e0 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -993,7 +993,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
 	if (status)
 		return status;
 
-	interface = &serial->serial->dev->config->interface->altsetting->desc;
+	interface = &serial->serial->dev->config->interface[0]->altsetting->desc;
 	if (!interface) {
 		dev_err (&serial->serial->dev->dev, "%s - no interface set, error!", __FUNCTION__);
 		return -ENODEV;
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index c82c3d0a2147..ebcf866f9bf9 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -182,7 +182,7 @@ static int kobil_startup (struct usb_serial *serial)
 	// search for the necessary endpoints
 	pdev = serial->dev;
  	actconfig = pdev->actconfig;
- 	interface = actconfig->interface;
+ 	interface = actconfig->interface[0];
 	altsetting = interface->altsetting;
  	endpoint = altsetting->endpoint;
   
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 78b4337c86bd..3d5f215197da 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1055,9 +1055,9 @@ int usb_serial_probe(struct usb_interface *interface,
 	     (dev->descriptor.idProduct == PL2303_PRODUCT_ID)) ||
 	    ((dev->descriptor.idVendor == ATEN_VENDOR_ID) &&
 	     (dev->descriptor.idProduct == ATEN_PRODUCT_ID))) {
-		if (interface != &dev->actconfig->interface[0]) {
+		if (interface != dev->actconfig->interface[0]) {
 			/* check out the endpoints of the other interface*/
-			iface_desc = &dev->actconfig->interface[0].altsetting[0];
+			iface_desc = &dev->actconfig->interface[0]->altsetting[0];
 			for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
 				endpoint = &iface_desc->endpoint[i].desc;
 				if ((endpoint->bEndpointAddress & 0x80) &&
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index b8e0627fa148..8b025505a206 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1061,7 +1061,7 @@ static int set_format(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime)
 		return -EINVAL;
 	}
 
-	iface = &config->interface[fmt->iface];
+	iface = config->interface[fmt->iface];
 	alts = &iface->altsetting[fmt->altset_idx];
 	altsd = get_iface_desc(alts);
 	snd_assert(altsd->bAlternateSetting == fmt->altsetting, return -EINVAL);
@@ -2156,7 +2156,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
 	config = dev->actconfig;
 
 	/* parse the interface's altsettings */
-	iface = &config->interface[iface_no];
+	iface = config->interface[iface_no];
 	for (i = 0; i < iface->num_altsetting; i++) {
 		alts = &iface->altsetting[i];
 		altsd = get_iface_desc(alts);
@@ -2291,7 +2291,7 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif)
 
 	/* find audiocontrol interface */
 	config = dev->actconfig;
-	host_iface = &config->interface[ctrlif].altsetting[0];
+	host_iface = &config->interface[ctrlif]->altsetting[0];
 	if (!(p1 = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen, NULL, HEADER))) {
 		snd_printk(KERN_ERR "cannot find HEADER\n");
 		return -EINVAL;
@@ -2313,7 +2313,7 @@ static int snd_usb_create_streams(snd_usb_audio_t *chip, int ctrlif)
 				   dev->devnum, ctrlif, j);
 			continue;
 		}
-		iface = &config->interface[j];
+		iface = config->interface[j];
 		if (usb_interface_claimed(iface)) {
 			snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", dev->devnum, ctrlif, j);
 			continue;
@@ -2429,7 +2429,7 @@ static int create_composite_quirk(snd_usb_audio_t *chip,
 	for (quirk = quirk->data; quirk->ifnum >= 0; ++quirk) {
 		if (quirk->ifnum >= get_cfg_desc(config)->bNumInterfaces)
 			continue;
-		iface = &config->interface[quirk->ifnum];
+		iface = config->interface[quirk->ifnum];
 		if (quirk->ifnum != probed_ifnum &&
 		    usb_interface_claimed(iface))
 			continue;
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index e28365ca9996..c99f18a52feb 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1490,7 +1490,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
 	int err;
 	const struct usbmix_ctl_map *map;
 	struct usb_device_descriptor *dev = &chip->dev->descriptor;
-	struct usb_host_interface *hostif = &chip->dev->actconfig->interface[ctrlif].altsetting[0];
+	struct usb_host_interface *hostif = &chip->dev->actconfig->interface[ctrlif]->altsetting[0];
 
 	strcpy(chip->card->mixername, "USB Mixer");
 
-- 
2.30.9