Commit Graph

381 Commits (4de78c6877ec21142582ac19453c2d453d1ea298)

Author SHA1 Message Date
Trond Myklebust 816724e65c Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Conflicts:

	fs/nfs/inode.c
	fs/super.c

Fix conflicts between patch 'NFS: Split fs/nfs/inode.c' and patch
'VFS: Permit filesystem to override root dentry on mount'
2006-06-24 13:07:53 -04:00
David Howells 454e2398be [PATCH] VFS: Permit filesystem to override root dentry on mount
Extend the get_sb() filesystem operation to take an extra argument that
permits the VFS to pass in the target vfsmount that defines the mountpoint.

The filesystem is then required to manually set the superblock and root dentry
pointers.  For most filesystems, this should be done with simple_set_mnt()
which will set the superblock pointer and then set the root dentry to the
superblock's s_root (as per the old default behaviour).

The get_sb() op now returns an integer as there's now no need to return the
superblock pointer.

This patch permits a superblock to be implicitly shared amongst several mount
points, such as can be done with NFS to avoid potential inode aliasing.  In
such a case, simple_set_mnt() would not be called, and instead the mnt_root
and mnt_sb would be set directly.

The patch also makes the following changes:

 (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
     pointer argument and return an integer, so most filesystems have to change
     very little.

 (*) If one of the convenience function is not used, then get_sb() should
     normally call simple_set_mnt() to instantiate the vfsmount. This will
     always return 0, and so can be tail-called from get_sb().

 (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
     dcache upon superblock destruction rather than shrink_dcache_anon().

     This is required because the superblock may now have multiple trees that
     aren't actually bound to s_root, but that still need to be cleaned up. The
     currently called functions assume that the whole tree is rooted at s_root,
     and that anonymous dentries are not the roots of trees which results in
     dentries being left unculled.

     However, with the way NFS superblock sharing are currently set to be
     implemented, these assumptions are violated: the root of the filesystem is
     simply a dummy dentry and inode (the real inode for '/' may well be
     inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
     with child trees.

     [*] Anonymous until discovered from another tree.

 (*) The documentation has been adjusted, including the additional bit of
     changing ext2_* into foo_* in the documentation.

[akpm@osdl.org: convert ipath_fs, do other stuff]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 07:42:45 -07:00
Greg Kroah-Hartman 0517587e58 [PATCH] USB: get USB suspend to work again
Yeah, it's a hack, but it is only temporary until Alan's patches
reworking this area make it in.  We really should not care what devices
below us are doing, especially when we do not really know what type of
devices they are.  This patch relies on the fact that the endpoint
devices do not have a driver assigned to us.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 22:54:23 -07:00
Greg Kroah-Hartman 43104f1da8 [PATCH] USB: only make /sys/class/usb show up when there is something in it
Now /sys/class/usb is dynamically created when we have something to put
in it, and removed when all devices go away.

Just trying to cut down on the clutter in sysfs...

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:19 -07:00
Greg Kroah-Hartman bd00949647 [PATCH] USB: convert usb class devices to real devices
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:19 -07:00
Greg Kroah-Hartman c182274ffe [PATCH] USB: move usb_device_class class devices to be real devices
This moves the usb class devices that control the usbfs nodes to show up
in the proper place in the larger device tree.

No userspace changes is needed, this is compatible due to the symlinks
generated by the driver core.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:19 -07:00
Greg Kroah-Hartman 9bde7497e0 [PATCH] USB: make endpoints real struct devices
This will allow for us to give endpoints a major/minor to create a
"usbfs2-like" way to access endpoints directly from userspace in an
easier manner than the current usbfs provides us.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:19 -07:00
Greg Kroah-Hartman 36679ea598 [PATCH] USB: make usb_create_ep_files take a struct device
Instead of a kobject, will make things easier in the future (don't know
what I was thinking when I did this originally...)

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:19 -07:00
Greg Kroah-Hartman 84412f6291 [PATCH] USB: move the endpoint specific sysfs code to it's own file
This makes it easier to modify in the future without touching anything else.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:18 -07:00
Philippe Retornaz 786dc1d3d7 [PATCH] usb: drivers/usb/core/devio.c dereferences a userspace pointer
See http://bugzilla.kernel.org/show_bug.cgi?id=6617.

This function dereference a __user pointer.

Signed-off-by: Philippe Retornaz <couriousous@mandriva.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:15 -07:00
Alan Stern 6ad07129a8 [PATCH] usbcore: recovery from Set-Configuration failure
This patch (as703) improves the error handling when a Set-Configuration
request fails.  The old interfaces are all unregistered before the
request is sent, and if the request fails then we don't know what config
the device is using.  So it makes no sense to leave actconfig pointing
to the old configuration with its invalid interfaces.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:15 -07:00
Alan Stern 7de18d8bf4 [PATCH] USB hub: use usb_reset_composite_device
This patch (as700) modifies the hub driver to take advantage of the new
usb_reset_composite_device API.  The existing code had special-case
calls stuck into usb_reset_device, just before and after the reset.
With the new version there's no need for special-case stuff; it all
happens naturally in the form of pre_reset and post_reset notifications.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:15 -07:00
Alan Stern 79efa097e7 [PATCH] usbcore: port reset for composite devices
This patch (as699) adds usb_reset_composite_device(), a routine for
sending a USB port reset to a device with multiple interfaces owned by
different drivers.  Drivers are notified about impending and completed
resets through two new methods in the usb_driver structure.

The patch modifieds the usbfs ioctl code to make it use the new routine
instead of usb_reset_device().  Follow-up patches will modify the hub,
usb-storage, and usbhid drivers so they can utilize this new API.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:15 -07:00
Giridhar Pemmasani 3f8f4a18f4 [PATCH] usbcore: Fix broken RNDIS config selection
RNDIS devices don't get configured owing to a typo in
choose_configuration().  This patch from Giridhar Pemmasani fixes the
typo.

From: Giridhar Pemmasani <giri@lmc.cs.sunysb.edu>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:14 -07:00
Daniel Drake 1fbe75e12f [PATCH] USB: print message when device is rejected due to insufficient power
2.6.16 introduces USB power budgeting in the Linux kernel, and since then, a
fair number of users have observed that some of their devices no longer work in
unpowered hubs (this is not a bug, the devices claim that they need more than
100mA).

The very least we can do is print an informational message to the kernel log
when this happens, otherwise it is not at all clear why the device was not
accepted.

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:14 -07:00
Greg Kroah-Hartman 782a7a632e [PATCH] USB: add usb_interrupt_msg() function for api completeness.
Really just a wrapper around usb_bulk_msg() but now it's documented
much better.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:12 -07:00
Micah Dowty 3612242e52 [PATCH] USB: Allow high-bandwidth isochronous packets via usbfs
This patch increases an arbitrary limit on the size of
individual isochronous packets submitted via usbfs. The
limit is still arbitrary, but it's now large enough to
support the maximum packet size used by high-bandwidth
isochronous transfers.

Signed-off-by: Micah Dowty <micah@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:11 -07:00
Micah Dowty e016683d59 [PATCH] USB: Remove 4088-byte limit on usbfs control URBs
This patch removes the artificial 4088-byte limit that usbfs
currently places on Control transfers. The USB spec does not
specify a strict limit on the size of an entire control transfer.
It does, however, state that the data stage "follows the same
protocol rules as bulk transfers." (USB 2, 8.5.3)

The level of support for large control transfers in real host
controllers varies, but it's important to support at least 4K
transfers. Windows enforces a maximum control transfer size
of 4K, so there exists some hardware that requires a full 4096
byte data stage. Without this patch, we fall short of that by
8 bytes on architectures with a 4K page size, and it becomes
impossible to support such hardware with a user-space driver.

Since any limit placed on control transfers by usbfs would be
arbitrary, this patch replaces the PAGE_SIZE limit with the same
arbitrary limit used by bulk transfers.

Signed-off-by: Micah Dowty <micah@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:11 -07:00
Alan Stern 4489a5712b [PATCH] USB: usbcore: always turn on hub port power
Some hubs claim not to support port-power switching, and right now the
hub driver believes them and does not enable power to their ports.
However it turns out that even though they don't actually switch power,
they do ignore all events on a port until told to turn on the power!
This problem has been reported by several users.

This revised patch (as672b) makes the hub driver always try to turn on
port power to all hubs, regardless of what the hub descriptor says.  It
also adds a comment explaining the need for this.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21 15:04:09 -07:00
David S. Miller c6387a48cf [SPARC]: Kill __irq_itoa().
This ugly hack was long overdue to die.

It was a way to print out Sparc interrupts in a more freindly format,
since IRQ numbers were arbitrary opaque 32-bit integers which vectored
into PIL levels.  These 32-bit integers were not necessarily in the
0-->NR_IRQS range, but the PILs they vectored to were.

The idea now is that we will increase NR_IRQS a little bit and use a
virtual<-->real IRQ number mapping scheme similar to PowerPC.

That makes this IRQ printing hack irrelevant, and furthermore only a
handful of drivers actually used __irq_itoa() making it even less
useful.

Signed-off-by: David S. Miller <davem@davemloft.net>
2006-06-20 01:21:29 -07:00
Trond Myklebust 1f5ce9e93a VFS: Unexport do_kern_mount() and clean up simple_pin_fs()
Replace all module uses with the new vfs_kern_mount() interface, and fix up
simple_pin_fs().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2006-06-09 09:34:16 -04:00
Alan Stern 436f5762bc [PATCH] USB: usbcore: don't check the device's power source
The choose_configuration() routine contains code the determine the
device's power source, so that configurations requiring external power
can be ruled out if the device is running on bus power.  Unfortunately
it turns out that some devices have errors in their config descriptors
and other devices don't like the GET_DEVICE_STATUS request.

Since that information wasn't used for anything else, this patch (as673)
removes the code, leaving only a comment.  It fixes bugzilla entry
#6448.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-05-08 23:43:55 -07:00
David Brownell db4cefaaea [PATCH] USB: fix OHCI PM regression
This fixes a small regression in USB controller power usage for many
OHCI controllers, notably including every non-PCI version of OHCI:  on
those systems, the runtime autosuspend mechanism is no longer enabled.

The change moves to saner defaults.  All root hubs are expected to handle
remote wakeup (and hence autosuspend), although drivers for buggy silicon
may override that default.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-05-08 23:43:55 -07:00
Linus Torvalds 754a264c42 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (158 commits)
  commit 4f705ae3e9
  Author: Bjorn Helgaas <bjorn.helgaas@hp.com>
  Date:   Mon Apr 3 17:09:22 2006 -0700
  
      [PATCH] DMI: move dmi_scan.c from arch/i386 to drivers/firmware/
      
      dmi_scan.c is arch-independent and is used by i386, x86_64, and ia64.
      Currently all three arches compile it from arch/i386, which means that ia64
      and x86_64 depend on things in arch/i386 that they wouldn't otherwise care
      about.
      
      This is simply "mv arch/i386/kernel/dmi_scan.c drivers/firmware/" (removing
      trailing whitespace) and the associated Makefile changes.  All three
      architectures already set CONFIG_DMI in their top-level Kconfig files.
      
      Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
      Cc: Andi Kleen <ak@muc.de>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Andrey Panin <pazke@orbita1.ru>
      Signed-off-by: Andrew Morton <akpm@osdl.org>
  ...
2006-04-14 17:07:57 -07:00
Andrew Morton 0266949205 [PATCH] pm: print name of failed suspend function
Print more diagnostic info to help identify the source of power management
suspend failures.

Example:

usb_hcd_pci_suspend(): pci_set_power_state+0x0/0x1af() returns -22
pci_device_suspend(): usb_hcd_pci_suspend+0x0/0x11b() returns -22
suspend_device(): pci_device_suspend+0x0/0x34() returns -22

Work-in-progress.  It needs lots more suspend_report_result() calls sprinkled
everywhere.

Cc: Patrick Mochel <mochel@digitalimplant.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@suspend2.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-04-14 11:41:25 -07:00
David Brownell 89ccbdc91b [PATCH] USB: otg hub support is optional
USB OTG devices are not required to support external hubs.  This adds a
configuration option to disable that support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-04-14 11:12:23 -07:00
Adrian Bunk 87ed0aeba8 [PATCH] USB: drivers/usb/core/: remove unused exports
This patch removes the following unused EXPORT_SYMBOL's:
- hub.c: usb_set_device_state
- usb.c: usb_alloc_dev
- usb.c: usb_disconnect

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-04-14 11:12:22 -07:00
Paul Mackerras bac30d1a78 Merge ../linux-2.6 2006-03-29 13:24:50 +11:00
Arjan van de Ven 99ac48f54a [PATCH] mark f_ops const in the inode
Mark the f_ops members of inodes as const, as well as fix the
ripple-through this causes by places that copy this f_ops and then "do
stuff" with it.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-28 09:16:05 -08:00
Benjamin Herrenschmidt e8222502ee [PATCH] powerpc: Kill _machine and hard-coded platform numbers
This removes statically assigned platform numbers and reworks the
powerpc platform probe code to use a better mechanism.  With this,
board support files can simply declare a new machine type with a
macro, and implement a probe() function that uses the flattened
device-tree to detect if they apply for a given machine.

We now have a machine_is() macro that replaces the comparisons of
_machine with the various PLATFORM_* constants.  This commit also
changes various drivers to use the new macro instead of looking at
_machine.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-03-28 23:15:54 +11:00
Alan Stern e041c68341 [PATCH] Notifier chain update: API changes
The kernel's implementation of notifier chains is unsafe.  There is no
protection against entries being added to or removed from a chain while the
chain is in use.  The issues were discussed in this thread:

    http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2

We noticed that notifier chains in the kernel fall into two basic usage
classes:

	"Blocking" chains are always called from a process context
	and the callout routines are allowed to sleep;

	"Atomic" chains can be called from an atomic context and
	the callout routines are not allowed to sleep.

We decided to codify this distinction and make it part of the API.  Therefore
this set of patches introduces three new, parallel APIs: one for blocking
notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
really just the old API under a new name).  New kinds of data structures are
used for the heads of the chains, and new routines are defined for
registration, unregistration, and calling a chain.  The three APIs are
explained in include/linux/notifier.h and their implementation is in
kernel/sys.c.

With atomic and blocking chains, the implementation guarantees that the chain
links will not be corrupted and that chain callers will not get messed up by
entries being added or removed.  For raw chains the implementation provides no
guarantees at all; users of this API must provide their own protections.  (The
idea was that situations may come up where the assumptions of the atomic and
blocking APIs are not appropriate, so it should be possible for users to
handle these things in their own way.)

There are some limitations, which should not be too hard to live with.  For
atomic/blocking chains, registration and unregistration must always be done in
a process context since the chain is protected by a mutex/rwsem.  Also, a
callout routine for a non-raw chain must not try to register or unregister
entries on its own chain.  (This did happen in a couple of places and the code
had to be changed to avoid it.)

Since atomic chains may be called from within an NMI handler, they cannot use
spinlocks for synchronization.  Instead we use RCU.  The overhead falls almost
entirely in the unregister routine, which is okay since unregistration is much
less frequent that calling a chain.

Here is the list of chains that we adjusted and their classifications.  None
of them use the raw API, so for the moment it is only a placeholder.

  ATOMIC CHAINS
  -------------
arch/i386/kernel/traps.c:		i386die_chain
arch/ia64/kernel/traps.c:		ia64die_chain
arch/powerpc/kernel/traps.c:		powerpc_die_chain
arch/sparc64/kernel/traps.c:		sparc64die_chain
arch/x86_64/kernel/traps.c:		die_chain
drivers/char/ipmi/ipmi_si_intf.c:	xaction_notifier_list
kernel/panic.c:				panic_notifier_list
kernel/profile.c:			task_free_notifier
net/bluetooth/hci_core.c:		hci_notifier
net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_chain
net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_expect_chain
net/ipv6/addrconf.c:			inet6addr_chain
net/netfilter/nf_conntrack_core.c:	nf_conntrack_chain
net/netfilter/nf_conntrack_core.c:	nf_conntrack_expect_chain
net/netlink/af_netlink.c:		netlink_chain

  BLOCKING CHAINS
  ---------------
arch/powerpc/platforms/pseries/reconfig.c:	pSeries_reconfig_chain
arch/s390/kernel/process.c:		idle_chain
arch/x86_64/kernel/process.c		idle_notifier
drivers/base/memory.c:			memory_chain
drivers/cpufreq/cpufreq.c		cpufreq_policy_notifier_list
drivers/cpufreq/cpufreq.c		cpufreq_transition_notifier_list
drivers/macintosh/adb.c:		adb_client_list
drivers/macintosh/via-pmu.c		sleep_notifier_list
drivers/macintosh/via-pmu68k.c		sleep_notifier_list
drivers/macintosh/windfarm_core.c	wf_client_list
drivers/usb/core/notify.c		usb_notifier_list
drivers/video/fbmem.c			fb_notifier_list
kernel/cpu.c				cpu_chain
kernel/module.c				module_notify_list
kernel/profile.c			munmap_notifier
kernel/profile.c			task_exit_notifier
kernel/sys.c				reboot_notifier_list
net/core/dev.c				netdev_chain
net/decnet/dn_dev.c:			dnaddr_chain
net/ipv4/devinet.c:			inetaddr_chain

It's possible that some of these classifications are wrong.  If they are,
please let us know or submit a patch to fix them.  Note that any chain that
gets called very frequently should be atomic, because the rwsem read-locking
used for blocking chains is very likely to incur cache misses on SMP systems.
(However, if the chain's callout routines may sleep then the chain cannot be
atomic.)

The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
material written by Keith Owens and suggestions from Paul McKenney and Andrew
Morton.

[jes@sgi.com: restructure the notifier chain initialization macros]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:50 -08:00
Linus Torvalds 2bf2154c6b Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (81 commits)
  [PATCH] USB: omninet: fix up debugging comments
  [PATCH] USB serial: add navman driver
  [PATCH] USB: Fix irda-usb use after use
  [PATCH] USB: rtl8150 small fix
  [PATCH] USB: ftdi_sio: add Icom ID1 USB product and vendor ids
  [PATCH] USB: cp2101: add new device IDs
  [PATCH] USB: fix check_ctrlrecip to allow control transfers in state ADDRESS
  [PATCH] USB: vicam.c: fix a NULL pointer dereference
  [PATCH] USB: ZC0301 driver bugfix
  [PATCH] USB: add support for Creativelabs Silvercrest USB keyboard
  [PATCH] USB: storage: new unusual_devs.h entry: Mitsumi 7in1 Card Reader
  [PATCH] USB: storage: unusual_devs.h entry 0420:0001
  [PATCH] USB: storage: another unusual_devs.h entry
  [PATCH] USB: storage: sandisk unusual_devices entry
  [PATCH] USB: fix initdata issue in isp116x-hcd
  [PATCH] USB: usbcore: usb_set_configuration oops (NULL ptr dereference)
  [PATCH] USB: usbcore: Don't assume a USB configuration includes any interfaces
  [PATCH] USB: ub 03 drop stall clearing
  [PATCH] USB: ub 02 remove diag
  [PATCH] USB: ub 01 remove first_open
  ...
2006-03-21 09:25:47 -08:00
Horst Schirmeier 24f8b116c4 [PATCH] USB: fix check_ctrlrecip to allow control transfers in state ADDRESS
check_ctrlrecip() disallows any control transfers if the device is
deconfigured (in configuration 0, ie.  state ADDRESS).  This for example
makes it impossible to read the device descriptors without configuring the
device, although most standard device requests are allowed in this state by
the spec.  This patch allows control transfers for the ADDRESS state, too.

Signed-off-by: Horst Schirmeier <horst@schirmeier.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:50:02 -08:00
Horst Schirmeier f48219db93 [PATCH] USB: usbcore: usb_set_configuration oops (NULL ptr dereference)
When trying to deconfigure a device via usb_set_configuration(dev, 0),
2.6.16-rc kernels after 55c527187c oops
with "Unable to handle NULL pointer dereference at...". This is due to
an unchecked dereference of cp in the power budget part.

Signed-off-by: Horst Schirmeier <horst@schirmeier.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:50:01 -08:00
Alan Stern 6aa35675bb [PATCH] USB: usbcore: Don't assume a USB configuration includes any interfaces
In a couple of places, usbcore assumes that a USB device configuration
will have a nonzero number of interfaces.  Having no interfaces may or
may not be allowed by the USB spec; in any event we shouldn't die if we
encounter such a thing.  This patch (as662) removes the assumptions.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:50:01 -08:00
Alan Stern 43c5d5aaaf [PATCH] usbcore: fix compile error with CONFIG_USB_SUSPEND=n
This patch (as647) fixes a small error introduced by a recent change to
the USB core suspend/resume code.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:58 -08:00
Alan Stern 6a8e87b23f [PATCH] USB core and HCDs: don't put_device while atomic
This patch (as640) removes several put_device and the corresponding
get_device calls from the USB core and HCDs.  Some of the puts were done
in atomic contexts, and none of them are needed since the core now
guarantees that every endpoint will be disabled and every URB completed
before a USB device is released.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:58 -08:00
David Brownell fb669cc01e [PATCH] USB: remove usbcore-specific wakeup flags
This makes usbcore use the driver model wakeup flags for host controllers
and for their root hubs.  Since previous patches have removed all users of
the HCD flags they replace, this converts the last users of those flags.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:56 -08:00
David Brownell b1e8f0a6a8 [PATCH] USB: usbcore sets up root hubs earlier
Make the HCD initialization sequence more sane ... notably, setting up
root hubs before HCDs are asked to do their one-time init.  Among other
things, that lets the HCDs do custom root hub init along with all the
other one-time initialization done in the (now misnamed) reset() method.

This also copies the controller wakeup flags into the root hub; it's
done a bit later than would be ideal, but that'll be necessary until
the PCI code initializes them correctly.  (The PCI patch breaks on PPC
due to how it sequences PCI initialization.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:56 -08:00
Arjan van de Ven 4186ecf8ad [PATCH] USB: convert a bunch of USB semaphores to mutexes
the patch below converts a bunch of semaphores-used-as-mutex in the USB
code to mutexes

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:55 -08:00
Adrian Bunk e266a12492 [PATCH] USB: drivers/usb/core/message.c: make usb_get_string() static
After the removal of usb-midi.c, there's no longer any external user of
usb_get_string().

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:54 -08:00
Andrew Morton 9fcd5c322c [PATCH] USB: optimise devio.c usbdev_read fix
drivers/usb/core/devio.c: In function `usbdev_read':
drivers/usb/core/devio.c:140: error: invalid type argument of `->'
drivers/usb/core/devio.c:141: error: invalid type argument of `->'
drivers/usb/core/devio.c:142: error: invalid type argument of `->'
drivers/usb/core/devio.c:143: error: invalid type argument of `->'

Cc: Oliver Neukum <oliver@neukum.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:52 -08:00
Oliver Neukum 8781ba0aa9 [PATCH] USB: optimise devio.c::usbdev_read
this is a small optimisation. It is ridiculous to do a kmalloc for
18 bytes. This puts it onto the stack.

Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 14:49:52 -08:00
Greg Kroah-Hartman b87ba0a33a [PATCH] add EXPORT_SYMBOL_GPL_FUTURE() to USB subsystem
The USB core symbols will be converted to GPL-only in a few years.  Mark
this as such and update the documentation explaining why, and provide a
pointer for developers to receive help if they need it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20 13:42:58 -08:00
Greg KH 410c05427a [PATCH] USB: Fix GPL markings on usb core functions.
I thought we had fixed up all non-gpl USB drivers, and was wrong to do
this.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-05 14:20:14 -08:00
Alexey Dobriyan 5d68dfcf3a [PATCH] USB: arm26: fix compilation of drivers/usb/core/message.c
drivers/usb/core/message.c:395: error: invalid use of undefined type `struct scatterlist'

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31 17:23:43 -08:00
Greg Kroah-Hartman e9aa795aae [PATCH] USB: add might_sleep() to usb_unlink_urb() to warn developers
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31 17:23:42 -08:00
Jes Sorensen 1b1dcc1b57 [PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem
This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.

Modified-by: Ingo Molnar <mingo@elte.hu>

(finished the conversion)

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2006-01-09 15:59:24 -08:00
Eric Dumazet 5160ee6fc8 [PATCH] shrink dentry struct
Some long time ago, dentry struct was carefully tuned so that on 32 bits
UP, sizeof(struct dentry) was exactly 128, ie a power of 2, and a multiple
of memory cache lines.

Then RCU was added and dentry struct enlarged by two pointers, with nice
results for SMP, but not so good on UP, because breaking the above tuning
(128 + 8 = 136 bytes)

This patch reverts this unwanted side effect, by using an union (d_u),
where d_rcu and d_child are placed so that these two fields can share their
memory needs.

At the time d_free() is called (and d_rcu is really used), d_child is known
to be empty and not touched by the dentry freeing.

Lockless lookups only access d_name, d_parent, d_lock, d_op, d_flags (so
the previous content of d_child is not needed if said dentry was unhashed
but still accessed by a CPU because of RCU constraints)

As dentry cache easily contains millions of entries, a size reduction is
worth the extra complexity of the ugly C union.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Dipankar Sarma <dipankar@in.ibm.com>
Cc: Maneesh Soni <maneesh@in.ibm.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Paul Jackson <pj@sgi.com>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: James Morris <jmorris@namei.org>
Cc: Stephen Smalley <sds@epoch.ncsc.mil>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:58 -08:00
Linus Torvalds db9edfd7e3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Trivial manual merge fixup for usb_find_interface clashes.
2006-01-04 18:44:12 -08:00
Kay Sievers 312c004d36 [PATCH] driver core: replace "hotplug" by "uevent"
Leave the overloaded "hotplug" word to susbsystems which are handling
real devices. The driver core does not "plug" anything, it just exports
the state to userspace and generates events.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 16:18:08 -08:00
Pete Zaitcev f5691d70d4 [PATCH] USB: fix usb_find_interface for ppc64
Fix usb_find_interface. You cannot case pointers to int and long on
a big-endian 64-bitter without consequences.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:51:44 -08:00
Pete Zaitcev aafbf24a11 [PATCH] USB: replace __setup("nousb") with __module_param_call
Fedora users complain that passing "nousbstorage" to the installer causes
the rest of the USB support to disappear. The installer uses kernel command
line as a way to pass options through Syslinux. The problem stems from the
use of strncmp() in obsolete_checksetup().

I used __module_param_call() instead of module_param because I wanted to
preserve the old syntax in grub.conf, and it's the only macro which allows
to remove the prefix.

The fix is tested to accept the option "nousb" correctly now.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:51:44 -08:00
Alan Stern f3d34ed48c [PATCH] USB: fix local variable clash
This patch (as621) fixes a local variable conflict I accidently
introduced into usb_set_configuration.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:51:42 -08:00
Arjan van de Ven 4c4c9432a6 [PATCH] USB: mark various usb tables const
patch below marks various USB tables and variables as const so that they
end up in .rodata section and don't cacheline share with things that get
written to. For the non-array variables it also allows gcc to optimize
more.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:51:40 -08:00
Alan Stern 2425e9fe67 [PATCH] USB: Don't assume root-hub resume succeeds
This patch (as614) makes a small change to the part of the hub driver
responsible for remote wakeup of root hubs.  When these wakeups occur
the driver is suspended, and in case the resume fails the driver should
remain suspended -- it shouldn't try to proceed with its normal
processing.

This will hardly ever matter in normal use, but it did crop up while I
was debugging a different problem.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:51:40 -08:00
Chris Humbert bd39b7f195 [PATCH] USB: don't allocate dma pools for PIO HCDs
USB: don't allocate dma pools for PIO HCDs

hcd_buffer_alloc() and hcd_buffer_free() have a similar dma_mask
check and revert to kmalloc()/kfree(), but hcd_buffer_create()
doesn't check dma_mask and allocates unused dma pools.

Signed-off-by: Chris Humbert <mahadri-kernel@drigon.com>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:51:39 -08:00
Alan Stern 12c3da346e [PATCH] USB: Store port number in usb_device
This patch (as610) adds a field to struct usb_device to store the device's
port number.  This allows us to remove several loops in the hub driver
(searching for a particular device among all the entries in the parent's
array of children).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:35 -08:00
Alan Stern 55c527187c [PATCH] USB: Consider power budget when choosing configuration
This patch (as609) changes the way we keep track of power budgeting for
USB hubs and devices, and it updates the choose_configuration routine to
take this information into account.  (This is something we should have
been doing all along.)  A new field in struct usb_device holds the amount
of bus current available from the upstream port, and the usb_hub structure
keeps track of the current available for each downstream port.

Two new rules for configuration selection are added:

	Don't select a self-powered configuration when only bus power
	is available.

	Don't select a configuration requiring more bus power than is
	available.

However the first rule is #if-ed out, because I found that the internal
hub in my HP USB keyboard claims that its only configuration is
self-powered.  The rule would prevent the configuration from being chosen,
leaving the hub & keyboard unconfigured.  Since similar descriptor errors
may turn out to be fairly common, it seemed wise not to include a rule
that would break automatic configuration unnecessarily for such devices.

The second rule may also trigger unnecessarily, although this should be
less common.  More likely it will annoy people by sometimes failing to
accept configurations that should never have been chosen in the first
place.

The patch also changes usbcore's reaction when no configuration is
suitable.  Instead of raising an error and rejecting the device, now
the core will simply leave the device unconfigured.  People can always
work around such problems by installing configurations manually through
sysfs.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:34 -08:00
Alan Stern 4bf0ba8614 [PATCH] USB: Fix locking for USB suspend/resume
The earlier USB locking updates didn't touch the suspend/resume
routines.  They need updating as well, since now the caller holds the
device semaphore.  This patch (as608) makes the necessary changes.  It
also adds a line to store the correct power state when a device is
resumed, something which was unaccountably missing.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:34 -08:00
Alan Stern 7d069b7d80 [PATCH] USB: Disconnect children during hub unbind
This patch (as606b) is an updated version of my earlier patch to
disconnect children from a hub device when the hub driver is unbound.
Thanks to the changes in the driver core locking, we now know that the
entire hub device (and not just the interface) is locked whenever the
hub driver's disconnect method runs.  Hence it is safe to disconnect the
child device structures immediately instead of deferring the job.

The earlier version of the patch neglected to disable the hub's ports.
We don't want to forget that; otherwise we'd end up with live devices
using addresses that have been recycled.  This update adds the necessary
code.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:34 -08:00
Alan Stern 9ad3d6ccf5 [PATCH] USB: Remove USB private semaphore
This patch (as605) removes the private udev->serialize semaphore,
relying instead on the locking provided by the embedded struct device's
semaphore.  The changes are confined to the core, except that the
usb_trylock_device routine now uses the return convention of
down_trylock rather than down_read_trylock (they return opposite values
for no good reason).

A couple of other associated changes are included as well:

	Now that we aren't concerned about HCDs that avoid using the
	hcd glue layer, usb_disconnect no longer needs to acquire the
	usb_bus_lock -- that can be done by usb_remove_hcd where it
	belongs.

	Devices aren't locked over the same scope of code in
	usb_new_device and hub_port_connect_change as they used to be.
	This shouldn't cause any trouble.

Along with the preceding driver core patch, this needs a lot of testing.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:34 -08:00
Greg Kroah-Hartman 75318d2d7c [PATCH] USB: remove .owner field from struct usb_driver
It is no longer needed, so let's remove it, saving a bit of memory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:34 -08:00
Greg Kroah-Hartman 2143acc6dc [PATCH] USB: make registering a usb driver automatically set the module owner
This fixes the driver that forgot to set the module owner up.  Now we
can remove the unneeded pointer from the usb driver structure.  The idea
for how to do this was from Al Viro, who did this for the PCI drivers.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:32 -08:00
Greg Kroah-Hartman ba9dc657af [PATCH] USB: allow usb drivers to disable dynamic ids
This lets drivers, like the usb-serial ones, disable the ability to add
ids from sysfs.

The usb-serial drivers are "odd" in that they are really usb-serial bus
drivers, not usb bus drivers, so the dynamic id logic will have to go
into the usb-serial bus core for those drivers to get that ability.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:32 -08:00
Greg Kroah-Hartman 733260ff9c [PATCH] USB: add dynamic id functionality to USB core
Echo the usb vendor and product id to the "new_id" file in the driver's
sysfs directory, and then that driver will be able to bind to a device
with those ids if it is present.

Example:
	echo 0557 2008 > /sys/bus/usb/drivers/foo_driver/new_id
adds the hex values 0557 and 2008 to the device id table for the foo_driver.

Note, usb-serial drivers do not currently work with this capability yet.
usb-storage also might have some oddities.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:32 -08:00
Greg Kroah-Hartman ddae41be61 [PATCH] USB: reorg some functions out of the main usb.c file
This will make the dynamic-id stuff easier to do, as it will be
self-contained.

No logic was changed at all.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:31 -08:00
Alan Stern 1c50c317e2 [PATCH] USB: central handling for host controllers that were reset during suspend/resume
This patch (as515b) adds a routine to usbcore to simplify handling of
host controllers that lost power or were reset during suspend/resume.
The new core routine marks all the child devices of the root hub as
NOTATTACHED and tells khubd to disconnect the device structures as soon
as possible.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 13:48:31 -08:00
Alan Stern 5a9191ff68 [PATCH] usbcore: allow suspend/resume even if drivers don't support it
This patch (as618) changes usbcore to prevent derailing the
suspend/resume sequence when a USB driver doesn't include support for
it.  This is a workaround rather than a true fix; the core needs to be
changed so that URB submissions from suspended drivers can be refused
and outstanding URBs cancelled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-12-21 14:46:35 -08:00
Benjamin Herrenschmidt 8de9840265 [PATCH] USB: Fix USB suspend/resume crasher (#2)
This patch closes the IRQ race and makes various other OHCI & EHCI code
path safer vs. suspend/resume.
I've been able to (finally !) successfully suspend and resume various
Mac models, with or without USB mouse plugged, or plugging while asleep,
or unplugging while asleep etc... all without a crash.

Alan, please verify the UHCI bit I did, I only verified that it builds.
It's very simple so I wouldn't expect any issue there. If you aren't
confident, then just drop the hunks that change uhci-hcd.c

I also made the patch a little bit more "safer" by making sure the store
to the interrupt register that disables interrupts is not posted before
I set the flag and drop the spinlock.

Without this patch, you cannot reliably sleep/wakeup any recent Mac, and
I suspect PCs have some more sneaky issues too (they don't frankly crash
with machine checks because x86 tend to silently swallow PCI errors but
that won't last afaik, at least PCI Express will blow up in those
situations, but the USB code may still misbehave).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-29 21:39:23 -08:00
David Brownell 21b1861fb2 [PATCH] USB: ohci, move ppc asic tweaks nearer pci
This should fix a suspend/resume issues that appear with OHCI on some
PPC hardware.  The PCI layer should doesn't have the hooks needed for
such ASIC-specific hooks (in this case, software clock gating), so
this moves the code to do that into hcd-pci.c ... where it can be
done after the relevant PCI PM state transition (to/from D3).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-23 23:04:28 -08:00
David Brownell f03c17fc9a [PATCH] USB: EHCI updates
This fixes some bugs in EHCI suspend/resume that joined us over the past
few releases (as usbcore, PCI, pmcore, and other components evolved):

  - Removes suspend and resume recursion from the EHCI driver, getting
    rid of the USB_SUSPEND special casing.

  - Updates the wakeup mechanism to work again; there's a newish usbcore
    call it needs to use.

  - Provide simpler tests for "do we need to restart from scratch", to
    address another case where PCI Vaux was lost.  (In this case it was
    restoring a swsusp snapshot, but there could be others.)

Un-exports a symbol that was temporarily exported.

A notable change from previous version is that this doesn't move
the spinlock init, so there's still a resume/reinit path bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-23 23:04:28 -08:00
Greg Kroah-Hartman 654f31189e [PATCH] USB: move CONFIG_USB_DEBUG checks into the Makefile
This lets us remove a lot of code in the drivers that were all checking
the same thing.  It also found some bugs in a few of the drivers, which
has been fixed up.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-17 11:29:55 -08:00
Andrew Morton 058120d70e [PATCH] usb devio warning fix
drivers/usb/core/devio.c: In function `proc_ioctl_compat':
drivers/usb/core/devio.c:1401: warning: passing arg 1 of `compat_ptr' makes integer from pointer without a cast

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-17 11:29:54 -08:00
Andrew Morton 777da5905e [PATCH] USB: usbdevfs_ioctl 32bit fix
drivers/usb/core/devio.c: In function `proc_ioctl_compat':
drivers/usb/core/devio.c:1401: warning: passing arg 1 of `compat_ptr' makes integer from pointer without a cast

NFI if this is correct...

Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-17 11:29:53 -08:00
OGAWA Hirofumi bc7cb323ba [PATCH] usbfs: usbfs_dir_inode_operations cleanup
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-17 11:29:53 -08:00
Dmitry Torokhov d4ece29d89 [PATCH] USB: fix 'unused variable' warning
USB: fix 'unused variable' warning

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-17 11:29:53 -08:00
Greg Kroah-Hartman 4303fc6f05 USB: fix up some odd parts due to partial merges
Thanks to Andrew for doing the hard work on this.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 19:59:31 -07:00
Andrew Morton 9a7834d06d [PATCH] USB: fix pm patches with CONFIG_PM off part 2
With CONFIG_PM=n:

drivers/built-in.o(.text+0x1098c): In function `hub_thread':
drivers/usb/core/hub.c:2673: undefined reference to `.dpm_runtime_resume'
drivers/built-in.o(.text+0x10998):drivers/usb/core/hub.c:2674: undefined reference to `.dpm_runtime_resume'

Please, never ever ever put extern decls into .c files.  Use the darn header
files :(

Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:52 -07:00
Andrew Morton db2d55b7f7 [PATCH] USB: fix pm patches with CONFIG_PM off part 1
With CONFIG_PM=n:

drivers/built-in.o(.text+0x2a69c): In function `ohci_hub_control':
drivers/usb/host/ohci-hub.c:539: undefined reference to `.usb_hcd_resume_root_hub'
drivers/built-in.o(.text+0x2b920): In function `ohci_irq':
drivers/usb/host/ohci-hcd.c:726: undefined reference to `.usb_hcd_resume_root_hub'

Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:51 -07:00
Alan Stern 4f62efe67f [PATCH] usbcore: Fix handling of sysfs strings and other attributes
This patch (as592) makes a few small improvements to the way device
strings are handled, and it fixes some bugs in a couple of other sysfs
attribute routines.  (Look at show_configuration_string() to see what I
mean.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:51 -07:00
Alan Stern 16f16d117c [PATCH] USB: Fix maxpacket length for ep0 on root hubs
This patch (as591) fixes a rather innocuous bug that has been around for
quite a long time: Virtual root hubs should have a maxpacket length of
64 for endpoint 0.  I didn't realize it was wrong until I started
looking through the endpoint attribute files.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:51 -07:00
Alan Stern 0a1ef3b5a7 [PATCH] usbcore: Use kzalloc instead of kmalloc/memset
This patch (as590) fixes up all the remaining places where usbcore can
use kzalloc rather than kmalloc/memset.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:51 -07:00
Alan Stern b724ae7796 [PATCH] usbcore: Wrap lines before column 80
I can't stand text lines that wrap-around in my 80-column windows.  This
patch (as589) makes cosmetic changes to a couple of source files.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:51 -07:00
Alan Stern 0e6c8e8db5 [PATCH] usbcore: endpoint attributes track altsetting changes
This patch (as588) fixes the way endpoint attribute files are registered
and unregistered.  Now they will correctly track along with altsetting
changes.  This fixes bugzilla entry #5467.

In a separate but related change, when a usb_reset_configuration call
fails, the device state is not changed to USB_STATE_ADDRESS.  In the
first place, failure means that we don't know what the state is, not
that we know the device is unconfigured.  In the second place, doing
this can potentially lead to a memory leak, since usbcore might not
realize there still is a current configuration that needs to be
destroyed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:51 -07:00
Alan Stern be69e5b190 [PATCH] usbcore: Improve endpoint sysfs file handling
This revised patch (as587b) improves the implementation of USB endpoint
sysfs files.  Instead of storing a whole bunch of attributes for every
single endpoint, each endpoint now gets its own kobject and they can
share a static list of attributes.  The number of extra fields added to
struct usb_host_endpoint has been reduced from 4 to 1.

The bEndpointAddress field is retained even though it is redundant (it
repeats the same information as the attributes' directory name).  The
code avoids calling kobject_register, to prevent generating unwanted
hotplug events.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:50 -07:00
Greg Kroah-Hartman 7521803dcc [PATCH] USB: always export interface information for modalias
This fixes a problem with some cdc acm devices that were not getting
automatically loaded as the module alias was not being reported
properly.

This check was for back in the days when we only reported hotplug events
for the main usb device, not the interfaces.  We should always give the
interface information for MODALIAS/modalias as it can be needed.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:48 -07:00
Pete Zaitcev c36fc889b5 [PATCH] usb: Patch for USBDEVFS_IOCTL from 32-bit programs
Dell supplied me with the following test:

#include<stdio.h>
#include<errno.h>
#include<sys/ioctl.h>
#include<fcntl.h>
#include<linux/usbdevice_fs.h>

main(int argc,char*argv[])
{
   struct usbdevfs_hub_portinfo hubPortInfo = {0};
   struct usbdevfs_ioctl command = {0};
   command.ifno = 0;
   command.ioctl_code = USBDEVFS_HUB_PORTINFO;
   command.data = (void*)&hubPortInfo;
   int fd, ret;
   if(argc != 2) {
     fprintf(stderr,"Usage: %s /proc/bus/usb/<BusNo>/<HubID>\n",argv[0]);
     fprintf(stderr,"Example: %s /proc/bus/usb/001/001\n",argv[0]);
     exit(1);
   }
   errno = 0;
   fd = open(argv[1],O_RDWR);
   if(fd < 0) {
     perror("open failed:");
     exit(errno);
   }
   errno = 0;
   ret = ioctl(fd,USBDEVFS_IOCTL,&command);
   printf("IOCTL return status:%d\n",ret);
   if(ret<0) {
     perror("IOCTL failed:");
     close(fd);
     exit(3);
   } else {
       printf("IOCTL passed:Num of ports %d\n",hubPortInfo.nports);
       close(fd);
       exit(0);
   }
   return 0;
}

I have verified that it breaks if built in 32 bit mode on x86_64 and that
the patch below fixes it.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:46 -07:00
Greg Kroah-Hartman 72adaa9627 [PATCH] USB: convert usbmon to use usb notifiers
This also removes 2 usbmon callbacks.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:46 -07:00
Greg Kroah-Hartman 54a5c4cd2e [PATCH] USB: convert usbfs/inode.c to use usb notifiers
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:46 -07:00
Greg Kroah-Hartman a7b986b3e1 [PATCH] USB: convert usbfs/devio.c to use usb notifiers
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:46 -07:00
Greg Kroah-Hartman 3099e75a7c [PATCH] USB: add notifier functions to the USB core for devices and busses
This should let us get rid of all of the different hooks in the USB core for
when something has changed.

Also, some other parts of the kernel have wanted to know this kind of
information at times.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:46 -07:00
Greg Kroah-Hartman 4592bf5a22 [PATCH] USB: remove the global function usbdev_lookup_minor
It's only used locally.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:45 -07:00
Alan Stern 0c0382e32d [PATCH] USB: Rename hcd->hub_suspend to hcd->bus_suspend
This patch (as580) is perhaps the only result from the long discussion I
had with David about his changes to the root-hub suspend/resume code.  It
renames the hub_suspend and hub_resume methods in struct usb_hcd to
bus_suspend and bus_resume.  These are more descriptive names, since the
methods really do suspend or resume an entire USB bus, and less likely to
be confused with the hub_suspend and hub_resume routines in hub.c.

It also takes David's advice about removing the layer of bus glue, where
those methods are called.  And it implements a related change that David
made to the other HCDs but forgot to put into dummy_hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:44 -07:00
Greg Kroah-Hartman 74ad9bd2fc [PATCH] USB: make wHubCharacteristics __le16 to match other usb descriptor fields
Also has the nice benefit of making sparc alignment issues go away.

Thanks to David Miller for pointing out the problems here.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hub.c |   22 ++++++++++++----------
 drivers/usb/core/hub.h |    2 +-
 2 files changed, 13 insertions(+), 11 deletions(-)
2005-10-28 16:47:42 -07:00
Alan Stern d09d36a91c [PATCH] USB: usb_bulk_message() handles interrupts endpoints
Because there is no bulk_interrupt_message() routine and no
USBDEVFS_INTERRUPT ioctl, people have been forced to abuse the
usb_bulk_message() routine and USBDEVFS_BULK by using them for interrupt
transfers as well as bulk transfers.

This patch (as567) formalizes this practice and adds code to
usb_bulk_message() for detecting when the target is really an interrupt
endpoint.  If it is, the routine submits an interrupt URB (using the
default interval) instead of a bulk URB.  In theory this should help HCDs
that don't like it when people try to mix transfer types, queuing both
periodic and non-periodic types for the same endpoint.

Not fully tested -- I don't have any programs that use USBDEVFS_BULK for
interrupt transfers -- but it compiles okay and normal bulk messages work
as well as before.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/message.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
2005-10-28 16:47:41 -07:00
David Brownell b13296c661 [PATCH] updates for "controller suspended" handling
Reject URBs to _all_ devices when their host controllers are suspended;
even root hub registers will be unavailable.  Also, don't reject urbs
to root hubs in other cases; the only upstream link is through that
controller (on PCI or whatever SOC bus is in use).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hcd.c |   28 ++++++++++++----------------
 drivers/usb/core/urb.c |    3 ++-
 2 files changed, 14 insertions(+), 17 deletions(-)
2005-10-28 16:47:41 -07:00
David Brownell 5edbfb7c8a [PATCH] stop exporting two functions
The way we're looking at USB suspend lately doesn't expect drivers to
call usb_suspend_device() or usb_resume_device() directly; that'll
be implicit when no interfaces are in use.

This patch removes those APIs from visibility outside usbcore.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

 drivers/usb/core/hub.c |   12 ++++--------
 drivers/usb/core/usb.h |    4 ++++
 include/linux/usb.h    |    5 -----
 3 files changed, 8 insertions(+), 13 deletions(-)
2005-10-28 16:47:41 -07:00
David Brownell 5f827ea3c3 [PATCH] usbcore PCI glue updates for PM
This updates the PCI glue to address the new and simplified usbcore suspend
semantics, where CONFIG_USB_SUSPEND becomes irrelevant to HCDs because
hcd->hub_suspend() will always be called.

  - Removes now-unneeded recursion support

  - Go back to ignoring faults reported by the wakeup calls; we expect them
    to fail sometimes, and that's just fine.

The PCI HCDs will need simple changes to catch up to this, like being able
to ignore the setting of CONFIG_USB_SUSPEND.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hcd-pci.c |  106 +++++++++++++++++++++------------------------
 drivers/usb/core/hcd.h     |    6 +-
 2 files changed, 53 insertions(+), 59 deletions(-)
2005-10-28 16:47:40 -07:00
David Brownell f3f3253d64 [PATCH] root hub updates (greater half)
This patch associates hub suspend and resume logic (including for root hubs)
with CONFIG_PM -- instead of CONFIG_USB_SUSPEND as before -- thereby unifying
two troublesome versions of suspend logic into just one.  It'll be easier to
keep things right from now on.

  - Now usbcore _always_ calls hcd->hub_suspend as needed, instead of
    only when USB_SUSPEND is enabled:
     * Those root hub methods are now called from hub suspend/resume;
       no more skipping between layers during device suspend/resume;
     * It now handles cases allowed by sysfs or autosuspended root hubs,
       by forcing the hub interface to resume too.

  - All devices, including virtual root hubs, now get the same treatment
    on their resume paths ... including re-activating all their interfaces.

Plus it gets rid of those stub copies of usb_{suspend,resume}_device(), and
updates the Kconfig to match the new definition of USB_SUSPEND:  it provides
(a) selective suspend, downstream from hubs; and (b) remote wakeup, upstream
from any device configuration which supports it.

This calls for minor followup patches for most HCDs (and their PCI glue).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/Kconfig |   11 ++-
 drivers/usb/core/hub.c   |  163 +++++++++++++++++++++++++----------------------
 2 files changed, 97 insertions(+), 77 deletions(-)
2005-10-28 16:47:40 -07:00
David Brownell 979d5199fe [PATCH] root hub changes (lesser half)
This patch collects various small updates related to root hubs, to shrink
later patches which build on them.

  - For root hub suspend/resume support:
     * Make the existing usb_hcd_resume_root_hub() routine respect pmcore
       locking, exporting and using the dpm_runtime_resume() method.
     * Add a new usb_hcd_suspend_root_hub() to pair with that routine.
       (Essential to make OHCI autosuspend behave again...)
     * HC_SUSPENDED by itself only refers to the root hub's downstream ports.
       So let HCDs see root hub URBs unless the parent device is suspended.

  - Remove an assertion we no longer need (and now, also don't want).

  - Generic suspend/resume updates to work better with swsusp.
     * Ignore the FREEZE vs SUSPEND distinction for hardware; trying to
       use it breaks the swsusp snapshots it's supposed to help (sigh).
     * On resume, mark devices as resumed right away, but then
       do nothing else if the device is marked NOTATTACHED.

These changes shouldn't be very noticable by themselves.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/base/power/runtime.c |    1
 drivers/usb/core/hcd.c       |   64 ++++++++++++++++++++++++++++++++++++++-----
 drivers/usb/core/hcd.h       |    1
 drivers/usb/core/hub.c       |   45 ++++++++++++++++++++++++------
 drivers/usb/core/usb.c       |   20 +++++++++----
 drivers/usb/core/usb.h       |    1
 6 files changed, 111 insertions(+), 21 deletions(-)
2005-10-28 16:47:40 -07:00
David Brownell 9293677af3 [PATCH] all HCDs provide root hub suspend/resume methods
This cleans up a small recent FIXME, ensuring that all the HCDs provide
root hub suspend/resume methods.  It also wraps the calls to those root
suspend routines just like on the PCI "USB_SUSPEND not defined" cases,
so non-PCI bus glue won't be as tempted to behave very differently.

Several of the SOC based OHCI drivers forgot to list those methods;
the patch also adds those missing declarations.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hcd.c          |   42 +++++++++++++++++++++++++---------------
 drivers/usb/host/ohci-au1xxx.c  |    5 ++++
 drivers/usb/host/ohci-lh7a404.c |    5 ++++
 drivers/usb/host/ohci-pxa27x.c  |    1
 drivers/usb/host/ohci-s3c2410.c |    1
 drivers/usb/host/ohci-sa1111.c  |    1
 6 files changed, 40 insertions(+), 15 deletions(-)
2005-10-28 16:47:40 -07:00
Matt Porter e08fb39b77 [PATCH] USB: Fix usb hub build
Signed-off-by: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
2005-10-28 16:47:39 -07:00
David Brownell 8ad7fe16df [PATCH] remove some USB_SUSPEND dependencies
This simplifies some of the PM-related #ifdeffing by recognizing
that USB_SUSPEND depends on PM.  Also, OHCI drivers were often
testing for USB_SUSPEND when they should have tested just PM.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hcd.c          |    2 ++
 drivers/usb/host/ohci-hcd.c     |    2 +-
 drivers/usb/host/ohci-hub.c     |    4 ++--
 drivers/usb/host/ohci-omap.c    |    2 +-
 drivers/usb/host/ohci-pci.c     |    2 +-
 drivers/usb/host/ohci-ppc-soc.c |    4 ++--
 drivers/usb/host/ohci-pxa27x.c  |    2 +-
 drivers/usb/host/ohci-s3c2410.c |    3 +--
 drivers/usb/host/ohci-sa1111.c  |    2 +-
 9 files changed, 12 insertions(+), 11 deletions(-)
2005-10-28 16:47:39 -07:00
David Brownell dbc3887e7d [PATCH] remove duplicated resume path code
This gets rid of some inconsistently duplicated logic to resume interfaces.
Similar code was in both finish_port_resume() and in usb_generic_resume().
Now there is just one copy of that code, accessed regardless of whether
CONFIG_USB_SUSPEND is enabled.  Fault handling is also more consistent.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:39 -07:00
David Brownell 390a8c345e [PATCH] remove usb_suspend_device() parameter
This patch removes the extra usb_suspend_device() parameter.  The original
reason to pass that parameter was so that this routine could suspend any
active children.  A previous patch removed that functionality ... leaving
no reason to pass the parameter.  A close analogy is pci_set_power_state,
which doesn't need a pm_message_t either.

On the internal code path that comes through the driver model, the parameter
is now used to distinguish cases where USB devices need to "freeze" but not
suspend.   It also checks for an error case that's accessible through sysfs:
attempting to suspend a device before its interfaces (or for hubs, ports).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hub.c         |   34 +++++++++++++++++++++-------------
 drivers/usb/core/usb.c         |   23 +++++++++++++++++++++--
 drivers/usb/host/ehci-hcd.c    |    2 +-
 drivers/usb/host/isp116x-hcd.c |    2 +-
 drivers/usb/host/ohci-pci.c    |    2 +-
 include/linux/usb.h            |    2 +-
 6 files changed, 46 insertions(+), 19 deletions(-)
2005-10-28 16:47:38 -07:00
David Brownell c9f89fa40c [PATCH] remove suspend-path recursion
This patch removes some recursion in the CONFIG_USB_SUSPEND logic, which
suspended children (of devices or hubs) that weren't already suspended.
When it sees such cases, suspend now just fails cleanly.

That logic was not needed during system-wide sleep state transitions; and
given the current notions of how to manage selective suspend transitions,
we don't want it there either.  Where it was particularly handy was coping
with various limitations of the sysfs "echo -n N > power/state" support.
(These include assuming that "N" is always meaningful to the driver; and
that drivers can only transition to state N from state zero.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:38 -07:00
David Brownell db69087437 [PATCH] usb_interface power state
This updates the handling of power state for USB interfaces.

  - Formalizes an existing invariant:  interface "power state" is a boolean:
    ON when I/O is allowed, and FREEZE otherwise.  It does so by defining
    some inlined helpers, then using them.

  - Adds a useful invariant:  the only interfaces marked active are those
    bound to non-suspended drivers.  Later patches build on this invariant.

  - Simplifies the interface driver API (and removes some error paths) by
    removing the requirement that they record power state changes during
    suspend and resume callbacks.  Now usbcore does that.

A few drivers were simplified to address that last change.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hub.c       |   33 +++++++++------------
 drivers/usb/core/message.c   |    1
 drivers/usb/core/usb.c       |   65 +++++++++++++++++++++++++++++++++----------
 drivers/usb/core/usb.h       |   18 +++++++++++
 drivers/usb/input/hid-core.c |    2 -
 drivers/usb/misc/usbtest.c   |   10 ------
 drivers/usb/net/pegasus.c    |    2 -
 drivers/usb/net/usbnet.c     |    2 -
 8 files changed, 85 insertions(+), 48 deletions(-)
2005-10-28 16:47:38 -07:00
Greg Kroah-Hartman e639dd3f4e [PATCH] USB: add more snooping hooks in devio.c
Now we can log the urbs travelling through usbfs

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 16:47:38 -07:00
Greg Kroah-Hartman d6e5bcf4a7 [PATCH] devfs: Remove the mode field from usb_class_driver as it's no longer needed
Also fixes all drivers that set this field, and removes some other devfs
specfic USB logic.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/class/usblp.c           |    3 +--
 drivers/usb/core/file.c             |   19 ++++---------------
 drivers/usb/image/mdc800.c          |    3 +--
 drivers/usb/input/aiptek.c          |    2 +-
 drivers/usb/input/hiddev.c          |    3 +--
 drivers/usb/media/dabusb.c          |    3 +--
 drivers/usb/misc/auerswald.c        |    3 +--
 drivers/usb/misc/idmouse.c          |    5 ++---
 drivers/usb/misc/legousbtower.c     |    5 ++---
 drivers/usb/misc/rio500.c           |    3 +--
 drivers/usb/misc/sisusbvga/sisusb.c |    5 -----
 drivers/usb/misc/usblcd.c           |    9 ++++-----
 drivers/usb/usb-skeleton.c          |    3 +--
 include/linux/usb.h                 |    7 ++-----
 14 files changed, 22 insertions(+), 51 deletions(-)
2005-10-28 16:47:37 -07:00
Greg Kroah-Hartman 094f164957 [PATCH] USB: add endpoint information to sysfs
This patch adds endpoint information for both devices and interfaces to
sysfs.  Previously it was only possible to get the endpoint information
from usbfs, and never possible to get any information on endpoint 0.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/sysfs.c |  195 ++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/usb.h      |    4
 2 files changed, 197 insertions(+), 2 deletions(-)
2005-10-28 16:47:37 -07:00
Greg KH 6fbfddcb52 Merge ../bleed-2.6 2005-10-28 10:13:16 -07:00
Greg Kroah-Hartman 53f4654272 [PATCH] Driver Core: fix up all callers of class_device_create()
The previous patch adding the ability to nest struct class_device
changed the paramaters to the call class_device_create().  This patch
fixes up all in-kernel users of the function.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 09:52:52 -07:00
David Brownell b94dc6b586 [PATCH] usb device wakeup flags
This patch teaches "usb_device" about the new driver model wakeup support:

 - It updates device wakeup capabilities when entering a configuration
   with the WAKEUP attribute;

 - During suspend processing it consults the policy bit to see
   whether it should enable wakeup for that device.  (This resolves
   a FIXME to not assume the answer is always "yes"; some devices
   lie about supporting remote wakeup.)

Support for root hubs and the HCDs is separate (and more complex).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 09:52:50 -07:00
Al Viro 55016f10e3 [PATCH] gfp_t: drivers/usb
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-28 08:16:49 -07:00
Linus Torvalds d7dd8a72ab Use the new "kill_proc_info_as_uid()" for USB disconnect too
All the same issues - we can't just save the pointer to the thread, we
must save the pid/uid/euid combination.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-10 16:31:30 -07:00
Harald Welte 46113830a1 [PATCH] Fix signal sending in usbdevio on async URB completion
If a process issues an URB from userspace and (starts to) terminate
before the URB comes back, we run into the issue described above.  This
is because the urb saves a pointer to "current" when it is posted to the
device, but there's no guarantee that this pointer is still valid
afterwards.

In fact, there are three separate issues:

1) the pointer to "current" can become invalid, since the task could be
   completely gone when the URB completion comes back from the device.

2) Even if the saved task pointer is still pointing to a valid task_struct,
   task_struct->sighand could have gone meanwhile.

3) Even if the process is perfectly fine, permissions may have changed,
   and we can no longer send it a signal.

So what we do instead, is to save the PID and uid's of the process, and
introduce a new kill_proc_info_as_uid() function.

Signed-off-by: Harald Welte <laforge@gnumonks.org>
[ Fixed up types and added symbol exports ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-10 16:16:33 -07:00
Daniel Ritz 03cdc0c304 [PATCH] usb/core/hcd-pci.c: don't free_irq() on suspend
the free_irq() in USB suspend breaks resume on some setups where USB
(ohci/ehci) shares the interrupt with an other device.

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-30 09:23:30 -07:00
Daniel Ritz d305ef5d2a [PATCH] driver core: add helper device_is_registered()
add the helper and use it instead of open coding the klist_node_attached() check
(which is a layering violation IMHO)

idea by Alan Stern.

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-22 07:58:24 -07:00
David Brownell b789696af8 [PATCH] USB: relax usbcore reset timings
This appears to help some folk, please merge.
This patch relaxes reset timings.  There are some reports that it
helps make enumeration work better on some high speed devices.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-12 12:23:49 -07:00
David Brownell dd16525b69 [PATCH] USB: get rid of minor log spamming
Routine cases like handoff-to-companion shouldn't trigger diagnostics.
This gets rid of some recently added log spamming.  It's routine for
hub_port_wait_reset() to return -ENOTCONN to indicate handoff from
highspeed hubs to companions, so an error message is incorrect.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-12 12:23:43 -07:00
Alan Stern f1a15606d5 [PATCH] usbcore: small changes to HCD glue layer
This patch (as549) introduces two small changes in the HCD glue layer.
The first simply removes a redundant test.  The second allows root-hub
polling to continue for a single iteration after a host controller dies;
this is needed for the patch that follows.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-12 12:23:39 -07:00
Linus Torvalds 5420520973 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6 2005-09-08 17:21:02 -07:00
david-b@pacbell.net e09711aef4 [PATCH] ehci: add think_time
This adds think_time to the usb_tt struct and sets it appropriately
(measured in ns); this can help us implement better split transaction
scheduling.

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:35 -07:00
david-b@pacbell.net 8f34c2883b [PATCH] USB: remove annoying message
Avoid an annoying message that can appear if devices are disconnected
in the middle of a USB scatterlist operation.

Message noted in http://bugzilla.kernel.org/show_bug.cgi?id=4373
(but the real issue there seems to be a SCSI level hang).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:25 -07:00
david-b@pacbell.net f956e7cd9a [PATCH] USB: tweak highspeed timing calculations
Use a more correct calculation for highspeed bit times.

  http://bugzilla.kernel.org/show_bug.cgi?id=3604

This sort if thing might start to make a difference now that the high
speed periodic scheduler is more complete -- and even getting used.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:25 -07:00
Alan Stern 3b4d7f7916 [PATCH] USB: Support unbinding of the usb_generic driver
This patch (as556) adds support for unbinding the usb_generic "driver".
That driver only binds to USB devices, as opposed to interfaces, and it
does nothing much besides marking which struct device's go with an
overall USB device plus providing suspend/resume methods.  Now that
users can unbind drivers at will using the sysfs "unbind" attribute, we
need a rational way of dealing with USB devices that are no longer under
full control of the USB stack.  The patch handles this by unconfiguring
the device, thereby removing all the interfaces and their associated
drivers and children.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:22 -07:00
Alan Stern 3ea15966ed [PATCH] USB: Add timeout to usb_lock_device_for_reset
This patch (as555) modifies the already-awkward
usb_lock_device_for_reset routine in usbcore by adding a timeout.  The
whole point of the routine is that the caller wants to acquire some
semaphores in the wrong order; protecting against the possibility of
deadlock by timing out seems only prudent.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:21 -07:00
Alan Stern bf193d3cd2 [PATCH] USB: Disconnect children when unbinding the hub driver
This patch (as554) makes the hub driver disconnect any child USB devices
when it is unbound from a hub.  Normally this will never happen, but
there are a few oddball ways to unbind the hub driver while leaving the
children intact.  For example, the new "unbind" sysfs attribute can be
used for this purpose.

Given that unbinding hubs with children is now safe, the patch also
removes the code that prevented people from doing so using usbfs.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:19 -07:00
Alan Stern 8b28c7526a [PATCH] USB: Code motion in the hub driver
This patch (as553) merely moves some code and deletes an unneeded test in
the hub driver.  This is in preparation for the patch that follows.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:28:19 -07:00
Alan Stern b375a0495f [PATCH] USB: URB_ASYNC_UNLINK flag removed from the kernel
29 July 2005, Cambridge, MA:

This afternoon Alan Stern submitted a patch to remove the URB_ASYNC_UNLINK
flag from the Linux kernel.  Mr. Stern explained, "This flag is a relic
from an earlier, less-well-designed system.  For over a year it hasn't
been used for anything other than printing warning messages."

An anonymous spokesman for the Linux kernel development community
commented, "This is exactly the sort of thing we see happening all the
time.  As the kernel evolves, support for old techniques and old code can
be jettisoned and replaced by newer, better approaches.  Proprietary
operating systems do not have the freedom or flexibility to change so
quickly."

Mr. Stern, a staff member at Harvard University's Rowland Institute who
works on Linux only as a hobby, noted that the patch (labelled as548) did
not update two files, keyspan.c and option.c, in the USB drivers' "serial"
subdirectory.  "Those files need more extensive changes," he remarked.
"They examine the status field of several URBs at times when they're not
supposed to.  That will need to be fixed before the URB_ASYNC_UNLINK flag
is removed."

Greg Kroah-Hartman, the kernel maintainer responsible for overseeing all
of Linux's USB drivers, did not respond to our inquiries or return our
calls.  His only comment was "Applied, thanks."

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:23:04 -07:00
Alan Stern fad21bdf56 [PATCH] USB: Fix regression in core/devio.c
This patch (as551) fixes another little problem recently added to the
USB core.  Someone didn't fix the type of the first argument to
unregister_chrdev_region.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:22:30 -07:00
Kay Sievers fbf82fd2e1 [PATCH] USB: real nodes instead of usbfs
This patch introduces a /sys/class/usb_device/ class
where every connected usb-device will show up:

  tree /sys/class/usb_device/
  /sys/class/usb_device/
  |-- usb1.1
  |   |-- dev
  |   `-- device -> ../../../devices/pci0000:00/0000:00:1d.0/usb1
  |-- usb2.1
  |   |-- dev
  |   `-- device -> ../../../devices/pci0000:00/0000:00:1d.1/usb2
  ...

The presence of the "dev" file lets udev create real device nodes.
  kay@pim:~/src/linux-2.6> tree /dev/bus/usb/
  /dev/bus/usb/
  |-- 1
  |   `-- 1
  |-- 2
  |   `-- 1
  ...

udev rule:
  SUBSYSTEM="usb_device", PROGRAM="/sbin/usb_device %k", NAME="%c"
  (echo $1 | /bin/sed 's/usb\([0-9]*\)\.\([0-9]*\)/bus\/usb\/\1\/\2/')

This makes libusb pick up the real nodes instead of the mounted usbfs:
  export USB_DEVFS_PATH=/dev/bus/usb

Background:
  All this makes it possible to manage usb devices with udev instead of
  the devfs solution. We are currently working on a pam_console/resmgr
  replacement driven by udev and a pam-helper. It applies ACL's to device
  nodes, which is required for modern desktop functionalty like
  "Fast User Switching" or multiple local login support.

New patch with its own major. I've succesfully disabled usbfs and use real
nodes only on my box. With: "export USB_DEVFS_PATH=/dev/bus/usb" libusb picks
up the udev managed nodes instead of reading usbfs files.

This makes udev to provide symlinks for libusb to pick up:
  SUBSYSTEM="usb_device", PROGRAM="/sbin/usbdevice %k", SYMLINK="%c"

/sbin/usbdevice:
  #!/bin/sh
  echo $1 | /bin/sed 's/usbdev\([0-9]*\)\.\([0-9]*\)/bus\/usb\/\1\/\2/'

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 16:22:29 -07:00
Greg Kroah-Hartman 95a629657d [PATCH] PCI: start paying attention to a lot of pci function return values
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 14:57:25 -07:00
Adrian Bunk 982245f017 [PATCH] PCI: remove CONFIG_PCI_NAMES
This patch removes CONFIG_PCI_NAMES.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 14:57:23 -07:00
Pekka Enberg 7b842b6e37 [PATCH] USB: convert kcalloc to kzalloc
This patch converts kcalloc(1, ...) calls to use the new kzalloc() function.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:46 -07:00
Dmitry Torokhov 76d1ce00bd [PATCH] Driver core: link device and all class devices derived from it.
Driver core: link device and all class devices derived from it.

To ease the task of locating class devices derived from a certain
device create symlinks from parent device to its class devices.
Change USB host class device name from usbX to usb_hostX to avoid
conflict when creating aforementioned links.

Tweaked by Greg to have the symlink be "class_name:class_device_name" in
order to prevent duplicate links.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-05 16:03:10 -07:00
Pavel Machek ca078bae81 [PATCH] swsusp: switch pm_message_t to struct
This adds type-checking to pm_message_t, so that people can't confuse it
with int or u32.  It also allows us to fix "disk yoyo" during suspend (disk
spinning down/up/down).

[We've tried that before; since that cpufreq problems were fixed and I've
tried make allyes config and fixed resulting damage.]

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Alexander Nyberg <alexn@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-05 00:06:16 -07:00
Dan Streetman 498f78e6fc [PATCH] USB: fix in usb_calc_bus_time
This patch does the same swap, i.e. use the ISO macro if (isoc).
Additionally, it fixes the return value - the usb_calc_bus_time function
returns the time in nanoseconds (I didn't notice that before) while the
HS_USECS and HS_USECS_ISO are microseconds.  This fixes the function to
return nanoseconds always, and adjusts ehci-q.c (the only high-speed
caller of the function) to wrap the call in NS_TO_US().

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-29 13:12:54 -07:00
Alan Stern 86d30741e4 [PATCH] USB: Usbcore: Don't try to delete unregistered interfaces
This patch handles a rarely-encountered failure mode in usbcore.  It's
legal for device_add to fail (although now it happens even more rarely
than before since failure to bind a driver is no longer fatal).  So when
we destroy the interfaces in a configuration, we shouldn't try to delete
ones which weren't successfully registered.  Also, failure to register an
interface shouldn't be fatal either -- I think; you may disagree about
this part of the patch.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-29 13:12:53 -07:00
Alan Stern fe0410c7f4 [PATCH] USB: usbfs: Don't leak uninitialized data
This patch fixes an information leak in the usbfs snoop facility:
uninitialized data from __get_free_page can be returned to userspace and
written to the system log.  It also improves the snoop output by printing
the wLength value.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-29 13:12:52 -07:00
Len Brown 5028770a42 [ACPI] merge acpi-2.6.12 branch into latest Linux 2.6.13-rc...
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-12 17:21:56 -04:00
brian@murphy.dk a3fdf4ebe0 [PATCH] USB: export usb_get_intf() and usb_put_intf()
Export usb_get_intf and usb_put_intf so that modules can increase
usb interface reference counts.

Signed-off-by: brian@murphy.dk
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-07-12 11:52:57 -07:00
Olav Kongas 5db539e49f [PATCH] USB: Fix kmalloc's flags type in USB
Greg,

This patch fixes the kmalloc() flags argument type in USB
subsystem; hopefully all of its occurences. The patch was
made against patch-2.6.12-git2 from Jun 20.

Cleanup of flags for kmalloc() in USB subsystem.

Signed-off-by: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-07-12 11:52:56 -07:00
akpm@osdl.org 9c8d61783e [PATCH] USB: khubd: use kthread API
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-07-12 11:52:54 -07:00
Greg Kroah-Hartman cf5910bbae [PATCH] USB: add bMaxPacketSize0 attribute to sysfs
For some reason this was not there...

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-07-12 11:52:54 -07:00
David Shaohua Li d58da59045 [ACPI] S3 Suspend to RAM: fix driver suspend/resume methods
Drivers should do this:

.suspend()
	pci_disable_device()

.resume()
	pci_enable_device()

http://bugzilla.kernel.org/show_bug.cgi?id=3469

Signed-off-by: David Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-11 23:23:46 -04:00
Alan Stern 0ed0c0c48c [PATCH] USB: usbcore: inverted test for resuming interfaces
This one-liner fixes a test for interfaces that are already resumed.

It would be nice if this could get into 2.6.12, but it's not critical
since it only affects people doing selective (runtime) suspend/resume.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27 14:44:05 -07:00
Alan Stern 8ec8d20b21 [PATCH] usbcore: register root hub in usb_add_hcd
This patch makes usbcore automatically allocate and register the root hub
device for a new host controller when the controller is registered.  This
way the HCDs don't all have to include the same boilerplate code.  As a
pleasant side benefit, the register_root_hub routine can now be made
static and not EXPORTed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27 14:43:49 -07:00
Alan Stern 7d35b92985 [PATCH] usbcore: Remove hub_set_power_budget
This patch removes the hub_set_power_budget routine, which was used by a
couple of HCDs to indicate that the root hub was running on battery power.
In its place is a new field added to struct usb_hcd, which HCDs can set
before the root hub is registered.  Special-case code in the hub driver
knows to look at this field when configuring a root hub.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27 14:43:48 -07:00
Alan Stern d5926ae7a8 [PATCH] usbcore support for root-hub IRQ instead of polling
This is a revised version of an earlier patch to add support to usbcore
for driving root hubs by interrupts rather than polling.

There's a temporary flag added to struct usb_hcd, marking devices whose
drivers are aware of the new mechanism.  By default that flag doesn't get
set so drivers will continue to see the same polling behavior as before.
This way we can convert the HCDs one by one to use interrupt-based event
reporting, and the temporary flag can be removed when they're all done.

Also included is a small change to the hcd_disable_endpoint routine.
Although endpoints normally shouldn't be disabled while a controller is
suspended, it's legal to do so when the controller's driver is being
rmmod'ed.

Lastly the patch adds a new callback, .hub_irq_enable, for use by HCDs
where the root hub's port-change interrupts are level-triggered rather
than edge-triggered.  The callback is invoked each time khubd has finished
processing a root hub, to let the HCD know that the interrupt can safely
be re-enabled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27 14:43:45 -07:00
David Brownell 72ebddb59a [PATCH] USB: turn a user mode driver error into a hard error
This patch turns a user mode driver error into a hard error, and updates
the relevant diagnostic slightly to help troubleshooting.  gphoto was
known to have this problem, hopefully it is now fixed (they have had
plenty of warning...)

This had been left as a soft error to give various user mode drivers a
change to be properly fixed, with the statement that starting in about
2.6.10 it would be changed.  It had been mostly safe as a soft error ...
but that can not be guaranteed.  Now that a year has passed, it's time to
really insist that the user mode drivers finally fix their relevant bugs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27 14:43:42 -07:00
Christoph Lameter 3e1d1d28d9 [PATCH] Cleanup patch for process freezing
1. Establish a simple API for process freezing defined in linux/include/sched.h:

   frozen(process)		Check for frozen process
   freezing(process)		Check if a process is being frozen
   freeze(process)		Tell a process to freeze (go to refrigerator)
   thaw_process(process)	Restart process
   frozen_process(process)	Process is frozen now

2. Remove all references to PF_FREEZE and PF_FROZEN from all
   kernel sources except sched.h

3. Fix numerous locations where try_to_freeze is manually done by a driver

4. Remove the argument that is no longer necessary from two function calls.

5. Some whitespace cleanup

6. Clear potential race in refrigerator (provides an open window of PF_FREEZE
   cleared before setting PF_FROZEN, recalc_sigpending does not check
   PF_FROZEN).

This patch does not address the problem of freeze_processes() violating the rule
that a task may only modify its own flags by setting PF_FREEZE. This is not clean
in an SMP environment. freeze(process) is therefore not SMP safe!

Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 17:10:13 -07:00
Adrian Bunk 4749f32da9 [PATCH] better USB_MON dependencies
This makes the USB_MON less confusing.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-23 10:04:15 -07:00
Christoph Hellwig 5f45f1a78f [PATCH] remove duplicate get_dentry functions in various places
Various filesystem drivers have grown a get_dentry() function that's a
duplicate of lookup_one_len, except that it doesn't take a maximum length
argument and doesn't check for \0 or / in the passed in filename.

Switch all these places to use lookup_one_len.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Greg KH <greg@kroah.com>
Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-23 09:45:20 -07:00
Greg Kroah-Hartman 4893e9d1cf [PATCH] USB: fix show_modalias() function due to attribute change
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:27:35 -07:00
Yani Ioannou 10523b3b82 [PATCH] Driver Core: drivers/s390/net/qeth_sys.c - drivers/usb/gadget/pxa2xx_udc.c: update device attribute callbacks
Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:35 -07:00
Alan Stern f409661877 [PATCH] usbcore: Don't call device_release_driver recursively
This patch fixes usb_driver_release_interface() to make it avoid calling
device_release_driver() recursively, i.e., when invoked from within the
disconnect routine for the same device.  The patch applies to your
"driver" tree.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:29 -07:00
Patrick Mochel 273971bade [PATCH] usb: klist_node_attached() fix
The original code looks like this:

        /* if interface was already added, bind now; else let
         * the future device_add() bind it, bypassing probe()
         */
        if (!list_empty (&dev->bus_list))
                device_bind_driver(dev);

IOW, it's checking to see if the device is attached to the bus or not
and binding the driver if it is. It's checking the device's bus list,
which will only appear empty when the device has been initialized, but
not added. It depends way too much on the driver model internals, but it
seems to be the only way to do the weird crap they want to do with
interfaces.

When I converted it to use klists, I accidentally inverted the logic,
which led to bad things happening. This patch returns the check to its
orginal value.

From: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/drivers/usb/core/usb.c
===================================================================
2005-06-20 15:15:28 -07:00
gregkh@suse.de ff710710ea [PATCH] USB: fix build warning in usb core as pointed out by Andrew.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/drivers/usb/core/usb.c
===================================================================
2005-06-20 15:15:26 -07:00
mochel@digitalimplant.org d4a7537122 [PATCH] Fix up USB to use klist_node_attached() instead of list_empty() on lists that will go away.
Signed-off-by: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/drivers/usb/core/usb.c
===================================================================
2005-06-20 15:15:17 -07:00
mochel@digitalimplant.org 6034a080f9 [PATCH] Use driver_for_each_device() instead of manually walking list.
Signed-off-by: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/drivers/usb/core/usb.c
===================================================================
2005-06-20 15:15:13 -07:00
Mark M. Hoffman 5cebfb759c [PATCH] USB: trivial error path fix
Trivial fix to USB class-creation error path; please apply.

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:09 -07:00
gregkh@suse.de 56b2293595 [PATCH] class: convert drivers/* to use the new class api instead of class_simple
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:09 -07:00
gregkh@suse.de 8561b10f6e [PATCH] USB: move the usb hcd code to use the new class code.
This moves a kref into the main hcd structure, which detaches it from
the class device structure.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:07 -07:00
Dmitry Torokhov 8d790d7408 [PATCH] make driver's name be const char *
Driver core:
  change driver's, bus's, class's and platform device's names
  to be const char * so one can use
            const char *drv_name = "asdfg";
  when initializing structures.
  Also kill couple of whitespaces.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-20 15:15:01 -07:00
Paulo Marques 77ddecc3c0 [PATCH] USB: make MODALIAS code a bit smaller devices
This patch makes the code to provide modalias in sysfs for usb devices
56 bytes smaller in i386, while making it clear that the first part of
the modalias string is the same no matter what the device class is.

Signed-Off-By: Paulo Marques <pmarques@grupopie.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-03 00:04:29 -07:00
Greg KH 360b52b089 [PATCH] USB: add modalias sysfs file for usb devices
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-05-16 21:44:26 -07:00
Steven Cole 093cf723b2 [PATCH] USB: Spelling fixes for drivers/usb.
Here are some spelling corrections for drivers/usb.

cancelation -> cancellation
succesful -> successful
cancelation -> cancellation
decriptor -> descriptor
Initalize -> Initialize
wierd -> weird
Protocoll -> Protocol
occured -> occurred
successfull -> successful
Procesing -> Processing
devide -> divide
Isochronuous -> Isochronous
noticable -> noticeable
Basicly -> Basically
transfering -> transferring
intialize -> initialize
Incomming -> Incoming
additionnal -> additional
asume -> assume
Unfortunatly -> Unfortunately
retreive -> retrieve
tranceiver -> transceiver
Compatiblity -> Compatibility
Incorprated -> Incorporated
existance -> existence
Ununsual -> Unusual

Signed-off-by: Steven Cole <elenstev@mesatop.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-05-03 23:31:52 -07:00
Roman Kagan fb3b4ebc0b [PATCH] USB: MODALIAS change for bcdDevice
The patch below adjusts the MODALIAS generated by the usb hotplug
function to match the proposed change to scripts/mod/file2alias.c.

Signed-off-by: Roman Kagan <rkagan@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-22 15:07:01 -07:00
Jesper Juhl 1bc3c9e1e4 [PATCH] USB: kfree cleanup for drivers/usb/* - no need to check for NULL
Get rid of a bunch of redundant NULL pointer checks in drivers/usb/*,
there's no need to check a pointer for NULL before calling kfree() on it.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


Index: gregkh-2.6/drivers/usb/class/audio.c
===================================================================
2005-04-18 17:39:34 -07:00
Jesper Juhl 6fd19f4b55 [PATCH] usb: kfree() cleanups in drivers/usb/core/devio.c
Checking for NULL before calling kfree() is redundant. This patch removes
these redundant checks and also makes a few tiny whitespace changes.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-18 17:39:33 -07:00
Alan Stern 8835f66573 [PATCH] USB: USB API documentation modification
In response to complaints about excessive latency in the uhci-hcd driver
I'm planning to convert it to a top-half/bottom-half design.  It turns out
that to do this, the USB API has to be modified slightly since the driver
will not be able to meet one of the guarantees in the current API.  This
patch changes some kerneldoc, specifying the weaker guarantee.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-18 17:39:30 -07:00
Christopher Li 668a9541a5 [PATCH] USB: bug fix in usbdevfs
I am sorry that the last patch about 32 bit compat ioctl on
64 bit kernel actually breaks the usbdevfs. That is on the current
BK tree. I am retarded. 

Here is the patch to fix it. Tested with USB hard disk and webcam
in both 32bit compatible mode and native 64bit mode.

Again, sorry about that.


From: Christopher Li <chrisl@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-18 17:39:26 -07:00
David Brownell a81e7ecca3 [PATCH] USB: revert "fix" to usb_set_interface()
This reverts a recent change to usb_set_interface().  The change worked
around a quirk in certain devices, but doing this in usbcore creates
needless regressions for other devices.  More appropriate fixes won't
put such handling in usbcore.

Basically it's tricky to do a full software reset of USB device state, since
the devices don't all act the same.  This adds a note to the kerneldoc for
the usb_reset_configuration() call to highlight the quirk this was working
around:  endpoint data toggles not being reset.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-18 17:39:25 -07:00
Greg KH 6d5e8254bf [PATCH] USB: fix up some sparse warnings about static functions that aren't static.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


Index: gregkh-2.6/drivers/usb/core/usb.h
===================================================================
2005-04-18 17:39:24 -07:00
Pavel Machek ba9d35fb01 [PATCH] USB: fix up remaining pm_message_t usages
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-18 17:39:24 -07:00
David Brownell 9a5d3e98dd [PATCH] USB: hcd suspend uses pm_message_t
This patch includes minor "sparse -Wbitwise" updates for the PCI based
HCDs.  Almost all of them involve just changing the second parameter of the
suspend() method to a pm_message_t ...  the others relate to how the EHCI
code walks in-memory data structures.  (There's a minor bug fixed there too
...  affecting the big-endian sysfs async schedule dump.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


Index: gregkh-2.6/drivers/usb/core/hcd.h
===================================================================
2005-04-18 17:39:23 -07:00
David Brownell 27d72e8572 [PATCH] usb suspend updates (interface suspend)
This is the first of a few installments of PM API updates to match the
recent switch to "pm_message_t".  This installment primarily affects
USB device drivers (for USB interfaces), and it changes the handful of
drivers which currently implement suspend methods:

    - <linux/usb.h> and usbcore, signature change

    - Some drivers only changed the signature, net effect this just
      shuts up "sparse -Wbitwise":
	* hid-core
	* stir4200

    - Two network drivers did that, and also grew slightly more
      featureful suspend code ... they now properly shut down
      their activities.  (As should stir4200...)
	* pegasus
	* usbnet

Note that the Wake-On-Lan (WOL) support in pegasus doesn't yet work; looks
to me like it's missing a request to turn it on, vs just configuring it.
The ASIX code in usbnet also has WOL hooks that are ready to use; untested.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/drivers/net/irda/stir4200.c
===================================================================
2005-04-18 17:39:22 -07:00
David Brownell c6053ecffb [PATCH] usb resume fixes
This has a variety of updates to the shared suspend/resume code for
PCI based USB host controllers.

    - Cope with pm_message_t replacing the target system state.
      This is actually a loss of functionality; PCI D1 and D2
      states will no longer be used, and it's no longer knowable
      that D3cold is on the way so power will be lost.

    - Most importantly, some of the resume paths are reworked and
      cleaned up.  They're now an exact mirror of suspend paths,
      and more care is taken to ensure the hardware is reactivated
      before the hardware re-enables interrupts.

Plus comment and diagnostic cleanups; there are some nasty cases here 
especially combined with swsusp, now they're somewhat commented.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff -puN drivers/usb/core/hcd-pci.c~usb-resume-fixes drivers/usb/core/hcd-pci.c
2005-04-18 17:39:22 -07:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00