linux/drivers/tty
Linus Torvalds adf96e6f51 sysrq: don't depend on weak undefined arrays to have an address that compares as NULL
When taking an address of an extern array, gcc quite naturally should be
able to say "an address of an object can never be NULL" and just
optimize away the test entirely.

However, the new alternate sysrq reset code (commit 154b7a489a5b:
"Input: sysrq - allow specifying alternate reset sequence") did exactly
that, and declared platform_sysrq_reset_seq[] as a weak array, and
expecting that testing the address of the array would show whether it
actually got linked against something or not.

And that doesn't work with all gcc versions.  Clearly it works with
*some* versions of gcc, and maybe it's even supposed to work, but it
really is a very fragile concept.

So instead of testing the address of the weak variable, just create a
weak instance of that array that is empty.  If some platform then has a
real platform_sysrq_reset_seq[] that overrides our weak one, the linker
will switch to that one, and it all works without any run-time
conditionals at all.

Reported-by: Dave Airlie <airlied@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 09:59:50 -08:00
..
hvc Features: 2013-02-24 16:18:31 -08:00
ipwireless Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
serial tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
vt Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
Kconfig tty: metag_da: Add metag DA TTY driver 2013-02-06 11:10:17 -08:00
Makefile tty: metag_da: Add metag DA TTY driver 2013-02-06 11:10:17 -08:00
amiserial.c tty: Remove ancient hardpps() 2013-02-13 10:17:06 -08:00
bfin_jtag_comm.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
cyclades.c cyclades: push down tty_port_tty_get 2013-01-15 22:43:15 -08:00
ehv_bytechan.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
goldfish.c goldfish: move to tty_port for flip buffers 2013-01-25 08:09:38 -08:00
isicom.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
metag_da.c tty: metag_da: avoid getting tty kref in dashtty_timer() 2013-02-06 11:10:17 -08:00
moxa.c TTY: switch tty_schedule_flip 2013-01-15 22:43:15 -08:00
moxa.h
mxser.c tty: mxser: improve error handling in mxser_probe() and mxser_module_init() 2013-02-18 11:05:14 -08:00
mxser.h
n_gsm.c tty: Prevent deadlock in n_gsm driver 2013-01-30 12:10:09 +01:00
n_hdlc.c
n_r3964.c tty: localise the lock 2012-08-10 12:55:47 -07:00
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c pps: Move timestamp read into PPS code proper 2013-02-13 10:13:58 -08:00
nozomi.c TTY: nozomi, remove dead code 2013-01-15 22:43:16 -08:00
pty.c pty: Ignore slave open count for master pty open 2013-02-04 15:40:29 -08:00
rocket.c tty: rocket: Explicitly list supported PCI IDs 2013-01-17 17:28:39 -08:00
rocket.h
rocket_int.h
synclink.c TTY: synclink: Convert + to | for bit operations 2013-01-30 00:09:58 -05:00
synclink_gt.c TTY: synclink: Convert + to | for bit operations 2013-01-30 00:09:58 -05:00
synclinkmp.c TTY: synclink: Convert + to | for bit operations 2013-01-30 00:09:58 -05:00
sysrq.c sysrq: don't depend on weak undefined arrays to have an address that compares as NULL 2013-02-27 09:59:50 -08:00
tty_audit.c TTY: audit, stop accessing tty->icount 2012-10-22 16:50:54 -07:00
tty_buffer.c pps: Move timestamp read into PPS code proper 2013-02-13 10:13:58 -08:00
tty_io.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
tty_ioctl.c tty: set_termios/set_termiox should not return -EINTR 2013-02-04 15:02:14 -08:00
tty_ldisc.c tty: don't deadlock while flushing workqueue 2013-01-15 23:07:15 -08:00
tty_mutex.c tty: tty_mutex.c: Fixed coding style warning (using printk) 2012-10-24 11:34:51 -07:00
tty_port.c TTY: introduce tty_port_destroy 2012-11-15 17:20:58 -08:00