diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/apm-emulation.c | 2 | ||||
-rw-r--r-- | drivers/char/bfin-otp.c | 2 | ||||
-rw-r--r-- | drivers/char/cyclades.c | 2 | ||||
-rw-r--r-- | drivers/char/dtlk.c | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 4 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_devintf.c | 1 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 1 | ||||
-rw-r--r-- | drivers/char/pty.c | 47 | ||||
-rw-r--r-- | drivers/char/serial167.c | 7 | ||||
-rw-r--r-- | drivers/char/tty_ldisc.c | 7 | ||||
-rw-r--r-- | drivers/char/vt_ioctl.c | 6 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 |
12 files changed, 43 insertions, 39 deletions
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index aaca40283be9..4f568cb9af3f 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -393,7 +393,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
393 | return as ? 0 : -ENOMEM; | 393 | return as ? 0 : -ENOMEM; |
394 | } | 394 | } |
395 | 395 | ||
396 | static struct file_operations apm_bios_fops = { | 396 | static const struct file_operations apm_bios_fops = { |
397 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
398 | .read = apm_read, | 398 | .read = apm_read, |
399 | .poll = apm_poll, | 399 | .poll = apm_poll, |
diff --git a/drivers/char/bfin-otp.c b/drivers/char/bfin-otp.c index e3dd24bff514..836d4f0a876f 100644 --- a/drivers/char/bfin-otp.c +++ b/drivers/char/bfin-otp.c | |||
@@ -217,7 +217,7 @@ static long bfin_otp_ioctl(struct file *filp, unsigned cmd, unsigned long arg) | |||
217 | # define bfin_otp_ioctl NULL | 217 | # define bfin_otp_ioctl NULL |
218 | #endif | 218 | #endif |
219 | 219 | ||
220 | static struct file_operations bfin_otp_fops = { | 220 | static const struct file_operations bfin_otp_fops = { |
221 | .owner = THIS_MODULE, | 221 | .owner = THIS_MODULE, |
222 | .unlocked_ioctl = bfin_otp_ioctl, | 222 | .unlocked_ioctl = bfin_otp_ioctl, |
223 | .read = bfin_otp_read, | 223 | .read = bfin_otp_read, |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index df5038bbcbc2..4254457d3911 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -3354,7 +3354,7 @@ static int __init cy_detect_isa(void) | |||
3354 | continue; | 3354 | continue; |
3355 | } | 3355 | } |
3356 | #ifdef MODULE | 3356 | #ifdef MODULE |
3357 | if (isparam && irq[i]) | 3357 | if (isparam && i < NR_CARDS && irq[i]) |
3358 | cy_isa_irq = irq[i]; | 3358 | cy_isa_irq = irq[i]; |
3359 | else | 3359 | else |
3360 | #endif | 3360 | #endif |
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 52e06589821d..045c930e6320 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/errno.h> /* for -EBUSY */ | 56 | #include <linux/errno.h> /* for -EBUSY */ |
57 | #include <linux/ioport.h> /* for request_region */ | 57 | #include <linux/ioport.h> /* for request_region */ |
58 | #include <linux/delay.h> /* for loops_per_jiffy */ | 58 | #include <linux/delay.h> /* for loops_per_jiffy */ |
59 | #include <linux/sched.h> | ||
59 | #include <linux/smp_lock.h> /* cycle_kernel_lock() */ | 60 | #include <linux/smp_lock.h> /* cycle_kernel_lock() */ |
60 | #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ | 61 | #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ |
61 | #include <asm/uaccess.h> /* for get_user, etc. */ | 62 | #include <asm/uaccess.h> /* for get_user, etc. */ |
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 00dd3de1be51..06aad0831c73 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -116,7 +116,7 @@ static int __devinit omap_rng_probe(struct platform_device *pdev) | |||
116 | if (!res) | 116 | if (!res) |
117 | return -ENOENT; | 117 | return -ENOENT; |
118 | 118 | ||
119 | mem = request_mem_region(res->start, res->end - res->start + 1, | 119 | mem = request_mem_region(res->start, resource_size(res), |
120 | pdev->name); | 120 | pdev->name); |
121 | if (mem == NULL) { | 121 | if (mem == NULL) { |
122 | ret = -EBUSY; | 122 | ret = -EBUSY; |
@@ -124,7 +124,7 @@ static int __devinit omap_rng_probe(struct platform_device *pdev) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | dev_set_drvdata(&pdev->dev, mem); | 126 | dev_set_drvdata(&pdev->dev, mem); |
127 | rng_base = ioremap(res->start, res->end - res->start + 1); | 127 | rng_base = ioremap(res->start, resource_size(res)); |
128 | if (!rng_base) { | 128 | if (!rng_base) { |
129 | ret = -ENOMEM; | 129 | ret = -ENOMEM; |
130 | goto err_ioremap; | 130 | goto err_ioremap; |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 41fc11dc921c..65545de3dbf4 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
37 | #include <asm/system.h> | 37 | #include <asm/system.h> |
38 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
39 | #include <linux/sched.h> | ||
39 | #include <linux/spinlock.h> | 40 | #include <linux/spinlock.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
41 | #include <linux/ipmi.h> | 42 | #include <linux/ipmi.h> |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 09050797c76a..ec5e3f8df648 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
36 | #include <asm/system.h> | 36 | #include <asm/system.h> |
37 | #include <linux/poll.h> | 37 | #include <linux/poll.h> |
38 | #include <linux/sched.h> | ||
38 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
39 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 53761cefa915..e066c4fdf81b 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -261,6 +261,9 @@ done: | |||
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | 263 | ||
264 | /* Traditional BSD devices */ | ||
265 | #ifdef CONFIG_LEGACY_PTYS | ||
266 | |||
264 | static int pty_install(struct tty_driver *driver, struct tty_struct *tty) | 267 | static int pty_install(struct tty_driver *driver, struct tty_struct *tty) |
265 | { | 268 | { |
266 | struct tty_struct *o_tty; | 269 | struct tty_struct *o_tty; |
@@ -310,24 +313,6 @@ free_mem_out: | |||
310 | return -ENOMEM; | 313 | return -ENOMEM; |
311 | } | 314 | } |
312 | 315 | ||
313 | |||
314 | static const struct tty_operations pty_ops = { | ||
315 | .install = pty_install, | ||
316 | .open = pty_open, | ||
317 | .close = pty_close, | ||
318 | .write = pty_write, | ||
319 | .write_room = pty_write_room, | ||
320 | .flush_buffer = pty_flush_buffer, | ||
321 | .chars_in_buffer = pty_chars_in_buffer, | ||
322 | .unthrottle = pty_unthrottle, | ||
323 | .set_termios = pty_set_termios, | ||
324 | .resize = pty_resize | ||
325 | }; | ||
326 | |||
327 | /* Traditional BSD devices */ | ||
328 | #ifdef CONFIG_LEGACY_PTYS | ||
329 | static struct tty_driver *pty_driver, *pty_slave_driver; | ||
330 | |||
331 | static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file, | 316 | static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file, |
332 | unsigned int cmd, unsigned long arg) | 317 | unsigned int cmd, unsigned long arg) |
333 | { | 318 | { |
@@ -341,7 +326,12 @@ static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file, | |||
341 | static int legacy_count = CONFIG_LEGACY_PTY_COUNT; | 326 | static int legacy_count = CONFIG_LEGACY_PTY_COUNT; |
342 | module_param(legacy_count, int, 0); | 327 | module_param(legacy_count, int, 0); |
343 | 328 | ||
344 | static const struct tty_operations pty_ops_bsd = { | 329 | /* |
330 | * The master side of a pty can do TIOCSPTLCK and thus | ||
331 | * has pty_bsd_ioctl. | ||
332 | */ | ||
333 | static const struct tty_operations master_pty_ops_bsd = { | ||
334 | .install = pty_install, | ||
345 | .open = pty_open, | 335 | .open = pty_open, |
346 | .close = pty_close, | 336 | .close = pty_close, |
347 | .write = pty_write, | 337 | .write = pty_write, |
@@ -354,8 +344,23 @@ static const struct tty_operations pty_ops_bsd = { | |||
354 | .resize = pty_resize | 344 | .resize = pty_resize |
355 | }; | 345 | }; |
356 | 346 | ||
347 | static const struct tty_operations slave_pty_ops_bsd = { | ||
348 | .install = pty_install, | ||
349 | .open = pty_open, | ||
350 | .close = pty_close, | ||
351 | .write = pty_write, | ||
352 | .write_room = pty_write_room, | ||
353 | .flush_buffer = pty_flush_buffer, | ||
354 | .chars_in_buffer = pty_chars_in_buffer, | ||
355 | .unthrottle = pty_unthrottle, | ||
356 | .set_termios = pty_set_termios, | ||
357 | .resize = pty_resize | ||
358 | }; | ||
359 | |||
357 | static void __init legacy_pty_init(void) | 360 | static void __init legacy_pty_init(void) |
358 | { | 361 | { |
362 | struct tty_driver *pty_driver, *pty_slave_driver; | ||
363 | |||
359 | if (legacy_count <= 0) | 364 | if (legacy_count <= 0) |
360 | return; | 365 | return; |
361 | 366 | ||
@@ -383,7 +388,7 @@ static void __init legacy_pty_init(void) | |||
383 | pty_driver->init_termios.c_ospeed = 38400; | 388 | pty_driver->init_termios.c_ospeed = 38400; |
384 | pty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW; | 389 | pty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW; |
385 | pty_driver->other = pty_slave_driver; | 390 | pty_driver->other = pty_slave_driver; |
386 | tty_set_operations(pty_driver, &pty_ops); | 391 | tty_set_operations(pty_driver, &master_pty_ops_bsd); |
387 | 392 | ||
388 | pty_slave_driver->owner = THIS_MODULE; | 393 | pty_slave_driver->owner = THIS_MODULE; |
389 | pty_slave_driver->driver_name = "pty_slave"; | 394 | pty_slave_driver->driver_name = "pty_slave"; |
@@ -399,7 +404,7 @@ static void __init legacy_pty_init(void) | |||
399 | pty_slave_driver->flags = TTY_DRIVER_RESET_TERMIOS | | 404 | pty_slave_driver->flags = TTY_DRIVER_RESET_TERMIOS | |
400 | TTY_DRIVER_REAL_RAW; | 405 | TTY_DRIVER_REAL_RAW; |
401 | pty_slave_driver->other = pty_driver; | 406 | pty_slave_driver->other = pty_driver; |
402 | tty_set_operations(pty_slave_driver, &pty_ops); | 407 | tty_set_operations(pty_slave_driver, &slave_pty_ops_bsd); |
403 | 408 | ||
404 | if (tty_register_driver(pty_driver)) | 409 | if (tty_register_driver(pty_driver)) |
405 | panic("Couldn't register pty driver"); | 410 | panic("Couldn't register pty driver"); |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 5942a9d674c0..452370af95de 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -220,8 +220,7 @@ static inline int serial_paranoia_check(struct cyclades_port *info, char *name, | |||
220 | return 1; | 220 | return 1; |
221 | } | 221 | } |
222 | 222 | ||
223 | if ((long)info < (long)(&cy_port[0]) | 223 | if (info < &cy_port[0] || info >= &cy_port[NR_PORTS]) { |
224 | || (long)(&cy_port[NR_PORTS]) < (long)info) { | ||
225 | printk("Warning: cyclades_port out of range for (%s) in %s\n", | 224 | printk("Warning: cyclades_port out of range for (%s) in %s\n", |
226 | name, routine); | 225 | name, routine); |
227 | return 1; | 226 | return 1; |
@@ -520,15 +519,13 @@ static irqreturn_t cd2401_tx_interrupt(int irq, void *dev_id) | |||
520 | panic("TxInt on debug port!!!"); | 519 | panic("TxInt on debug port!!!"); |
521 | } | 520 | } |
522 | #endif | 521 | #endif |
523 | |||
524 | info = &cy_port[channel]; | ||
525 | |||
526 | /* validate the port number (as configured and open) */ | 522 | /* validate the port number (as configured and open) */ |
527 | if ((channel < 0) || (NR_PORTS <= channel)) { | 523 | if ((channel < 0) || (NR_PORTS <= channel)) { |
528 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); | 524 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); |
529 | base_addr[CyTEOIR] = CyNOTRANS; | 525 | base_addr[CyTEOIR] = CyNOTRANS; |
530 | return IRQ_HANDLED; | 526 | return IRQ_HANDLED; |
531 | } | 527 | } |
528 | info = &cy_port[channel]; | ||
532 | info->last_active = jiffies; | 529 | info->last_active = jiffies; |
533 | if (info->tty == 0) { | 530 | if (info->tty == 0) { |
534 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); | 531 | base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index aafdbaebc16a..feb55075819b 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -518,7 +518,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | |||
518 | static int tty_ldisc_halt(struct tty_struct *tty) | 518 | static int tty_ldisc_halt(struct tty_struct *tty) |
519 | { | 519 | { |
520 | clear_bit(TTY_LDISC, &tty->flags); | 520 | clear_bit(TTY_LDISC, &tty->flags); |
521 | return cancel_delayed_work(&tty->buf.work); | 521 | return cancel_delayed_work_sync(&tty->buf.work); |
522 | } | 522 | } |
523 | 523 | ||
524 | /** | 524 | /** |
@@ -756,12 +756,9 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
756 | * N_TTY. | 756 | * N_TTY. |
757 | */ | 757 | */ |
758 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { | 758 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { |
759 | /* Make sure the old ldisc is quiescent */ | ||
760 | tty_ldisc_halt(tty); | ||
761 | flush_scheduled_work(); | ||
762 | |||
763 | /* Avoid racing set_ldisc or tty_ldisc_release */ | 759 | /* Avoid racing set_ldisc or tty_ldisc_release */ |
764 | mutex_lock(&tty->ldisc_mutex); | 760 | mutex_lock(&tty->ldisc_mutex); |
761 | tty_ldisc_halt(tty); | ||
765 | if (tty->ldisc) { /* Not yet closed */ | 762 | if (tty->ldisc) { /* Not yet closed */ |
766 | /* Switch back to N_TTY */ | 763 | /* Switch back to N_TTY */ |
767 | tty_ldisc_reinit(tty); | 764 | tty_ldisc_reinit(tty); |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 29c651ab0d78..6b36ee56e6fe 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -981,8 +981,10 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
981 | goto eperm; | 981 | goto eperm; |
982 | 982 | ||
983 | if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg, | 983 | if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg, |
984 | sizeof(struct vt_setactivate))) | 984 | sizeof(struct vt_setactivate))) { |
985 | return -EFAULT; | 985 | ret = -EFAULT; |
986 | goto out; | ||
987 | } | ||
986 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) | 988 | if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) |
987 | ret = -ENXIO; | 989 | ret = -ENXIO; |
988 | else { | 990 | else { |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index f40ab699860f..4846d50199f3 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -559,7 +559,7 @@ static int hwicap_release(struct inode *inode, struct file *file) | |||
559 | return status; | 559 | return status; |
560 | } | 560 | } |
561 | 561 | ||
562 | static struct file_operations hwicap_fops = { | 562 | static const struct file_operations hwicap_fops = { |
563 | .owner = THIS_MODULE, | 563 | .owner = THIS_MODULE, |
564 | .write = hwicap_write, | 564 | .write = hwicap_write, |
565 | .read = hwicap_read, | 565 | .read = hwicap_read, |