| Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
This makes the USB_MON less confusing.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
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>
|
|
On Wed, May 04, 2005 at 01:37:30PM -0700, David Brownell wrote:
> On Wednesday 04 May 2005 12:19 pm, Roman Kagan wrote:
> > struct urb {
> > /* private, usb core and host controller only fields in the urb */
> > ...
> > struct list_head urb_list; /* list pointer to all active urbs */
> > ...
> > };
> >
> > Is it safe to use it for driver's purposes when the driver owns the urb,
> > that is, starting from the completion routine until the urb is submitted
> > with usb_submit_urb()?
>
> Right now, it should be.
Great! FWIW I've briefly tested a modified version of usbatm using
the list head in struct urb instead of creating a wrapper struct, and I
haven't seen any failures yet. So I tend to believe that your "should
be" actually means "is" :)
> > If it is, can it be guaranteed in future, e.g.
> > by moving the list head into the public section of struct urb?
>
> In fact I'm not sure why it ever got called "private" to usbcore/hcds.
> I thought the idea was that it should be like urb->status, reserved for
> whoever controls the URB.
OK then how about the following (essentially documentation) patch?
Signed-off-by: Roman Kagan <rkagan@mail.ru>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
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
===================================================================
|
|
Before I'm getting flamed to death:
This patch contains possible cleanups. If parts of this patch conflict
with pending changes these parts of my patch have to be dropped.
This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global functions:
- core/usb.c: usb_buffer_map
- core/usb.c: usb_buffer_unmap
- remove the following unneeded EXPORT_SYMBOL's:
- core/hcd.c: usb_bus_init
- core/hcd.c: usb_alloc_bus
- core/hcd.c: usb_register_bus
- core/hcd.c: usb_deregister_bus
- core/hcd.c: usb_hcd_irq
- core/usb.c: usb_buffer_map
- core/usb.c: usb_buffer_unmap
- core/buffer.c: hcd_buffer_create
- core/buffer.c: hcd_buffer_destroy
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
device insertion.
This should fix a lot of issues with broken devices that can't handle retrieving strings
while they are doing something else (strings would be fetched from usbfs and sysfs entries.)
Based on a patch that has been in the SuSE kernel tree for a long time from Olaf Hering <olh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Change the units of the timeout constants in usb.h to correspond to
the new parameter units for usb_{control,bulk}_msg(), in this case from seconds
to milliseconds.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
This patch adds so-called "usbmon", or USB monitoring framework, similar
to what tcpdump provides for Ethernet. This is an initial version, but
it should be safe and useful. It adds an overhead of an if () statement
into submission and giveback paths even when not monitoring, but this
was deemed a lesser evil than stealth manipulation of function pointers.
The patch makes two changes to hcd.c which make usbmon more useful:
- Change the way we determine that DMA should not be mapped for root
hubs, so that usbmon knows easily when it's safe to capture data.
- Return exports of usb_bus_list and usb_bus_list_lock for those who
wish to build usbmon as a module.
This version of the patch changes #define to inlines for hooks and
drops extra mod_ops.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Some minor doc/comment fixes for USB.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
Yet another step in the quest to get all USB data structures to be native
endian.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This changes the usbcore interfaces provided to HCDs:
- Remove usb_device->hcpriv and it allocation/deallocation hooks
- Replace struct hcd_dev with more appropriate per-endpoint state
- Update HCD apis to use usb_host_endpoint in key places
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This starts updating the usbcore interface to use endpoints in places it
previously used pipes or other representations of the endpoint.
- add new arrays of "struct usb_host_endpoint" pointers, matching
current config and altsetting
- get rid of the two epmaxpacket[] arrays; they duplicate information
that's now readily accessible from the usb_host_endpoint.
- resolve a FIXME by removing a function that only existed because
the usb_host_endpoint wasn't readily accessible.
It also removes most of an old rant about pipes, trimming it down so
only the important bits remain.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This patch reintroduces the usb_lock_device_for_reset() routine, which
is specially tailored to meet the needs of drivers that have to reset a
device either during probe() or during normal operations. It updates a
few drivers that do device resets, to make them use the new routine. It
also adds a new field to struct usb_interface, to keep track of whether
the interface is in the process of being bound to or unbound from a
driver. This is necessary, because during binding we know the device is
already locked so we don't want to try to acquire the lock again!
With this patch in place, USB device resets should finally become
reliable.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This patch reintroduces the USB device locking code we tried out
earlier. As before, it solves the problem of effectively locking all
the devices while drivers are registered and unregistered by introducing
an rwsem. Unlike the earlier attempt, this version does not ever try to
acquire a lock re-entrantly. I trust that will eliminate the races and
hang-ups you observed with the earlier version. There are also copious
comments explaining exactly how things should work.
The patch interacts slightly with the locktree() code introduced by
David for suspend/resume support. It doesn't change the functionality
at all; it just updates the routine to follow the new locking rules.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This has been publicised for years now, and the usvfs name will work just
fine with a 2.4 kernel, so we are not breaking backwards compatibility.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
Well, it works only for UHCI controllers, but that's not acceptable...
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This patch is a repeat of as331 as described in
http://marc.theaimsgroup.com/?l=linux-usb-devel&m=108811725219677&w=2
It has been updated slightly to match the current source. It should be
non-controversial; it has nothing to do with hubs or locking. Please
apply.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This adds some of the infrastructure needed to support some more
USB capabilities:
- CONFIG_USB_SUSPEND, so Linux can put individual devices
into the USB "suspend" state. They can (sometimes) use
"remote wakeup" to resume the host; or they can each be
resumed by the host.
+ New usbcore device selective suspend/resume APIs
* Define them, as stubs for now
* Call them on the paths sysfs uses (renamed functions)
+ HCD support
* Define root hub suspend calls; delegate them to HCDs.
* OHCI and EHCI can suspend/resume root hubs that way.
* Not called yet, until suspend/resume calls exist
- CONFIG_USB_OTG, which depends on the selective suspend APIs
to allow devices to switch roles (host to peripheral, etc).
This patch just adds a few key flags in usb_bus, needed by
usbcore (during enumeration) and by HCD and OTG controllers
on OTG-capable boards.
- Related bugfix: power budgeting is supposed to place a
100mA per port (non-OTG) for bus-powered devices.
This patch changes no behavior; later patches will do that,
and they'll be smaller because of this.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
Hi Greg!
I am compiling allmodconfig with some extra gcc warnings enabled
(-W -Wno-unused -Wno-sign-compare -Winline -Wundef) and got this one:
CC [M] security/root_plug.o
In file included from security/root_plug.c:30:
include/linux/usb.h:358: warning: `inline' is not at beginning of declaration
Patch is trivial:
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
This patch is a slightly revised version of as277c, updated to match the
current source. The only difference from the older version is that this
makes urb->use_count into an atomic_t, to avoid the overhead of an extra
locking step each time an URB is submitted and given back. The important
features of this patch are:
-EPERM added to Documentation/usb/error-codes.txt.
Failure to use URB_ASYNC_UNLINK with usb_unlink_urb() is
deprecated in the documentation.
New ->reject and ->use_count fields added to struct urb.
The reject field is protected by urb->lock, and locking is
required only in usb_kill_urb() which doesn't have to be fast.
Single wait_queue used for all processes waiting inside
usb_kill_urb(). The wait queue is woken up only when an URB
is given back with ->reject set.
usb_rh_status_dequeue() changed to return int. It looks like
this function should be declared static; it's not used outside
the hcd.c file.
Prototype for unlink_urb() in struct usb_operations is changed
to include a status code argument. This is necessary so that
the different unlink paths can return -ENOENT and -ECONNRESET
as appropriate.
Support for synchronous usb_unlink_urb() has been removed;
such calls are passed to usb_kill_urb().
Kerneldoc for usb_unlink_urb() is updated.
usb_kill_urb() added to urb.c.
hc_simple() host driver is partially updated -- it should
compile but it won't really work right.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
proc_resetdevice is called with dev->serialize held.
usb_reset_device takes dev->serialize and then calls
__usb_reset_device. To avoid deadlock, proc_resetdevice
should call __usb_reset_device directly.
Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
|
|
|
|
|
|
this is a new waiting helper safe even if we are left on a waitqueue.
This version addresses Alan's concerns about ifdefs. Please apply.
- add delay helper that is safe even if we are still on another waitqueue
|
|
|
|
This is a revised version of an earlier patch; I feel a lot better about
this one. Basically it does the same thing as before: allocate
interfaces dynamically to avoid the problems with reusing them.
The difference is that this patch adds a struct kref to the array of
usb_interface_cache's, so the array can persist if needed after the
device has been disconnected. Each interface takes a reference to it
(along with the configuration itself), so as long as the interfaces
remain pinned in memory the altsettings will also remain.
Here is a slight revision of patch as246b. This one allocates all the new
interfaces before changing any other state; otherwise it's the same.
|
|
|
|
|
|
|
|
Remove usb_interface.driver, and along with it the "half bound" state
previously associated with drivers binding with claim() instead of probe().
This changes usb_driver_claim_interface() semantics slightly: drivers must
now be prepared to accept disconnect() callbacks.
Fixes more locking bugs, and a claim() oops that snuck in with a
recent patch.
|
|
I've posted all these before, the only notable change is
treating that one gphoto2 case as warn-and-continue rather
than return-with-failure.
usb_set_configuration() cleanup
* Remove it from the USB kernel driver API. No drivers need it now,
and the sysadmin can change bConfigurationValue using sysfs (say,
when hotplugging an otherwise problematic device).
* Simpler/cleaner locking: caller must own dev->serialize.
* Access from usbfs now uses usb_reset_configuration() sometimes,
preventing sysfs thrash, and warns about some dangerous usage
(which gphoto2 and other programs may be relying on). (This is
from Alan Stern, but I morphed an error return into a warning.)
* Prevent a couple potential "no configuration" oopses. (Alan's?)
* Remove one broken call from usbcore, in the "device morphed" path
of usb_reset_device(). This should be more polite now, hanging
that one device rather than khubd.
|
|
into kroah.com:/home/linux/BK/usb-2.6
|
|
From: "David S. Miller" <davem@redhat.com>
Currently, for an existing DMA mapping, there is a way to transfer buffer
ownership back to the cpu, yet there is no way to give it back to the device
again explicitly. The latter really is needed on platforms where the PCI
subsystem does not snoop the cpu caches, MIPS is one example.
Many drivers were expecting the existing DMA sync interface to handle both
directions, which was wrong.
Now, with this change, we have explicit interfaces for DMA syncing to/from
the device and the cpu.
|
|
Some doc updates, mostly from Alan Stern, clarifying
quetions folk have asked recently about unlinking
and about iso transfers.
|
|
|
|
On Sat, 21 Feb 2004, Greg KH wrote:
> > One thing that would be good, whether this change gets made or not, is to
> > remove all assumptions from drivers about the order in which interfaces
> > are stored (use usb_ifnum_to_if()) and the order in which altsettings are
> > stored (replace intf.act_altsetting with a pointer and create
> > usb_altnum_to_alt() analogous to usb_ifnum_to_if()). There are plenty of
> > drivers that will need to be fixed up.
>
> I'd be glad to take patches to fix up any drivers that still have this
> problem right now.
Here's a start. This patch begins the conversion process by adding
usbcore support for cur_altsetting and deprecating act_altsetting.
So long as we assumed that altsetting numbers range from 0 to
num_altsetting-1 and that the number matches its index in the altsetting
array, there was no harm in using act_altsetting. But without that
assumption act_altsetting is merely an invitation to errors. Although the
kerneldoc says that act_altsetting is the _index_ of the active
altsetting, it's all too easy to confuse it with the _number_ of the
active altsetting. Using cur_altsetting instead (a pointer rather than a
number) will prevent that confusion.
Until all the drivers have been converted to use cur_altsetting, the core
will have to maintain act_altsetting in parallel with it. Eventually we
will be able to remove act_altsetting, but fixing all the drivers will
take a while.
Included in this patch:
Add cur_altsetting to struct usb_interface and deprecate
act_altsetting.
Add comments and kerneldoc explaining the changes. Also remove
the comments in front of struct usb_host_config (they seem to
have been left behind when usb_ch9.h was split out) and add
kerneldoc for that structure.
Add usb_altnum_to_altsetting() to help look up altsettings based
on their number.
Convert the usb_set_interface(), usb_set_configuration(), and
usb_reset_configuration() routines to support cur_altsetting
and act_altsetting in parallel. Convert a few others to use
cur_altsetting rather than act_altsetting.
Rename a few local variables to make their meaning a little
clearer. It would be nice to change struct usb_host_interface
to something like usb_host_altsetting, but that's a patch for
another time.
|
|
On Fri, 27 Feb 2004, Greg KH wrote:
> On Wed, Feb 25, 2004 at 10:05:37AM -0500, Alan Stern wrote:
>
> > Why would anyone want to do this, you ask? Well the USB subsystem does it
> > already. Each USB device can have several configurations, only one of
> > which is active at any time. Corresponding to each configuration is a set
> > of struct devices, and they (together with their embedded kobjects) are
> > allocated and initialized when the USB device is first detected. The
> > struct devices are add()'ed and del()'ed as configurations are activated
> > and deactivated, leading to just the sort of call sequence shown above.
>
> Then we need to fix this.
The driver model does not support repeated device_add(), device_del(),
device_add(), device_del(), ... calls for the same device. But that's
what happens to an interface's embedded struct device when we change
configurations.
Accordingly, this patch changes the device_add()/device_del() calls for
interfaces to device_register()/device_unregister(). When the interface
is unregistered the new code waits for the release method to run, so that
it will be safe to re-register the interface should the former
configuration be reinstated.
Greg, please check this out to make sure I haven't made some dumb mistake.
It works on my system and it fixes a memory leak in the USB system.
|
|
This patch starts dis-entangling some of the enumeration logic by
moving initialization code into the usb_alloc_dev() constructor.
Some call signatures changed; a usbcore-internal declaration was
moved in <linux/usb.h> to a more appropriate location.
With the driver model init now more centralized, it's safer to
use driver model calls (including dev_info) a lot earlier, so
the "new device at address N" message now does that. It also
reports the device speed, which may not be evident otherwise.
|
|
(moving the one used function into the usb.c file.)
|
|
|
|
There are problems lurking in the driver binding code for usb,
with highlights being disagreements about:
(a) locks: usb bus writelock v. BKL v. driver->serialize
(b) driver: interface.driver v. interface.dev.driver
Fixing those is going to take multiple patches, and I thought
I'd start out with a small one that's relatively simple. This:
- Cleans up locking.
* Updates comments and kerneldoc to reflect that the
usb bus writelock is what protects against conflicts
when binding/unbinding drivers to devices.
* Removes driver->serialize ... not needed, since
it's only gotten when the bus writelock is held.
* Removes incorrect "must have BKL" comments, and one
bit of code that tried to use BKL not the writelock.
- Removes inconsistencies about what driver is bound to the
interface ... for now "interface.driver" is "the truth".
* usb_probe_interface() will no longer clobber bindings
established with usb_driver_claim_interface().
* usb_driver_release_interface() calls device_release_driver()
for bindings established with probe(), so the driver model
updates (sysfs etc) are done as expected.
* usb_unbind_interface() doesn't usb_driver_release_interface(),
since release() should eventually _always_ call unbind()
(indirectly through device_release_driver).
Essentially there are two driver binding models in USB today,
and this patch makes them start to cooperate properly:
- probe()/disconnect(), used by most drivers. This goes
through the driver model core.
- claim()/release(), used by CDC drivers (ACM, Ethernet)
and audio to claim extra interfaces and by usbfs since it
can't come in through probe(). Bypasses driver model.
That interface.driver pointer can be removed by changing the
claim()/release() code to use the driver model calls added
for that purpose: device_{bind,release}_driver(). I didn't
do that in this patch, since it'll have side effects like
extra disconnect() calls that drivers will need to handle.
A separate usbfs patch is needed to fix its driver binding;
mostly just to use the right lock, but those changes were
more extensive and uncovered other issues. (Like, I think,
some that Duncan has been noticing ...)
|
|
Reduce constant string space by reusing __FILE__
|
|
This patch removes the home-brewed resizeable arrays used to store
altsetting structures, along with the now-unneeded max_altsetting field.
Since we are already making a preliminary pass through all the descriptors
to check their lengths, we take the opportunity to also count the number
of altsetting descriptors for each interface. Then exactly the right
number can be allocated all at once.
This also moves the code that allocates the altsettings outside the
usb_parse_interface() routine. Though not important now, this change will
come in handy in the next patch.
|
|
Here is the first part of ISDN bugfixes for 2.6.
It should make ISDN work again with most controllers.
More fixes follow after more testing.
|
|
the driver model.
Now it's up to the individual USB drivers to implement suspend() and
resume() if they want to.
|