diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/agp/agp.h | 2 | ||||
-rw-r--r-- | drivers/char/agp/amd-k7-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/generic.c | 19 | ||||
-rw-r--r-- | drivers/char/agp/sworks-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/via-agp.c | 2 | ||||
-rw-r--r-- | drivers/char/bsr.c | 2 | ||||
-rw-r--r-- | drivers/char/hpet.c | 6 | ||||
-rw-r--r-- | drivers/char/hw_random/n2-drv.c | 7 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_poweroff.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 11 | ||||
-rw-r--r-- | drivers/char/mbcs.h | 4 | ||||
-rw-r--r-- | drivers/char/mem.c | 42 | ||||
-rw-r--r-- | drivers/char/mwave/3780i.h | 2 | ||||
-rw-r--r-- | drivers/char/nwbutton.c | 2 | ||||
-rw-r--r-- | drivers/char/pcmcia/cm4000_cs.c | 2 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 4 | ||||
-rw-r--r-- | drivers/char/random.c | 2 | ||||
-rw-r--r-- | drivers/char/raw.c | 34 | ||||
-rw-r--r-- | drivers/char/sonypi.c | 4 | ||||
-rw-r--r-- | drivers/char/tpm/tpm.c | 2 | ||||
-rw-r--r-- | drivers/char/virtio_console.c | 11 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.c | 16 |
23 files changed, 110 insertions, 72 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index ad59b4e0a9b5..49502bc5360a 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -523,7 +523,7 @@ config RAW_DRIVER | |||
523 | with the O_DIRECT flag. | 523 | with the O_DIRECT flag. |
524 | 524 | ||
525 | config MAX_RAW_DEVS | 525 | config MAX_RAW_DEVS |
526 | int "Maximum number of RAW devices to support (1-8192)" | 526 | int "Maximum number of RAW devices to support (1-65536)" |
527 | depends on RAW_DRIVER | 527 | depends on RAW_DRIVER |
528 | default "256" | 528 | default "256" |
529 | help | 529 | help |
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index 3e67ddde9e16..923f99df4f1c 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
@@ -237,7 +237,7 @@ extern int agp_try_unsupported_boot; | |||
237 | 237 | ||
238 | long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 238 | long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
239 | 239 | ||
240 | /* Chipset independant registers (from AGP Spec) */ | 240 | /* Chipset independent registers (from AGP Spec) */ |
241 | #define AGP_APBASE 0x10 | 241 | #define AGP_APBASE 0x10 |
242 | 242 | ||
243 | #define AGPSTAT 0x4 | 243 | #define AGPSTAT 0x4 |
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index 45681c0ff3b6..f7e88787af97 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -272,7 +272,7 @@ static void amd_irongate_cleanup(void) | |||
272 | * This routine could be implemented by taking the addresses | 272 | * This routine could be implemented by taking the addresses |
273 | * written to the GATT, and flushing them individually. However | 273 | * written to the GATT, and flushing them individually. However |
274 | * currently it just flushes the whole table. Which is probably | 274 | * currently it just flushes the whole table. Which is probably |
275 | * more efficent, since agp_memory blocks can be a large number of | 275 | * more efficient, since agp_memory blocks can be a large number of |
276 | * entries. | 276 | * entries. |
277 | */ | 277 | */ |
278 | 278 | ||
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 012cba0d6d96..b072648dc3f6 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -115,6 +115,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) | |||
115 | struct agp_memory *new; | 115 | struct agp_memory *new; |
116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); | 116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); |
117 | 117 | ||
118 | if (INT_MAX/sizeof(struct page *) < num_agp_pages) | ||
119 | return NULL; | ||
120 | |||
118 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); | 121 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); |
119 | if (new == NULL) | 122 | if (new == NULL) |
120 | return NULL; | 123 | return NULL; |
@@ -234,11 +237,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, | |||
234 | int scratch_pages; | 237 | int scratch_pages; |
235 | struct agp_memory *new; | 238 | struct agp_memory *new; |
236 | size_t i; | 239 | size_t i; |
240 | int cur_memory; | ||
237 | 241 | ||
238 | if (!bridge) | 242 | if (!bridge) |
239 | return NULL; | 243 | return NULL; |
240 | 244 | ||
241 | if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp) | 245 | cur_memory = atomic_read(&bridge->current_memory_agp); |
246 | if ((cur_memory + page_count > bridge->max_memory_agp) || | ||
247 | (cur_memory + page_count < page_count)) | ||
242 | return NULL; | 248 | return NULL; |
243 | 249 | ||
244 | if (type >= AGP_USER_TYPES) { | 250 | if (type >= AGP_USER_TYPES) { |
@@ -1089,8 +1095,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) | |||
1089 | return -EINVAL; | 1095 | return -EINVAL; |
1090 | } | 1096 | } |
1091 | 1097 | ||
1092 | /* AK: could wrap */ | 1098 | if (((pg_start + mem->page_count) > num_entries) || |
1093 | if ((pg_start + mem->page_count) > num_entries) | 1099 | ((pg_start + mem->page_count) < pg_start)) |
1094 | return -EINVAL; | 1100 | return -EINVAL; |
1095 | 1101 | ||
1096 | j = pg_start; | 1102 | j = pg_start; |
@@ -1124,7 +1130,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
1124 | { | 1130 | { |
1125 | size_t i; | 1131 | size_t i; |
1126 | struct agp_bridge_data *bridge; | 1132 | struct agp_bridge_data *bridge; |
1127 | int mask_type; | 1133 | int mask_type, num_entries; |
1128 | 1134 | ||
1129 | bridge = mem->bridge; | 1135 | bridge = mem->bridge; |
1130 | if (!bridge) | 1136 | if (!bridge) |
@@ -1136,6 +1142,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
1136 | if (type != mem->type) | 1142 | if (type != mem->type) |
1137 | return -EINVAL; | 1143 | return -EINVAL; |
1138 | 1144 | ||
1145 | num_entries = agp_num_entries(); | ||
1146 | if (((pg_start + mem->page_count) > num_entries) || | ||
1147 | ((pg_start + mem->page_count) < pg_start)) | ||
1148 | return -EINVAL; | ||
1149 | |||
1139 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); | 1150 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); |
1140 | if (mask_type != 0) { | 1151 | if (mask_type != 0) { |
1141 | /* The generic routines know nothing of memory types */ | 1152 | /* The generic routines know nothing of memory types */ |
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index 13acaaf64edb..f02f9b07fd4c 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -229,7 +229,7 @@ static int serverworks_fetch_size(void) | |||
229 | * This routine could be implemented by taking the addresses | 229 | * This routine could be implemented by taking the addresses |
230 | * written to the GATT, and flushing them individually. However | 230 | * written to the GATT, and flushing them individually. However |
231 | * currently it just flushes the whole table. Which is probably | 231 | * currently it just flushes the whole table. Which is probably |
232 | * more efficent, since agp_memory blocks can be a large number of | 232 | * more efficient, since agp_memory blocks can be a large number of |
233 | * entries. | 233 | * entries. |
234 | */ | 234 | */ |
235 | static void serverworks_tlbflush(struct agp_memory *temp) | 235 | static void serverworks_tlbflush(struct agp_memory *temp) |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index df67e80019d2..8bc384937401 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -400,7 +400,7 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = | |||
400 | * the traditional AGP which resides only in chipset. AGP is used | 400 | * the traditional AGP which resides only in chipset. AGP is used |
401 | * by 3D driver which wasn't available for the VT3336 and VT3364 | 401 | * by 3D driver which wasn't available for the VT3336 and VT3364 |
402 | * generation until now. Unfortunately, by testing, VT3364 works | 402 | * generation until now. Unfortunately, by testing, VT3364 works |
403 | * but VT3336 doesn't. - explaination from via, just leave this as | 403 | * but VT3336 doesn't. - explanation from via, just leave this as |
404 | * as a placeholder to avoid future patches adding it back in. | 404 | * as a placeholder to avoid future patches adding it back in. |
405 | */ | 405 | */ |
406 | #if 0 | 406 | #if 0 |
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index a4a6c2f044b5..cf39bc08ce08 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c | |||
@@ -295,7 +295,7 @@ static int bsr_create_devs(struct device_node *bn) | |||
295 | static int __init bsr_init(void) | 295 | static int __init bsr_init(void) |
296 | { | 296 | { |
297 | struct device_node *np; | 297 | struct device_node *np; |
298 | dev_t bsr_dev = MKDEV(bsr_major, 0); | 298 | dev_t bsr_dev; |
299 | int ret = -ENODEV; | 299 | int ret = -ENODEV; |
300 | int result; | 300 | int result; |
301 | 301 | ||
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 7066e801b9d3..051474c65b78 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -84,8 +84,6 @@ static struct clocksource clocksource_hpet = { | |||
84 | .rating = 250, | 84 | .rating = 250, |
85 | .read = read_hpet, | 85 | .read = read_hpet, |
86 | .mask = CLOCKSOURCE_MASK(64), | 86 | .mask = CLOCKSOURCE_MASK(64), |
87 | .mult = 0, /* to be calculated */ | ||
88 | .shift = 10, | ||
89 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 87 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
90 | }; | 88 | }; |
91 | static struct clocksource *hpet_clocksource; | 89 | static struct clocksource *hpet_clocksource; |
@@ -934,9 +932,7 @@ int hpet_alloc(struct hpet_data *hdp) | |||
934 | if (!hpet_clocksource) { | 932 | if (!hpet_clocksource) { |
935 | hpet_mctr = (void __iomem *)&hpetp->hp_hpet->hpet_mc; | 933 | hpet_mctr = (void __iomem *)&hpetp->hp_hpet->hpet_mc; |
936 | CLKSRC_FSYS_MMIO_SET(clocksource_hpet.fsys_mmio, hpet_mctr); | 934 | CLKSRC_FSYS_MMIO_SET(clocksource_hpet.fsys_mmio, hpet_mctr); |
937 | clocksource_hpet.mult = clocksource_hz2mult(hpetp->hp_tick_freq, | 935 | clocksource_register_hz(&clocksource_hpet, hpetp->hp_tick_freq); |
938 | clocksource_hpet.shift); | ||
939 | clocksource_register(&clocksource_hpet); | ||
940 | hpetp->hp_clocksource = &clocksource_hpet; | 936 | hpetp->hp_clocksource = &clocksource_hpet; |
941 | hpet_clocksource = &clocksource_hpet; | 937 | hpet_clocksource = &clocksource_hpet; |
942 | } | 938 | } |
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index 43ac61978d8b..ac6739e085e3 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c | |||
@@ -619,15 +619,18 @@ static void __devinit n2rng_driver_version(void) | |||
619 | pr_info("%s", version); | 619 | pr_info("%s", version); |
620 | } | 620 | } |
621 | 621 | ||
622 | static const struct of_device_id n2rng_match[]; | ||
622 | static int __devinit n2rng_probe(struct platform_device *op) | 623 | static int __devinit n2rng_probe(struct platform_device *op) |
623 | { | 624 | { |
625 | const struct of_device_id *match; | ||
624 | int victoria_falls; | 626 | int victoria_falls; |
625 | int err = -ENOMEM; | 627 | int err = -ENOMEM; |
626 | struct n2rng *np; | 628 | struct n2rng *np; |
627 | 629 | ||
628 | if (!op->dev.of_match) | 630 | match = of_match_device(n2rng_match, &op->dev); |
631 | if (!match) | ||
629 | return -EINVAL; | 632 | return -EINVAL; |
630 | victoria_falls = (op->dev.of_match->data != NULL); | 633 | victoria_falls = (match->data != NULL); |
631 | 634 | ||
632 | n2rng_driver_version(); | 635 | n2rng_driver_version(); |
633 | np = kzalloc(sizeof(*np), GFP_KERNEL); | 636 | np = kzalloc(sizeof(*np), GFP_KERNEL); |
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index 0dec5da000ef..2efa176beab0 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c | |||
@@ -122,7 +122,7 @@ static struct ipmi_recv_msg halt_recv_msg = { | |||
122 | 122 | ||
123 | 123 | ||
124 | /* | 124 | /* |
125 | * Code to send a message and wait for the reponse. | 125 | * Code to send a message and wait for the response. |
126 | */ | 126 | */ |
127 | 127 | ||
128 | static void receive_handler(struct ipmi_recv_msg *recv_msg, void *handler_data) | 128 | static void receive_handler(struct ipmi_recv_msg *recv_msg, void *handler_data) |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index d28b484aee45..64c6b8530615 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -339,7 +339,7 @@ static void return_hosed_msg(struct smi_info *smi_info, int cCode) | |||
339 | cCode = IPMI_ERR_UNSPECIFIED; | 339 | cCode = IPMI_ERR_UNSPECIFIED; |
340 | /* else use it as is */ | 340 | /* else use it as is */ |
341 | 341 | ||
342 | /* Make it a reponse */ | 342 | /* Make it a response */ |
343 | msg->rsp[0] = msg->data[0] | 4; | 343 | msg->rsp[0] = msg->data[0] | 4; |
344 | msg->rsp[1] = msg->data[1]; | 344 | msg->rsp[1] = msg->data[1]; |
345 | msg->rsp[2] = cCode; | 345 | msg->rsp[2] = cCode; |
@@ -2554,9 +2554,11 @@ static struct pci_driver ipmi_pci_driver = { | |||
2554 | }; | 2554 | }; |
2555 | #endif /* CONFIG_PCI */ | 2555 | #endif /* CONFIG_PCI */ |
2556 | 2556 | ||
2557 | static struct of_device_id ipmi_match[]; | ||
2557 | static int __devinit ipmi_probe(struct platform_device *dev) | 2558 | static int __devinit ipmi_probe(struct platform_device *dev) |
2558 | { | 2559 | { |
2559 | #ifdef CONFIG_OF | 2560 | #ifdef CONFIG_OF |
2561 | const struct of_device_id *match; | ||
2560 | struct smi_info *info; | 2562 | struct smi_info *info; |
2561 | struct resource resource; | 2563 | struct resource resource; |
2562 | const __be32 *regsize, *regspacing, *regshift; | 2564 | const __be32 *regsize, *regspacing, *regshift; |
@@ -2566,7 +2568,8 @@ static int __devinit ipmi_probe(struct platform_device *dev) | |||
2566 | 2568 | ||
2567 | dev_info(&dev->dev, "probing via device tree\n"); | 2569 | dev_info(&dev->dev, "probing via device tree\n"); |
2568 | 2570 | ||
2569 | if (!dev->dev.of_match) | 2571 | match = of_match_device(ipmi_match, &dev->dev); |
2572 | if (!match) | ||
2570 | return -EINVAL; | 2573 | return -EINVAL; |
2571 | 2574 | ||
2572 | ret = of_address_to_resource(np, 0, &resource); | 2575 | ret = of_address_to_resource(np, 0, &resource); |
@@ -2601,7 +2604,7 @@ static int __devinit ipmi_probe(struct platform_device *dev) | |||
2601 | return -ENOMEM; | 2604 | return -ENOMEM; |
2602 | } | 2605 | } |
2603 | 2606 | ||
2604 | info->si_type = (enum si_type) dev->dev.of_match->data; | 2607 | info->si_type = (enum si_type) match->data; |
2605 | info->addr_source = SI_DEVICETREE; | 2608 | info->addr_source = SI_DEVICETREE; |
2606 | info->irq_setup = std_irq_setup; | 2609 | info->irq_setup = std_irq_setup; |
2607 | 2610 | ||
@@ -2927,7 +2930,7 @@ static void return_hosed_msg_badsize(struct smi_info *smi_info) | |||
2927 | { | 2930 | { |
2928 | struct ipmi_smi_msg *msg = smi_info->curr_msg; | 2931 | struct ipmi_smi_msg *msg = smi_info->curr_msg; |
2929 | 2932 | ||
2930 | /* Make it a reponse */ | 2933 | /* Make it a response */ |
2931 | msg->rsp[0] = msg->data[0] | 4; | 2934 | msg->rsp[0] = msg->data[0] | 4; |
2932 | msg->rsp[1] = msg->data[1]; | 2935 | msg->rsp[1] = msg->data[1]; |
2933 | msg->rsp[2] = CANNOT_RETURN_REQUESTED_LENGTH; | 2936 | msg->rsp[2] = CANNOT_RETURN_REQUESTED_LENGTH; |
diff --git a/drivers/char/mbcs.h b/drivers/char/mbcs.h index ba671589f4cb..1a36884c48b5 100644 --- a/drivers/char/mbcs.h +++ b/drivers/char/mbcs.h | |||
@@ -36,13 +36,13 @@ | |||
36 | #define MBCS_RD_DMA_CTRL 0x0110 /* Read DMA Control */ | 36 | #define MBCS_RD_DMA_CTRL 0x0110 /* Read DMA Control */ |
37 | #define MBCS_RD_DMA_AMO_DEST 0x0118 /* Read DMA AMO Destination */ | 37 | #define MBCS_RD_DMA_AMO_DEST 0x0118 /* Read DMA AMO Destination */ |
38 | #define MBCS_RD_DMA_INT_DEST 0x0120 /* Read DMA Interrupt Destination */ | 38 | #define MBCS_RD_DMA_INT_DEST 0x0120 /* Read DMA Interrupt Destination */ |
39 | #define MBCS_RD_DMA_AUX_STAT 0x0130 /* Read DMA Auxillary Status */ | 39 | #define MBCS_RD_DMA_AUX_STAT 0x0130 /* Read DMA Auxiliary Status */ |
40 | #define MBCS_WR_DMA_SYS_ADDR 0x0200 /* Write DMA System Address */ | 40 | #define MBCS_WR_DMA_SYS_ADDR 0x0200 /* Write DMA System Address */ |
41 | #define MBCS_WR_DMA_LOC_ADDR 0x0208 /* Write DMA Local Address */ | 41 | #define MBCS_WR_DMA_LOC_ADDR 0x0208 /* Write DMA Local Address */ |
42 | #define MBCS_WR_DMA_CTRL 0x0210 /* Write DMA Control */ | 42 | #define MBCS_WR_DMA_CTRL 0x0210 /* Write DMA Control */ |
43 | #define MBCS_WR_DMA_AMO_DEST 0x0218 /* Write DMA AMO Destination */ | 43 | #define MBCS_WR_DMA_AMO_DEST 0x0218 /* Write DMA AMO Destination */ |
44 | #define MBCS_WR_DMA_INT_DEST 0x0220 /* Write DMA Interrupt Destination */ | 44 | #define MBCS_WR_DMA_INT_DEST 0x0220 /* Write DMA Interrupt Destination */ |
45 | #define MBCS_WR_DMA_AUX_STAT 0x0230 /* Write DMA Auxillary Status */ | 45 | #define MBCS_WR_DMA_AUX_STAT 0x0230 /* Write DMA Auxiliary Status */ |
46 | #define MBCS_ALG_AMO_DEST 0x0300 /* Algorithm AMO Destination */ | 46 | #define MBCS_ALG_AMO_DEST 0x0300 /* Algorithm AMO Destination */ |
47 | #define MBCS_ALG_INT_DEST 0x0308 /* Algorithm Interrupt Destination */ | 47 | #define MBCS_ALG_INT_DEST 0x0308 /* Algorithm Interrupt Destination */ |
48 | #define MBCS_ALG_OFFSETS 0x0310 | 48 | #define MBCS_ALG_OFFSETS 0x0310 |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 436a99017998..8fc04b4f311f 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -806,29 +806,41 @@ static const struct file_operations oldmem_fops = { | |||
806 | }; | 806 | }; |
807 | #endif | 807 | #endif |
808 | 808 | ||
809 | static ssize_t kmsg_write(struct file *file, const char __user *buf, | 809 | static ssize_t kmsg_writev(struct kiocb *iocb, const struct iovec *iv, |
810 | size_t count, loff_t *ppos) | 810 | unsigned long count, loff_t pos) |
811 | { | 811 | { |
812 | char *tmp; | 812 | char *line, *p; |
813 | ssize_t ret; | 813 | int i; |
814 | ssize_t ret = -EFAULT; | ||
815 | size_t len = iov_length(iv, count); | ||
814 | 816 | ||
815 | tmp = kmalloc(count + 1, GFP_KERNEL); | 817 | line = kmalloc(len + 1, GFP_KERNEL); |
816 | if (tmp == NULL) | 818 | if (line == NULL) |
817 | return -ENOMEM; | 819 | return -ENOMEM; |
818 | ret = -EFAULT; | 820 | |
819 | if (!copy_from_user(tmp, buf, count)) { | 821 | /* |
820 | tmp[count] = 0; | 822 | * copy all vectors into a single string, to ensure we do |
821 | ret = printk("%s", tmp); | 823 | * not interleave our log line with other printk calls |
822 | if (ret > count) | 824 | */ |
823 | /* printk can add a prefix */ | 825 | p = line; |
824 | ret = count; | 826 | for (i = 0; i < count; i++) { |
827 | if (copy_from_user(p, iv[i].iov_base, iv[i].iov_len)) | ||
828 | goto out; | ||
829 | p += iv[i].iov_len; | ||
825 | } | 830 | } |
826 | kfree(tmp); | 831 | p[0] = '\0'; |
832 | |||
833 | ret = printk("%s", line); | ||
834 | /* printk can add a prefix */ | ||
835 | if (ret > len) | ||
836 | ret = len; | ||
837 | out: | ||
838 | kfree(line); | ||
827 | return ret; | 839 | return ret; |
828 | } | 840 | } |
829 | 841 | ||
830 | static const struct file_operations kmsg_fops = { | 842 | static const struct file_operations kmsg_fops = { |
831 | .write = kmsg_write, | 843 | .aio_write = kmsg_writev, |
832 | .llseek = noop_llseek, | 844 | .llseek = noop_llseek, |
833 | }; | 845 | }; |
834 | 846 | ||
diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h index 270431ca7dae..fba6ab1160ce 100644 --- a/drivers/char/mwave/3780i.h +++ b/drivers/char/mwave/3780i.h | |||
@@ -122,7 +122,7 @@ typedef struct { | |||
122 | typedef struct { | 122 | typedef struct { |
123 | unsigned char Dma:3; /* RW: DMA channel selection */ | 123 | unsigned char Dma:3; /* RW: DMA channel selection */ |
124 | unsigned char NumTransfers:2; /* RW: Maximum # of transfers once being granted the ISA bus */ | 124 | unsigned char NumTransfers:2; /* RW: Maximum # of transfers once being granted the ISA bus */ |
125 | unsigned char ReRequest:2; /* RW: Minumum delay between releasing the ISA bus and requesting it again */ | 125 | unsigned char ReRequest:2; /* RW: Minimum delay between releasing the ISA bus and requesting it again */ |
126 | unsigned char MEMCS16:1; /* RW: ISA signal MEMCS16: 0=disabled, 1=enabled */ | 126 | unsigned char MEMCS16:1; /* RW: ISA signal MEMCS16: 0=disabled, 1=enabled */ |
127 | } DSP_BUSMASTER_CFG_1; | 127 | } DSP_BUSMASTER_CFG_1; |
128 | 128 | ||
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 8994ce32e6c7..04a480f86c6c 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c | |||
@@ -75,7 +75,7 @@ int button_add_callback (void (*callback) (void), int count) | |||
75 | * with -EINVAL. If there is more than one entry with the same address, | 75 | * with -EINVAL. If there is more than one entry with the same address, |
76 | * because it searches the list from end to beginning, it will unregister the | 76 | * because it searches the list from end to beginning, it will unregister the |
77 | * last one to be registered first (FILO- First In Last Out). | 77 | * last one to be registered first (FILO- First In Last Out). |
78 | * Note that this is not neccessarily true if the entries are not submitted | 78 | * Note that this is not necessarily true if the entries are not submitted |
79 | * at the same time, because another driver could have unregistered a callback | 79 | * at the same time, because another driver could have unregistered a callback |
80 | * between the submissions creating a gap earlier in the list, which would | 80 | * between the submissions creating a gap earlier in the list, which would |
81 | * be filled first at submission time. | 81 | * be filled first at submission time. |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index bcbbc71febb7..90bd01671c70 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -806,7 +806,7 @@ static void monitor_card(unsigned long p) | |||
806 | dev->flags1 = 0x01; | 806 | dev->flags1 = 0x01; |
807 | xoutb(dev->flags1, REG_FLAGS1(iobase)); | 807 | xoutb(dev->flags1, REG_FLAGS1(iobase)); |
808 | 808 | ||
809 | /* atr is present (which doesnt mean it's valid) */ | 809 | /* atr is present (which doesn't mean it's valid) */ |
810 | set_bit(IS_ATR_PRESENT, &dev->flags); | 810 | set_bit(IS_ATR_PRESENT, &dev->flags); |
811 | if (dev->atr[0] == 0x03) | 811 | if (dev->atr[0] == 0x03) |
812 | str_invert_revert(dev->atr, dev->atr_len); | 812 | str_invert_revert(dev->atr, dev->atr_len); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index beca80bb9bdb..b575411c69b2 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -1290,7 +1290,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1290 | /* Allocate and claim adapter resources */ | 1290 | /* Allocate and claim adapter resources */ |
1291 | retval = claim_resources(info); | 1291 | retval = claim_resources(info); |
1292 | 1292 | ||
1293 | /* perform existance check and diagnostics */ | 1293 | /* perform existence check and diagnostics */ |
1294 | if ( !retval ) | 1294 | if ( !retval ) |
1295 | retval = adapter_test(info); | 1295 | retval = adapter_test(info); |
1296 | 1296 | ||
@@ -2680,7 +2680,7 @@ static void rx_free_buffers(MGSLPC_INFO *info) | |||
2680 | static int claim_resources(MGSLPC_INFO *info) | 2680 | static int claim_resources(MGSLPC_INFO *info) |
2681 | { | 2681 | { |
2682 | if (rx_alloc_buffers(info) < 0 ) { | 2682 | if (rx_alloc_buffers(info) < 0 ) { |
2683 | printk( "Cant allocate rx buffer %s\n", info->device_name); | 2683 | printk( "Can't allocate rx buffer %s\n", info->device_name); |
2684 | release_resources(info); | 2684 | release_resources(info); |
2685 | return -ENODEV; | 2685 | return -ENODEV; |
2686 | } | 2686 | } |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 5e29e8031bbc..d4ddeba56682 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -732,7 +732,7 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf, | |||
732 | size_t nbytes, int min, int rsvd); | 732 | size_t nbytes, int min, int rsvd); |
733 | 733 | ||
734 | /* | 734 | /* |
735 | * This utility inline function is responsible for transfering entropy | 735 | * This utility inline function is responsible for transferring entropy |
736 | * from the primary pool to the secondary extraction pool. We make | 736 | * from the primary pool to the secondary extraction pool. We make |
737 | * sure we pull enough for a 'catastrophic reseed'. | 737 | * sure we pull enough for a 'catastrophic reseed'. |
738 | */ | 738 | */ |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index b4b9d5a47885..b33e8ea314ed 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/gfp.h> | 22 | #include <linux/gfp.h> |
23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
24 | #include <linux/vmalloc.h> | ||
24 | 25 | ||
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
26 | 27 | ||
@@ -30,10 +31,15 @@ struct raw_device_data { | |||
30 | }; | 31 | }; |
31 | 32 | ||
32 | static struct class *raw_class; | 33 | static struct class *raw_class; |
33 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; | 34 | static struct raw_device_data *raw_devices; |
34 | static DEFINE_MUTEX(raw_mutex); | 35 | static DEFINE_MUTEX(raw_mutex); |
35 | static const struct file_operations raw_ctl_fops; /* forward declaration */ | 36 | static const struct file_operations raw_ctl_fops; /* forward declaration */ |
36 | 37 | ||
38 | static int max_raw_minors = MAX_RAW_MINORS; | ||
39 | |||
40 | module_param(max_raw_minors, int, 0); | ||
41 | MODULE_PARM_DESC(max_raw_minors, "Maximum number of raw devices (1-65536)"); | ||
42 | |||
37 | /* | 43 | /* |
38 | * Open/close code for raw IO. | 44 | * Open/close code for raw IO. |
39 | * | 45 | * |
@@ -125,7 +131,7 @@ static int bind_set(int number, u64 major, u64 minor) | |||
125 | struct raw_device_data *rawdev; | 131 | struct raw_device_data *rawdev; |
126 | int err = 0; | 132 | int err = 0; |
127 | 133 | ||
128 | if (number <= 0 || number >= MAX_RAW_MINORS) | 134 | if (number <= 0 || number >= max_raw_minors) |
129 | return -EINVAL; | 135 | return -EINVAL; |
130 | 136 | ||
131 | if (MAJOR(dev) != major || MINOR(dev) != minor) | 137 | if (MAJOR(dev) != major || MINOR(dev) != minor) |
@@ -312,14 +318,27 @@ static int __init raw_init(void) | |||
312 | dev_t dev = MKDEV(RAW_MAJOR, 0); | 318 | dev_t dev = MKDEV(RAW_MAJOR, 0); |
313 | int ret; | 319 | int ret; |
314 | 320 | ||
315 | ret = register_chrdev_region(dev, MAX_RAW_MINORS, "raw"); | 321 | if (max_raw_minors < 1 || max_raw_minors > 65536) { |
322 | printk(KERN_WARNING "raw: invalid max_raw_minors (must be" | ||
323 | " between 1 and 65536), using %d\n", MAX_RAW_MINORS); | ||
324 | max_raw_minors = MAX_RAW_MINORS; | ||
325 | } | ||
326 | |||
327 | raw_devices = vmalloc(sizeof(struct raw_device_data) * max_raw_minors); | ||
328 | if (!raw_devices) { | ||
329 | printk(KERN_ERR "Not enough memory for raw device structures\n"); | ||
330 | ret = -ENOMEM; | ||
331 | goto error; | ||
332 | } | ||
333 | memset(raw_devices, 0, sizeof(struct raw_device_data) * max_raw_minors); | ||
334 | |||
335 | ret = register_chrdev_region(dev, max_raw_minors, "raw"); | ||
316 | if (ret) | 336 | if (ret) |
317 | goto error; | 337 | goto error; |
318 | 338 | ||
319 | cdev_init(&raw_cdev, &raw_fops); | 339 | cdev_init(&raw_cdev, &raw_fops); |
320 | ret = cdev_add(&raw_cdev, dev, MAX_RAW_MINORS); | 340 | ret = cdev_add(&raw_cdev, dev, max_raw_minors); |
321 | if (ret) { | 341 | if (ret) { |
322 | kobject_put(&raw_cdev.kobj); | ||
323 | goto error_region; | 342 | goto error_region; |
324 | } | 343 | } |
325 | 344 | ||
@@ -336,8 +355,9 @@ static int __init raw_init(void) | |||
336 | return 0; | 355 | return 0; |
337 | 356 | ||
338 | error_region: | 357 | error_region: |
339 | unregister_chrdev_region(dev, MAX_RAW_MINORS); | 358 | unregister_chrdev_region(dev, max_raw_minors); |
340 | error: | 359 | error: |
360 | vfree(raw_devices); | ||
341 | return ret; | 361 | return ret; |
342 | } | 362 | } |
343 | 363 | ||
@@ -346,7 +366,7 @@ static void __exit raw_exit(void) | |||
346 | device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); | 366 | device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); |
347 | class_destroy(raw_class); | 367 | class_destroy(raw_class); |
348 | cdev_del(&raw_cdev); | 368 | cdev_del(&raw_cdev); |
349 | unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); | 369 | unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), max_raw_minors); |
350 | } | 370 | } |
351 | 371 | ||
352 | module_init(raw_init); | 372 | module_init(raw_init); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 79e36c878a4c..1ee8ce7d2762 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1241,7 +1241,7 @@ static int __devinit sonypi_setup_ioports(struct sonypi_device *dev, | |||
1241 | while (check_ioport && check->port1) { | 1241 | while (check_ioport && check->port1) { |
1242 | if (!request_region(check->port1, | 1242 | if (!request_region(check->port1, |
1243 | sonypi_device.region_size, | 1243 | sonypi_device.region_size, |
1244 | "Sony Programable I/O Device Check")) { | 1244 | "Sony Programmable I/O Device Check")) { |
1245 | printk(KERN_ERR "sonypi: ioport 0x%.4x busy, using sony-laptop? " | 1245 | printk(KERN_ERR "sonypi: ioport 0x%.4x busy, using sony-laptop? " |
1246 | "if not use check_ioport=0\n", | 1246 | "if not use check_ioport=0\n", |
1247 | check->port1); | 1247 | check->port1); |
@@ -1255,7 +1255,7 @@ static int __devinit sonypi_setup_ioports(struct sonypi_device *dev, | |||
1255 | 1255 | ||
1256 | if (request_region(ioport_list->port1, | 1256 | if (request_region(ioport_list->port1, |
1257 | sonypi_device.region_size, | 1257 | sonypi_device.region_size, |
1258 | "Sony Programable I/O Device")) { | 1258 | "Sony Programmable I/O Device")) { |
1259 | dev->ioport1 = ioport_list->port1; | 1259 | dev->ioport1 = ioport_list->port1; |
1260 | dev->ioport2 = ioport_list->port2; | 1260 | dev->ioport2 = ioport_list->port2; |
1261 | return 0; | 1261 | return 0; |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 1f46f1cd9225..7beb0e25f1e1 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -980,7 +980,7 @@ int tpm_open(struct inode *inode, struct file *file) | |||
980 | return -EBUSY; | 980 | return -EBUSY; |
981 | } | 981 | } |
982 | 982 | ||
983 | chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL); | 983 | chip->data_buffer = kzalloc(TPM_BUFSIZE, GFP_KERNEL); |
984 | if (chip->data_buffer == NULL) { | 984 | if (chip->data_buffer == NULL) { |
985 | clear_bit(0, &chip->is_open); | 985 | clear_bit(0, &chip->is_open); |
986 | put_device(chip->dev); | 986 | put_device(chip->dev); |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 84b164d1eb2b..838568a7dbf5 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port) | |||
1280 | spin_lock_irq(&pdrvdata_lock); | 1280 | spin_lock_irq(&pdrvdata_lock); |
1281 | list_del(&port->cons.list); | 1281 | list_del(&port->cons.list); |
1282 | spin_unlock_irq(&pdrvdata_lock); | 1282 | spin_unlock_irq(&pdrvdata_lock); |
1283 | #if 0 | ||
1284 | /* | ||
1285 | * hvc_remove() not called as removing one hvc port | ||
1286 | * results in other hvc ports getting frozen. | ||
1287 | * | ||
1288 | * Once this is resolved in hvc, this functionality | ||
1289 | * will be enabled. Till that is done, the -EPIPE | ||
1290 | * return from get_chars() above will help | ||
1291 | * hvc_console.c to clean up on ports we remove here. | ||
1292 | */ | ||
1293 | hvc_remove(port->cons.hvc); | 1283 | hvc_remove(port->cons.hvc); |
1294 | #endif | ||
1295 | } | 1284 | } |
1296 | 1285 | ||
1297 | /* Remove unused data this port might have received. */ | 1286 | /* Remove unused data this port might have received. */ |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index d3c9d755ed98..39ccdeada791 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -67,7 +67,7 @@ | |||
67 | * cp foo.bit /dev/icap0 | 67 | * cp foo.bit /dev/icap0 |
68 | * | 68 | * |
69 | * Note that unless foo.bit is an appropriately constructed partial | 69 | * Note that unless foo.bit is an appropriately constructed partial |
70 | * bitstream, this has a high likelyhood of overwriting the design | 70 | * bitstream, this has a high likelihood of overwriting the design |
71 | * currently programmed in the FPGA. | 71 | * currently programmed in the FPGA. |
72 | */ | 72 | */ |
73 | 73 | ||
@@ -715,13 +715,13 @@ static int __devexit hwicap_remove(struct device *dev) | |||
715 | } | 715 | } |
716 | 716 | ||
717 | #ifdef CONFIG_OF | 717 | #ifdef CONFIG_OF |
718 | static int __devinit hwicap_of_probe(struct platform_device *op) | 718 | static int __devinit hwicap_of_probe(struct platform_device *op, |
719 | const struct hwicap_driver_config *config) | ||
719 | { | 720 | { |
720 | struct resource res; | 721 | struct resource res; |
721 | const unsigned int *id; | 722 | const unsigned int *id; |
722 | const char *family; | 723 | const char *family; |
723 | int rc; | 724 | int rc; |
724 | const struct hwicap_driver_config *config = op->dev.of_match->data; | ||
725 | const struct config_registers *regs; | 725 | const struct config_registers *regs; |
726 | 726 | ||
727 | 727 | ||
@@ -751,20 +751,24 @@ static int __devinit hwicap_of_probe(struct platform_device *op) | |||
751 | regs); | 751 | regs); |
752 | } | 752 | } |
753 | #else | 753 | #else |
754 | static inline int hwicap_of_probe(struct platform_device *op) | 754 | static inline int hwicap_of_probe(struct platform_device *op, |
755 | const struct hwicap_driver_config *config) | ||
755 | { | 756 | { |
756 | return -EINVAL; | 757 | return -EINVAL; |
757 | } | 758 | } |
758 | #endif /* CONFIG_OF */ | 759 | #endif /* CONFIG_OF */ |
759 | 760 | ||
761 | static const struct of_device_id __devinitconst hwicap_of_match[]; | ||
760 | static int __devinit hwicap_drv_probe(struct platform_device *pdev) | 762 | static int __devinit hwicap_drv_probe(struct platform_device *pdev) |
761 | { | 763 | { |
764 | const struct of_device_id *match; | ||
762 | struct resource *res; | 765 | struct resource *res; |
763 | const struct config_registers *regs; | 766 | const struct config_registers *regs; |
764 | const char *family; | 767 | const char *family; |
765 | 768 | ||
766 | if (pdev->dev.of_match) | 769 | match = of_match_device(hwicap_of_match, &pdev->dev); |
767 | return hwicap_of_probe(pdev); | 770 | if (match) |
771 | return hwicap_of_probe(pdev, match->data); | ||
768 | 772 | ||
769 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 773 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
770 | if (!res) | 774 | if (!res) |