diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hpet.c | 5 | ||||
-rw-r--r-- | drivers/char/hw_random/Kconfig | 13 | ||||
-rw-r--r-- | drivers/char/hw_random/Makefile | 1 | ||||
-rw-r--r-- | drivers/char/hw_random/powernv-rng.c | 81 | ||||
-rw-r--r-- | drivers/char/hw_random/pseries-rng.c | 14 | ||||
-rw-r--r-- | drivers/char/misc.c | 8 | ||||
-rw-r--r-- | drivers/char/nwbutton.c | 2 | ||||
-rw-r--r-- | drivers/char/rtc.c | 5 | ||||
-rw-r--r-- | drivers/char/snsc.c | 3 | ||||
-rw-r--r-- | drivers/char/snsc_event.c | 3 | ||||
-rw-r--r-- | drivers/char/tlclk.c | 2 | ||||
-rw-r--r-- | drivers/char/tpm/xen-tpmfront.c | 1 | ||||
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.c | 3 |
13 files changed, 119 insertions, 22 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 448ce5e29c56..dca5834685cf 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -486,8 +486,7 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) | |||
486 | } | 486 | } |
487 | 487 | ||
488 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); | 488 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); |
489 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ | 489 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ ? IRQF_SHARED : 0; |
490 | ? IRQF_SHARED : IRQF_DISABLED; | ||
491 | if (request_irq(irq, hpet_interrupt, irq_flags, | 490 | if (request_irq(irq, hpet_interrupt, irq_flags, |
492 | devp->hd_name, (void *)devp)) { | 491 | devp->hd_name, (void *)devp)) { |
493 | printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); | 492 | printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); |
@@ -971,8 +970,6 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
971 | struct acpi_resource_fixed_memory32 *fixmem32; | 970 | struct acpi_resource_fixed_memory32 *fixmem32; |
972 | 971 | ||
973 | fixmem32 = &res->data.fixed_memory32; | 972 | fixmem32 = &res->data.fixed_memory32; |
974 | if (!fixmem32) | ||
975 | return AE_NO_MEMORY; | ||
976 | 973 | ||
977 | hdp->hd_phys_address = fixmem32->address; | 974 | hdp->hd_phys_address = fixmem32->address; |
978 | hdp->hd_address = ioremap(fixmem32->address, | 975 | hdp->hd_address = ioremap(fixmem32->address, |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 0aa9d91daef5..c206de2951f2 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -290,6 +290,19 @@ config HW_RANDOM_PSERIES | |||
290 | 290 | ||
291 | If unsure, say Y. | 291 | If unsure, say Y. |
292 | 292 | ||
293 | config HW_RANDOM_POWERNV | ||
294 | tristate "PowerNV Random Number Generator support" | ||
295 | depends on HW_RANDOM && PPC_POWERNV | ||
296 | default HW_RANDOM | ||
297 | ---help--- | ||
298 | This is the driver for Random Number Generator hardware found | ||
299 | in POWER7+ and above machines for PowerNV platform. | ||
300 | |||
301 | To compile this driver as a module, choose M here: the | ||
302 | module will be called powernv-rng. | ||
303 | |||
304 | If unsure, say Y. | ||
305 | |||
293 | config HW_RANDOM_EXYNOS | 306 | config HW_RANDOM_EXYNOS |
294 | tristate "EXYNOS HW random number generator support" | 307 | tristate "EXYNOS HW random number generator support" |
295 | depends on HW_RANDOM && HAS_IOMEM && HAVE_CLK | 308 | depends on HW_RANDOM && HAS_IOMEM && HAVE_CLK |
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index bed467c9300e..d7d2435ff7fa 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -24,6 +24,7 @@ obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o | |||
24 | obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o | 24 | obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o |
25 | obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o | 25 | obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o |
26 | obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o | 26 | obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o |
27 | obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o | ||
27 | obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o | 28 | obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o |
28 | obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o | 29 | obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o |
29 | obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o | 30 | obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o |
diff --git a/drivers/char/hw_random/powernv-rng.c b/drivers/char/hw_random/powernv-rng.c new file mode 100644 index 000000000000..3f4f63204560 --- /dev/null +++ b/drivers/char/hw_random/powernv-rng.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Michael Ellerman, Guo Chao, IBM Corp. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/random.h> | ||
16 | #include <linux/hw_random.h> | ||
17 | |||
18 | static int powernv_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) | ||
19 | { | ||
20 | unsigned long *buf; | ||
21 | int i, len; | ||
22 | |||
23 | /* We rely on rng_buffer_size() being >= sizeof(unsigned long) */ | ||
24 | len = max / sizeof(unsigned long); | ||
25 | |||
26 | buf = (unsigned long *)data; | ||
27 | |||
28 | for (i = 0; i < len; i++) | ||
29 | powernv_get_random_long(buf++); | ||
30 | |||
31 | return len * sizeof(unsigned long); | ||
32 | } | ||
33 | |||
34 | static struct hwrng powernv_hwrng = { | ||
35 | .name = "powernv-rng", | ||
36 | .read = powernv_rng_read, | ||
37 | }; | ||
38 | |||
39 | static int powernv_rng_remove(struct platform_device *pdev) | ||
40 | { | ||
41 | hwrng_unregister(&powernv_hwrng); | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static int powernv_rng_probe(struct platform_device *pdev) | ||
47 | { | ||
48 | int rc; | ||
49 | |||
50 | rc = hwrng_register(&powernv_hwrng); | ||
51 | if (rc) { | ||
52 | /* We only register one device, ignore any others */ | ||
53 | if (rc == -EEXIST) | ||
54 | rc = -ENODEV; | ||
55 | |||
56 | return rc; | ||
57 | } | ||
58 | |||
59 | pr_info("Registered powernv hwrng.\n"); | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static struct of_device_id powernv_rng_match[] = { | ||
65 | { .compatible = "ibm,power-rng",}, | ||
66 | {}, | ||
67 | }; | ||
68 | MODULE_DEVICE_TABLE(of, powernv_rng_match); | ||
69 | |||
70 | static struct platform_driver powernv_rng_driver = { | ||
71 | .driver = { | ||
72 | .name = "powernv_rng", | ||
73 | .of_match_table = powernv_rng_match, | ||
74 | }, | ||
75 | .probe = powernv_rng_probe, | ||
76 | .remove = powernv_rng_remove, | ||
77 | }; | ||
78 | module_platform_driver(powernv_rng_driver); | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_DESCRIPTION("Bare metal HWRNG driver for POWER7+ and above"); | ||
diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c index 5f1197929f0c..b761459a3436 100644 --- a/drivers/char/hw_random/pseries-rng.c +++ b/drivers/char/hw_random/pseries-rng.c | |||
@@ -17,6 +17,9 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
22 | #include <linux/kernel.h> | ||
20 | #include <linux/module.h> | 23 | #include <linux/module.h> |
21 | #include <linux/hw_random.h> | 24 | #include <linux/hw_random.h> |
22 | #include <asm/vio.h> | 25 | #include <asm/vio.h> |
@@ -25,10 +28,15 @@ | |||
25 | 28 | ||
26 | static int pseries_rng_data_read(struct hwrng *rng, u32 *data) | 29 | static int pseries_rng_data_read(struct hwrng *rng, u32 *data) |
27 | { | 30 | { |
28 | if (plpar_hcall(H_RANDOM, (unsigned long *)data) != H_SUCCESS) { | 31 | int rc; |
29 | printk(KERN_ERR "pseries rng hcall error\n"); | 32 | |
30 | return 0; | 33 | rc = plpar_hcall(H_RANDOM, (unsigned long *)data); |
34 | if (rc != H_SUCCESS) { | ||
35 | pr_err_ratelimited("H_RANDOM call failed %d\n", rc); | ||
36 | return -EIO; | ||
31 | } | 37 | } |
38 | |||
39 | /* The hypervisor interface returns 64 bits */ | ||
32 | return 8; | 40 | return 8; |
33 | } | 41 | } |
34 | 42 | ||
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 190d4423653f..2f685f6eda48 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -193,8 +193,8 @@ int misc_register(struct miscdevice * misc) | |||
193 | if (misc->minor == MISC_DYNAMIC_MINOR) { | 193 | if (misc->minor == MISC_DYNAMIC_MINOR) { |
194 | int i = find_first_zero_bit(misc_minors, DYNAMIC_MINORS); | 194 | int i = find_first_zero_bit(misc_minors, DYNAMIC_MINORS); |
195 | if (i >= DYNAMIC_MINORS) { | 195 | if (i >= DYNAMIC_MINORS) { |
196 | mutex_unlock(&misc_mtx); | 196 | err = -EBUSY; |
197 | return -EBUSY; | 197 | goto out; |
198 | } | 198 | } |
199 | misc->minor = DYNAMIC_MINORS - i - 1; | 199 | misc->minor = DYNAMIC_MINORS - i - 1; |
200 | set_bit(i, misc_minors); | 200 | set_bit(i, misc_minors); |
@@ -203,8 +203,8 @@ int misc_register(struct miscdevice * misc) | |||
203 | 203 | ||
204 | list_for_each_entry(c, &misc_list, list) { | 204 | list_for_each_entry(c, &misc_list, list) { |
205 | if (c->minor == misc->minor) { | 205 | if (c->minor == misc->minor) { |
206 | mutex_unlock(&misc_mtx); | 206 | err = -EBUSY; |
207 | return -EBUSY; | 207 | goto out; |
208 | } | 208 | } |
209 | } | 209 | } |
210 | } | 210 | } |
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index cfdfe493c6af..1fd00dc06897 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c | |||
@@ -220,7 +220,7 @@ static int __init nwbutton_init(void) | |||
220 | return -EBUSY; | 220 | return -EBUSY; |
221 | } | 221 | } |
222 | 222 | ||
223 | if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, IRQF_DISABLED, | 223 | if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, 0, |
224 | "nwbutton", NULL)) { | 224 | "nwbutton", NULL)) { |
225 | printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n", | 225 | printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n", |
226 | IRQ_NETWINDER_BUTTON); | 226 | IRQ_NETWINDER_BUTTON); |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index c0cbbd429bdc..35259961cc38 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -227,7 +227,7 @@ static inline unsigned char rtc_is_updating(void) | |||
227 | 227 | ||
228 | #ifdef RTC_IRQ | 228 | #ifdef RTC_IRQ |
229 | /* | 229 | /* |
230 | * A very tiny interrupt handler. It runs with IRQF_DISABLED set, | 230 | * A very tiny interrupt handler. It runs with interrupts disabled, |
231 | * but there is possibility of conflicting with the set_rtc_mmss() | 231 | * but there is possibility of conflicting with the set_rtc_mmss() |
232 | * call (the rtc irq and the timer irq can easily run at the same | 232 | * call (the rtc irq and the timer irq can easily run at the same |
233 | * time in two different CPUs). So we need to serialize | 233 | * time in two different CPUs). So we need to serialize |
@@ -1040,8 +1040,7 @@ no_irq: | |||
1040 | rtc_int_handler_ptr = rtc_interrupt; | 1040 | rtc_int_handler_ptr = rtc_interrupt; |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | if (request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, | 1043 | if (request_irq(RTC_IRQ, rtc_int_handler_ptr, 0, "rtc", NULL)) { |
1044 | "rtc", NULL)) { | ||
1045 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 1044 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
1046 | rtc_has_irq = 0; | 1045 | rtc_has_irq = 0; |
1047 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 1046 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 5816b39ff5a9..8bab59292a0d 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -108,8 +108,7 @@ scdrv_open(struct inode *inode, struct file *file) | |||
108 | /* hook this subchannel up to the system controller interrupt */ | 108 | /* hook this subchannel up to the system controller interrupt */ |
109 | mutex_lock(&scdrv_mutex); | 109 | mutex_lock(&scdrv_mutex); |
110 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, | 110 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, |
111 | IRQF_SHARED | IRQF_DISABLED, | 111 | IRQF_SHARED, SYSCTL_BASENAME, sd); |
112 | SYSCTL_BASENAME, sd); | ||
113 | if (rv) { | 112 | if (rv) { |
114 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); | 113 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); |
115 | kfree(sd); | 114 | kfree(sd); |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index ee156948b9f8..59bcefd6ec7c 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -292,8 +292,7 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
292 | 292 | ||
293 | /* hook event subchannel up to the system controller interrupt */ | 293 | /* hook event subchannel up to the system controller interrupt */ |
294 | rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt, | 294 | rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt, |
295 | IRQF_SHARED | IRQF_DISABLED, | 295 | IRQF_SHARED, "system controller events", event_sd); |
296 | "system controller events", event_sd); | ||
297 | if (rv) { | 296 | if (rv) { |
298 | printk(KERN_WARNING "%s: irq request failed (%d)\n", | 297 | printk(KERN_WARNING "%s: irq request failed (%d)\n", |
299 | __func__, rv); | 298 | __func__, rv); |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index e95e0ab0bd87..100cd1de9939 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -222,7 +222,7 @@ static int tlclk_open(struct inode *inode, struct file *filp) | |||
222 | /* This device is wired through the FPGA IO space of the ATCA blade | 222 | /* This device is wired through the FPGA IO space of the ATCA blade |
223 | * we can't share this IRQ */ | 223 | * we can't share this IRQ */ |
224 | result = request_irq(telclk_interrupt, &tlclk_interrupt, | 224 | result = request_irq(telclk_interrupt, &tlclk_interrupt, |
225 | IRQF_DISABLED, "telco_clock", tlclk_interrupt); | 225 | 0, "telco_clock", tlclk_interrupt); |
226 | if (result == -EBUSY) | 226 | if (result == -EBUSY) |
227 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); | 227 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); |
228 | else | 228 | else |
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c index 06189e55b4e5..94c280d36e8b 100644 --- a/drivers/char/tpm/xen-tpmfront.c +++ b/drivers/char/tpm/xen-tpmfront.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/err.h> | 11 | #include <linux/err.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | #include <xen/xen.h> | ||
13 | #include <xen/events.h> | 14 | #include <xen/events.h> |
14 | #include <xen/interface/io/tpmif.h> | 15 | #include <xen/interface/io/tpmif.h> |
15 | #include <xen/grant_table.h> | 16 | #include <xen/grant_table.h> |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 5224da5202d3..f6345f932e46 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
@@ -721,7 +721,7 @@ static int hwicap_remove(struct device *dev) | |||
721 | { | 721 | { |
722 | struct hwicap_drvdata *drvdata; | 722 | struct hwicap_drvdata *drvdata; |
723 | 723 | ||
724 | drvdata = (struct hwicap_drvdata *)dev_get_drvdata(dev); | 724 | drvdata = dev_get_drvdata(dev); |
725 | 725 | ||
726 | if (!drvdata) | 726 | if (!drvdata) |
727 | return 0; | 727 | return 0; |
@@ -731,7 +731,6 @@ static int hwicap_remove(struct device *dev) | |||
731 | iounmap(drvdata->base_address); | 731 | iounmap(drvdata->base_address); |
732 | release_mem_region(drvdata->mem_start, drvdata->mem_size); | 732 | release_mem_region(drvdata->mem_start, drvdata->mem_size); |
733 | kfree(drvdata); | 733 | kfree(drvdata); |
734 | dev_set_drvdata(dev, NULL); | ||
735 | 734 | ||
736 | mutex_lock(&icap_sem); | 735 | mutex_lock(&icap_sem); |
737 | probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0; | 736 | probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0; |