1. 23 7月, 2008 1 次提交
    • A
      usb_serial: API all change · 95da310e
      Alan Cox 提交于
      USB serial likes to use port->tty back pointers for the real work it does and
      to do so without any actual locking. Unfortunately when you consider hangup
      events, hangup/parallel reopen or even worse hangup followed by parallel close
      events the tty->port and port->tty pointers are not guaranteed to be the same
      as port->tty is the active tty while tty->port is the port the tty may or
      may not still be attached to.
      
      So rework the entire API to pass the tty struct. For console cases we need
      to pass both for now. This shows up multiple drivers that immediately crash
      with USB console some of which have been fixed in the process.
      
      Longer term we need a proper tty as console abstraction
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      95da310e
  2. 25 4月, 2008 2 次提交
  3. 02 2月, 2008 3 次提交
    • G
      USB: fix codingstyle issues in include/linux/usb/ · 41dceed5
      Greg Kroah-Hartman 提交于
      Fixes a number of coding style issues in the USB public header files.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      41dceed5
    • O
      USB: stop io performed by mos7720 upon close() · a1cd7e99
      Oliver Neukum 提交于
      This fixes a problem where the mos7720 driver will make io to a device from
      which it has been logically disconnected. It does so by introducing a flag by
      which the generic usb serial code can signal the subdrivers their
      disconnection and appropriate locking.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      a1cd7e99
    • A
      USB: usb_serial: clean tty reference in the last close · 9a6b1efa
      Aristeu Rozanski 提交于
      When a usb serial adapter is used as console, the usb serial console
      driver bumps the open_count on the port struct used but doesn't attach
      a real tty to it (only a fake one temporaly). If this port is opened later
      using the regular character device interface, the open method won't
      initialize the port, which is the expected, and will receive a brand new
      tty struct created by tty layer, which will be stored in port->tty.
      
      When the last close is issued, open_count won't be 0 because of the
      console usage and the port->tty will still contain the old tty value. This
      is the last ttyUSB<n> close so the allocated tty will be freed by the
      tty layer. The usb_serial and usb_serial_port are still in use by the
      console, so port_free() won't be called (serial_close() ->
      usb_serial_put() -> destroy_serial() -> port_free()), so the scheduled
      work (port->work, usb_serial_port_work()) will still run. And
      usb_serial_port_work() does:
      (...)
              tty = port->tty;
              if (!tty)
                      return;
      
              tty_wakeup(tty);
      which causes (manually copied):
      
      Faulting instruction address: 0x6b6b6b68
      Oops: Kernel access of bad area, sig: 11 [#1]
      PREEMPT PowerMac
      Modules linked in: binfmt_misc ipv6 nfs lockd nfs_acl sunrpc dm_snapshot dm_mirror dm_mod hfsplus uinput ams input_polldev genrtc cpufreq_powersave i2c_powermac therm_adt746x snd_aoa_codec_tas snd_aoa_fabric_layout snd_aoa joydev snd_aoa_i2sbus snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc pmac_zilog serial_core evdev ide_cd cdrom snd appletouch soundcore snd_aoa_soundbus bcm43xx firmware_class usbhid ieee80211softmac ff_memless firewire_ohci firewire_core ieee80211 ieee80211_crypt crc_itu_t sungem sungem_phy uninorth_agp agpart ssb
      NIP: 6b6b6b68 LR: c01b2108 CTR: 6b6b6b6b
      REGS: c106de80 TRAP: 0400   Not tainted  (2.6.24-rc2)
      MSR: 40009032 <EE,ME,IR,DR>  CR: 82004024  XER: 00000000
      TASK = c106b4c0[5] 'events/0' THREAD: c106c000
      GPR00: 6b6b6b6b c106df30 c106b4c0 c2d613a0 00009032 00000001 00001a00 00000001
      GPR08: 00000008 00000000 00000000 c106c000 42004028 00000000 016ffbe0 0171a724
      GPR16: 016ffcf4 00240e24 00240e70 016fee68 016ff9a4 c03046c4 c0327f50 c03046fc
      GPR24: c106b6b9 c106b4c0 c101d610 c106c000 c02160fc c1eac1dc c2d613ac c2d613a0
      NIP [6b6b6b68] 0x6b6b6b68
      LR [c01b2108] tty_wakeup+0x6c/0x9c
      Call Trace:
      [c106df30] [c01b20e8] tty_wakeup+0x4c/0x9c (unreliable)
      [c106df40] [c0216138] usb_serial_port_work+0x3c/0x78
      [c106df50] [c00432e8] run_workqueue+0xc4/0x15c
      [c106df90] [c0043798] worker_thread+0xa0/0x124
      [c106dfd0] [c0048224] kthread+0x48/0x84
      [c106dff0] [c00129bc] kernel_thread+0x44/0x60
      Instruction dump:
      XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
      XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
      Slab corruption: size-2048 start=c2d613a0, len=2048
      Redzone: 0x9f911029d74e35b/0x9f911029d74e35b.
      Last user: [<c01b16d8>](release_one_tty+0xbc/0xf4)
      050: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
      Prev obj: start=c2d60b88, len=2048
      Redzone: 0x9f911029d74e35b/0x9f911029d74e35b.
      Last user: [<c00f30ec>](show_stat+0x410/0x428)
      000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
      010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
      
      This patch avoids this, clearing port->tty considering if the port is
      used as serial console or not
      Signed-off-by: NAristeu Rozanski <arozansk@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      9a6b1efa
  4. 13 10月, 2007 1 次提交
    • A
      USB: serial core should respect driver requirements · 063a2da8
      Alan Stern 提交于
      This patch (as997) fixes a bug in the USB serial core.  The core needs
      to pay attention to drivers' requirements regarding the number and
      type of endpoints a device has.
      
      At the same time, the patch changes the NUM_DONT_CARE constant (which
      is stored in a single-byte field) from -1 to a safer, unsigned value.
      It also improves the kerneldoc for several fields in the
      usb_serial_driver structure.
      
      Finally, the patch replaces a list_for_each() with list_for_each_entry().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      063a2da8
  5. 13 7月, 2007 1 次提交
  6. 17 2月, 2007 1 次提交
    • J
      USB: add flow control to usb-serial generic driver. · 253ca923
      Joris van Rantwijk 提交于
      I added two fields to struct usb_serial_port to keep track of the
      throttle state. Other usb-serial drivers typically use private data for
      such things, but the generic driver can not really do that because some
      of its code is also used by other drivers (which may have their own
      private data needs).
      
      As it is, I am not sure that this patch is useful in all scenarios.
      It is certainly helpful for low-bandwidth devices that can hold their
      data in response to throttling. But for devices that pump data in
      real-time as fast as possible (webcam, A/D converter, etc), throttling
      may actually cause more data loss.
      
      From: Joris van Rantwijk <jorispubl@xs4all.nl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      253ca923
  7. 08 2月, 2007 1 次提交
  8. 09 12月, 2006 1 次提交
    • A
      [PATCH] tty: switch to ktermios · 606d099c
      Alan Cox 提交于
      This is the grungy swap all the occurrences in the right places patch that
      goes with the updates.  At this point we have the same functionality as
      before (except that sgttyb() returns speeds not zero) and are ready to
      begin turning new stuff on providing nobody reports lots of bugs
      
      If you are a tty driver author converting an out of tree driver the only
      impact should be termios->ktermios name changes for the speed/property
      setting functions from your upper layers.
      
      If you are implementing your own TCGETS function before then your driver
      was broken already and its about to get a whole lot more painful for you so
      please fix it 8)
      
      Also fill in c_ispeed/ospeed on init for most devices, although the current
      code will do this for you anyway but I'd like eventually to lose that extra
      paranoia
      
      [akpm@osdl.org: bluetooth fix]
      [mp3@de.ibm.com: sclp fix]
      [mp3@de.ibm.com: warning fix for tty3270]
      [hugh@veritas.com: fix tty_ioctl powerpc build]
      [jdike@addtoit.com: uml: fix ->set_termios declaration]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NMartin Peschke <mp3@de.ibm.com>
      Acked-by: NPeter Oberparleiter <oberpar@de.ibm.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NHugh Dickins <hugh@veritas.com>
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      606d099c
  9. 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
  10. 13 7月, 2006 1 次提交
  11. 01 7月, 2006 1 次提交
  12. 22 6月, 2006 2 次提交
  13. 15 4月, 2006 1 次提交
  14. 05 1月, 2006 1 次提交
    • L
      [PATCH] USB: usbserial: race-condition fix. · 8a4613f0
      Luiz Fernando Capitulino 提交于
      There is a race-condition in usb-serial driver that can be triggered if
      a processes does 'port->tty->driver_data = NULL' in serial_close() while
      other processes is in kernel-space about to call serial_ioctl() on the
      same port.
      
      This happens because a process can open the device while there is
      another one closing it.
      
      The patch below fixes that by adding a semaphore to ensure that no
      process will open the device while another process is closing it.
      
      Note that we can't use spinlocks here, since serial_open() and
      serial_close() can sleep.
      Signed-off-by: NLuiz Capitulino <lcapitulino@mandriva.com.br>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8a4613f0
  15. 29 10月, 2005 4 次提交
  16. 28 6月, 2005 1 次提交
  17. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4