1. 02 12月, 2006 3 次提交
    • A
      USB: expand autosuspend/autoresume API · 692a186c
      Alan Stern 提交于
      This patch (as814) adds usb_autopm_set_interface() to the autosuspend
      API.  It also provides convenient wrapper routines,
      usb_autopm_enable() and usb_autopm_disable(), for drivers that want
      to specify directly whether autosuspend should be allowed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      692a186c
    • L
      USB: makes usb_endpoint_* functions inline. · 0c1ac4f2
      Luiz Fernando N. Capitulino 提交于
      We have no benefits of having the usb_endpoint_* functions as functions,
      but making them inline saves text and data segment sizes:
      
      text	   data	    bss	    dec	    hex	filename
      14893634	3108770	1108840	19111244	1239d4c	vmlinux.func
      14893185	3108566	1108840	19110591	1239abf	vmlinux.inline
      
       This is the result of a 2.6.19-rc3 kernel compiled with GCC 4.1.1 without
      CONFIG_MODULES, CONFIG_CC_OPTIMIZE_FOR_SIZE, CONFIG_REGPARM options set.
      USB support is fully enabled (while most of the other drivers are not),
      and that kernel has most of the USB code ported to use the endpoint
      functions.
      
      That happens because a call to those functions are expensive (in terms
      of bytes), while the function's size is smaller or have the same 'size' of
      the call.
      Signed-off-by: NLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0c1ac4f2
    • I
      usb/hub: allow hubs up to 31 children · 43705251
      inaky@linux.intel.com 提交于
      Current Wireless USB host hardware (Intel i1480 for example) allows up
      to 22 devices to connect, thus bringing up the max number of children
      in the WUSB Host Controller to 22 'fake' ports. Upcoming hardware
      might raise that limit.
      
      Makes almost no difference to go to 31, as the bit arrays are
      byte-aligned (plus an extra bit in general), so 22 bits fit in 4 bytes
      as 31 do.
      
      As well, the only other array that depends on USB_MAXCHILDREN is
      'struct usb_hub->indicator'. By declaring it 'u8' instead of 'enum
      hub_led_mode', we reduce the size of each entry from 4 bytes (in i386)
      to 1, which will add as we when are doubling USB_MAXCHILDREN
      (with 16 the size of that array is 64 bytes, with 31 would be 128; by
      using u8 that goes down to 31 bytes).
      Signed-off-by: NInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      43705251
  2. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  3. 29 9月, 2006 1 次提交
  4. 28 9月, 2006 11 次提交
    • A
      usbcore: add autosuspend/autoresume infrastructure · 645daaab
      Alan Stern 提交于
      This patch (as739) adds the basic infrastructure for USB autosuspend
      and autoresume.  The main features are:
      
      	PM usage counters added to struct usb_device and struct
      	usb_interface, indicating whether it's okay to autosuspend
      	them or they are currently in use.
      
      	Flag added to usb_device indicating whether the current
      	suspend/resume operation originated from outside or as an
      	autosuspend/autoresume.
      
      	Flag added to usb_driver indicating whether the driver
      	supports autosuspend.  If not, no device bound to the driver
      	will be autosuspended.
      
      	Mutex added to usb_device for protecting PM operations.
      	Unlike the device semaphore, the locking rule for the pm_mutex
      	is that you must acquire the locks going _up_ the device tree.
      
      	New routines handling autosuspend/autoresume requests for
      	interfaces and devices.
      
      	Suspend and resume requests are propagated up the device tree
      	(but not outside the USB subsystem).
      
      	work_struct added to usb_device, for carrying out delayed
      	autosuspend requests.
      
      	Autoresume added (and autosuspend prevented) during probe and
      	disconnect.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      645daaab
    • A
      usbcore: store each usb_device's level in the tree · b6956ffa
      Alan Stern 提交于
      This patch (as778) adds a field to struct usb_device to store the
      device's level in the USB tree.  In itself this number isn't really
      important.  But the overhead is very low, and in a later patch it will
      be used for preventing bogus warnings from the lockdep checker.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b6956ffa
    • A
      usbcore: trim down usb_bus structure · 17200583
      Alan Stern 提交于
      As part of the ongoing program to flatten out the HCD bus-glue layer,
      this patch (as771b) eliminates the hcpriv, release, and kref fields
      from struct usb_bus.  hcpriv and release were not being used for
      anything worthwhile, and kref has been moved into the enclosing
      usb_hcd structure.
      
      Along with those changes, the patch gets rid of usb_bus_get and
      usb_bus_put, replacing them with usb_get_hcd and usb_put_hcd.
      
      The one interesting aspect is that the dev_set_drvdata call was
      removed from usb_put_hcd, where it clearly doesn't belong.  This means
      the driver private data won't get reset to NULL.  It shouldn't cause
      any problems, since the private data is undefined when no driver is
      bound.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      17200583
    • A
      usbcore: Add flag for whether a host controller uses DMA · dd990f16
      Alan Stern 提交于
      This patch (as770b) introduces a new field to usb_bus: a flag
      indicating whether or not the host controller uses DMA.  This serves
      to encapsulate the computation.  It also means we will have only one
      spot to update if the DMA API changes.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dd990f16
    • A
      USB: remove struct usb_operations · a6d2bb9f
      Alan Stern 提交于
      All of the currently-supported USB host controller drivers use the HCD
      bus-glue framework.  As part of the program for flattening out the glue
      layer, this patch (as769) removes the usb_operations structure.  All
      function calls now go directly to the HCD routines (slightly renamed
      to remain within the "usb_" namespace).
      
      The patch also removes usb_alloc_bus(), because it's not useful in the
      HCD framework and it wasn't referenced anywhere.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a6d2bb9f
    • A
      usbcore: help drivers to change device configs · 088dc270
      Alan Stern 提交于
      It's generally a bad idea for USB interface drivers to try to change a
      device's configuration, and usbcore doesn't provide any way for them
      to do it.  However in a few exceptional circumstances it can make
      sense.  This patch (as767) adds a roundabout mechanism to help drivers
      that may need it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      088dc270
    • L
      USB core: Use const where possible. · 095bc335
      Luiz Fernando N. Capitulino 提交于
      This patch marks some USB core's functions parameters as const. This
      improves the design (we're saying to the caller that its parameter is
      not going to be modified) and may help in compiler's optimisation work.
      Signed-off-by: NLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      095bc335
    • L
      USB: New functions to check endpoints info. · b7cfaaaf
      Luiz Fernando N. Capitulino 提交于
      These functions makes USB driver's code simpler when dealing with endpoints
      by avoiding them from accessing the endpoint's descriptor structure directly
      when they only need to know the endpoint's transfer type and/or
      direction.
      
      Please, read each functions' documentation in order to know how to use
      them.
      Signed-off-by: NLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b7cfaaaf
    • J
      USB: making the kernel -Wshadow clean - USB & completion · 3d5b2510
      Jesper Juhl 提交于
      include/linux/usb.h causes a lot of -Wshadow warnings - fix them.
      
        include/linux/usb.h:901: warning: declaration of 'complete' shadows a global declaration
        include/linux/completion.h:52: warning: shadowed declaration is here
        include/linux/usb.h:932: warning: declaration of 'complete' shadows a global declaration
        include/linux/completion.h:52: warning: shadowed declaration is here
        include/linux/usb.h:967: warning: declaration of 'complete' shadows a global declaration
        include/linux/completion.h:52: warning: shadowed declaration is here
      Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3d5b2510
    • A
      usbcore: track whether interfaces are suspended · 4d064c08
      Alan Stern 提交于
      Currently we rely on intf->dev.power.power_state.event for tracking
      whether intf is suspended.  This is not a reliable technique because
      that value is owned by the PM core, not by usbcore.  This patch (as718b)
      adds a new flag so that we can accurately tell which interfaces are
      suspended and which aren't.
      
      At first one might think these flags aren't needed, since interfaces
      will be suspended along with their devices.  It turns out there are a
      couple of intermediate situations where that's not quite true, such as
      while processing a remote-wakeup request.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4d064c08
    • A
      usbcore: add usb_device_driver definition · 8bb54ab5
      Alan Stern 提交于
      This patch (as732) adds a usb_device_driver structure, for representing
      drivers that manage an entire USB device as opposed to just an
      interface.  Support routines like usb_register_device_driver,
      usb_deregister_device_driver, usb_probe_device, and usb_unbind_device
      are also added.
      
      Unlike an earlier version of this patch, the new code is type-safe.  To
      accomplish this, the existing struct driver embedded in struct
      usb_driver had to be wrapped in an intermediate wrapper.  This enables
      the core to tell at runtime whether a particular struct driver belongs
      to a device driver or to an interface driver.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8bb54ab5
  5. 03 8月, 2006 2 次提交
  6. 13 7月, 2006 1 次提交
  7. 22 6月, 2006 5 次提交
  8. 26 4月, 2006 1 次提交
  9. 29 3月, 2006 1 次提交
  10. 21 3月, 2006 1 次提交
  11. 05 1月, 2006 8 次提交
    • K
      [PATCH] driver core: replace "hotplug" by "uevent" · 312c004d
      Kay Sievers 提交于
      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: NKay Sievers <kay.sievers@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      312c004d
    • A
      [PATCH] USB: Store port number in usb_device · 12c3da34
      Alan Stern 提交于
      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: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      12c3da34
    • A
      [PATCH] USB: Consider power budget when choosing configuration · 55c52718
      Alan Stern 提交于
      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: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      55c52718
    • A
      [PATCH] USB: Remove USB private semaphore · 9ad3d6cc
      Alan Stern 提交于
      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: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9ad3d6cc
    • G
      [PATCH] USB: remove .owner field from struct usb_driver · 75318d2d
      Greg Kroah-Hartman 提交于
      It is no longer needed, so let's remove it, saving a bit of memory.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      75318d2d
    • G
      [PATCH] USB: make registering a usb driver automatically set the module owner · 2143acc6
      Greg Kroah-Hartman 提交于
      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: NGreg Kroah-Hartman <gregkh@suse.de>
      2143acc6
    • G
      [PATCH] USB: allow usb drivers to disable dynamic ids · ba9dc657
      Greg Kroah-Hartman 提交于
      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: NGreg Kroah-Hartman <gregkh@suse.de>
      ba9dc657
    • G
      [PATCH] USB: add dynamic id functionality to USB core · 733260ff
      Greg Kroah-Hartman 提交于
      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: NGreg Kroah-Hartman <gregkh@suse.de>
      733260ff
  12. 24 11月, 2005 1 次提交
  13. 14 11月, 2005 1 次提交
  14. 29 10月, 2005 3 次提交