1. 17 11月, 2010 1 次提交
  2. 29 10月, 2010 1 次提交
  3. 26 10月, 2010 1 次提交
    • C
      fs: do not assign default i_ino in new_inode · 85fe4025
      Christoph Hellwig 提交于
      Instead of always assigning an increasing inode number in new_inode
      move the call to assign it into those callers that actually need it.
      For now callers that need it is estimated conservatively, that is
      the call is added to all filesystems that do not assign an i_ino
      by themselves.  For a few more filesystems we can avoid assigning
      any inode number given that they aren't user visible, and for others
      it could be done lazily when an inode number is actually needed,
      but that's left for later patches.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      85fe4025
  4. 23 10月, 2010 14 次提交
    • A
      USB: accept some invalid ep0-maxpacket values · 56626a72
      Alan Stern 提交于
      A few devices (such as the RCA VR5220 voice recorder) are so
      non-compliant with the USB spec that they have invalid maxpacket sizes
      for endpoint 0.  Nevertheless, as long as we can safely use them, we
      may as well do so.
      
      This patch (as1432) softens our acceptance criterion by allowing
      high-speed devices to have ep0-maxpacket sizes other than 64.  A
      warning is printed in the system log when this happens, and the
      existing error message is clarified.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NJames <bjlockie@lockie.ca>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      56626a72
    • S
      usb: Fix issue with USB 3.0 devices after system resume · 85f0ff46
      Sarah Sharp 提交于
      When the system suspends and a host controller's power is lost, the USB
      core attempts to revive any USB devices that had the persist_enabled flag
      set.  For non-SuperSpeed devices, it will disable the port, and then set
      the udev->reset_resume flag.  This will cause the USB core to reset the
      device, verify the device descriptors to make sure it's the same device,
      and re-install any non-default configurations or alternate interface
      settings.
      
      However, we can't disable SuperSpeed root hub ports because that turns off
      SuperSpeed terminations, which will inhibit any devices connecting at USB
      3.0 speeds.  (Plus external hubs don't allow SuperSpeed ports to be
      disabled.)
      
      Because of this logic in hub_activate():
                      /* We can forget about a "removed" device when there's a
                       * physical disconnect or the connect status changes.
                       */
                      if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
                                      (portchange & USB_PORT_STAT_C_CONNECTION))
                              clear_bit(port1, hub->removed_bits);
      
                      if (!udev || udev->state == USB_STATE_NOTATTACHED) {
                              /* Tell khubd to disconnect the device or
                               * check for a new connection
                               */
                              if (udev || (portstatus & USB_PORT_STAT_CONNECTION))
                                      set_bit(port1, hub->change_bits);
      
                      } else if (portstatus & USB_PORT_STAT_ENABLE) {
                              /* The power session apparently survived the resume.
                               * If there was an overcurrent or suspend change
                               * (i.e., remote wakeup request), have khubd
                               * take care of it.
                               */
                              if (portchange)
                                      set_bit(port1, hub->change_bits);
      
                      } else if (udev->persist_enabled) {
                              udev->reset_resume = 1;
                              set_bit(port1, hub->change_bits);
      
                      } else {
                              /* The power session is gone; tell khubd */
                              usb_set_device_state(udev, USB_STATE_NOTATTACHED);
                              set_bit(port1, hub->change_bits);
                      }
      
      a SuperSpeed device after a resume with a loss of power will never get the
      reset_resume flag set.  Instead the core will assume the power session
      survived and that the device still has the same address, configuration,
      and alternate interface settings.  The xHCI host controller will have no
      knowledge of the device (since all xhci_virt_devices were destroyed when
      power loss was discovered, and xhci_discover_or_reset_device() has not
      been called), and all URBs to the device will fail.
      
      If the device driver responds by resetting the device, everything will
      continue smoothly.  However, if lsusb is used before the device driver
      resets the device (or there is no driver), then all lsusb descriptor
      fetches will fail.
      
      The quick fix is to pretend the port is disabled in hub_activate(), by
      clearing the local variable.  But I'm not sure what other parts of the hub
      driver need to be changed because they have assumptions about when ports
      will be disabled.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      85f0ff46
    • A
      USB: core: use kernel assigned address for devices under xHCI · c8d4af8e
      Andiry Xu 提交于
      xHCI driver uses hardware assigned device address. This may cause device
      address conflict in certain cases.
      
      Use kernel assigned address for devices under xHCI. Store the xHC assigned
      address locally in xHCI driver.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      c8d4af8e
    • M
      usb: makefile cleanup · 0a2b8a0d
      matt mooney 提交于
      For all modules, change <module>-objs to <module>-y; remove
      if-statements and replace with lists using the kbuild idiom; move
      flags to the top of the file; and fix alignment while trying to
      maintain the original scheme in each file.
      
      None of the dependencies are modified.
      Signed-off-by: Nmatt mooney <mfm@muteddisk.com>
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0a2b8a0d
    • R
      usb: core: endpoint: Fix error path · 7b3a766c
      Rahul Ruikar 提交于
      In function usb_create_ep_devs()
      call put_device() when device_register() fails.
      Signed-off-by: NRahul Ruikar <rahul.ruikar@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7b3a766c
    • P
      USB: do not print -ESHUTDOWN message if usb at otg device mode · 7491f133
      Peter Chen 提交于
      At otg device mode, the otg host resume should do no-op during
      system resume, otherwise, the otg device will be treated as a
      host for enumeration.
      
      So, the otg host driver returns -ESHUTDOWN if it detects the
      current usb mode is device mode. The host driver has to return
      -ESHUTDOWN, otherwise, the usb_hc_died will be called.
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7491f133
    • M
      USB: introduce unmap_urb_setup_for_dma() · 1dae423d
      Martin Fuzzey 提交于
      Split unmap_urb_for_dma() to allow just the setup buffer
      to be unmapped. This allows HCDs to use PIO for the setup
      buffer if it is not suitable for DMA.
      Signed-off-by: NMartin Fuzzey <mfuzzey@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1dae423d
    • A
      USB: disable endpoints after unbinding interfaces, not before · 80f0cf39
      Alan Stern 提交于
      This patch (as1430) fixes a bug in usbcore.  When a device
      configuration change occurs or a device is removed, the endpoints for
      the old config should be completely disabled.  However it turns out
      they aren't; this is because usb_unbind_interface() calls
      usb_enable_interface() or usb_set_interface() to put interfaces back
      in altsetting 0, which re-enables the interfaces' endpoints.
      
      As a result, when a device goes through a config change or is
      unconfigured, the ep_in[] and ep_out[] arrays may be left holding old
      pointers to usb_host_endpoint structures.  If the device is
      deauthorized these structures get freed, and the stale pointers cause
      errors when the the device is eventually unplugged.
      
      The solution is to disable the endpoints after unbinding the
      interfaces instead of before.  This isn't as large a change as it
      sounds, since usb_unbind_interface() disables all the interface's
      endpoints anyway before calling the driver's disconnect routine,
      unless the driver claims to support "soft" unbind.
      
      This fixes Bugzilla #19192.  Thanks to "Tom" Lei Ming for diagnosing
      the underlying cause of the problem.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NCarsten Sommer <carsten_sommer@ymail.com>
      CC: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      80f0cf39
    • M
      usb: change to new flag variable · 25013315
      matt mooney 提交于
      Replace EXTRA_CFLAGS with ccflags-y.
      Signed-off-by: Nmatt mooney <mfm@muteddisk.com>
      Acked-by: NWANG Cong <xiyou.wangcong@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      25013315
    • M
      usb: musb: host: unmap the buffer for PIO data transfers · 496dda70
      Maulik Mankad 提交于
      The USB stack maps the buffer for DMA if the controller supports DMA.
      MUSB controller can perform DMA as well as PIO transfers.
      The buffer needs to be unmapped before CPU can perform
      PIO data transfers.
      
      Export unmap_urb_for_dma() so that drivers can perform
      the DMA unmapping in a sane way.
      Signed-off-by: NMaulik Mankad <x0082077@ti.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      496dda70
    • A
      USB: teach "devices" file about Wireless and SuperSpeed USB · 834e2312
      Alan Stern 提交于
      The /sys/kernel/debug/usb/devices file doesn't know about Wireless or
      SuperSpeed USB.  This patch (as1416b) teaches it, and updates the
      Documentation/usb/proc_sub_info.txt file accordingly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Vrabel <david.vrabel@csr.com>
      CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      834e2312
    • A
      OHCI: work around for nVidia shutdown problem · 3df7169e
      Alan Stern 提交于
      This patch (as1417) fixes a problem affecting some (or all) nVidia
      chipsets.  When the computer is shut down, the OHCI controllers
      continue to power the USB buses and evidently they drive a Reset
      signal out all their ports.  This prevents attached devices from going
      to low power.  Mouse LEDs stay on, for example, which is disconcerting
      for users and a drain on laptop batteries.
      
      The fix involves leaving each OHCI controller in the OPERATIONAL state
      during system shutdown rather than putting it in the RESET state.
      Although this nominally means the controller is running, in fact it's
      not doing very much since all the schedules are all disabled.  However
      there is ongoing DMA to the Host Controller Communications Area, so
      the patch also disables the bus-master capability of all PCI USB
      controllers after the shutdown routine runs.
      
      The fix is applied only to nVidia-based PCI OHCI controllers, so it
      shouldn't cause problems on systems using other hardware.  As an added
      safety measure, in case the kernel encounters one of these running
      controllers during boot, the patch changes quirk_usb_handoff_ohci()
      (which runs early on during PCI discovery) to reset the controller
      before anything bad can happen.
      Reported-by: NPali Rohár <pali.rohar@gmail.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Tested-by: NPali Rohár <pali.rohar@gmail.com>
      CC: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3df7169e
    • S
      USB: output an error message when the pipe type doesn't match the endpoint type · f7dd6491
      Simon Arlott 提交于
      Commit f661c6f8 adds a check of the pipe type if
      CONFIG_USB_DEBUG is enabled, but it doesn't output anything if this scenario
      occurs.
      Signed-off-by: NSimon Arlott <simon@fire.lp0.eu>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f7dd6491
    • W
      USB: core: update comment to match current function name · 4bec9917
      Wolfram Sang 提交于
      Found while debugging a USB problem and trying to find the mentioned function.
      Signed-off-by: NWolfram Sang <w.sang@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4bec9917
  5. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  6. 25 9月, 2010 2 次提交
  7. 04 9月, 2010 1 次提交
    • T
      usb: allow drivers to use allocated bandwidth until unbound · 0791971b
      Thadeu Lima de Souza Cascardo 提交于
      When using the remove sysfs file, the device configuration is set to -1
      (unconfigured). This eventually unbind drivers with the bandwidth_mutex
      held. Some drivers may call functions that hold said mutex, like
      usb_reset_device. This is the case for rtl8187, for example. This will
      lead to the same process holding the mutex twice, which deadlocks.
      
      Besides, according to Alan Stern:
      "The deadlock problem probably could be handled somehow, but there's a
      separate issue: Until the usb_disable_device call finishes unbinding
      the drivers, the drivers are free to continue using their allocated
      bandwidth.  We musn't change the bandwidth allocations until after the
      unbinding is done.  So this patch is indeed necessary."
      
      Unbinding the driver before holding the bandwidth_mutex solves the
      problem. If any operation after that fails, drivers are not bound again.
      But that would be a problem anyway that the user may solve resetting the
      device configuration to one that works, just like he would need to do in
      most other failure cases.
      Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0791971b
  8. 11 8月, 2010 19 次提交