aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2010-08-10timbuart: use __devinit and __devexit macros for probe and removeRichard Röjfors1-3/+3
Move the probe and remove functions to the devinit and devexit sections. Signed-off-by: Richard Röjfors <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: MMIO32 support for 8250_early.cSamium Gromoff2-15/+45
Provide MMIO32 support in 8250_early (aka earlycon) [[email protected]: fix printk format warnings] [[email protected]: fix printk args some more] Signed-off-by: Samium Gromoff <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: mcf: don't take spinlocks in already protected functionsYury Georgievskiy1-18/+13
Don't take the port spinlock in uart functions where the serial core already takes care of locking/unlocking them. The code would actually lock up on architectures where spinlocks are implemented. Also protect calling mcf_rx_chars/mcf_tx_chars in the interrupt handler by the port spinlock and use IRQ_RETVAL to return from isr. [[email protected]: make irq-handler return value more explicit] Signed-off-by: Yury Georgievskiy <[email protected]> Cc: Alan Cox <[email protected]> Acked-by: Greg Ungerer <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: general fixes in the serial_rs485 structureClaudio Scordino2-4/+11
Fix several issues related to the RS485 interface: - It adds the flag SER_RS485_RTS_BEFORE_SEND that was missing from the serial_rs485 structure (even if "delay_rts_before_send" was existing) - It adds a further "delay_rts_after_send" field for those drivers that can have a delay after send (e.g., atmel_serial) - It fixes the usage of the structure in the atmel_serial driver (where "delay_rts_before_send" should be used instead of "delay_rts_after_send"). Signed-off-by: Claudio Scordino <[email protected]> Signed-off-by: Bernhard Roth <[email protected]> Cc: Philippe De Muyter <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: fix missing bit coverage of ASYNC_FLAGSJohn Villalovos1-1/+1
It seems that currently ASYNC_FLAGS is one bit short of covering all the bits of the ASYNC user flags. In particular it does not cover the ASYNC_AUTOPROBE bit. ASYNCB_LAST_USER and ASYNCB_AUTOPROBE are both equal to 15. Therefore: ASYNC_AUTOPROBE = 1000 0000 0000 0000 ASYNC_FLAGS = 0111 1111 1111 1111 So ASYNC_FLAGS is not covering the ASYNC_AUTOPROBE bit. This patch fixes the issue and with the patch the values will be: ASYNC_AUTOPROBE = 1000 0000 0000 0000 ASYNC_FLAGS = 1111 1111 1111 1111 As a side note, doing a "git grep" I didn't find any use of ASYNC_AUTOPROBE or ASYNCB_AUTOPROBE in the kernel, besides this include file. Signed-off-by: John Villalovos <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: "altera_uart: simplify altera_uart_console_putc()" checkpatch fixesAndrew Morton1-1/+1
ERROR: code indent should use tabs where possible #32: FILE: drivers/serial/altera_uart.c:397: +^I ALTERA_UART_STATUS_TRDY_MSK))$ total: 1 errors, 0 warnings, 39 lines checked ./patches/altera_uart-simplify-altera_uart_console_putc.patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches This fix got lost when someone merged "altera_uart: simplify altera_uart_console_putc()". Please don't lose fixes. Please don't write of mere patches which have trivial checkpatch errors. Cc: Tobias Klauser <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: crisv10: formatting of pointers in printk()Kulikov Vasiliy1-2/+2
Use %p instead of %08x in printk(). Signed-off-by: Kulikov Vasiliy <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10vt: Fix warning: statement with no effect due to vt_kern.hKevin Winchester1-11/+46
Using: gcc (GCC) 4.5.0 20100610 (prerelease) with CONFIG_CONSOLE_TRANSLATIONS=n, the following warnings are seen: drivers/char/vt_ioctl.c: In function ‘vt_ioctl’: drivers/char/vt_ioctl.c:1309:4: warning: statement with no effect drivers/char/vt.c: In function ‘vc_allocate’: drivers/char/vt.c:774:3: warning: statement with no effect drivers/video/console/vgacon.c: In function ‘vgacon_init’: drivers/video/console/vgacon.c:587:3: warning: statement with no effect drivers/video/console/vgacon.c: In function ‘vgacon_deinit’: drivers/video/console/vgacon.c:606:2: warning: statement with no effect drivers/video/console/fbcon.c: In function ‘fbcon_init’: drivers/video/console/fbcon.c:1087:3: warning: statement with no effect drivers/video/console/fbcon.c:1089:3: warning: statement with no effect drivers/video/console/fbcon.c: In function ‘fbcon_set_disp’: drivers/video/console/fbcon.c:1369:3: warning: statement with no effect drivers/video/console/fbcon.c:1371:3: warning: statement with no effect This is because several functions in include/linux/vt_kern.h are defined to (0). Convert them to static inline functions to silence the warnings and gain a bit of type safety. Signed-off-by: Kevin Winchester <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty_io: remove casts from void*Kulikov Vasiliy1-6/+6
Remove unnesessary casts from void*. Signed-off-by: Kulikov Vasiliy <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: max3107: Abstract out the platform specific bitsAlan Cox6-337/+531
At the moment there is only one platform type supported and there is is hard wired, but with these changes the infrastructure is now there for anyone else to provide methods for their hardware. Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: max3107: introduce a max3107 driverjianwei.yang4-0/+1809
This device is used by some of the Intel MID platforms. It's not similar enough to the MAX3100 to use the same driver. At this point the driver is specific to the platform and not generalised. We will fix that later. Signed-off-by: jianwei.yang <[email protected]> Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: avoid recursive BTM in pty_closeArnd Bergmann2-13/+15
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: Arnd Bergmann <[email protected]> Acked-by: Alan Cox <[email protected]> Cc: Tony Luck <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Andrew Morton <[email protected]> Cc: John Kacur <[email protected]> Cc: Al Viro <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-108250: fix set_ldisc operationArnd Bergmann1-7/+2
The ldisc number now gets passed into ->set_ldisc. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: release BTM while sleeping in block_til_readyArnd Bergmann11-1/+25
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: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: implement BTM as mutex instead of BKLArnd Bergmann3-13/+53
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: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: remove tty_lock_nestedArnd Bergmann5-41/+25
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: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: untangle locking of wait_until_sentArnd Bergmann4-15/+31
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: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: reorder ldisc lockingArnd Bergmann2-6/+27
We need to release the BTM in paste_selection() when sleeping in tty_ldisc_ref_wait to avoid deadlocks with tty_ldisc_enable. In tty_set_ldisc, we now always grab the BTM before taking the ldisc_mutex in order to avoid AB-BA deadlocks between the two. tty_ldisc_halt potentially blocks on a workqueue function that takes the BTM, so we must release the BTM before calling it. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: introduce wait_event_interruptible_ttyArnd Bergmann7-10/+59
Calling wait_event_interruptible implicitly releases the BKL when it sleeps, but we need to do this explcitly when we have converted it to a mutex. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10cdc-acm: remove dead codeArnd Bergmann1-9/+3
The wait_event_interruptible_timeout in acm_port_down is never reached. Remove it to avoid possible deadlocks with the big tty mutex if someone were to start using the blocking version of acm_port_down. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: fix console_sem lock orderArnd Bergmann1-2/+0
vgacon_do_font_op releases and reacquires the BTM while holding console_sem. This violates the rule that BTM has to be the outer lock whenever we hold both. There does not seem to be any reason to give up the BTM here, so just stop doing that. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: never hold BTM while getting tty_mutexArnd Bergmann2-19/+17
tty_mutex is never taken with the BTM held, except for two corner cases that are worked around here. We give up the BTM before calling tty_release() in the error path of tty_open(). Similarly, we reorder the locking in ptmx_open() to get tty_mutex before the BTM. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: replace BKL with a new tty_lockArnd Bergmann17-115/+161
As a preparation for replacing the big kernel lock in the TTY layer, wrap all the callers in new macros tty_lock, tty_lock_nested and tty_unlock. Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: fix termios settings in openArnd Bergmann1-10/+9
Move termios initialization in open into uart_dtr_rts to make sure it always gets called when necessary. Based on a suggestion from Alan Cox. Alan writes: Ok this sort of makes sense. Something isn't getting initialised and both getty and minicom will do a termios set which is sorting it out. This is occurring because the generic block_til_ready sets ASYNCB_NORMAL_ACTIVE so the termios updating gets skipped. This patch should cure it and then we can think about doing it more elegantly by getting the serial layer to use tty_port_open, kfifo and the like and removing the tons of repeated crap in all the drivers. Signed-off-by: Arnd Bergmann <[email protected]> Reported-by: Tony Luck <[email protected]> Cc: Alan Cox <[email protected]> Cc: Tony Luck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: Use block_til_ready helperAlan Cox1-86/+1
Our code now rather closely resembles the helper, so switch to it. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: trim locking on the helpersAlan Cox1-4/+1
The port mutex protects port->tty, but these paths never need to walk from port->tty. They do need the low level lock as the API expects that but they already also take it. Thus we can drop the extra mutex lock calls here. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: add port helpersAlan Cox1-14/+37
We can make this the same as the ones that will be needed by the tty_port helper logic that we want to move to but still call them from the existing code base. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: Change the wait for carrier lockingAlan Cox1-9/+35
We want to push the lock/unlock into the helper functions so that we can prepare to move to using the tty_port helper. The expansion initially comes out a bit ugly but its worth the temporary expansion IMHO just so we can produce a nice testable series of changes. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: Move the vt_tty field from the vc_data into the standard tty_portAlan Cox4-12/+11
This takes all the tty references through the expected interface points so we can refcount them. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: Make vt's have a tty_portAlan Cox2-0/+4
The vt layer isn't safely handling reference counts to tty object on the input side. Add a tty port structure to the vt layer in order to implement this using the standard helpers. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10vc: Locking clean upAlan Cox2-3/+8
The virtual console layer uses the BKL for various things that don't really need it. Clean them out. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: serial - fix tty referencing in set_ldiscAlan Cox3-7/+4
Pass down the ldisc number so that the drivers don't have to peek into the tty object themselves. This lets us get rid of another case of back referencing port to tty which we don't want (because of races versus hangup/close). Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: serial - fix tty back references in termiosAlan Cox5-26/+19
One or two drivers go poking back into the tty from the termios setting routine in unsafe ways. We don't need to pass the tty down because the [ab]users are just using it to get at things they can get at anyway. This leaves low_latency setting to sort out along with set_ldisc use. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: serial - fix various misuses/mishandlings of port->ttyAlan Cox1-49/+60
Make it robust against hang up events. In most cases we can do this simply by passing the right things in the first place. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10synclink: reworking locking a bitAlan Cox2-2/+19
Use the port mutex and port lock to fix the various races. The locking still isn't totally consistent but its better than before. Wants switching to the port helpers. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: Fix the digi acceleport driver NULL checksAlan Cox1-5/+9
This now refcounts but doesn't actually check the reference was obtained in all the places it should. Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10specialix: Kill the BKLAlan Cox1-6/+5
Use the port mutex instead Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10epca: Kill the big kernel lockAlan Cox1-3/+1
The lock is no longer needed for wait until sent paths so this can go Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10cyclades: Kill off BKL usageAlan Cox1-11/+9
Use the port mutext for config setting, the rest is locked sufficiently anyway that the BKL makes no odds. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10synclink: kill the big kernel lockAlan Cox3-73/+56
We don't need it while waiting and we can lock the ioctls using the port mutex. While at it eliminate use of the hangup mutex and switch to the port mutex. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10rocket: kill BKLAlan Cox1-9/+19
We can use the port mutex for this and also for the hangup path so removing the problematic use of the hangup mutex in this driver. Fix up the locking on the various port flags while we are at it. Ultimately this driver needs to be using tty_port_ helpers which would sort this out far better. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10isicom: kill off the BKLAlan Cox1-8/+5
As with the others we can use the port mutex to get the needed locking properties and fix the race with open. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10riscom8: kill use of lock_kernelAlan Cox1-6/+8
The riscom8 board uses lock_kernel to protect bits of the port setting ioctl logic. We can use the port mutex for this as the logic is internal and will also lock set versus open (a locking property that has been lost somewhere along the way) Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10istallion: use bit ops for the board flagsAlan Cox2-19/+19
This lets us avoid problems with races on the flag changes Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10stallion: prune lock_kernel callsAlan Cox2-17/+25
Remove unneeded tty layer lock kernel bits. Relock the needed bits using the port mutex. The istallion still has brd state races but those are not new or introduced by the removal of the lock_kernel logic. Signed-off-by: Alan Cox <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10vt/console: try harder to print output when panicingJesse Barnes8-9/+27
Jesse's initial patch commit said: "At panic time (i.e. when oops_in_progress is set) we should try a bit harder to update the screen and make sure output gets to the VT, since some drivers are capable of flipping back to it. So make sure we try to unblank and update the display if called from a panic context." I've enhanced this to add a flag to the vc that console layer can set to indicate they want this behaviour to occur. This also adds support to fbcon for that flag and adds an fb flag for drivers to indicate they want to use the support. It enables this for KMS drivers. Signed-off-by: Dave Airlie <[email protected]> Signed-off-by: Jesse Barnes <[email protected]> Acked-by: James Simmons <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: Add EXTPROC support for LINEMODE[email protected]39-10/+101
This patch is against the 2.6.34 source. Paraphrased from the 1989 BSD patch by David Borman @ cray.com: These are the changes needed for the kernel to support LINEMODE in the server. There is a new bit in the termios local flag word, EXTPROC. When this bit is set, several aspects of the terminal driver are disabled. Input line editing, character echo, and mapping of signals are all disabled. This allows the telnetd to turn off these functions when in linemode, but still keep track of what state the user wants the terminal to be in. New ioctl: TIOCSIG Generate a signal to processes in the current process group of the pty. There is a new mode for packet driver, the TIOCPKT_IOCTL bit. When packet mode is turned on in the pty, and the EXTPROC bit is set, then whenever the state of the pty is changed, the next read on the master side of the pty will have the TIOCPKT_IOCTL bit set. This allows the process on the server side of the pty to know when the state of the terminal has changed; it can then issue the appropriate ioctl to retrieve the new state. Since the original BSD patches accompanied the source code for telnet I've left that reference here, but obviously the feature is useful for any remote terminal protocol, including ssh. The corresponding feature has existed in the BSD tty driver since 1989. For historical reference, a good copy of the relevant files can be found here: http://anonsvn.mit.edu/viewvc/krb5/trunk/src/appl/telnet/?pathrev=17741 Signed-off-by: Howard Chu <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: remove remaining Hayes ESP ioctlsGreg Kroah-Hartman8-16/+0
As Jeff Dike pointed out, the Hayes ESP driver was removed in commit f53a2ade0bb9f2a81f473e6469155172a96b7c38, so these ioctl definitions should also be removed. This cleans up the remaining arch-specific locations of this ioctl value. Thanks to Arnd for pointing these out. Cc: Jeff Dike <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10tty: Remove Hayes ESP ioctlsJeff Dike1-4/+2
Remove Hayes ESP ioctls The Hayes ESP driver has been removed from the tree: commit f53a2ade0bb9f2a81f473e6469155172a96b7c38 ("tty: esp: remove broken driver") so its ioctls aren't needed any more. Signed-off-by: Jeff Dike <[email protected]> Acked-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-08-10serial: fix wakup races in the mrst_max3110 driverArjan van de Ven1-28/+18
The mrst_max3110 driver had a set of unsafe wakeup sequences along the following line: if (!atomic_read(&foo)) { atomic_set(&foo, 1); wake_up(worker_thread); } and the worker thread would do if (atomic_read(&foo)) { do_work(); atomic_set(&foo, 0); } which can result in various missed wakups due to test-then-set races, as well as due to clear-after-work instead of clear-before-work. This patch fixes these races by using the proper bit test-and-set operations, and by doing clear-before-work. Signed-off-by: Arjan van de Ven <[email protected]> Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>