aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig8
-rw-r--r--drivers/char/consolemap.c2
-rw-r--r--drivers/char/lcd.c2
-rw-r--r--drivers/char/lp.c2
-rw-r--r--drivers/char/mxser_new.c8
-rw-r--r--drivers/char/n_r3964.c37
-rw-r--r--drivers/char/n_tty.c1
-rw-r--r--drivers/char/pcmcia/synclink_cs.c2
-rw-r--r--drivers/char/rio/riocmd.c2
-rw-r--r--drivers/char/rtc.c38
-rw-r--r--drivers/char/sx.c8
-rw-r--r--drivers/char/synclink.c2
-rw-r--r--drivers/char/synclinkmp.c4
-rw-r--r--drivers/char/sysrq.c37
-rw-r--r--drivers/char/tty_io.c8
-rw-r--r--drivers/char/viocons.c10
-rw-r--r--drivers/char/vt.c2
-rw-r--r--drivers/char/vt_ioctl.c10
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
97 97
98config COMPUTONE 98config COMPUTONE
99 tristate "Computone IntelliPort Plus serial support" 99 tristate "Computone IntelliPort Plus serial support"
100 depends on SERIAL_NONSTANDARD 100 depends on SERIAL_NONSTANDARD && (ISA || EISA || PCI)
101 ---help--- 101 ---help---
102 This driver supports the entire family of Intelliport II/Plus 102 This driver supports the entire family of Intelliport II/Plus
103 controllers with the exception of the MicroChannel controllers and 103 controllers with the exception of the MicroChannel controllers and
@@ -203,7 +203,7 @@ config MOXA_SMARTIO
203 203
204config MOXA_SMARTIO_NEW 204config MOXA_SMARTIO_NEW
205 tristate "Moxa SmartIO support v. 2.0 (EXPERIMENTAL)" 205 tristate "Moxa SmartIO support v. 2.0 (EXPERIMENTAL)"
206 depends on SERIAL_NONSTANDARD 206 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
207 help 207 help
208 Say Y here if you have a Moxa SmartIO multiport serial card and/or 208 Say Y here if you have a Moxa SmartIO multiport serial card and/or
209 want to help develop a new version of this driver. 209 want to help develop a new version of this driver.
@@ -218,7 +218,7 @@ config MOXA_SMARTIO_NEW
218 218
219config ISI 219config ISI
220 tristate "Multi-Tech multiport card support (EXPERIMENTAL)" 220 tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
221 depends on SERIAL_NONSTANDARD 221 depends on SERIAL_NONSTANDARD && PCI
222 select FW_LOADER 222 select FW_LOADER
223 help 223 help
224 This is a driver for the Multi-Tech cards which provide several 224 This is a driver for the Multi-Tech cards which provide several
@@ -312,7 +312,7 @@ config SPECIALIX_RTSCTS
312 312
313config SX 313config SX
314 tristate "Specialix SX (and SI) card support" 314 tristate "Specialix SX (and SI) card support"
315 depends on SERIAL_NONSTANDARD 315 depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
316 help 316 help
317 This is a driver for the SX and SI multiport serial cards. 317 This is a driver for the SX and SI multiport serial cards.
318 Please read the file <file:Documentation/sx.txt> for details. 318 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)
443 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 443 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
444 if (p && p->readonly) return -EIO; 444 if (p && p->readonly) return -EIO;
445 if (!p || --p->refcount) { 445 if (!p || --p->refcount) {
446 q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL); 446 q = kmalloc(sizeof(*p), GFP_KERNEL);
447 if (!q) { 447 if (!q) {
448 if (p) p->refcount++; 448 if (p) p->refcount++;
449 return -ENOMEM; 449 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,
459 (&display, (struct lcd_display *) arg, 459 (&display, (struct lcd_display *) arg,
460 sizeof(struct lcd_display))) 460 sizeof(struct lcd_display)))
461 return -EFAULT; 461 return -EFAULT;
462 rom = (unsigned char *) kmalloc((128), GFP_ATOMIC); 462 rom = kmalloc((128), GFP_ATOMIC);
463 if (rom == NULL) { 463 if (rom == NULL) {
464 printk(KERN_ERR LCD "kmalloc() failed in %s\n", 464 printk(KERN_ERR LCD "kmalloc() failed in %s\n",
465 __FUNCTION__); 465 __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)
525 return -EIO; 525 return -EIO;
526 } 526 }
527 } 527 }
528 lp_table[minor].lp_buffer = (char *) kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); 528 lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL);
529 if (!lp_table[minor].lp_buffer) { 529 if (!lp_table[minor].lp_buffer) {
530 LP_F(minor) &= ~LP_BUSY; 530 LP_F(minor) &= ~LP_BUSY;
531 return -ENOMEM; 531 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;
315static int mxser_set_baud_method[MXSER_PORTS + 1]; 315static int mxser_set_baud_method[MXSER_PORTS + 1];
316static spinlock_t gm_lock; 316static spinlock_t gm_lock;
317 317
318#ifdef CONFIG_PCI
318static int CheckIsMoxaMust(int io) 319static int CheckIsMoxaMust(int io)
319{ 320{
320 u8 oldmcr, hwid; 321 u8 oldmcr, hwid;
@@ -337,6 +338,7 @@ static int CheckIsMoxaMust(int io)
337 } 338 }
338 return MOXA_OTHER_UART; 339 return MOXA_OTHER_UART;
339} 340}
341#endif
340 342
341static void process_txrx_fifo(struct mxser_port *info) 343static void process_txrx_fifo(struct mxser_port *info)
342{ 344{
@@ -2380,9 +2382,11 @@ static void mxser_release_res(struct mxser_board *brd, struct pci_dev *pdev,
2380 if (irq) 2382 if (irq)
2381 free_irq(brd->irq, brd); 2383 free_irq(brd->irq, brd);
2382 if (pdev != NULL) { /* PCI */ 2384 if (pdev != NULL) { /* PCI */
2385#ifdef CONFIG_PCI
2383 pci_release_region(pdev, 2); 2386 pci_release_region(pdev, 2);
2384 pci_release_region(pdev, 3); 2387 pci_release_region(pdev, 3);
2385 pci_dev_put(pdev); 2388 pci_dev_put(pdev);
2389#endif
2386 } else { 2390 } else {
2387 release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); 2391 release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
2388 release_region(brd->vector, 1); 2392 release_region(brd->vector, 1);
@@ -2546,6 +2550,7 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
2546static int __devinit mxser_probe(struct pci_dev *pdev, 2550static int __devinit mxser_probe(struct pci_dev *pdev,
2547 const struct pci_device_id *ent) 2551 const struct pci_device_id *ent)
2548{ 2552{
2553#ifdef CONFIG_PCI
2549 struct mxser_board *brd; 2554 struct mxser_board *brd;
2550 unsigned int i, j; 2555 unsigned int i, j;
2551 unsigned long ioaddress; 2556 unsigned long ioaddress;
@@ -2644,6 +2649,9 @@ err_relio:
2644 brd->info = NULL; 2649 brd->info = NULL;
2645err: 2650err:
2646 return retval; 2651 return retval;
2652#else
2653 return -ENODEV;
2654#endif
2647} 2655}
2648 2656
2649static void __devexit mxser_remove(struct pci_dev *pdev) 2657static 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);
125static void receive_char(struct r3964_info *pInfo, const unsigned char c); 125static void receive_char(struct r3964_info *pInfo, const unsigned char c);
126static void receive_error(struct r3964_info *pInfo, const char flag); 126static void receive_error(struct r3964_info *pInfo, const char flag);
127static void on_timeout(unsigned long priv); 127static void on_timeout(unsigned long priv);
128static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg); 128static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg);
129static int read_telegram(struct r3964_info *pInfo, pid_t pid, unsigned char __user *buf); 129static int read_telegram(struct r3964_info *pInfo, struct pid *pid, unsigned char __user *buf);
130static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg, 130static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg,
131 int error_code, struct r3964_block_header *pBlock); 131 int error_code, struct r3964_block_header *pBlock);
132static struct r3964_message* remove_msg(struct r3964_info *pInfo, 132static struct r3964_message* remove_msg(struct r3964_info *pInfo,
@@ -829,7 +829,7 @@ static void on_timeout(unsigned long priv)
829} 829}
830 830
831static struct r3964_client_info *findClient( 831static struct r3964_client_info *findClient(
832 struct r3964_info *pInfo, pid_t pid) 832 struct r3964_info *pInfo, struct pid *pid)
833{ 833{
834 struct r3964_client_info *pClient; 834 struct r3964_client_info *pClient;
835 835
@@ -843,7 +843,7 @@ static struct r3964_client_info *findClient(
843 return NULL; 843 return NULL;
844} 844}
845 845
846static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) 846static int enable_signals(struct r3964_info *pInfo, struct pid *pid, int arg)
847{ 847{
848 struct r3964_client_info *pClient; 848 struct r3964_client_info *pClient;
849 struct r3964_client_info **ppClient; 849 struct r3964_client_info **ppClient;
@@ -858,7 +858,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
858 858
859 if(pClient->pid == pid) 859 if(pClient->pid == pid)
860 { 860 {
861 TRACE_PS("removing client %d from client list", pid); 861 TRACE_PS("removing client %d from client list", pid_nr(pid));
862 *ppClient = pClient->next; 862 *ppClient = pClient->next;
863 while(pClient->msg_count) 863 while(pClient->msg_count)
864 { 864 {
@@ -869,6 +869,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
869 TRACE_M("enable_signals - msg kfree %p",pMsg); 869 TRACE_M("enable_signals - msg kfree %p",pMsg);
870 } 870 }
871 } 871 }
872 put_pid(pClient->pid);
872 kfree(pClient); 873 kfree(pClient);
873 TRACE_M("enable_signals - kfree %p",pClient); 874 TRACE_M("enable_signals - kfree %p",pClient);
874 return 0; 875 return 0;
@@ -892,10 +893,10 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
892 if(pClient==NULL) 893 if(pClient==NULL)
893 return -ENOMEM; 894 return -ENOMEM;
894 895
895 TRACE_PS("add client %d to client list", pid); 896 TRACE_PS("add client %d to client list", pid_nr(pid));
896 spin_lock_init(&pClient->lock); 897 spin_lock_init(&pClient->lock);
897 pClient->sig_flags=arg; 898 pClient->sig_flags=arg;
898 pClient->pid = pid; 899 pClient->pid = get_pid(pid);
899 pClient->next=pInfo->firstClient; 900 pClient->next=pInfo->firstClient;
900 pClient->first_msg = NULL; 901 pClient->first_msg = NULL;
901 pClient->last_msg = NULL; 902 pClient->last_msg = NULL;
@@ -908,7 +909,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
908 return 0; 909 return 0;
909} 910}
910 911
911static int read_telegram(struct r3964_info *pInfo, pid_t pid, unsigned char __user *buf) 912static int read_telegram(struct r3964_info *pInfo, struct pid *pid, unsigned char __user *buf)
912{ 913{
913 struct r3964_client_info *pClient; 914 struct r3964_client_info *pClient;
914 struct r3964_block_header *block; 915 struct r3964_block_header *block;
@@ -1005,7 +1006,7 @@ queue_the_message:
1005 /* Send SIGIO signal to client process: */ 1006 /* Send SIGIO signal to client process: */
1006 if(pClient->sig_flags & R3964_USE_SIGIO) 1007 if(pClient->sig_flags & R3964_USE_SIGIO)
1007 { 1008 {
1008 kill_proc(pClient->pid, SIGIO, 1); 1009 kill_pid(pClient->pid, SIGIO, 1);
1009 } 1010 }
1010} 1011}
1011 1012
@@ -1042,7 +1043,7 @@ static void remove_client_block(struct r3964_info *pInfo,
1042{ 1043{
1043 struct r3964_block_header *block; 1044 struct r3964_block_header *block;
1044 1045
1045 TRACE_PS("remove_client_block PID %d", pClient->pid); 1046 TRACE_PS("remove_client_block PID %d", pid_nr(pClient->pid));
1046 1047
1047 block=pClient->next_block_to_read; 1048 block=pClient->next_block_to_read;
1048 if(block) 1049 if(block)
@@ -1157,6 +1158,7 @@ static void r3964_close(struct tty_struct *tty)
1157 TRACE_M("r3964_close - msg kfree %p",pMsg); 1158 TRACE_M("r3964_close - msg kfree %p",pMsg);
1158 } 1159 }
1159 } 1160 }
1161 put_pid(pClient->pid);
1160 kfree(pClient); 1162 kfree(pClient);
1161 TRACE_M("r3964_close - client kfree %p",pClient); 1163 TRACE_M("r3964_close - client kfree %p",pClient);
1162 pClient=pNext; 1164 pClient=pNext;
@@ -1193,12 +1195,11 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
1193 struct r3964_client_message theMsg; 1195 struct r3964_client_message theMsg;
1194 DECLARE_WAITQUEUE (wait, current); 1196 DECLARE_WAITQUEUE (wait, current);
1195 1197
1196 int pid = current->pid;
1197 int count; 1198 int count;
1198 1199
1199 TRACE_L("read()"); 1200 TRACE_L("read()");
1200 1201
1201 pClient=findClient(pInfo, pid); 1202 pClient=findClient(pInfo, task_pid(current));
1202 if(pClient) 1203 if(pClient)
1203 { 1204 {
1204 pMsg = remove_msg(pInfo, pClient); 1205 pMsg = remove_msg(pInfo, pClient);
@@ -1252,7 +1253,6 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file,
1252 struct r3964_block_header *pHeader; 1253 struct r3964_block_header *pHeader;
1253 struct r3964_client_info *pClient; 1254 struct r3964_client_info *pClient;
1254 unsigned char *new_data; 1255 unsigned char *new_data;
1255 int pid;
1256 1256
1257 TRACE_L("write request, %d characters", count); 1257 TRACE_L("write request, %d characters", count);
1258/* 1258/*
@@ -1295,9 +1295,7 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file,
1295 pHeader->locks = 0; 1295 pHeader->locks = 0;
1296 pHeader->owner = NULL; 1296 pHeader->owner = NULL;
1297 1297
1298 pid=current->pid; 1298 pClient=findClient(pInfo, task_pid(current));
1299
1300 pClient=findClient(pInfo, pid);
1301 if(pClient) 1299 if(pClient)
1302 { 1300 {
1303 pHeader->owner = pClient; 1301 pHeader->owner = pClient;
@@ -1328,7 +1326,7 @@ static int r3964_ioctl(struct tty_struct * tty, struct file * file,
1328 switch(cmd) 1326 switch(cmd)
1329 { 1327 {
1330 case R3964_ENABLE_SIGNALS: 1328 case R3964_ENABLE_SIGNALS:
1331 return enable_signals(pInfo, current->pid, arg); 1329 return enable_signals(pInfo, task_pid(current), arg);
1332 case R3964_SETPRIORITY: 1330 case R3964_SETPRIORITY:
1333 if(arg<R3964_MASTER || arg>R3964_SLAVE) 1331 if(arg<R3964_MASTER || arg>R3964_SLAVE)
1334 return -EINVAL; 1332 return -EINVAL;
@@ -1341,7 +1339,7 @@ static int r3964_ioctl(struct tty_struct * tty, struct file * file,
1341 pInfo->flags &= ~R3964_BCC; 1339 pInfo->flags &= ~R3964_BCC;
1342 return 0; 1340 return 0;
1343 case R3964_READ_TELEGRAM: 1341 case R3964_READ_TELEGRAM:
1344 return read_telegram(pInfo, current->pid, (unsigned char __user *)arg); 1342 return read_telegram(pInfo, task_pid(current), (unsigned char __user *)arg);
1345 default: 1343 default:
1346 return -ENOIOCTLCMD; 1344 return -ENOIOCTLCMD;
1347 } 1345 }
@@ -1357,7 +1355,6 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file,
1357 struct poll_table_struct *wait) 1355 struct poll_table_struct *wait)
1358{ 1356{
1359 struct r3964_info *pInfo=(struct r3964_info*)tty->disc_data; 1357 struct r3964_info *pInfo=(struct r3964_info*)tty->disc_data;
1360 int pid=current->pid;
1361 struct r3964_client_info *pClient; 1358 struct r3964_client_info *pClient;
1362 struct r3964_message *pMsg=NULL; 1359 struct r3964_message *pMsg=NULL;
1363 unsigned long flags; 1360 unsigned long flags;
@@ -1365,7 +1362,7 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file,
1365 1362
1366 TRACE_L("POLL"); 1363 TRACE_L("POLL");
1367 1364
1368 pClient=findClient(pInfo,pid); 1365 pClient=findClient(pInfo, task_pid(current));
1369 if(pClient) 1366 if(pClient)
1370 { 1367 {
1371 poll_wait(file, &pInfo->read_wait, wait); 1368 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,
1151 n = min(*nr, n); 1151 n = min(*nr, n);
1152 spin_unlock_irqrestore(&tty->read_lock, flags); 1152 spin_unlock_irqrestore(&tty->read_lock, flags);
1153 if (n) { 1153 if (n) {
1154 mb();
1155 retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n); 1154 retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
1156 n -= retval; 1155 n -= retval;
1157 spin_lock_irqsave(&tty->read_lock, flags); 1156 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)
541 if (debug_level >= DEBUG_LEVEL_INFO) 541 if (debug_level >= DEBUG_LEVEL_INFO)
542 printk("mgslpc_attach\n"); 542 printk("mgslpc_attach\n");
543 543
544 info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); 544 info = kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
545 if (!info) { 545 if (!info) {
546 printk("Error can't allocate device instance data\n"); 546 printk("Error can't allocate device instance data\n");
547 return -ENOMEM; 547 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)
556{ 556{
557 struct CmdBlk *CmdBlkP; 557 struct CmdBlk *CmdBlkP;
558 558
559 CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); 559 CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
560 if (CmdBlkP) 560 if (CmdBlkP)
561 memset(CmdBlkP, 0, sizeof(struct CmdBlk)); 561 memset(CmdBlkP, 0, sizeof(struct CmdBlk));
562 return CmdBlkP; 562 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;
113#define hpet_set_rtc_irq_bit(arg) 0 113#define hpet_set_rtc_irq_bit(arg) 0
114#define hpet_rtc_timer_init() do { } while (0) 114#define hpet_rtc_timer_init() do { } while (0)
115#define hpet_rtc_dropped_irq() 0 115#define hpet_rtc_dropped_irq() 0
116static inline irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) {return 0;} 116static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) {return 0;}
117#else 117#else
118extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); 118extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
119#endif 119#endif
@@ -165,7 +165,9 @@ static void mask_rtc_irq_bit(unsigned char bit)
165} 165}
166#endif 166#endif
167 167
168#ifdef CONFIG_PROC_FS
168static int rtc_proc_open(struct inode *inode, struct file *file); 169static int rtc_proc_open(struct inode *inode, struct file *file);
170#endif
169 171
170/* 172/*
171 * Bits in rtc_status. (6 bits of room for future expansion) 173 * Bits in rtc_status. (6 bits of room for future expansion)
@@ -906,6 +908,7 @@ static struct miscdevice rtc_dev = {
906 .fops = &rtc_fops, 908 .fops = &rtc_fops,
907}; 909};
908 910
911#ifdef CONFIG_PROC_FS
909static const struct file_operations rtc_proc_fops = { 912static const struct file_operations rtc_proc_fops = {
910 .owner = THIS_MODULE, 913 .owner = THIS_MODULE,
911 .open = rtc_proc_open, 914 .open = rtc_proc_open,
@@ -913,14 +916,13 @@ static const struct file_operations rtc_proc_fops = {
913 .llseek = seq_lseek, 916 .llseek = seq_lseek,
914 .release = single_release, 917 .release = single_release,
915}; 918};
916
917#if defined(RTC_IRQ) && !defined(__sparc__)
918static irq_handler_t rtc_int_handler_ptr;
919#endif 919#endif
920 920
921static int __init rtc_init(void) 921static int __init rtc_init(void)
922{ 922{
923#ifdef CONFIG_PROC_FS
923 struct proc_dir_entry *ent; 924 struct proc_dir_entry *ent;
925#endif
924#if defined(__alpha__) || defined(__mips__) 926#if defined(__alpha__) || defined(__mips__)
925 unsigned int year, ctrl; 927 unsigned int year, ctrl;
926 char *guess = NULL; 928 char *guess = NULL;
@@ -932,9 +934,11 @@ static int __init rtc_init(void)
932 struct sparc_isa_bridge *isa_br; 934 struct sparc_isa_bridge *isa_br;
933 struct sparc_isa_device *isa_dev; 935 struct sparc_isa_device *isa_dev;
934#endif 936#endif
935#endif 937#else
936#ifndef __sparc__
937 void *r; 938 void *r;
939#ifdef RTC_IRQ
940 irq_handler_t rtc_int_handler_ptr;
941#endif
938#endif 942#endif
939 943
940#ifdef __sparc__ 944#ifdef __sparc__
@@ -958,6 +962,7 @@ static int __init rtc_init(void)
958 } 962 }
959 } 963 }
960#endif 964#endif
965 rtc_has_irq = 0;
961 printk(KERN_ERR "rtc_init: no PC rtc found\n"); 966 printk(KERN_ERR "rtc_init: no PC rtc found\n");
962 return -EIO; 967 return -EIO;
963 968
@@ -972,6 +977,7 @@ found:
972 * PCI Slot 2 INTA# (and some INTx# in Slot 1). 977 * PCI Slot 2 INTA# (and some INTx# in Slot 1).
973 */ 978 */
974 if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { 979 if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) {
980 rtc_has_irq = 0;
975 printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); 981 printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq);
976 return -EIO; 982 return -EIO;
977 } 983 }
@@ -982,6 +988,9 @@ no_irq:
982 else 988 else
983 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); 989 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
984 if (!r) { 990 if (!r) {
991#ifdef RTC_IRQ
992 rtc_has_irq = 0;
993#endif
985 printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", 994 printk(KERN_ERR "rtc: I/O resource %lx is not free.\n",
986 (long)(RTC_PORT(0))); 995 (long)(RTC_PORT(0)));
987 return -EIO; 996 return -EIO;
@@ -996,6 +1005,7 @@ no_irq:
996 1005
997 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { 1006 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) {
998 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ 1007 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
1008 rtc_has_irq = 0;
999 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); 1009 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
1000 if (RTC_IOMAPPED) 1010 if (RTC_IOMAPPED)
1001 release_region(RTC_PORT(0), RTC_IO_EXTENT); 1011 release_region(RTC_PORT(0), RTC_IO_EXTENT);
@@ -1012,21 +1022,19 @@ no_irq:
1012 if (misc_register(&rtc_dev)) { 1022 if (misc_register(&rtc_dev)) {
1013#ifdef RTC_IRQ 1023#ifdef RTC_IRQ
1014 free_irq(RTC_IRQ, NULL); 1024 free_irq(RTC_IRQ, NULL);
1025 rtc_has_irq = 0;
1015#endif 1026#endif
1016 release_region(RTC_PORT(0), RTC_IO_EXTENT); 1027 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1017 return -ENODEV; 1028 return -ENODEV;
1018 } 1029 }
1019 1030
1031#ifdef CONFIG_PROC_FS
1020 ent = create_proc_entry("driver/rtc", 0, NULL); 1032 ent = create_proc_entry("driver/rtc", 0, NULL);
1021 if (!ent) { 1033 if (ent)
1022#ifdef RTC_IRQ 1034 ent->proc_fops = &rtc_proc_fops;
1023 free_irq(RTC_IRQ, NULL); 1035 else
1036 printk(KERN_WARNING "rtc: Failed to register with procfs.\n");
1024#endif 1037#endif
1025 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1026 misc_deregister(&rtc_dev);
1027 return -ENOMEM;
1028 }
1029 ent->proc_fops = &rtc_proc_fops;
1030 1038
1031#if defined(__alpha__) || defined(__mips__) 1039#if defined(__alpha__) || defined(__mips__)
1032 rtc_freq = HZ; 1040 rtc_freq = HZ;
@@ -1159,6 +1167,7 @@ static void rtc_dropped_irq(unsigned long data)
1159} 1167}
1160#endif 1168#endif
1161 1169
1170#ifdef CONFIG_PROC_FS
1162/* 1171/*
1163 * Info exported via "/proc/driver/rtc". 1172 * Info exported via "/proc/driver/rtc".
1164 */ 1173 */
@@ -1243,6 +1252,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1243{ 1252{
1244 return single_open(file, rtc_proc_show, NULL); 1253 return single_open(file, rtc_proc_show, NULL);
1245} 1254}
1255#endif
1246 1256
1247void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1257void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1248{ 1258{
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,
2498 /* It is safe/allowed to del_timer a non-active timer */ 2498 /* It is safe/allowed to del_timer a non-active timer */
2499 del_timer(&board->timer); 2499 del_timer(&board->timer);
2500 if (pdev) { 2500 if (pdev) {
2501#ifdef CONFIG_PCI
2501 pci_iounmap(pdev, board->base); 2502 pci_iounmap(pdev, board->base);
2502 pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2); 2503 pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2);
2504#endif
2503 } else { 2505 } else {
2504 iounmap(board->base); 2506 iounmap(board->base);
2505 release_region(board->hw_base, board->hw_len); 2507 release_region(board->hw_base, board->hw_len);
@@ -2601,6 +2603,7 @@ static struct eisa_driver sx_eisadriver = {
2601 2603
2602#endif 2604#endif
2603 2605
2606#ifdef CONFIG_PCI
2604 /******************************************************** 2607 /********************************************************
2605 * Setting bit 17 in the CNTRL register of the PLX 9050 * 2608 * Setting bit 17 in the CNTRL register of the PLX 9050 *
2606 * chip forces a retry on writes while a read is pending.* 2609 * 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)
2632 } 2635 }
2633 iounmap(rebase); 2636 iounmap(rebase);
2634} 2637}
2638#endif
2635 2639
2636static int __devinit sx_pci_probe(struct pci_dev *pdev, 2640static int __devinit sx_pci_probe(struct pci_dev *pdev,
2637 const struct pci_device_id *ent) 2641 const struct pci_device_id *ent)
2638{ 2642{
2643#ifdef CONFIG_PCI
2639 struct sx_board *board; 2644 struct sx_board *board;
2640 unsigned int i, reg; 2645 unsigned int i, reg;
2641 int retval = -EIO; 2646 int retval = -EIO;
@@ -2700,6 +2705,9 @@ err_flag:
2700 board->flags &= ~SX_BOARD_PRESENT; 2705 board->flags &= ~SX_BOARD_PRESENT;
2701err: 2706err:
2702 return retval; 2707 return retval;
2708#else
2709 return -ENODEV;
2710#endif
2703} 2711}
2704 2712
2705static void __devexit sx_pci_remove(struct pci_dev *pdev) 2713static 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)
4332{ 4332{
4333 struct mgsl_struct *info; 4333 struct mgsl_struct *info;
4334 4334
4335 info = (struct mgsl_struct *)kmalloc(sizeof(struct mgsl_struct), 4335 info = kmalloc(sizeof(struct mgsl_struct),
4336 GFP_KERNEL); 4336 GFP_KERNEL);
4337 4337
4338 if (!info) { 4338 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)
2730 return 0; 2730 return 0;
2731 2731
2732 if (!info->tx_buf) { 2732 if (!info->tx_buf) {
2733 info->tx_buf = (unsigned char *)kmalloc(info->max_frame_size, GFP_KERNEL); 2733 info->tx_buf = kmalloc(info->max_frame_size, GFP_KERNEL);
2734 if (!info->tx_buf) { 2734 if (!info->tx_buf) {
2735 printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", 2735 printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n",
2736 __FILE__,__LINE__,info->device_name); 2736 __FILE__,__LINE__,info->device_name);
@@ -3798,7 +3798,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
3798{ 3798{
3799 SLMP_INFO *info; 3799 SLMP_INFO *info;
3800 3800
3801 info = (SLMP_INFO *)kmalloc(sizeof(SLMP_INFO), 3801 info = kmalloc(sizeof(SLMP_INFO),
3802 GFP_KERNEL); 3802 GFP_KERNEL);
3803 3803
3804 if (!info) { 3804 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 @@
41#include <asm/irq_regs.h> 41#include <asm/irq_regs.h>
42 42
43/* Whether we react on sysrq keys or just ignore them */ 43/* Whether we react on sysrq keys or just ignore them */
44int sysrq_enabled = 1; 44int __read_mostly __sysrq_enabled = 1;
45
46static int __read_mostly sysrq_always_enabled;
47
48int sysrq_on(void)
49{
50 return __sysrq_enabled || sysrq_always_enabled;
51}
52
53/*
54 * A value of 1 means 'all', other nonzero values are an op mask:
55 */
56static inline int sysrq_on_mask(int mask)
57{
58 return sysrq_always_enabled || __sysrq_enabled == 1 ||
59 (__sysrq_enabled & mask);
60}
61
62static int __init sysrq_always_enabled_setup(char *str)
63{
64 sysrq_always_enabled = 1;
65 printk(KERN_INFO "debug: sysrq always enabled.\n");
66
67 return 1;
68}
69
70__setup("sysrq_always_enabled", sysrq_always_enabled_setup);
71
45 72
46static void sysrq_handle_loglevel(int key, struct tty_struct *tty) 73static void sysrq_handle_loglevel(int key, struct tty_struct *tty)
47{ 74{
@@ -379,8 +406,7 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
379 * Should we check for enabled operations (/proc/sysrq-trigger 406 * Should we check for enabled operations (/proc/sysrq-trigger
380 * should not) and is the invoked operation enabled? 407 * should not) and is the invoked operation enabled?
381 */ 408 */
382 if (!check_mask || sysrq_enabled == 1 || 409 if (!check_mask || sysrq_on_mask(op_p->enable_mask)) {
383 (sysrq_enabled & op_p->enable_mask)) {
384 printk("%s\n", op_p->action_msg); 410 printk("%s\n", op_p->action_msg);
385 console_loglevel = orig_log_level; 411 console_loglevel = orig_log_level;
386 op_p->handler(key, tty); 412 op_p->handler(key, tty);
@@ -414,9 +440,8 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
414 */ 440 */
415void handle_sysrq(int key, struct tty_struct *tty) 441void handle_sysrq(int key, struct tty_struct *tty)
416{ 442{
417 if (!sysrq_enabled) 443 if (sysrq_on())
418 return; 444 __handle_sysrq(key, tty, 1);
419 __handle_sysrq(key, tty, 1);
420} 445}
421EXPORT_SYMBOL(handle_sysrq); 446EXPORT_SYMBOL(handle_sysrq);
422 447
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)
3335 int session; 3335 int session;
3336 int i; 3336 int i;
3337 struct file *filp; 3337 struct file *filp;
3338 struct tty_ldisc *disc;
3339 struct fdtable *fdt; 3338 struct fdtable *fdt;
3340 3339
3341 if (!tty) 3340 if (!tty)
3342 return; 3341 return;
3343 session = tty->session; 3342 session = tty->session;
3344 3343
3345 /* We don't want an ldisc switch during this */ 3344 tty_ldisc_flush(tty);
3346 disc = tty_ldisc_ref(tty);
3347 if (disc && disc->flush_buffer)
3348 disc->flush_buffer(tty);
3349 tty_ldisc_deref(disc);
3350 3345
3351 if (tty->driver->flush_buffer) 3346 if (tty->driver->flush_buffer)
3352 tty->driver->flush_buffer(tty); 3347 tty->driver->flush_buffer(tty);
@@ -3821,6 +3816,7 @@ struct tty_struct *get_current_tty(void)
3821 barrier(); 3816 barrier();
3822 return tty; 3817 return tty;
3823} 3818}
3819EXPORT_SYMBOL_GPL(get_current_tty);
3824 3820
3825/* 3821/*
3826 * Initialize the console device. This is called *early*, so 3822 * 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 @@
61static DEFINE_SPINLOCK(consolelock); 61static DEFINE_SPINLOCK(consolelock);
62static DEFINE_SPINLOCK(consoleloglock); 62static DEFINE_SPINLOCK(consoleloglock);
63 63
64#ifdef CONFIG_MAGIC_SYSRQ
65static int vio_sysrq_pressed; 64static int vio_sysrq_pressed;
66extern int sysrq_enabled;
67#endif
68 65
69#define VIOCHAR_NUM_BUF 16 66#define VIOCHAR_NUM_BUF 16
70 67
@@ -936,8 +933,10 @@ static void vioHandleData(struct HvLpEvent *event)
936 */ 933 */
937 num_pushed = 0; 934 num_pushed = 0;
938 for (index = 0; index < cevent->len; index++) { 935 for (index = 0; index < cevent->len; index++) {
939#ifdef CONFIG_MAGIC_SYSRQ 936 /*
940 if (sysrq_enabled) { 937 * Will be optimized away if !CONFIG_MAGIC_SYSRQ:
938 */
939 if (sysrq_on()) {
941 /* 0x0f is the ascii character for ^O */ 940 /* 0x0f is the ascii character for ^O */
942 if (cevent->data[index] == '\x0f') { 941 if (cevent->data[index] == '\x0f') {
943 vio_sysrq_pressed = 1; 942 vio_sysrq_pressed = 1;
@@ -956,7 +955,6 @@ static void vioHandleData(struct HvLpEvent *event)
956 continue; 955 continue;
957 } 956 }
958 } 957 }
959#endif
960 /* 958 /*
961 * The sysrq sequence isn't included in this check if 959 * The sysrq sequence isn't included in this check if
962 * sysrq is enabled and compiled into the kernel because 960 * 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)
784 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) 784 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
785 return 0; 785 return 0;
786 786
787 newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER); 787 newscreen = kmalloc(new_screen_size, GFP_USER);
788 if (!newscreen) 788 if (!newscreen)
789 return -ENOMEM; 789 return -ENOMEM;
790 790
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
129 !capable(CAP_SYS_RESOURCE)) 129 !capable(CAP_SYS_RESOURCE))
130 return -EPERM; 130 return -EPERM;
131 131
132 key_map = (ushort *) kmalloc(sizeof(plain_map), 132 key_map = kmalloc(sizeof(plain_map),
133 GFP_KERNEL); 133 GFP_KERNEL);
134 if (!key_map) 134 if (!key_map)
135 return -ENOMEM; 135 return -ENOMEM;
@@ -259,7 +259,7 @@ do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
259 sz = 256; 259 sz = 256;
260 while (sz < funcbufsize - funcbufleft + delta) 260 while (sz < funcbufsize - funcbufleft + delta)
261 sz <<= 1; 261 sz <<= 1;
262 fnw = (char *) kmalloc(sz, GFP_KERNEL); 262 fnw = kmalloc(sz, GFP_KERNEL);
263 if(!fnw) { 263 if(!fnw) {
264 ret = -ENOMEM; 264 ret = -ENOMEM;
265 goto reterr; 265 goto reterr;
@@ -1087,7 +1087,7 @@ static void complete_change_console(struct vc_data *vc)
1087 switch_screen(vc); 1087 switch_screen(vc);
1088 1088
1089 /* 1089 /*
1090 * This can't appear below a successful kill_proc(). If it did, 1090 * This can't appear below a successful kill_pid(). If it did,
1091 * then the *blank_screen operation could occur while X, having 1091 * then the *blank_screen operation could occur while X, having
1092 * received acqsig, is waking up on another processor. This 1092 * received acqsig, is waking up on another processor. This
1093 * condition can lead to overlapping accesses to the VGA range 1093 * condition can lead to overlapping accesses to the VGA range
@@ -1110,7 +1110,7 @@ static void complete_change_console(struct vc_data *vc)
1110 */ 1110 */
1111 if (vc->vt_mode.mode == VT_PROCESS) { 1111 if (vc->vt_mode.mode == VT_PROCESS) {
1112 /* 1112 /*
1113 * Send the signal as privileged - kill_proc() will 1113 * Send the signal as privileged - kill_pid() will
1114 * tell us if the process has gone or something else 1114 * tell us if the process has gone or something else
1115 * is awry 1115 * is awry
1116 */ 1116 */
@@ -1170,7 +1170,7 @@ void change_console(struct vc_data *new_vc)
1170 vc = vc_cons[fg_console].d; 1170 vc = vc_cons[fg_console].d;
1171 if (vc->vt_mode.mode == VT_PROCESS) { 1171 if (vc->vt_mode.mode == VT_PROCESS) {
1172 /* 1172 /*
1173 * Send the signal as privileged - kill_proc() will 1173 * Send the signal as privileged - kill_pid() will
1174 * tell us if the process has gone or something else 1174 * tell us if the process has gone or something else
1175 * is awry 1175 * is awry
1176 */ 1176 */