···11281128}1129112911301130#ifdef CONFIG_PM11311131-/* Power management suspend, so power off the transmitter/receiver */11321132-static int stir_suspend(struct usb_interface *intf, u32 state)11311131+/* USB suspend, so power off the transmitter/receiver */11321132+static int stir_suspend(struct usb_interface *intf, pm_message_t message)11331133{11341134 struct stir_cb *stir = usb_get_intfdata(intf);11351135
···3333#include "hcd.h"343435353636-/* PCI-based HCs are normal, but custom bus glue should be ok */3636+/* PCI-based HCs are common, but plenty of non-PCI HCs are used too */373738383939/*-------------------------------------------------------------------------*/···67676868 if (pci_enable_device (dev) < 0)6969 return -ENODEV;7070- dev->current_state = 0;7171- dev->dev.power.power_state = 0;7070+ dev->current_state = PCI_D0;7171+ dev->dev.power.power_state = PMSG_ON;72727373 if (!dev->irq) {7474 dev_err (&dev->dev,···186186187187#ifdef CONFIG_PM188188189189-static char __attribute_used__ *pci_state(u32 state)190190-{191191- switch (state) {192192- case 0: return "D0";193193- case 1: return "D1";194194- case 2: return "D2";195195- case 3: return "D3hot";196196- case 4: return "D3cold";197197- }198198- return NULL;199199-}200200-201189/**202190 * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD203191 * @dev: USB Host Controller being suspended204204- * @state: state that the controller is going into192192+ * @message: semantics in flux205193 *206194 * Store this function in the HCD's struct pci_driver as suspend().207195 */208208-int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)196196+int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)209197{210198 struct usb_hcd *hcd;211199 int retval = 0;···201213202214 hcd = pci_get_drvdata(dev);203215216216+ /* FIXME until the generic PM interfaces change a lot more, this217217+ * can't use PCI D1 and D2 states. For example, the confusion218218+ * between messages and states will need to vanish, and messages219219+ * will need to provide a target system state again.220220+ *221221+ * It'll be important to learn characteristics of the target state,222222+ * especially on embedded hardware where the HCD will often be in223223+ * charge of an external VBUS power supply and one or more clocks.224224+ * Some target system states will leave them active; others won't.225225+ * (With PCI, that's often handled by platform BIOS code.)226226+ */227227+204228 /* even when the PCI layer rejects some of the PCI calls205229 * below, HCs can try global suspend and reduce DMA traffic.206230 * PM-sensitive HCDs may already have done this.207231 */208232 has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);209209- if (state > 4)210210- state = 4;211233212234 switch (hcd->state) {213235···226228 */227229 case HC_STATE_RUNNING:228230 hcd->state = HC_STATE_QUIESCING;229229- retval = hcd->driver->suspend (hcd, state);231231+ retval = hcd->driver->suspend (hcd, message);230232 if (retval) {231233 dev_dbg (hcd->self.controller, 232234 "suspend fail, retval %d\n",···244246 * have been called, otherwise root hub timers still run ...245247 */246248 case HC_STATE_SUSPENDED:247247- if (state <= dev->current_state)248248- break;249249-250250- /* no DMA or IRQs except in D0 */251251- if (!dev->current_state) {249249+ /* no DMA or IRQs except when HC is active */250250+ if (dev->current_state == PCI_D0) {251251+ free_irq (hcd->irq, hcd);252252 pci_save_state (dev);253253 pci_disable_device (dev);254254- free_irq (hcd->irq, hcd);255254 }256255257256 if (!has_pci_pm) {···256261 break;257262 }258263259259- /* POLICY: ignore D1/D2/D3hot differences;260260- * we know D3hot will always work.264264+ /* NOTE: dev->current_state becomes nonzero only here, and265265+ * only for devices that support PCI PM. Also, exiting266266+ * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset267267+ * some device state (e.g. as part of clock reinit).261268 */262262- retval = pci_set_power_state (dev, state);263263- if (retval < 0 && state < 3) {264264- retval = pci_set_power_state (dev, 3);265265- if (retval == 0)266266- state = 3;267267- }269269+ retval = pci_set_power_state (dev, PCI_D3hot);268270 if (retval == 0) {269269- dev_dbg (hcd->self.controller, "--> PCI %s\n",270270- pci_state(dev->current_state));271271-#ifdef CONFIG_USB_SUSPEND272272- pci_enable_wake (dev, state, hcd->remote_wakeup);273273- pci_enable_wake (dev, 4, hcd->remote_wakeup);274274-#endif271271+ dev_dbg (hcd->self.controller, "--> PCI D3\n");272272+ pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup);273273+ pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup);275274 } else if (retval < 0) {276276- dev_dbg (&dev->dev, "PCI %s suspend fail, %d\n",277277- pci_state(state), retval);275275+ dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",276276+ retval);278277 (void) usb_hcd_pci_resume (dev);279278 break;280279 }···276287 default:277288 dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n",278289 hcd->state);290290+ WARN_ON(1);279291 retval = -EINVAL;280292 break;281293 }282294283295 /* update power_state **ONLY** to make sysfs happier */284296 if (retval == 0)285285- dev->dev.power.power_state = state;297297+ dev->dev.power.power_state = message;286298 return retval;287299}288300EXPORT_SYMBOL (usb_hcd_pci_suspend);···298308{299309 struct usb_hcd *hcd;300310 int retval;301301- int has_pci_pm;302311303312 hcd = pci_get_drvdata(dev);304313 if (hcd->state != HC_STATE_SUSPENDED) {···305316 "can't resume, not suspended!\n");306317 return 0;307318 }308308- has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);309319310310- /* D3cold resume isn't usually reported this way... */311311- dev_dbg(hcd->self.controller, "resume from PCI %s%s\n",312312- pci_state(dev->current_state),313313- has_pci_pm ? "" : " (legacy)");320320+ /* NOTE: chip docs cover clean "real suspend" cases (what Linux321321+ * calls "standby", "suspend to RAM", and so on). There are also322322+ * dirty cases when swsusp fakes a suspend in "shutdown" mode.323323+ */324324+ if (dev->current_state != PCI_D0) {325325+#ifdef DEBUG326326+ int pci_pm;327327+ u16 pmcr;328328+329329+ pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);330330+ pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr);331331+ pmcr &= PCI_PM_CTRL_STATE_MASK;332332+ if (pmcr) {333333+ /* Clean case: power to USB and to HC registers was334334+ * maintained; remote wakeup is easy.335335+ */336336+ dev_dbg(hcd->self.controller, "resume from PCI D%d\n",337337+ pmcr);338338+ } else {339339+ /* Clean: HC lost Vcc power, D0 uninitialized340340+ * + Vaux may have preserved port and transceiver341341+ * state ... for remote wakeup from D3cold342342+ * + or not; HCD must reinit + re-enumerate343343+ *344344+ * Dirty: D0 semi-initialized cases with swsusp345345+ * + after BIOS init346346+ * + after Linux init (HCD statically linked)347347+ */348348+ dev_dbg(hcd->self.controller,349349+ "PCI D0, from previous PCI D%d\n",350350+ dev->current_state);351351+ }352352+#endif353353+ pci_enable_wake (dev, dev->current_state, 0);354354+ pci_enable_wake (dev, PCI_D3cold, 0);355355+ } else {356356+ /* Same basic cases: clean (powered/not), dirty */357357+ dev_dbg(hcd->self.controller, "PCI legacy resume\n");358358+ }359359+360360+ /* NOTE: the PCI API itself is asymmetric here. We don't need to361361+ * pci_set_power_state(PCI_D0) since that's part of re-enabling;362362+ * but that won't re-enable bus mastering. Yet pci_disable_device()363363+ * explicitly disables bus mastering...364364+ */365365+ retval = pci_enable_device (dev);366366+ if (retval < 0) {367367+ dev_err (hcd->self.controller,368368+ "can't re-enable after resume, %d!\n", retval);369369+ return retval;370370+ }371371+ pci_set_master (dev);372372+ pci_restore_state (dev);373373+374374+ dev->dev.power.power_state = PMSG_ON;314375315376 hcd->state = HC_STATE_RESUMING;316316-317317- if (has_pci_pm)318318- pci_set_power_state (dev, 0);319319- dev->dev.power.power_state = 0;377377+ hcd->saw_irq = 0;320378 retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,321321- hcd->driver->description, hcd);379379+ hcd->irq_descr, hcd);322380 if (retval < 0) {323381 dev_err (hcd->self.controller,324382 "can't restore IRQ after resume!\n");383383+ usb_hc_died (hcd);325384 return retval;326385 }327327- hcd->saw_irq = 0;328328- pci_restore_state (dev);329329-#ifdef CONFIG_USB_SUSPEND330330- pci_enable_wake (dev, dev->current_state, 0);331331- pci_enable_wake (dev, 4, 0);332332-#endif333386334387 retval = hcd->driver->resume (hcd);335388 if (!HC_IS_RUNNING (hcd->state)) {
+2-2
drivers/usb/core/hcd.h
···177177 * a whole, not just the root hub; they're for bus glue.178178 */179179 /* called after all devices were suspended */180180- int (*suspend) (struct usb_hcd *hcd, u32 state);180180+ int (*suspend) (struct usb_hcd *hcd, pm_message_t message);181181182182 /* called before any devices get resumed */183183 int (*resume) (struct usb_hcd *hcd);···226226extern void usb_hcd_pci_remove (struct pci_dev *dev);227227228228#ifdef CONFIG_PM229229-extern int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state);229229+extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state);230230extern int usb_hcd_pci_resume (struct pci_dev *dev);231231#endif /* CONFIG_PM */232232
+10-14
drivers/usb/core/hub.c
···381381 dev_err (&hdev->dev,382382 "clear tt %d (%04x) error %d\n",383383 clear->tt, clear->devinfo, status);384384- kfree (clear);384384+ kfree(clear);385385 }386386 spin_unlock_irqrestore (&hub->tt.lock, flags);387387}···728728 list_del_init(&hub->event_list);729729 spin_unlock_irq(&hub_event_lock);730730731731- if (hub->descriptor) {732732- kfree(hub->descriptor);733733- hub->descriptor = NULL;734734- }731731+ kfree(hub->descriptor);732732+ hub->descriptor = NULL;735733736736- if (hub->status) {737737- kfree(hub->status);738738- hub->status = NULL;739739- }734734+ kfree(hub->status);735735+ hub->status = NULL;740736741737 if (hub->buffer) {742738 usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer,···14521456 /* FIXME let caller ask to power down the port:14531457 * - some devices won't enumerate without a VBUS power cycle14541458 * - SRP saves power that way14551455- * - usb_suspend_device(dev,PM_SUSPEND_DISK)14591459+ * - usb_suspend_device(dev, PMSG_SUSPEND)14561460 * That's easy if this hub can switch power per-port, and14571461 * khubd reactivates the port later (timer, SRP, etc).14581462 * Powerdown must be optional, because of reset/DFU.···1527153115281532/*15291533 * Devices on USB hub ports have only one "suspend" state, corresponding15301530- * to ACPI D2 (PM_SUSPEND_MEM), "may cause the device to lose some context".15341534+ * to ACPI D2, "may cause the device to lose some context".15311535 * State transitions include:15321536 *15331537 * - suspend, resume ... when the VBUS power link stays live···17271731 struct usb_driver *driver;1728173217291733 intf = udev->actconfig->interface[i];17301730- if (intf->dev.power.power_state == PM_SUSPEND_ON)17341734+ if (intf->dev.power.power_state == PMSG_SUSPEND)17311735 continue;17321736 if (!intf->dev.driver) {17331737 /* FIXME maybe force to alt 0 */···1741174517421746 /* can we do better than just logging errors? */17431747 status = driver->resume(intf);17441744- if (intf->dev.power.power_state != PM_SUSPEND_ON17481748+ if (intf->dev.power.power_state != PMSG_ON17451749 || status)17461750 dev_dbg(&intf->dev,17471751 "resume fail, state %d code %d\n",···23502354 schedule_work (&hub->leds);23512355 }23522356 }23532353- kfree (qual);23572357+ kfree(qual);23542358}2355235923562360static unsigned
···11331133 /* prevent submissions using previous endpoint settings */11341134 usb_disable_interface(dev, iface);1135113511361136- /* 9.1.1.5 says:11371137- *11381138- * Configuring a device or changing an alternate setting11391139- * causes all of the status and configuration values11401140- * associated with endpoints in the affected interfaces to11411141- * be set to their default values. This includes setting11421142- * the data toggle of any endpoint using data toggles to11431143- * the value DATA0.11441144- *11451145- * Some devices take this too literally and don't reset the data11461146- * toggles if the new altsetting is the same as the old one (the11471147- * command isn't "changing" an alternate setting). We will manually11481148- * reset the toggles when the new and old altsettings are the same.11491149- * Most devices won't need this, but fortunately it doesn't happen11501150- * often.11511151- */11521152- if (iface->cur_altsetting == alt)11531153- manual = 1;11541136 iface->cur_altsetting = alt;1155113711561138 /* If the interface only has one altsetting and the device didn't11571157- * accept the request (or whenever the old altsetting is the same11581158- * as the new one), we attempt to carry out the equivalent action11391139+ * accept the request, we attempt to carry out the equivalent action11591140 * by manually clearing the HALT feature for each endpoint in the11601141 * new altsetting.11611142 */···11831202 *11841203 * Because this affects multiple interfaces, avoid using this with composite11851204 * (multi-interface) devices. Instead, the driver for each interface may11861186- * use usb_set_interface() on the interfaces it claims. Resetting the whole12051205+ * use usb_set_interface() on the interfaces it claims. Be careful though;12061206+ * some devices don't support the SET_INTERFACE request, and others won't12071207+ * reset all the interface state (notably data toggles). Resetting the whole11871208 * configuration would affect other drivers' interfaces.11881209 *11891210 * The caller must own the device lock.
+10-6
drivers/usb/core/urb.c
···420420 *421421 * Host Controller Drivers (HCDs) place all the URBs for a particular422422 * endpoint in a queue. Normally the queue advances as the controller423423- * hardware processes each request. But when an URB terminates with any424424- * fault (such as an error, or being unlinked) its queue stops, at least425425- * until that URB's completion routine returns. It is guaranteed that426426- * the queue will not restart until all its unlinked URBs have been fully427427- * retired, with their completion routines run, even if that's not until428428- * some time after the original completion handler returns.423423+ * hardware processes each request. But when an URB terminates with an424424+ * error its queue stops, at least until that URB's completion routine425425+ * returns. It is guaranteed that the queue will not restart until all426426+ * its unlinked URBs have been fully retired, with their completion427427+ * routines run, even if that's not until some time after the original428428+ * completion handler returns. Normally the same behavior and guarantees429429+ * apply when an URB terminates because it was unlinked; however if an430430+ * URB is unlinked before the hardware has started to execute it, then431431+ * its queue is not guaranteed to stop until all the preceding URBs have432432+ * completed.429433 *430434 * This means that USB device drivers can safely build deep queues for431435 * large or complex transfers, and clean them up reliably after any sort
+3-10
drivers/usb/core/usb.c
···5050#include "hcd.h"5151#include "usb.h"52525353-extern int usb_hub_init(void);5454-extern void usb_hub_cleanup(void);5555-extern int usb_major_init(void);5656-extern void usb_major_cleanup(void);5757-extern int usb_host_init(void);5858-extern void usb_host_cleanup(void);5959-60536154const char *usbcore_name = "usbcore";6255···13751382 usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);13761383}1377138413781378-static int usb_generic_suspend(struct device *dev, u32 state)13851385+static int usb_generic_suspend(struct device *dev, pm_message_t message)13791386{13801387 struct usb_interface *intf;13811388 struct usb_driver *driver;1382138913831390 if (dev->driver == &usb_generic_driver)13841384- return usb_suspend_device (to_usb_device(dev), state);13911391+ return usb_suspend_device (to_usb_device(dev), message);1385139213861393 if ((dev->driver == NULL) ||13871394 (dev->driver_data == &usb_generic_driver_data))···13951402 return 0;1396140313971404 if (driver->suspend)13981398- return driver->suspend(intf, state);14051405+ return driver->suspend(intf, message);13991406 return 0;14001407}14011408
+8
drivers/usb/core/usb.h
···2121extern void usb_kick_khubd(struct usb_device *dev);2222extern void usb_resume_root_hub(struct usb_device *dev);23232424+extern int usb_hub_init(void);2525+extern void usb_hub_cleanup(void);2626+extern int usb_major_init(void);2727+extern void usb_major_cleanup(void);2828+extern int usb_host_init(void);2929+extern void usb_host_cleanup(void);3030+2431/* for labeling diagnostics */2532extern const char *usbcore_name;2633···3629extern struct file_operations usbfs_devices_fops;3730extern struct file_operations usbfs_device_file_operations;3831extern void usbfs_conn_disc_event(void);3232+39334034struct dev_state {4135 struct list_head list; /* state list */
+24-32
drivers/usb/gadget/ether.c
···100100101101/* CDC and RNDIS support the same host-chosen outgoing packet filters. */102102#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \103103+ |USB_CDC_PACKET_TYPE_ALL_MULTICAST \104104+ |USB_CDC_PACKET_TYPE_PROMISCUOUS \103105 |USB_CDC_PACKET_TYPE_DIRECTED)104106105107···324322/* also defer IRQs on highspeed TX */325323#define TX_DELAY qmult326324327327-#define BITRATE(g) (((g)->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS)325325+static inline int BITRATE(struct usb_gadget *g)326326+{327327+ return (g->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS;328328+}328329329330#else /* full speed (low speed doesn't do bulk) */330331#define qlen(gadget) DEFAULT_QLEN331332332332-#define BITRATE(g) FS_BPS333333+static inline int BITRATE(struct usb_gadget *g)334334+{335335+ return FS_BPS;336336+}333337#endif334338335339···11751167 eth_reset_config (dev);1176116811771169 /* default: pass all packets, no multicast filtering */11781178- dev->cdc_filter = 0x000f;11701170+ dev->cdc_filter = DEFAULT_FILTER;1179117111801172 switch (number) {11811173 case DEV_CONFIG_VALUE:···13511343 struct eth_dev *dev = get_gadget_data (gadget);13521344 struct usb_request *req = dev->req;13531345 int value = -EOPNOTSUPP;13541354- u16 wIndex = ctrl->wIndex;13551355- u16 wValue = ctrl->wValue;13561356- u16 wLength = ctrl->wLength;13461346+ u16 wIndex = (__force u16) ctrl->wIndex;13471347+ u16 wValue = (__force u16) ctrl->wValue;13481348+ u16 wLength = (__force u16) ctrl->wLength;1357134913581350 /* descriptors just go into the pre-allocated ep0 buffer,13591351 * while config change events may enable network traffic.···1701169317021694 /* Some platforms perform better when IP packets are aligned,17031695 * but on at least one, checksumming fails otherwise. Note:17041704- * this doesn't account for variable-sized RNDIS headers.16961696+ * RNDIS headers involve variable numbers of LE32 values.17051697 */17061698 skb_reserve(skb, NET_IP_ALIGN);17071699···17381730#ifdef CONFIG_USB_ETH_RNDIS17391731 /* we know MaxPacketsPerTransfer == 1 here */17401732 if (dev->rndis)17411741- rndis_rm_hdr (req->buf, &(skb->len));17331733+ status = rndis_rm_hdr (skb);17421734#endif17431743- if (ETH_HLEN > skb->len || skb->len > ETH_FRAME_LEN) {17351735+ if (status < 017361736+ || ETH_HLEN > skb->len17371737+ || skb->len > ETH_FRAME_LEN) {17441738 dev->stats.rx_errors++;17451739 dev->stats.rx_length_errors++;17461740 DEBUG (dev, "rx length %d\n", skb->len);···20572047 DEBUG ((struct eth_dev *) ep->driver_data,20582048 "rndis control ack complete --> %d, %d/%d\n",20592049 req->status, req->actual, req->length);20602060-20612061- usb_ep_free_buffer(ep, req->buf, req->dma, 8);20622062- usb_ep_free_request(ep, req);20632050}2064205120652052static int rndis_control_ack (struct net_device *net)20662053{20672054 struct eth_dev *dev = netdev_priv(net);20682055 u32 length;20692069- struct usb_request *resp;20562056+ struct usb_request *resp = dev->stat_req;2070205720712058 /* in case RNDIS calls this after disconnect */20722072- if (!dev->status_ep) {20592059+ if (!dev->status) {20732060 DEBUG (dev, "status ENODEV\n");20742061 return -ENODEV;20752062 }2076206320772077- /* Allocate memory for notification ie. ACK */20782078- resp = usb_ep_alloc_request (dev->status_ep, GFP_ATOMIC);20792079- if (!resp) {20802080- DEBUG (dev, "status ENOMEM\n");20812081- return -ENOMEM;20822082- }20832083-20842084- resp->buf = usb_ep_alloc_buffer (dev->status_ep, 8,20852085- &resp->dma, GFP_ATOMIC);20862086- if (!resp->buf) {20872087- DEBUG (dev, "status buf ENOMEM\n");20882088- usb_ep_free_request (dev->status_ep, resp);20892089- return -ENOMEM;20902090- }20912091-20922064 /* Send RNDIS RESPONSE_AVAILABLE notification;20932065 * USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too20942066 */···21052113 if (dev->rndis) {21062114 rndis_set_param_medium (dev->rndis_config,21072115 NDIS_MEDIUM_802_3,21082108- BITRATE(dev->gadget));21162116+ BITRATE(dev->gadget)/100);21092117 rndis_send_media_state (dev, 1);21102118 }21112119#endif ···22992307 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);23002308 } else if (gadget_is_pxa27x(gadget)) {23012309 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);23022302- } else if (gadget_is_s3c2410(gadget)) {23032303- device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);23102310+ } else if (gadget_is_s3c2410(gadget)) {23112311+ device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);23042312 } else if (gadget_is_at91(gadget)) {23052313 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213);23062314 } else {
+5-7
drivers/usb/gadget/omap_udc.c
···28092809 return 0;28102810}2811281128122812-/* suspend/resume/wakeup from sysfs (echo > power/state) */28132813-28142814-static int omap_udc_suspend(struct device *dev, u32 state, u32 level)28122812+static int omap_udc_suspend(struct device *dev, pm_message_t state, u32 level)28152813{28162814 if (level != 0)28172815 return 0;2818281628192817 DBG("suspend, state %d\n", state);28202818 omap_pullup(&udc->gadget, 0);28212821- udc->gadget.dev.power.power_state = 3;28222822- udc->gadget.dev.parent->power.power_state = 3;28192819+ udc->gadget.dev.power.power_state = PMSG_SUSPEND;28202820+ udc->gadget.dev.parent->power.power_state = PMSG_SUSPEND;28232821 return 0;28242822}28252823···28272829 return 0;2828283028292831 DBG("resume + wakeup/SRP\n");28302830- udc->gadget.dev.parent->power.power_state = 0;28312831- udc->gadget.dev.power.power_state = 0;28322832+ udc->gadget.dev.parent->power.power_state = PMSG_ON;28332833+ udc->gadget.dev.power.power_state = PMSG_ON;28322834 omap_pullup(&udc->gadget, 1);2833283528342836 /* maybe the host would enumerate us if we nudged it */
···394394 mark = ' ';395395 if (hw_curr == td->qtd_dma)396396 mark = '*';397397- else if (qh->hw_qtd_next == td->qtd_dma)397397+ else if (qh->hw_qtd_next == cpu_to_le32(td->qtd_dma))398398 mark = '+';399399 else if (QTD_LENGTH (scratch)) {400400 if (td->hw_alt_next == ehci->async->hw_alt_next)
+2-2
drivers/usb/host/ehci-hcd.c
···721721 * the right sort of wakeup. 722722 */723723724724-static int ehci_suspend (struct usb_hcd *hcd, u32 state)724724+static int ehci_suspend (struct usb_hcd *hcd, pm_message_t message)725725{726726 struct ehci_hcd *ehci = hcd_to_ehci (hcd);727727···729729 msleep (100);730730731731#ifdef CONFIG_USB_SUSPEND732732- (void) usb_suspend_device (hcd->self.root_hub, state);732732+ (void) usb_suspend_device (hcd->self.root_hub, message);733733#else734734 usb_lock_device (hcd->self.root_hub);735735 (void) ehci_hub_suspend (hcd);
···310310311311 for (i = qh->start; i < ehci->periodic_size; i += period) {312312 union ehci_shadow *prev = &ehci->pshadow [i];313313- u32 *hw_p = &ehci->periodic [i];313313+ __le32 *hw_p = &ehci->periodic [i];314314 union ehci_shadow here = *prev;315315- u32 type = 0;315315+ __le32 type = 0;316316317317 /* skip the iso nodes at list head */318318 while (here.ptr) {
···458458459459/* states match PCI usage, always suspending the root hub except that460460 * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset).461461+ *462462+ * FIXME: above comment is not right, and code is wrong, too :-(.461463 */462464463463-static int ohci_omap_suspend(struct device *dev, u32 state, u32 level)465465+static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level)464466{465467 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));466468 int status = -EINVAL;
···868868869869 se401->dev = NULL;870870871871- for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) {872872- usb_kill_urb(se401->urb[i]);873873- usb_free_urb(se401->urb[i]);874874- se401->urb[i] = NULL;875875- kfree(se401->sbuf[i].data);876876- }877877- for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) {871871+ for (i=0; i<SE401_NUMSBUF; i++)872872+ if (se401->urb[i]) {873873+ usb_kill_urb(se401->urb[i]);874874+ usb_free_urb(se401->urb[i]);875875+ se401->urb[i] = NULL;876876+ kfree(se401->sbuf[i].data);877877+ }878878+ for (i=0; i<SE401_NUMSCRATCH; i++) {878879 kfree(se401->scratch[i].data);879880 }880881 if (se401->inturb) {
+2-4
drivers/usb/media/usbvideo.c
···11691169 }11701170 RingQueue_Free(&uvd->dp);11711171 for (i=0; i < USBVIDEO_NUMSBUF; i++) {11721172- if (uvd->sbuf[i].data != NULL) {11731173- kfree (uvd->sbuf[i].data);11741174- uvd->sbuf[i].data = NULL;11751175- }11721172+ kfree(uvd->sbuf[i].data);11731173+ uvd->sbuf[i].data = NULL;11761174 }11771175 }11781176 }
+2-4
drivers/usb/media/w9968cf.c
···36243624 return 0;3625362536263626fail: /* Free unused memory */36273627- if (cam->control_buffer)36283628- kfree(cam->control_buffer);36293629- if (cam->data_buffer)36303630- kfree(cam->data_buffer);36273627+ kfree(cam->control_buffer);36283628+ kfree(cam->data_buffer);36313629 if (cam->v4ldev)36323630 video_device_release(cam->v4ldev);36333631 up(&cam->dev_sem);
+10-16
drivers/usb/misc/auerswald.c
···705705/* free a single auerbuf */706706static void auerbuf_free (pauerbuf_t bp)707707{708708- if (bp->bufp) {709709- kfree (bp->bufp);710710- }711711- if (bp->dr) {712712- kfree (bp->dr);713713- }708708+ kfree(bp->bufp);709709+ kfree(bp->dr);714710 if (bp->urbp) {715715- usb_free_urb (bp->urbp);711711+ usb_free_urb(bp->urbp);716712 }717717- kfree (bp);713713+ kfree(bp);718714}719715720716/* free the buffers from an auerbuf list */···10891093*/10901094static void auerswald_int_free (pauerswald_t cp)10911095{10921092- if (cp->inturbp) {10931093- usb_free_urb (cp->inturbp);10941094- cp->inturbp = NULL;10951095- }10961096- if (cp->intbufp) {10971097- kfree (cp->intbufp);10981098- cp->intbufp = NULL;10991099- }10961096+ if (cp->inturbp) {10971097+ usb_free_urb(cp->inturbp);10981098+ cp->inturbp = NULL;10991099+ }11001100+ kfree(cp->intbufp);11011101+ cp->intbufp = NULL;11001102}1101110311021104/* This function is called to activate the interrupt
···202202 for (i=0; i < serial->num_ports; ++i) {203203 /* My special items, the standard routines free my urbs */204204 priv = usb_get_serial_port_data(serial->port[i]);205205- if (priv)206206- kfree(priv);205205+ kfree(priv);207206 }208207}209208
···568568* and the sleep. In other words, spin_unlock_irqrestore and569569* interruptible_sleep_on_timeout are "atomic" with respect to570570* wake ups. This is used to implement condition variables.571571+*572572+* interruptible_sleep_on_timeout is deprecated and has been replaced573573+* with the equivalent code.571574*/572575573576static inline long cond_wait_interruptible_timeout_irqrestore(···579576{580577 DEFINE_WAIT(wait);581578582582- prepare_to_wait(q, &wait, TASK_UNINTERRUPTIBLE);579579+ prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);583580 spin_unlock_irqrestore(lock, flags);584581 timeout = schedule_timeout(timeout);585582 finish_wait(q, &wait);586583587584 return timeout;588588-589585}590586591587···15981596 dbg( "digi_close: write oob failed, ret=%d", ret );1599159716001598 /* wait for final commands on oob port to complete */16011601- prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_UNINTERRUPTIBLE);15991599+ prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);16021600 schedule_timeout(DIGI_CLOSE_TIMEOUT);16031601 finish_wait(&priv->dp_flush_wait, &wait);16041602···1997199519981996 } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) {1999199720002000- wake_up( &priv->dp_flush_wait );19981998+ wake_up_interruptible( &priv->dp_flush_wait );2001199920022000 }20032001
+2-4
drivers/usb/serial/empeg.c
···550550failed_usb_serial_register:551551 for (i = 0; i < NUM_URBS; ++i) {552552 if (write_urb_pool[i]) {553553- if (write_urb_pool[i]->transfer_buffer)554554- kfree(write_urb_pool[i]->transfer_buffer);553553+ kfree(write_urb_pool[i]->transfer_buffer);555554 usb_free_urb(write_urb_pool[i]);556555 }557556 }···574575 * the host controllers get fixed to set urb->dev = NULL after575576 * the urb is finished. Otherwise this call oopses. */576577 /* usb_kill_urb(write_urb_pool[i]); */577577- if (write_urb_pool[i]->transfer_buffer)578578- kfree(write_urb_pool[i]->transfer_buffer);578578+ kfree(write_urb_pool[i]->transfer_buffer);579579 usb_free_urb (write_urb_pool[i]);580580 }581581 }
+3-7
drivers/usb/serial/ftdi_sio.c
···13471347 priv->flags = ASYNC_LOW_LATENCY;1348134813491349 /* Increase the size of read buffers */13501350- if (port->bulk_in_buffer) {13511351- kfree (port->bulk_in_buffer);13521352- }13501350+ kfree(port->bulk_in_buffer);13531351 port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL);13541352 if (!port->bulk_in_buffer) {13551353 kfree (priv);···13631365 usb_free_urb (port->write_urb);13641366 port->write_urb = NULL;13651367 }13661366- if (port->bulk_out_buffer) {13671367- kfree (port->bulk_out_buffer);13681368- port->bulk_out_buffer = NULL;13691369- }13681368+ kfree(port->bulk_out_buffer);13691369+ port->bulk_out_buffer = NULL;1370137013711371 usb_set_serial_port_data(serial->port[0], priv);13721372
+8-16
drivers/usb/serial/io_edgeport.c
···951951952952953953 /* clean up the transfer buffer */954954- if (urb->transfer_buffer != NULL) {955955- kfree(urb->transfer_buffer);956956- }954954+ kfree(urb->transfer_buffer);957955958956 /* Free the command urb */959957 usb_free_urb (urb);···1264126612651267 if (edge_port->write_urb) {12661268 /* if this urb had a transfer buffer already (old transfer) free it */12671267- if (edge_port->write_urb->transfer_buffer != NULL) {12681268- kfree(edge_port->write_urb->transfer_buffer);12691269- }12701270- usb_free_urb (edge_port->write_urb);12691269+ kfree(edge_port->write_urb->transfer_buffer);12701270+ usb_free_urb(edge_port->write_urb);12711271 edge_port->write_urb = NULL;12721272 }12731273- if (edge_port->txfifo.fifo) {12741274- kfree(edge_port->txfifo.fifo);12751275- edge_port->txfifo.fifo = NULL;12761276- }12731273+ kfree(edge_port->txfifo.fifo);12741274+ edge_port->txfifo.fifo = NULL;1277127512781276 dbg("%s exited", __FUNCTION__);12791277} ···14131419 // get a pointer to the write_urb14141420 urb = edge_port->write_urb;1415142114161416- /* if this urb had a transfer buffer already (old transfer) free it */14171417- if (urb->transfer_buffer != NULL) {14181418- kfree(urb->transfer_buffer);14191419- urb->transfer_buffer = NULL;14201420- }14221422+ /* make sure transfer buffer is freed */14231423+ kfree(urb->transfer_buffer);14241424+ urb->transfer_buffer = NULL;1421142514221426 /* build the data header for the buffer and port that we are about to send out */14231427 count = fifo->count;
···119119 /* expect to get short transfer if no card fitted */120120 if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {121121 /* had a short transfer, no card inserted, free map memory */122122- if (info->lba_to_pba)123123- kfree(info->lba_to_pba);124124- if (info->pba_to_lba)125125- kfree(info->pba_to_lba);122122+ kfree(info->lba_to_pba);123123+ kfree(info->pba_to_lba);126124 info->lba_to_pba = NULL;127125 info->pba_to_lba = NULL;128126···647649 return -1;648650 }649651650650- if (info->lba_to_pba)651651- kfree(info->lba_to_pba);652652- if (info->pba_to_lba)653653- kfree(info->pba_to_lba);652652+ kfree(info->lba_to_pba);653653+ kfree(info->pba_to_lba);654654 info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);655655 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);656656657657 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {658658- if (info->lba_to_pba != NULL)659659- kfree(info->lba_to_pba);660660- if (info->pba_to_lba != NULL)661661- kfree(info->pba_to_lba);658658+ kfree(info->lba_to_pba);659659+ kfree(info->pba_to_lba);662660 info->lba_to_pba = NULL;663661 info->pba_to_lba = NULL;664662 kfree(buffer);···722728 if (!extra)723729 return;724730725725- if (info->lba_to_pba)726726- kfree(info->lba_to_pba);727727- if (info->pba_to_lba)728728- kfree(info->pba_to_lba);731731+ kfree(info->lba_to_pba);732732+ kfree(info->pba_to_lba);729733}730734731735
+1-1
drivers/usb/storage/transport.c
···996996 * command phase and the data phase. Some devices need a little997997 * more than that, probably because of clock rate inaccuracies. */998998 if (unlikely(us->flags & US_FL_GO_SLOW))999999- udelay(110);999999+ udelay(125);1000100010011001 if (transfer_length) {10021002 unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ?
+13
drivers/usb/storage/unusual_devs.h
···763763 US_FL_SINGLE_LUN ),764764#endif765765766766+#ifdef CONFIG_USB_STORAGE_DATAFAB767767+/* Reported by Felix Moeller <felix@derklecks.de>768768+ * in Germany this is sold by Hama with the productnumber 46952769769+ * as "DualSlot CompactFlash(TM) & MStick Drive USB"770770+ */771771+UNUSUAL_DEV( 0x07c4, 0xa10b, 0x0000, 0xffff,772772+ "DataFab Systems Inc.",773773+ "USB CF+MS",774774+ US_SC_SCSI, US_PR_DATAFAB, NULL,775775+ 0 ),776776+777777+#endif778778+766779/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100767780 * Only revision 1.13 tested (same for all of the above devices,768781 * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY.
+2-2
include/linux/usb.h
···558558559559 int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);560560561561- int (*suspend) (struct usb_interface *intf, u32 state);561561+ int (*suspend) (struct usb_interface *intf, pm_message_t message);562562 int (*resume) (struct usb_interface *intf);563563564564 const struct usb_device_id *id_table;···977977 int timeout);978978979979/* selective suspend/resume */980980-extern int usb_suspend_device(struct usb_device *dev, u32 state);980980+extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);981981extern int usb_resume_device(struct usb_device *dev);982982983983
+1-1
include/linux/usb_cdc.h
···114114115115 /* type is associated with mdlm_desc.bGUID */116116 __u8 bGuidDescriptorType;117117- __u8 bDetailData[];117117+ __u8 bDetailData[0];118118} __attribute__ ((packed));119119120120/*-------------------------------------------------------------------------*/