diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/agp/agp.h | 2 | ||||
-rw-r--r-- | drivers/char/agp/alpha-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_console.c | 6 | ||||
-rw-r--r-- | drivers/char/hvc_console.h | 12 | ||||
-rw-r--r-- | drivers/char/hvc_iucv.c | 4 | ||||
-rw-r--r-- | drivers/char/mem.c | 2 | ||||
-rw-r--r-- | drivers/char/mspec.c | 2 | ||||
-rw-r--r-- | drivers/char/pty.c | 47 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 15 |
9 files changed, 57 insertions, 35 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index d6f36c004d9b..870f12cfed93 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
@@ -131,7 +131,7 @@ struct agp_bridge_driver { | |||
131 | struct agp_bridge_data { | 131 | struct agp_bridge_data { |
132 | const struct agp_version *version; | 132 | const struct agp_version *version; |
133 | const struct agp_bridge_driver *driver; | 133 | const struct agp_bridge_driver *driver; |
134 | struct vm_operations_struct *vm_ops; | 134 | const struct vm_operations_struct *vm_ops; |
135 | void *previous_size; | 135 | void *previous_size; |
136 | void *current_size; | 136 | void *current_size; |
137 | void *dev_private_data; | 137 | void *dev_private_data; |
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c index 5ea4da8e9954..dd84af4d4f7e 100644 --- a/drivers/char/agp/alpha-agp.c +++ b/drivers/char/agp/alpha-agp.c | |||
@@ -40,7 +40,7 @@ static struct aper_size_info_fixed alpha_core_agp_sizes[] = | |||
40 | { 0, 0, 0 }, /* filled in by alpha_core_agp_setup */ | 40 | { 0, 0, 0 }, /* filled in by alpha_core_agp_setup */ |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct vm_operations_struct alpha_core_agp_vm_ops = { | 43 | static const struct vm_operations_struct alpha_core_agp_vm_ops = { |
44 | .fault = alpha_core_agp_vm_fault, | 44 | .fault = alpha_core_agp_vm_fault, |
45 | }; | 45 | }; |
46 | 46 | ||
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 25ce15bb1c08..a632f25f144a 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -678,7 +678,7 @@ int hvc_poll(struct hvc_struct *hp) | |||
678 | EXPORT_SYMBOL_GPL(hvc_poll); | 678 | EXPORT_SYMBOL_GPL(hvc_poll); |
679 | 679 | ||
680 | /** | 680 | /** |
681 | * hvc_resize() - Update terminal window size information. | 681 | * __hvc_resize() - Update terminal window size information. |
682 | * @hp: HVC console pointer | 682 | * @hp: HVC console pointer |
683 | * @ws: Terminal window size structure | 683 | * @ws: Terminal window size structure |
684 | * | 684 | * |
@@ -687,12 +687,12 @@ EXPORT_SYMBOL_GPL(hvc_poll); | |||
687 | * | 687 | * |
688 | * Locking: Locking free; the function MUST be called holding hp->lock | 688 | * Locking: Locking free; the function MUST be called holding hp->lock |
689 | */ | 689 | */ |
690 | void hvc_resize(struct hvc_struct *hp, struct winsize ws) | 690 | void __hvc_resize(struct hvc_struct *hp, struct winsize ws) |
691 | { | 691 | { |
692 | hp->ws = ws; | 692 | hp->ws = ws; |
693 | schedule_work(&hp->tty_resize); | 693 | schedule_work(&hp->tty_resize); |
694 | } | 694 | } |
695 | EXPORT_SYMBOL_GPL(hvc_resize); | 695 | EXPORT_SYMBOL_GPL(__hvc_resize); |
696 | 696 | ||
697 | /* | 697 | /* |
698 | * This kthread is either polling or interrupt driven. This is determined by | 698 | * This kthread is either polling or interrupt driven. This is determined by |
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 3c85d78c975c..10950ca706d8 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define HVC_CONSOLE_H | 28 | #define HVC_CONSOLE_H |
29 | #include <linux/kref.h> | 29 | #include <linux/kref.h> |
30 | #include <linux/tty.h> | 30 | #include <linux/tty.h> |
31 | #include <linux/spinlock.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * This is the max number of console adapters that can/will be found as | 34 | * This is the max number of console adapters that can/will be found as |
@@ -88,7 +89,16 @@ int hvc_poll(struct hvc_struct *hp); | |||
88 | void hvc_kick(void); | 89 | void hvc_kick(void); |
89 | 90 | ||
90 | /* Resize hvc tty terminal window */ | 91 | /* Resize hvc tty terminal window */ |
91 | extern void hvc_resize(struct hvc_struct *hp, struct winsize ws); | 92 | extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws); |
93 | |||
94 | static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws) | ||
95 | { | ||
96 | unsigned long flags; | ||
97 | |||
98 | spin_lock_irqsave(&hp->lock, flags); | ||
99 | __hvc_resize(hp, ws); | ||
100 | spin_unlock_irqrestore(&hp->lock, flags); | ||
101 | } | ||
92 | 102 | ||
93 | /* default notifier for irq based notification */ | 103 | /* default notifier for irq based notification */ |
94 | extern int notifier_add_irq(struct hvc_struct *hp, int data); | 104 | extern int notifier_add_irq(struct hvc_struct *hp, int data); |
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c index 0ecac7e532f6..b8a5d654d3d0 100644 --- a/drivers/char/hvc_iucv.c +++ b/drivers/char/hvc_iucv.c | |||
@@ -273,7 +273,9 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv, | |||
273 | case MSG_TYPE_WINSIZE: | 273 | case MSG_TYPE_WINSIZE: |
274 | if (rb->mbuf->datalen != sizeof(struct winsize)) | 274 | if (rb->mbuf->datalen != sizeof(struct winsize)) |
275 | break; | 275 | break; |
276 | hvc_resize(priv->hvc, *((struct winsize *) rb->mbuf->data)); | 276 | /* The caller must ensure that the hvc is locked, which |
277 | * is the case when called from hvc_iucv_get_chars() */ | ||
278 | __hvc_resize(priv->hvc, *((struct winsize *) rb->mbuf->data)); | ||
277 | break; | 279 | break; |
278 | 280 | ||
279 | case MSG_TYPE_ERROR: /* ignored ... */ | 281 | case MSG_TYPE_ERROR: /* ignored ... */ |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 6c8b65d069e5..a074fceb67d3 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -301,7 +301,7 @@ static inline int private_mapping_ok(struct vm_area_struct *vma) | |||
301 | } | 301 | } |
302 | #endif | 302 | #endif |
303 | 303 | ||
304 | static struct vm_operations_struct mmap_mem_ops = { | 304 | static const struct vm_operations_struct mmap_mem_ops = { |
305 | #ifdef CONFIG_HAVE_IOREMAP_PROT | 305 | #ifdef CONFIG_HAVE_IOREMAP_PROT |
306 | .access = generic_access_phys | 306 | .access = generic_access_phys |
307 | #endif | 307 | #endif |
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c index 30f095a8c2d4..1997270bb6f4 100644 --- a/drivers/char/mspec.c +++ b/drivers/char/mspec.c | |||
@@ -239,7 +239,7 @@ mspec_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
239 | return VM_FAULT_NOPAGE; | 239 | return VM_FAULT_NOPAGE; |
240 | } | 240 | } |
241 | 241 | ||
242 | static struct vm_operations_struct mspec_vm_ops = { | 242 | static const struct vm_operations_struct mspec_vm_ops = { |
243 | .open = mspec_open, | 243 | .open = mspec_open, |
244 | .close = mspec_close, | 244 | .close = mspec_close, |
245 | .fault = mspec_fault, | 245 | .fault = mspec_fault, |
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/tty_io.c b/drivers/char/tty_io.c index ea18a129b0b5..59499ee0fe6a 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1389,7 +1389,7 @@ EXPORT_SYMBOL(tty_shutdown); | |||
1389 | * of ttys that the driver keeps. | 1389 | * of ttys that the driver keeps. |
1390 | * | 1390 | * |
1391 | * This method gets called from a work queue so that the driver private | 1391 | * This method gets called from a work queue so that the driver private |
1392 | * shutdown ops can sleep (needed for USB at least) | 1392 | * cleanup ops can sleep (needed for USB at least) |
1393 | */ | 1393 | */ |
1394 | static void release_one_tty(struct work_struct *work) | 1394 | static void release_one_tty(struct work_struct *work) |
1395 | { | 1395 | { |
@@ -1397,10 +1397,9 @@ static void release_one_tty(struct work_struct *work) | |||
1397 | container_of(work, struct tty_struct, hangup_work); | 1397 | container_of(work, struct tty_struct, hangup_work); |
1398 | struct tty_driver *driver = tty->driver; | 1398 | struct tty_driver *driver = tty->driver; |
1399 | 1399 | ||
1400 | if (tty->ops->shutdown) | 1400 | if (tty->ops->cleanup) |
1401 | tty->ops->shutdown(tty); | 1401 | tty->ops->cleanup(tty); |
1402 | else | 1402 | |
1403 | tty_shutdown(tty); | ||
1404 | tty->magic = 0; | 1403 | tty->magic = 0; |
1405 | tty_driver_kref_put(driver); | 1404 | tty_driver_kref_put(driver); |
1406 | module_put(driver->owner); | 1405 | module_put(driver->owner); |
@@ -1415,6 +1414,12 @@ static void release_one_tty(struct work_struct *work) | |||
1415 | static void queue_release_one_tty(struct kref *kref) | 1414 | static void queue_release_one_tty(struct kref *kref) |
1416 | { | 1415 | { |
1417 | struct tty_struct *tty = container_of(kref, struct tty_struct, kref); | 1416 | struct tty_struct *tty = container_of(kref, struct tty_struct, kref); |
1417 | |||
1418 | if (tty->ops->shutdown) | ||
1419 | tty->ops->shutdown(tty); | ||
1420 | else | ||
1421 | tty_shutdown(tty); | ||
1422 | |||
1418 | /* The hangup queue is now free so we can reuse it rather than | 1423 | /* The hangup queue is now free so we can reuse it rather than |
1419 | waste a chunk of memory for each port */ | 1424 | waste a chunk of memory for each port */ |
1420 | INIT_WORK(&tty->hangup_work, release_one_tty); | 1425 | INIT_WORK(&tty->hangup_work, release_one_tty); |