aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/core
AgeCommit message (Collapse)Author
2007-07-19USB: documentation update for usb_unlink_urbAlan Stern
This patch (as936) updates the kerneldoc for usb_unlink_urb. The explanation of how endpoint queues are meant to work is now clearer and in better agreement with reality. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19USB: fix warning caused by autosuspend counter going negativeAlan Stern
This patch (as937) fixes a minor bug in the autosuspend usage-counting code. Each hub's usage counter keeps track of the number of unsuspended children. However the current driver increments the counter after registering a new child, by which time the child may already have been suspended and caused the counter to go negative. The obvious solution is to increment the counter before registering the child. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19USB: add "descriptors" binary sysfs attributeAlan Stern
This patch (as934) adds a new readonly binary sysfs attribute file called "descriptors" for each USB device. The attribute contains the device descriptor followed by the raw descriptor entry (config plug subsidiary descriptors) for the current configuration. Having this information available in fixed-format binary makes life a lot easier for user programs by avoiding the need to open, read, and parse multiple sysfs text files. The information in this attribute file is much like that in usbfs's device file, but there are some significant differences: The 2-byte fields in the device descriptor are left in little-endian byte order, as they appear on the bus and in the kernel. Only one raw descriptor set is presented, that of the current configuration. Opening this file will not cause a suspended device to be autoresumed. The last item in particular should be a big selling point for libusb, which currently forces all USB devices to be resumed as it scans the device tree. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Dave Mielke <dave@mielke.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-18dev_vdbg(), available with -DVERBOSE_DEBUGDavid Brownell
This defines a dev_vdbg() call, which is enabled with -DVERBOSE_DEBUG. When enabled, dev_vdbg() acts just like dev_dbg(). When disabled, it is a NOP ... just like dev_dbg() without -DDEBUG. The specific code was moved out of a USB patch, but lots of drivers have similar support. That is, code can now be written to use an additional level of debug output, selected at compile time. Many driver authors have found this idiom to be very useful. A typical usage model is for "normal" debug messages to focus on fault paths and not be very "chatty", so that those messages can be left on during normal operation without much of a performance or syslog load. On the other hand "verbose" messages would be noisy enough that they wouldn't normally be enabled; they might even affect timings enough to change system or driver behavior. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-17Freezer: make kernel threads nonfreezable by defaultRafael J. Wysocki
Currently, the freezer treats all tasks as freezable, except for the kernel threads that explicitly set the PF_NOFREEZE flag for themselves. This approach is problematic, since it requires every kernel thread to either set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't care for the freezing of tasks at all. It seems better to only require the kernel threads that want to or need to be frozen to use some freezer-related code and to remove any freezer-related code from the other (nonfreezable) kernel threads, which is done in this patch. The patch causes all kernel threads to be nonfreezable by default (ie. to have PF_NOFREEZE set by default) and introduces the set_freezable() function that should be called by the freezable kernel threads in order to unset PF_NOFREEZE. It also makes all of the currently freezable kernel threads call set_freezable(), so it shouldn't cause any (intentional) change of behaviour to appear. Additionally, it updates documentation to describe the freezing of tasks more accurately. [akpm@linux-foundation.org: build fixes] Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net> Cc: Pavel Machek <pavel@ucw.cz> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Gautham R Shenoy <ego@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-12USB: additions to the quirk listOliver Neukum
this adds some scanners reported to be crashed by autosuspend to the quirk list. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: quirk for samsung printerOliver Neukum
this printer does not survive suspension. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: usb/dma doc updatesDavid Brownell
This patch updates some of the documentation about DMA buffer management for USB, and ways to avoid extra copying. Our understanding of the issues has improved over time. - Most drivers should *avoid* the dma-coherent allocators. There are a few exceptions (like the HID driver). - Some methods are currently commented out; it seems folk writing USB drivers aren't doing performance tuning at that level yet. - Just avoid highmem; there's no good way to pass an "I can do highmem DMA" capability through a driver stack. This is easy, everything already avoids highmem. But it'd be nice if x86_32 systems with much physical memory could use it directly with network adapters and mass storage devices. (Patch, anyone?) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: make the usb_device numa_node get assigned from controllerYinghai Lu
So we can use dev_to_node(&usb_dev->dev) later in kmalloc_node to dma buffer Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Cc: Andi Kleen <ak@suse.de> Acked-by: Christoph Lameter <clameter@sgi.com> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Make usb-autosuspend timer 1 sec jiffy alignedVenki Pallipadi
Make usb autosuspend timers 1sec jiffy aligned. This helps to reduce the frequency at which the CPU must be taken out of a lower-power state. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Don't autosuspend Blackberry devices.Jeremy Katz
Blackberry devices charge over USB. By autosuspending the port, they are not able to charge reliably. Signed-off-by: Jeremy Katz <katzj@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: add IAD support to usbfs and sysfsCraig W. Nadler
USB_IAD: Adds support for USB Interface Association Descriptors. This patch adds support to the USB host stack for parsing, storing, and displaying Interface Association Descriptors. In /proc/bus/usb/devices lines starting with A: show the fields in an IAD. In sysfs if an interface on a USB device is referenced by an IAD the following files will be added to the sysfs directory for that interface: iad_bFirstInterface, iad_bInterfaceCount, iad_bFunctionClass, and iad_bFunctionSubClass, iad_bFunctionProtocol Signed-off-by: Craig W. Nadler <craig@nadler.us> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Fix off-by-1 error in the scatter-gather libraryAlan Stern
The loop in usb_sg_wait() is structured in a way that makes it hard to tell, when the loop exits, whether or not the last URB submission succeeded. This patch (as928) changes it from a "for" loop to a "while" loop and keeps "i" always equal to the number of successful submissions. This fixes an off-by-one error which can show up when the first URB submission fails. The patch also removes a couple of lines that initialize fields which don't need to be initialized. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Don't resume root hub if the controller is suspendedAlan Stern
Root hubs can't be resumed if their parent controller device is still suspended. This patch (as925) adds a check for that condition in hcd_bus_resume() and prevents it from being treated as a fatal controller failure. ehci-hcd is updated to add the corresponding test. Unnecessary debugging messages are removed from uhci-hcd and dummy-hcd. The error return code from dummy-hcd is changed to -ESHUTDOWN, the same as the others. ohci-hcd doesn't need any changes. Suspend handling in the non-PCI host drivers is somewhat hit-and-miss. This patch shouldn't have any effect on them. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Remove usages of dev->power.power_stateAlan Stern
This patch (as922) removes all but one of the remaining vestiges of dev->power.power_state from usbcore. The only usage left must remain until the deprecated "power/state" sysfs attribute is gone. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Add URB_FREE_BUFFER flag and the logic behind itMarcel Holtmann
USB: Add URB_FREE_BUFFER flag for freeing the transfer buffer In some cases it is not needed that the driver keeps track of the transfer buffer of an URB. It can be simply freed along with the URB itself when the reference count goes down to zero. The new flag URB_FREE_BUFFER enables this behavior. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Fix up full-speed bInterval values in high-speed interrupt descriptorLaurent Pinchart
Many device manufacturers are using full-speed bInterval values in high-speed interrupt endpoint descriptors. If the bInterval value is greater than 16, assume the device uses full-speed descriptors and fix the value accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12usb: free DMA mappings if enqueue failsPete Zaitcev
This patch releases DMA resources if enqueue fails in the HCD. Linux had this bug ever since we converted from virt_to_bus for 2.4. It is difficult to hit. A user would need a significant memory pressure or some other unusual condition. It was reported to me by IBM. They ran a management application for RSA II adapters which sent Bulk requests to an Interrupt endpoint. Submissions got rejected by HCD due to an invalid interval value and the swiotlb pool became depleted in the matter of hours. We fixed the invalid interval issue in devio.c separately, but this seems to be a bug worth fixing as well. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Handle bogus low-speed Bulk endpointsAlan Stern
A noticeable number of low-speed devices mistakenly include descriptors for Bulk endpoints, which is forbidden by the USB spec. In an attempt to make such devices more usable, this patch (as924) converts the descriptors to Interrupt with an interval of 1 ms. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: add power/persist device attributeAlan Stern
This patch (as920) adds an extra level of protection to the USB-Persist facility. Now it will apply by default only to hubs; for all other devices the user must enable it explicitly by setting the power/persist device attribute. The disconnect_all_children() routine in hub.c has been removed and its code placed inline. This is the way it was originally as part of hub_pre_reset(); the revised usage in hub_reset_resume() is sufficiently different that the code can no longer be shared. Likewise, mark_children_for_reset() is now inline as part of hub_reset_resume(). The end result looks much cleaner than before. The sysfs interface is updated to add the new attribute file, and there are corresponding documentation updates. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: unify reset_resume and normal resumeAlan Stern
This patch (as919) unifies the code paths used for normal resume and for reset-resume. Earlier I had failed to note a section in the USB spec which requires the host to resume a suspended port before resetting it if the attached device is enabled for remote wakeup. Since the port has to be resumed anyway, we might as well reuse the existing code. The main changes are: usb_reset_suspended_device() is eliminated. usb_root_hub_lost_power() is moved down next to the hub_reset_resume() routine, to which it is logically related. finish_port_resume() does a port reset() if the device's reset_resume flag is set. usb_port_resume() doesn't check whether the port is initially enabled if this is a USB-Persist sort of resume. Code to perform the port reset is added to the resume pathway for the non-CONFIG_USB_SUSPEND case. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: add reset_resume methodAlan Stern
This patch (as918) introduces a new USB driver method: reset_resume. It is called when a device needs to be reset as part of a resume procedure (whether because of a device quirk or because of the USB-Persist facility), thereby taking over a role formerly assigned to the post_reset method. As a consequence, post_reset no longer needs an argument indicating whether it is being called as part of a reset-resume. This separation of functions makes the code clearer. In addition, the pre_reset and post_reset method return types are changed; they now must return an error code. The return value is unused at present, but at some later time we may unbind drivers and re-probe if they encounter an error during reset handling. The existing pre_reset and post_reset methods in the usbhid, usb-storage, and hub drivers are updated to match the new requirements. For usbhid the post_reset routine is also used for reset_resume (duplicate method pointers); for the other drivers a new reset_resume routine is added. The change to hub.c looks bigger than it really is, because mark_children_for_reset_resume() gets moved down next to the new hub_reset_resume() routine. A minor change to usb-storage makes the usb_stor_report_bus_reset() routine acquire the host lock instead of requiring the caller to hold it already. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Jiri Kosina <jkosina@suse.cz> CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: remove excess code from hub.cAlan Stern
This patch (as917) removes a now-unnecessary level of subroutine nesting from hub.c. Since usb_port_suspend() does nothing but call hub_port_suspend(), and usb_port_resume() does nothing but call hub_port_resume(), there's no reason to keep the routines separate. Also included in the patch are a few cosmetic changes involving whitespace and use of braces. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: separate root and non-root suspend/resumeAlan Stern
This patch (as916) completes the separation of code paths for suspend and resume of root hubs as opposed to non-root devices. Root hubs will be power-managed through their bus_suspend and bus_resume methods, whereas normal devices will use usb_port_suspend() and usb_port_resume(). Changes to the hcd_bus_{suspend,resume} routines mostly represent motion of code that was already present elsewhere. They include: Adding debugging log messages, Setting the device state appropriately, and Adding a resume recovery time delay. Changes to the port-suspend and port-resume routines in hub.c include: Removal of checks for root devices (since they will never be triggered), and Removal of checks for NULL or invalid device pointers (these were left over from earlier kernel versions and aren't needed at all). Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: remove __usb_port_suspendAlan Stern
This patch (as915b) combines the public routine usb_port_suspend() and the private routine __usb_port_suspend() into a single function. By removing the explicit mention of otg_port in the call to __usb_port_suspend(), we prevent a possible error in which the system tries to perform HNP on the wrong port when a non-targeted device is plugged into a non-OTG port. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: introduce usb_anchorOliver Neukum
- introduction of usb_anchor and its methods Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB Core: hub.c: prevent re-enumeration on HNPVikram Pandita
Patch is to prevent the OTG host of doing 3 times enumeration of device when the Host suspends for HNP. The error code used in this case is ENOTSUPP. Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: rework C++-style commentsAlan Stern
This patch (as911) replaces some C++-style commented-out debugging lines in driver.c with a new "verbose debugging" macro. It makes the code look cleaner, and it's easier to turn the debugging on or off. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: prevent char device open/deregister raceAlan Stern
This patch (as908) adds central protection in usbcore for the prototypical race between opening and unregistering a char device. The spinlock used to protect the minor-numbers array is replaced with an rwsem, which can remain locked across a call to a driver's open() method. This guarantees that open() and deregister() will be mutually exclusive. The private locks currently used in several individual drivers for this purpose are no longer necessary, and the patch removes them. The following USB drivers are affected: usblcd, idmouse, auerswald, legousbtower, sisusbvga/sisusb, ldusb, adutux, iowarrior, and usb-skeleton. As a side effect of this change, usb_deregister_dev() must not be called while holding a lock that is acquired by open(). Unfortunately a number of drivers do this, but luckily the solution is simple: call usb_deregister_dev() before acquiring the lock. In addition to these changes (and their consequent code simplifications), the patch fixes a use-after-free bug in adutux and a race between open() and release() in iowarrior. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: hub.c loops forever on resume from ram due to bluetoothMark Lord
Okay, found it. The root cause here was a missing CONFIG_USB_SUSPEND=y, which means the hci_usb device never got marked as USB_STATE_SUSPENDED, which then caused the loop to go on forever. The system works fine now with CONFIG_USB_SUSPEND=y in the .config. Here's the patch to prevent future lockups for this or other causes. I no longer need it, but it does still seem a good idea. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Patch to align the various USB timers to fire at the same timeArjan van de Ven
This patch modifies the USB regular 250ms timer to be "perfectly aligned" to the second and quarters thereof. This change is there to make sure that if you have multiple USB ports, the timers for all these ports will fire at the same time rather than all spread out. All spread out wakes the CPU up from power saving idle a lot more than needed... Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Make device reset stop retrying after disconnectAlan Stern
This patch (as898) changes the port reset code in the hub driver. If a connect change occurs, it is reported the same way as a disconnect (which of course is what it really is). It also changes usb_reset_device(), to prevent the routine from futilely retrying the reset after a disconnect has occurred. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: add RESET_RESUME device quirkAlan Stern
This patch (as888) adds a new USB device quirk for devices which are unable to resume correctly. By using the new code added for the USB-persist facility, it is a simple matter to reset these devices instead of resuming them. To get things kicked off, a quirk entry is added for the Philips PSC805. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: add USB-Persist facilityAlan Stern
This patch (as886) adds the controversial USB-persist facility, allowing USB devices to persist across a power loss during system suspend. The facility is controlled by a new Kconfig option (with appropriate warnings about the potential dangers); when the option is off the behavior will remain the same as it is now. But when the option is on, people will be able to use suspend-to-disk and keep their USB filesystems intact -- something particularly valuable for small machines where the root filesystem is on a USB device! Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: make hub driver's release more robustAlan Stern
This revised patch (as893c) improves the method used by the hub driver to release its private data structure. The current code is non-robust, relying on a memory region not getting reused by another driver after it has been freed. The patch adds a reference count to the structure, resolving the question of when to release it. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: remove "locktree" routine from the hub driverAlan Stern
This patch (as892) removes the "locktree" routine from the hub driver. It currently is used in only one place, by a single kernel thread; hence it isn't doing any good. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: remove references to dev.power.power_stateAlan Stern
This revised patch (as891b) removes two unnecessary references to intf->dev.power.power_state from usb-storage, and replaces a reference to root_hub->dev.power.power_state with a check of hcd->state. This is in preparation for the removal of dev.power.power_state, which is already deprecated. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: don't unsuspend for a new connectionAlan Stern
This patch (as889) prevents the hub driver from trying to resume a port when there is a new connection. For one thing, the resume is not needed -- the upcoming port reset will clear the suspend feature automatically. For another, on some systems the resume fails and causes problems. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: move bus_suspend and bus_resume method callsAlan Stern
This patch (as885) moves the root-hub bus_suspend() and bus_resume() method calls from the hub driver's suspend and resume methods into the usb_generic driver methods, where they make just as much sense. Their old locations were not fully correct. For example, in a kernel compiled without CONFIG_USB_SUSPEND, if one were to do: echo -n 1-0:1.0 >/sys/bus/usb/drivers/hub/unbind to unbind the hub driver from a root hub, there would then be no way to suspend that root hub. Attempts to put the system to sleep would fail; the USB controller driver would refuse to suspend because the root hub was still active. The patch also makes a very slight change in the way devices with no driver are handled during suspend. Rather than doing a standard USB port-suspend directly, now the suspend routine in usb_generic is called. In practice this should never affect anyone. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: Implement PM FREEZE and PRETHAWAlan Stern
This patch (as884) finally implements the time-saving semantics possible with the Power Management FREEZE and PRETHAW events. Their proper handling requires only that devices be quiesced, with interrupts and DMA turned off; non-root USB devices don't actually need to be put in a suspended state. The patch checks and avoids doing the suspend call when possible. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: interface PM stateAlan Stern
This patch (as880) strives to keep the PM core's idea of a USB interface's power state in synch with usbcore's own idea. In the end this doesn't really matter, but it's better to be consistent. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11PM: Remove prev_state from struct dev_pm_infoRafael J. Wysocki
The prev_state member of struct dev_pm_info (defined in include/linux/pm.h) is only used during a resume to check if the device's state before the suspend was 'off', in which case the device is not resumed. However, in such cases the decision whether or not to resume the device should be made on the driver level and the resume callbacks from the device's bus and class should be executed anyway (the may be needed for some things other than just powering on the device). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08USB: Fix up bogus bInterval values in endpoint descriptorsAlan Stern
This patch (as904) adds code to check for endpoint descriptor bInterval values outside the legal limits. Illegal values are set to 32 ms, which seems like a reasonable default. This fixes Bugzilla #8432. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08USB: set default y for CONFIG_USB_DEVICE_CLASSKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: bert hubert <bert.hubert@netherlabs.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-29USB: replace flush_workqueue with cancel_sync_workAlan Stern
This patch (as912) replaces a couple of calls to flush_workqueue() with cancel_sync_work() and cancel_rearming_delayed_work(). Using a more directed approach allows us to avoid some nasty deadlocks. The prime example occurs when a first-level device (the parent is a root hub) is removed while at the same time the root hub gets a remote wakeup request. khubd would try to flush the autosuspend workqueue while holding the root-hub's lock, and the remote-wakeup workqueue routine would be waiting to lock the root hub. The patch also reorganizes the power management portion of usb_disconnect(), separating it out into its own routine. The autosuspend workqueue entry is cancelled immediately instead of waiting for the device's release routine. In addition, synchronization with the autosuspend thread is carried out even for root hubs (an oversight in the original code). Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Greg KH <gregkh@suse.de> Cc: Mark Lord <lkml@rtr.ca> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-22USB: fix ratelimit call semanticsAlan Stern
This patch (as910) fixes a ratelimit modification so that the original error-handling path will be followed even when the log-rate limitation kicks in. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-22USB: handle errors in power/level attributeAlan Stern
This patch (as906) improves the error handling for the USB power/level attribute file. If an error occurs, the original power-level settings will be restored. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-22USB: make the autosuspend workqueue thread freezableAlan Stern
This patch (as881b) makes the ksuspend_usb_wq workqueue freezable. We don't want a rogue workqueue thread running around, unexpectedly suspending or resuming USB devices in the middle of a system sleep transition. This fixes Bugzilla #8498. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-22USB: don't try to kzalloc 0 bytesAlan Stern
This patch (as907) prevents us from trying to allocate 0 bytes when an interface has no endpoint descriptors. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-22USB: remove short initial timeout for device descriptor fetchAlan Stern
This patch (as905) removes a micro-optimization from the hub port initialization code. Previously we had been using a short timeout on the first attempt the read the device descriptor; now we will use the standard timeout length. It's not clear that the short timeout ever provided any benefit. And now we know of one case where it actually hurts: The device can't meet the short timeout and then it gets terminally confused. This fixes Bugzilla #8444. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>