1. 12 12月, 2009 3 次提交
  2. 10 10月, 2009 2 次提交
  3. 28 9月, 2009 1 次提交
    • D
      tty: Fix regressions caused by commit b50989dc · f278a2f7
      Dave Young 提交于
      The following commit made console open fails while booting:
      
      	commit b50989dc
      	Author: Alan Cox <alan@linux.intel.com>
      	Date:   Sat Sep 19 13:13:22 2009 -0700
      
      	tty: make the kref destructor occur asynchronously
      
      Due to tty release routines run in a workqueue now, error like the
      following will be reported while booting:
      
      INIT open /dev/console Input/output error
      
      It also causes hibernation regression to appear as reported at
      http://bugzilla.kernel.org/show_bug.cgi?id=14229
      
      The reason is that now there's latency issue with closing, but when
      we open a "closing not finished" tty, -EIO will be returned.
      
      Fix it as per the following Alan's suggestion:
      
        Fun but it's actually not a bug and the fix is wrong in itself as
        the port may be closing but not yet being destructed, in which case
        it seems to do the wrong thing.  Opening a tty that is closing (and
        could be closing for long periods) is supposed to return -EIO.
      
        I suspect a better way to deal with this and keep the old console
        timing is to split tty->shutdown into two functions.
      
        tty->shutdown() - called synchronously just before we dump the tty
        onto the waitqueue for destruction
      
        tty->cleanup() - called when the destructor runs.
      
        We would then do the shutdown part which can occur in IRQ context
        fine, before queueing the rest of the release (from tty->magic = 0
        ...  the end) to occur asynchronously
      
        The USB update in -next would then need a call like
      
             if (tty->cleanup)
                     tty->cleanup(tty);
      
        at the top of the async function and the USB shutdown to be split
        between shutdown and cleanup as the USB resource cleanup and final
        tidy cannot occur synchronously as it needs to sleep.
      
        In other words the logic becomes
      
             final kref put
                     make object unfindable
      
             async
                     clean it up
      Signed-off-by: NDave Young <hidave.darkstar@gmail.com>
      [ rjw: Rebased on top of 2.6.31-git, reworked the changelog. ]
      Signed-off-by: N"Rafael J. Wysocki" <rjw@sisk.pl>
      [ Changed serial naming to match new rules, dropped tty_shutdown as per
        comments from Alan Stern  - Linus ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f278a2f7
  4. 23 9月, 2009 3 次提交
  5. 20 9月, 2009 12 次提交
    • A
      usb-serial: straighten out serial_open · 320348c8
      Alan Stern 提交于
      This patch (as1291) removes a bunch of code from serial_open(), things
      that were rendered unnecessary by earlier patches.  A missing spinlock
      is added to protect port->port.count, which needs to be incremented
      even if the open fails but not if the tty has gotten a hangup.  The
      test for whether the hardware has been initialized, based on the use
      count, is replaced by a more transparent test of the
      ASYNCB_INITIALIZED bit in the port flags.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      320348c8
    • A
      usb-serial: add missing tests and debug lines · ff8324df
      Alan Stern 提交于
      This patch (as1290) adds some missing tests.  serial_down() isn't
      supposed to do anything if the hardware hasn't been initialized, and
      serial_close() isn't supposed to do anything if the tty has gotten a
      hangup (because serial_hangup() takes care of shutting down the
      hardware).
      
      The patch also updates and adds a few debugging lines.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ff8324df
    • A
      usb-serial: rename subroutines · 74556123
      Alan Stern 提交于
      This patch (as1289) renames serial_do_down() to serial_down() and
      serial_do_free() to serial_release().  It also adds a missing call to
      tty_shutdown() in serial_release().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      74556123
    • A
      usb-serial: fix termios initialization logic · 7e29bb4b
      Alan Stern 提交于
      This patch (as1288) fixes the initialization logic in
      serial_install().  A new tty always needs to have a termios
      initialized no matter what, not just in the case where the lower
      driver will override the termios settings.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7e29bb4b
    • A
      usb-serial: acquire references when a new tty is installed · cc56cd01
      Alan Stern 提交于
      This patch (as1287) makes serial_install() be reponsible for acquiring
      references to the usb_serial structure and the driver module when a
      tty is first used.  This is more sensible than having serial_open() do
      it, because a tty can be opened many times whereas it is installed
      only once, when it is created.  (Not to mention that these actions are
      reversed when the tty is released, not when it is closed.)  Finally,
      it is at install time that the TTY core takes its own reference to the
      usb_serial module, so it is only fitting that we should act the same
      way in regard to the lower-level serial driver.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cc56cd01
    • A
      usb-serial: change logic of serial lookups · 8bc2c1b2
      Alan Stern 提交于
      This patch (as1286) changes usb_serial_get_by_index().  Now the
      routine will check whether the serial device has been disconnected; if
      it has then the return value will be NULL.  If the device hasn't been
      disconnected then the routine will return with serial->disc_mutex
      held, so that the caller can use the structure without fear of racing
      against driver unloads.
      
      This permits the scope of table_mutex in destroy_serial() to be
      reduced.  Instead of protecting the entire function, it suffices to
      protect the part that actually uses serial_table[], i.e., the call to
      return_serial().  There's no longer any danger of the refcount being
      incremented after it reaches 0 (which was the reason for having the
      large scope previously), because it can't reach 0 until the serial
      device has been disconnected.
      
      Also, the patch makes serial_install() check that serial is non-NULL
      before attempting to use it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8bc2c1b2
    • A
      usb-serial: put subroutines in logical order · f5b0953a
      Alan Stern 提交于
      This patch (as1285) rearranges the subroutines in usb-serial.c
      concerned with tty lifetimes into a more logical order: install, open,
      hangup, close, release.  It also updates the formatting of the
      kerneldoc comments.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f5b0953a
    • A
      usb-serial: change referencing of port and serial structures · 41bd34dd
      Alan Stern 提交于
      This patch (as1284) changes the referencing of the usb_serial and
      usb_serial_port structures in usb-serial.c.  It's not feasible to make
      the port structures keep a reference to the serial structure, because
      the ports need to remain in existence when serial is released -- quite
      a few of the drivers expect this.  Consequently taking a reference
      to the port when the device file is open is insufficient; such a
      reference would not pin serial.
      
      To fix this, we now take a reference to serial when the device file is
      opened.  The final put_device() for the ports occurs in
      destroy_serial(), so that the ports will last as long as they are
      needed.
      
      The patch initializes all the port devices, including those in the
      unused "fake" ports.  This makes the code more uniform because they
      can all be released in the same way.  The error handling code in
      usb_serial_probe() is much simplified by this approach; instead of
      freeing everything by hand we can use a single usb_serial_put() call.
      
      Also simplified is the port-release mechanism.  Instead of being two
      separate routines, port_release() and port_free() can be combined into
      one.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      41bd34dd
    • A
      tty: USB serial termios bits · fe1ae7fd
      Alan Cox 提交于
      Various drivers have hacks to mangle termios structures. This stems from
      the fact there is no nice setup hook for configuring the termios settings
      when the port is created
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fe1ae7fd
    • A
      tty: USB does not need the filp argument in the drivers · a509a7e4
      Alan Cox 提交于
      And indeed none of them use it. Clean this up as it will make moving to a
      standard open method rather easier.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a509a7e4
    • A
      tty: USB can now use the shutdown method for kref based freeing of ports · 4455e344
      Alan Cox 提交于
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4455e344
    • A
      tty: USB hangup is racy · d2b39182
      Alan Cox 提交于
      The USB layer uses tty_hangup to deal with unplugs of the physical hardware
      (analogous to loss of carrier) and then frees the resources. However the
      tty_hangup is asynchronous. As the hangup can sleep we can use tty_vhangup
      which is the non async version to avoid freeing resources too early.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d2b39182
  6. 28 7月, 2009 2 次提交
  7. 13 7月, 2009 2 次提交
    • J
      USB: console: Fix regression in usb console on kernel boot · 6e406121
      Jason Wessel 提交于
      The commit 335f8514 introduced a
      regression which stopped usb consoles from working correctly as a
      kernel boot console as well as interactive login device.
      
      The addition of the serial_close() which in turn calls
      tty_port_close_start() will change the reference count of port.count
      and warn about it.  The usb console code had previously incremented
      the port.count to indicate it was making use of the device as a
      console and the forced change causes a double open on the usb device
      which leads to a non obvious kernel oops later on when the tty is
      freed.
      
      To fix the problem instead make use of port->console to track if the
      port is in fact an active console port to avoid double initialization
      of the usb serial device.  The port.count is incremented and
      decremented only with in the scope of usb_console_setup() for the
      purpose of the low level driver initialization.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6e406121
    • A
      headers: smp_lock.h redux · 405f5571
      Alexey Dobriyan 提交于
      * Remove smp_lock.h from files which don't need it (including some headers!)
      * Add smp_lock.h to files which do need it
      * Make smp_lock.h include conditional in hardirq.h
        It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT
      
        This will make hardirq.h inclusion cheaper for every PREEMPT=n config
        (which includes allmodconfig/allyesconfig, BTW)
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      405f5571
  8. 26 6月, 2009 1 次提交
  9. 16 6月, 2009 2 次提交
  10. 11 6月, 2009 1 次提交
  11. 29 5月, 2009 1 次提交
    • A
      usb-serial: fix crash when sub-driver updates firmware · 0a3c8549
      Alan Stern 提交于
      This patch (as1244) fixes a crash in usb-serial that occurs when a
      sub-driver returns a positive value from its attach method, indicating
      that new firmware was loaded and the device will disconnect and
      reconnect.  The usb-serial core then skips the step of registering the
      port devices; when the disconnect occurs, the attempt to unregister
      the ports fails dramatically.
      
      This problem shows up with Keyspan devices and it might affect others
      as well.
      
      When the attach method returns a positive value, the patch sets
      num_ports to 0.  This tells usb_serial_disconnect() not to try
      unregistering any of the ports; instead they are cleaned up by
      destroy_serial().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      0a3c8549
  12. 24 4月, 2009 1 次提交
    • A
      USB: serial: fix lifetime and locking problems · 2d93148a
      Alan Stern 提交于
      This patch (as1229) fixes a few lifetime and locking problems in the
      usb-serial driver.  The main symptom is that an invalid kevent is
      created when the serial device is unplugged while a connection is
      active.
      
      	Ports should be unregistered when device is disconnected,
      	not when the parent usb_serial structure is deallocated.
      
      	Each open file should hold a reference to the corresponding
      	port structure, and the reference should be released when
      	the file is closed.
      
      	serial->disc_mutex should be acquired in serial_open(), to
      	resolve the classic race between open and disconnect.
      
      	serial_close() doesn't need to hold both serial->disc_mutex
      	and port->mutex at the same time.
      
      	Release the subdriver's module reference only after releasing
      	all the other references, in case one of the release routines
      	needs to invoke some code in the subdriver module.
      
      	Replace a call to flush_scheduled_work() (which is prone to
      	deadlocks) with cancel_work_sync().  Also, add a call to
      	cancel_work_sync() in the disconnect routine.
      
      	Reduce the scope of serial->disc_mutex in serial_disconnect().
      	The only place it really needs to protect is where the
      	"disconnected" flag is set.
      
      This fixes the bug reported in
      
      	http://bugs.freedesktop.org/show_bug.cgi?id=20703Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NDan Williams <dcbw@redhat.com>
      Tested-by: NMing Lei <tom.leiming@gmail.com>
      Reviewed-by: NOliver Neukum <oliver@neukum.org>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      2d93148a
  13. 01 4月, 2009 1 次提交
  14. 25 3月, 2009 5 次提交
    • D
      usb-serial: fix usb_serial_register bug when boot with nousb param · e4abe665
      Dave Young 提交于
      With "nousb" cmdline booting, built-in serial drivers (ie. airecable)
      will trigger kernel oops.
      
      Indeed, if nousb, usb_serial_init will failed, and the usb serial bus type
      will not be registerd, then usb_serial_register call driver_register
      which try to register the driver to a not registered bus.
      
      Here add usb_disabled() check in usb_serial_register to fix it.
      Signed-off-by: NDave Young <hidave.darkstar@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e4abe665
    • J
      USB: serial: refuse to open recently removed USB Serial devices · 331879fd
      James Woodcock 提交于
      A USB-serial converter device is plugged into a system, and a process
      opens it's device node.  If the device is physically removed whilst the
      process still has its device node open, then other processes can
      sucessfully open the now non-existent device's node.  I would expect
      that open() on a device that has been physically removed should return
      ENODEV.
      
      This is manifesting itself with getty on my system.  I do the following:
      1.  set up inittab to spawn getty on ttyUSB0, eg:
          T1:23:respawn:/sbin/getty -L ttyUSB0 115200 vt100
      2.  Plug in USB-serial converter cable
      3.  Wait for a login prompt on a terminal program attached to the serial
          cable
      4.  Login
      5.  Pull the USB-serial converter cable from the box
      6.  getty doesn't realise that ttyUSB0 no longer exists as /dev/ttyUSB0
          can still be opened.
      7.  Re-insert the USB-serial converter cable
      8.  You should no longer get a login prompt over the serial cable, as
          the the USB-serial cable now shows up as /dev/ttyUSB1, and getty is
          trying to talk to /dev/ttyUSB0.
      
      The attached patch will cause open("/dev/ttyUSB0", O_RDONLY) to return
      ENODEV after the USB-serial converter has been pulled.  The patch was
      created against 2.6.28.1.  I can supply it against something else if
      needs be.  It is fairly simple, so should be OK.
      
      I am using a pl2303 device, although I don't think that makes any
      difference.
      
      
      From: James Woodcock <James.Woodcock@ACULAB.COM>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      331879fd
    • O
      USB: serial: remove recourse to generic method · 1c27ae67
      Oliver Neukum 提交于
      This removes the fallback to the generic method. It is cleaner to
      explicitely request it. Introducing this was my mistake. This will
      be solved by an explicit test and the driver being allowed to request
      what it needs to be done upon resumption.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1c27ae67
    • O
      USB: serial: use generic method if no alternative is provided in usb serial layer · c49cfa91
      Oliver Neukum 提交于
      This patch makes use of the generic method if a serial driver provides
      no implementation. This simplifies implementing suspend/resume support
      in serial drivers.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c49cfa91
    • O
      USB: serial: introduce a flag into the usb serial layer to tell drivers that... · f8bece8d
      Oliver Neukum 提交于
      USB: serial: introduce a flag into the usb serial layer to tell drivers that their URBs are killed due to suspension
      
      This patch introduces a flag into the usb serial layer to tell drivers
      that their URBs are killed due to suspension. That is necessary to let
      drivers know whether they should report an error back.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      
      Hi Greg,
      
      this is for 2.6.30. Patches to use this in drivers are under development.
      
      	Regards
      		Oliver
      
      f8bece8d
  15. 13 1月, 2009 1 次提交
  16. 03 1月, 2009 2 次提交