1. 05 10月, 2010 1 次提交
    • A
      drivers: autoconvert trivial BKL users to private mutex · 613655fa
      Arnd Bergmann 提交于
      All these files use the big kernel lock in a trivial
      way to serialize their private file operations,
      typically resulting from an earlier semi-automatic
      pushdown from VFS.
      
      None of these drivers appears to want to lock against
      other code, and they all use the BKL as the top-level
      lock in their file operations, meaning that there
      is no lock-order inversion problem.
      
      Consequently, we can remove the BKL completely,
      replacing it with a per-file mutex in every case.
      Using a scripted approach means we can avoid
      typos.
      
      These drivers do not seem to be under active
      maintainance from my brief investigation. Apologies
      to those maintainers that I have missed.
      
      file=$1
      name=$2
      if grep -q lock_kernel ${file} ; then
          if grep -q 'include.*linux.mutex.h' ${file} ; then
                  sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
          else
                  sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
          fi
          sed -i ${file} \
              -e "/^#include.*linux.mutex.h/,$ {
                      1,/^\(static\|int\|long\)/ {
                           /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
      
      } }"  \
          -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
          -e '/[      ]*cycle_kernel_lock();/d'
      else
          sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                      -e '/cycle_kernel_lock()/d'
      fi
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      613655fa
  2. 16 9月, 2010 1 次提交
    • A
      ipmi: autoconvert trivial BKL users to private mutex · 609146fd
      Arnd Bergmann 提交于
      All these files use the big kernel lock in a trivial
      way to serialize their private file operations,
      typically resulting from an earlier semi-automatic
      pushdown from VFS.
      
      None of these drivers appears to want to lock against
      other code, and they all use the BKL as the top-level
      lock in their file operations, meaning that there
      is no lock-order inversion problem.
      
      Consequently, we can remove the BKL completely,
      replacing it with a per-file mutex in every case.
      Using a scripted approach means we can avoid
      typos.
      
      file=$1
      name=$2
      if grep -q lock_kernel ${file} ; then
          if grep -q 'include.*linux.mutex.h' ${file} ; then
                  sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
          else
                  sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
          fi
          sed -i ${file} \
              -e "/^#include.*linux.mutex.h/,$ {
                      1,/^\(static\|int\|long\)/ {
                           /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
      
      } }"  \
          -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
          -e '/[      ]*cycle_kernel_lock();/d'
      else
          sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                      -e '/cycle_kernel_lock()/d'
      fi
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NCorey Minyard <cminyard@mvista.com>
      Cc: openipmi-developer@lists.sourceforge.net
      609146fd
  3. 07 9月, 2010 5 次提交
  4. 04 9月, 2010 2 次提交
    • N
      tty: fix tty_line must not be equal to number of allocated tty pointers in tty driver · 6eb68d6f
      Nathael Pajani 提交于
      I found a bug "by chance" in drivers/char/tty_io.c
      
      I mean "by chance" because I was just reading the code of the
      tty_find_polling_driver() to make a new tty_find_by_name() function.
      
      In tty_find_polling_driver() the driver actually test "tty_line <=
      p->num" while num refers to the number of struct tty_struct pointers
      allocated for the p->ttys (p is a tty_driver), and tty_line is scanned
      in a tty name, which can be for example ttyS2. Then tty_line equals 2.
      And if p->num is 2, we have only p->ttys[0] and p->ttys[1], but no
      p->ttys[2].
      
      This is actually unharmful, for tty_find_polling_driver() is used only
      in drivers/serial/kgdboc.c, and there's a test over there to find a
      console with a matching index, which will never happen.
      
      This is still a bug anyway.
      Signed-off-by: NNathael Pajani <nathael.pajani@ed3l.fr>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6eb68d6f
    • F
      vt: Fix console corruption on driver hand-over. · 9fc2b2d0
      Francisco Jerez 提交于
      After 02f0777a "vc_origin" is no
      longer reset to the screen buffer before calling the con_init() hook
      of the new console driver.
      
      If the old driver wasn't using a fixed scanout buffer (e.g. the case
      of vgacon) "vc_origin" may be a pointer to a VRAM location, and its
      contents aren't guaranteed to be preserved after calling con_deinit()
      on the old driver and con_init() on the new driver, i.e. the
      subsequent console resize may fill the framebuffer with garbage.
      
      It can be reproduced in the transition from vgacon to the nouveau
      framebuffer driver: in that case the legacy VGA aperture "vc_origin"
      points to becomes unreadable after fbcon_init().
      
      This patch reverts the mentioned commit. To avoid the problem it
      intended to fix, stop using "vc_scr_end" in vc_do_resize() to
      calculate how many rows we have to copy (actually the code looks
      simpler this way without the help of "vc_scr_end").
      Signed-off-by: NFrancisco Jerez <currojerez@riseup.net>
      Cc: qiaochong <qiaochong@loongson.cn>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Alan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9fc2b2d0
  5. 29 8月, 2010 1 次提交
    • A
      Input: use PIT_TICK_RATE in vt beep ioctl · 2c4e9671
      Arnd Bergmann 提交于
      The KIOCSOUND and KDMKTONE ioctls are based on the CLOCK_TICK_RATE,
      which is architecture and sometimes configuration specific.
      
      In practice, most user applications assume that it is actually defined
      as the i8253 PIT base clock of 1193182 Hz, which is true on some
      architectures but not on others.
      
      This patch makes the vt code use the PIT frequency on all
      architectures, which is much more well-defined.  It will change the
      behavior of user applications sending the beep ioctl on all
      architectures that define CLOCK_TICK_RATE different from
      PIT_TICK_RATE.
      
      The original breakage was introduced in commit bcc8ca09 "Adapt
      drivers/char/vt_ioctl.c to non-x86".  Hopefully, reverting this change
      will make the frequency correct in more cases than it will make it
      incorrect.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
      2c4e9671
  6. 24 8月, 2010 4 次提交
  7. 22 8月, 2010 2 次提交
  8. 21 8月, 2010 1 次提交
  9. 20 8月, 2010 1 次提交
  10. 18 8月, 2010 2 次提交
    • N
      tty: fix fu_list abuse · d996b62a
      Nick Piggin 提交于
      tty: fix fu_list abuse
      
      tty code abuses fu_list, which causes a bug in remount,ro handling.
      
      If a tty device node is opened on a filesystem, then the last link to the inode
      removed, the filesystem will be allowed to be remounted readonly. This is
      because fs_may_remount_ro does not find the 0 link tty inode on the file sb
      list (because the tty code incorrectly removed it to use for its own purpose).
      This can result in a filesystem with errors after it is marked "clean".
      
      Taking idea from Christoph's initial patch, allocate a tty private struct
      at file->private_data and put our required list fields in there, linking
      file and tty. This makes tty nodes behave the same way as other device nodes
      and avoid meddling with the vfs, and avoids this bug.
      
      The error handling is not trivial in the tty code, so for this bugfix, I take
      the simple approach of using __GFP_NOFAIL and don't worry about memory errors.
      This is not a problem because our allocator doesn't fail small allocs as a rule
      anyway. So proper error handling is left as an exercise for tty hackers.
      
      [ Arguably filesystem's device inode would ideally be divorced from the
      driver's pseudo inode when it is opened, but in practice it's not clear whether
      that will ever be worth implementing. ]
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d996b62a
    • N
      fs: cleanup files_lock locking · ee2ffa0d
      Nick Piggin 提交于
      fs: cleanup files_lock locking
      
      Lock tty_files with a new spinlock, tty_files_lock; provide helpers to
      manipulate the per-sb files list; unexport the files_lock spinlock.
      
      Cc: linux-kernel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ee2ffa0d
  11. 17 8月, 2010 3 次提交
    • G
      of: Fix missing includes · f1ca09b2
      Grant Likely 提交于
      This patch fixes missing includes from a number of .c files because
      the code (wrongfully) depended on prom.h including them.  The include
      of linux/of_address.h was removed in microblaze prom.h in commit
      "of/address: Clean up function declarations" (sha1 id 22ae782f), but
      not fixed in some callers.  This patch fixes them up.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Tested-by: NMichal Simek <monstr@monstr.eu>
      f1ca09b2
    • J
      vt,console,kdb: preserve console_blanked while in kdb · beed5336
      Jason Wessel 提交于
      Commit b45cfba4 (vt,console,kdb:
      implement atomic console enter/leave functions) introduced the ability
      to atomically change the console mode with kernel mode setting but did
      not preserve the state of the console_blanked variable.
      
      The console_blanked variable must be restored when executing the
      con_debug_leave() or further kernel mode set changes (such as using
      chvt X) will fail to correctly set the state of console.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      CC: Andrew Morton <akpm@linux-foundation.org>
      beed5336
    • J
      vt: fix regression warnings from KMS merge · fed891c8
      Jason Wessel 提交于
      Fix the following new sparse warnings in vt.c introduced by the commit
      b45cfba4 (vt,console,kdb: implement
      atomic console enter/leave functions):
      
      drivers/char/vt.c:197:5: warning: symbol 'saved_fg_console' was not declared. Should it be static?
      drivers/char/vt.c:198:5: warning: symbol 'saved_last_console' was not declared. Should it be static?
      drivers/char/vt.c:199:5: warning: symbol 'saved_want_console' was not declared. Should it be static?
      drivers/char/vt.c:200:5: warning: symbol 'saved_vc_mode' was not declared. Should it be static?
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      CC: Andrew Morton <akpm@linux-foundation.org>
      fed891c8
  12. 12 8月, 2010 1 次提交
  13. 11 8月, 2010 16 次提交
    • S
      kfifo: fix kfifo miss use of nozami.c · 4457d984
      Stefani Seibold 提交于
      There are different types of a fifo which can not handled in C without a
      lot of overhead.  So i decided to write the API as a set of macros, which
      is the only way to do a kind of template meta programming without C++.
      This macros handles the different types of fifos in a transparent way.
      
      There are a lot of benefits:
      
      - Compile time handling of the different fifo types
      - Better performance (a save put or get of an integer does only generate
        9 assembly instructions on a x86)
      - Type save
      - Cleaner interface, the additional kfifo_..._rec() functions are gone
      - Easier to use
      - Less error prone
      - Different types of fifos: it is now possible to define a int fifo or
        any other type. See below for an example.
      - Smaller footprint for none byte type fifos
      - No need of creating a second hidden variable, like in the old DEFINE_KFIFO
      
      The API was not changed.
      
      There are now real in place fifos where the data space is a part of the
      structure.  The fifo needs now 20 byte plus the fifo space.  Dynamic
      assigned or allocated create a little bit more code.
      
      Most of the macros code will be optimized away and simple generate a
      function call.  Only the really small one generates inline code.
      
      Additionally you can now create fifos for any data type, not only the
      "unsigned char" byte streamed fifos.
      
      There is also a new kfifo_put and kfifo_get function, to handle a single
      element in a fifo.  This macros generates inline code, which is lit bit
      larger but faster.
      
      I know that this kind of macros are very sophisticated and not easy to
      maintain.  But i have all tested and it works as expected.  I analyzed the
      output of the compiler and for the x86 the code is as good as hand written
      assembler code.  For the byte stream fifo the generate code is exact the
      same as with the current kfifo implementation.  For all other types of
      fifos the code is smaller before, because the interface is easier to use.
      
      The main goal was to provide an API which is very intuitive, save and easy
      to use.  So linux will get now a powerful fifo API which provides all what
      a developer needs.  This will save in the future a lot of kernel space,
      since there is no need to write an own implementation.  Most of the device
      driver developers need a fifo, and also deep kernel development will gain
      benefit from this API.
      
      Here are the results of the text section usage:
      
      Example 1:
                              kfifo_put/_get  kfifo_in/out    current kfifo
      dynamic allocated       0x000002a8      0x00000291      0x00000299
      in place                0x00000291      0x0000026e      0x00000273
      
      kfifo.c                 new             old
      text section size       0x00000be5      0x000008b2
      
      As you can see, kfifo_put/kfifo_get creates a little bit more code than
      kfifo_in/kfifo_out, but it is much faster (the code is inline).
      
      The code is complete hand crafted and optimized.  The text section size is
      as small as possible.  You get all the fifo handling in only 3 kb.  This
      includes type safe fix size records, dynamic records and DMA handling.
      
      This should be the final version. All requested features are implemented.
      
      Note: Most features of this API doesn't have any users.  All functions
      which are not used in the next 9 months will be removed.  So, please adapt
      your drivers and other sources as soon as possible to the new API and post
      it.
      
      This are the features which are currently not used in the kernel:
      
      kfifo_to_user()
      kfifo_from_user()
      kfifo_dma_....() macros
      kfifo_esize()
      kfifo_recsize()
      kfifo_put()
      kfifo_get()
      
      The fixed size record elements, exclude "unsigned char" fifo's and the
      variable size records fifo's
      
      This patch:
      
      User of the kernel fifo should never bypass the API and directly access
      the fifo structure.  Otherwise it will be very hard to maintain the API.
      Signed-off-by: NStefani Seibold <stefani@seibold.net>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4457d984
    • J
      drivers/char/n_gsm.c: add missing spin_unlock_irqrestore · e73790a5
      Julia Lawall 提交于
      Add a spin_unlock_irqrestore missing on the error path.  Converting the
      return to break leads to the spin_unlock_irqrestore at the end of the
      function.
      
      The semantic match that finds this problem is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression E1;
      @@
      
      * spin_lock_irqsave(E1,...);
        <+... when != E1
        if (...) {
          ... when != E1
      *   return ...;
        }
        ...+>
      * spin_unlock_irqrestore(E1,...);
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Alan Cox <alan@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e73790a5
    • Y
      ipmi: print info for spmi and smbios paths like acpi and pci · 7bb671e3
      Yinghai Lu 提交于
      Print out the reg spacing and size for spmi and smbios so BIOS developers
      can make them consistent.
      
      Also remove extra PFX on the duplicating path.
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Matthew Garrett <mjg@redhat.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Myron Stowe <myron.stowe@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7bb671e3
    • Y
      ipmi: fix memleaking for add_smi when duplicating happen · 7faefea6
      Yinghai Lu 提交于
      Free the temporary info struct when we have duplicated ones.
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Matthew Garrett <mjg@redhat.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Myron Stowe <myron.stowe@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7faefea6
    • J
      drivers/char/ipmi/ipmi_si_intf.c: fix warning: variable 'addr_space' set but not used · f46c77c2
      Justin P. Mattock 提交于
      Fix a warning message generated by GCC, and also updates a web address
      pointing to a pdf containing information.
      
      CC [M]  drivers/char/ipmi/ipmi_si_intf.o
      drivers/char/ipmi/ipmi_si_intf.c: In function 'try_init_spmi':
      drivers/char/ipmi/ipmi_si_intf.c:2016:8: warning: variable 'addr_space' set but not used
      Signed-off-by: NSergey V. <sftp.mtuci@gmail.com>
      Signed-off-by: NJustin P. Mattock <justinmattock@gmail.com>
      Acked-by: NCorey Minyard <minyard@acm.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f46c77c2
    • R
      param: update drivers/char/ipmi/ipmi_watchdog.c to new scheme · c8ba6c52
      Rusty Russell 提交于
      This is one of the most interesting users of module parameters in the
      tree, so weaning it off the old-style non-const module_param_call
      scheme is a useful exercise.
      
      I was confused by set_param_int/get_param_int (vs. the normal
      param_set_int and param_get_int), so I renamed set_param_int to
      set_param_timeout, and re-used param_get_int directly instead of
      get_param_int.  I also implemented param_check_wdog_ifnum and
      param_check_timeout, so now the ifnum_to_use and timeout/pretimeout
      parameters can just use plain module_param().
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: openipmi-developer@lists.sourceforge.net
      c8ba6c52
    • S
      Add param ops struct for hvc_iucv driver. · 549a8a03
      Sachin Sant 提交于
      Today's next 20091117 build failed on s390 with
      
      drivers/char/hvc_iucv.c:1331: error: 'param_ops_vmidfilter' undeclared here (not in a function)
      make[2]: *** [drivers/char/hvc_iucv.o] Error 1
      
      Most probably caused by commit 684a6d340b8a5767db4670031b0f39455346018a
      (param:param_ops) which introduced a param_ops structure.
      
      The following compile tested patch adds a param_ops structure for hvc_iucv.
      Signed-off-by: NSachin Sant <sachinp@in.ibm.com>
      Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Tested-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      549a8a03
    • J
      Char: nozomi, set tty->driver_data appropriately · bf9c1fca
      Jiri Slaby 提交于
      Sorry, one more fix, this one depends on the other, so this is rather 2/2.
      --
      
      tty->driver_data is used all over the code, but never set. This
      results in oopses like:
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000130
      IP: [<ffffffff814a0040>] mutex_lock+0x10/0x40
      ...
      Pid: 2157, comm: modem-manager Not tainted 2.6.34.1-0.1-desktop #1 2768DR7/2768DR7
      RIP: 0010:[<ffffffff814a0040>]  [<ffffffff814a0040>] mutex_lock+0x10/0x40
      RSP: 0018:ffff88007b16fa50  EFLAGS: 00010286
      RAX: 0000000000000000 RBX: 0000000000000130 RCX: 0000000000000003
      RDX: 0000000000000003 RSI: 0000000000000286 RDI: 0000000000000130
      RBP: 0000000000001000 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000130
      R13: 0000000000000001 R14: 0000000000000000 R15: ffff88007b16feb4
      ...
      Call Trace:
       [<ffffffffa077690d>] ntty_write_room+0x4d/0x90 [nozomi]
      ...
      
      Set tty->driver_data to the computed port in .install to not recompute it in
      every place where needed. Switch .open to use driver_data too.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: stable <stable@kernel.org> [.34, .35]
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      bf9c1fca
    • J
      Char: nozomi, fix tty->count counting · ee78bb95
      Jiri Slaby 提交于
      Currently ntty_install omits to increment tty count and we get the
      following warnings:
      Warning: dev (noz2) tty->count(0) != #fd's(1) in tty_open
      
      So to fix that, add one tty->count++ there.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: stable <stable@kernel.org> [.34, .35]
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ee78bb95
    • K
      mxser: remove unnesesary NULL check · 464eb8f5
      Kulikov Vasiliy 提交于
      mxser_transmit_chars(tty, port) is called only from mxser_interrupt().
      NULL check is performed in mxser_interrupt() so it is redundant here.
      Signed-off-by: NKulikov Vasiliy <segooon@gmail.com>
      Acked-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      464eb8f5
    • K
      tty_io: remove casts from void* · 2b50d247
      Kulikov Vasiliy 提交于
      Remove unnesessary casts from void*.
      Signed-off-by: NKulikov Vasiliy <segooon@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2b50d247
    • A
      tty: avoid recursive BTM in pty_close · 11dbf203
      Arnd Bergmann 提交于
      When the console has been redirected, a hangup of the tty
      will cause tty_release to be called under the big tty_mutex,
      which leads to a deadlock because hangup is also called
      under the BTM.
      
      This moves the BTM deeper into the tty_hangup function so
      we can close the redirected tty without holding the BTM.
      In case of pty, we now need to drop the BTM before
      calling tty_vhangup.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      11dbf203
    • A
      tty: release BTM while sleeping in block_til_ready · e142a31d
      Arnd Bergmann 提交于
      Most tty drivers may block while opening a device.
      Since this possibly depends on another thread
      closing it first and both threads may need the BTM,
      we need to release it here.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e142a31d
    • A
      tty: implement BTM as mutex instead of BKL · b07471fa
      Arnd Bergmann 提交于
      The tty locking now follows the rules for mutexes, so
      we can replace the BKL usage with a new subsystem
      wide mutex.
      
      Using a regular mutex here will change the behaviour
      when blocked on the BTM from spinning to sleeping,
      but that should not be visible to the user.
      
      Using the mutex also means that all the BTM is now
      covered by lockdep.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b07471fa
    • A
      tty: remove tty_lock_nested · ddcd9fb6
      Arnd Bergmann 提交于
      This changes all remaining users of tty_lock_nested
      to be non-recursive, which lets us kill this function.
      As a consequence, we won't need to keep the lock count
      any more, which allows more simplifications later.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ddcd9fb6
    • A
      tty: untangle locking of wait_until_sent · 20365219
      Arnd Bergmann 提交于
      Some wait_until_sent versions require the big
      tty mutex, others don't and some callers of
      wait_until_sent already hold it while other don't.
      That leads to recursive use of the BTM in these
      functions, which we're trying to get rid of.
      
      This turns all cleans up the locking there so
      that the driver's wait_until_sent function
      never takes the BTM itself if it is already
      called with that lock held.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      20365219