diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/Kconfig | 8 | ||||
-rw-r--r-- | drivers/char/consolemap.c | 2 | ||||
-rw-r--r-- | drivers/char/lcd.c | 2 | ||||
-rw-r--r-- | drivers/char/lp.c | 2 | ||||
-rw-r--r-- | drivers/char/mxser_new.c | 8 | ||||
-rw-r--r-- | drivers/char/n_r3964.c | 37 | ||||
-rw-r--r-- | drivers/char/n_tty.c | 1 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 2 | ||||
-rw-r--r-- | drivers/char/rio/riocmd.c | 2 | ||||
-rw-r--r-- | drivers/char/rtc.c | 38 | ||||
-rw-r--r-- | drivers/char/sx.c | 8 | ||||
-rw-r--r-- | drivers/char/synclink.c | 2 | ||||
-rw-r--r-- | drivers/char/synclinkmp.c | 4 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 37 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 8 | ||||
-rw-r--r-- | drivers/char/viocons.c | 10 | ||||
-rw-r--r-- | drivers/char/vt.c | 2 | ||||
-rw-r--r-- | drivers/char/vt_ioctl.c | 10 |
18 files changed, 112 insertions, 71 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 0a3aee29e067..9e43e39dc35c 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -97,7 +97,7 @@ config SERIAL_NONSTANDARD config COMPUTONE tristate "Computone IntelliPort Plus serial support" - depends on SERIAL_NONSTANDARD + depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI) ---help--- This driver supports the entire family of Intelliport II/Plus controllers with the exception of the MicroChannel controllers and @@ -203,7 +203,7 @@ config MOXA_SMARTIO config MOXA_SMARTIO_NEW tristate "Moxa SmartIO support v. 2.0 (EXPERIMENTAL)" - depends on SERIAL_NONSTANDARD + depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) help Say Y here if you have a Moxa SmartIO multiport serial card and/or want to help develop a new version of this driver. @@ -218,7 +218,7 @@ config MOXA_SMARTIO_NEW config ISI tristate "Multi-Tech multiport card support (EXPERIMENTAL)" - depends on SERIAL_NONSTANDARD + depends on SERIAL_NONSTANDARD && PCI select FW_LOADER help This is a driver for the Multi-Tech cards which provide several @@ -312,7 +312,7 @@ config SPECIALIX_RTSCTS config SX tristate "Specialix SX (and SI) card support" - depends on SERIAL_NONSTANDARD + depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) help This is a driver for the SX and SI multiport serial cards. Please read the file <file:Documentation/sx.txt> for details. diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c index 04a12027a740..b99b7561260d 100644 --- a/drivers/char/consolemap.c +++ b/drivers/char/consolemap.c @@ -443,7 +443,7 @@ int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui) p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; if (p && p->readonly) return -EIO; if (!p || --p->refcount) { - q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL); + q = kmalloc(sizeof(*p), GFP_KERNEL); if (!q) { if (p) p->refcount++; return -ENOMEM; diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index da601fd6c07a..d649abbf0857 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c @@ -459,7 +459,7 @@ static int lcd_ioctl(struct inode *inode, struct file *file, (&display, (struct lcd_display *) arg, sizeof(struct lcd_display))) return -EFAULT; - rom = (unsigned char *) kmalloc((128), GFP_ATOMIC); + rom = kmalloc((128), GFP_ATOMIC); if (rom == NULL) { printk(KERN_ERR LCD "kmalloc() failed in %s\n", __FUNCTION__); diff --git a/drivers/char/lp.c b/drivers/char/lp.c index b70b5388b5a8..b51d08be0bcf 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -525,7 +525,7 @@ static int lp_open(struct inode * inode, struct file * file) return -EIO; } } - lp_table[minor].lp_buffer = (char *) kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); + lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); if (!lp_table[minor].lp_buffer) { LP_F(minor) &= ~LP_BUSY; return -ENOMEM; diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index efa8076c33e0..cd989dce7c53 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c @@ -315,6 +315,7 @@ static struct mxser_mon_ext mon_data_ext; static int mxser_set_baud_method[MXSER_PORTS + 1]; static spinlock_t gm_lock; +#ifdef CONFIG_PCI static int CheckIsMoxaMust(int io) { u8 oldmcr, hwid; @@ -337,6 +338,7 @@ static int CheckIsMoxaMust(int io) } return MOXA_OTHER_UART; } +#endif static void process_txrx_fifo(struct mxser_port *info) { @@ -2380,9 +2382,11 @@ static void mxser_release_res(struct mxser_board *brd, struct pci_dev *pdev, if (irq) free_irq(brd->irq, brd); if (pdev != NULL) { /* PCI */ +#ifdef CONFIG_PCI pci_release_region(pdev, 2); pci_release_region(pdev, 3); pci_dev_put(pdev); +#endif } else { release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); release_region(brd->vector, 1); @@ -2546,6 +2550,7 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd) static int __devinit mxser_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { +#ifdef CONFIG_PCI struct mxser_board *brd; unsigned int i, j; unsigned long ioaddress; @@ -2644,6 +2649,9 @@ err_relio: brd->info = NULL; err: return retval; +#else + return -ENODEV; +#endif } static void __devexit mxser_remove(struct pci_dev *pdev) diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 103d338f21e2..dc6d41841457 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c @@ -125,8 +125,8 @@ static void transmit_block(struct r3964_info *pInfo); static void receive_char(struct r3964_info *pInfo, const unsigned char c); static void receive_error(struct r3964_info *pInfo, const char flag); static void on_timeout(unsigned long priv); -static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg); -static int read_telegram(struct r3964_info *pInfo, pid_t pid, unsigned char __user *buf); +static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg); +static int read_telegram(struct r3964_info *pInfo, struct pid *pid, unsigned char __user *buf); static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg, int error_code, struct r3964_block_header *pBlock); static struct r3964_message* remove_msg(struct r3964_info *pInfo, @@ -829,7 +829,7 @@ static void on_timeout(unsigned long priv) } static struct r3964_client_info *findClient( - struct r3964_info *pInfo, pid_t pid) + struct r3964_info *pInfo, struct pid *pid) { struct r3964_client_info *pClient; @@ -843,7 +843,7 @@ static struct r3964_client_info *findClient( return NULL; } -static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) +static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg) { struct r3964_client_info *pClient; struct r3964_client_info **ppClient; @@ -858,7 +858,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) if(pClient->pid == pid) { - TRACE_PS("removing client %d from client list", pid); + TRACE_PS("removing client %d from client list", pid_nr(pid)); *ppClient = pClient->next; while(pClient->msg_count) { @@ -869,6 +869,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) TRACE_M("enable_signals - msg kfree %p",pMsg); } } + put_pid(pClient->pid); kfree(pClient); TRACE_M("enable_signals - kfree %p",pClient); return 0; @@ -892,10 +893,10 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) if(pClient==NULL) return -ENOMEM; - TRACE_PS("add client %d to client list", pid); + TRACE_PS("add client %d to client list", pid_nr(pid)); spin_lock_init(&pClient->lock); pClient->sig_flags=arg; - pClient->pid = pid; + pClient->pid = get_pid(pid); pClient->next=pInfo->firstClient; pClient->first_msg = NULL; pClient->last_msg = NULL; @@ -908,7 +909,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) return 0; } -static int read_telegram(struct r3964_info *pInfo, pid_t pid, unsigned char __user *buf) +static int read_telegram(struct r3964_info *pInfo, struct pid *pid, unsigned char __user *buf) { struct r3964_client_info *pClient; struct r3964_block_header *block; @@ -1005,7 +1006,7 @@ queue_the_message: /* Send SIGIO signal to client process: */ if(pClient->sig_flags & R3964_USE_SIGIO) { - kill_proc(pClient->pid, SIGIO, 1); + kill_pid(pClient->pid, SIGIO, 1); } } @@ -1042,7 +1043,7 @@ static void remove_client_block(struct r3964_info *pInfo, { struct r3964_block_header *block; - TRACE_PS("remove_client_block PID %d", pClient->pid); + TRACE_PS("remove_client_block PID %d", pid_nr(pClient->pid)); block=pClient->next_block_to_read; if(block) @@ -1157,6 +1158,7 @@ static void r3964_close(struct tty_struct *tty) TRACE_M("r3964_close - msg kfree %p",pMsg); } } + put_pid(pClient->pid); kfree(pClient); TRACE_M("r3964_close - client kfree %p",pClient); pClient=pNext; @@ -1193,12 +1195,11 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file, struct r3964_client_message theMsg; DECLARE_WAITQUEUE (wait, current); - int pid = current->pid; int count; TRACE_L("read()"); - pClient=findClient(pInfo, pid); + pClient=findClient(pInfo, task_pid(current)); if(pClient) { pMsg = remove_msg(pInfo, pClient); @@ -1252,7 +1253,6 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file, struct r3964_block_header *pHeader; struct r3964_client_info *pClient; unsigned char *new_data; - int pid; TRACE_L("write request, %d characters", count); /* @@ -1295,9 +1295,7 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file, pHeader->locks = 0; pHeader->owner = NULL; - pid=current->pid; - - pClient=findClient(pInfo, pid); + pClient=findClient(pInfo, task_pid(current)); if(pClient) { pHeader->owner = pClient; @@ -1328,7 +1326,7 @@ static int r3964_ioctl(struct tty_struct * tty, struct file * file, switch(cmd) { case R3964_ENABLE_SIGNALS: - return enable_signals(pInfo, current->pid, arg); + return enable_signals(pInfo, task_pid(current), arg); case R3964_SETPRIORITY: if(arg<R3964_MASTER || arg>R3964_SLAVE) return -EINVAL; @@ -1341,7 +1339,7 @@ static int r3964_ioctl(struct tty_struct * tty, struct file * file, pInfo->flags &= ~R3964_BCC; return 0; case R3964_READ_TELEGRAM: - return read_telegram(pInfo, current->pid, (unsigned char __user *)arg); + return read_telegram(pInfo, task_pid(current), (unsigned char __user *)arg); default: return -ENOIOCTLCMD; } @@ -1357,7 +1355,6 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file, struct poll_table_struct *wait) { struct r3964_info *pInfo=(struct r3964_info*)tty->disc_data; - int pid=current->pid; struct r3964_client_info *pClient; struct r3964_message *pMsg=NULL; unsigned long flags; @@ -1365,7 +1362,7 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file, TRACE_L("POLL"); - pClient=findClient(pInfo,pid); + pClient=findClient(pInfo, task_pid(current)); if(pClient) { poll_wait(file, &pInfo->read_wait, wait); diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index e96a00fe1389..2bdb0144a22e 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c @@ -1151,7 +1151,6 @@ static int copy_from_read_buf(struct tty_struct *tty, n = min(*nr, n); spin_unlock_irqrestore(&tty->read_lock, flags); if (n) { - mb(); retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n); n -= retval; spin_lock_irqsave(&tty->read_lock, flags); diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 5152cedd8878..f108c136800a 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -541,7 +541,7 @@ static int mgslpc_probe(struct pcmcia_device *link) if (debug_level >= DEBUG_LEVEL_INFO) printk("mgslpc_attach\n"); - info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); + info = kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); if (!info) { printk("Error can't allocate device instance data\n"); return -ENOMEM; diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 167ebc84e8d7..245f03195b7c 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c @@ -556,7 +556,7 @@ struct CmdBlk *RIOGetCmdBlk(void) { struct CmdBlk *CmdBlkP; - CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); + CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); if (CmdBlkP) memset(CmdBlkP, 0, sizeof(struct CmdBlk)); return CmdBlkP; diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 66a7385bc34a..e1d70e8b6268 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -113,7 +113,7 @@ static int rtc_has_irq = 1; #define hpet_set_rtc_irq_bit(arg) 0 #define hpet_rtc_timer_init() do { } while (0) #define hpet_rtc_dropped_irq() 0 -static inline irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) {return 0;} +static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) {return 0;} #else extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); #endif @@ -165,7 +165,9 @@ static void mask_rtc_irq_bit(unsigned char bit) } #endif +#ifdef CONFIG_PROC_FS static int rtc_proc_open(struct inode *inode, struct file *file); +#endif /* * Bits in rtc_status. (6 bits of room for future expansion) @@ -906,6 +908,7 @@ static struct miscdevice rtc_dev = { .fops = &rtc_fops, }; +#ifdef CONFIG_PROC_FS static const struct file_operations rtc_proc_fops = { .owner = THIS_MODULE, .open = rtc_proc_open, @@ -913,14 +916,13 @@ static const struct file_operations rtc_proc_fops = { .llseek = seq_lseek, .release = single_release, }; - -#if defined(RTC_IRQ) && !defined(__sparc__) -static irq_handler_t rtc_int_handler_ptr; #endif static int __init rtc_init(void) { +#ifdef CONFIG_PROC_FS struct proc_dir_entry *ent; +#endif #if defined(__alpha__) || defined(__mips__) unsigned int year, ctrl; char *guess = NULL; @@ -932,9 +934,11 @@ static int __init rtc_init(void) struct sparc_isa_bridge *isa_br; struct sparc_isa_device *isa_dev; #endif -#endif -#ifndef __sparc__ +#else void *r; +#ifdef RTC_IRQ + irq_handler_t rtc_int_handler_ptr; +#endif #endif #ifdef __sparc__ @@ -958,6 +962,7 @@ static int __init rtc_init(void) } } #endif + rtc_has_irq = 0; printk(KERN_ERR "rtc_init: no PC rtc found\n"); return -EIO; @@ -972,6 +977,7 @@ found: * PCI Slot 2 INTA# (and some INTx# in Slot 1). */ if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { + rtc_has_irq = 0; printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); return -EIO; } @@ -982,6 +988,9 @@ no_irq: else r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); if (!r) { +#ifdef RTC_IRQ + rtc_has_irq = 0; +#endif printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", (long)(RTC_PORT(0))); return -EIO; @@ -996,6 +1005,7 @@ no_irq: if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ + rtc_has_irq = 0; printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); if (RTC_IOMAPPED) release_region(RTC_PORT(0), RTC_IO_EXTENT); @@ -1012,21 +1022,19 @@ no_irq: if (misc_register(&rtc_dev)) { #ifdef RTC_IRQ free_irq(RTC_IRQ, NULL); + rtc_has_irq = 0; #endif release_region(RTC_PORT(0), RTC_IO_EXTENT); return -ENODEV; } +#ifdef CONFIG_PROC_FS ent = create_proc_entry("driver/rtc", 0, NULL); - if (!ent) { -#ifdef RTC_IRQ - free_irq(RTC_IRQ, NULL); + if (ent) + ent->proc_fops = &rtc_proc_fops; + else + printk(KERN_WARNING "rtc: Failed to register with procfs.\n"); #endif - release_region(RTC_PORT(0), RTC_IO_EXTENT); - misc_deregister(&rtc_dev); - return -ENOMEM; - } - ent->proc_fops = &rtc_proc_fops; #if defined(__alpha__) || defined(__mips__) rtc_freq = HZ; @@ -1159,6 +1167,7 @@ static void rtc_dropped_irq(unsigned long data) } #endif +#ifdef CONFIG_PROC_FS /* * Info exported via "/proc/driver/rtc". */ @@ -1243,6 +1252,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file) { return single_open(file, rtc_proc_show, NULL); } +#endif void rtc_get_rtc_time(struct rtc_time *rtc_tm) { diff --git a/drivers/char/sx.c b/drivers/char/sx.c index a3008ce13015..1da92a689ae4 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -2498,8 +2498,10 @@ static void __devexit sx_remove_card(struct sx_board *board, /* It is safe/allowed to del_timer a non-active timer */ del_timer(&board->timer); if (pdev) { +#ifdef CONFIG_PCI pci_iounmap(pdev, board->base); pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2); +#endif } else { iounmap(board->base); release_region(board->hw_base, board->hw_len); @@ -2601,6 +2603,7 @@ static struct eisa_driver sx_eisadriver = { #endif +#ifdef CONFIG_PCI /******************************************************** * Setting bit 17 in the CNTRL register of the PLX 9050 * * chip forces a retry on writes while a read is pending.* @@ -2632,10 +2635,12 @@ static void __devinit fix_sx_pci(struct pci_dev *pdev, struct sx_board *board) } iounmap(rebase); } +#endif static int __devinit sx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { +#ifdef CONFIG_PCI struct sx_board *board; unsigned int i, reg; int retval = -EIO; @@ -2700,6 +2705,9 @@ err_flag: board->flags &= ~SX_BOARD_PRESENT; err: return retval; +#else + return -ENODEV; +#endif } static void __devexit sx_pci_remove(struct pci_dev *pdev) diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index acc6fab601cc..3fa625db9e4b 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -4332,7 +4332,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) { struct mgsl_struct *info; - info = (struct mgsl_struct *)kmalloc(sizeof(struct mgsl_struct), + info = kmalloc(sizeof(struct mgsl_struct), GFP_KERNEL); if (!info) { diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 53e8ccf94fe3..8f4d67afe5bf 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -2730,7 +2730,7 @@ static int startup(SLMP_INFO * info) return 0; if (!info->tx_buf) { - info->tx_buf = (unsigned char *)kmalloc(info->max_frame_size, GFP_KERNEL); + info->tx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); if (!info->tx_buf) { printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", __FILE__,__LINE__,info->device_name); @@ -3798,7 +3798,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) { SLMP_INFO *info; - info = (SLMP_INFO *)kmalloc(sizeof(SLMP_INFO), + info = kmalloc(sizeof(SLMP_INFO), GFP_KERNEL); if (!info) { diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 05810c8d20bc..13935235e066 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -41,7 +41,34 @@ #include <asm/irq_regs.h> /* Whether we react on sysrq keys or just ignore them */ -int sysrq_enabled = 1; +int __read_mostly __sysrq_enabled = 1; + +static int __read_mostly sysrq_always_enabled; + +int sysrq_on(void) +{ + return __sysrq_enabled || sysrq_always_enabled; +} + +/* + * A value of 1 means 'all', other nonzero values are an op mask: + */ +static inline int sysrq_on_mask(int mask) +{ + return sysrq_always_enabled || __sysrq_enabled == 1 || + (__sysrq_enabled & mask); +} + +static int __init sysrq_always_enabled_setup(char *str) +{ + sysrq_always_enabled = 1; + printk(KERN_INFO "debug: sysrq always enabled.\n"); + + return 1; +} + +__setup("sysrq_always_enabled", sysrq_always_enabled_setup); + static void sysrq_handle_loglevel(int key, struct tty_struct *tty) { @@ -379,8 +406,7 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) * Should we check for enabled operations (/proc/sysrq-trigger * should not) and is the invoked operation enabled? */ - if (!check_mask || sysrq_enabled == 1 || - (sysrq_enabled & op_p->enable_mask)) { + if (!check_mask || sysrq_on_mask(op_p->enable_mask)) { printk("%s\n", op_p->action_msg); console_loglevel = orig_log_level; op_p->handler(key, tty); @@ -414,9 +440,8 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) */ void handle_sysrq(int key, struct tty_struct *tty) { - if (!sysrq_enabled) - return; - __handle_sysrq(key, tty, 1); + if (sysrq_on()) + __handle_sysrq(key, tty, 1); } EXPORT_SYMBOL(handle_sysrq); diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 4044c864fdd4..47a6eacb10bc 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -3335,18 +3335,13 @@ static void __do_SAK(struct work_struct *work) int session; int i; struct file *filp; - struct tty_ldisc *disc; struct fdtable *fdt; if (!tty) return; session = tty->session; - /* We don't want an ldisc switch during this */ - disc = tty_ldisc_ref(tty); - if (disc && disc->flush_buffer) - disc->flush_buffer(tty); - tty_ldisc_deref(disc); + tty_ldisc_flush(tty); if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty); @@ -3821,6 +3816,7 @@ struct tty_struct *get_current_tty(void) barrier(); return tty; } +EXPORT_SYMBOL_GPL(get_current_tty); /* * Initialize the console device. This is called *early*, so diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 6d2e314860df..0e0da443cbd5 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c @@ -61,10 +61,7 @@ static DEFINE_SPINLOCK(consolelock); static DEFINE_SPINLOCK(consoleloglock); -#ifdef CONFIG_MAGIC_SYSRQ static int vio_sysrq_pressed; -extern int sysrq_enabled; -#endif #define VIOCHAR_NUM_BUF 16 @@ -936,8 +933,10 @@ static void vioHandleData(struct HvLpEvent *event) */ num_pushed = 0; for (index = 0; index < cevent->len; index++) { -#ifdef CONFIG_MAGIC_SYSRQ - if (sysrq_enabled) { + /* + * Will be optimized away if !CONFIG_MAGIC_SYSRQ: + */ + if (sysrq_on()) { /* 0x0f is the ascii character for ^O */ if (cevent->data[index] == '\x0f') { vio_sysrq_pressed = 1; @@ -956,7 +955,6 @@ static void vioHandleData(struct HvLpEvent *event) continue; } } -#endif /* * The sysrq sequence isn't included in this check if * sysrq is enabled and compiled into the kernel because diff --git a/drivers/char/vt.c b/drivers/char/vt.c index a8239dac994f..06c32a3e3ca4 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -784,7 +784,7 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines) if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) return 0; - newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER); + newscreen = kmalloc(new_screen_size, GFP_USER); if (!newscreen) return -ENOMEM; diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index ac5d60edbafa..dc8368ebb1ac 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c @@ -129,7 +129,7 @@ do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_str !capable(CAP_SYS_RESOURCE)) return -EPERM; - key_map = (ushort *) kmalloc(sizeof(plain_map), + key_map = kmalloc(sizeof(plain_map), GFP_KERNEL); if (!key_map) return -ENOMEM; @@ -259,7 +259,7 @@ do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm) sz = 256; while (sz < funcbufsize - funcbufleft + delta) sz <<= 1; - fnw = (char *) kmalloc(sz, GFP_KERNEL); + fnw = kmalloc(sz, GFP_KERNEL); if(!fnw) { ret = -ENOMEM; goto reterr; @@ -1087,7 +1087,7 @@ static void complete_change_console(struct vc_data *vc) switch_screen(vc); /* - * This can't appear below a successful kill_proc(). If it did, + * This can't appear below a successful kill_pid(). If it did, * then the *blank_screen operation could occur while X, having * received acqsig, is waking up on another processor. This * condition can lead to overlapping accesses to the VGA range @@ -1110,7 +1110,7 @@ static void complete_change_console(struct vc_data *vc) */ if (vc->vt_mode.mode == VT_PROCESS) { /* - * Send the signal as privileged - kill_proc() will + * Send the signal as privileged - kill_pid() will * tell us if the process has gone or something else * is awry */ @@ -1170,7 +1170,7 @@ void change_console(struct vc_data *new_vc) vc = vc_cons[fg_console].d; if (vc->vt_mode.mode == VT_PROCESS) { /* - * Send the signal as privileged - kill_proc() will + * Send the signal as privileged - kill_pid() will * tell us if the process has gone or something else * is awry */ |