Merge remote branch 'rmk/for-linus' into for-linus

* rmk/for-linus: (1557 commits)
  ARM: 6806/1: irq: introduce entry and exit functions for chained handlers
  ARM: 6781/1: Thumb-2: Work around buggy Thumb-2 short branch relocations in gas
  ARM: 6747/1: P2V: Thumb2 support
  ARM: 6798/1: aout-core: zero thread debug registers in a.out core dump
  ARM: 6796/1: Footbridge: Fix I/O mappings for NOMMU mode
  ARM: 6784/1: errata: no automatic Store Buffer drain on Cortex-A9
  ARM: 6772/1: errata: possible fault MMU translations following an ASID switch
  ARM: 6776/1: mach-ux500: activate fix for errata 753970
  ARM: 6794/1: SPEAr: Append UL to device address macros.
  ARM: 6793/1: SPEAr: Remove unused *_SIZE macros from spear*.h files
  ARM: 6792/1: SPEAr: Replace SIZE macro's with SZ_4K macros
  ARM: 6791/1: SPEAr3xx: Declare device structures after shirq code
  ARM: 6790/1: SPEAr: Clock Framework: Rename usbd clock and align apb_clk entry
  ARM: 6789/1: SPEAr3xx: Rename sdio to sdhci
  ARM: 6788/1: SPEAr: Include mach/hardware.h instead of mach/spear.h
  ARM: 6787/1: SPEAr: Reorder #includes in .h & .c files.
  ARM: 6681/1: SPEAr: add debugfs support to clk API
  ARM: 6703/1: SPEAr: update clk API support
  ARM: 6679/1: SPEAr: make clk API functions more generic
  ARM: 6737/1: SPEAr: formalized timer support
  ...

Conflicts:
	arch/arm/mach-msm/board-msm7x27.c
	arch/arm/mach-msm/board-msm7x30.c
	arch/arm/mach-msm/board-qsd8x50.c
	arch/arm/mach-msm/board-sapphire.c
	arch/arm/mach-msm/include/mach/memory.h
This commit is contained in:
David Brown 2011-03-16 22:13:16 -07:00
commit 92c260f755
1728 changed files with 26170 additions and 14144 deletions

View file

@ -10,4 +10,3 @@ obj-$(CONFIG_HVC_XEN) += hvc_xen.o
obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o
obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o
obj-$(CONFIG_HVCS) += hvcs.o
obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o

File diff suppressed because it is too large Load diff

View file

@ -2414,6 +2414,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm,
gsm->initiator = c->initiator;
gsm->mru = c->mru;
gsm->mtu = c->mtu;
gsm->encoding = c->encapsulation;
gsm->adaption = c->adaption;
gsm->n2 = c->n2;

View file

@ -581,8 +581,9 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
__u8 __user *buf, size_t nr)
{
struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
int ret;
int ret = 0;
struct n_hdlc_buf *rbuf;
DECLARE_WAITQUEUE(wait, current);
if (debuglevel >= DEBUG_LEVEL_INFO)
printk("%s(%d)n_hdlc_tty_read() called\n",__FILE__,__LINE__);
@ -598,57 +599,55 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
return -EFAULT;
}
tty_lock();
add_wait_queue(&tty->read_wait, &wait);
for (;;) {
if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
tty_unlock();
return -EIO;
ret = -EIO;
break;
}
if (tty_hung_up_p(file))
break;
n_hdlc = tty2n_hdlc (tty);
if (!n_hdlc || n_hdlc->magic != HDLC_MAGIC ||
tty != n_hdlc->tty) {
tty_unlock();
return 0;
}
set_current_state(TASK_INTERRUPTIBLE);
rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list);
if (rbuf)
if (rbuf) {
if (rbuf->count > nr) {
/* too large for caller's buffer */
ret = -EOVERFLOW;
} else {
if (copy_to_user(buf, rbuf->buf, rbuf->count))
ret = -EFAULT;
else
ret = rbuf->count;
}
if (n_hdlc->rx_free_buf_list.count >
DEFAULT_RX_BUF_COUNT)
kfree(rbuf);
else
n_hdlc_buf_put(&n_hdlc->rx_free_buf_list, rbuf);
break;
}
/* no data */
if (file->f_flags & O_NONBLOCK) {
tty_unlock();
return -EAGAIN;
ret = -EAGAIN;
break;
}
interruptible_sleep_on (&tty->read_wait);
schedule();
if (signal_pending(current)) {
tty_unlock();
return -EINTR;
ret = -EINTR;
break;
}
}
if (rbuf->count > nr)
/* frame too large for caller's buffer (discard frame) */
ret = -EOVERFLOW;
else {
/* Copy the data to the caller's buffer */
if (copy_to_user(buf, rbuf->buf, rbuf->count))
ret = -EFAULT;
else
ret = rbuf->count;
}
/* return HDLC buffer to free list unless the free list */
/* count has exceeded the default value, in which case the */
/* buffer is freed back to the OS to conserve memory */
if (n_hdlc->rx_free_buf_list.count > DEFAULT_RX_BUF_COUNT)
kfree(rbuf);
else
n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,rbuf);
tty_unlock();
remove_wait_queue(&tty->read_wait, &wait);
__set_current_state(TASK_RUNNING);
return ret;
} /* end of n_hdlc_tty_read() */
@ -691,14 +690,15 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
count = maxframe;
}
tty_lock();
add_wait_queue(&tty->write_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
/* Allocate transmit buffer */
/* sleep until transmit buffer available */
while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) {
tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list);
if (tbuf)
break;
if (file->f_flags & O_NONBLOCK) {
error = -EAGAIN;
break;
@ -719,7 +719,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
}
}
set_current_state(TASK_RUNNING);
__set_current_state(TASK_RUNNING);
remove_wait_queue(&tty->write_wait, &wait);
if (!error) {
@ -731,7 +731,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
n_hdlc_buf_put(&n_hdlc->tx_buf_list,tbuf);
n_hdlc_send_frames(n_hdlc,tty);
}
tty_unlock();
return error;
} /* end of n_hdlc_tty_write() */

View file

@ -262,7 +262,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status)
static void receive_chars(struct m68k_serial *info, unsigned short rx)
{
struct tty_struct *tty = info->port.tty;
struct tty_struct *tty = info->tty;
m68328_uart *uart = &uart_addr[info->line];
unsigned char ch, flag;
@ -329,7 +329,7 @@ static void transmit_chars(struct m68k_serial *info)
goto clear_and_return;
}
if((info->xmit_cnt <= 0) || info->port.tty->stopped) {
if((info->xmit_cnt <= 0) || info->tty->stopped) {
/* That's peculiar... TX ints off */
uart->ustcnt &= ~USTCNT_TX_INTR_MASK;
goto clear_and_return;
@ -383,7 +383,7 @@ static void do_softint(struct work_struct *work)
struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue);
struct tty_struct *tty;
tty = info->port.tty;
tty = info->tty;
if (!tty)
return;
#if 0
@ -407,7 +407,7 @@ static void do_serial_hangup(struct work_struct *work)
struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup);
struct tty_struct *tty;
tty = info->port.tty;
tty = info->tty;
if (!tty)
return;
@ -451,8 +451,8 @@ static int startup(struct m68k_serial * info)
uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK;
#endif
if (info->port.tty)
clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
if (info->tty)
clear_bit(TTY_IO_ERROR, &info->tty->flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
/*
@ -486,8 +486,8 @@ static void shutdown(struct m68k_serial * info)
info->xmit_buf = 0;
}
if (info->port.tty)
set_bit(TTY_IO_ERROR, &info->port.tty->flags);
if (info->tty)
set_bit(TTY_IO_ERROR, &info->tty->flags);
info->flags &= ~S_INITIALIZED;
local_irq_restore(flags);
@ -553,9 +553,9 @@ static void change_speed(struct m68k_serial *info)
unsigned cflag;
int i;
if (!info->port.tty || !info->port.tty->termios)
if (!info->tty || !info->tty->termios)
return;
cflag = info->port.tty->termios->c_cflag;
cflag = info->tty->termios->c_cflag;
if (!(port = info->port))
return;
@ -970,7 +970,6 @@ static void send_break(struct m68k_serial * info, unsigned int duration)
static int rs_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg)
{
int error;
struct m68k_serial * info = (struct m68k_serial *)tty->driver_data;
int retval;
@ -1104,7 +1103,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
tty_ldisc_flush(tty);
tty->closing = 0;
info->event = 0;
info->port.tty = NULL;
info->tty = NULL;
#warning "This is not and has never been valid so fix it"
#if 0
if (tty->ldisc.num != ldiscs[N_TTY].num) {
@ -1142,7 +1141,7 @@ void rs_hangup(struct tty_struct *tty)
info->event = 0;
info->count = 0;
info->flags &= ~S_NORMAL_ACTIVE;
info->port.tty = NULL;
info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}
@ -1261,7 +1260,7 @@ int rs_open(struct tty_struct *tty, struct file * filp)
info->count++;
tty->driver_data = info;
info->port.tty = tty;
info->tty = tty;
/*
* Start up serial port
@ -1338,7 +1337,7 @@ rs68328_init(void)
info = &m68k_soft[i];
info->magic = SERIAL_MAGIC;
info->port = (int) &uart_addr[i];
info->port.tty = NULL;
info->tty = NULL;
info->irq = uart_irqs[i];
info->custom_divisor = 16;
info->close_delay = 50;

View file

@ -2428,6 +2428,7 @@ static const struct tty_operations rs_360_ops = {
/* .read_proc = rs_360_read_proc, */
.tiocmget = rs_360_tiocmget,
.tiocmset = rs_360_tiocmset,
.get_icount = rs_360_get_icount,
};
static int __init rs_360_init(void)

View file

@ -236,7 +236,8 @@ static const struct serial8250_config uart_config[] = {
.fifo_size = 128,
.tx_loadsz = 128,
.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
.flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP,
/* UART_CAP_EFR breaks billionon CF bluetooth card. */
.flags = UART_CAP_FIFO | UART_CAP_SLEEP,
},
[PORT_16654] = {
.name = "ST16654",

View file

@ -1518,6 +1518,7 @@ config SERIAL_BCM63XX_CONSOLE
config SERIAL_GRLIB_GAISLER_APBUART
tristate "GRLIB APBUART serial support"
depends on OF
select SERIAL_CORE
---help---
Add support for the GRLIB APBUART serial port.

View file

@ -370,10 +370,8 @@ static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id)
{
struct bfin_serial_port *uart = dev_id;
spin_lock(&uart->port.lock);
while (UART_GET_LSR(uart) & DR)
bfin_serial_rx_chars(uart);
spin_unlock(&uart->port.lock);
return IRQ_HANDLED;
}
@ -490,9 +488,8 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
{
int x_pos, pos;
dma_disable_irq(uart->tx_dma_channel);
dma_disable_irq(uart->rx_dma_channel);
spin_lock_bh(&uart->port.lock);
dma_disable_irq_nosync(uart->rx_dma_channel);
spin_lock_bh(&uart->rx_lock);
/* 2D DMA RX buffer ring is used. Because curr_y_count and
* curr_x_count can't be read as an atomic operation,
@ -523,8 +520,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
}
spin_unlock_bh(&uart->port.lock);
dma_enable_irq(uart->tx_dma_channel);
spin_unlock_bh(&uart->rx_lock);
dma_enable_irq(uart->rx_dma_channel);
mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES);
@ -571,7 +567,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
unsigned short irqstat;
int x_pos, pos;
spin_lock(&uart->port.lock);
spin_lock(&uart->rx_lock);
irqstat = get_dma_curr_irqstat(uart->rx_dma_channel);
clear_dma_irqstat(uart->rx_dma_channel);
@ -589,7 +585,7 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
}
spin_unlock(&uart->port.lock);
spin_unlock(&uart->rx_lock);
return IRQ_HANDLED;
}
@ -1332,6 +1328,7 @@ static int bfin_serial_probe(struct platform_device *pdev)
}
#ifdef CONFIG_SERIAL_BFIN_DMA
spin_lock_init(&uart->rx_lock);
uart->tx_done = 1;
uart->tx_count = 0;

View file

@ -601,7 +601,7 @@ static int max3100_startup(struct uart_port *port)
s->rts = 0;
sprintf(b, "max3100-%d", s->minor);
s->workqueue = create_freezeable_workqueue(b);
s->workqueue = create_freezable_workqueue(b);
if (!s->workqueue) {
dev_warn(&s->spi->dev, "cannot create workqueue\n");
return -EBUSY;

View file

@ -833,7 +833,7 @@ static int max3107_startup(struct uart_port *port)
struct max3107_port *s = container_of(port, struct max3107_port, port);
/* Initialize work queue */
s->workqueue = create_freezeable_workqueue("max3107");
s->workqueue = create_freezable_workqueue("max3107");
if (!s->workqueue) {
dev_err(&s->spi->dev, "Workqueue creation failed\n");
return -EBUSY;

View file

@ -829,7 +829,7 @@ static void __init sbd_probe_duarts(void)
#ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE
/*
* Serial console stuff. Very basic, polling driver for doing serial
* console output. The console_sem is held by the caller, so we
* console output. The console_lock is held by the caller, so we
* shouldn't be interrupted for more console activity.
*/
static void sbd_console_putchar(struct uart_port *uport, int ch)

View file

@ -712,6 +712,7 @@ static struct pcmcia_device_id serial_ids[] = {
PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0e01),
PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0a05),
PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0b05),
PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x1101),
PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070),
PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562),

View file

@ -46,7 +46,7 @@
#include <asm/irq_regs.h>
/* Whether we react on sysrq keys or just ignore them */
static int __read_mostly sysrq_enabled = 1;
static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
static bool __read_mostly sysrq_always_enabled;
static bool sysrq_on(void)
@ -571,6 +571,7 @@ struct sysrq_state {
unsigned int alt_use;
bool active;
bool need_reinject;
bool reinjecting;
};
static void sysrq_reinject_alt_sysrq(struct work_struct *work)
@ -581,6 +582,10 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work)
unsigned int alt_code = sysrq->alt_use;
if (sysrq->need_reinject) {
/* we do not want the assignment to be reordered */
sysrq->reinjecting = true;
mb();
/* Simulate press and release of Alt + SysRq */
input_inject_event(handle, EV_KEY, alt_code, 1);
input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1);
@ -589,6 +594,9 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work)
input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0);
input_inject_event(handle, EV_KEY, alt_code, 0);
input_inject_event(handle, EV_SYN, SYN_REPORT, 1);
mb();
sysrq->reinjecting = false;
}
}
@ -599,6 +607,13 @@ static bool sysrq_filter(struct input_handle *handle,
bool was_active = sysrq->active;
bool suppress;
/*
* Do not filter anything if we are in the process of re-injecting
* Alt+SysRq combination.
*/
if (sysrq->reinjecting)
return false;
switch (type) {
case EV_SYN:
@ -629,7 +644,7 @@ static bool sysrq_filter(struct input_handle *handle,
sysrq->alt_use = sysrq->alt;
/*
* If nothing else will be pressed we'll need
* to * re-inject Alt-SysRq keysroke.
* to re-inject Alt-SysRq keysroke.
*/
sysrq->need_reinject = true;
}

View file

@ -3256,8 +3256,8 @@ static ssize_t show_cons_active(struct device *dev,
struct console *c;
ssize_t count = 0;
acquire_console_sem();
for (c = console_drivers; c; c = c->next) {
console_lock();
for_each_console(c) {
if (!c->device)
continue;
if (!c->write)
@ -3271,7 +3271,7 @@ static ssize_t show_cons_active(struct device *dev,
while (i--)
count += sprintf(buf + count, "%s%d%c",
cs[i]->name, cs[i]->index, i ? ' ':'\n');
release_console_sem();
console_unlock();
return count;
}
@ -3306,7 +3306,7 @@ int __init tty_init(void)
if (IS_ERR(consdev))
consdev = NULL;
else
device_create_file(consdev, &dev_attr_active);
WARN_ON(device_create_file(consdev, &dev_attr_active) < 0);
#ifdef CONFIG_VT
vty_init(&console_fops);

View file

@ -316,9 +316,9 @@ int paste_selection(struct tty_struct *tty)
/* always called with BTM from vt_ioctl */
WARN_ON(!tty_locked());
acquire_console_sem();
console_lock();
poke_blanked_console();
release_console_sem();
console_unlock();
ld = tty_ldisc_ref(tty);
if (!ld) {

View file

@ -202,7 +202,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
/* Select the proper current console and verify
* sanity of the situation under the console lock.
*/
acquire_console_sem();
console_lock();
attr = (currcons & 128);
currcons = (currcons & 127);
@ -336,9 +336,9 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
* the pagefault handling code may want to call printk().
*/
release_console_sem();
console_unlock();
ret = copy_to_user(buf, con_buf_start, orig_count);
acquire_console_sem();
console_lock();
if (ret) {
read += (orig_count - ret);
@ -354,7 +354,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
if (read)
ret = read;
unlock_out:
release_console_sem();
console_unlock();
mutex_unlock(&con_buf_mtx);
return ret;
}
@ -379,7 +379,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
/* Select the proper current console and verify
* sanity of the situation under the console lock.
*/
acquire_console_sem();
console_lock();
attr = (currcons & 128);
currcons = (currcons & 127);
@ -414,9 +414,9 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
/* Temporarily drop the console lock so that we can read
* in the write data from userspace safely.
*/
release_console_sem();
console_unlock();
ret = copy_from_user(con_buf, buf, this_round);
acquire_console_sem();
console_lock();
if (ret) {
this_round -= ret;
@ -542,7 +542,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
vcs_scr_updated(vc);
unlock_out:
release_console_sem();
console_unlock();
mutex_unlock(&con_buf_mtx);

View file

@ -1003,9 +1003,9 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws)
struct vc_data *vc = tty->driver_data;
int ret;
acquire_console_sem();
console_lock();
ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row);
release_console_sem();
console_unlock();
return ret;
}
@ -1271,7 +1271,7 @@ static void default_attr(struct vc_data *vc)
vc->vc_color = vc->vc_def_color;
}
/* console_sem is held */
/* console_lock is held */
static void csi_m(struct vc_data *vc)
{
int i;
@ -1415,7 +1415,7 @@ int mouse_reporting(void)
return vc_cons[fg_console].d->vc_report_mouse;
}
/* console_sem is held */
/* console_lock is held */
static void set_mode(struct vc_data *vc, int on_off)
{
int i;
@ -1485,7 +1485,7 @@ static void set_mode(struct vc_data *vc, int on_off)
}
}
/* console_sem is held */
/* console_lock is held */
static void setterm_command(struct vc_data *vc)
{
switch(vc->vc_par[0]) {
@ -1545,7 +1545,7 @@ static void setterm_command(struct vc_data *vc)
}
}
/* console_sem is held */
/* console_lock is held */
static void csi_at(struct vc_data *vc, unsigned int nr)
{
if (nr > vc->vc_cols - vc->vc_x)
@ -1555,7 +1555,7 @@ static void csi_at(struct vc_data *vc, unsigned int nr)
insert_char(vc, nr);
}
/* console_sem is held */
/* console_lock is held */
static void csi_L(struct vc_data *vc, unsigned int nr)
{
if (nr > vc->vc_rows - vc->vc_y)
@ -1566,7 +1566,7 @@ static void csi_L(struct vc_data *vc, unsigned int nr)
vc->vc_need_wrap = 0;
}
/* console_sem is held */
/* console_lock is held */
static void csi_P(struct vc_data *vc, unsigned int nr)
{
if (nr > vc->vc_cols - vc->vc_x)
@ -1576,7 +1576,7 @@ static void csi_P(struct vc_data *vc, unsigned int nr)
delete_char(vc, nr);
}
/* console_sem is held */
/* console_lock is held */
static void csi_M(struct vc_data *vc, unsigned int nr)
{
if (nr > vc->vc_rows - vc->vc_y)
@ -1587,7 +1587,7 @@ static void csi_M(struct vc_data *vc, unsigned int nr)
vc->vc_need_wrap = 0;
}
/* console_sem is held (except via vc_init->reset_terminal */
/* console_lock is held (except via vc_init->reset_terminal */
static void save_cur(struct vc_data *vc)
{
vc->vc_saved_x = vc->vc_x;
@ -1603,7 +1603,7 @@ static void save_cur(struct vc_data *vc)
vc->vc_saved_G1 = vc->vc_G1_charset;
}
/* console_sem is held */
/* console_lock is held */
static void restore_cur(struct vc_data *vc)
{
gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y);
@ -1625,7 +1625,7 @@ enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
ESpalette };
/* console_sem is held (except via vc_init()) */
/* console_lock is held (except via vc_init()) */
static void reset_terminal(struct vc_data *vc, int do_clear)
{
vc->vc_top = 0;
@ -1685,7 +1685,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
csi_J(vc, 2);
}
/* console_sem is held */
/* console_lock is held */
static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
{
/*
@ -2119,7 +2119,7 @@ static int is_double_width(uint32_t ucs)
return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1);
}
/* acquires console_sem */
/* acquires console_lock */
static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
#ifdef VT_BUF_VRAM_ONLY
@ -2147,11 +2147,11 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
might_sleep();
acquire_console_sem();
console_lock();
vc = tty->driver_data;
if (vc == NULL) {
printk(KERN_ERR "vt: argh, driver_data is NULL !\n");
release_console_sem();
console_unlock();
return 0;
}
@ -2159,7 +2159,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
if (!vc_cons_allocated(currcons)) {
/* could this happen? */
printk_once("con_write: tty %d not allocated\n", currcons+1);
release_console_sem();
console_unlock();
return 0;
}
@ -2375,7 +2375,7 @@ rescan_last_byte:
}
FLUSH
console_conditional_schedule();
release_console_sem();
console_unlock();
notify_update(vc);
return n;
#undef FLUSH
@ -2388,11 +2388,11 @@ rescan_last_byte:
* us to do the switches asynchronously (needed when we want
* to switch due to a keyboard interrupt). Synchronization
* with other console code and prevention of re-entrancy is
* ensured with console_sem.
* ensured with console_lock.
*/
static void console_callback(struct work_struct *ignored)
{
acquire_console_sem();
console_lock();
if (want_console >= 0) {
if (want_console != fg_console &&
@ -2422,7 +2422,7 @@ static void console_callback(struct work_struct *ignored)
}
notify_update(vc_cons[fg_console].d);
release_console_sem();
console_unlock();
}
int set_console(int nr)
@ -2603,7 +2603,7 @@ static struct console vt_console_driver = {
*/
/*
* Generally a bit racy with respect to console_sem().
* Generally a bit racy with respect to console_lock();.
*
* There are some functions which don't need it.
*
@ -2629,17 +2629,17 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
switch (type)
{
case TIOCL_SETSEL:
acquire_console_sem();
console_lock();
ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
release_console_sem();
console_unlock();
break;
case TIOCL_PASTESEL:
ret = paste_selection(tty);
break;
case TIOCL_UNBLANKSCREEN:
acquire_console_sem();
console_lock();
unblank_screen();
release_console_sem();
console_unlock();
break;
case TIOCL_SELLOADLUT:
ret = sel_loadlut(p);
@ -2688,10 +2688,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
}
break;
case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */
acquire_console_sem();
console_lock();
ignore_poke = 1;
do_blank_screen(0);
release_console_sem();
console_unlock();
break;
case TIOCL_BLANKEDSCREEN:
ret = console_blanked;
@ -2790,11 +2790,11 @@ static void con_flush_chars(struct tty_struct *tty)
return;
/* if we race with con_close(), vt may be null */
acquire_console_sem();
console_lock();
vc = tty->driver_data;
if (vc)
set_cursor(vc);
release_console_sem();
console_unlock();
}
/*
@ -2805,7 +2805,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
unsigned int currcons = tty->index;
int ret = 0;
acquire_console_sem();
console_lock();
if (tty->driver_data == NULL) {
ret = vc_allocate(currcons);
if (ret == 0) {
@ -2813,7 +2813,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
/* Still being freed */
if (vc->port.tty) {
release_console_sem();
console_unlock();
return -ERESTARTSYS;
}
tty->driver_data = vc;
@ -2827,11 +2827,11 @@ static int con_open(struct tty_struct *tty, struct file *filp)
tty->termios->c_iflag |= IUTF8;
else
tty->termios->c_iflag &= ~IUTF8;
release_console_sem();
console_unlock();
return ret;
}
}
release_console_sem();
console_unlock();
return ret;
}
@ -2844,9 +2844,9 @@ static void con_shutdown(struct tty_struct *tty)
{
struct vc_data *vc = tty->driver_data;
BUG_ON(vc == NULL);
acquire_console_sem();
console_lock();
vc->port.tty = NULL;
release_console_sem();
console_unlock();
tty_shutdown(tty);
}
@ -2893,13 +2893,13 @@ static int __init con_init(void)
struct vc_data *vc;
unsigned int currcons = 0, i;
acquire_console_sem();
console_lock();
if (conswitchp)
display_desc = conswitchp->con_startup();
if (!display_desc) {
fg_console = 0;
release_console_sem();
console_unlock();
return 0;
}
@ -2946,7 +2946,7 @@ static int __init con_init(void)
printable = 1;
printk("\n");
release_console_sem();
console_unlock();
#ifdef CONFIG_VT_CONSOLE
register_console(&vt_console_driver);
@ -2994,7 +2994,7 @@ int __init vty_init(const struct file_operations *console_fops)
if (IS_ERR(tty0dev))
tty0dev = NULL;
else
device_create_file(tty0dev, &dev_attr_active);
WARN_ON(device_create_file(tty0dev, &dev_attr_active) < 0);
vcs_init();
@ -3037,7 +3037,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
if (!try_module_get(owner))
return -ENODEV;
acquire_console_sem();
console_lock();
/* check if driver is registered */
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
@ -3122,7 +3122,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
retval = 0;
err:
release_console_sem();
console_unlock();
module_put(owner);
return retval;
};
@ -3171,7 +3171,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
if (!try_module_get(owner))
return -ENODEV;
acquire_console_sem();
console_lock();
/* check if driver is registered and if it is unbindable */
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
@ -3185,7 +3185,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
}
if (retval) {
release_console_sem();
console_unlock();
goto err;
}
@ -3204,12 +3204,12 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
}
if (retval) {
release_console_sem();
console_unlock();
goto err;
}
if (!con_is_bound(csw)) {
release_console_sem();
console_unlock();
goto err;
}
@ -3238,7 +3238,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
if (!con_is_bound(csw))
con_driver->flag &= ~CON_DRIVER_FLAG_INIT;
release_console_sem();
console_unlock();
/* ignore return value, binding should not fail */
bind_con_driver(defcsw, first, last, deflt);
err:
@ -3538,14 +3538,14 @@ int register_con_driver(const struct consw *csw, int first, int last)
if (!try_module_get(owner))
return -ENODEV;
acquire_console_sem();
console_lock();
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
con_driver = &registered_con_driver[i];
/* already registered */
if (con_driver->con == csw)
retval = -EINVAL;
retval = -EBUSY;
}
if (retval)
@ -3592,7 +3592,7 @@ int register_con_driver(const struct consw *csw, int first, int last)
}
err:
release_console_sem();
console_unlock();
module_put(owner);
return retval;
}
@ -3613,7 +3613,7 @@ int unregister_con_driver(const struct consw *csw)
{
int i, retval = -ENODEV;
acquire_console_sem();
console_lock();
/* cannot unregister a bound driver */
if (con_is_bound(csw))
@ -3639,7 +3639,7 @@ int unregister_con_driver(const struct consw *csw)
}
}
err:
release_console_sem();
console_unlock();
return retval;
}
EXPORT_SYMBOL(unregister_con_driver);
@ -3656,7 +3656,12 @@ int take_over_console(const struct consw *csw, int first, int last, int deflt)
int err;
err = register_con_driver(csw, first, last);
/* if we get an busy error we still want to bind the console driver
* and return success, as we may have unbound the console driver
 * but not unregistered it.
*/
if (err == -EBUSY)
err = 0;
if (!err)
bind_con_driver(csw, first, last, deflt);
@ -3934,9 +3939,9 @@ int con_set_cmap(unsigned char __user *arg)
{
int rc;
acquire_console_sem();
console_lock();
rc = set_get_cmap (arg,1);
release_console_sem();
console_unlock();
return rc;
}
@ -3945,9 +3950,9 @@ int con_get_cmap(unsigned char __user *arg)
{
int rc;
acquire_console_sem();
console_lock();
rc = set_get_cmap (arg,0);
release_console_sem();
console_unlock();
return rc;
}
@ -3994,12 +3999,12 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op)
} else
font.data = NULL;
acquire_console_sem();
console_lock();
if (vc->vc_sw->con_font_get)
rc = vc->vc_sw->con_font_get(vc, &font);
else
rc = -ENOSYS;
release_console_sem();
console_unlock();
if (rc)
goto out;
@ -4076,12 +4081,12 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op)
font.data = memdup_user(op->data, size);
if (IS_ERR(font.data))
return PTR_ERR(font.data);
acquire_console_sem();
console_lock();
if (vc->vc_sw->con_font_set)
rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
else
rc = -ENOSYS;
release_console_sem();
console_unlock();
kfree(font.data);
return rc;
}
@ -4103,12 +4108,12 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
else
name[MAX_FONT_NAME - 1] = 0;
acquire_console_sem();
console_lock();
if (vc->vc_sw->con_font_default)
rc = vc->vc_sw->con_font_default(vc, &font, s);
else
rc = -ENOSYS;
release_console_sem();
console_unlock();
if (!rc) {
op->width = font.width;
op->height = font.height;
@ -4124,7 +4129,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
if (vc->vc_mode != KD_TEXT)
return -EINVAL;
acquire_console_sem();
console_lock();
if (!vc->vc_sw->con_font_copy)
rc = -ENOSYS;
else if (con < 0 || !vc_cons_allocated(con))
@ -4133,7 +4138,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
rc = 0;
else
rc = vc->vc_sw->con_font_copy(vc, con);
release_console_sem();
console_unlock();
return rc;
}

View file

@ -649,12 +649,12 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
/*
* explicitly blank/unblank the screen if switching modes
*/
acquire_console_sem();
console_lock();
if (arg == KD_TEXT)
do_unblank_screen(1);
else
do_blank_screen(1);
release_console_sem();
console_unlock();
break;
case KDGETMODE:
@ -893,7 +893,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
ret = -EINVAL;
goto out;
}
acquire_console_sem();
console_lock();
vc->vt_mode = tmp;
/* the frsig is ignored, so we set it to 0 */
vc->vt_mode.frsig = 0;
@ -901,7 +901,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
vc->vt_pid = get_pid(task_pid(current));
/* no switch is required -- [email protected] */
vc->vt_newvt = -1;
release_console_sem();
console_unlock();
break;
}
@ -910,9 +910,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
struct vt_mode tmp;
int rc;
acquire_console_sem();
console_lock();
memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
release_console_sem();
console_unlock();
rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
if (rc)
@ -965,9 +965,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
ret = -ENXIO;
else {
arg--;
acquire_console_sem();
console_lock();
ret = vc_allocate(arg);
release_console_sem();
console_unlock();
if (ret)
break;
set_console(arg);
@ -990,7 +990,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
ret = -ENXIO;
else {
vsa.console--;
acquire_console_sem();
console_lock();
ret = vc_allocate(vsa.console);
if (ret == 0) {
struct vc_data *nvc;
@ -1003,7 +1003,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
put_pid(nvc->vt_pid);
nvc->vt_pid = get_pid(task_pid(current));
}
release_console_sem();
console_unlock();
if (ret)
break;
/* Commence switch and lock */
@ -1044,7 +1044,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
/*
* Switching-from response
*/
acquire_console_sem();
console_lock();
if (vc->vt_newvt >= 0) {
if (arg == 0)
/*
@ -1063,7 +1063,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
vc->vt_newvt = -1;
ret = vc_allocate(newvt);
if (ret) {
release_console_sem();
console_unlock();
break;
}
/*
@ -1083,7 +1083,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
if (arg != VT_ACKACQ)
ret = -EINVAL;
}
release_console_sem();
console_unlock();
break;
/*
@ -1096,20 +1096,20 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
}
if (arg == 0) {
/* deallocate all unused consoles, but leave 0 */
acquire_console_sem();
console_lock();
for (i=1; i<MAX_NR_CONSOLES; i++)
if (! VT_BUSY(i))
vc_deallocate(i);
release_console_sem();
console_unlock();
} else {
/* deallocate a single console, if possible */
arg--;
if (VT_BUSY(arg))
ret = -EBUSY;
else if (arg) { /* leave 0 */
acquire_console_sem();
console_lock();
vc_deallocate(arg);
release_console_sem();
console_unlock();
}
}
break;
@ -1126,7 +1126,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
get_user(cc, &vtsizes->v_cols))
ret = -EFAULT;
else {
acquire_console_sem();
console_lock();
for (i = 0; i < MAX_NR_CONSOLES; i++) {
vc = vc_cons[i].d;
@ -1135,7 +1135,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
vc_resize(vc_cons[i].d, cc, ll);
}
}
release_console_sem();
console_unlock();
}
break;
}
@ -1187,14 +1187,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
for (i = 0; i < MAX_NR_CONSOLES; i++) {
if (!vc_cons[i].d)
continue;
acquire_console_sem();
console_lock();
if (vlin)
vc_cons[i].d->vc_scan_lines = vlin;
if (clin)
vc_cons[i].d->vc_font.height = clin;
vc_cons[i].d->vc_resize_user = 1;
vc_resize(vc_cons[i].d, cc, ll);
release_console_sem();
console_unlock();
}
break;
}
@ -1367,7 +1367,7 @@ void vc_SAK(struct work_struct *work)
struct vc_data *vc;
struct tty_struct *tty;
acquire_console_sem();
console_lock();
vc = vc_con->d;
if (vc) {
tty = vc->port.tty;
@ -1379,7 +1379,7 @@ void vc_SAK(struct work_struct *work)
__do_SAK(tty);
reset_vc(vc);
}
release_console_sem();
console_unlock();
}
#ifdef CONFIG_COMPAT
@ -1737,10 +1737,10 @@ int vt_move_to_console(unsigned int vt, int alloc)
{
int prev;
acquire_console_sem();
console_lock();
/* Graphics mode - up to X */
if (disable_vt_switch) {
release_console_sem();
console_unlock();
return 0;
}
prev = fg_console;
@ -1748,7 +1748,7 @@ int vt_move_to_console(unsigned int vt, int alloc)
if (alloc && vc_allocate(vt)) {
/* we can't have a free VC for now. Too bad,
* we don't want to mess the screen for now. */
release_console_sem();
console_unlock();
return -ENOSPC;
}
@ -1758,10 +1758,10 @@ int vt_move_to_console(unsigned int vt, int alloc)
* Let the calling function know so it can decide
* what to do.
*/
release_console_sem();
console_unlock();
return -EIO;
}
release_console_sem();
console_unlock();
tty_lock();
if (vt_waitactive(vt + 1)) {
pr_debug("Suspend: Can't switch VCs.");
@ -1781,8 +1781,8 @@ int vt_move_to_console(unsigned int vt, int alloc)
*/
void pm_set_vt_switch(int do_switch)
{
acquire_console_sem();
console_lock();
disable_vt_switch = !do_switch;
release_console_sem();
console_unlock();
}
EXPORT_SYMBOL(pm_set_vt_switch);