diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-17 12:17:19 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-17 12:19:31 -0400 |
commit | 9b4f2e9576658c4e52d95dc8d309f51b2e2db096 (patch) | |
tree | 7b1902b0f931783fccc6fee45c6f9c16b4fde5ce /drivers/char | |
parent | 3c6c65f5ed5a6d307bd607aecd06d658c0934d88 (diff) | |
parent | 803db244b9f71102e366fd689000c1417b9a7508 (diff) |
ieee1394: merge from Linus
Conflicts: drivers/ieee1394/hosts.c
Patch "lockdep: annotate ieee1394 skb-queue-head locking" was meddling
with patch "ieee1394: fix kerneldoc of hpsb_alloc_host".
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/char')
121 files changed, 1293 insertions, 446 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index ffcf15c30e90..d9c5a9142ad1 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -1059,7 +1059,7 @@ ioctl_out: | |||
1059 | return ret_val; | 1059 | return ret_val; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | static struct file_operations agp_fops = | 1062 | static const struct file_operations agp_fops = |
1063 | { | 1063 | { |
1064 | .owner = THIS_MODULE, | 1064 | .owner = THIS_MODULE, |
1065 | .llseek = no_llseek, | 1065 | .llseek = no_llseek, |
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index bcc4668835b5..10a389dafd60 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c | |||
@@ -112,7 +112,7 @@ static int ac_ioctl(struct inode *, struct file *, unsigned int, | |||
112 | unsigned long); | 112 | unsigned long); |
113 | static irqreturn_t ac_interrupt(int, void *, struct pt_regs *); | 113 | static irqreturn_t ac_interrupt(int, void *, struct pt_regs *); |
114 | 114 | ||
115 | static struct file_operations ac_fops = { | 115 | static const struct file_operations ac_fops = { |
116 | .owner = THIS_MODULE, | 116 | .owner = THIS_MODULE, |
117 | .llseek = no_llseek, | 117 | .llseek = no_llseek, |
118 | .read = ac_read, | 118 | .read = ac_read, |
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c index 46d66037b917..8ce3f34cfc22 100644 --- a/drivers/char/cs5535_gpio.c +++ b/drivers/char/cs5535_gpio.c | |||
@@ -158,7 +158,7 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file) | |||
158 | return nonseekable_open(inode, file); | 158 | return nonseekable_open(inode, file); |
159 | } | 159 | } |
160 | 160 | ||
161 | static struct file_operations cs5535_gpio_fops = { | 161 | static const struct file_operations cs5535_gpio_fops = { |
162 | .owner = THIS_MODULE, | 162 | .owner = THIS_MODULE, |
163 | .write = cs5535_gpio_write, | 163 | .write = cs5535_gpio_write, |
164 | .read = cs5535_gpio_read, | 164 | .read = cs5535_gpio_read, |
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c index 5bb2234a9094..39a7f685e3fd 100644 --- a/drivers/char/drm/radeon_state.c +++ b/drivers/char/drm/radeon_state.c | |||
@@ -175,6 +175,14 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
175 | } | 175 | } |
176 | break; | 176 | break; |
177 | 177 | ||
178 | case R200_EMIT_VAP_CTL:{ | ||
179 | RING_LOCALS; | ||
180 | BEGIN_RING(2); | ||
181 | OUT_RING_REG(RADEON_SE_TCL_STATE_FLUSH, 0); | ||
182 | ADVANCE_RING(); | ||
183 | } | ||
184 | break; | ||
185 | |||
178 | case RADEON_EMIT_RB3D_COLORPITCH: | 186 | case RADEON_EMIT_RB3D_COLORPITCH: |
179 | case RADEON_EMIT_RE_LINE_PATTERN: | 187 | case RADEON_EMIT_RE_LINE_PATTERN: |
180 | case RADEON_EMIT_SE_LINE_WIDTH: | 188 | case RADEON_EMIT_SE_LINE_WIDTH: |
@@ -202,7 +210,6 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
202 | case R200_EMIT_TCL_LIGHT_MODEL_CTL_0: | 210 | case R200_EMIT_TCL_LIGHT_MODEL_CTL_0: |
203 | case R200_EMIT_TFACTOR_0: | 211 | case R200_EMIT_TFACTOR_0: |
204 | case R200_EMIT_VTX_FMT_0: | 212 | case R200_EMIT_VTX_FMT_0: |
205 | case R200_EMIT_VAP_CTL: | ||
206 | case R200_EMIT_MATRIX_SELECT_0: | 213 | case R200_EMIT_MATRIX_SELECT_0: |
207 | case R200_EMIT_TEX_PROC_CTL_2: | 214 | case R200_EMIT_TEX_PROC_CTL_2: |
208 | case R200_EMIT_TCL_UCP_VERT_BLEND_CTL: | 215 | case R200_EMIT_TCL_UCP_VERT_BLEND_CTL: |
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c index d755cac14bc1..21c8229f5443 100644 --- a/drivers/char/ds1286.c +++ b/drivers/char/ds1286.c | |||
@@ -281,7 +281,7 @@ static unsigned int ds1286_poll(struct file *file, poll_table *wait) | |||
281 | * The various file operations we support. | 281 | * The various file operations we support. |
282 | */ | 282 | */ |
283 | 283 | ||
284 | static struct file_operations ds1286_fops = { | 284 | static const struct file_operations ds1286_fops = { |
285 | .llseek = no_llseek, | 285 | .llseek = no_llseek, |
286 | .read = ds1286_read, | 286 | .read = ds1286_read, |
287 | .poll = ds1286_poll, | 287 | .poll = ds1286_poll, |
diff --git a/drivers/char/ds1302.c b/drivers/char/ds1302.c index 625e8b517005..bcdb107aa967 100644 --- a/drivers/char/ds1302.c +++ b/drivers/char/ds1302.c | |||
@@ -282,7 +282,7 @@ get_rtc_status(char *buf) | |||
282 | 282 | ||
283 | /* The various file operations we support. */ | 283 | /* The various file operations we support. */ |
284 | 284 | ||
285 | static struct file_operations rtc_fops = { | 285 | static const struct file_operations rtc_fops = { |
286 | .owner = THIS_MODULE, | 286 | .owner = THIS_MODULE, |
287 | .ioctl = rtc_ioctl, | 287 | .ioctl = rtc_ioctl, |
288 | }; | 288 | }; |
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index 953e670dcd09..48cb8f0e8ebf 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c | |||
@@ -336,7 +336,7 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset, | |||
336 | static struct proc_dir_entry *proc_therm_ds1620; | 336 | static struct proc_dir_entry *proc_therm_ds1620; |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | static struct file_operations ds1620_fops = { | 339 | static const struct file_operations ds1620_fops = { |
340 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
341 | .open = nonseekable_open, | 341 | .open = nonseekable_open, |
342 | .read = ds1620_read, | 342 | .read = ds1620_read, |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 09b413618b57..9b1bf60ffbe7 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
@@ -483,7 +483,7 @@ static int dsp56k_release(struct inode *inode, struct file *file) | |||
483 | return 0; | 483 | return 0; |
484 | } | 484 | } |
485 | 485 | ||
486 | static struct file_operations dsp56k_fops = { | 486 | static const struct file_operations dsp56k_fops = { |
487 | .owner = THIS_MODULE, | 487 | .owner = THIS_MODULE, |
488 | .read = dsp56k_read, | 488 | .read = dsp56k_read, |
489 | .write = dsp56k_write, | 489 | .write = dsp56k_write, |
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index da2c89f1b8bc..5e82c3bad2e3 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
@@ -94,7 +94,7 @@ static int dtlk_release(struct inode *, struct file *); | |||
94 | static int dtlk_ioctl(struct inode *inode, struct file *file, | 94 | static int dtlk_ioctl(struct inode *inode, struct file *file, |
95 | unsigned int cmd, unsigned long arg); | 95 | unsigned int cmd, unsigned long arg); |
96 | 96 | ||
97 | static struct file_operations dtlk_fops = | 97 | static const struct file_operations dtlk_fops = |
98 | { | 98 | { |
99 | .owner = THIS_MODULE, | 99 | .owner = THIS_MODULE, |
100 | .read = dtlk_read, | 100 | .read = dtlk_read, |
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c index 0090e7a4fcd3..004141d535a2 100644 --- a/drivers/char/efirtc.c +++ b/drivers/char/efirtc.c | |||
@@ -285,7 +285,7 @@ efi_rtc_close(struct inode *inode, struct file *file) | |||
285 | * The various file operations we support. | 285 | * The various file operations we support. |
286 | */ | 286 | */ |
287 | 287 | ||
288 | static struct file_operations efi_rtc_fops = { | 288 | static const struct file_operations efi_rtc_fops = { |
289 | .owner = THIS_MODULE, | 289 | .owner = THIS_MODULE, |
290 | .ioctl = efi_rtc_ioctl, | 290 | .ioctl = efi_rtc_ioctl, |
291 | .open = efi_rtc_open, | 291 | .open = efi_rtc_open, |
diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c index 55272566b740..164a1aa77a2f 100644 --- a/drivers/char/ftape/zftape/zftape-init.c +++ b/drivers/char/ftape/zftape/zftape-init.c | |||
@@ -86,7 +86,7 @@ static ssize_t zft_read (struct file *fp, char __user *buff, | |||
86 | static ssize_t zft_write(struct file *fp, const char __user *buff, | 86 | static ssize_t zft_write(struct file *fp, const char __user *buff, |
87 | size_t req_len, loff_t *ppos); | 87 | size_t req_len, loff_t *ppos); |
88 | 88 | ||
89 | static struct file_operations zft_cdev = | 89 | static const struct file_operations zft_cdev = |
90 | { | 90 | { |
91 | .owner = THIS_MODULE, | 91 | .owner = THIS_MODULE, |
92 | .read = zft_read, | 92 | .read = zft_read, |
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index bebd7e34f792..817dc409ac20 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
@@ -482,7 +482,7 @@ static inline int gen_rtc_proc_init(void) { return 0; } | |||
482 | * The various file operations we support. | 482 | * The various file operations we support. |
483 | */ | 483 | */ |
484 | 484 | ||
485 | static struct file_operations gen_rtc_fops = { | 485 | static const struct file_operations gen_rtc_fops = { |
486 | .owner = THIS_MODULE, | 486 | .owner = THIS_MODULE, |
487 | #ifdef CONFIG_GEN_RTC_X | 487 | #ifdef CONFIG_GEN_RTC_X |
488 | .read = gen_rtc_read, | 488 | .read = gen_rtc_read, |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index e5643f3aa73f..8afba339f05a 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -553,7 +553,7 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) | |||
553 | return err; | 553 | return err; |
554 | } | 554 | } |
555 | 555 | ||
556 | static struct file_operations hpet_fops = { | 556 | static const struct file_operations hpet_fops = { |
557 | .owner = THIS_MODULE, | 557 | .owner = THIS_MODULE, |
558 | .llseek = no_llseek, | 558 | .llseek = no_llseek, |
559 | .read = hpet_read, | 559 | .read = hpet_read, |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index ca2f538e549e..613d67f1c7f0 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -668,6 +668,7 @@ int khvcd(void *unused) | |||
668 | do { | 668 | do { |
669 | poll_mask = 0; | 669 | poll_mask = 0; |
670 | hvc_kicked = 0; | 670 | hvc_kicked = 0; |
671 | try_to_freeze(); | ||
671 | wmb(); | 672 | wmb(); |
672 | if (cpus_empty(cpus_in_xmon)) { | 673 | if (cpus_empty(cpus_in_xmon)) { |
673 | spin_lock(&hvc_structs_lock); | 674 | spin_lock(&hvc_structs_lock); |
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 8dc205b275e3..017f755632a3 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -311,7 +311,8 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet, | |||
311 | /* CD went away; no more connection */ | 311 | /* CD went away; no more connection */ |
312 | pr_debug("hvsi%i: CD dropped\n", hp->index); | 312 | pr_debug("hvsi%i: CD dropped\n", hp->index); |
313 | hp->mctrl &= TIOCM_CD; | 313 | hp->mctrl &= TIOCM_CD; |
314 | if (!(hp->tty->flags & CLOCAL)) | 314 | /* If userland hasn't done an open(2) yet, hp->tty is NULL. */ |
315 | if (hp->tty && !(hp->tty->flags & CLOCAL)) | ||
315 | *to_hangup = hp->tty; | 316 | *to_hangup = hp->tty; |
316 | } | 317 | } |
317 | break; | 318 | break; |
@@ -986,10 +987,7 @@ static void hvsi_write_worker(void *arg) | |||
986 | start_j = 0; | 987 | start_j = 0; |
987 | #endif /* DEBUG */ | 988 | #endif /* DEBUG */ |
988 | wake_up_all(&hp->emptyq); | 989 | wake_up_all(&hp->emptyq); |
989 | if (test_bit(TTY_DO_WRITE_WAKEUP, &hp->tty->flags) | 990 | tty_wakeup(hp->tty); |
990 | && hp->tty->ldisc.write_wakeup) | ||
991 | hp->tty->ldisc.write_wakeup(hp->tty); | ||
992 | wake_up_interruptible(&hp->tty->write_wait); | ||
993 | } | 991 | } |
994 | 992 | ||
995 | out: | 993 | out: |
@@ -1299,13 +1297,12 @@ static int __init hvsi_console_init(void) | |||
1299 | hp->inbuf_end = hp->inbuf; | 1297 | hp->inbuf_end = hp->inbuf; |
1300 | hp->state = HVSI_CLOSED; | 1298 | hp->state = HVSI_CLOSED; |
1301 | hp->vtermno = *vtermno; | 1299 | hp->vtermno = *vtermno; |
1302 | hp->virq = virt_irq_create_mapping(irq[0]); | 1300 | hp->virq = irq_create_mapping(NULL, irq[0]); |
1303 | if (hp->virq == NO_IRQ) { | 1301 | if (hp->virq == NO_IRQ) { |
1304 | printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", | 1302 | printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", |
1305 | __FUNCTION__, hp->virq); | 1303 | __FUNCTION__, irq[0]); |
1306 | continue; | 1304 | continue; |
1307 | } else | 1305 | } |
1308 | hp->virq = irq_offset_up(hp->virq); | ||
1309 | 1306 | ||
1310 | hvsi_count++; | 1307 | hvsi_count++; |
1311 | } | 1308 | } |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 88b026639f10..154a81d328c1 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -149,7 +149,7 @@ out: | |||
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | static struct file_operations rng_chrdev_ops = { | 152 | static const struct file_operations rng_chrdev_ops = { |
153 | .owner = THIS_MODULE, | 153 | .owner = THIS_MODULE, |
154 | .open = rng_dev_open, | 154 | .open = rng_dev_open, |
155 | .read = rng_dev_read, | 155 | .read = rng_dev_read, |
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c index be61f22ee7bb..d37ced0d132b 100644 --- a/drivers/char/hw_random/geode-rng.c +++ b/drivers/char/hw_random/geode-rng.c | |||
@@ -107,10 +107,14 @@ found: | |||
107 | if (err) { | 107 | if (err) { |
108 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | 108 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", |
109 | err); | 109 | err); |
110 | goto out; | 110 | goto err_unmap; |
111 | } | 111 | } |
112 | out: | 112 | out: |
113 | return err; | 113 | return err; |
114 | |||
115 | err_unmap: | ||
116 | iounmap(mem); | ||
117 | goto out; | ||
114 | } | 118 | } |
115 | 119 | ||
116 | static void __exit mod_exit(void) | 120 | static void __exit mod_exit(void) |
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 6594bd5645f4..ccd7e7102234 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -164,7 +164,7 @@ static int __init mod_init(void) | |||
164 | if (err) { | 164 | if (err) { |
165 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | 165 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", |
166 | err); | 166 | err); |
167 | goto out; | 167 | goto err_unmap; |
168 | } | 168 | } |
169 | out: | 169 | out: |
170 | return err; | 170 | return err; |
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 819516b35a79..a01d796d1eeb 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -25,12 +25,12 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/random.h> | 27 | #include <linux/random.h> |
28 | #include <linux/clk.h> | ||
28 | #include <linux/err.h> | 29 | #include <linux/err.h> |
29 | #include <linux/device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/hw_random.h> | 31 | #include <linux/hw_random.h> |
31 | 32 | ||
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | #include <asm/hardware/clock.h> | ||
34 | 34 | ||
35 | #define RNG_OUT_REG 0x00 /* Output register */ | 35 | #define RNG_OUT_REG 0x00 /* Output register */ |
36 | #define RNG_STAT_REG 0x04 /* Status register | 36 | #define RNG_STAT_REG 0x04 /* Status register |
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | static void __iomem *rng_base; | 53 | static void __iomem *rng_base; |
54 | static struct clk *rng_ick; | 54 | static struct clk *rng_ick; |
55 | static struct device *rng_dev; | 55 | static struct platform_device *rng_dev; |
56 | 56 | ||
57 | static u32 omap_rng_read_reg(int reg) | 57 | static u32 omap_rng_read_reg(int reg) |
58 | { | 58 | { |
@@ -83,9 +83,8 @@ static struct hwrng omap_rng_ops = { | |||
83 | .data_read = omap_rng_data_read, | 83 | .data_read = omap_rng_data_read, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static int __init omap_rng_probe(struct device *dev) | 86 | static int __init omap_rng_probe(struct platform_device *pdev) |
87 | { | 87 | { |
88 | struct platform_device *pdev = to_platform_device(dev); | ||
89 | struct resource *res, *mem; | 88 | struct resource *res, *mem; |
90 | int ret; | 89 | int ret; |
91 | 90 | ||
@@ -95,16 +94,14 @@ static int __init omap_rng_probe(struct device *dev) | |||
95 | */ | 94 | */ |
96 | BUG_ON(rng_dev); | 95 | BUG_ON(rng_dev); |
97 | 96 | ||
98 | if (cpu_is_omap24xx()) { | 97 | if (cpu_is_omap24xx()) { |
99 | rng_ick = clk_get(NULL, "rng_ick"); | 98 | rng_ick = clk_get(NULL, "rng_ick"); |
100 | if (IS_ERR(rng_ick)) { | 99 | if (IS_ERR(rng_ick)) { |
101 | dev_err(dev, "Could not get rng_ick\n"); | 100 | dev_err(&pdev->dev, "Could not get rng_ick\n"); |
102 | ret = PTR_ERR(rng_ick); | 101 | ret = PTR_ERR(rng_ick); |
103 | return ret; | 102 | return ret; |
104 | } | 103 | } else |
105 | else { | 104 | clk_enable(rng_ick); |
106 | clk_use(rng_ick); | ||
107 | } | ||
108 | } | 105 | } |
109 | 106 | ||
110 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 107 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -117,7 +114,7 @@ static int __init omap_rng_probe(struct device *dev) | |||
117 | if (mem == NULL) | 114 | if (mem == NULL) |
118 | return -EBUSY; | 115 | return -EBUSY; |
119 | 116 | ||
120 | dev_set_drvdata(dev, mem); | 117 | dev_set_drvdata(&pdev->dev, mem); |
121 | rng_base = (u32 __iomem *)io_p2v(res->start); | 118 | rng_base = (u32 __iomem *)io_p2v(res->start); |
122 | 119 | ||
123 | ret = hwrng_register(&omap_rng_ops); | 120 | ret = hwrng_register(&omap_rng_ops); |
@@ -127,25 +124,25 @@ static int __init omap_rng_probe(struct device *dev) | |||
127 | return ret; | 124 | return ret; |
128 | } | 125 | } |
129 | 126 | ||
130 | dev_info(dev, "OMAP Random Number Generator ver. %02x\n", | 127 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", |
131 | omap_rng_read_reg(RNG_REV_REG)); | 128 | omap_rng_read_reg(RNG_REV_REG)); |
132 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | 129 | omap_rng_write_reg(RNG_MASK_REG, 0x1); |
133 | 130 | ||
134 | rng_dev = dev; | 131 | rng_dev = pdev; |
135 | 132 | ||
136 | return 0; | 133 | return 0; |
137 | } | 134 | } |
138 | 135 | ||
139 | static int __exit omap_rng_remove(struct device *dev) | 136 | static int __exit omap_rng_remove(struct platform_device *pdev) |
140 | { | 137 | { |
141 | struct resource *mem = dev_get_drvdata(dev); | 138 | struct resource *mem = dev_get_drvdata(&pdev->dev); |
142 | 139 | ||
143 | hwrng_unregister(&omap_rng_ops); | 140 | hwrng_unregister(&omap_rng_ops); |
144 | 141 | ||
145 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 142 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
146 | 143 | ||
147 | if (cpu_is_omap24xx()) { | 144 | if (cpu_is_omap24xx()) { |
148 | clk_unuse(rng_ick); | 145 | clk_disable(rng_ick); |
149 | clk_put(rng_ick); | 146 | clk_put(rng_ick); |
150 | } | 147 | } |
151 | 148 | ||
@@ -157,18 +154,16 @@ static int __exit omap_rng_remove(struct device *dev) | |||
157 | 154 | ||
158 | #ifdef CONFIG_PM | 155 | #ifdef CONFIG_PM |
159 | 156 | ||
160 | static int omap_rng_suspend(struct device *dev, pm_message_t message, u32 level) | 157 | static int omap_rng_suspend(struct platform_device *pdev, pm_message_t message) |
161 | { | 158 | { |
162 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 159 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
163 | |||
164 | return 0; | 160 | return 0; |
165 | } | 161 | } |
166 | 162 | ||
167 | static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | 163 | static int omap_rng_resume(struct platform_device *pdev) |
168 | { | 164 | { |
169 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | 165 | omap_rng_write_reg(RNG_MASK_REG, 0x1); |
170 | 166 | return 0; | |
171 | return 1; | ||
172 | } | 167 | } |
173 | 168 | ||
174 | #else | 169 | #else |
@@ -179,9 +174,11 @@ static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | |||
179 | #endif | 174 | #endif |
180 | 175 | ||
181 | 176 | ||
182 | static struct device_driver omap_rng_driver = { | 177 | static struct platform_driver omap_rng_driver = { |
183 | .name = "omap_rng", | 178 | .driver = { |
184 | .bus = &platform_bus_type, | 179 | .name = "omap_rng", |
180 | .owner = THIS_MODULE, | ||
181 | }, | ||
185 | .probe = omap_rng_probe, | 182 | .probe = omap_rng_probe, |
186 | .remove = __exit_p(omap_rng_remove), | 183 | .remove = __exit_p(omap_rng_remove), |
187 | .suspend = omap_rng_suspend, | 184 | .suspend = omap_rng_suspend, |
@@ -193,12 +190,12 @@ static int __init omap_rng_init(void) | |||
193 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) | 190 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) |
194 | return -ENODEV; | 191 | return -ENODEV; |
195 | 192 | ||
196 | return driver_register(&omap_rng_driver); | 193 | return platform_driver_register(&omap_rng_driver); |
197 | } | 194 | } |
198 | 195 | ||
199 | static void __exit omap_rng_exit(void) | 196 | static void __exit omap_rng_exit(void) |
200 | { | 197 | { |
201 | driver_unregister(&omap_rng_driver); | 198 | platform_driver_unregister(&omap_rng_driver); |
202 | } | 199 | } |
203 | 200 | ||
204 | module_init(omap_rng_init); | 201 | module_init(omap_rng_init); |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index f3c3aaf4560e..353d9f3cf8d7 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -80,7 +80,7 @@ static int i8k_open_fs(struct inode *inode, struct file *file); | |||
80 | static int i8k_ioctl(struct inode *, struct file *, unsigned int, | 80 | static int i8k_ioctl(struct inode *, struct file *, unsigned int, |
81 | unsigned long); | 81 | unsigned long); |
82 | 82 | ||
83 | static struct file_operations i8k_fops = { | 83 | static const struct file_operations i8k_fops = { |
84 | .open = i8k_open_fs, | 84 | .open = i8k_open_fs, |
85 | .read = seq_read, | 85 | .read = seq_read, |
86 | .llseek = seq_lseek, | 86 | .llseek = seq_lseek, |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index a4200a2b0811..7907ae88c2f4 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -233,7 +233,7 @@ static void *DevTableMem[IP2_MAX_BOARDS]; | |||
233 | /* This is the driver descriptor for the ip2ipl device, which is used to | 233 | /* This is the driver descriptor for the ip2ipl device, which is used to |
234 | * download the loadware to the boards. | 234 | * download the loadware to the boards. |
235 | */ | 235 | */ |
236 | static struct file_operations ip2_ipl = { | 236 | static const struct file_operations ip2_ipl = { |
237 | .owner = THIS_MODULE, | 237 | .owner = THIS_MODULE, |
238 | .read = ip2_ipl_read, | 238 | .read = ip2_ipl_read, |
239 | .write = ip2_ipl_write, | 239 | .write = ip2_ipl_write, |
@@ -3186,3 +3186,10 @@ ip2trace (unsigned short pn, unsigned char cat, unsigned char label, unsigned lo | |||
3186 | 3186 | ||
3187 | 3187 | ||
3188 | MODULE_LICENSE("GPL"); | 3188 | MODULE_LICENSE("GPL"); |
3189 | |||
3190 | static struct pci_device_id ip2main_pci_tbl[] __devinitdata = { | ||
3191 | { PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) }, | ||
3192 | { } | ||
3193 | }; | ||
3194 | |||
3195 | MODULE_DEVICE_TABLE(pci, ip2main_pci_tbl); | ||
diff --git a/drivers/char/ip27-rtc.c b/drivers/char/ip27-rtc.c index 3acdac3c967e..a48da02aad2f 100644 --- a/drivers/char/ip27-rtc.c +++ b/drivers/char/ip27-rtc.c | |||
@@ -196,7 +196,7 @@ static int rtc_release(struct inode *inode, struct file *file) | |||
196 | * The various file operations we support. | 196 | * The various file operations we support. |
197 | */ | 197 | */ |
198 | 198 | ||
199 | static struct file_operations rtc_fops = { | 199 | static const struct file_operations rtc_fops = { |
200 | .owner = THIS_MODULE, | 200 | .owner = THIS_MODULE, |
201 | .ioctl = rtc_ioctl, | 201 | .ioctl = rtc_ioctl, |
202 | .open = rtc_open, | 202 | .open = rtc_open, |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 2fc894fef1cb..68d7c61a864e 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -765,7 +765,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, | |||
765 | } | 765 | } |
766 | #endif | 766 | #endif |
767 | 767 | ||
768 | static struct file_operations ipmi_fops = { | 768 | static const struct file_operations ipmi_fops = { |
769 | .owner = THIS_MODULE, | 769 | .owner = THIS_MODULE, |
770 | .ioctl = ipmi_ioctl, | 770 | .ioctl = ipmi_ioctl, |
771 | #ifdef CONFIG_COMPAT | 771 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 0aa5d608fe6f..843d34c8627c 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -3428,6 +3428,7 @@ struct ipmi_recv_msg *ipmi_alloc_recv_msg(void) | |||
3428 | 3428 | ||
3429 | rv = kmalloc(sizeof(struct ipmi_recv_msg), GFP_ATOMIC); | 3429 | rv = kmalloc(sizeof(struct ipmi_recv_msg), GFP_ATOMIC); |
3430 | if (rv) { | 3430 | if (rv) { |
3431 | rv->user = NULL; | ||
3431 | rv->done = free_recv_msg; | 3432 | rv->done = free_recv_msg; |
3432 | atomic_inc(&recv_msg_inuse_count); | 3433 | atomic_inc(&recv_msg_inuse_count); |
3433 | } | 3434 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index f57eba0bf253..abca98beac14 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -402,10 +402,10 @@ static void handle_flags(struct smi_info *smi_info) | |||
402 | smi_info->curr_msg->data, | 402 | smi_info->curr_msg->data, |
403 | smi_info->curr_msg->data_size); | 403 | smi_info->curr_msg->data_size); |
404 | smi_info->si_state = SI_GETTING_EVENTS; | 404 | smi_info->si_state = SI_GETTING_EVENTS; |
405 | } else if (smi_info->msg_flags & OEM_DATA_AVAIL) { | 405 | } else if (smi_info->msg_flags & OEM_DATA_AVAIL && |
406 | if (smi_info->oem_data_avail_handler) | 406 | smi_info->oem_data_avail_handler) { |
407 | if (smi_info->oem_data_avail_handler(smi_info)) | 407 | if (smi_info->oem_data_avail_handler(smi_info)) |
408 | goto retry; | 408 | goto retry; |
409 | } else { | 409 | } else { |
410 | smi_info->si_state = SI_NORMAL; | 410 | smi_info->si_state = SI_NORMAL; |
411 | } | 411 | } |
@@ -2481,6 +2481,7 @@ static __devinit int init_ipmi_si(void) | |||
2481 | #ifdef CONFIG_PCI | 2481 | #ifdef CONFIG_PCI |
2482 | pci_unregister_driver(&ipmi_pci_driver); | 2482 | pci_unregister_driver(&ipmi_pci_driver); |
2483 | #endif | 2483 | #endif |
2484 | driver_unregister(&ipmi_driver); | ||
2484 | printk("ipmi_si: Unable to find any System Interface(s)\n"); | 2485 | printk("ipmi_si: Unable to find any System Interface(s)\n"); |
2485 | return -ENODEV; | 2486 | return -ENODEV; |
2486 | } else { | 2487 | } else { |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 74a889c58333..accaaf1a6b69 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -807,7 +807,7 @@ static int ipmi_close(struct inode *ino, struct file *filep) | |||
807 | return 0; | 807 | return 0; |
808 | } | 808 | } |
809 | 809 | ||
810 | static struct file_operations ipmi_wdog_fops = { | 810 | static const struct file_operations ipmi_wdog_fops = { |
811 | .owner = THIS_MODULE, | 811 | .owner = THIS_MODULE, |
812 | .read = ipmi_read, | 812 | .read = ipmi_read, |
813 | .poll = ipmi_poll, | 813 | .poll = ipmi_poll, |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index fbce2f0669d6..84dfc4278139 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -748,7 +748,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp); | |||
748 | * will give access to the shared memory on the Stallion intelligent | 748 | * will give access to the shared memory on the Stallion intelligent |
749 | * board. This is also a very useful debugging tool. | 749 | * board. This is also a very useful debugging tool. |
750 | */ | 750 | */ |
751 | static struct file_operations stli_fsiomem = { | 751 | static const struct file_operations stli_fsiomem = { |
752 | .owner = THIS_MODULE, | 752 | .owner = THIS_MODULE, |
753 | .read = stli_memread, | 753 | .read = stli_memread, |
754 | .write = stli_memwrite, | 754 | .write = stli_memwrite, |
diff --git a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c index 747ba45e50e5..cde562d70c4f 100644 --- a/drivers/char/ite_gpio.c +++ b/drivers/char/ite_gpio.c | |||
@@ -357,7 +357,7 @@ DEB(printk("interrupt 0x%x %d\n",ITE_GPAISR, i)); | |||
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | static struct file_operations ite_gpio_fops = { | 360 | static const struct file_operations ite_gpio_fops = { |
361 | .owner = THIS_MODULE, | 361 | .owner = THIS_MODULE, |
362 | .ioctl = ite_gpio_ioctl, | 362 | .ioctl = ite_gpio_ioctl, |
363 | .open = ite_gpio_open, | 363 | .open = ite_gpio_open, |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 056ebe84b81d..3e90aac37510 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -107,7 +107,6 @@ const int NR_TYPES = ARRAY_SIZE(max_vals); | |||
107 | 107 | ||
108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; | 108 | struct kbd_struct kbd_table[MAX_NR_CONSOLES]; |
109 | static struct kbd_struct *kbd = kbd_table; | 109 | static struct kbd_struct *kbd = kbd_table; |
110 | static struct kbd_struct kbd0; | ||
111 | 110 | ||
112 | int spawnpid, spawnsig; | 111 | int spawnpid, spawnsig; |
113 | 112 | ||
@@ -223,13 +222,13 @@ static void kd_nosound(unsigned long ignored) | |||
223 | { | 222 | { |
224 | struct list_head *node; | 223 | struct list_head *node; |
225 | 224 | ||
226 | list_for_each(node,&kbd_handler.h_list) { | 225 | list_for_each(node, &kbd_handler.h_list) { |
227 | struct input_handle *handle = to_handle_h(node); | 226 | struct input_handle *handle = to_handle_h(node); |
228 | if (test_bit(EV_SND, handle->dev->evbit)) { | 227 | if (test_bit(EV_SND, handle->dev->evbit)) { |
229 | if (test_bit(SND_TONE, handle->dev->sndbit)) | 228 | if (test_bit(SND_TONE, handle->dev->sndbit)) |
230 | input_event(handle->dev, EV_SND, SND_TONE, 0); | 229 | input_inject_event(handle, EV_SND, SND_TONE, 0); |
231 | if (test_bit(SND_BELL, handle->dev->sndbit)) | 230 | if (test_bit(SND_BELL, handle->dev->sndbit)) |
232 | input_event(handle->dev, EV_SND, SND_BELL, 0); | 231 | input_inject_event(handle, EV_SND, SND_BELL, 0); |
233 | } | 232 | } |
234 | } | 233 | } |
235 | } | 234 | } |
@@ -247,11 +246,11 @@ void kd_mksound(unsigned int hz, unsigned int ticks) | |||
247 | struct input_handle *handle = to_handle_h(node); | 246 | struct input_handle *handle = to_handle_h(node); |
248 | if (test_bit(EV_SND, handle->dev->evbit)) { | 247 | if (test_bit(EV_SND, handle->dev->evbit)) { |
249 | if (test_bit(SND_TONE, handle->dev->sndbit)) { | 248 | if (test_bit(SND_TONE, handle->dev->sndbit)) { |
250 | input_event(handle->dev, EV_SND, SND_TONE, hz); | 249 | input_inject_event(handle, EV_SND, SND_TONE, hz); |
251 | break; | 250 | break; |
252 | } | 251 | } |
253 | if (test_bit(SND_BELL, handle->dev->sndbit)) { | 252 | if (test_bit(SND_BELL, handle->dev->sndbit)) { |
254 | input_event(handle->dev, EV_SND, SND_BELL, 1); | 253 | input_inject_event(handle, EV_SND, SND_BELL, 1); |
255 | break; | 254 | break; |
256 | } | 255 | } |
257 | } | 256 | } |
@@ -272,15 +271,15 @@ int kbd_rate(struct kbd_repeat *rep) | |||
272 | unsigned int d = 0; | 271 | unsigned int d = 0; |
273 | unsigned int p = 0; | 272 | unsigned int p = 0; |
274 | 273 | ||
275 | list_for_each(node,&kbd_handler.h_list) { | 274 | list_for_each(node, &kbd_handler.h_list) { |
276 | struct input_handle *handle = to_handle_h(node); | 275 | struct input_handle *handle = to_handle_h(node); |
277 | struct input_dev *dev = handle->dev; | 276 | struct input_dev *dev = handle->dev; |
278 | 277 | ||
279 | if (test_bit(EV_REP, dev->evbit)) { | 278 | if (test_bit(EV_REP, dev->evbit)) { |
280 | if (rep->delay > 0) | 279 | if (rep->delay > 0) |
281 | input_event(dev, EV_REP, REP_DELAY, rep->delay); | 280 | input_inject_event(handle, EV_REP, REP_DELAY, rep->delay); |
282 | if (rep->period > 0) | 281 | if (rep->period > 0) |
283 | input_event(dev, EV_REP, REP_PERIOD, rep->period); | 282 | input_inject_event(handle, EV_REP, REP_PERIOD, rep->period); |
284 | d = dev->rep[REP_DELAY]; | 283 | d = dev->rep[REP_DELAY]; |
285 | p = dev->rep[REP_PERIOD]; | 284 | p = dev->rep[REP_PERIOD]; |
286 | } | 285 | } |
@@ -988,7 +987,7 @@ static inline unsigned char getleds(void) | |||
988 | * interrupt routines for this thing allows us to easily mask | 987 | * interrupt routines for this thing allows us to easily mask |
989 | * this when we don't want any of the above to happen. | 988 | * this when we don't want any of the above to happen. |
990 | * This allows for easy and efficient race-condition prevention | 989 | * This allows for easy and efficient race-condition prevention |
991 | * for kbd_refresh_leds => input_event(dev, EV_LED, ...) => ... | 990 | * for kbd_start => input_inject_event(dev, EV_LED, ...) => ... |
992 | */ | 991 | */ |
993 | 992 | ||
994 | static void kbd_bh(unsigned long dummy) | 993 | static void kbd_bh(unsigned long dummy) |
@@ -998,11 +997,11 @@ static void kbd_bh(unsigned long dummy) | |||
998 | 997 | ||
999 | if (leds != ledstate) { | 998 | if (leds != ledstate) { |
1000 | list_for_each(node, &kbd_handler.h_list) { | 999 | list_for_each(node, &kbd_handler.h_list) { |
1001 | struct input_handle * handle = to_handle_h(node); | 1000 | struct input_handle *handle = to_handle_h(node); |
1002 | input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | 1001 | input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); |
1003 | input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); | 1002 | input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); |
1004 | input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); | 1003 | input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); |
1005 | input_sync(handle->dev); | 1004 | input_inject_event(handle, EV_SYN, SYN_REPORT, 0); |
1006 | } | 1005 | } |
1007 | } | 1006 | } |
1008 | 1007 | ||
@@ -1011,23 +1010,6 @@ static void kbd_bh(unsigned long dummy) | |||
1011 | 1010 | ||
1012 | DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); | 1011 | DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); |
1013 | 1012 | ||
1014 | /* | ||
1015 | * This allows a newly plugged keyboard to pick the LED state. | ||
1016 | */ | ||
1017 | static void kbd_refresh_leds(struct input_handle *handle) | ||
1018 | { | ||
1019 | unsigned char leds = ledstate; | ||
1020 | |||
1021 | tasklet_disable(&keyboard_tasklet); | ||
1022 | if (leds != 0xff) { | ||
1023 | input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | ||
1024 | input_event(handle->dev, EV_LED, LED_NUML, !!(leds & 0x02)); | ||
1025 | input_event(handle->dev, EV_LED, LED_CAPSL, !!(leds & 0x04)); | ||
1026 | input_sync(handle->dev); | ||
1027 | } | ||
1028 | tasklet_enable(&keyboard_tasklet); | ||
1029 | } | ||
1030 | |||
1031 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ | 1013 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ |
1032 | defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ | 1014 | defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ |
1033 | defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ | 1015 | defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ |
@@ -1043,7 +1025,7 @@ static const unsigned short x86_keycodes[256] = | |||
1043 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, | 1025 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, |
1044 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, | 1026 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
1045 | 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, | 1027 | 80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92, |
1046 | 284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339, | 1028 | 284,285,309, 0,312, 91,327,328,329,331,333,335,336,337,338,339, |
1047 | 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, | 1029 | 367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349, |
1048 | 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, | 1030 | 360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355, |
1049 | 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, | 1031 | 103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361, |
@@ -1065,38 +1047,55 @@ extern void sun_do_break(void); | |||
1065 | static int emulate_raw(struct vc_data *vc, unsigned int keycode, | 1047 | static int emulate_raw(struct vc_data *vc, unsigned int keycode, |
1066 | unsigned char up_flag) | 1048 | unsigned char up_flag) |
1067 | { | 1049 | { |
1068 | if (keycode > 255 || !x86_keycodes[keycode]) | 1050 | int code; |
1069 | return -1; | ||
1070 | 1051 | ||
1071 | switch (keycode) { | 1052 | switch (keycode) { |
1072 | case KEY_PAUSE: | 1053 | case KEY_PAUSE: |
1073 | put_queue(vc, 0xe1); | 1054 | put_queue(vc, 0xe1); |
1074 | put_queue(vc, 0x1d | up_flag); | 1055 | put_queue(vc, 0x1d | up_flag); |
1075 | put_queue(vc, 0x45 | up_flag); | 1056 | put_queue(vc, 0x45 | up_flag); |
1076 | return 0; | 1057 | break; |
1058 | |||
1077 | case KEY_HANGEUL: | 1059 | case KEY_HANGEUL: |
1078 | if (!up_flag) | 1060 | if (!up_flag) |
1079 | put_queue(vc, 0xf2); | 1061 | put_queue(vc, 0xf2); |
1080 | return 0; | 1062 | break; |
1063 | |||
1081 | case KEY_HANJA: | 1064 | case KEY_HANJA: |
1082 | if (!up_flag) | 1065 | if (!up_flag) |
1083 | put_queue(vc, 0xf1); | 1066 | put_queue(vc, 0xf1); |
1084 | return 0; | 1067 | break; |
1085 | } | ||
1086 | 1068 | ||
1087 | if (keycode == KEY_SYSRQ && sysrq_alt) { | 1069 | case KEY_SYSRQ: |
1088 | put_queue(vc, 0x54 | up_flag); | 1070 | /* |
1089 | return 0; | 1071 | * Real AT keyboards (that's what we're trying |
1090 | } | 1072 | * to emulate here emit 0xe0 0x2a 0xe0 0x37 when |
1073 | * pressing PrtSc/SysRq alone, but simply 0x54 | ||
1074 | * when pressing Alt+PrtSc/SysRq. | ||
1075 | */ | ||
1076 | if (sysrq_alt) { | ||
1077 | put_queue(vc, 0x54 | up_flag); | ||
1078 | } else { | ||
1079 | put_queue(vc, 0xe0); | ||
1080 | put_queue(vc, 0x2a | up_flag); | ||
1081 | put_queue(vc, 0xe0); | ||
1082 | put_queue(vc, 0x37 | up_flag); | ||
1083 | } | ||
1084 | break; | ||
1085 | |||
1086 | default: | ||
1087 | if (keycode > 255) | ||
1088 | return -1; | ||
1091 | 1089 | ||
1092 | if (x86_keycodes[keycode] & 0x100) | 1090 | code = x86_keycodes[keycode]; |
1093 | put_queue(vc, 0xe0); | 1091 | if (!code) |
1092 | return -1; | ||
1094 | 1093 | ||
1095 | put_queue(vc, (x86_keycodes[keycode] & 0x7f) | up_flag); | 1094 | if (code & 0x100) |
1095 | put_queue(vc, 0xe0); | ||
1096 | put_queue(vc, (code & 0x7f) | up_flag); | ||
1096 | 1097 | ||
1097 | if (keycode == KEY_SYSRQ) { | 1098 | break; |
1098 | put_queue(vc, 0xe0); | ||
1099 | put_queue(vc, 0x37 | up_flag); | ||
1100 | } | 1099 | } |
1101 | 1100 | ||
1102 | return 0; | 1101 | return 0; |
@@ -1298,16 +1297,15 @@ static struct input_handle *kbd_connect(struct input_handler *handler, | |||
1298 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) | 1297 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) |
1299 | return NULL; | 1298 | return NULL; |
1300 | 1299 | ||
1301 | if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) | 1300 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); |
1301 | if (!handle) | ||
1302 | return NULL; | 1302 | return NULL; |
1303 | memset(handle, 0, sizeof(struct input_handle)); | ||
1304 | 1303 | ||
1305 | handle->dev = dev; | 1304 | handle->dev = dev; |
1306 | handle->handler = handler; | 1305 | handle->handler = handler; |
1307 | handle->name = "kbd"; | 1306 | handle->name = "kbd"; |
1308 | 1307 | ||
1309 | input_open_device(handle); | 1308 | input_open_device(handle); |
1310 | kbd_refresh_leds(handle); | ||
1311 | 1309 | ||
1312 | return handle; | 1310 | return handle; |
1313 | } | 1311 | } |
@@ -1318,6 +1316,24 @@ static void kbd_disconnect(struct input_handle *handle) | |||
1318 | kfree(handle); | 1316 | kfree(handle); |
1319 | } | 1317 | } |
1320 | 1318 | ||
1319 | /* | ||
1320 | * Start keyboard handler on the new keyboard by refreshing LED state to | ||
1321 | * match the rest of the system. | ||
1322 | */ | ||
1323 | static void kbd_start(struct input_handle *handle) | ||
1324 | { | ||
1325 | unsigned char leds = ledstate; | ||
1326 | |||
1327 | tasklet_disable(&keyboard_tasklet); | ||
1328 | if (leds != 0xff) { | ||
1329 | input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01)); | ||
1330 | input_inject_event(handle, EV_LED, LED_NUML, !!(leds & 0x02)); | ||
1331 | input_inject_event(handle, EV_LED, LED_CAPSL, !!(leds & 0x04)); | ||
1332 | input_inject_event(handle, EV_SYN, SYN_REPORT, 0); | ||
1333 | } | ||
1334 | tasklet_enable(&keyboard_tasklet); | ||
1335 | } | ||
1336 | |||
1321 | static struct input_device_id kbd_ids[] = { | 1337 | static struct input_device_id kbd_ids[] = { |
1322 | { | 1338 | { |
1323 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, | 1339 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, |
@@ -1338,6 +1354,7 @@ static struct input_handler kbd_handler = { | |||
1338 | .event = kbd_event, | 1354 | .event = kbd_event, |
1339 | .connect = kbd_connect, | 1355 | .connect = kbd_connect, |
1340 | .disconnect = kbd_disconnect, | 1356 | .disconnect = kbd_disconnect, |
1357 | .start = kbd_start, | ||
1341 | .name = "kbd", | 1358 | .name = "kbd", |
1342 | .id_table = kbd_ids, | 1359 | .id_table = kbd_ids, |
1343 | }; | 1360 | }; |
@@ -1346,15 +1363,15 @@ int __init kbd_init(void) | |||
1346 | { | 1363 | { |
1347 | int i; | 1364 | int i; |
1348 | 1365 | ||
1349 | kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; | 1366 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1350 | kbd0.ledmode = LED_SHOW_FLAGS; | 1367 | kbd_table[i].ledflagstate = KBD_DEFLEDS; |
1351 | kbd0.lockstate = KBD_DEFLOCK; | 1368 | kbd_table[i].default_ledflagstate = KBD_DEFLEDS; |
1352 | kbd0.slockstate = 0; | 1369 | kbd_table[i].ledmode = LED_SHOW_FLAGS; |
1353 | kbd0.modeflags = KBD_DEFMODE; | 1370 | kbd_table[i].lockstate = KBD_DEFLOCK; |
1354 | kbd0.kbdmode = VC_XLATE; | 1371 | kbd_table[i].slockstate = 0; |
1355 | 1372 | kbd_table[i].modeflags = KBD_DEFMODE; | |
1356 | for (i = 0 ; i < MAX_NR_CONSOLES ; i++) | 1373 | kbd_table[i].kbdmode = VC_XLATE; |
1357 | kbd_table[i] = kbd0; | 1374 | } |
1358 | 1375 | ||
1359 | input_register_handler(&kbd_handler); | 1376 | input_register_handler(&kbd_handler); |
1360 | 1377 | ||
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index 7d49b241de56..da601fd6c07a 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c | |||
@@ -598,7 +598,7 @@ static ssize_t lcd_read(struct file *file, char *buf, | |||
598 | * The various file operations we support. | 598 | * The various file operations we support. |
599 | */ | 599 | */ |
600 | 600 | ||
601 | static struct file_operations lcd_fops = { | 601 | static const struct file_operations lcd_fops = { |
602 | .read = lcd_read, | 602 | .read = lcd_read, |
603 | .ioctl = lcd_ioctl, | 603 | .ioctl = lcd_ioctl, |
604 | .open = lcd_open, | 604 | .open = lcd_open, |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 582cdbdb0c42..f875fda3b089 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -666,7 +666,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, | |||
666 | return retval; | 666 | return retval; |
667 | } | 667 | } |
668 | 668 | ||
669 | static struct file_operations lp_fops = { | 669 | static const struct file_operations lp_fops = { |
670 | .owner = THIS_MODULE, | 670 | .owner = THIS_MODULE, |
671 | .write = lp_write, | 671 | .write = lp_write, |
672 | .ioctl = lp_ioctl, | 672 | .ioctl = lp_ioctl, |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 70f3954d6dfd..917b20402664 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -95,7 +95,7 @@ static inline int valid_phys_addr_range(unsigned long addr, size_t count) | |||
95 | return 1; | 95 | return 1; |
96 | } | 96 | } |
97 | 97 | ||
98 | static inline int valid_mmap_phys_addr_range(unsigned long addr, size_t size) | 98 | static inline int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) |
99 | { | 99 | { |
100 | return 1; | 100 | return 1; |
101 | } | 101 | } |
@@ -242,7 +242,7 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma) | |||
242 | { | 242 | { |
243 | size_t size = vma->vm_end - vma->vm_start; | 243 | size_t size = vma->vm_end - vma->vm_start; |
244 | 244 | ||
245 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff << PAGE_SHIFT, size)) | 245 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) |
246 | return -EINVAL; | 246 | return -EINVAL; |
247 | 247 | ||
248 | vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, | 248 | vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, |
@@ -776,7 +776,7 @@ static int open_port(struct inode * inode, struct file * filp) | |||
776 | #define open_kmem open_mem | 776 | #define open_kmem open_mem |
777 | #define open_oldmem open_mem | 777 | #define open_oldmem open_mem |
778 | 778 | ||
779 | static struct file_operations mem_fops = { | 779 | static const struct file_operations mem_fops = { |
780 | .llseek = memory_lseek, | 780 | .llseek = memory_lseek, |
781 | .read = read_mem, | 781 | .read = read_mem, |
782 | .write = write_mem, | 782 | .write = write_mem, |
@@ -784,7 +784,7 @@ static struct file_operations mem_fops = { | |||
784 | .open = open_mem, | 784 | .open = open_mem, |
785 | }; | 785 | }; |
786 | 786 | ||
787 | static struct file_operations kmem_fops = { | 787 | static const struct file_operations kmem_fops = { |
788 | .llseek = memory_lseek, | 788 | .llseek = memory_lseek, |
789 | .read = read_kmem, | 789 | .read = read_kmem, |
790 | .write = write_kmem, | 790 | .write = write_kmem, |
@@ -792,7 +792,7 @@ static struct file_operations kmem_fops = { | |||
792 | .open = open_kmem, | 792 | .open = open_kmem, |
793 | }; | 793 | }; |
794 | 794 | ||
795 | static struct file_operations null_fops = { | 795 | static const struct file_operations null_fops = { |
796 | .llseek = null_lseek, | 796 | .llseek = null_lseek, |
797 | .read = read_null, | 797 | .read = read_null, |
798 | .write = write_null, | 798 | .write = write_null, |
@@ -800,7 +800,7 @@ static struct file_operations null_fops = { | |||
800 | }; | 800 | }; |
801 | 801 | ||
802 | #if defined(CONFIG_ISA) || !defined(__mc68000__) | 802 | #if defined(CONFIG_ISA) || !defined(__mc68000__) |
803 | static struct file_operations port_fops = { | 803 | static const struct file_operations port_fops = { |
804 | .llseek = memory_lseek, | 804 | .llseek = memory_lseek, |
805 | .read = read_port, | 805 | .read = read_port, |
806 | .write = write_port, | 806 | .write = write_port, |
@@ -808,7 +808,7 @@ static struct file_operations port_fops = { | |||
808 | }; | 808 | }; |
809 | #endif | 809 | #endif |
810 | 810 | ||
811 | static struct file_operations zero_fops = { | 811 | static const struct file_operations zero_fops = { |
812 | .llseek = zero_lseek, | 812 | .llseek = zero_lseek, |
813 | .read = read_zero, | 813 | .read = read_zero, |
814 | .write = write_zero, | 814 | .write = write_zero, |
@@ -819,14 +819,14 @@ static struct backing_dev_info zero_bdi = { | |||
819 | .capabilities = BDI_CAP_MAP_COPY, | 819 | .capabilities = BDI_CAP_MAP_COPY, |
820 | }; | 820 | }; |
821 | 821 | ||
822 | static struct file_operations full_fops = { | 822 | static const struct file_operations full_fops = { |
823 | .llseek = full_lseek, | 823 | .llseek = full_lseek, |
824 | .read = read_full, | 824 | .read = read_full, |
825 | .write = write_full, | 825 | .write = write_full, |
826 | }; | 826 | }; |
827 | 827 | ||
828 | #ifdef CONFIG_CRASH_DUMP | 828 | #ifdef CONFIG_CRASH_DUMP |
829 | static struct file_operations oldmem_fops = { | 829 | static const struct file_operations oldmem_fops = { |
830 | .read = read_oldmem, | 830 | .read = read_oldmem, |
831 | .open = open_oldmem, | 831 | .open = open_oldmem, |
832 | }; | 832 | }; |
@@ -853,7 +853,7 @@ static ssize_t kmsg_write(struct file * file, const char __user * buf, | |||
853 | return ret; | 853 | return ret; |
854 | } | 854 | } |
855 | 855 | ||
856 | static struct file_operations kmsg_fops = { | 856 | static const struct file_operations kmsg_fops = { |
857 | .write = kmsg_write, | 857 | .write = kmsg_write, |
858 | }; | 858 | }; |
859 | 859 | ||
@@ -903,7 +903,7 @@ static int memory_open(struct inode * inode, struct file * filp) | |||
903 | return 0; | 903 | return 0; |
904 | } | 904 | } |
905 | 905 | ||
906 | static struct file_operations memory_fops = { | 906 | static const struct file_operations memory_fops = { |
907 | .open = memory_open, /* just a selector for the real open */ | 907 | .open = memory_open, /* just a selector for the real open */ |
908 | }; | 908 | }; |
909 | 909 | ||
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index d5fa19da330b..62ebe09656e3 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -113,7 +113,7 @@ static int misc_seq_open(struct inode *inode, struct file *file) | |||
113 | return seq_open(file, &misc_seq_ops); | 113 | return seq_open(file, &misc_seq_ops); |
114 | } | 114 | } |
115 | 115 | ||
116 | static struct file_operations misc_proc_fops = { | 116 | static const struct file_operations misc_proc_fops = { |
117 | .owner = THIS_MODULE, | 117 | .owner = THIS_MODULE, |
118 | .open = misc_seq_open, | 118 | .open = misc_seq_open, |
119 | .read = seq_read, | 119 | .read = seq_read, |
@@ -176,7 +176,7 @@ fail: | |||
176 | */ | 176 | */ |
177 | static struct class *misc_class; | 177 | static struct class *misc_class; |
178 | 178 | ||
179 | static struct file_operations misc_fops = { | 179 | static const struct file_operations misc_fops = { |
180 | .owner = THIS_MODULE, | 180 | .owner = THIS_MODULE, |
181 | .open = misc_open, | 181 | .open = misc_open, |
182 | }; | 182 | }; |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 70b774ff5aa4..1f0f2b6dae26 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
@@ -63,7 +63,7 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); | |||
63 | */ | 63 | */ |
64 | static unsigned long mmtimer_femtoperiod = 0; | 64 | static unsigned long mmtimer_femtoperiod = 0; |
65 | 65 | ||
66 | static struct file_operations mmtimer_fops = { | 66 | static const struct file_operations mmtimer_fops = { |
67 | .owner = THIS_MODULE, | 67 | .owner = THIS_MODULE, |
68 | .mmap = mmtimer_mmap, | 68 | .mmap = mmtimer_mmap, |
69 | .ioctl = mmtimer_ioctl, | 69 | .ioctl = mmtimer_ioctl, |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 4ea7bd5f4f56..a369dd6877d8 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -142,6 +142,7 @@ typedef struct _moxa_board_conf { | |||
142 | 142 | ||
143 | static moxa_board_conf moxa_boards[MAX_BOARDS]; | 143 | static moxa_board_conf moxa_boards[MAX_BOARDS]; |
144 | static void __iomem *moxaBaseAddr[MAX_BOARDS]; | 144 | static void __iomem *moxaBaseAddr[MAX_BOARDS]; |
145 | static int loadstat[MAX_BOARDS]; | ||
145 | 146 | ||
146 | struct moxa_str { | 147 | struct moxa_str { |
147 | int type; | 148 | int type; |
@@ -1688,6 +1689,8 @@ int MoxaDriverPoll(void) | |||
1688 | if (moxaCard == 0) | 1689 | if (moxaCard == 0) |
1689 | return (-1); | 1690 | return (-1); |
1690 | for (card = 0; card < MAX_BOARDS; card++) { | 1691 | for (card = 0; card < MAX_BOARDS; card++) { |
1692 | if (loadstat[card] == 0) | ||
1693 | continue; | ||
1691 | if ((ports = moxa_boards[card].numPorts) == 0) | 1694 | if ((ports = moxa_boards[card].numPorts) == 0) |
1692 | continue; | 1695 | continue; |
1693 | if (readb(moxaIntPend[card]) == 0xff) { | 1696 | if (readb(moxaIntPend[card]) == 0xff) { |
@@ -2903,6 +2906,7 @@ static int moxaloadcode(int cardno, unsigned char __user *tmp, int len) | |||
2903 | } | 2906 | } |
2904 | break; | 2907 | break; |
2905 | } | 2908 | } |
2909 | loadstat[cardno] = 1; | ||
2906 | return (0); | 2910 | return (0); |
2907 | } | 2911 | } |
2908 | 2912 | ||
@@ -2920,7 +2924,7 @@ static int moxaloadc218(int cardno, void __iomem *baseAddr, int len) | |||
2920 | len1 = len >> 1; | 2924 | len1 = len >> 1; |
2921 | ptr = (ushort *) moxaBuff; | 2925 | ptr = (ushort *) moxaBuff; |
2922 | for (i = 0; i < len1; i++) | 2926 | for (i = 0; i < len1; i++) |
2923 | usum += *(ptr + i); | 2927 | usum += le16_to_cpu(*(ptr + i)); |
2924 | retry = 0; | 2928 | retry = 0; |
2925 | do { | 2929 | do { |
2926 | len1 = len >> 1; | 2930 | len1 = len >> 1; |
@@ -2992,7 +2996,7 @@ static int moxaloadc320(int cardno, void __iomem *baseAddr, int len, int *numPor | |||
2992 | wlen = len >> 1; | 2996 | wlen = len >> 1; |
2993 | uptr = (ushort *) moxaBuff; | 2997 | uptr = (ushort *) moxaBuff; |
2994 | for (i = 0; i < wlen; i++) | 2998 | for (i = 0; i < wlen; i++) |
2995 | usum += uptr[i]; | 2999 | usum += le16_to_cpu(uptr[i]); |
2996 | retry = 0; | 3000 | retry = 0; |
2997 | j = 0; | 3001 | j = 0; |
2998 | do { | 3002 | do { |
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index d3ba2f860ef0..39a2e661ff55 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
@@ -454,7 +454,7 @@ static int register_serial_portandirq(unsigned int port, int irq) | |||
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
457 | static struct file_operations mwave_fops = { | 457 | static const struct file_operations mwave_fops = { |
458 | .owner = THIS_MODULE, | 458 | .owner = THIS_MODULE, |
459 | .read = mwave_read, | 459 | .read = mwave_read, |
460 | .write = mwave_write, | 460 | .write = mwave_write, |
diff --git a/drivers/char/nsc_gpio.c b/drivers/char/nsc_gpio.c index 5b91e4e25641..7719bd75810b 100644 --- a/drivers/char/nsc_gpio.c +++ b/drivers/char/nsc_gpio.c | |||
@@ -68,13 +68,11 @@ ssize_t nsc_gpio_write(struct file *file, const char __user *data, | |||
68 | amp->gpio_config(m, ~1, 0); | 68 | amp->gpio_config(m, ~1, 0); |
69 | break; | 69 | break; |
70 | case 'T': | 70 | case 'T': |
71 | dev_dbg(dev, "GPIO%d output is push pull\n", | 71 | dev_dbg(dev, "GPIO%d output is push pull\n", m); |
72 | m); | ||
73 | amp->gpio_config(m, ~2, 2); | 72 | amp->gpio_config(m, ~2, 2); |
74 | break; | 73 | break; |
75 | case 't': | 74 | case 't': |
76 | dev_dbg(dev, "GPIO%d output is open drain\n", | 75 | dev_dbg(dev, "GPIO%d output is open drain\n", m); |
77 | m); | ||
78 | amp->gpio_config(m, ~2, 0); | 76 | amp->gpio_config(m, ~2, 0); |
79 | break; | 77 | break; |
80 | case 'P': | 78 | case 'P': |
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 8c5f102622b6..a39f19c35a6a 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -437,7 +437,7 @@ nvram_read_proc(char *buffer, char **start, off_t offset, | |||
437 | 437 | ||
438 | #endif /* CONFIG_PROC_FS */ | 438 | #endif /* CONFIG_PROC_FS */ |
439 | 439 | ||
440 | static struct file_operations nvram_fops = { | 440 | static const struct file_operations nvram_fops = { |
441 | .owner = THIS_MODULE, | 441 | .owner = THIS_MODULE, |
442 | .llseek = nvram_llseek, | 442 | .llseek = nvram_llseek, |
443 | .read = nvram_read, | 443 | .read = nvram_read, |
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index f240a104d250..7c57ebfa8640 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c | |||
@@ -183,7 +183,7 @@ static int button_read (struct file *filp, char __user *buffer, | |||
183 | * attempts to perform these operations on the device. | 183 | * attempts to perform these operations on the device. |
184 | */ | 184 | */ |
185 | 185 | ||
186 | static struct file_operations button_fops = { | 186 | static const struct file_operations button_fops = { |
187 | .owner = THIS_MODULE, | 187 | .owner = THIS_MODULE, |
188 | .read = button_read, | 188 | .read = button_read, |
189 | }; | 189 | }; |
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index 8865387d3448..206cf6f50695 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
@@ -642,7 +642,7 @@ static void kick_open(void) | |||
642 | udelay(25); | 642 | udelay(25); |
643 | } | 643 | } |
644 | 644 | ||
645 | static struct file_operations flash_fops = | 645 | static const struct file_operations flash_fops = |
646 | { | 646 | { |
647 | .owner = THIS_MODULE, | 647 | .owner = THIS_MODULE, |
648 | .llseek = flash_llseek, | 648 | .llseek = flash_llseek, |
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c index c860de6a6fde..84e5a68635f1 100644 --- a/drivers/char/pc8736x_gpio.c +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -3,18 +3,18 @@ | |||
3 | National Semiconductor PC8736x GPIO driver. Allows a user space | 3 | National Semiconductor PC8736x GPIO driver. Allows a user space |
4 | process to play with the GPIO pins. | 4 | process to play with the GPIO pins. |
5 | 5 | ||
6 | Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com> | 6 | Copyright (c) 2005,2006 Jim Cromie <jim.cromie@gmail.com> |
7 | 7 | ||
8 | adapted from linux/drivers/char/scx200_gpio.c | 8 | adapted from linux/drivers/char/scx200_gpio.c |
9 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>, | 9 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>, |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
15 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/cdev.h> | ||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/ioport.h> | 19 | #include <linux/ioport.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
@@ -25,7 +25,7 @@ | |||
25 | #define DEVNAME "pc8736x_gpio" | 25 | #define DEVNAME "pc8736x_gpio" |
26 | 26 | ||
27 | MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); | 27 | MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); |
28 | MODULE_DESCRIPTION("NatSemi PC-8736x GPIO Pin Driver"); | 28 | MODULE_DESCRIPTION("NatSemi/Winbond PC-8736x GPIO Pin Driver"); |
29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
30 | 30 | ||
31 | static int major; /* default to dynamic major */ | 31 | static int major; /* default to dynamic major */ |
@@ -38,14 +38,14 @@ static u8 pc8736x_gpio_shadow[4]; | |||
38 | 38 | ||
39 | #define SIO_BASE1 0x2E /* 1st command-reg to check */ | 39 | #define SIO_BASE1 0x2E /* 1st command-reg to check */ |
40 | #define SIO_BASE2 0x4E /* alt command-reg to check */ | 40 | #define SIO_BASE2 0x4E /* alt command-reg to check */ |
41 | #define SIO_BASE_OFFSET 0x20 | ||
42 | 41 | ||
43 | #define SIO_SID 0x20 /* SuperI/O ID Register */ | 42 | #define SIO_SID 0x20 /* SuperI/O ID Register */ |
44 | #define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ | 43 | #define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ |
45 | 44 | ||
46 | #define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ | 45 | #define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ |
47 | 46 | ||
48 | #define PC8736X_GPIO_SIZE 16 | 47 | #define PC8736X_GPIO_RANGE 16 /* ioaddr range */ |
48 | #define PC8736X_GPIO_CT 32 /* minors matching 4 8 bit ports */ | ||
49 | 49 | ||
50 | #define SIO_UNIT_SEL 0x7 /* unit select reg */ | 50 | #define SIO_UNIT_SEL 0x7 /* unit select reg */ |
51 | #define SIO_UNIT_ACT 0x30 /* unit enable */ | 51 | #define SIO_UNIT_ACT 0x30 /* unit enable */ |
@@ -212,14 +212,12 @@ static void pc8736x_gpio_change(unsigned index) | |||
212 | pc8736x_gpio_set(index, !pc8736x_gpio_current(index)); | 212 | pc8736x_gpio_set(index, !pc8736x_gpio_current(index)); |
213 | } | 213 | } |
214 | 214 | ||
215 | static struct nsc_gpio_ops pc8736x_access = { | 215 | static struct nsc_gpio_ops pc8736x_gpio_ops = { |
216 | .owner = THIS_MODULE, | 216 | .owner = THIS_MODULE, |
217 | .gpio_config = pc8736x_gpio_configure, | 217 | .gpio_config = pc8736x_gpio_configure, |
218 | .gpio_dump = nsc_gpio_dump, | 218 | .gpio_dump = nsc_gpio_dump, |
219 | .gpio_get = pc8736x_gpio_get, | 219 | .gpio_get = pc8736x_gpio_get, |
220 | .gpio_set = pc8736x_gpio_set, | 220 | .gpio_set = pc8736x_gpio_set, |
221 | .gpio_set_high = pc8736x_gpio_set_high, | ||
222 | .gpio_set_low = pc8736x_gpio_set_low, | ||
223 | .gpio_change = pc8736x_gpio_change, | 221 | .gpio_change = pc8736x_gpio_change, |
224 | .gpio_current = pc8736x_gpio_current | 222 | .gpio_current = pc8736x_gpio_current |
225 | }; | 223 | }; |
@@ -227,16 +225,16 @@ static struct nsc_gpio_ops pc8736x_access = { | |||
227 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) | 225 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) |
228 | { | 226 | { |
229 | unsigned m = iminor(inode); | 227 | unsigned m = iminor(inode); |
230 | file->private_data = &pc8736x_access; | 228 | file->private_data = &pc8736x_gpio_ops; |
231 | 229 | ||
232 | dev_dbg(&pdev->dev, "open %d\n", m); | 230 | dev_dbg(&pdev->dev, "open %d\n", m); |
233 | 231 | ||
234 | if (m > 63) | 232 | if (m >= PC8736X_GPIO_CT) |
235 | return -EINVAL; | 233 | return -EINVAL; |
236 | return nonseekable_open(inode, file); | 234 | return nonseekable_open(inode, file); |
237 | } | 235 | } |
238 | 236 | ||
239 | static struct file_operations pc8736x_gpio_fops = { | 237 | static const struct file_operations pc8736x_gpio_fileops = { |
240 | .owner = THIS_MODULE, | 238 | .owner = THIS_MODULE, |
241 | .open = pc8736x_gpio_open, | 239 | .open = pc8736x_gpio_open, |
242 | .write = nsc_gpio_write, | 240 | .write = nsc_gpio_write, |
@@ -255,9 +253,12 @@ static void __init pc8736x_init_shadow(void) | |||
255 | 253 | ||
256 | } | 254 | } |
257 | 255 | ||
256 | static struct cdev pc8736x_gpio_cdev; | ||
257 | |||
258 | static int __init pc8736x_gpio_init(void) | 258 | static int __init pc8736x_gpio_init(void) |
259 | { | 259 | { |
260 | int rc = 0; | 260 | int rc; |
261 | dev_t devid; | ||
261 | 262 | ||
262 | pdev = platform_device_alloc(DEVNAME, 0); | 263 | pdev = platform_device_alloc(DEVNAME, 0); |
263 | if (!pdev) | 264 | if (!pdev) |
@@ -275,7 +276,7 @@ static int __init pc8736x_gpio_init(void) | |||
275 | dev_err(&pdev->dev, "no device found\n"); | 276 | dev_err(&pdev->dev, "no device found\n"); |
276 | goto undo_platform_dev_add; | 277 | goto undo_platform_dev_add; |
277 | } | 278 | } |
278 | pc8736x_access.dev = &pdev->dev; | 279 | pc8736x_gpio_ops.dev = &pdev->dev; |
279 | 280 | ||
280 | /* Verify that chip and it's GPIO unit are both enabled. | 281 | /* Verify that chip and it's GPIO unit are both enabled. |
281 | My BIOS does this, so I take minimum action here | 282 | My BIOS does this, so I take minimum action here |
@@ -297,7 +298,7 @@ static int __init pc8736x_gpio_init(void) | |||
297 | pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8 | 298 | pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8 |
298 | | superio_inb(SIO_BASE_LADDR)); | 299 | | superio_inb(SIO_BASE_LADDR)); |
299 | 300 | ||
300 | if (!request_region(pc8736x_gpio_base, 16, DEVNAME)) { | 301 | if (!request_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE, DEVNAME)) { |
301 | rc = -ENODEV; | 302 | rc = -ENODEV; |
302 | dev_err(&pdev->dev, "GPIO ioport %x busy\n", | 303 | dev_err(&pdev->dev, "GPIO ioport %x busy\n", |
303 | pc8736x_gpio_base); | 304 | pc8736x_gpio_base); |
@@ -305,10 +306,17 @@ static int __init pc8736x_gpio_init(void) | |||
305 | } | 306 | } |
306 | dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); | 307 | dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); |
307 | 308 | ||
308 | rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops); | 309 | if (major) { |
310 | devid = MKDEV(major, 0); | ||
311 | rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME); | ||
312 | } else { | ||
313 | rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME); | ||
314 | major = MAJOR(devid); | ||
315 | } | ||
316 | |||
309 | if (rc < 0) { | 317 | if (rc < 0) { |
310 | dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); | 318 | dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); |
311 | goto undo_platform_dev_add; | 319 | goto undo_request_region; |
312 | } | 320 | } |
313 | if (!major) { | 321 | if (!major) { |
314 | major = rc; | 322 | major = rc; |
@@ -316,8 +324,15 @@ static int __init pc8736x_gpio_init(void) | |||
316 | } | 324 | } |
317 | 325 | ||
318 | pc8736x_init_shadow(); | 326 | pc8736x_init_shadow(); |
327 | |||
328 | /* ignore minor errs, and succeed */ | ||
329 | cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fileops); | ||
330 | cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT); | ||
331 | |||
319 | return 0; | 332 | return 0; |
320 | 333 | ||
334 | undo_request_region: | ||
335 | release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE); | ||
321 | undo_platform_dev_add: | 336 | undo_platform_dev_add: |
322 | platform_device_del(pdev); | 337 | platform_device_del(pdev); |
323 | undo_platform_dev_alloc: | 338 | undo_platform_dev_alloc: |
@@ -328,14 +343,15 @@ undo_platform_dev_alloc: | |||
328 | 343 | ||
329 | static void __exit pc8736x_gpio_cleanup(void) | 344 | static void __exit pc8736x_gpio_cleanup(void) |
330 | { | 345 | { |
331 | dev_dbg(&pdev->dev, " cleanup\n"); | 346 | dev_dbg(&pdev->dev, "cleanup\n"); |
332 | 347 | ||
333 | release_region(pc8736x_gpio_base, 16); | 348 | cdev_del(&pc8736x_gpio_cdev); |
349 | unregister_chrdev_region(MKDEV(major,0), PC8736X_GPIO_CT); | ||
350 | release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE); | ||
334 | 351 | ||
335 | unregister_chrdev(major, DEVNAME); | 352 | platform_device_del(pdev); |
353 | platform_device_put(pdev); | ||
336 | } | 354 | } |
337 | 355 | ||
338 | EXPORT_SYMBOL(pc8736x_access); | ||
339 | |||
340 | module_init(pc8736x_gpio_init); | 356 | module_init(pc8736x_gpio_init); |
341 | module_exit(pc8736x_gpio_cleanup); | 357 | module_exit(pc8736x_gpio_cleanup); |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 31c8a21f9d87..50d20aafeb18 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -1938,7 +1938,7 @@ static void cm4000_detach(struct pcmcia_device *link) | |||
1938 | return; | 1938 | return; |
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | static struct file_operations cm4000_fops = { | 1941 | static const struct file_operations cm4000_fops = { |
1942 | .owner = THIS_MODULE, | 1942 | .owner = THIS_MODULE, |
1943 | .read = cmm_read, | 1943 | .read = cmm_read, |
1944 | .write = cmm_write, | 1944 | .write = cmm_write, |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 47a8465bf95b..55cf4be42976 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -688,7 +688,7 @@ static void reader_detach(struct pcmcia_device *link) | |||
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | 690 | ||
691 | static struct file_operations reader_fops = { | 691 | static const struct file_operations reader_fops = { |
692 | .owner = THIS_MODULE, | 692 | .owner = THIS_MODULE, |
693 | .read = cm4040_read, | 693 | .read = cm4040_read, |
694 | .write = cm4040_write, | 694 | .write = cm4040_write, |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 17bc8abd5df5..00f574cbb0d4 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -1174,8 +1174,12 @@ static void dcd_change(MGSLPC_INFO *info) | |||
1174 | else | 1174 | else |
1175 | info->input_signal_events.dcd_down++; | 1175 | info->input_signal_events.dcd_down++; |
1176 | #ifdef CONFIG_HDLC | 1176 | #ifdef CONFIG_HDLC |
1177 | if (info->netcount) | 1177 | if (info->netcount) { |
1178 | hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, info->netdev); | 1178 | if (info->serial_signals & SerialSignal_DCD) |
1179 | netif_carrier_on(info->netdev); | ||
1180 | else | ||
1181 | netif_carrier_off(info->netdev); | ||
1182 | } | ||
1179 | #endif | 1183 | #endif |
1180 | wake_up_interruptible(&info->status_event_wait_q); | 1184 | wake_up_interruptible(&info->status_event_wait_q); |
1181 | wake_up_interruptible(&info->event_wait_q); | 1185 | wake_up_interruptible(&info->event_wait_q); |
@@ -4251,8 +4255,10 @@ static int hdlcdev_open(struct net_device *dev) | |||
4251 | spin_lock_irqsave(&info->lock, flags); | 4255 | spin_lock_irqsave(&info->lock, flags); |
4252 | get_signals(info); | 4256 | get_signals(info); |
4253 | spin_unlock_irqrestore(&info->lock, flags); | 4257 | spin_unlock_irqrestore(&info->lock, flags); |
4254 | hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev); | 4258 | if (info->serial_signals & SerialSignal_DCD) |
4255 | 4259 | netif_carrier_on(dev); | |
4260 | else | ||
4261 | netif_carrier_off(dev); | ||
4256 | return 0; | 4262 | return 0; |
4257 | } | 4263 | } |
4258 | 4264 | ||
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 24231d9743dc..520d2cf82bc0 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -739,7 +739,7 @@ static unsigned int pp_poll (struct file * file, poll_table * wait) | |||
739 | 739 | ||
740 | static struct class *ppdev_class; | 740 | static struct class *ppdev_class; |
741 | 741 | ||
742 | static struct file_operations pp_fops = { | 742 | static const struct file_operations pp_fops = { |
743 | .owner = THIS_MODULE, | 743 | .owner = THIS_MODULE, |
744 | .llseek = no_llseek, | 744 | .llseek = no_llseek, |
745 | .read = pp_read, | 745 | .read = pp_read, |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 164bddae047f..4c3a5ca9d8f7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -416,7 +416,7 @@ static struct entropy_store input_pool = { | |||
416 | .poolinfo = &poolinfo_table[0], | 416 | .poolinfo = &poolinfo_table[0], |
417 | .name = "input", | 417 | .name = "input", |
418 | .limit = 1, | 418 | .limit = 1, |
419 | .lock = SPIN_LOCK_UNLOCKED, | 419 | .lock = __SPIN_LOCK_UNLOCKED(&input_pool.lock), |
420 | .pool = input_pool_data | 420 | .pool = input_pool_data |
421 | }; | 421 | }; |
422 | 422 | ||
@@ -425,7 +425,7 @@ static struct entropy_store blocking_pool = { | |||
425 | .name = "blocking", | 425 | .name = "blocking", |
426 | .limit = 1, | 426 | .limit = 1, |
427 | .pull = &input_pool, | 427 | .pull = &input_pool, |
428 | .lock = SPIN_LOCK_UNLOCKED, | 428 | .lock = __SPIN_LOCK_UNLOCKED(&blocking_pool.lock), |
429 | .pool = blocking_pool_data | 429 | .pool = blocking_pool_data |
430 | }; | 430 | }; |
431 | 431 | ||
@@ -433,7 +433,7 @@ static struct entropy_store nonblocking_pool = { | |||
433 | .poolinfo = &poolinfo_table[1], | 433 | .poolinfo = &poolinfo_table[1], |
434 | .name = "nonblocking", | 434 | .name = "nonblocking", |
435 | .pull = &input_pool, | 435 | .pull = &input_pool, |
436 | .lock = SPIN_LOCK_UNLOCKED, | 436 | .lock = __SPIN_LOCK_UNLOCKED(&nonblocking_pool.lock), |
437 | .pool = nonblocking_pool_data | 437 | .pool = nonblocking_pool_data |
438 | }; | 438 | }; |
439 | 439 | ||
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 9bf97c5e38c0..579868af4a54 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -30,7 +30,7 @@ struct raw_device_data { | |||
30 | static struct class *raw_class; | 30 | static struct class *raw_class; |
31 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; | 31 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; |
32 | static DEFINE_MUTEX(raw_mutex); | 32 | static DEFINE_MUTEX(raw_mutex); |
33 | static struct file_operations raw_ctl_fops; /* forward declaration */ | 33 | static const struct file_operations raw_ctl_fops; /* forward declaration */ |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Open/close code for raw IO. | 36 | * Open/close code for raw IO. |
@@ -261,7 +261,7 @@ static ssize_t raw_file_aio_write(struct kiocb *iocb, const char __user *buf, | |||
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | static struct file_operations raw_fops = { | 264 | static const struct file_operations raw_fops = { |
265 | .read = generic_file_read, | 265 | .read = generic_file_read, |
266 | .aio_read = generic_file_aio_read, | 266 | .aio_read = generic_file_aio_read, |
267 | .write = raw_file_write, | 267 | .write = raw_file_write, |
@@ -274,7 +274,7 @@ static struct file_operations raw_fops = { | |||
274 | .owner = THIS_MODULE, | 274 | .owner = THIS_MODULE, |
275 | }; | 275 | }; |
276 | 276 | ||
277 | static struct file_operations raw_ctl_fops = { | 277 | static const struct file_operations raw_ctl_fops = { |
278 | .ioctl = raw_ctl_ioctl, | 278 | .ioctl = raw_ctl_ioctl, |
279 | .open = raw_open, | 279 | .open = raw_open, |
280 | .owner = THIS_MODULE, | 280 | .owner = THIS_MODULE, |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 3afc6a47ebbc..3fa80aaf4527 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -243,7 +243,7 @@ static struct real_driver rio_real_driver = { | |||
243 | * | 243 | * |
244 | */ | 244 | */ |
245 | 245 | ||
246 | static struct file_operations rio_fw_fops = { | 246 | static const struct file_operations rio_fw_fops = { |
247 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
248 | .ioctl = rio_fw_ioctl, | 248 | .ioctl = rio_fw_ioctl, |
249 | }; | 249 | }; |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index aefac4ac0bf5..6e6a7c7a7eff 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -46,13 +46,12 @@ | |||
46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init | 46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init |
47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer | 47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer |
48 | * CONFIG_HPET_EMULATE_RTC | 48 | * CONFIG_HPET_EMULATE_RTC |
49 | * 1.12a Maciej W. Rozycki: Handle memory-mapped chips properly. | ||
49 | * 1.12ac Alan Cox: Allow read access to the day of week register | 50 | * 1.12ac Alan Cox: Allow read access to the day of week register |
50 | */ | 51 | */ |
51 | 52 | ||
52 | #define RTC_VERSION "1.12ac" | 53 | #define RTC_VERSION "1.12ac" |
53 | 54 | ||
54 | #define RTC_IO_EXTENT 0x8 | ||
55 | |||
56 | /* | 55 | /* |
57 | * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with | 56 | * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with |
58 | * interrupts disabled. Due to the index-port/data-port (0x70/0x71) | 57 | * interrupts disabled. Due to the index-port/data-port (0x70/0x71) |
@@ -337,7 +336,15 @@ static ssize_t rtc_read(struct file *file, char __user *buf, | |||
337 | if (rtc_has_irq == 0) | 336 | if (rtc_has_irq == 0) |
338 | return -EIO; | 337 | return -EIO; |
339 | 338 | ||
340 | if (count < sizeof(unsigned)) | 339 | /* |
340 | * Historically this function used to assume that sizeof(unsigned long) | ||
341 | * is the same in userspace and kernelspace. This lead to problems | ||
342 | * for configurations with multiple ABIs such a the MIPS o32 and 64 | ||
343 | * ABIs supported on the same kernel. So now we support read of both | ||
344 | * 4 and 8 bytes and assume that's the sizeof(unsigned long) in the | ||
345 | * userspace ABI. | ||
346 | */ | ||
347 | if (count != sizeof(unsigned int) && count != sizeof(unsigned long)) | ||
341 | return -EINVAL; | 348 | return -EINVAL; |
342 | 349 | ||
343 | add_wait_queue(&rtc_wait, &wait); | 350 | add_wait_queue(&rtc_wait, &wait); |
@@ -368,10 +375,12 @@ static ssize_t rtc_read(struct file *file, char __user *buf, | |||
368 | schedule(); | 375 | schedule(); |
369 | } while (1); | 376 | } while (1); |
370 | 377 | ||
371 | if (count < sizeof(unsigned long)) | 378 | if (count == sizeof(unsigned int)) |
372 | retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); | 379 | retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); |
373 | else | 380 | else |
374 | retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long); | 381 | retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long); |
382 | if (!retval) | ||
383 | retval = count; | ||
375 | out: | 384 | out: |
376 | current->state = TASK_RUNNING; | 385 | current->state = TASK_RUNNING; |
377 | remove_wait_queue(&rtc_wait, &wait); | 386 | remove_wait_queue(&rtc_wait, &wait); |
@@ -877,7 +886,7 @@ int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg) | |||
877 | * The various file operations we support. | 886 | * The various file operations we support. |
878 | */ | 887 | */ |
879 | 888 | ||
880 | static struct file_operations rtc_fops = { | 889 | static const struct file_operations rtc_fops = { |
881 | .owner = THIS_MODULE, | 890 | .owner = THIS_MODULE, |
882 | .llseek = no_llseek, | 891 | .llseek = no_llseek, |
883 | .read = rtc_read, | 892 | .read = rtc_read, |
@@ -896,7 +905,7 @@ static struct miscdevice rtc_dev = { | |||
896 | .fops = &rtc_fops, | 905 | .fops = &rtc_fops, |
897 | }; | 906 | }; |
898 | 907 | ||
899 | static struct file_operations rtc_proc_fops = { | 908 | static const struct file_operations rtc_proc_fops = { |
900 | .owner = THIS_MODULE, | 909 | .owner = THIS_MODULE, |
901 | .open = rtc_proc_open, | 910 | .open = rtc_proc_open, |
902 | .read = seq_read, | 911 | .read = seq_read, |
@@ -923,6 +932,9 @@ static int __init rtc_init(void) | |||
923 | struct sparc_isa_device *isa_dev; | 932 | struct sparc_isa_device *isa_dev; |
924 | #endif | 933 | #endif |
925 | #endif | 934 | #endif |
935 | #ifndef __sparc__ | ||
936 | void *r; | ||
937 | #endif | ||
926 | 938 | ||
927 | #ifdef __sparc__ | 939 | #ifdef __sparc__ |
928 | for_each_ebus(ebus) { | 940 | for_each_ebus(ebus) { |
@@ -964,8 +976,13 @@ found: | |||
964 | } | 976 | } |
965 | no_irq: | 977 | no_irq: |
966 | #else | 978 | #else |
967 | if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc")) { | 979 | if (RTC_IOMAPPED) |
968 | printk(KERN_ERR "rtc: I/O port %d is not free.\n", RTC_PORT (0)); | 980 | r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); |
981 | else | ||
982 | r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | ||
983 | if (!r) { | ||
984 | printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", | ||
985 | (long)(RTC_PORT(0))); | ||
969 | return -EIO; | 986 | return -EIO; |
970 | } | 987 | } |
971 | 988 | ||
@@ -979,7 +996,10 @@ no_irq: | |||
979 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { | 996 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { |
980 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 997 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
981 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 998 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
982 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 999 | if (RTC_IOMAPPED) |
1000 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1001 | else | ||
1002 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
983 | return -EIO; | 1003 | return -EIO; |
984 | } | 1004 | } |
985 | hpet_rtc_timer_init(); | 1005 | hpet_rtc_timer_init(); |
@@ -1079,7 +1099,10 @@ static void __exit rtc_exit (void) | |||
1079 | if (rtc_has_irq) | 1099 | if (rtc_has_irq) |
1080 | free_irq (rtc_irq, &rtc_port); | 1100 | free_irq (rtc_irq, &rtc_port); |
1081 | #else | 1101 | #else |
1082 | release_region (RTC_PORT (0), RTC_IO_EXTENT); | 1102 | if (RTC_IOMAPPED) |
1103 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1104 | else | ||
1105 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1083 | #ifdef RTC_IRQ | 1106 | #ifdef RTC_IRQ |
1084 | if (rtc_has_irq) | 1107 | if (rtc_has_irq) |
1085 | free_irq (RTC_IRQ, NULL); | 1108 | free_irq (RTC_IRQ, NULL); |
@@ -1222,7 +1245,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file) | |||
1222 | 1245 | ||
1223 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) | 1246 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) |
1224 | { | 1247 | { |
1225 | unsigned long uip_watchdog = jiffies; | 1248 | unsigned long uip_watchdog = jiffies, flags; |
1226 | unsigned char ctrl; | 1249 | unsigned char ctrl; |
1227 | #ifdef CONFIG_MACH_DECSTATION | 1250 | #ifdef CONFIG_MACH_DECSTATION |
1228 | unsigned int real_year; | 1251 | unsigned int real_year; |
@@ -1249,7 +1272,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1249 | * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is | 1272 | * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is |
1250 | * only updated by the RTC when initially set to a non-zero value. | 1273 | * only updated by the RTC when initially set to a non-zero value. |
1251 | */ | 1274 | */ |
1252 | spin_lock_irq(&rtc_lock); | 1275 | spin_lock_irqsave(&rtc_lock, flags); |
1253 | rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); | 1276 | rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); |
1254 | rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); | 1277 | rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); |
1255 | rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); | 1278 | rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); |
@@ -1263,7 +1286,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1263 | real_year = CMOS_READ(RTC_DEC_YEAR); | 1286 | real_year = CMOS_READ(RTC_DEC_YEAR); |
1264 | #endif | 1287 | #endif |
1265 | ctrl = CMOS_READ(RTC_CONTROL); | 1288 | ctrl = CMOS_READ(RTC_CONTROL); |
1266 | spin_unlock_irq(&rtc_lock); | 1289 | spin_unlock_irqrestore(&rtc_lock, flags); |
1267 | 1290 | ||
1268 | if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 1291 | if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
1269 | { | 1292 | { |
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 45083e5dd23b..b956c7babd18 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ | 6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ |
7 | 7 | ||
8 | #include <linux/config.h> | ||
9 | #include <linux/device.h> | 8 | #include <linux/device.h> |
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include <linux/module.h> | 10 | #include <linux/module.h> |
@@ -22,37 +21,37 @@ | |||
22 | #include <linux/scx200_gpio.h> | 21 | #include <linux/scx200_gpio.h> |
23 | #include <linux/nsc_gpio.h> | 22 | #include <linux/nsc_gpio.h> |
24 | 23 | ||
25 | #define NAME "scx200_gpio" | 24 | #define DRVNAME "scx200_gpio" |
26 | #define DEVNAME NAME | ||
27 | 25 | ||
28 | static struct platform_device *pdev; | 26 | static struct platform_device *pdev; |
29 | 27 | ||
30 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); | 28 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); |
31 | MODULE_DESCRIPTION("NatSemi SCx200 GPIO Pin Driver"); | 29 | MODULE_DESCRIPTION("NatSemi/AMD SCx200 GPIO Pin Driver"); |
32 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
33 | 31 | ||
34 | static int major = 0; /* default to dynamic major */ | 32 | static int major = 0; /* default to dynamic major */ |
35 | module_param(major, int, 0); | 33 | module_param(major, int, 0); |
36 | MODULE_PARM_DESC(major, "Major device number"); | 34 | MODULE_PARM_DESC(major, "Major device number"); |
37 | 35 | ||
38 | struct nsc_gpio_ops scx200_access = { | 36 | #define MAX_PINS 32 /* 64 later, when known ok */ |
37 | |||
38 | struct nsc_gpio_ops scx200_gpio_ops = { | ||
39 | .owner = THIS_MODULE, | 39 | .owner = THIS_MODULE, |
40 | .gpio_config = scx200_gpio_configure, | 40 | .gpio_config = scx200_gpio_configure, |
41 | .gpio_dump = nsc_gpio_dump, | 41 | .gpio_dump = nsc_gpio_dump, |
42 | .gpio_get = scx200_gpio_get, | 42 | .gpio_get = scx200_gpio_get, |
43 | .gpio_set = scx200_gpio_set, | 43 | .gpio_set = scx200_gpio_set, |
44 | .gpio_set_high = scx200_gpio_set_high, | ||
45 | .gpio_set_low = scx200_gpio_set_low, | ||
46 | .gpio_change = scx200_gpio_change, | 44 | .gpio_change = scx200_gpio_change, |
47 | .gpio_current = scx200_gpio_current | 45 | .gpio_current = scx200_gpio_current |
48 | }; | 46 | }; |
47 | EXPORT_SYMBOL(scx200_gpio_ops); | ||
49 | 48 | ||
50 | static int scx200_gpio_open(struct inode *inode, struct file *file) | 49 | static int scx200_gpio_open(struct inode *inode, struct file *file) |
51 | { | 50 | { |
52 | unsigned m = iminor(inode); | 51 | unsigned m = iminor(inode); |
53 | file->private_data = &scx200_access; | 52 | file->private_data = &scx200_gpio_ops; |
54 | 53 | ||
55 | if (m > 63) | 54 | if (m >= MAX_PINS) |
56 | return -EINVAL; | 55 | return -EINVAL; |
57 | return nonseekable_open(inode, file); | 56 | return nonseekable_open(inode, file); |
58 | } | 57 | } |
@@ -62,8 +61,7 @@ static int scx200_gpio_release(struct inode *inode, struct file *file) | |||
62 | return 0; | 61 | return 0; |
63 | } | 62 | } |
64 | 63 | ||
65 | 64 | static const struct file_operations scx200_gpio_fileops = { | |
66 | static struct file_operations scx200_gpio_fops = { | ||
67 | .owner = THIS_MODULE, | 65 | .owner = THIS_MODULE, |
68 | .write = nsc_gpio_write, | 66 | .write = nsc_gpio_write, |
69 | .read = nsc_gpio_read, | 67 | .read = nsc_gpio_read, |
@@ -71,21 +69,20 @@ static struct file_operations scx200_gpio_fops = { | |||
71 | .release = scx200_gpio_release, | 69 | .release = scx200_gpio_release, |
72 | }; | 70 | }; |
73 | 71 | ||
74 | struct cdev *scx200_devices; | 72 | struct cdev scx200_gpio_cdev; /* use 1 cdev for all pins */ |
75 | static int num_pins = 32; | ||
76 | 73 | ||
77 | static int __init scx200_gpio_init(void) | 74 | static int __init scx200_gpio_init(void) |
78 | { | 75 | { |
79 | int rc, i; | 76 | int rc; |
80 | dev_t dev = MKDEV(major, 0); | 77 | dev_t devid; |
81 | 78 | ||
82 | if (!scx200_gpio_present()) { | 79 | if (!scx200_gpio_present()) { |
83 | printk(KERN_ERR NAME ": no SCx200 gpio present\n"); | 80 | printk(KERN_ERR DRVNAME ": no SCx200 gpio present\n"); |
84 | return -ENODEV; | 81 | return -ENODEV; |
85 | } | 82 | } |
86 | 83 | ||
87 | /* support dev_dbg() with pdev->dev */ | 84 | /* support dev_dbg() with pdev->dev */ |
88 | pdev = platform_device_alloc(DEVNAME, 0); | 85 | pdev = platform_device_alloc(DRVNAME, 0); |
89 | if (!pdev) | 86 | if (!pdev) |
90 | return -ENOMEM; | 87 | return -ENOMEM; |
91 | 88 | ||
@@ -94,37 +91,25 @@ static int __init scx200_gpio_init(void) | |||
94 | goto undo_malloc; | 91 | goto undo_malloc; |
95 | 92 | ||
96 | /* nsc_gpio uses dev_dbg(), so needs this */ | 93 | /* nsc_gpio uses dev_dbg(), so needs this */ |
97 | scx200_access.dev = &pdev->dev; | 94 | scx200_gpio_ops.dev = &pdev->dev; |
98 | 95 | ||
99 | if (major) | 96 | if (major) { |
100 | rc = register_chrdev_region(dev, num_pins, "scx200_gpio"); | 97 | devid = MKDEV(major, 0); |
101 | else { | 98 | rc = register_chrdev_region(devid, MAX_PINS, "scx200_gpio"); |
102 | rc = alloc_chrdev_region(&dev, 0, num_pins, "scx200_gpio"); | 99 | } else { |
103 | major = MAJOR(dev); | 100 | rc = alloc_chrdev_region(&devid, 0, MAX_PINS, "scx200_gpio"); |
101 | major = MAJOR(devid); | ||
104 | } | 102 | } |
105 | if (rc < 0) { | 103 | if (rc < 0) { |
106 | dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); | 104 | dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); |
107 | goto undo_platform_device_add; | 105 | goto undo_platform_device_add; |
108 | } | 106 | } |
109 | scx200_devices = kzalloc(num_pins * sizeof(struct cdev), GFP_KERNEL); | 107 | |
110 | if (!scx200_devices) { | 108 | cdev_init(&scx200_gpio_cdev, &scx200_gpio_fileops); |
111 | rc = -ENOMEM; | 109 | cdev_add(&scx200_gpio_cdev, devid, MAX_PINS); |
112 | goto undo_chrdev_region; | ||
113 | } | ||
114 | for (i = 0; i < num_pins; i++) { | ||
115 | struct cdev *cdev = &scx200_devices[i]; | ||
116 | cdev_init(cdev, &scx200_gpio_fops); | ||
117 | cdev->owner = THIS_MODULE; | ||
118 | rc = cdev_add(cdev, MKDEV(major, i), 1); | ||
119 | /* tolerate 'minor' errors */ | ||
120 | if (rc) | ||
121 | dev_err(&pdev->dev, "Error %d on minor %d", rc, i); | ||
122 | } | ||
123 | 110 | ||
124 | return 0; /* succeed */ | 111 | return 0; /* succeed */ |
125 | 112 | ||
126 | undo_chrdev_region: | ||
127 | unregister_chrdev_region(dev, num_pins); | ||
128 | undo_platform_device_add: | 113 | undo_platform_device_add: |
129 | platform_device_del(pdev); | 114 | platform_device_del(pdev); |
130 | undo_malloc: | 115 | undo_malloc: |
@@ -135,10 +120,11 @@ undo_malloc: | |||
135 | 120 | ||
136 | static void __exit scx200_gpio_cleanup(void) | 121 | static void __exit scx200_gpio_cleanup(void) |
137 | { | 122 | { |
138 | kfree(scx200_devices); | 123 | cdev_del(&scx200_gpio_cdev); |
139 | unregister_chrdev_region(MKDEV(major, 0), num_pins); | 124 | /* cdev_put(&scx200_gpio_cdev); */ |
125 | |||
126 | unregister_chrdev_region(MKDEV(major, 0), MAX_PINS); | ||
140 | platform_device_unregister(pdev); | 127 | platform_device_unregister(pdev); |
141 | /* kfree(pdev); */ | ||
142 | } | 128 | } |
143 | 129 | ||
144 | module_init(scx200_gpio_init); | 130 | module_init(scx200_gpio_init); |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 203240b6c08f..07e0b75f2338 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -347,7 +347,7 @@ scdrv_poll(struct file *file, struct poll_table_struct *wait) | |||
347 | return mask; | 347 | return mask; |
348 | } | 348 | } |
349 | 349 | ||
350 | static struct file_operations scdrv_fops = { | 350 | static const struct file_operations scdrv_fops = { |
351 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
352 | .read = scdrv_read, | 352 | .read = scdrv_read, |
353 | .write = scdrv_write, | 353 | .write = scdrv_write, |
@@ -374,7 +374,12 @@ scdrv_init(void) | |||
374 | struct sysctl_data_s *scd; | 374 | struct sysctl_data_s *scd; |
375 | void *salbuf; | 375 | void *salbuf; |
376 | dev_t first_dev, dev; | 376 | dev_t first_dev, dev; |
377 | nasid_t event_nasid = ia64_sn_get_console_nasid(); | 377 | nasid_t event_nasid; |
378 | |||
379 | if (!ia64_platform_is("sn2")) | ||
380 | return -ENODEV; | ||
381 | |||
382 | event_nasid = ia64_sn_get_console_nasid(); | ||
378 | 383 | ||
379 | if (alloc_chrdev_region(&first_dev, 0, num_cnodes, | 384 | if (alloc_chrdev_region(&first_dev, 0, num_cnodes, |
380 | SYSCTL_BASENAME) < 0) { | 385 | SYSCTL_BASENAME) < 0) { |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index 8b2210b633df..d12d4f629cec 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -220,20 +220,7 @@ scdrv_dispatch_event(char *event, int len) | |||
220 | " Sending SIGPWR to init...\n"); | 220 | " Sending SIGPWR to init...\n"); |
221 | 221 | ||
222 | /* give a SIGPWR signal to init proc */ | 222 | /* give a SIGPWR signal to init proc */ |
223 | 223 | kill_proc(1, SIGPWR, 0); | |
224 | /* first find init's task */ | ||
225 | read_lock(&tasklist_lock); | ||
226 | for_each_process(p) { | ||
227 | if (p->pid == 1) | ||
228 | break; | ||
229 | } | ||
230 | if (p) { | ||
231 | force_sig(SIGPWR, p); | ||
232 | } else { | ||
233 | printk(KERN_ERR "Failed to signal init!\n"); | ||
234 | snsc_shutting_down = 0; /* so can try again (?) */ | ||
235 | } | ||
236 | read_unlock(&tasklist_lock); | ||
237 | } else { | 224 | } else { |
238 | /* print to system log */ | 225 | /* print to system log */ |
239 | printk("%s|$(0x%x)%s\n", severity, esp_code, desc); | 226 | printk("%s|$(0x%x)%s\n", severity, esp_code, desc); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 45508a039508..d4e434d694b7 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1106,7 +1106,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, | |||
1106 | return ret; | 1106 | return ret; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | static struct file_operations sonypi_misc_fops = { | 1109 | static const struct file_operations sonypi_misc_fops = { |
1110 | .owner = THIS_MODULE, | 1110 | .owner = THIS_MODULE, |
1111 | .read = sonypi_misc_read, | 1111 | .read = sonypi_misc_read, |
1112 | .poll = sonypi_misc_poll, | 1112 | .poll = sonypi_misc_poll, |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index cb2859249d49..a1d303f9a33d 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -2584,6 +2584,12 @@ static void __exit specialix_exit_module(void) | |||
2584 | func_exit(); | 2584 | func_exit(); |
2585 | } | 2585 | } |
2586 | 2586 | ||
2587 | static struct pci_device_id specialx_pci_tbl[] __devinitdata = { | ||
2588 | { PCI_DEVICE(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_IO8) }, | ||
2589 | { } | ||
2590 | }; | ||
2591 | MODULE_DEVICE_TABLE(pci, specialx_pci_tbl); | ||
2592 | |||
2587 | module_init(specialix_init_module); | 2593 | module_init(specialix_init_module); |
2588 | module_exit(specialix_exit_module); | 2594 | module_exit(specialix_exit_module); |
2589 | 2595 | ||
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index ed7b8eaf0367..3beb2203d24b 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -707,7 +707,7 @@ static unsigned int sc26198_baudtable[] = { | |||
707 | * Define the driver info for a user level control device. Used mainly | 707 | * Define the driver info for a user level control device. Used mainly |
708 | * to get at port stats - only not using the port device itself. | 708 | * to get at port stats - only not using the port device itself. |
709 | */ | 709 | */ |
710 | static struct file_operations stl_fsiomem = { | 710 | static const struct file_operations stl_fsiomem = { |
711 | .owner = THIS_MODULE, | 711 | .owner = THIS_MODULE, |
712 | .ioctl = stl_memioctl, | 712 | .ioctl = stl_memioctl, |
713 | }; | 713 | }; |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 45c193aa11db..e1cd2bc4b1e4 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -410,7 +410,7 @@ static struct real_driver sx_real_driver = { | |||
410 | * | 410 | * |
411 | */ | 411 | */ |
412 | 412 | ||
413 | static struct file_operations sx_fw_fops = { | 413 | static const struct file_operations sx_fw_fops = { |
414 | .owner = THIS_MODULE, | 414 | .owner = THIS_MODULE, |
415 | .ioctl = sx_fw_ioctl, | 415 | .ioctl = sx_fw_ioctl, |
416 | }; | 416 | }; |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index df782dd1098c..78b1b1a2732b 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -1344,8 +1344,12 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1344 | } else | 1344 | } else |
1345 | info->input_signal_events.dcd_down++; | 1345 | info->input_signal_events.dcd_down++; |
1346 | #ifdef CONFIG_HDLC | 1346 | #ifdef CONFIG_HDLC |
1347 | if (info->netcount) | 1347 | if (info->netcount) { |
1348 | hdlc_set_carrier(status & MISCSTATUS_DCD, info->netdev); | 1348 | if (status & MISCSTATUS_DCD) |
1349 | netif_carrier_on(info->netdev); | ||
1350 | else | ||
1351 | netif_carrier_off(info->netdev); | ||
1352 | } | ||
1349 | #endif | 1353 | #endif |
1350 | } | 1354 | } |
1351 | if (status & MISCSTATUS_CTS_LATCHED) | 1355 | if (status & MISCSTATUS_CTS_LATCHED) |
@@ -7844,8 +7848,10 @@ static int hdlcdev_open(struct net_device *dev) | |||
7844 | spin_lock_irqsave(&info->irq_spinlock, flags); | 7848 | spin_lock_irqsave(&info->irq_spinlock, flags); |
7845 | usc_get_serial_signals(info); | 7849 | usc_get_serial_signals(info); |
7846 | spin_unlock_irqrestore(&info->irq_spinlock, flags); | 7850 | spin_unlock_irqrestore(&info->irq_spinlock, flags); |
7847 | hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev); | 7851 | if (info->serial_signals & SerialSignal_DCD) |
7848 | 7852 | netif_carrier_on(dev); | |
7853 | else | ||
7854 | netif_carrier_off(dev); | ||
7849 | return 0; | 7855 | return 0; |
7850 | } | 7856 | } |
7851 | 7857 | ||
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index e829594195c1..2f07b085536b 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -391,8 +391,8 @@ static MGSL_PARAMS default_params = { | |||
391 | #define DESC_LIST_SIZE 4096 | 391 | #define DESC_LIST_SIZE 4096 |
392 | 392 | ||
393 | #define MASK_PARITY BIT1 | 393 | #define MASK_PARITY BIT1 |
394 | #define MASK_FRAMING BIT2 | 394 | #define MASK_FRAMING BIT0 |
395 | #define MASK_BREAK BIT3 | 395 | #define MASK_BREAK BIT14 |
396 | #define MASK_OVERRUN BIT4 | 396 | #define MASK_OVERRUN BIT4 |
397 | 397 | ||
398 | #define GSR 0x00 /* global status */ | 398 | #define GSR 0x00 /* global status */ |
@@ -1497,8 +1497,10 @@ static int hdlcdev_open(struct net_device *dev) | |||
1497 | spin_lock_irqsave(&info->lock, flags); | 1497 | spin_lock_irqsave(&info->lock, flags); |
1498 | get_signals(info); | 1498 | get_signals(info); |
1499 | spin_unlock_irqrestore(&info->lock, flags); | 1499 | spin_unlock_irqrestore(&info->lock, flags); |
1500 | hdlc_set_carrier(info->signals & SerialSignal_DCD, dev); | 1500 | if (info->signals & SerialSignal_DCD) |
1501 | 1501 | netif_carrier_on(dev); | |
1502 | else | ||
1503 | netif_carrier_off(dev); | ||
1502 | return 0; | 1504 | return 0; |
1503 | } | 1505 | } |
1504 | 1506 | ||
@@ -1798,17 +1800,17 @@ static void rx_async(struct slgt_info *info) | |||
1798 | 1800 | ||
1799 | stat = 0; | 1801 | stat = 0; |
1800 | 1802 | ||
1801 | if ((status = *(p+1) & (BIT9 + BIT8))) { | 1803 | if ((status = *(p+1) & (BIT1 + BIT0))) { |
1802 | if (status & BIT9) | 1804 | if (status & BIT1) |
1803 | icount->parity++; | 1805 | icount->parity++; |
1804 | else if (status & BIT8) | 1806 | else if (status & BIT0) |
1805 | icount->frame++; | 1807 | icount->frame++; |
1806 | /* discard char if tty control flags say so */ | 1808 | /* discard char if tty control flags say so */ |
1807 | if (status & info->ignore_status_mask) | 1809 | if (status & info->ignore_status_mask) |
1808 | continue; | 1810 | continue; |
1809 | if (status & BIT9) | 1811 | if (status & BIT1) |
1810 | stat = TTY_PARITY; | 1812 | stat = TTY_PARITY; |
1811 | else if (status & BIT8) | 1813 | else if (status & BIT0) |
1812 | stat = TTY_FRAME; | 1814 | stat = TTY_FRAME; |
1813 | } | 1815 | } |
1814 | if (tty) { | 1816 | if (tty) { |
@@ -1997,8 +1999,12 @@ static void dcd_change(struct slgt_info *info) | |||
1997 | info->input_signal_events.dcd_down++; | 1999 | info->input_signal_events.dcd_down++; |
1998 | } | 2000 | } |
1999 | #ifdef CONFIG_HDLC | 2001 | #ifdef CONFIG_HDLC |
2000 | if (info->netcount) | 2002 | if (info->netcount) { |
2001 | hdlc_set_carrier(info->signals & SerialSignal_DCD, info->netdev); | 2003 | if (info->signals & SerialSignal_DCD) |
2004 | netif_carrier_on(info->netdev); | ||
2005 | else | ||
2006 | netif_carrier_off(info->netdev); | ||
2007 | } | ||
2002 | #endif | 2008 | #endif |
2003 | wake_up_interruptible(&info->status_event_wait_q); | 2009 | wake_up_interruptible(&info->status_event_wait_q); |
2004 | wake_up_interruptible(&info->event_wait_q); | 2010 | wake_up_interruptible(&info->event_wait_q); |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 1e443a233f51..66f3754fbbdf 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -1752,8 +1752,10 @@ static int hdlcdev_open(struct net_device *dev) | |||
1752 | spin_lock_irqsave(&info->lock, flags); | 1752 | spin_lock_irqsave(&info->lock, flags); |
1753 | get_signals(info); | 1753 | get_signals(info); |
1754 | spin_unlock_irqrestore(&info->lock, flags); | 1754 | spin_unlock_irqrestore(&info->lock, flags); |
1755 | hdlc_set_carrier(info->serial_signals & SerialSignal_DCD, dev); | 1755 | if (info->serial_signals & SerialSignal_DCD) |
1756 | 1756 | netif_carrier_on(dev); | |
1757 | else | ||
1758 | netif_carrier_off(dev); | ||
1757 | return 0; | 1759 | return 0; |
1758 | } | 1760 | } |
1759 | 1761 | ||
@@ -2522,8 +2524,12 @@ void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2522 | } else | 2524 | } else |
2523 | info->input_signal_events.dcd_down++; | 2525 | info->input_signal_events.dcd_down++; |
2524 | #ifdef CONFIG_HDLC | 2526 | #ifdef CONFIG_HDLC |
2525 | if (info->netcount) | 2527 | if (info->netcount) { |
2526 | hdlc_set_carrier(status & SerialSignal_DCD, info->netdev); | 2528 | if (status & SerialSignal_DCD) |
2529 | netif_carrier_on(info->netdev); | ||
2530 | else | ||
2531 | netif_carrier_off(info->netdev); | ||
2532 | } | ||
2527 | #endif | 2533 | #endif |
2528 | } | 2534 | } |
2529 | if (status & MISCSTATUS_CTS_LATCHED) | 2535 | if (status & MISCSTATUS_CTS_LATCHED) |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index a064ee9181c0..ee3ca8f1768e 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -147,12 +147,13 @@ static struct sysrq_key_op sysrq_mountro_op = { | |||
147 | .enable_mask = SYSRQ_ENABLE_REMOUNT, | 147 | .enable_mask = SYSRQ_ENABLE_REMOUNT, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | #ifdef CONFIG_DEBUG_MUTEXES | 150 | #ifdef CONFIG_LOCKDEP |
151 | static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, | 151 | static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, |
152 | struct tty_struct *tty) | 152 | struct tty_struct *tty) |
153 | { | 153 | { |
154 | mutex_debug_show_all_locks(); | 154 | debug_show_all_locks(); |
155 | } | 155 | } |
156 | |||
156 | static struct sysrq_key_op sysrq_showlocks_op = { | 157 | static struct sysrq_key_op sysrq_showlocks_op = { |
157 | .handler = sysrq_handle_showlocks, | 158 | .handler = sysrq_handle_showlocks, |
158 | .help_msg = "show-all-locks(D)", | 159 | .help_msg = "show-all-locks(D)", |
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index a80c83210872..bb1bad4c18f9 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -255,7 +255,7 @@ static int tanbac_tb0219_release(struct inode *inode, struct file *file) | |||
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
258 | static struct file_operations tb0219_fops = { | 258 | static const struct file_operations tb0219_fops = { |
259 | .owner = THIS_MODULE, | 259 | .owner = THIS_MODULE, |
260 | .read = tanbac_tb0219_read, | 260 | .read = tanbac_tb0219_read, |
261 | .write = tanbac_tb0219_write, | 261 | .write = tanbac_tb0219_write, |
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index e0633a119d29..d30dc09dbbc9 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -381,7 +381,7 @@ tipar_ioctl(struct inode *inode, struct file *file, | |||
381 | 381 | ||
382 | /* ----- kernel module registering ------------------------------------ */ | 382 | /* ----- kernel module registering ------------------------------------ */ |
383 | 383 | ||
384 | static struct file_operations tipar_fops = { | 384 | static const struct file_operations tipar_fops = { |
385 | .owner = THIS_MODULE, | 385 | .owner = THIS_MODULE, |
386 | .llseek = no_llseek, | 386 | .llseek = no_llseek, |
387 | .read = tipar_read, | 387 | .read = tipar_read, |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 952b829e2cb4..d2c5ba4e83b8 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -247,7 +247,7 @@ static ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t cou | |||
247 | return 0; | 247 | return 0; |
248 | } | 248 | } |
249 | 249 | ||
250 | static struct file_operations tlclk_fops = { | 250 | static const struct file_operations tlclk_fops = { |
251 | .read = tlclk_read, | 251 | .read = tlclk_read, |
252 | .write = tlclk_write, | 252 | .write = tlclk_write, |
253 | .open = tlclk_open, | 253 | .open = tlclk_open, |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index e2fb234dee40..dd36fd04a842 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -92,7 +92,7 @@ static int tosh_ioctl(struct inode *, struct file *, unsigned int, | |||
92 | unsigned long); | 92 | unsigned long); |
93 | 93 | ||
94 | 94 | ||
95 | static struct file_operations tosh_fops = { | 95 | static const struct file_operations tosh_fops = { |
96 | .owner = THIS_MODULE, | 96 | .owner = THIS_MODULE, |
97 | .ioctl = tosh_ioctl, | 97 | .ioctl = tosh_ioctl, |
98 | }; | 98 | }; |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 6889e7db3aff..a082a2e34252 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -1141,6 +1141,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend | |||
1141 | put_device(dev); | 1141 | put_device(dev); |
1142 | clear_bit(chip->dev_num, dev_mask); | 1142 | clear_bit(chip->dev_num, dev_mask); |
1143 | kfree(chip); | 1143 | kfree(chip); |
1144 | kfree(devname); | ||
1144 | return NULL; | 1145 | return NULL; |
1145 | } | 1146 | } |
1146 | 1147 | ||
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index 58a258cec153..ad8ffe49256f 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -116,7 +116,7 @@ static u8 tpm_atml_status(struct tpm_chip *chip) | |||
116 | return ioread8(chip->vendor.iobase + 1); | 116 | return ioread8(chip->vendor.iobase + 1); |
117 | } | 117 | } |
118 | 118 | ||
119 | static struct file_operations atmel_ops = { | 119 | static const struct file_operations atmel_ops = { |
120 | .owner = THIS_MODULE, | 120 | .owner = THIS_MODULE, |
121 | .llseek = no_llseek, | 121 | .llseek = no_llseek, |
122 | .open = tpm_open, | 122 | .open = tpm_open, |
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index adfff21beb21..1353b5a6bae8 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -338,7 +338,7 @@ static struct attribute *inf_attrs[] = { | |||
338 | 338 | ||
339 | static struct attribute_group inf_attr_grp = {.attrs = inf_attrs }; | 339 | static struct attribute_group inf_attr_grp = {.attrs = inf_attrs }; |
340 | 340 | ||
341 | static struct file_operations inf_ops = { | 341 | static const struct file_operations inf_ops = { |
342 | .owner = THIS_MODULE, | 342 | .owner = THIS_MODULE, |
343 | .llseek = no_llseek, | 343 | .llseek = no_llseek, |
344 | .open = tpm_open, | 344 | .open = tpm_open, |
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 4c8bc06c7d95..26287aace87d 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c | |||
@@ -226,7 +226,7 @@ static u8 tpm_nsc_status(struct tpm_chip *chip) | |||
226 | return inb(chip->vendor.base + NSC_STATUS); | 226 | return inb(chip->vendor.base + NSC_STATUS); |
227 | } | 227 | } |
228 | 228 | ||
229 | static struct file_operations nsc_ops = { | 229 | static const struct file_operations nsc_ops = { |
230 | .owner = THIS_MODULE, | 230 | .owner = THIS_MODULE, |
231 | .llseek = no_llseek, | 231 | .llseek = no_llseek, |
232 | .open = tpm_open, | 232 | .open = tpm_open, |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index abb0f2aeae66..ee7ac6f43c65 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -330,7 +330,7 @@ out_err: | |||
330 | return rc; | 330 | return rc; |
331 | } | 331 | } |
332 | 332 | ||
333 | static struct file_operations tis_ops = { | 333 | static const struct file_operations tis_ops = { |
334 | .owner = THIS_MODULE, | 334 | .owner = THIS_MODULE, |
335 | .llseek = no_llseek, | 335 | .llseek = no_llseek, |
336 | .open = tpm_open, | 336 | .open = tpm_open, |
@@ -424,6 +424,7 @@ static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
424 | iowrite32(interrupt, | 424 | iowrite32(interrupt, |
425 | chip->vendor.iobase + | 425 | chip->vendor.iobase + |
426 | TPM_INT_STATUS(chip->vendor.locality)); | 426 | TPM_INT_STATUS(chip->vendor.locality)); |
427 | ioread32(chip->vendor.iobase + TPM_INT_STATUS(chip->vendor.locality)); | ||
427 | return IRQ_HANDLED; | 428 | return IRQ_HANDLED; |
428 | } | 429 | } |
429 | 430 | ||
@@ -431,23 +432,19 @@ static int interrupts = 1; | |||
431 | module_param(interrupts, bool, 0444); | 432 | module_param(interrupts, bool, 0444); |
432 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); | 433 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); |
433 | 434 | ||
434 | static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | 435 | static int tpm_tis_init(struct device *dev, resource_size_t start, |
435 | const struct pnp_device_id *pnp_id) | 436 | resource_size_t len) |
436 | { | 437 | { |
437 | u32 vendor, intfcaps, intmask; | 438 | u32 vendor, intfcaps, intmask; |
438 | int rc, i; | 439 | int rc, i; |
439 | unsigned long start, len; | ||
440 | struct tpm_chip *chip; | 440 | struct tpm_chip *chip; |
441 | 441 | ||
442 | start = pnp_mem_start(pnp_dev, 0); | ||
443 | len = pnp_mem_len(pnp_dev, 0); | ||
444 | |||
445 | if (!start) | 442 | if (!start) |
446 | start = TIS_MEM_BASE; | 443 | start = TIS_MEM_BASE; |
447 | if (!len) | 444 | if (!len) |
448 | len = TIS_MEM_LEN; | 445 | len = TIS_MEM_LEN; |
449 | 446 | ||
450 | if (!(chip = tpm_register_hardware(&pnp_dev->dev, &tpm_tis))) | 447 | if (!(chip = tpm_register_hardware(dev, &tpm_tis))) |
451 | return -ENODEV; | 448 | return -ENODEV; |
452 | 449 | ||
453 | chip->vendor.iobase = ioremap(start, len); | 450 | chip->vendor.iobase = ioremap(start, len); |
@@ -464,7 +461,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
464 | chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | 461 | chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); |
465 | chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | 462 | chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); |
466 | 463 | ||
467 | dev_info(&pnp_dev->dev, | 464 | dev_info(dev, |
468 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | 465 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
469 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | 466 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
470 | 467 | ||
@@ -472,26 +469,26 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
472 | intfcaps = | 469 | intfcaps = |
473 | ioread32(chip->vendor.iobase + | 470 | ioread32(chip->vendor.iobase + |
474 | TPM_INTF_CAPS(chip->vendor.locality)); | 471 | TPM_INTF_CAPS(chip->vendor.locality)); |
475 | dev_dbg(&pnp_dev->dev, "TPM interface capabilities (0x%x):\n", | 472 | dev_dbg(dev, "TPM interface capabilities (0x%x):\n", |
476 | intfcaps); | 473 | intfcaps); |
477 | if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) | 474 | if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) |
478 | dev_dbg(&pnp_dev->dev, "\tBurst Count Static\n"); | 475 | dev_dbg(dev, "\tBurst Count Static\n"); |
479 | if (intfcaps & TPM_INTF_CMD_READY_INT) | 476 | if (intfcaps & TPM_INTF_CMD_READY_INT) |
480 | dev_dbg(&pnp_dev->dev, "\tCommand Ready Int Support\n"); | 477 | dev_dbg(dev, "\tCommand Ready Int Support\n"); |
481 | if (intfcaps & TPM_INTF_INT_EDGE_FALLING) | 478 | if (intfcaps & TPM_INTF_INT_EDGE_FALLING) |
482 | dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Falling\n"); | 479 | dev_dbg(dev, "\tInterrupt Edge Falling\n"); |
483 | if (intfcaps & TPM_INTF_INT_EDGE_RISING) | 480 | if (intfcaps & TPM_INTF_INT_EDGE_RISING) |
484 | dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Rising\n"); | 481 | dev_dbg(dev, "\tInterrupt Edge Rising\n"); |
485 | if (intfcaps & TPM_INTF_INT_LEVEL_LOW) | 482 | if (intfcaps & TPM_INTF_INT_LEVEL_LOW) |
486 | dev_dbg(&pnp_dev->dev, "\tInterrupt Level Low\n"); | 483 | dev_dbg(dev, "\tInterrupt Level Low\n"); |
487 | if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) | 484 | if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) |
488 | dev_dbg(&pnp_dev->dev, "\tInterrupt Level High\n"); | 485 | dev_dbg(dev, "\tInterrupt Level High\n"); |
489 | if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) | 486 | if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) |
490 | dev_dbg(&pnp_dev->dev, "\tLocality Change Int Support\n"); | 487 | dev_dbg(dev, "\tLocality Change Int Support\n"); |
491 | if (intfcaps & TPM_INTF_STS_VALID_INT) | 488 | if (intfcaps & TPM_INTF_STS_VALID_INT) |
492 | dev_dbg(&pnp_dev->dev, "\tSts Valid Int Support\n"); | 489 | dev_dbg(dev, "\tSts Valid Int Support\n"); |
493 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) | 490 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) |
494 | dev_dbg(&pnp_dev->dev, "\tData Avail Int Support\n"); | 491 | dev_dbg(dev, "\tData Avail Int Support\n"); |
495 | 492 | ||
496 | if (request_locality(chip, 0) != 0) { | 493 | if (request_locality(chip, 0) != 0) { |
497 | rc = -ENODEV; | 494 | rc = -ENODEV; |
@@ -594,6 +591,16 @@ out_err: | |||
594 | return rc; | 591 | return rc; |
595 | } | 592 | } |
596 | 593 | ||
594 | static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | ||
595 | const struct pnp_device_id *pnp_id) | ||
596 | { | ||
597 | resource_size_t start, len; | ||
598 | start = pnp_mem_start(pnp_dev, 0); | ||
599 | len = pnp_mem_len(pnp_dev, 0); | ||
600 | |||
601 | return tpm_tis_init(&pnp_dev->dev, start, len); | ||
602 | } | ||
603 | |||
597 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) | 604 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) |
598 | { | 605 | { |
599 | return tpm_pm_suspend(&dev->dev, msg); | 606 | return tpm_pm_suspend(&dev->dev, msg); |
@@ -628,8 +635,36 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, | |||
628 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); | 635 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); |
629 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); | 636 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); |
630 | 637 | ||
638 | static struct device_driver tis_drv = { | ||
639 | .name = "tpm_tis", | ||
640 | .bus = &platform_bus_type, | ||
641 | .owner = THIS_MODULE, | ||
642 | .suspend = tpm_pm_suspend, | ||
643 | .resume = tpm_pm_resume, | ||
644 | }; | ||
645 | |||
646 | static struct platform_device *pdev; | ||
647 | |||
648 | static int force; | ||
649 | module_param(force, bool, 0444); | ||
650 | MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry"); | ||
631 | static int __init init_tis(void) | 651 | static int __init init_tis(void) |
632 | { | 652 | { |
653 | int rc; | ||
654 | |||
655 | if (force) { | ||
656 | rc = driver_register(&tis_drv); | ||
657 | if (rc < 0) | ||
658 | return rc; | ||
659 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) | ||
660 | return PTR_ERR(pdev); | ||
661 | if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) { | ||
662 | platform_device_unregister(pdev); | ||
663 | driver_unregister(&tis_drv); | ||
664 | } | ||
665 | return rc; | ||
666 | } | ||
667 | |||
633 | return pnp_register_driver(&tis_pnp_driver); | 668 | return pnp_register_driver(&tis_pnp_driver); |
634 | } | 669 | } |
635 | 670 | ||
@@ -654,7 +689,11 @@ static void __exit cleanup_tis(void) | |||
654 | tpm_remove_hardware(chip->dev); | 689 | tpm_remove_hardware(chip->dev); |
655 | } | 690 | } |
656 | spin_unlock(&tis_lock); | 691 | spin_unlock(&tis_lock); |
657 | pnp_unregister_driver(&tis_pnp_driver); | 692 | if (force) { |
693 | platform_device_unregister(pdev); | ||
694 | driver_unregister(&tis_drv); | ||
695 | } else | ||
696 | pnp_unregister_driver(&tis_pnp_driver); | ||
658 | } | 697 | } |
659 | 698 | ||
660 | module_init(init_tis); | 699 | module_init(init_tis); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 615e934da05f..bb0d9199e994 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -153,6 +153,15 @@ int tty_ioctl(struct inode * inode, struct file * file, | |||
153 | static int tty_fasync(int fd, struct file * filp, int on); | 153 | static int tty_fasync(int fd, struct file * filp, int on); |
154 | static void release_mem(struct tty_struct *tty, int idx); | 154 | static void release_mem(struct tty_struct *tty, int idx); |
155 | 155 | ||
156 | /** | ||
157 | * alloc_tty_struct - allocate a tty object | ||
158 | * | ||
159 | * Return a new empty tty structure. The data fields have not | ||
160 | * been initialized in any way but has been zeroed | ||
161 | * | ||
162 | * Locking: none | ||
163 | * FIXME: use kzalloc | ||
164 | */ | ||
156 | 165 | ||
157 | static struct tty_struct *alloc_tty_struct(void) | 166 | static struct tty_struct *alloc_tty_struct(void) |
158 | { | 167 | { |
@@ -166,6 +175,15 @@ static struct tty_struct *alloc_tty_struct(void) | |||
166 | 175 | ||
167 | static void tty_buffer_free_all(struct tty_struct *); | 176 | static void tty_buffer_free_all(struct tty_struct *); |
168 | 177 | ||
178 | /** | ||
179 | * free_tty_struct - free a disused tty | ||
180 | * @tty: tty struct to free | ||
181 | * | ||
182 | * Free the write buffers, tty queue and tty memory itself. | ||
183 | * | ||
184 | * Locking: none. Must be called after tty is definitely unused | ||
185 | */ | ||
186 | |||
169 | static inline void free_tty_struct(struct tty_struct *tty) | 187 | static inline void free_tty_struct(struct tty_struct *tty) |
170 | { | 188 | { |
171 | kfree(tty->write_buf); | 189 | kfree(tty->write_buf); |
@@ -175,6 +193,17 @@ static inline void free_tty_struct(struct tty_struct *tty) | |||
175 | 193 | ||
176 | #define TTY_NUMBER(tty) ((tty)->index + (tty)->driver->name_base) | 194 | #define TTY_NUMBER(tty) ((tty)->index + (tty)->driver->name_base) |
177 | 195 | ||
196 | /** | ||
197 | * tty_name - return tty naming | ||
198 | * @tty: tty structure | ||
199 | * @buf: buffer for output | ||
200 | * | ||
201 | * Convert a tty structure into a name. The name reflects the kernel | ||
202 | * naming policy and if udev is in use may not reflect user space | ||
203 | * | ||
204 | * Locking: none | ||
205 | */ | ||
206 | |||
178 | char *tty_name(struct tty_struct *tty, char *buf) | 207 | char *tty_name(struct tty_struct *tty, char *buf) |
179 | { | 208 | { |
180 | if (!tty) /* Hmm. NULL pointer. That's fun. */ | 209 | if (!tty) /* Hmm. NULL pointer. That's fun. */ |
@@ -235,6 +264,28 @@ static int check_tty_count(struct tty_struct *tty, const char *routine) | |||
235 | * Tty buffer allocation management | 264 | * Tty buffer allocation management |
236 | */ | 265 | */ |
237 | 266 | ||
267 | |||
268 | /** | ||
269 | * tty_buffer_free_all - free buffers used by a tty | ||
270 | * @tty: tty to free from | ||
271 | * | ||
272 | * Remove all the buffers pending on a tty whether queued with data | ||
273 | * or in the free ring. Must be called when the tty is no longer in use | ||
274 | * | ||
275 | * Locking: none | ||
276 | */ | ||
277 | |||
278 | |||
279 | /** | ||
280 | * tty_buffer_free_all - free buffers used by a tty | ||
281 | * @tty: tty to free from | ||
282 | * | ||
283 | * Remove all the buffers pending on a tty whether queued with data | ||
284 | * or in the free ring. Must be called when the tty is no longer in use | ||
285 | * | ||
286 | * Locking: none | ||
287 | */ | ||
288 | |||
238 | static void tty_buffer_free_all(struct tty_struct *tty) | 289 | static void tty_buffer_free_all(struct tty_struct *tty) |
239 | { | 290 | { |
240 | struct tty_buffer *thead; | 291 | struct tty_buffer *thead; |
@@ -247,19 +298,47 @@ static void tty_buffer_free_all(struct tty_struct *tty) | |||
247 | kfree(thead); | 298 | kfree(thead); |
248 | } | 299 | } |
249 | tty->buf.tail = NULL; | 300 | tty->buf.tail = NULL; |
301 | tty->buf.memory_used = 0; | ||
250 | } | 302 | } |
251 | 303 | ||
304 | /** | ||
305 | * tty_buffer_init - prepare a tty buffer structure | ||
306 | * @tty: tty to initialise | ||
307 | * | ||
308 | * Set up the initial state of the buffer management for a tty device. | ||
309 | * Must be called before the other tty buffer functions are used. | ||
310 | * | ||
311 | * Locking: none | ||
312 | */ | ||
313 | |||
252 | static void tty_buffer_init(struct tty_struct *tty) | 314 | static void tty_buffer_init(struct tty_struct *tty) |
253 | { | 315 | { |
254 | spin_lock_init(&tty->buf.lock); | 316 | spin_lock_init(&tty->buf.lock); |
255 | tty->buf.head = NULL; | 317 | tty->buf.head = NULL; |
256 | tty->buf.tail = NULL; | 318 | tty->buf.tail = NULL; |
257 | tty->buf.free = NULL; | 319 | tty->buf.free = NULL; |
320 | tty->buf.memory_used = 0; | ||
258 | } | 321 | } |
259 | 322 | ||
260 | static struct tty_buffer *tty_buffer_alloc(size_t size) | 323 | /** |
324 | * tty_buffer_alloc - allocate a tty buffer | ||
325 | * @tty: tty device | ||
326 | * @size: desired size (characters) | ||
327 | * | ||
328 | * Allocate a new tty buffer to hold the desired number of characters. | ||
329 | * Return NULL if out of memory or the allocation would exceed the | ||
330 | * per device queue | ||
331 | * | ||
332 | * Locking: Caller must hold tty->buf.lock | ||
333 | */ | ||
334 | |||
335 | static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size) | ||
261 | { | 336 | { |
262 | struct tty_buffer *p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); | 337 | struct tty_buffer *p; |
338 | |||
339 | if (tty->buf.memory_used + size > 65536) | ||
340 | return NULL; | ||
341 | p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); | ||
263 | if(p == NULL) | 342 | if(p == NULL) |
264 | return NULL; | 343 | return NULL; |
265 | p->used = 0; | 344 | p->used = 0; |
@@ -269,17 +348,27 @@ static struct tty_buffer *tty_buffer_alloc(size_t size) | |||
269 | p->read = 0; | 348 | p->read = 0; |
270 | p->char_buf_ptr = (char *)(p->data); | 349 | p->char_buf_ptr = (char *)(p->data); |
271 | p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; | 350 | p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; |
272 | /* printk("Flip create %p\n", p); */ | 351 | tty->buf.memory_used += size; |
273 | return p; | 352 | return p; |
274 | } | 353 | } |
275 | 354 | ||
276 | /* Must be called with the tty_read lock held. This needs to acquire strategy | 355 | /** |
277 | code to decide if we should kfree or relink a given expired buffer */ | 356 | * tty_buffer_free - free a tty buffer |
357 | * @tty: tty owning the buffer | ||
358 | * @b: the buffer to free | ||
359 | * | ||
360 | * Free a tty buffer, or add it to the free list according to our | ||
361 | * internal strategy | ||
362 | * | ||
363 | * Locking: Caller must hold tty->buf.lock | ||
364 | */ | ||
278 | 365 | ||
279 | static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b) | 366 | static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b) |
280 | { | 367 | { |
281 | /* Dumb strategy for now - should keep some stats */ | 368 | /* Dumb strategy for now - should keep some stats */ |
282 | /* printk("Flip dispose %p\n", b); */ | 369 | tty->buf.memory_used -= b->size; |
370 | WARN_ON(tty->buf.memory_used < 0); | ||
371 | |||
283 | if(b->size >= 512) | 372 | if(b->size >= 512) |
284 | kfree(b); | 373 | kfree(b); |
285 | else { | 374 | else { |
@@ -288,6 +377,18 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b) | |||
288 | } | 377 | } |
289 | } | 378 | } |
290 | 379 | ||
380 | /** | ||
381 | * tty_buffer_find - find a free tty buffer | ||
382 | * @tty: tty owning the buffer | ||
383 | * @size: characters wanted | ||
384 | * | ||
385 | * Locate an existing suitable tty buffer or if we are lacking one then | ||
386 | * allocate a new one. We round our buffers off in 256 character chunks | ||
387 | * to get better allocation behaviour. | ||
388 | * | ||
389 | * Locking: Caller must hold tty->buf.lock | ||
390 | */ | ||
391 | |||
291 | static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | 392 | static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) |
292 | { | 393 | { |
293 | struct tty_buffer **tbh = &tty->buf.free; | 394 | struct tty_buffer **tbh = &tty->buf.free; |
@@ -299,20 +400,28 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | |||
299 | t->used = 0; | 400 | t->used = 0; |
300 | t->commit = 0; | 401 | t->commit = 0; |
301 | t->read = 0; | 402 | t->read = 0; |
302 | /* DEBUG ONLY */ | 403 | tty->buf.memory_used += t->size; |
303 | /* memset(t->data, '*', size); */ | ||
304 | /* printk("Flip recycle %p\n", t); */ | ||
305 | return t; | 404 | return t; |
306 | } | 405 | } |
307 | tbh = &((*tbh)->next); | 406 | tbh = &((*tbh)->next); |
308 | } | 407 | } |
309 | /* Round the buffer size out */ | 408 | /* Round the buffer size out */ |
310 | size = (size + 0xFF) & ~ 0xFF; | 409 | size = (size + 0xFF) & ~ 0xFF; |
311 | return tty_buffer_alloc(size); | 410 | return tty_buffer_alloc(tty, size); |
312 | /* Should possibly check if this fails for the largest buffer we | 411 | /* Should possibly check if this fails for the largest buffer we |
313 | have queued and recycle that ? */ | 412 | have queued and recycle that ? */ |
314 | } | 413 | } |
315 | 414 | ||
415 | /** | ||
416 | * tty_buffer_request_room - grow tty buffer if needed | ||
417 | * @tty: tty structure | ||
418 | * @size: size desired | ||
419 | * | ||
420 | * Make at least size bytes of linear space available for the tty | ||
421 | * buffer. If we fail return the size we managed to find. | ||
422 | * | ||
423 | * Locking: Takes tty->buf.lock | ||
424 | */ | ||
316 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) | 425 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) |
317 | { | 426 | { |
318 | struct tty_buffer *b, *n; | 427 | struct tty_buffer *b, *n; |
@@ -347,6 +456,18 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
347 | } | 456 | } |
348 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); | 457 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); |
349 | 458 | ||
459 | /** | ||
460 | * tty_insert_flip_string - Add characters to the tty buffer | ||
461 | * @tty: tty structure | ||
462 | * @chars: characters | ||
463 | * @size: size | ||
464 | * | ||
465 | * Queue a series of bytes to the tty buffering. All the characters | ||
466 | * passed are marked as without error. Returns the number added. | ||
467 | * | ||
468 | * Locking: Called functions may take tty->buf.lock | ||
469 | */ | ||
470 | |||
350 | int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, | 471 | int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, |
351 | size_t size) | 472 | size_t size) |
352 | { | 473 | { |
@@ -370,6 +491,20 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, | |||
370 | } | 491 | } |
371 | EXPORT_SYMBOL(tty_insert_flip_string); | 492 | EXPORT_SYMBOL(tty_insert_flip_string); |
372 | 493 | ||
494 | /** | ||
495 | * tty_insert_flip_string_flags - Add characters to the tty buffer | ||
496 | * @tty: tty structure | ||
497 | * @chars: characters | ||
498 | * @flags: flag bytes | ||
499 | * @size: size | ||
500 | * | ||
501 | * Queue a series of bytes to the tty buffering. For each character | ||
502 | * the flags array indicates the status of the character. Returns the | ||
503 | * number added. | ||
504 | * | ||
505 | * Locking: Called functions may take tty->buf.lock | ||
506 | */ | ||
507 | |||
373 | int tty_insert_flip_string_flags(struct tty_struct *tty, | 508 | int tty_insert_flip_string_flags(struct tty_struct *tty, |
374 | const unsigned char *chars, const char *flags, size_t size) | 509 | const unsigned char *chars, const char *flags, size_t size) |
375 | { | 510 | { |
@@ -394,6 +529,17 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, | |||
394 | } | 529 | } |
395 | EXPORT_SYMBOL(tty_insert_flip_string_flags); | 530 | EXPORT_SYMBOL(tty_insert_flip_string_flags); |
396 | 531 | ||
532 | /** | ||
533 | * tty_schedule_flip - push characters to ldisc | ||
534 | * @tty: tty to push from | ||
535 | * | ||
536 | * Takes any pending buffers and transfers their ownership to the | ||
537 | * ldisc side of the queue. It then schedules those characters for | ||
538 | * processing by the line discipline. | ||
539 | * | ||
540 | * Locking: Takes tty->buf.lock | ||
541 | */ | ||
542 | |||
397 | void tty_schedule_flip(struct tty_struct *tty) | 543 | void tty_schedule_flip(struct tty_struct *tty) |
398 | { | 544 | { |
399 | unsigned long flags; | 545 | unsigned long flags; |
@@ -405,12 +551,19 @@ void tty_schedule_flip(struct tty_struct *tty) | |||
405 | } | 551 | } |
406 | EXPORT_SYMBOL(tty_schedule_flip); | 552 | EXPORT_SYMBOL(tty_schedule_flip); |
407 | 553 | ||
408 | /* | 554 | /** |
555 | * tty_prepare_flip_string - make room for characters | ||
556 | * @tty: tty | ||
557 | * @chars: return pointer for character write area | ||
558 | * @size: desired size | ||
559 | * | ||
409 | * Prepare a block of space in the buffer for data. Returns the length | 560 | * Prepare a block of space in the buffer for data. Returns the length |
410 | * available and buffer pointer to the space which is now allocated and | 561 | * available and buffer pointer to the space which is now allocated and |
411 | * accounted for as ready for normal characters. This is used for drivers | 562 | * accounted for as ready for normal characters. This is used for drivers |
412 | * that need their own block copy routines into the buffer. There is no | 563 | * that need their own block copy routines into the buffer. There is no |
413 | * guarantee the buffer is a DMA target! | 564 | * guarantee the buffer is a DMA target! |
565 | * | ||
566 | * Locking: May call functions taking tty->buf.lock | ||
414 | */ | 567 | */ |
415 | 568 | ||
416 | int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size) | 569 | int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size) |
@@ -427,12 +580,20 @@ int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_ | |||
427 | 580 | ||
428 | EXPORT_SYMBOL_GPL(tty_prepare_flip_string); | 581 | EXPORT_SYMBOL_GPL(tty_prepare_flip_string); |
429 | 582 | ||
430 | /* | 583 | /** |
584 | * tty_prepare_flip_string_flags - make room for characters | ||
585 | * @tty: tty | ||
586 | * @chars: return pointer for character write area | ||
587 | * @flags: return pointer for status flag write area | ||
588 | * @size: desired size | ||
589 | * | ||
431 | * Prepare a block of space in the buffer for data. Returns the length | 590 | * Prepare a block of space in the buffer for data. Returns the length |
432 | * available and buffer pointer to the space which is now allocated and | 591 | * available and buffer pointer to the space which is now allocated and |
433 | * accounted for as ready for characters. This is used for drivers | 592 | * accounted for as ready for characters. This is used for drivers |
434 | * that need their own block copy routines into the buffer. There is no | 593 | * that need their own block copy routines into the buffer. There is no |
435 | * guarantee the buffer is a DMA target! | 594 | * guarantee the buffer is a DMA target! |
595 | * | ||
596 | * Locking: May call functions taking tty->buf.lock | ||
436 | */ | 597 | */ |
437 | 598 | ||
438 | int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size) | 599 | int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size) |
@@ -451,10 +612,16 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags); | |||
451 | 612 | ||
452 | 613 | ||
453 | 614 | ||
454 | /* | 615 | /** |
616 | * tty_set_termios_ldisc - set ldisc field | ||
617 | * @tty: tty structure | ||
618 | * @num: line discipline number | ||
619 | * | ||
455 | * This is probably overkill for real world processors but | 620 | * This is probably overkill for real world processors but |
456 | * they are not on hot paths so a little discipline won't do | 621 | * they are not on hot paths so a little discipline won't do |
457 | * any harm. | 622 | * any harm. |
623 | * | ||
624 | * Locking: takes termios_sem | ||
458 | */ | 625 | */ |
459 | 626 | ||
460 | static void tty_set_termios_ldisc(struct tty_struct *tty, int num) | 627 | static void tty_set_termios_ldisc(struct tty_struct *tty, int num) |
@@ -474,6 +641,19 @@ static DEFINE_SPINLOCK(tty_ldisc_lock); | |||
474 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); | 641 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); |
475 | static struct tty_ldisc tty_ldiscs[NR_LDISCS]; /* line disc dispatch table */ | 642 | static struct tty_ldisc tty_ldiscs[NR_LDISCS]; /* line disc dispatch table */ |
476 | 643 | ||
644 | /** | ||
645 | * tty_register_ldisc - install a line discipline | ||
646 | * @disc: ldisc number | ||
647 | * @new_ldisc: pointer to the ldisc object | ||
648 | * | ||
649 | * Installs a new line discipline into the kernel. The discipline | ||
650 | * is set up as unreferenced and then made available to the kernel | ||
651 | * from this point onwards. | ||
652 | * | ||
653 | * Locking: | ||
654 | * takes tty_ldisc_lock to guard against ldisc races | ||
655 | */ | ||
656 | |||
477 | int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc) | 657 | int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc) |
478 | { | 658 | { |
479 | unsigned long flags; | 659 | unsigned long flags; |
@@ -493,6 +673,18 @@ int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc) | |||
493 | } | 673 | } |
494 | EXPORT_SYMBOL(tty_register_ldisc); | 674 | EXPORT_SYMBOL(tty_register_ldisc); |
495 | 675 | ||
676 | /** | ||
677 | * tty_unregister_ldisc - unload a line discipline | ||
678 | * @disc: ldisc number | ||
679 | * @new_ldisc: pointer to the ldisc object | ||
680 | * | ||
681 | * Remove a line discipline from the kernel providing it is not | ||
682 | * currently in use. | ||
683 | * | ||
684 | * Locking: | ||
685 | * takes tty_ldisc_lock to guard against ldisc races | ||
686 | */ | ||
687 | |||
496 | int tty_unregister_ldisc(int disc) | 688 | int tty_unregister_ldisc(int disc) |
497 | { | 689 | { |
498 | unsigned long flags; | 690 | unsigned long flags; |
@@ -512,6 +704,19 @@ int tty_unregister_ldisc(int disc) | |||
512 | } | 704 | } |
513 | EXPORT_SYMBOL(tty_unregister_ldisc); | 705 | EXPORT_SYMBOL(tty_unregister_ldisc); |
514 | 706 | ||
707 | /** | ||
708 | * tty_ldisc_get - take a reference to an ldisc | ||
709 | * @disc: ldisc number | ||
710 | * | ||
711 | * Takes a reference to a line discipline. Deals with refcounts and | ||
712 | * module locking counts. Returns NULL if the discipline is not available. | ||
713 | * Returns a pointer to the discipline and bumps the ref count if it is | ||
714 | * available | ||
715 | * | ||
716 | * Locking: | ||
717 | * takes tty_ldisc_lock to guard against ldisc races | ||
718 | */ | ||
719 | |||
515 | struct tty_ldisc *tty_ldisc_get(int disc) | 720 | struct tty_ldisc *tty_ldisc_get(int disc) |
516 | { | 721 | { |
517 | unsigned long flags; | 722 | unsigned long flags; |
@@ -540,6 +745,17 @@ struct tty_ldisc *tty_ldisc_get(int disc) | |||
540 | 745 | ||
541 | EXPORT_SYMBOL_GPL(tty_ldisc_get); | 746 | EXPORT_SYMBOL_GPL(tty_ldisc_get); |
542 | 747 | ||
748 | /** | ||
749 | * tty_ldisc_put - drop ldisc reference | ||
750 | * @disc: ldisc number | ||
751 | * | ||
752 | * Drop a reference to a line discipline. Manage refcounts and | ||
753 | * module usage counts | ||
754 | * | ||
755 | * Locking: | ||
756 | * takes tty_ldisc_lock to guard against ldisc races | ||
757 | */ | ||
758 | |||
543 | void tty_ldisc_put(int disc) | 759 | void tty_ldisc_put(int disc) |
544 | { | 760 | { |
545 | struct tty_ldisc *ld; | 761 | struct tty_ldisc *ld; |
@@ -557,6 +773,19 @@ void tty_ldisc_put(int disc) | |||
557 | 773 | ||
558 | EXPORT_SYMBOL_GPL(tty_ldisc_put); | 774 | EXPORT_SYMBOL_GPL(tty_ldisc_put); |
559 | 775 | ||
776 | /** | ||
777 | * tty_ldisc_assign - set ldisc on a tty | ||
778 | * @tty: tty to assign | ||
779 | * @ld: line discipline | ||
780 | * | ||
781 | * Install an instance of a line discipline into a tty structure. The | ||
782 | * ldisc must have a reference count above zero to ensure it remains/ | ||
783 | * The tty instance refcount starts at zero. | ||
784 | * | ||
785 | * Locking: | ||
786 | * Caller must hold references | ||
787 | */ | ||
788 | |||
560 | static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld) | 789 | static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld) |
561 | { | 790 | { |
562 | tty->ldisc = *ld; | 791 | tty->ldisc = *ld; |
@@ -571,6 +800,8 @@ static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld) | |||
571 | * the tty ldisc. Return 0 on failure or 1 on success. This is | 800 | * the tty ldisc. Return 0 on failure or 1 on success. This is |
572 | * used to implement both the waiting and non waiting versions | 801 | * used to implement both the waiting and non waiting versions |
573 | * of tty_ldisc_ref | 802 | * of tty_ldisc_ref |
803 | * | ||
804 | * Locking: takes tty_ldisc_lock | ||
574 | */ | 805 | */ |
575 | 806 | ||
576 | static int tty_ldisc_try(struct tty_struct *tty) | 807 | static int tty_ldisc_try(struct tty_struct *tty) |
@@ -602,6 +833,8 @@ static int tty_ldisc_try(struct tty_struct *tty) | |||
602 | * must also be careful not to hold other locks that will deadlock | 833 | * must also be careful not to hold other locks that will deadlock |
603 | * against a discipline change, such as an existing ldisc reference | 834 | * against a discipline change, such as an existing ldisc reference |
604 | * (which we check for) | 835 | * (which we check for) |
836 | * | ||
837 | * Locking: call functions take tty_ldisc_lock | ||
605 | */ | 838 | */ |
606 | 839 | ||
607 | struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *tty) | 840 | struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *tty) |
@@ -622,6 +855,8 @@ EXPORT_SYMBOL_GPL(tty_ldisc_ref_wait); | |||
622 | * Dereference the line discipline for the terminal and take a | 855 | * Dereference the line discipline for the terminal and take a |
623 | * reference to it. If the line discipline is in flux then | 856 | * reference to it. If the line discipline is in flux then |
624 | * return NULL. Can be called from IRQ and timer functions. | 857 | * return NULL. Can be called from IRQ and timer functions. |
858 | * | ||
859 | * Locking: called functions take tty_ldisc_lock | ||
625 | */ | 860 | */ |
626 | 861 | ||
627 | struct tty_ldisc *tty_ldisc_ref(struct tty_struct *tty) | 862 | struct tty_ldisc *tty_ldisc_ref(struct tty_struct *tty) |
@@ -639,6 +874,8 @@ EXPORT_SYMBOL_GPL(tty_ldisc_ref); | |||
639 | * | 874 | * |
640 | * Undoes the effect of tty_ldisc_ref or tty_ldisc_ref_wait. May | 875 | * Undoes the effect of tty_ldisc_ref or tty_ldisc_ref_wait. May |
641 | * be called in IRQ context. | 876 | * be called in IRQ context. |
877 | * | ||
878 | * Locking: takes tty_ldisc_lock | ||
642 | */ | 879 | */ |
643 | 880 | ||
644 | void tty_ldisc_deref(struct tty_ldisc *ld) | 881 | void tty_ldisc_deref(struct tty_ldisc *ld) |
@@ -683,6 +920,9 @@ static void tty_ldisc_enable(struct tty_struct *tty) | |||
683 | * | 920 | * |
684 | * Set the discipline of a tty line. Must be called from a process | 921 | * Set the discipline of a tty line. Must be called from a process |
685 | * context. | 922 | * context. |
923 | * | ||
924 | * Locking: takes tty_ldisc_lock. | ||
925 | * called functions take termios_sem | ||
686 | */ | 926 | */ |
687 | 927 | ||
688 | static int tty_set_ldisc(struct tty_struct *tty, int ldisc) | 928 | static int tty_set_ldisc(struct tty_struct *tty, int ldisc) |
@@ -846,9 +1086,17 @@ restart: | |||
846 | return retval; | 1086 | return retval; |
847 | } | 1087 | } |
848 | 1088 | ||
849 | /* | 1089 | /** |
850 | * This routine returns a tty driver structure, given a device number | 1090 | * get_tty_driver - find device of a tty |
1091 | * @dev_t: device identifier | ||
1092 | * @index: returns the index of the tty | ||
1093 | * | ||
1094 | * This routine returns a tty driver structure, given a device number | ||
1095 | * and also passes back the index number. | ||
1096 | * | ||
1097 | * Locking: caller must hold tty_mutex | ||
851 | */ | 1098 | */ |
1099 | |||
852 | static struct tty_driver *get_tty_driver(dev_t device, int *index) | 1100 | static struct tty_driver *get_tty_driver(dev_t device, int *index) |
853 | { | 1101 | { |
854 | struct tty_driver *p; | 1102 | struct tty_driver *p; |
@@ -863,11 +1111,17 @@ static struct tty_driver *get_tty_driver(dev_t device, int *index) | |||
863 | return NULL; | 1111 | return NULL; |
864 | } | 1112 | } |
865 | 1113 | ||
866 | /* | 1114 | /** |
867 | * If we try to write to, or set the state of, a terminal and we're | 1115 | * tty_check_change - check for POSIX terminal changes |
868 | * not in the foreground, send a SIGTTOU. If the signal is blocked or | 1116 | * @tty: tty to check |
869 | * ignored, go ahead and perform the operation. (POSIX 7.2) | 1117 | * |
1118 | * If we try to write to, or set the state of, a terminal and we're | ||
1119 | * not in the foreground, send a SIGTTOU. If the signal is blocked or | ||
1120 | * ignored, go ahead and perform the operation. (POSIX 7.2) | ||
1121 | * | ||
1122 | * Locking: none | ||
870 | */ | 1123 | */ |
1124 | |||
871 | int tty_check_change(struct tty_struct * tty) | 1125 | int tty_check_change(struct tty_struct * tty) |
872 | { | 1126 | { |
873 | if (current->signal->tty != tty) | 1127 | if (current->signal->tty != tty) |
@@ -912,7 +1166,7 @@ static int hung_up_tty_ioctl(struct inode * inode, struct file * file, | |||
912 | return cmd == TIOCSPGRP ? -ENOTTY : -EIO; | 1166 | return cmd == TIOCSPGRP ? -ENOTTY : -EIO; |
913 | } | 1167 | } |
914 | 1168 | ||
915 | static struct file_operations tty_fops = { | 1169 | static const struct file_operations tty_fops = { |
916 | .llseek = no_llseek, | 1170 | .llseek = no_llseek, |
917 | .read = tty_read, | 1171 | .read = tty_read, |
918 | .write = tty_write, | 1172 | .write = tty_write, |
@@ -924,7 +1178,7 @@ static struct file_operations tty_fops = { | |||
924 | }; | 1178 | }; |
925 | 1179 | ||
926 | #ifdef CONFIG_UNIX98_PTYS | 1180 | #ifdef CONFIG_UNIX98_PTYS |
927 | static struct file_operations ptmx_fops = { | 1181 | static const struct file_operations ptmx_fops = { |
928 | .llseek = no_llseek, | 1182 | .llseek = no_llseek, |
929 | .read = tty_read, | 1183 | .read = tty_read, |
930 | .write = tty_write, | 1184 | .write = tty_write, |
@@ -936,7 +1190,7 @@ static struct file_operations ptmx_fops = { | |||
936 | }; | 1190 | }; |
937 | #endif | 1191 | #endif |
938 | 1192 | ||
939 | static struct file_operations console_fops = { | 1193 | static const struct file_operations console_fops = { |
940 | .llseek = no_llseek, | 1194 | .llseek = no_llseek, |
941 | .read = tty_read, | 1195 | .read = tty_read, |
942 | .write = redirected_tty_write, | 1196 | .write = redirected_tty_write, |
@@ -947,7 +1201,7 @@ static struct file_operations console_fops = { | |||
947 | .fasync = tty_fasync, | 1201 | .fasync = tty_fasync, |
948 | }; | 1202 | }; |
949 | 1203 | ||
950 | static struct file_operations hung_up_tty_fops = { | 1204 | static const struct file_operations hung_up_tty_fops = { |
951 | .llseek = no_llseek, | 1205 | .llseek = no_llseek, |
952 | .read = hung_up_tty_read, | 1206 | .read = hung_up_tty_read, |
953 | .write = hung_up_tty_write, | 1207 | .write = hung_up_tty_write, |
@@ -1005,10 +1259,27 @@ void tty_ldisc_flush(struct tty_struct *tty) | |||
1005 | 1259 | ||
1006 | EXPORT_SYMBOL_GPL(tty_ldisc_flush); | 1260 | EXPORT_SYMBOL_GPL(tty_ldisc_flush); |
1007 | 1261 | ||
1008 | /* | 1262 | /** |
1009 | * This can be called by the "eventd" kernel thread. That is process synchronous, | 1263 | * do_tty_hangup - actual handler for hangup events |
1010 | * but doesn't hold any locks, so we need to make sure we have the appropriate | 1264 | * @data: tty device |
1011 | * locks for what we're doing.. | 1265 | * |
1266 | * This can be called by the "eventd" kernel thread. That is process | ||
1267 | * synchronous but doesn't hold any locks, so we need to make sure we | ||
1268 | * have the appropriate locks for what we're doing. | ||
1269 | * | ||
1270 | * The hangup event clears any pending redirections onto the hung up | ||
1271 | * device. It ensures future writes will error and it does the needed | ||
1272 | * line discipline hangup and signal delivery. The tty object itself | ||
1273 | * remains intact. | ||
1274 | * | ||
1275 | * Locking: | ||
1276 | * BKL | ||
1277 | * redirect lock for undoing redirection | ||
1278 | * file list lock for manipulating list of ttys | ||
1279 | * tty_ldisc_lock from called functions | ||
1280 | * termios_sem resetting termios data | ||
1281 | * tasklist_lock to walk task list for hangup event | ||
1282 | * | ||
1012 | */ | 1283 | */ |
1013 | static void do_tty_hangup(void *data) | 1284 | static void do_tty_hangup(void *data) |
1014 | { | 1285 | { |
@@ -1133,6 +1404,14 @@ static void do_tty_hangup(void *data) | |||
1133 | fput(f); | 1404 | fput(f); |
1134 | } | 1405 | } |
1135 | 1406 | ||
1407 | /** | ||
1408 | * tty_hangup - trigger a hangup event | ||
1409 | * @tty: tty to hangup | ||
1410 | * | ||
1411 | * A carrier loss (virtual or otherwise) has occurred on this like | ||
1412 | * schedule a hangup sequence to run after this event. | ||
1413 | */ | ||
1414 | |||
1136 | void tty_hangup(struct tty_struct * tty) | 1415 | void tty_hangup(struct tty_struct * tty) |
1137 | { | 1416 | { |
1138 | #ifdef TTY_DEBUG_HANGUP | 1417 | #ifdef TTY_DEBUG_HANGUP |
@@ -1145,6 +1424,15 @@ void tty_hangup(struct tty_struct * tty) | |||
1145 | 1424 | ||
1146 | EXPORT_SYMBOL(tty_hangup); | 1425 | EXPORT_SYMBOL(tty_hangup); |
1147 | 1426 | ||
1427 | /** | ||
1428 | * tty_vhangup - process vhangup | ||
1429 | * @tty: tty to hangup | ||
1430 | * | ||
1431 | * The user has asked via system call for the terminal to be hung up. | ||
1432 | * We do this synchronously so that when the syscall returns the process | ||
1433 | * is complete. That guarantee is neccessary for security reasons. | ||
1434 | */ | ||
1435 | |||
1148 | void tty_vhangup(struct tty_struct * tty) | 1436 | void tty_vhangup(struct tty_struct * tty) |
1149 | { | 1437 | { |
1150 | #ifdef TTY_DEBUG_HANGUP | 1438 | #ifdef TTY_DEBUG_HANGUP |
@@ -1156,6 +1444,14 @@ void tty_vhangup(struct tty_struct * tty) | |||
1156 | } | 1444 | } |
1157 | EXPORT_SYMBOL(tty_vhangup); | 1445 | EXPORT_SYMBOL(tty_vhangup); |
1158 | 1446 | ||
1447 | /** | ||
1448 | * tty_hung_up_p - was tty hung up | ||
1449 | * @filp: file pointer of tty | ||
1450 | * | ||
1451 | * Return true if the tty has been subject to a vhangup or a carrier | ||
1452 | * loss | ||
1453 | */ | ||
1454 | |||
1159 | int tty_hung_up_p(struct file * filp) | 1455 | int tty_hung_up_p(struct file * filp) |
1160 | { | 1456 | { |
1161 | return (filp->f_op == &hung_up_tty_fops); | 1457 | return (filp->f_op == &hung_up_tty_fops); |
@@ -1163,19 +1459,28 @@ int tty_hung_up_p(struct file * filp) | |||
1163 | 1459 | ||
1164 | EXPORT_SYMBOL(tty_hung_up_p); | 1460 | EXPORT_SYMBOL(tty_hung_up_p); |
1165 | 1461 | ||
1166 | /* | 1462 | /** |
1167 | * This function is typically called only by the session leader, when | 1463 | * disassociate_ctty - disconnect controlling tty |
1168 | * it wants to disassociate itself from its controlling tty. | 1464 | * @on_exit: true if exiting so need to "hang up" the session |
1465 | * | ||
1466 | * This function is typically called only by the session leader, when | ||
1467 | * it wants to disassociate itself from its controlling tty. | ||
1169 | * | 1468 | * |
1170 | * It performs the following functions: | 1469 | * It performs the following functions: |
1171 | * (1) Sends a SIGHUP and SIGCONT to the foreground process group | 1470 | * (1) Sends a SIGHUP and SIGCONT to the foreground process group |
1172 | * (2) Clears the tty from being controlling the session | 1471 | * (2) Clears the tty from being controlling the session |
1173 | * (3) Clears the controlling tty for all processes in the | 1472 | * (3) Clears the controlling tty for all processes in the |
1174 | * session group. | 1473 | * session group. |
1175 | * | 1474 | * |
1176 | * The argument on_exit is set to 1 if called when a process is | 1475 | * The argument on_exit is set to 1 if called when a process is |
1177 | * exiting; it is 0 if called by the ioctl TIOCNOTTY. | 1476 | * exiting; it is 0 if called by the ioctl TIOCNOTTY. |
1477 | * | ||
1478 | * Locking: tty_mutex is taken to protect current->signal->tty | ||
1479 | * BKL is taken for hysterical raisins | ||
1480 | * Tasklist lock is taken (under tty_mutex) to walk process | ||
1481 | * lists for the session. | ||
1178 | */ | 1482 | */ |
1483 | |||
1179 | void disassociate_ctty(int on_exit) | 1484 | void disassociate_ctty(int on_exit) |
1180 | { | 1485 | { |
1181 | struct tty_struct *tty; | 1486 | struct tty_struct *tty; |
@@ -1222,6 +1527,25 @@ void disassociate_ctty(int on_exit) | |||
1222 | unlock_kernel(); | 1527 | unlock_kernel(); |
1223 | } | 1528 | } |
1224 | 1529 | ||
1530 | |||
1531 | /** | ||
1532 | * stop_tty - propogate flow control | ||
1533 | * @tty: tty to stop | ||
1534 | * | ||
1535 | * Perform flow control to the driver. For PTY/TTY pairs we | ||
1536 | * must also propogate the TIOCKPKT status. May be called | ||
1537 | * on an already stopped device and will not re-call the driver | ||
1538 | * method. | ||
1539 | * | ||
1540 | * This functionality is used by both the line disciplines for | ||
1541 | * halting incoming flow and by the driver. It may therefore be | ||
1542 | * called from any context, may be under the tty atomic_write_lock | ||
1543 | * but not always. | ||
1544 | * | ||
1545 | * Locking: | ||
1546 | * Broken. Relies on BKL which is unsafe here. | ||
1547 | */ | ||
1548 | |||
1225 | void stop_tty(struct tty_struct *tty) | 1549 | void stop_tty(struct tty_struct *tty) |
1226 | { | 1550 | { |
1227 | if (tty->stopped) | 1551 | if (tty->stopped) |
@@ -1238,6 +1562,19 @@ void stop_tty(struct tty_struct *tty) | |||
1238 | 1562 | ||
1239 | EXPORT_SYMBOL(stop_tty); | 1563 | EXPORT_SYMBOL(stop_tty); |
1240 | 1564 | ||
1565 | /** | ||
1566 | * start_tty - propogate flow control | ||
1567 | * @tty: tty to start | ||
1568 | * | ||
1569 | * Start a tty that has been stopped if at all possible. Perform | ||
1570 | * any neccessary wakeups and propogate the TIOCPKT status. If this | ||
1571 | * is the tty was previous stopped and is being started then the | ||
1572 | * driver start method is invoked and the line discipline woken. | ||
1573 | * | ||
1574 | * Locking: | ||
1575 | * Broken. Relies on BKL which is unsafe here. | ||
1576 | */ | ||
1577 | |||
1241 | void start_tty(struct tty_struct *tty) | 1578 | void start_tty(struct tty_struct *tty) |
1242 | { | 1579 | { |
1243 | if (!tty->stopped || tty->flow_stopped) | 1580 | if (!tty->stopped || tty->flow_stopped) |
@@ -1258,6 +1595,23 @@ void start_tty(struct tty_struct *tty) | |||
1258 | 1595 | ||
1259 | EXPORT_SYMBOL(start_tty); | 1596 | EXPORT_SYMBOL(start_tty); |
1260 | 1597 | ||
1598 | /** | ||
1599 | * tty_read - read method for tty device files | ||
1600 | * @file: pointer to tty file | ||
1601 | * @buf: user buffer | ||
1602 | * @count: size of user buffer | ||
1603 | * @ppos: unused | ||
1604 | * | ||
1605 | * Perform the read system call function on this terminal device. Checks | ||
1606 | * for hung up devices before calling the line discipline method. | ||
1607 | * | ||
1608 | * Locking: | ||
1609 | * Locks the line discipline internally while needed | ||
1610 | * For historical reasons the line discipline read method is | ||
1611 | * invoked under the BKL. This will go away in time so do not rely on it | ||
1612 | * in new code. Multiple read calls may be outstanding in parallel. | ||
1613 | */ | ||
1614 | |||
1261 | static ssize_t tty_read(struct file * file, char __user * buf, size_t count, | 1615 | static ssize_t tty_read(struct file * file, char __user * buf, size_t count, |
1262 | loff_t *ppos) | 1616 | loff_t *ppos) |
1263 | { | 1617 | { |
@@ -1302,6 +1656,7 @@ static inline ssize_t do_tty_write( | |||
1302 | ssize_t ret = 0, written = 0; | 1656 | ssize_t ret = 0, written = 0; |
1303 | unsigned int chunk; | 1657 | unsigned int chunk; |
1304 | 1658 | ||
1659 | /* FIXME: O_NDELAY ... */ | ||
1305 | if (mutex_lock_interruptible(&tty->atomic_write_lock)) { | 1660 | if (mutex_lock_interruptible(&tty->atomic_write_lock)) { |
1306 | return -ERESTARTSYS; | 1661 | return -ERESTARTSYS; |
1307 | } | 1662 | } |
@@ -1318,6 +1673,9 @@ static inline ssize_t do_tty_write( | |||
1318 | * layer has problems with bigger chunks. It will | 1673 | * layer has problems with bigger chunks. It will |
1319 | * claim to be able to handle more characters than | 1674 | * claim to be able to handle more characters than |
1320 | * it actually does. | 1675 | * it actually does. |
1676 | * | ||
1677 | * FIXME: This can probably go away now except that 64K chunks | ||
1678 | * are too likely to fail unless switched to vmalloc... | ||
1321 | */ | 1679 | */ |
1322 | chunk = 2048; | 1680 | chunk = 2048; |
1323 | if (test_bit(TTY_NO_WRITE_SPLIT, &tty->flags)) | 1681 | if (test_bit(TTY_NO_WRITE_SPLIT, &tty->flags)) |
@@ -1375,6 +1733,24 @@ static inline ssize_t do_tty_write( | |||
1375 | } | 1733 | } |
1376 | 1734 | ||
1377 | 1735 | ||
1736 | /** | ||
1737 | * tty_write - write method for tty device file | ||
1738 | * @file: tty file pointer | ||
1739 | * @buf: user data to write | ||
1740 | * @count: bytes to write | ||
1741 | * @ppos: unused | ||
1742 | * | ||
1743 | * Write data to a tty device via the line discipline. | ||
1744 | * | ||
1745 | * Locking: | ||
1746 | * Locks the line discipline as required | ||
1747 | * Writes to the tty driver are serialized by the atomic_write_lock | ||
1748 | * and are then processed in chunks to the device. The line discipline | ||
1749 | * write method will not be involked in parallel for each device | ||
1750 | * The line discipline write method is called under the big | ||
1751 | * kernel lock for historical reasons. New code should not rely on this. | ||
1752 | */ | ||
1753 | |||
1378 | static ssize_t tty_write(struct file * file, const char __user * buf, size_t count, | 1754 | static ssize_t tty_write(struct file * file, const char __user * buf, size_t count, |
1379 | loff_t *ppos) | 1755 | loff_t *ppos) |
1380 | { | 1756 | { |
@@ -1422,7 +1798,18 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t | |||
1422 | 1798 | ||
1423 | static char ptychar[] = "pqrstuvwxyzabcde"; | 1799 | static char ptychar[] = "pqrstuvwxyzabcde"; |
1424 | 1800 | ||
1425 | static inline void pty_line_name(struct tty_driver *driver, int index, char *p) | 1801 | /** |
1802 | * pty_line_name - generate name for a pty | ||
1803 | * @driver: the tty driver in use | ||
1804 | * @index: the minor number | ||
1805 | * @p: output buffer of at least 6 bytes | ||
1806 | * | ||
1807 | * Generate a name from a driver reference and write it to the output | ||
1808 | * buffer. | ||
1809 | * | ||
1810 | * Locking: None | ||
1811 | */ | ||
1812 | static void pty_line_name(struct tty_driver *driver, int index, char *p) | ||
1426 | { | 1813 | { |
1427 | int i = index + driver->name_base; | 1814 | int i = index + driver->name_base; |
1428 | /* ->name is initialized to "ttyp", but "tty" is expected */ | 1815 | /* ->name is initialized to "ttyp", but "tty" is expected */ |
@@ -1431,24 +1818,53 @@ static inline void pty_line_name(struct tty_driver *driver, int index, char *p) | |||
1431 | ptychar[i >> 4 & 0xf], i & 0xf); | 1818 | ptychar[i >> 4 & 0xf], i & 0xf); |
1432 | } | 1819 | } |
1433 | 1820 | ||
1434 | static inline void tty_line_name(struct tty_driver *driver, int index, char *p) | 1821 | /** |
1822 | * pty_line_name - generate name for a tty | ||
1823 | * @driver: the tty driver in use | ||
1824 | * @index: the minor number | ||
1825 | * @p: output buffer of at least 7 bytes | ||
1826 | * | ||
1827 | * Generate a name from a driver reference and write it to the output | ||
1828 | * buffer. | ||
1829 | * | ||
1830 | * Locking: None | ||
1831 | */ | ||
1832 | static void tty_line_name(struct tty_driver *driver, int index, char *p) | ||
1435 | { | 1833 | { |
1436 | sprintf(p, "%s%d", driver->name, index + driver->name_base); | 1834 | sprintf(p, "%s%d", driver->name, index + driver->name_base); |
1437 | } | 1835 | } |
1438 | 1836 | ||
1439 | /* | 1837 | /** |
1838 | * init_dev - initialise a tty device | ||
1839 | * @driver: tty driver we are opening a device on | ||
1840 | * @idx: device index | ||
1841 | * @tty: returned tty structure | ||
1842 | * | ||
1843 | * Prepare a tty device. This may not be a "new" clean device but | ||
1844 | * could also be an active device. The pty drivers require special | ||
1845 | * handling because of this. | ||
1846 | * | ||
1847 | * Locking: | ||
1848 | * The function is called under the tty_mutex, which | ||
1849 | * protects us from the tty struct or driver itself going away. | ||
1850 | * | ||
1851 | * On exit the tty device has the line discipline attached and | ||
1852 | * a reference count of 1. If a pair was created for pty/tty use | ||
1853 | * and the other was a pty master then it too has a reference count of 1. | ||
1854 | * | ||
1440 | * WSH 06/09/97: Rewritten to remove races and properly clean up after a | 1855 | * WSH 06/09/97: Rewritten to remove races and properly clean up after a |
1441 | * failed open. The new code protects the open with a mutex, so it's | 1856 | * failed open. The new code protects the open with a mutex, so it's |
1442 | * really quite straightforward. The mutex locking can probably be | 1857 | * really quite straightforward. The mutex locking can probably be |
1443 | * relaxed for the (most common) case of reopening a tty. | 1858 | * relaxed for the (most common) case of reopening a tty. |
1444 | */ | 1859 | */ |
1860 | |||
1445 | static int init_dev(struct tty_driver *driver, int idx, | 1861 | static int init_dev(struct tty_driver *driver, int idx, |
1446 | struct tty_struct **ret_tty) | 1862 | struct tty_struct **ret_tty) |
1447 | { | 1863 | { |
1448 | struct tty_struct *tty, *o_tty; | 1864 | struct tty_struct *tty, *o_tty; |
1449 | struct termios *tp, **tp_loc, *o_tp, **o_tp_loc; | 1865 | struct termios *tp, **tp_loc, *o_tp, **o_tp_loc; |
1450 | struct termios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc; | 1866 | struct termios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc; |
1451 | int retval=0; | 1867 | int retval = 0; |
1452 | 1868 | ||
1453 | /* check whether we're reopening an existing tty */ | 1869 | /* check whether we're reopening an existing tty */ |
1454 | if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { | 1870 | if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { |
@@ -1662,10 +2078,20 @@ release_mem_out: | |||
1662 | goto end_init; | 2078 | goto end_init; |
1663 | } | 2079 | } |
1664 | 2080 | ||
1665 | /* | 2081 | /** |
1666 | * Releases memory associated with a tty structure, and clears out the | 2082 | * release_mem - release tty structure memory |
1667 | * driver table slots. | 2083 | * |
2084 | * Releases memory associated with a tty structure, and clears out the | ||
2085 | * driver table slots. This function is called when a device is no longer | ||
2086 | * in use. It also gets called when setup of a device fails. | ||
2087 | * | ||
2088 | * Locking: | ||
2089 | * tty_mutex - sometimes only | ||
2090 | * takes the file list lock internally when working on the list | ||
2091 | * of ttys that the driver keeps. | ||
2092 | * FIXME: should we require tty_mutex is held here ?? | ||
1668 | */ | 2093 | */ |
2094 | |||
1669 | static void release_mem(struct tty_struct *tty, int idx) | 2095 | static void release_mem(struct tty_struct *tty, int idx) |
1670 | { | 2096 | { |
1671 | struct tty_struct *o_tty; | 2097 | struct tty_struct *o_tty; |
@@ -2006,18 +2432,27 @@ static void release_dev(struct file * filp) | |||
2006 | 2432 | ||
2007 | } | 2433 | } |
2008 | 2434 | ||
2009 | /* | 2435 | /** |
2010 | * tty_open and tty_release keep up the tty count that contains the | 2436 | * tty_open - open a tty device |
2011 | * number of opens done on a tty. We cannot use the inode-count, as | 2437 | * @inode: inode of device file |
2012 | * different inodes might point to the same tty. | 2438 | * @filp: file pointer to tty |
2439 | * | ||
2440 | * tty_open and tty_release keep up the tty count that contains the | ||
2441 | * number of opens done on a tty. We cannot use the inode-count, as | ||
2442 | * different inodes might point to the same tty. | ||
2443 | * | ||
2444 | * Open-counting is needed for pty masters, as well as for keeping | ||
2445 | * track of serial lines: DTR is dropped when the last close happens. | ||
2446 | * (This is not done solely through tty->count, now. - Ted 1/27/92) | ||
2013 | * | 2447 | * |
2014 | * Open-counting is needed for pty masters, as well as for keeping | 2448 | * The termios state of a pty is reset on first open so that |
2015 | * track of serial lines: DTR is dropped when the last close happens. | 2449 | * settings don't persist across reuse. |
2016 | * (This is not done solely through tty->count, now. - Ted 1/27/92) | ||
2017 | * | 2450 | * |
2018 | * The termios state of a pty is reset on first open so that | 2451 | * Locking: tty_mutex protects current->signal->tty, get_tty_driver and |
2019 | * settings don't persist across reuse. | 2452 | * init_dev work. tty->count should protect the rest. |
2453 | * task_lock is held to update task details for sessions | ||
2020 | */ | 2454 | */ |
2455 | |||
2021 | static int tty_open(struct inode * inode, struct file * filp) | 2456 | static int tty_open(struct inode * inode, struct file * filp) |
2022 | { | 2457 | { |
2023 | struct tty_struct *tty; | 2458 | struct tty_struct *tty; |
@@ -2132,6 +2567,18 @@ got_driver: | |||
2132 | } | 2567 | } |
2133 | 2568 | ||
2134 | #ifdef CONFIG_UNIX98_PTYS | 2569 | #ifdef CONFIG_UNIX98_PTYS |
2570 | /** | ||
2571 | * ptmx_open - open a unix 98 pty master | ||
2572 | * @inode: inode of device file | ||
2573 | * @filp: file pointer to tty | ||
2574 | * | ||
2575 | * Allocate a unix98 pty master device from the ptmx driver. | ||
2576 | * | ||
2577 | * Locking: tty_mutex protects theinit_dev work. tty->count should | ||
2578 | protect the rest. | ||
2579 | * allocated_ptys_lock handles the list of free pty numbers | ||
2580 | */ | ||
2581 | |||
2135 | static int ptmx_open(struct inode * inode, struct file * filp) | 2582 | static int ptmx_open(struct inode * inode, struct file * filp) |
2136 | { | 2583 | { |
2137 | struct tty_struct *tty; | 2584 | struct tty_struct *tty; |
@@ -2191,6 +2638,18 @@ out: | |||
2191 | } | 2638 | } |
2192 | #endif | 2639 | #endif |
2193 | 2640 | ||
2641 | /** | ||
2642 | * tty_release - vfs callback for close | ||
2643 | * @inode: inode of tty | ||
2644 | * @filp: file pointer for handle to tty | ||
2645 | * | ||
2646 | * Called the last time each file handle is closed that references | ||
2647 | * this tty. There may however be several such references. | ||
2648 | * | ||
2649 | * Locking: | ||
2650 | * Takes bkl. See release_dev | ||
2651 | */ | ||
2652 | |||
2194 | static int tty_release(struct inode * inode, struct file * filp) | 2653 | static int tty_release(struct inode * inode, struct file * filp) |
2195 | { | 2654 | { |
2196 | lock_kernel(); | 2655 | lock_kernel(); |
@@ -2199,7 +2658,18 @@ static int tty_release(struct inode * inode, struct file * filp) | |||
2199 | return 0; | 2658 | return 0; |
2200 | } | 2659 | } |
2201 | 2660 | ||
2202 | /* No kernel lock held - fine */ | 2661 | /** |
2662 | * tty_poll - check tty status | ||
2663 | * @filp: file being polled | ||
2664 | * @wait: poll wait structures to update | ||
2665 | * | ||
2666 | * Call the line discipline polling method to obtain the poll | ||
2667 | * status of the device. | ||
2668 | * | ||
2669 | * Locking: locks called line discipline but ldisc poll method | ||
2670 | * may be re-entered freely by other callers. | ||
2671 | */ | ||
2672 | |||
2203 | static unsigned int tty_poll(struct file * filp, poll_table * wait) | 2673 | static unsigned int tty_poll(struct file * filp, poll_table * wait) |
2204 | { | 2674 | { |
2205 | struct tty_struct * tty; | 2675 | struct tty_struct * tty; |
@@ -2243,6 +2713,21 @@ static int tty_fasync(int fd, struct file * filp, int on) | |||
2243 | return 0; | 2713 | return 0; |
2244 | } | 2714 | } |
2245 | 2715 | ||
2716 | /** | ||
2717 | * tiocsti - fake input character | ||
2718 | * @tty: tty to fake input into | ||
2719 | * @p: pointer to character | ||
2720 | * | ||
2721 | * Fake input to a tty device. Does the neccessary locking and | ||
2722 | * input management. | ||
2723 | * | ||
2724 | * FIXME: does not honour flow control ?? | ||
2725 | * | ||
2726 | * Locking: | ||
2727 | * Called functions take tty_ldisc_lock | ||
2728 | * current->signal->tty check is safe without locks | ||
2729 | */ | ||
2730 | |||
2246 | static int tiocsti(struct tty_struct *tty, char __user *p) | 2731 | static int tiocsti(struct tty_struct *tty, char __user *p) |
2247 | { | 2732 | { |
2248 | char ch, mbz = 0; | 2733 | char ch, mbz = 0; |
@@ -2258,6 +2743,18 @@ static int tiocsti(struct tty_struct *tty, char __user *p) | |||
2258 | return 0; | 2743 | return 0; |
2259 | } | 2744 | } |
2260 | 2745 | ||
2746 | /** | ||
2747 | * tiocgwinsz - implement window query ioctl | ||
2748 | * @tty; tty | ||
2749 | * @arg: user buffer for result | ||
2750 | * | ||
2751 | * Copies the kernel idea of the window size into the user buffer. No | ||
2752 | * locking is done. | ||
2753 | * | ||
2754 | * FIXME: Returning random values racing a window size set is wrong | ||
2755 | * should lock here against that | ||
2756 | */ | ||
2757 | |||
2261 | static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg) | 2758 | static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg) |
2262 | { | 2759 | { |
2263 | if (copy_to_user(arg, &tty->winsize, sizeof(*arg))) | 2760 | if (copy_to_user(arg, &tty->winsize, sizeof(*arg))) |
@@ -2265,6 +2762,24 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg) | |||
2265 | return 0; | 2762 | return 0; |
2266 | } | 2763 | } |
2267 | 2764 | ||
2765 | /** | ||
2766 | * tiocswinsz - implement window size set ioctl | ||
2767 | * @tty; tty | ||
2768 | * @arg: user buffer for result | ||
2769 | * | ||
2770 | * Copies the user idea of the window size to the kernel. Traditionally | ||
2771 | * this is just advisory information but for the Linux console it | ||
2772 | * actually has driver level meaning and triggers a VC resize. | ||
2773 | * | ||
2774 | * Locking: | ||
2775 | * The console_sem is used to ensure we do not try and resize | ||
2776 | * the console twice at once. | ||
2777 | * FIXME: Two racing size sets may leave the console and kernel | ||
2778 | * parameters disagreeing. Is this exploitable ? | ||
2779 | * FIXME: Random values racing a window size get is wrong | ||
2780 | * should lock here against that | ||
2781 | */ | ||
2782 | |||
2268 | static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, | 2783 | static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, |
2269 | struct winsize __user * arg) | 2784 | struct winsize __user * arg) |
2270 | { | 2785 | { |
@@ -2294,6 +2809,15 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2294 | return 0; | 2809 | return 0; |
2295 | } | 2810 | } |
2296 | 2811 | ||
2812 | /** | ||
2813 | * tioccons - allow admin to move logical console | ||
2814 | * @file: the file to become console | ||
2815 | * | ||
2816 | * Allow the adminstrator to move the redirected console device | ||
2817 | * | ||
2818 | * Locking: uses redirect_lock to guard the redirect information | ||
2819 | */ | ||
2820 | |||
2297 | static int tioccons(struct file *file) | 2821 | static int tioccons(struct file *file) |
2298 | { | 2822 | { |
2299 | if (!capable(CAP_SYS_ADMIN)) | 2823 | if (!capable(CAP_SYS_ADMIN)) |
@@ -2319,6 +2843,17 @@ static int tioccons(struct file *file) | |||
2319 | return 0; | 2843 | return 0; |
2320 | } | 2844 | } |
2321 | 2845 | ||
2846 | /** | ||
2847 | * fionbio - non blocking ioctl | ||
2848 | * @file: file to set blocking value | ||
2849 | * @p: user parameter | ||
2850 | * | ||
2851 | * Historical tty interfaces had a blocking control ioctl before | ||
2852 | * the generic functionality existed. This piece of history is preserved | ||
2853 | * in the expected tty API of posix OS's. | ||
2854 | * | ||
2855 | * Locking: none, the open fle handle ensures it won't go away. | ||
2856 | */ | ||
2322 | 2857 | ||
2323 | static int fionbio(struct file *file, int __user *p) | 2858 | static int fionbio(struct file *file, int __user *p) |
2324 | { | 2859 | { |
@@ -2334,9 +2869,26 @@ static int fionbio(struct file *file, int __user *p) | |||
2334 | return 0; | 2869 | return 0; |
2335 | } | 2870 | } |
2336 | 2871 | ||
2872 | /** | ||
2873 | * tiocsctty - set controlling tty | ||
2874 | * @tty: tty structure | ||
2875 | * @arg: user argument | ||
2876 | * | ||
2877 | * This ioctl is used to manage job control. It permits a session | ||
2878 | * leader to set this tty as the controlling tty for the session. | ||
2879 | * | ||
2880 | * Locking: | ||
2881 | * Takes tasklist lock internally to walk sessions | ||
2882 | * Takes task_lock() when updating signal->tty | ||
2883 | * | ||
2884 | * FIXME: tty_mutex is needed to protect signal->tty references. | ||
2885 | * FIXME: why task_lock on the signal->tty reference ?? | ||
2886 | * | ||
2887 | */ | ||
2888 | |||
2337 | static int tiocsctty(struct tty_struct *tty, int arg) | 2889 | static int tiocsctty(struct tty_struct *tty, int arg) |
2338 | { | 2890 | { |
2339 | task_t *p; | 2891 | struct task_struct *p; |
2340 | 2892 | ||
2341 | if (current->signal->leader && | 2893 | if (current->signal->leader && |
2342 | (current->signal->session == tty->session)) | 2894 | (current->signal->session == tty->session)) |
@@ -2374,6 +2926,18 @@ static int tiocsctty(struct tty_struct *tty, int arg) | |||
2374 | return 0; | 2926 | return 0; |
2375 | } | 2927 | } |
2376 | 2928 | ||
2929 | /** | ||
2930 | * tiocgpgrp - get process group | ||
2931 | * @tty: tty passed by user | ||
2932 | * @real_tty: tty side of the tty pased by the user if a pty else the tty | ||
2933 | * @p: returned pid | ||
2934 | * | ||
2935 | * Obtain the process group of the tty. If there is no process group | ||
2936 | * return an error. | ||
2937 | * | ||
2938 | * Locking: none. Reference to ->signal->tty is safe. | ||
2939 | */ | ||
2940 | |||
2377 | static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) | 2941 | static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) |
2378 | { | 2942 | { |
2379 | /* | 2943 | /* |
@@ -2385,6 +2949,20 @@ static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t | |||
2385 | return put_user(real_tty->pgrp, p); | 2949 | return put_user(real_tty->pgrp, p); |
2386 | } | 2950 | } |
2387 | 2951 | ||
2952 | /** | ||
2953 | * tiocspgrp - attempt to set process group | ||
2954 | * @tty: tty passed by user | ||
2955 | * @real_tty: tty side device matching tty passed by user | ||
2956 | * @p: pid pointer | ||
2957 | * | ||
2958 | * Set the process group of the tty to the session passed. Only | ||
2959 | * permitted where the tty session is our session. | ||
2960 | * | ||
2961 | * Locking: None | ||
2962 | * | ||
2963 | * FIXME: current->signal->tty referencing is unsafe. | ||
2964 | */ | ||
2965 | |||
2388 | static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) | 2966 | static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) |
2389 | { | 2967 | { |
2390 | pid_t pgrp; | 2968 | pid_t pgrp; |
@@ -2408,6 +2986,18 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t | |||
2408 | return 0; | 2986 | return 0; |
2409 | } | 2987 | } |
2410 | 2988 | ||
2989 | /** | ||
2990 | * tiocgsid - get session id | ||
2991 | * @tty: tty passed by user | ||
2992 | * @real_tty: tty side of the tty pased by the user if a pty else the tty | ||
2993 | * @p: pointer to returned session id | ||
2994 | * | ||
2995 | * Obtain the session id of the tty. If there is no session | ||
2996 | * return an error. | ||
2997 | * | ||
2998 | * Locking: none. Reference to ->signal->tty is safe. | ||
2999 | */ | ||
3000 | |||
2411 | static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) | 3001 | static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) |
2412 | { | 3002 | { |
2413 | /* | 3003 | /* |
@@ -2421,6 +3011,16 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ | |||
2421 | return put_user(real_tty->session, p); | 3011 | return put_user(real_tty->session, p); |
2422 | } | 3012 | } |
2423 | 3013 | ||
3014 | /** | ||
3015 | * tiocsetd - set line discipline | ||
3016 | * @tty: tty device | ||
3017 | * @p: pointer to user data | ||
3018 | * | ||
3019 | * Set the line discipline according to user request. | ||
3020 | * | ||
3021 | * Locking: see tty_set_ldisc, this function is just a helper | ||
3022 | */ | ||
3023 | |||
2424 | static int tiocsetd(struct tty_struct *tty, int __user *p) | 3024 | static int tiocsetd(struct tty_struct *tty, int __user *p) |
2425 | { | 3025 | { |
2426 | int ldisc; | 3026 | int ldisc; |
@@ -2430,6 +3030,21 @@ static int tiocsetd(struct tty_struct *tty, int __user *p) | |||
2430 | return tty_set_ldisc(tty, ldisc); | 3030 | return tty_set_ldisc(tty, ldisc); |
2431 | } | 3031 | } |
2432 | 3032 | ||
3033 | /** | ||
3034 | * send_break - performed time break | ||
3035 | * @tty: device to break on | ||
3036 | * @duration: timeout in mS | ||
3037 | * | ||
3038 | * Perform a timed break on hardware that lacks its own driver level | ||
3039 | * timed break functionality. | ||
3040 | * | ||
3041 | * Locking: | ||
3042 | * None | ||
3043 | * | ||
3044 | * FIXME: | ||
3045 | * What if two overlap | ||
3046 | */ | ||
3047 | |||
2433 | static int send_break(struct tty_struct *tty, unsigned int duration) | 3048 | static int send_break(struct tty_struct *tty, unsigned int duration) |
2434 | { | 3049 | { |
2435 | tty->driver->break_ctl(tty, -1); | 3050 | tty->driver->break_ctl(tty, -1); |
@@ -2442,8 +3057,19 @@ static int send_break(struct tty_struct *tty, unsigned int duration) | |||
2442 | return 0; | 3057 | return 0; |
2443 | } | 3058 | } |
2444 | 3059 | ||
2445 | static int | 3060 | /** |
2446 | tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) | 3061 | * tiocmget - get modem status |
3062 | * @tty: tty device | ||
3063 | * @file: user file pointer | ||
3064 | * @p: pointer to result | ||
3065 | * | ||
3066 | * Obtain the modem status bits from the tty driver if the feature | ||
3067 | * is supported. Return -EINVAL if it is not available. | ||
3068 | * | ||
3069 | * Locking: none (up to the driver) | ||
3070 | */ | ||
3071 | |||
3072 | static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) | ||
2447 | { | 3073 | { |
2448 | int retval = -EINVAL; | 3074 | int retval = -EINVAL; |
2449 | 3075 | ||
@@ -2456,8 +3082,20 @@ tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p) | |||
2456 | return retval; | 3082 | return retval; |
2457 | } | 3083 | } |
2458 | 3084 | ||
2459 | static int | 3085 | /** |
2460 | tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, | 3086 | * tiocmset - set modem status |
3087 | * @tty: tty device | ||
3088 | * @file: user file pointer | ||
3089 | * @cmd: command - clear bits, set bits or set all | ||
3090 | * @p: pointer to desired bits | ||
3091 | * | ||
3092 | * Set the modem status bits from the tty driver if the feature | ||
3093 | * is supported. Return -EINVAL if it is not available. | ||
3094 | * | ||
3095 | * Locking: none (up to the driver) | ||
3096 | */ | ||
3097 | |||
3098 | static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, | ||
2461 | unsigned __user *p) | 3099 | unsigned __user *p) |
2462 | { | 3100 | { |
2463 | int retval = -EINVAL; | 3101 | int retval = -EINVAL; |
@@ -2573,6 +3211,7 @@ int tty_ioctl(struct inode * inode, struct file * file, | |||
2573 | clear_bit(TTY_EXCLUSIVE, &tty->flags); | 3211 | clear_bit(TTY_EXCLUSIVE, &tty->flags); |
2574 | return 0; | 3212 | return 0; |
2575 | case TIOCNOTTY: | 3213 | case TIOCNOTTY: |
3214 | /* FIXME: taks lock or tty_mutex ? */ | ||
2576 | if (current->signal->tty != tty) | 3215 | if (current->signal->tty != tty) |
2577 | return -ENOTTY; | 3216 | return -ENOTTY; |
2578 | if (current->signal->leader) | 3217 | if (current->signal->leader) |
@@ -2753,9 +3392,16 @@ void do_SAK(struct tty_struct *tty) | |||
2753 | 3392 | ||
2754 | EXPORT_SYMBOL(do_SAK); | 3393 | EXPORT_SYMBOL(do_SAK); |
2755 | 3394 | ||
2756 | /* | 3395 | /** |
2757 | * This routine is called out of the software interrupt to flush data | 3396 | * flush_to_ldisc |
2758 | * from the buffer chain to the line discipline. | 3397 | * @private_: tty structure passed from work queue. |
3398 | * | ||
3399 | * This routine is called out of the software interrupt to flush data | ||
3400 | * from the buffer chain to the line discipline. | ||
3401 | * | ||
3402 | * Locking: holds tty->buf.lock to guard buffer list. Drops the lock | ||
3403 | * while invoking the line discipline receive_buf method. The | ||
3404 | * receive_buf method is single threaded for each tty instance. | ||
2759 | */ | 3405 | */ |
2760 | 3406 | ||
2761 | static void flush_to_ldisc(void *private_) | 3407 | static void flush_to_ldisc(void *private_) |
@@ -2831,6 +3477,8 @@ static int n_baud_table = ARRAY_SIZE(baud_table); | |||
2831 | * Convert termios baud rate data into a speed. This should be called | 3477 | * Convert termios baud rate data into a speed. This should be called |
2832 | * with the termios lock held if this termios is a terminal termios | 3478 | * with the termios lock held if this termios is a terminal termios |
2833 | * structure. May change the termios data. | 3479 | * structure. May change the termios data. |
3480 | * | ||
3481 | * Locking: none | ||
2834 | */ | 3482 | */ |
2835 | 3483 | ||
2836 | int tty_termios_baud_rate(struct termios *termios) | 3484 | int tty_termios_baud_rate(struct termios *termios) |
@@ -2859,6 +3507,8 @@ EXPORT_SYMBOL(tty_termios_baud_rate); | |||
2859 | * Returns the baud rate as an integer for this terminal. The | 3507 | * Returns the baud rate as an integer for this terminal. The |
2860 | * termios lock must be held by the caller and the terminal bit | 3508 | * termios lock must be held by the caller and the terminal bit |
2861 | * flags may be updated. | 3509 | * flags may be updated. |
3510 | * | ||
3511 | * Locking: none | ||
2862 | */ | 3512 | */ |
2863 | 3513 | ||
2864 | int tty_get_baud_rate(struct tty_struct *tty) | 3514 | int tty_get_baud_rate(struct tty_struct *tty) |
@@ -2888,6 +3538,8 @@ EXPORT_SYMBOL(tty_get_baud_rate); | |||
2888 | * | 3538 | * |
2889 | * In the event of the queue being busy for flipping the work will be | 3539 | * In the event of the queue being busy for flipping the work will be |
2890 | * held off and retried later. | 3540 | * held off and retried later. |
3541 | * | ||
3542 | * Locking: tty buffer lock. Driver locks in low latency mode. | ||
2891 | */ | 3543 | */ |
2892 | 3544 | ||
2893 | void tty_flip_buffer_push(struct tty_struct *tty) | 3545 | void tty_flip_buffer_push(struct tty_struct *tty) |
@@ -2907,9 +3559,16 @@ void tty_flip_buffer_push(struct tty_struct *tty) | |||
2907 | EXPORT_SYMBOL(tty_flip_buffer_push); | 3559 | EXPORT_SYMBOL(tty_flip_buffer_push); |
2908 | 3560 | ||
2909 | 3561 | ||
2910 | /* | 3562 | /** |
2911 | * This subroutine initializes a tty structure. | 3563 | * initialize_tty_struct |
3564 | * @tty: tty to initialize | ||
3565 | * | ||
3566 | * This subroutine initializes a tty structure that has been newly | ||
3567 | * allocated. | ||
3568 | * | ||
3569 | * Locking: none - tty in question must not be exposed at this point | ||
2912 | */ | 3570 | */ |
3571 | |||
2913 | static void initialize_tty_struct(struct tty_struct *tty) | 3572 | static void initialize_tty_struct(struct tty_struct *tty) |
2914 | { | 3573 | { |
2915 | memset(tty, 0, sizeof(struct tty_struct)); | 3574 | memset(tty, 0, sizeof(struct tty_struct)); |
@@ -2935,6 +3594,7 @@ static void initialize_tty_struct(struct tty_struct *tty) | |||
2935 | /* | 3594 | /* |
2936 | * The default put_char routine if the driver did not define one. | 3595 | * The default put_char routine if the driver did not define one. |
2937 | */ | 3596 | */ |
3597 | |||
2938 | static void tty_default_put_char(struct tty_struct *tty, unsigned char ch) | 3598 | static void tty_default_put_char(struct tty_struct *tty, unsigned char ch) |
2939 | { | 3599 | { |
2940 | tty->driver->write(tty, &ch, 1); | 3600 | tty->driver->write(tty, &ch, 1); |
@@ -2943,19 +3603,23 @@ static void tty_default_put_char(struct tty_struct *tty, unsigned char ch) | |||
2943 | static struct class *tty_class; | 3603 | static struct class *tty_class; |
2944 | 3604 | ||
2945 | /** | 3605 | /** |
2946 | * tty_register_device - register a tty device | 3606 | * tty_register_device - register a tty device |
2947 | * @driver: the tty driver that describes the tty device | 3607 | * @driver: the tty driver that describes the tty device |
2948 | * @index: the index in the tty driver for this tty device | 3608 | * @index: the index in the tty driver for this tty device |
2949 | * @device: a struct device that is associated with this tty device. | 3609 | * @device: a struct device that is associated with this tty device. |
2950 | * This field is optional, if there is no known struct device for this | 3610 | * This field is optional, if there is no known struct device |
2951 | * tty device it can be set to NULL safely. | 3611 | * for this tty device it can be set to NULL safely. |
2952 | * | 3612 | * |
2953 | * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). | 3613 | * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). |
2954 | * | 3614 | * |
2955 | * This call is required to be made to register an individual tty device if | 3615 | * This call is required to be made to register an individual tty device |
2956 | * the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that | 3616 | * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If |
2957 | * bit is not set, this function should not be called by a tty driver. | 3617 | * that bit is not set, this function should not be called by a tty |
3618 | * driver. | ||
3619 | * | ||
3620 | * Locking: ?? | ||
2958 | */ | 3621 | */ |
3622 | |||
2959 | struct class_device *tty_register_device(struct tty_driver *driver, | 3623 | struct class_device *tty_register_device(struct tty_driver *driver, |
2960 | unsigned index, struct device *device) | 3624 | unsigned index, struct device *device) |
2961 | { | 3625 | { |
@@ -2977,13 +3641,16 @@ struct class_device *tty_register_device(struct tty_driver *driver, | |||
2977 | } | 3641 | } |
2978 | 3642 | ||
2979 | /** | 3643 | /** |
2980 | * tty_unregister_device - unregister a tty device | 3644 | * tty_unregister_device - unregister a tty device |
2981 | * @driver: the tty driver that describes the tty device | 3645 | * @driver: the tty driver that describes the tty device |
2982 | * @index: the index in the tty driver for this tty device | 3646 | * @index: the index in the tty driver for this tty device |
2983 | * | 3647 | * |
2984 | * If a tty device is registered with a call to tty_register_device() then | 3648 | * If a tty device is registered with a call to tty_register_device() then |
2985 | * this function must be made when the tty device is gone. | 3649 | * this function must be called when the tty device is gone. |
3650 | * | ||
3651 | * Locking: ?? | ||
2986 | */ | 3652 | */ |
3653 | |||
2987 | void tty_unregister_device(struct tty_driver *driver, unsigned index) | 3654 | void tty_unregister_device(struct tty_driver *driver, unsigned index) |
2988 | { | 3655 | { |
2989 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); | 3656 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); |
@@ -3094,7 +3761,6 @@ int tty_register_driver(struct tty_driver *driver) | |||
3094 | driver->cdev.owner = driver->owner; | 3761 | driver->cdev.owner = driver->owner; |
3095 | error = cdev_add(&driver->cdev, dev, driver->num); | 3762 | error = cdev_add(&driver->cdev, dev, driver->num); |
3096 | if (error) { | 3763 | if (error) { |
3097 | cdev_del(&driver->cdev); | ||
3098 | unregister_chrdev_region(dev, driver->num); | 3764 | unregister_chrdev_region(dev, driver->num); |
3099 | driver->ttys = NULL; | 3765 | driver->ttys = NULL; |
3100 | driver->termios = driver->termios_locked = NULL; | 3766 | driver->termios = driver->termios_locked = NULL; |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index f19cf9d7792d..4ad47d321bd4 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -36,6 +36,18 @@ | |||
36 | #define TERMIOS_WAIT 2 | 36 | #define TERMIOS_WAIT 2 |
37 | #define TERMIOS_TERMIO 4 | 37 | #define TERMIOS_TERMIO 4 |
38 | 38 | ||
39 | |||
40 | /** | ||
41 | * tty_wait_until_sent - wait for I/O to finish | ||
42 | * @tty: tty we are waiting for | ||
43 | * @timeout: how long we will wait | ||
44 | * | ||
45 | * Wait for characters pending in a tty driver to hit the wire, or | ||
46 | * for a timeout to occur (eg due to flow control) | ||
47 | * | ||
48 | * Locking: none | ||
49 | */ | ||
50 | |||
39 | void tty_wait_until_sent(struct tty_struct * tty, long timeout) | 51 | void tty_wait_until_sent(struct tty_struct * tty, long timeout) |
40 | { | 52 | { |
41 | DECLARE_WAITQUEUE(wait, current); | 53 | DECLARE_WAITQUEUE(wait, current); |
@@ -94,6 +106,18 @@ static void unset_locked_termios(struct termios *termios, | |||
94 | old->c_cc[i] : termios->c_cc[i]; | 106 | old->c_cc[i] : termios->c_cc[i]; |
95 | } | 107 | } |
96 | 108 | ||
109 | /** | ||
110 | * change_termios - update termios values | ||
111 | * @tty: tty to update | ||
112 | * @new_termios: desired new value | ||
113 | * | ||
114 | * Perform updates to the termios values set on this terminal. There | ||
115 | * is a bit of layering violation here with n_tty in terms of the | ||
116 | * internal knowledge of this function. | ||
117 | * | ||
118 | * Locking: termios_sem | ||
119 | */ | ||
120 | |||
97 | static void change_termios(struct tty_struct * tty, struct termios * new_termios) | 121 | static void change_termios(struct tty_struct * tty, struct termios * new_termios) |
98 | { | 122 | { |
99 | int canon_change; | 123 | int canon_change; |
@@ -155,6 +179,19 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios | |||
155 | up(&tty->termios_sem); | 179 | up(&tty->termios_sem); |
156 | } | 180 | } |
157 | 181 | ||
182 | /** | ||
183 | * set_termios - set termios values for a tty | ||
184 | * @tty: terminal device | ||
185 | * @arg: user data | ||
186 | * @opt: option information | ||
187 | * | ||
188 | * Helper function to prepare termios data and run neccessary other | ||
189 | * functions before using change_termios to do the actual changes. | ||
190 | * | ||
191 | * Locking: | ||
192 | * Called functions take ldisc and termios_sem locks | ||
193 | */ | ||
194 | |||
158 | static int set_termios(struct tty_struct * tty, void __user *arg, int opt) | 195 | static int set_termios(struct tty_struct * tty, void __user *arg, int opt) |
159 | { | 196 | { |
160 | struct termios tmp_termios; | 197 | struct termios tmp_termios; |
@@ -284,6 +321,17 @@ static void set_sgflags(struct termios * termios, int flags) | |||
284 | } | 321 | } |
285 | } | 322 | } |
286 | 323 | ||
324 | /** | ||
325 | * set_sgttyb - set legacy terminal values | ||
326 | * @tty: tty structure | ||
327 | * @sgttyb: pointer to old style terminal structure | ||
328 | * | ||
329 | * Updates a terminal from the legacy BSD style terminal information | ||
330 | * structure. | ||
331 | * | ||
332 | * Locking: termios_sem | ||
333 | */ | ||
334 | |||
287 | static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb) | 335 | static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb) |
288 | { | 336 | { |
289 | int retval; | 337 | int retval; |
@@ -369,9 +417,16 @@ static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars) | |||
369 | } | 417 | } |
370 | #endif | 418 | #endif |
371 | 419 | ||
372 | /* | 420 | /** |
373 | * Send a high priority character to the tty. | 421 | * send_prio_char - send priority character |
422 | * | ||
423 | * Send a high priority character to the tty even if stopped | ||
424 | * | ||
425 | * Locking: none | ||
426 | * | ||
427 | * FIXME: overlapping calls with start/stop tty lose state of tty | ||
374 | */ | 428 | */ |
429 | |||
375 | static void send_prio_char(struct tty_struct *tty, char ch) | 430 | static void send_prio_char(struct tty_struct *tty, char ch) |
376 | { | 431 | { |
377 | int was_stopped = tty->stopped; | 432 | int was_stopped = tty->stopped; |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 45e9bd81bc0e..a9247b5213d5 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
@@ -465,7 +465,7 @@ vcs_open(struct inode *inode, struct file *filp) | |||
465 | return 0; | 465 | return 0; |
466 | } | 466 | } |
467 | 467 | ||
468 | static struct file_operations vcs_fops = { | 468 | static const struct file_operations vcs_fops = { |
469 | .llseek = vcs_lseek, | 469 | .llseek = vcs_lseek, |
470 | .read = vcs_read, | 470 | .read = vcs_read, |
471 | .write = vcs_write, | 471 | .write = vcs_write, |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 7d42c8ec8dbc..b72b2049aaae 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -292,7 +292,7 @@ static int proc_viotape_open(struct inode *inode, struct file *file) | |||
292 | return single_open(file, proc_viotape_show, NULL); | 292 | return single_open(file, proc_viotape_show, NULL); |
293 | } | 293 | } |
294 | 294 | ||
295 | static struct file_operations proc_viotape_operations = { | 295 | static const struct file_operations proc_viotape_operations = { |
296 | .open = proc_viotape_open, | 296 | .open = proc_viotape_open, |
297 | .read = seq_read, | 297 | .read = seq_read, |
298 | .llseek = seq_lseek, | 298 | .llseek = seq_lseek, |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 073da48c092e..8116a47b80f4 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/cpu.h> | 33 | #include <asm/cpu.h> |
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | #include <asm/vr41xx/giu.h> | 35 | #include <asm/vr41xx/giu.h> |
36 | #include <asm/vr41xx/irq.h> | ||
36 | #include <asm/vr41xx/vr41xx.h> | 37 | #include <asm/vr41xx/vr41xx.h> |
37 | 38 | ||
38 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | 39 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); |
@@ -605,7 +606,7 @@ static int gpio_release(struct inode *inode, struct file *file) | |||
605 | return 0; | 606 | return 0; |
606 | } | 607 | } |
607 | 608 | ||
608 | static struct file_operations gpio_fops = { | 609 | static const struct file_operations gpio_fops = { |
609 | .owner = THIS_MODULE, | 610 | .owner = THIS_MODULE, |
610 | .read = gpio_read, | 611 | .read = gpio_read, |
611 | .write = gpio_write, | 612 | .write = gpio_write, |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 3ef823d7d255..da7e66a2a38b 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -886,6 +886,7 @@ void vc_disallocate(unsigned int currcons) | |||
886 | if (vc_cons_allocated(currcons)) { | 886 | if (vc_cons_allocated(currcons)) { |
887 | struct vc_data *vc = vc_cons[currcons].d; | 887 | struct vc_data *vc = vc_cons[currcons].d; |
888 | vc->vc_sw->con_deinit(vc); | 888 | vc->vc_sw->con_deinit(vc); |
889 | module_put(vc->vc_sw->owner); | ||
889 | if (vc->vc_kmalloced) | 890 | if (vc->vc_kmalloced) |
890 | kfree(vc->vc_screenbuf); | 891 | kfree(vc->vc_screenbuf); |
891 | if (currcons >= MIN_NR_CONSOLES) | 892 | if (currcons >= MIN_NR_CONSOLES) |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index eccffaf26faa..a5628a8b6620 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -1011,6 +1011,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1011 | return -EPERM; | 1011 | return -EPERM; |
1012 | vt_dont_switch = 0; | 1012 | vt_dont_switch = 0; |
1013 | return 0; | 1013 | return 0; |
1014 | case VT_GETHIFONTMASK: | ||
1015 | return put_user(vc->vc_hi_font_mask, (unsigned short __user *)arg); | ||
1014 | default: | 1016 | default: |
1015 | return -ENOIOCTLCMD; | 1017 | return -ENOIOCTLCMD; |
1016 | } | 1018 | } |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index d53f664a4dd8..fff89c2d88fd 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -45,7 +45,7 @@ config WATCHDOG_NOWAYOUT | |||
45 | comment "Watchdog Device Drivers" | 45 | comment "Watchdog Device Drivers" |
46 | depends on WATCHDOG | 46 | depends on WATCHDOG |
47 | 47 | ||
48 | # Architecture Independant | 48 | # Architecture Independent |
49 | 49 | ||
50 | config SOFT_WATCHDOG | 50 | config SOFT_WATCHDOG |
51 | tristate "Software watchdog" | 51 | tristate "Software watchdog" |
@@ -127,7 +127,7 @@ config S3C2410_WATCHDOG | |||
127 | enabled. | 127 | enabled. |
128 | 128 | ||
129 | The driver is limited by the speed of the system's PCLK | 129 | The driver is limited by the speed of the system's PCLK |
130 | signal, so with reasonbaly fast systems (PCLK around 50-66MHz) | 130 | signal, so with reasonably fast systems (PCLK around 50-66MHz) |
131 | then watchdog intervals of over approximately 20seconds are | 131 | then watchdog intervals of over approximately 20seconds are |
132 | unavailable. | 132 | unavailable. |
133 | 133 | ||
@@ -423,7 +423,7 @@ config SBC_EPX_C3_WATCHDOG | |||
423 | is no way to know if writing to its IO address will corrupt | 423 | is no way to know if writing to its IO address will corrupt |
424 | your system or have any real effect. The only way to be sure | 424 | your system or have any real effect. The only way to be sure |
425 | that this driver does what you want is to make sure you | 425 | that this driver does what you want is to make sure you |
426 | are runnning it on an EPX-C3 from Winsystems with the watchdog | 426 | are running it on an EPX-C3 from Winsystems with the watchdog |
427 | timer at IO address 0x1ee and 0x1ef. It will write to both those | 427 | timer at IO address 0x1ee and 0x1ef. It will write to both those |
428 | IO ports. Basically, the assumption is made that if you compile | 428 | IO ports. Basically, the assumption is made that if you compile |
429 | this driver into your kernel and/or load it as a module, that you | 429 | this driver into your kernel and/or load it as a module, that you |
@@ -472,7 +472,7 @@ config INDYDOG | |||
472 | tristate "Indy/I2 Hardware Watchdog" | 472 | tristate "Indy/I2 Hardware Watchdog" |
473 | depends on WATCHDOG && SGI_IP22 | 473 | depends on WATCHDOG && SGI_IP22 |
474 | help | 474 | help |
475 | Hardwaredriver for the Indy's/I2's watchdog. This is a | 475 | Hardware driver for the Indy's/I2's watchdog. This is a |
476 | watchdog timer that will reboot the machine after a 60 second | 476 | watchdog timer that will reboot the machine after a 60 second |
477 | timer expired and no process has written to /dev/watchdog during | 477 | timer expired and no process has written to /dev/watchdog during |
478 | that time. | 478 | that time. |
diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c index 7289f4af93d0..c77fe3cf2852 100644 --- a/drivers/char/watchdog/acquirewdt.c +++ b/drivers/char/watchdog/acquirewdt.c | |||
@@ -231,7 +231,7 @@ static int acq_notify_sys(struct notifier_block *this, unsigned long code, | |||
231 | * Kernel Interfaces | 231 | * Kernel Interfaces |
232 | */ | 232 | */ |
233 | 233 | ||
234 | static struct file_operations acq_fops = { | 234 | static const struct file_operations acq_fops = { |
235 | .owner = THIS_MODULE, | 235 | .owner = THIS_MODULE, |
236 | .llseek = no_llseek, | 236 | .llseek = no_llseek, |
237 | .write = acq_write, | 237 | .write = acq_write, |
diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c index 194a3fd36b91..8069be445edc 100644 --- a/drivers/char/watchdog/advantechwdt.c +++ b/drivers/char/watchdog/advantechwdt.c | |||
@@ -227,7 +227,7 @@ advwdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
227 | * Kernel Interfaces | 227 | * Kernel Interfaces |
228 | */ | 228 | */ |
229 | 229 | ||
230 | static struct file_operations advwdt_fops = { | 230 | static const struct file_operations advwdt_fops = { |
231 | .owner = THIS_MODULE, | 231 | .owner = THIS_MODULE, |
232 | .llseek = no_llseek, | 232 | .llseek = no_llseek, |
233 | .write = advwdt_write, | 233 | .write = advwdt_write, |
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c index 8338ca300e2e..c5c94e4c9495 100644 --- a/drivers/char/watchdog/alim1535_wdt.c +++ b/drivers/char/watchdog/alim1535_wdt.c | |||
@@ -362,7 +362,7 @@ static int __init ali_find_watchdog(void) | |||
362 | * Kernel Interfaces | 362 | * Kernel Interfaces |
363 | */ | 363 | */ |
364 | 364 | ||
365 | static struct file_operations ali_fops = { | 365 | static const struct file_operations ali_fops = { |
366 | .owner = THIS_MODULE, | 366 | .owner = THIS_MODULE, |
367 | .llseek = no_llseek, | 367 | .llseek = no_llseek, |
368 | .write = ali_write, | 368 | .write = ali_write, |
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c index c05ac188a4d7..ffd7684f999b 100644 --- a/drivers/char/watchdog/alim7101_wdt.c +++ b/drivers/char/watchdog/alim7101_wdt.c | |||
@@ -281,7 +281,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | static struct file_operations wdt_fops = { | 284 | static const struct file_operations wdt_fops = { |
285 | .owner= THIS_MODULE, | 285 | .owner= THIS_MODULE, |
286 | .llseek= no_llseek, | 286 | .llseek= no_llseek, |
287 | .write= fop_write, | 287 | .write= fop_write, |
diff --git a/drivers/char/watchdog/at91_wdt.c b/drivers/char/watchdog/at91_wdt.c index f61dedc3c96c..cc266715ea32 100644 --- a/drivers/char/watchdog/at91_wdt.c +++ b/drivers/char/watchdog/at91_wdt.c | |||
@@ -183,7 +183,7 @@ static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, l | |||
183 | 183 | ||
184 | /* ......................................................................... */ | 184 | /* ......................................................................... */ |
185 | 185 | ||
186 | static struct file_operations at91wdt_fops = { | 186 | static const struct file_operations at91wdt_fops = { |
187 | .owner = THIS_MODULE, | 187 | .owner = THIS_MODULE, |
188 | .llseek = no_llseek, | 188 | .llseek = no_llseek, |
189 | .ioctl = at91_wdt_ioctl, | 189 | .ioctl = at91_wdt_ioctl, |
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index 537f5c6729bf..e3cefc538b40 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c | |||
@@ -145,7 +145,7 @@ static int booke_wdt_open (struct inode *inode, struct file *file) | |||
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
147 | 147 | ||
148 | static struct file_operations booke_wdt_fops = { | 148 | static const struct file_operations booke_wdt_fops = { |
149 | .owner = THIS_MODULE, | 149 | .owner = THIS_MODULE, |
150 | .llseek = no_llseek, | 150 | .llseek = no_llseek, |
151 | .write = booke_wdt_write, | 151 | .write = booke_wdt_write, |
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index 3e8410b5a65e..04c7e49918db 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c | |||
@@ -198,7 +198,7 @@ static ssize_t cpu5wdt_write(struct file *file, const char __user *buf, size_t c | |||
198 | return count; | 198 | return count; |
199 | } | 199 | } |
200 | 200 | ||
201 | static struct file_operations cpu5wdt_fops = { | 201 | static const struct file_operations cpu5wdt_fops = { |
202 | .owner = THIS_MODULE, | 202 | .owner = THIS_MODULE, |
203 | .llseek = no_llseek, | 203 | .llseek = no_llseek, |
204 | .ioctl = cpu5wdt_ioctl, | 204 | .ioctl = cpu5wdt_ioctl, |
diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/char/watchdog/ep93xx_wdt.c index 9021dbb78299..77c8a955ae9e 100644 --- a/drivers/char/watchdog/ep93xx_wdt.c +++ b/drivers/char/watchdog/ep93xx_wdt.c | |||
@@ -187,7 +187,7 @@ static int ep93xx_wdt_release(struct inode *inode, struct file *file) | |||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static struct file_operations ep93xx_wdt_fops = { | 190 | static const struct file_operations ep93xx_wdt_fops = { |
191 | .owner = THIS_MODULE, | 191 | .owner = THIS_MODULE, |
192 | .write = ep93xx_wdt_write, | 192 | .write = ep93xx_wdt_write, |
193 | .ioctl = ep93xx_wdt_ioctl, | 193 | .ioctl = ep93xx_wdt_ioctl, |
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c index ea670de4fab7..62dbccb2f6df 100644 --- a/drivers/char/watchdog/eurotechwdt.c +++ b/drivers/char/watchdog/eurotechwdt.c | |||
@@ -356,7 +356,7 @@ static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
356 | */ | 356 | */ |
357 | 357 | ||
358 | 358 | ||
359 | static struct file_operations eurwdt_fops = { | 359 | static const struct file_operations eurwdt_fops = { |
360 | .owner = THIS_MODULE, | 360 | .owner = THIS_MODULE, |
361 | .llseek = no_llseek, | 361 | .llseek = no_llseek, |
362 | .write = eurwdt_write, | 362 | .write = eurwdt_write, |
diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c index 93785f13242e..870539eabbf3 100644 --- a/drivers/char/watchdog/i6300esb.c +++ b/drivers/char/watchdog/i6300esb.c | |||
@@ -337,7 +337,7 @@ static int esb_notify_sys (struct notifier_block *this, unsigned long code, void | |||
337 | * Kernel Interfaces | 337 | * Kernel Interfaces |
338 | */ | 338 | */ |
339 | 339 | ||
340 | static struct file_operations esb_fops = { | 340 | static const struct file_operations esb_fops = { |
341 | .owner = THIS_MODULE, | 341 | .owner = THIS_MODULE, |
342 | .llseek = no_llseek, | 342 | .llseek = no_llseek, |
343 | .write = esb_write, | 343 | .write = esb_write, |
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index bfbdbbf3c2f2..8385dd36eefe 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c | |||
@@ -378,7 +378,7 @@ static int i8xx_tco_notify_sys (struct notifier_block *this, unsigned long code, | |||
378 | * Kernel Interfaces | 378 | * Kernel Interfaces |
379 | */ | 379 | */ |
380 | 380 | ||
381 | static struct file_operations i8xx_tco_fops = { | 381 | static const struct file_operations i8xx_tco_fops = { |
382 | .owner = THIS_MODULE, | 382 | .owner = THIS_MODULE, |
383 | .llseek = no_llseek, | 383 | .llseek = no_llseek, |
384 | .write = i8xx_tco_write, | 384 | .write = i8xx_tco_write, |
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c index a2e53c715b36..fd95f7327798 100644 --- a/drivers/char/watchdog/ib700wdt.c +++ b/drivers/char/watchdog/ib700wdt.c | |||
@@ -255,7 +255,7 @@ ibwdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
255 | * Kernel Interfaces | 255 | * Kernel Interfaces |
256 | */ | 256 | */ |
257 | 257 | ||
258 | static struct file_operations ibwdt_fops = { | 258 | static const struct file_operations ibwdt_fops = { |
259 | .owner = THIS_MODULE, | 259 | .owner = THIS_MODULE, |
260 | .llseek = no_llseek, | 260 | .llseek = no_llseek, |
261 | .write = ibwdt_write, | 261 | .write = ibwdt_write, |
diff --git a/drivers/char/watchdog/ibmasr.c b/drivers/char/watchdog/ibmasr.c index b0741cbdc139..26ceee7a4df0 100644 --- a/drivers/char/watchdog/ibmasr.c +++ b/drivers/char/watchdog/ibmasr.c | |||
@@ -322,7 +322,7 @@ static int asr_release(struct inode *inode, struct file *file) | |||
322 | return 0; | 322 | return 0; |
323 | } | 323 | } |
324 | 324 | ||
325 | static struct file_operations asr_fops = { | 325 | static const struct file_operations asr_fops = { |
326 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
327 | .llseek = no_llseek, | 327 | .llseek = no_llseek, |
328 | .write = asr_write, | 328 | .write = asr_write, |
diff --git a/drivers/char/watchdog/indydog.c b/drivers/char/watchdog/indydog.c index d387979b2434..dacc1c20a310 100644 --- a/drivers/char/watchdog/indydog.c +++ b/drivers/char/watchdog/indydog.c | |||
@@ -154,7 +154,7 @@ static int indydog_notify_sys(struct notifier_block *this, unsigned long code, v | |||
154 | return NOTIFY_DONE; | 154 | return NOTIFY_DONE; |
155 | } | 155 | } |
156 | 156 | ||
157 | static struct file_operations indydog_fops = { | 157 | static const struct file_operations indydog_fops = { |
158 | .owner = THIS_MODULE, | 158 | .owner = THIS_MODULE, |
159 | .llseek = no_llseek, | 159 | .llseek = no_llseek, |
160 | .write = indydog_write, | 160 | .write = indydog_write, |
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c index aa29a7d68759..692908819e26 100644 --- a/drivers/char/watchdog/ixp2000_wdt.c +++ b/drivers/char/watchdog/ixp2000_wdt.c | |||
@@ -168,7 +168,7 @@ ixp2000_wdt_release(struct inode *inode, struct file *file) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | static struct file_operations ixp2000_wdt_fops = | 171 | static const struct file_operations ixp2000_wdt_fops = |
172 | { | 172 | { |
173 | .owner = THIS_MODULE, | 173 | .owner = THIS_MODULE, |
174 | .llseek = no_llseek, | 174 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c index e6a3fe83fa01..9db5cf2c38c3 100644 --- a/drivers/char/watchdog/ixp4xx_wdt.c +++ b/drivers/char/watchdog/ixp4xx_wdt.c | |||
@@ -162,7 +162,7 @@ ixp4xx_wdt_release(struct inode *inode, struct file *file) | |||
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | static struct file_operations ixp4xx_wdt_fops = | 165 | static const struct file_operations ixp4xx_wdt_fops = |
166 | { | 166 | { |
167 | .owner = THIS_MODULE, | 167 | .owner = THIS_MODULE, |
168 | .llseek = no_llseek, | 168 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index b67b4878ae0f..23734e07fb22 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c | |||
@@ -388,7 +388,7 @@ static int zf_notify_sys(struct notifier_block *this, unsigned long code, | |||
388 | 388 | ||
389 | 389 | ||
390 | 390 | ||
391 | static struct file_operations zf_fops = { | 391 | static const struct file_operations zf_fops = { |
392 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
393 | .llseek = no_llseek, | 393 | .llseek = no_llseek, |
394 | .write = zf_write, | 394 | .write = zf_write, |
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index 433c27f98159..ae943324d251 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c | |||
@@ -190,7 +190,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, | |||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | 192 | ||
193 | static struct file_operations mixcomwd_fops= | 193 | static const struct file_operations mixcomwd_fops= |
194 | { | 194 | { |
195 | .owner = THIS_MODULE, | 195 | .owner = THIS_MODULE, |
196 | .llseek = no_llseek, | 196 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c index dac1381af364..a480903ee1a5 100644 --- a/drivers/char/watchdog/mpc83xx_wdt.c +++ b/drivers/char/watchdog/mpc83xx_wdt.c | |||
@@ -129,7 +129,7 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file, | |||
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | static struct file_operations mpc83xx_wdt_fops = { | 132 | static const struct file_operations mpc83xx_wdt_fops = { |
133 | .owner = THIS_MODULE, | 133 | .owner = THIS_MODULE, |
134 | .llseek = no_llseek, | 134 | .llseek = no_llseek, |
135 | .write = mpc83xx_wdt_write, | 135 | .write = mpc83xx_wdt_write, |
diff --git a/drivers/char/watchdog/mpc8xx_wdt.c b/drivers/char/watchdog/mpc8xx_wdt.c index 11f0ccd4c4d4..35dd9e6e1140 100644 --- a/drivers/char/watchdog/mpc8xx_wdt.c +++ b/drivers/char/watchdog/mpc8xx_wdt.c | |||
@@ -132,7 +132,7 @@ static int mpc8xx_wdt_ioctl(struct inode *inode, struct file *file, | |||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | static struct file_operations mpc8xx_wdt_fops = { | 135 | static const struct file_operations mpc8xx_wdt_fops = { |
136 | .owner = THIS_MODULE, | 136 | .owner = THIS_MODULE, |
137 | .llseek = no_llseek, | 137 | .llseek = no_llseek, |
138 | .write = mpc8xx_wdt_write, | 138 | .write = mpc8xx_wdt_write, |
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index c2d492c852fc..54b3c56ead0d 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -297,7 +297,7 @@ static void mpcore_wdt_shutdown(struct platform_device *dev) | |||
297 | /* | 297 | /* |
298 | * Kernel Interfaces | 298 | * Kernel Interfaces |
299 | */ | 299 | */ |
300 | static struct file_operations mpcore_wdt_fops = { | 300 | static const struct file_operations mpcore_wdt_fops = { |
301 | .owner = THIS_MODULE, | 301 | .owner = THIS_MODULE, |
302 | .llseek = no_llseek, | 302 | .llseek = no_llseek, |
303 | .write = mpcore_wdt_write, | 303 | .write = mpcore_wdt_write, |
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index 20a6cbb0fbb8..5c8fab345b40 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -166,7 +166,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | static struct file_operations mv64x60_wdt_fops = { | 169 | static const struct file_operations mv64x60_wdt_fops = { |
170 | .owner = THIS_MODULE, | 170 | .owner = THIS_MODULE, |
171 | .llseek = no_llseek, | 171 | .llseek = no_llseek, |
172 | .write = mv64x60_wdt_write, | 172 | .write = mv64x60_wdt_write, |
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index 6d44ca68312d..cd7d1b6a5d9f 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c | |||
@@ -740,7 +740,7 @@ static int pcwd_notify_sys(struct notifier_block *this, unsigned long code, void | |||
740 | * Kernel Interfaces | 740 | * Kernel Interfaces |
741 | */ | 741 | */ |
742 | 742 | ||
743 | static struct file_operations pcwd_fops = { | 743 | static const struct file_operations pcwd_fops = { |
744 | .owner = THIS_MODULE, | 744 | .owner = THIS_MODULE, |
745 | .llseek = no_llseek, | 745 | .llseek = no_llseek, |
746 | .write = pcwd_write, | 746 | .write = pcwd_write, |
@@ -755,7 +755,7 @@ static struct miscdevice pcwd_miscdev = { | |||
755 | .fops = &pcwd_fops, | 755 | .fops = &pcwd_fops, |
756 | }; | 756 | }; |
757 | 757 | ||
758 | static struct file_operations pcwd_temp_fops = { | 758 | static const struct file_operations pcwd_temp_fops = { |
759 | .owner = THIS_MODULE, | 759 | .owner = THIS_MODULE, |
760 | .llseek = no_llseek, | 760 | .llseek = no_llseek, |
761 | .read = pcwd_temp_read, | 761 | .read = pcwd_temp_read, |
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 1f40ecefbf72..c7cfd6dbfe1b 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -625,7 +625,7 @@ static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, v | |||
625 | * Kernel Interfaces | 625 | * Kernel Interfaces |
626 | */ | 626 | */ |
627 | 627 | ||
628 | static struct file_operations pcipcwd_fops = { | 628 | static const struct file_operations pcipcwd_fops = { |
629 | .owner = THIS_MODULE, | 629 | .owner = THIS_MODULE, |
630 | .llseek = no_llseek, | 630 | .llseek = no_llseek, |
631 | .write = pcipcwd_write, | 631 | .write = pcipcwd_write, |
@@ -640,7 +640,7 @@ static struct miscdevice pcipcwd_miscdev = { | |||
640 | .fops = &pcipcwd_fops, | 640 | .fops = &pcipcwd_fops, |
641 | }; | 641 | }; |
642 | 642 | ||
643 | static struct file_operations pcipcwd_temp_fops = { | 643 | static const struct file_operations pcipcwd_temp_fops = { |
644 | .owner = THIS_MODULE, | 644 | .owner = THIS_MODULE, |
645 | .llseek = no_llseek, | 645 | .llseek = no_llseek, |
646 | .read = pcipcwd_temp_read, | 646 | .read = pcipcwd_temp_read, |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 92bf8c1a0f0d..b7ae73dcdd08 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -523,7 +523,7 @@ static int usb_pcwd_notify_sys(struct notifier_block *this, unsigned long code, | |||
523 | * Kernel Interfaces | 523 | * Kernel Interfaces |
524 | */ | 524 | */ |
525 | 525 | ||
526 | static struct file_operations usb_pcwd_fops = { | 526 | static const struct file_operations usb_pcwd_fops = { |
527 | .owner = THIS_MODULE, | 527 | .owner = THIS_MODULE, |
528 | .llseek = no_llseek, | 528 | .llseek = no_llseek, |
529 | .write = usb_pcwd_write, | 529 | .write = usb_pcwd_write, |
@@ -538,7 +538,7 @@ static struct miscdevice usb_pcwd_miscdev = { | |||
538 | .fops = &usb_pcwd_fops, | 538 | .fops = &usb_pcwd_fops, |
539 | }; | 539 | }; |
540 | 540 | ||
541 | static struct file_operations usb_pcwd_temperature_fops = { | 541 | static const struct file_operations usb_pcwd_temperature_fops = { |
542 | .owner = THIS_MODULE, | 542 | .owner = THIS_MODULE, |
543 | .llseek = no_llseek, | 543 | .llseek = no_llseek, |
544 | .read = usb_pcwd_temperature_read, | 544 | .read = usb_pcwd_temperature_read, |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index f267dad26071..be978e8ed754 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -319,7 +319,7 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file, | |||
319 | 319 | ||
320 | /* kernel interface */ | 320 | /* kernel interface */ |
321 | 321 | ||
322 | static struct file_operations s3c2410wdt_fops = { | 322 | static const struct file_operations s3c2410wdt_fops = { |
323 | .owner = THIS_MODULE, | 323 | .owner = THIS_MODULE, |
324 | .llseek = no_llseek, | 324 | .llseek = no_llseek, |
325 | .write = s3c2410wdt_write, | 325 | .write = s3c2410wdt_write, |
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index b22e95c5470c..1fc16d995788 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c | |||
@@ -135,7 +135,7 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
135 | return ret; | 135 | return ret; |
136 | } | 136 | } |
137 | 137 | ||
138 | static struct file_operations sa1100dog_fops = | 138 | static const struct file_operations sa1100dog_fops = |
139 | { | 139 | { |
140 | .owner = THIS_MODULE, | 140 | .owner = THIS_MODULE, |
141 | .llseek = no_llseek, | 141 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c index ed0bd55fbfc1..4663c2fd53cd 100644 --- a/drivers/char/watchdog/sbc60xxwdt.c +++ b/drivers/char/watchdog/sbc60xxwdt.c | |||
@@ -282,7 +282,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | static struct file_operations wdt_fops = { | 285 | static const struct file_operations wdt_fops = { |
286 | .owner = THIS_MODULE, | 286 | .owner = THIS_MODULE, |
287 | .llseek = no_llseek, | 287 | .llseek = no_llseek, |
288 | .write = fop_write, | 288 | .write = fop_write, |
diff --git a/drivers/char/watchdog/sbc8360.c b/drivers/char/watchdog/sbc8360.c index 6562aa910ace..41fc6f80c493 100644 --- a/drivers/char/watchdog/sbc8360.c +++ b/drivers/char/watchdog/sbc8360.c | |||
@@ -200,7 +200,7 @@ static int wd_margin = 0xB; | |||
200 | static int wd_multiplier = 2; | 200 | static int wd_multiplier = 2; |
201 | static int nowayout = WATCHDOG_NOWAYOUT; | 201 | static int nowayout = WATCHDOG_NOWAYOUT; |
202 | 202 | ||
203 | module_param(timeout, int, 27); | 203 | module_param(timeout, int, 0); |
204 | MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))"); | 204 | MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))"); |
205 | module_param(nowayout, int, 0); | 205 | module_param(nowayout, int, 0); |
206 | MODULE_PARM_DESC(nowayout, | 206 | MODULE_PARM_DESC(nowayout, |
@@ -305,7 +305,7 @@ static int sbc8360_notify_sys(struct notifier_block *this, unsigned long code, | |||
305 | * Kernel Interfaces | 305 | * Kernel Interfaces |
306 | */ | 306 | */ |
307 | 307 | ||
308 | static struct file_operations sbc8360_fops = { | 308 | static const struct file_operations sbc8360_fops = { |
309 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
310 | .llseek = no_llseek, | 310 | .llseek = no_llseek, |
311 | .write = sbc8360_write, | 311 | .write = sbc8360_write, |
@@ -407,7 +407,7 @@ module_exit(sbc8360_exit); | |||
407 | MODULE_AUTHOR("Ian E. Morgan <imorgan@webcon.ca>"); | 407 | MODULE_AUTHOR("Ian E. Morgan <imorgan@webcon.ca>"); |
408 | MODULE_DESCRIPTION("SBC8360 watchdog driver"); | 408 | MODULE_DESCRIPTION("SBC8360 watchdog driver"); |
409 | MODULE_LICENSE("GPL"); | 409 | MODULE_LICENSE("GPL"); |
410 | MODULE_VERSION("1.0"); | 410 | MODULE_VERSION("1.01"); |
411 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 411 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
412 | 412 | ||
413 | /* end of sbc8360.c */ | 413 | /* end of sbc8360.c */ |
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c index 09867fadc720..bfc475dabe6d 100644 --- a/drivers/char/watchdog/sbc_epx_c3.c +++ b/drivers/char/watchdog/sbc_epx_c3.c | |||
@@ -154,7 +154,7 @@ static int epx_c3_notify_sys(struct notifier_block *this, unsigned long code, | |||
154 | return NOTIFY_DONE; | 154 | return NOTIFY_DONE; |
155 | } | 155 | } |
156 | 156 | ||
157 | static struct file_operations epx_c3_fops = { | 157 | static const struct file_operations epx_c3_fops = { |
158 | .owner = THIS_MODULE, | 158 | .owner = THIS_MODULE, |
159 | .llseek = no_llseek, | 159 | .llseek = no_llseek, |
160 | .write = epx_c3_write, | 160 | .write = epx_c3_write, |
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index 78ef6333c181..7c3cf293a5af 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c | |||
@@ -292,7 +292,7 @@ static struct notifier_block sc1200wdt_notifier = | |||
292 | .notifier_call = sc1200wdt_notify_sys, | 292 | .notifier_call = sc1200wdt_notify_sys, |
293 | }; | 293 | }; |
294 | 294 | ||
295 | static struct file_operations sc1200wdt_fops = | 295 | static const struct file_operations sc1200wdt_fops = |
296 | { | 296 | { |
297 | .owner = THIS_MODULE, | 297 | .owner = THIS_MODULE, |
298 | .llseek = no_llseek, | 298 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c index 4ee9974ad8cb..2c7c9db71be8 100644 --- a/drivers/char/watchdog/sc520_wdt.c +++ b/drivers/char/watchdog/sc520_wdt.c | |||
@@ -336,7 +336,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | static struct file_operations wdt_fops = { | 339 | static const struct file_operations wdt_fops = { |
340 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
341 | .llseek = no_llseek, | 341 | .llseek = no_llseek, |
342 | .write = fop_write, | 342 | .write = fop_write, |
diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c index c0b4754e8de0..c561299a5537 100644 --- a/drivers/char/watchdog/scx200_wdt.c +++ b/drivers/char/watchdog/scx200_wdt.c | |||
@@ -194,7 +194,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file, | |||
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | static struct file_operations scx200_wdt_fops = { | 197 | static const struct file_operations scx200_wdt_fops = { |
198 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
199 | .llseek = no_llseek, | 199 | .llseek = no_llseek, |
200 | .write = scx200_wdt_write, | 200 | .write = scx200_wdt_write, |
diff --git a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c index 803701b675c0..1355038f1044 100644 --- a/drivers/char/watchdog/shwdt.c +++ b/drivers/char/watchdog/shwdt.c | |||
@@ -344,7 +344,7 @@ static int sh_wdt_notify_sys(struct notifier_block *this, | |||
344 | return NOTIFY_DONE; | 344 | return NOTIFY_DONE; |
345 | } | 345 | } |
346 | 346 | ||
347 | static struct file_operations sh_wdt_fops = { | 347 | static const struct file_operations sh_wdt_fops = { |
348 | .owner = THIS_MODULE, | 348 | .owner = THIS_MODULE, |
349 | .llseek = no_llseek, | 349 | .llseek = no_llseek, |
350 | .write = sh_wdt_write, | 350 | .write = sh_wdt_write, |
diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index 79ce5c655428..ef8da517545a 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c | |||
@@ -243,7 +243,7 @@ static int softdog_notify_sys(struct notifier_block *this, unsigned long code, | |||
243 | * Kernel Interfaces | 243 | * Kernel Interfaces |
244 | */ | 244 | */ |
245 | 245 | ||
246 | static struct file_operations softdog_fops = { | 246 | static const struct file_operations softdog_fops = { |
247 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
248 | .llseek = no_llseek, | 248 | .llseek = no_llseek, |
249 | .write = softdog_write, | 249 | .write = softdog_write, |
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c index d15ca9a3986f..13f16d41c2fd 100644 --- a/drivers/char/watchdog/w83627hf_wdt.c +++ b/drivers/char/watchdog/w83627hf_wdt.c | |||
@@ -274,7 +274,7 @@ wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
274 | * Kernel Interfaces | 274 | * Kernel Interfaces |
275 | */ | 275 | */ |
276 | 276 | ||
277 | static struct file_operations wdt_fops = { | 277 | static const struct file_operations wdt_fops = { |
278 | .owner = THIS_MODULE, | 278 | .owner = THIS_MODULE, |
279 | .llseek = no_llseek, | 279 | .llseek = no_llseek, |
280 | .write = wdt_write, | 280 | .write = wdt_write, |
diff --git a/drivers/char/watchdog/w83877f_wdt.c b/drivers/char/watchdog/w83877f_wdt.c index 52a8bd0a5988..ccf6c0915945 100644 --- a/drivers/char/watchdog/w83877f_wdt.c +++ b/drivers/char/watchdog/w83877f_wdt.c | |||
@@ -299,7 +299,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | static struct file_operations wdt_fops = { | 302 | static const struct file_operations wdt_fops = { |
303 | .owner = THIS_MODULE, | 303 | .owner = THIS_MODULE, |
304 | .llseek = no_llseek, | 304 | .llseek = no_llseek, |
305 | .write = fop_write, | 305 | .write = fop_write, |
diff --git a/drivers/char/watchdog/w83977f_wdt.c b/drivers/char/watchdog/w83977f_wdt.c index c31849e4c5c2..98f4e17db70a 100644 --- a/drivers/char/watchdog/w83977f_wdt.c +++ b/drivers/char/watchdog/w83977f_wdt.c | |||
@@ -449,7 +449,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
449 | return NOTIFY_DONE; | 449 | return NOTIFY_DONE; |
450 | } | 450 | } |
451 | 451 | ||
452 | static struct file_operations wdt_fops= | 452 | static const struct file_operations wdt_fops= |
453 | { | 453 | { |
454 | .owner = THIS_MODULE, | 454 | .owner = THIS_MODULE, |
455 | .llseek = no_llseek, | 455 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c index 7cf6c9bbf486..2bb6a9d6ad28 100644 --- a/drivers/char/watchdog/wafer5823wdt.c +++ b/drivers/char/watchdog/wafer5823wdt.c | |||
@@ -222,7 +222,7 @@ static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code, vo | |||
222 | * Kernel Interfaces | 222 | * Kernel Interfaces |
223 | */ | 223 | */ |
224 | 224 | ||
225 | static struct file_operations wafwdt_fops = { | 225 | static const struct file_operations wafwdt_fops = { |
226 | .owner = THIS_MODULE, | 226 | .owner = THIS_MODULE, |
227 | .llseek = no_llseek, | 227 | .llseek = no_llseek, |
228 | .write = wafwdt_write, | 228 | .write = wafwdt_write, |
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c index 3a462c34b92a..5c38cdf41731 100644 --- a/drivers/char/watchdog/wdrtas.c +++ b/drivers/char/watchdog/wdrtas.c | |||
@@ -520,7 +520,7 @@ wdrtas_reboot(struct notifier_block *this, unsigned long code, void *ptr) | |||
520 | 520 | ||
521 | /*** initialization stuff */ | 521 | /*** initialization stuff */ |
522 | 522 | ||
523 | static struct file_operations wdrtas_fops = { | 523 | static const struct file_operations wdrtas_fops = { |
524 | .owner = THIS_MODULE, | 524 | .owner = THIS_MODULE, |
525 | .llseek = no_llseek, | 525 | .llseek = no_llseek, |
526 | .write = wdrtas_write, | 526 | .write = wdrtas_write, |
@@ -535,7 +535,7 @@ static struct miscdevice wdrtas_miscdev = { | |||
535 | .fops = &wdrtas_fops, | 535 | .fops = &wdrtas_fops, |
536 | }; | 536 | }; |
537 | 537 | ||
538 | static struct file_operations wdrtas_temp_fops = { | 538 | static const struct file_operations wdrtas_temp_fops = { |
539 | .owner = THIS_MODULE, | 539 | .owner = THIS_MODULE, |
540 | .llseek = no_llseek, | 540 | .llseek = no_llseek, |
541 | .read = wdrtas_temp_read, | 541 | .read = wdrtas_temp_read, |
diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index a1d972c8f44c..70be81e39a61 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c | |||
@@ -494,7 +494,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
494 | */ | 494 | */ |
495 | 495 | ||
496 | 496 | ||
497 | static struct file_operations wdt_fops = { | 497 | static const struct file_operations wdt_fops = { |
498 | .owner = THIS_MODULE, | 498 | .owner = THIS_MODULE, |
499 | .llseek = no_llseek, | 499 | .llseek = no_llseek, |
500 | .write = wdt_write, | 500 | .write = wdt_write, |
@@ -510,7 +510,7 @@ static struct miscdevice wdt_miscdev = { | |||
510 | }; | 510 | }; |
511 | 511 | ||
512 | #ifdef CONFIG_WDT_501 | 512 | #ifdef CONFIG_WDT_501 |
513 | static struct file_operations wdt_temp_fops = { | 513 | static const struct file_operations wdt_temp_fops = { |
514 | .owner = THIS_MODULE, | 514 | .owner = THIS_MODULE, |
515 | .llseek = no_llseek, | 515 | .llseek = no_llseek, |
516 | .read = wdt_temp_read, | 516 | .read = wdt_temp_read, |
diff --git a/drivers/char/watchdog/wdt285.c b/drivers/char/watchdog/wdt285.c index 52825a1f1779..6555fb844f23 100644 --- a/drivers/char/watchdog/wdt285.c +++ b/drivers/char/watchdog/wdt285.c | |||
@@ -178,7 +178,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | 180 | ||
181 | static struct file_operations watchdog_fops = { | 181 | static const struct file_operations watchdog_fops = { |
182 | .owner = THIS_MODULE, | 182 | .owner = THIS_MODULE, |
183 | .llseek = no_llseek, | 183 | .llseek = no_llseek, |
184 | .write = watchdog_write, | 184 | .write = watchdog_write, |
diff --git a/drivers/char/watchdog/wdt977.c b/drivers/char/watchdog/wdt977.c index 3cde2b9bb763..a0935bc775f8 100644 --- a/drivers/char/watchdog/wdt977.c +++ b/drivers/char/watchdog/wdt977.c | |||
@@ -418,7 +418,7 @@ static int wdt977_notify_sys(struct notifier_block *this, unsigned long code, | |||
418 | return NOTIFY_DONE; | 418 | return NOTIFY_DONE; |
419 | } | 419 | } |
420 | 420 | ||
421 | static struct file_operations wdt977_fops= | 421 | static const struct file_operations wdt977_fops= |
422 | { | 422 | { |
423 | .owner = THIS_MODULE, | 423 | .owner = THIS_MODULE, |
424 | .llseek = no_llseek, | 424 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index 7529ecdbabae..5918ca2c9c35 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c | |||
@@ -543,7 +543,7 @@ static int wdtpci_notify_sys(struct notifier_block *this, unsigned long code, | |||
543 | */ | 543 | */ |
544 | 544 | ||
545 | 545 | ||
546 | static struct file_operations wdtpci_fops = { | 546 | static const struct file_operations wdtpci_fops = { |
547 | .owner = THIS_MODULE, | 547 | .owner = THIS_MODULE, |
548 | .llseek = no_llseek, | 548 | .llseek = no_llseek, |
549 | .write = wdtpci_write, | 549 | .write = wdtpci_write, |
@@ -559,7 +559,7 @@ static struct miscdevice wdtpci_miscdev = { | |||
559 | }; | 559 | }; |
560 | 560 | ||
561 | #ifdef CONFIG_WDT_501_PCI | 561 | #ifdef CONFIG_WDT_501_PCI |
562 | static struct file_operations wdtpci_temp_fops = { | 562 | static const struct file_operations wdtpci_temp_fops = { |
563 | .owner = THIS_MODULE, | 563 | .owner = THIS_MODULE, |
564 | .llseek = no_llseek, | 564 | .llseek = no_llseek, |
565 | .read = wdtpci_temp_read, | 565 | .read = wdtpci_temp_read, |