]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/core/message.c
USB: usb dev_set_name() instead of dev->bus_id
[linux-2.6-omap-h63xx.git] / drivers / usb / core / message.c
index c311f67b7f0824dba591b50d4b21f943827349b0..315363b744a3781ab86e5e3476e35061e89cd30c 100644 (file)
@@ -312,7 +312,7 @@ static void sg_complete(struct urb *urb)
                                    retval != -EBUSY)
                                        dev_err(&io->dev->dev,
                                                "%s, unlink --> %d\n",
-                                               __FUNCTION__, retval);
+                                               __func__, retval);
                        } else if (urb == io->urbs [i])
                                found = 1;
                }
@@ -394,7 +394,9 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
        if (!io->urbs)
                goto nomem;
 
-       urb_flags = URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT;
+       urb_flags = URB_NO_INTERRUPT;
+       if (dma)
+               urb_flags |= URB_NO_TRANSFER_DMA_MAP;
        if (usb_pipein(pipe))
                urb_flags |= URB_SHORT_NOT_OK;
 
@@ -550,7 +552,7 @@ void usb_sg_wait(struct usb_sg_request *io)
                        io->urbs[i]->dev = NULL;
                        io->urbs[i]->status = retval;
                        dev_dbg(&io->dev->dev, "%s, submit --> %d\n",
-                               __FUNCTION__, retval);
+                               __func__, retval);
                        usb_sg_cancel(io);
                }
                spin_lock_irq(&io->lock);
@@ -600,7 +602,7 @@ void usb_sg_cancel(struct usb_sg_request *io)
                        retval = usb_unlink_urb(io->urbs [i]);
                        if (retval != -EINPROGRESS && retval != -EBUSY)
                                dev_warn(&io->dev->dev, "%s, unlink --> %d\n",
-                                       __FUNCTION__, retval);
+                                       __func__, retval);
                }
                spin_lock(&io->lock);
        }
@@ -784,7 +786,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
        if (size <= 0 || !buf || !index)
                return -EINVAL;
        buf[0] = 0;
-       tbuf = kmalloc(256, GFP_KERNEL);
+       tbuf = kmalloc(256, GFP_NOIO);
        if (!tbuf)
                return -ENOMEM;
 
@@ -1068,7 +1070,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
 {
        int i;
 
-       dev_dbg(&dev->dev, "%s nuking %s URBs\n", __FUNCTION__,
+       dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
                skip_ep0 ? "non-ep0" : "all");
        for (i = skip_ep0; i < 16; ++i) {
                usb_disable_endpoint(dev, i);
@@ -1088,9 +1090,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
                        if (!device_is_registered(&interface->dev))
                                continue;
                        dev_dbg(&dev->dev, "unregistering interface %s\n",
-                               interface->dev.bus_id);
-                       usb_remove_sysfs_intf_files(interface);
+                               dev_name(&interface->dev));
                        device_del(&interface->dev);
+                       usb_remove_sysfs_intf_files(interface);
                }
 
                /* Now that the interfaces are unbound, nobody should
@@ -1231,7 +1233,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
         */
 
        /* prevent submissions using previous endpoint settings */
-       if (iface->cur_altsetting != alt && device_is_registered(&iface->dev))
+       if (iface->cur_altsetting != alt)
                usb_remove_sysfs_intf_files(iface);
        usb_disable_interface(dev, iface);
 
@@ -1330,8 +1332,7 @@ int usb_reset_configuration(struct usb_device *dev)
                struct usb_interface *intf = config->interface[i];
                struct usb_host_interface *alt;
 
-               if (device_is_registered(&intf->dev))
-                       usb_remove_sysfs_intf_files(intf);
+               usb_remove_sysfs_intf_files(intf);
                alt = usb_altnum_to_altsetting(intf, 0);
 
                /* No altsetting 0?  We'll assume the first altsetting.
@@ -1606,10 +1607,11 @@ free_interfaces:
                intf->dev.driver = NULL;
                intf->dev.bus = &usb_bus_type;
                intf->dev.type = &usb_if_device_type;
+               intf->dev.groups = usb_interface_groups;
                intf->dev.dma_mask = dev->dev.dma_mask;
                device_initialize(&intf->dev);
                mark_quiesced(intf);
-               sprintf(&intf->dev.bus_id[0], "%d-%s:%d.%d",
+               dev_set_name(&intf->dev, "%d-%s:%d.%d",
                        dev->bus->busnum, dev->devpath,
                        configuration, alt->desc.bInterfaceNumber);
        }
@@ -1629,12 +1631,12 @@ free_interfaces:
 
                dev_dbg(&dev->dev,
                        "adding %s (config #%d, interface %d)\n",
-                       intf->dev.bus_id, configuration,
+                       dev_name(&intf->dev), configuration,
                        intf->cur_altsetting->desc.bInterfaceNumber);
                ret = device_add(&intf->dev);
                if (ret != 0) {
                        dev_err(&dev->dev, "device_add(%s) --> %d\n",
-                               intf->dev.bus_id, ret);
+                               dev_name(&intf->dev), ret);
                        continue;
                }
                usb_create_sysfs_intf_files(intf);