1. 18 2月, 2011 1 次提交
  2. 04 2月, 2011 2 次提交
  3. 23 1月, 2011 1 次提交
  4. 21 1月, 2011 1 次提交
    • D
      kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT · 6a108a14
      David Rientjes 提交于
      The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
      is used to configure any non-standard kernel with a much larger scope than
      only small devices.
      
      This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
      references to the option throughout the kernel.  A new CONFIG_EMBEDDED
      option is added that automatically selects CONFIG_EXPERT when enabled and
      can be used in the future to isolate options that should only be
      considered for embedded systems (RISC architectures, SLOB, etc).
      
      Calling the option "EXPERT" more accurately represents its intention: only
      expert users who understand the impact of the configuration changes they
      are making should enable it.
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NDavid Woodhouse <david.woodhouse@intel.com>
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Robin Holt <holt@sgi.com>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6a108a14
  5. 15 1月, 2011 2 次提交
    • S
      usb: Realloc xHCI structures after a hub is verified. · 653a39d1
      Sarah Sharp 提交于
      When there's an xHCI host power loss after a suspend from memory, the USB
      core attempts to reset and verify the USB devices that are attached to the
      system.  The xHCI driver has to reallocate those devices, since the
      hardware lost all knowledge of them during the power loss.
      
      When a hub is plugged in, and the host loses power, the xHCI hardware
      structures are not updated to say the device is a hub.  This is usually
      done in hub_configure() when the USB hub is detected.  That function is
      skipped during a reset and verify by the USB core, since the core restores
      the old configuration and alternate settings, and the hub driver has no
      idea this happened.  This bug makes the xHCI host controller reject the
      enumeration of low speed devices under the resumed hub.
      
      Therefore, make the USB core re-setup the internal xHCI hub device
      information by calling update_hub_device() when hub_activate() is called
      for a hub reset resume.  After a host power loss, all devices under the
      roothub get a reset-resume or a disconnect.
      
      This patch should be queued for the 2.6.37 stable tree.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      653a39d1
    • A
      xHCI: synchronize irq in xhci_suspend() · 0029227f
      Andiry Xu 提交于
      Synchronize the interrupts instead of free them in xhci_suspend(). This will
      prevent a double free when the host is suspended and then the card removed.
      
      Set the flag hcd->msix_enabled when using MSI-X, and check the flag in
      suspend_common(). MSI-X synchronization will be handled by xhci_suspend(),
      and MSI/INTx will be synchronized in suspend_common().
      
      This patch should be queued for the 2.6.37 stable tree.
      Reported-by: NMatthew Garrett <mjg@redhat.com>
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      0029227f
  6. 07 1月, 2011 3 次提交
    • N
      fs: dcache remove dcache_lock · b5c84bf6
      Nick Piggin 提交于
      dcache_lock no longer protects anything. remove it.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      b5c84bf6
    • N
      fs: dcache scale subdirs · 2fd6b7f5
      Nick Piggin 提交于
      Protect d_subdirs and d_child with d_lock, except in filesystems that aren't
      using dcache_lock for these anyway (eg. using i_mutex).
      
      Note: if we change the locking rule in future so that ->d_child protection is
      provided only with ->d_parent->d_lock, it may allow us to reduce some locking.
      But it would be an exception to an otherwise regular locking scheme, so we'd
      have to see some good results. Probably not worthwhile.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      2fd6b7f5
    • N
      fs: dcache scale d_unhashed · da502956
      Nick Piggin 提交于
      Protect d_unhashed(dentry) condition with d_lock. This means keeping
      DCACHE_UNHASHED bit in synch with hash manipulations.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      da502956
  7. 24 12月, 2010 1 次提交
  8. 17 12月, 2010 1 次提交
  9. 22 11月, 2010 1 次提交
    • A
      usb: musb: do not use dma for control transfers · 07a8cdd2
      Anand Gadiyar 提交于
      The Inventra DMA engine used with the MUSB controller in many
      SoCs cannot use DMA for control transfers on EP0, but can use
      DMA for all other transfers.
      
      The USB core maps urbs for DMA if hcd->self.uses_dma is true.
      (hcd->self.uses_dma is true for MUSB as well).
      
      Split the uses_dma flag into two - one that says if the
      controller needs to use PIO for control transfers, and
      another which says if the controller uses DMA (for all
      other transfers).
      
      Also, populate this flag for all MUSB by default.
      
      (Tested on OMAP3 and OMAP4 boards, with EHCI and MUSB HCDs
      simultaneously in use).
      Signed-off-by: NMaulik Mankad <x0082077@ti.com>
      Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
      Signed-off-by: NAnand Gadiyar <gadiyar@ti.com>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
      Cc: Ajay Kumar Gupta <ajay.gupta@ti.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      07a8cdd2
  10. 18 11月, 2010 1 次提交
  11. 17 11月, 2010 5 次提交
  12. 11 11月, 2010 1 次提交
  13. 29 10月, 2010 1 次提交
  14. 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
  15. 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
  16. 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
  17. 25 9月, 2010 2 次提交
  18. 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