1. 28 1月, 2009 1 次提交
    • A
      USB: fix char-device disconnect handling · 501950d8
      Alan Stern 提交于
      This patch (as1198) fixes a conceptual bug: Somewhere along the line
      we managed to confuse USB class devices with USB char devices.  As a
      result, the code to send a disconnect signal to userspace would not be
      built if both CONFIG_USB_DEVICE_CLASS and CONFIG_USB_DEVICEFS were
      disabled.
      
      The usb_fs_classdev_common_remove() routine has been renamed to
      usbdev_remove() and it is now called whenever any USB device is
      removed, not just when a class device is unregistered.  The notifier
      registration and unregistration calls are no longer conditionally
      compiled.  And since the common removal code will always be called as
      part of the char device interface, there's no need to call it again as
      part of the usbfs interface; thus the invocation of
      usb_fs_classdev_common_remove() has been taken out of
      usbfs_remove_device().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Tested-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Cc: stable <stable@kernel.org>
      
      501950d8
  2. 08 1月, 2009 2 次提交
    • M
      USB: fix minor nit in usbfs checking · ed0c7720
      Mark Lord 提交于
      One minor nit did show up, though.  The patch below
      seems to make more sense than the code does without it.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ed0c7720
    • P
      USB: Remove restrictions on signal numbers in devio.c · ff8973d9
      Phil Endecott 提交于
      Just over a year ago (!) I had this brief exchange with Alan Stern:
      
      >> It seems that the signal that can be used with USBDEVFS_DISCSIGNAL and 
      >> in usbdevfs_urb.signr is limited to the real-time signals SIGRTMIN to 
      >> SIGRTMAX. What's the rationale for this restriction? I believe that a 
      >> process can kill() itself with any signal number, can't it? I was 
      >> planning to use SIGIO for usbdevfs_urb.signr and SIGTERM (uncaught) for 
      >> USBDEVFS_DISCSIGNAL. I don't think I'll have a problem with using 
      >> SIGRTMIN+n instead, but I'm curious to know if there's some subtle 
      >> problem with the non-real-time signals that I should be aware of.
      >
      > I don't know of any reason for this restriction.
      
      Since no-one else could think of a reason either, I offer the following 
      patch which allows any signal to be used with USBDEVFS_DISCSIGNAL and 
      usbdevfs_urb.signr.
      Signed-off-by: NPhil Endecott <usbpatch@chezphil.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ff8973d9
  3. 14 11月, 2008 2 次提交
  4. 18 10月, 2008 3 次提交
  5. 17 10月, 2008 1 次提交
  6. 22 7月, 2008 10 次提交
    • G
      device create: usb: convert device_create to device_create_drvdata · bc00bc92
      Greg Kroah-Hartman 提交于
      device_create() is race-prone, so use the race-free
      device_create_drvdata() instead as device_create() is going away.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bc00bc92
    • D
      sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minor · e105b8bf
      Dan Williams 提交于
      Why?:
      There are occasions where userspace would like to access sysfs
      attributes for a device but it may not know how sysfs has named the
      device or the path.  For example what is the sysfs path for
      /dev/disk/by-id/ata-ST3160827AS_5MT004CK?  With this change a call to
      stat(2) returns the major:minor then userspace can see that
      /sys/dev/block/8:32 links to /sys/block/sdc.
      
      What are the alternatives?:
      1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce
         the need to proliferate ioctl interfaces into the kernel, so this
         seems counter productive.
      
      2/ Use udev to create these symlinks: Also doable, but it adds a
         udev dependency to utilities that might be running in a limited
         environment like an initramfs.
      
      3/ Do a full-tree search of sysfs.
      
      [kay.sievers@vrfy.org: fix duplicate registrations]
      [kay.sievers@vrfy.org: cleanup suggestions]
      
      Cc: Neil Brown <neilb@suse.de>
      Cc: Tejun Heo <htejun@gmail.com>
      Acked-by: NKay Sievers <kay.sievers@vrfy.org>
      Reviewed-by: NSL Baur <steve@xemacs.org>
      Acked-by: NKay Sievers <kay.sievers@vrfy.org>
      Acked-by: NMark Lord <lkml@rtr.ca>
      Acked-by: NH. Peter Anvin <hpa@zytor.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e105b8bf
    • D
      USB: Fix pointer/int cast in USB devio code · a80d5ff0
      David Howells 提交于
      Fix pointer/int cast in USB devio code, and thus avoid a compiler warning.
      
      A void* data argument passed to bus_find_device() and thence to match_devt()
      is used to carry a 32-bit datum.  However, casting directly between a u32 and
      a pointer is not permitted - there must be an intermediate cast via (unsigned)
      long.
      
      This was introduced by the following patch:
      
      	commit 94b1c9fa060ece2c8f080583beb6cc6008e41413
      	Author: Alan Stern <stern@rowland.harvard.edu>
      	Date:   Tue Jun 24 14:47:12 2008 -0400
      
      	    usbfs: simplify the lookup-by-minor routines
      
      	    This patch (as1105) simplifies the lookup-by-minor-number code in
      	    usbfs.  Instead of passing the minor number to the callback, which
      	    must then reconstruct the entire dev_t value, the patch passes the
      	    dev_t value directly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a80d5ff0
    • A
      usbfs: don't store bad pointers in registration · e04199b2
      Alan Stern 提交于
      This patch (as1107) fixes a small bug in the usbfs registration and
      unregistration code.  It avoids leaving an error value stored in the
      device's usb_classdev field and it avoids trying to unregister a NULL
      pointer.  (It also fixes a rather extreme overuse of whitespace.)
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e04199b2
    • A
      usbfs: fix race between open and unregister · d64aac36
      Alan Stern 提交于
      This patch (as1106) fixes a race between opening and unregistering
      device files in usbfs.  The current code drops its reference to the
      device and then reacquires it, ignoring the possibility that the
      device structure might have been removed in the meantime.  It also
      doesn't check whether the device is already in the NOTATTACHED state
      when the file is opened.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d64aac36
    • A
      usbfs: simplify the lookup-by-minor routines · 61ad04a8
      Alan Stern 提交于
      This patch (as1105) simplifies the lookup-by-minor-number code in
      usbfs.  Instead of passing the minor number to the callback, which
      must then reconstruct the entire dev_t value, the patch passes the
      dev_t value directly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      61ad04a8
    • A
      usbfs: send disconnect signals when device is unregistered · cd9f0375
      Alan Stern 提交于
      USB device files are accessible in two ways: as files in usbfs and as
      character device nodes.  The two paths are supposed to behave
      identically, but they don't.  When the underlying USB device is
      unplugged, disconnect signals are sent to processes with open usbfs
      files (if they requested these signals) but not to processes with open
      device node files.
      
      This patch (as1104) fixes the bug by moving the disconnect-signalling
      code into a common subroutine which is called from both paths.
      Putting this subroutine in devio.c removes the only out-of-file
      reference to struct dev_state, and so the structure's declaration can
      be moved from usb.h into devio.c.
      
      Finally, the new subroutine performs one extra action: It kills all
      the outstanding async URBs.  (I'd kill the outstanding synchronous
      URBs too, if there was any way to do it.)  In the past this hasn't
      mattered much, because devices were unregistered from usbfs only
      when they were disconnected.  But now the unregistration can also
      occur whenever devices are unbound from the usb_generic driver.  At
      any rate, killing URBs when a device is unregistered from usbfs seems
      like a good thing to do.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cd9f0375
    • M
      USB: fix usb_reset_device and usb_reset_composite_device(take 3) · 742120c6
      Ming Lei 提交于
      This patch renames the existing usb_reset_device in hub.c to
      usb_reset_and_verify_device and renames the existing
      usb_reset_composite_device to usb_reset_device. Also the new
      usb_reset_and_verify_device does't need to be EXPORTED .
      
      The idea of the patch is that external interface driver
      should warn the other interfaces' driver of the same
      device before and after reseting the usb device. One interface
      driver shoud call _old_ usb_reset_composite_device instead of
      _old_ usb_reset_device since it can't assume the device contains
      only one interface. The _old_ usb_reset_composite_device
      is safe for single interface device also. we rename the two
      functions to make the change easily.
      
      This patch is under guideline from Alan Stern.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      742120c6
    • M
      USB: remove interface parameter of usb_reset_composite_device · 625f6949
      Ming Lei 提交于
      From the current implementation of usb_reset_composite_device
      function, the iface parameter is no longer useful. This function
      doesn't do something special for the iface usb_interface,compared
      with other interfaces in the usb_device. So remove the parameter
      and fix the related caller.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      625f6949
    • A
      USB: remove CVS keywords · ea05af61
      Adrian Bunk 提交于
      This patch removes CVS keywords that weren't updated for a long time
      from comments.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ea05af61
  7. 21 6月, 2008 1 次提交
  8. 25 4月, 2008 3 次提交
  9. 02 2月, 2008 4 次提交
  10. 20 10月, 2007 1 次提交
  11. 13 10月, 2007 3 次提交
  12. 28 4月, 2007 3 次提交
    • O
      usbfs micro optimitation · 527660a8
      Oliver Neukum 提交于
      the memory barrier is needed only with smp.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      527660a8
    • K
      USB: make usbdevices export their device nodes instead of using a separate class · 9f8b17e6
      Kay Sievers 提交于
      o The "real" usb-devices export now a device node which can
        populate /dev/bus/usb.
      
      o The usb_device class is optional now and can be disabled in the
        kernel config. Major/minor of the "real" devices and class devices
        are the same.
      
      o The environment of the usb-device event contains DEVNUM and BUSNUM to
        help udev and get rid of the ugly udev rule we need for the class
        devices.
      
      o The usb-devices and usb-interfaces share the same bus, so I used
        the new "struct device_type" to let these devices identify
        themselves. This also removes the current logic of using a magic
        platform-pointer.
        The name of the device_type is also added to the environment
        which makes it easier to distinguish the different kinds of devices
        on the same subsystem.
      
        It looks like this:
          add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1
          ACTION=add
          DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-1
          SUBSYSTEM=usb
          SEQNUM=1533
          MAJOR=189
          MINOR=131
          DEVTYPE=usb_device
          PRODUCT=46d/c03e/2000
          TYPE=0/0/0
          BUSNUM=002
          DEVNUM=004
      
      This udev rule works as a replacement for usb_device class devices:
        SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \
          NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
      
      Updated patch, which needs the device_type patches in Greg's tree.
      
      I also got a bugzilla assigned for this. :)
        https://bugzilla.novell.com/show_bug.cgi?id=250659Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      9f8b17e6
    • G
      USB: remove use of the bus rwsem, as it doesn't really protect anything. · 341487a8
      Greg Kroah-Hartman 提交于
      The driver core stopped using the rwsem a long time ago, yet the USB
      core still grabbed the lock, thinking it protected something.  This
      patch removes that useless use.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: linux-usb-devel <linux-usb-devel@lists.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      341487a8
  13. 10 3月, 2007 1 次提交
  14. 17 2月, 2007 1 次提交
    • A
      USB: unconfigure devices which have config 0 · 3f141e2a
      Alan Stern 提交于
      Some USB devices do have a configuration 0, in contravention of the
      USB spec.  Normally 0 is supposed to indicate that a device is
      unconfigured.
      
      While we can't change what the device is doing, we can change usbcore.
      This patch (as852) allows usb_set_configuration() to accept a config
      value of -1 as indicating that the device should be unconfigured.  The
      request actually sent to the device will still contain 0 as the value.
      But even if the device does have a configuration 0, dev->actconfig
      will be set to NULL and dev->state will be set to USB_STATE_ADDRESS.
      
      Without some sort of special-case handling like this, there is no way
      to unconfigure these non-compliant devices.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3f141e2a
  15. 08 2月, 2007 2 次提交
  16. 21 12月, 2006 1 次提交
    • C
      USB: fix to usbfs_snoop logging of user defined control urbs · df251b8b
      Chris Frey 提交于
      When sending CONTROL URB's using the usual CONTROL ioctl, logging works
      fine, but when sending them via SUBMITURB, like VMWare does, the
      control fields are not logged.  This patch fixes that.
      
      I didn't see any major changes to devio.c recently, so this patch should apply
      cleanly to even the latest kernel.  I can resubmit if it doesn't.
      
      From: Chris Frey <cdfrey@foursquare.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      df251b8b
  17. 02 12月, 2006 1 次提交