aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c2
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c2
-rw-r--r--drivers/char/random.c6
-rw-r--r--drivers/char/rtc.c52
4 files changed, 44 insertions, 18 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index cc5d77797def..02518da6a386 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -47,7 +47,7 @@
47/* #define ATR_CSUM */ 47/* #define ATR_CSUM */
48 48
49#ifdef PCMCIA_DEBUG 49#ifdef PCMCIA_DEBUG
50#define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) 50#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
51static int pc_debug = PCMCIA_DEBUG; 51static int pc_debug = PCMCIA_DEBUG;
52module_param(pc_debug, int, 0600); 52module_param(pc_debug, int, 0600);
53#define DEBUGP(n, rdr, x, args...) do { \ 53#define DEBUGP(n, rdr, x, args...) do { \
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index a0b9c8728d56..5f291bf739a6 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -41,7 +41,7 @@
41 41
42 42
43#ifdef PCMCIA_DEBUG 43#ifdef PCMCIA_DEBUG
44#define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) 44#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
45static int pc_debug = PCMCIA_DEBUG; 45static int pc_debug = PCMCIA_DEBUG;
46module_param(pc_debug, int, 0600); 46module_param(pc_debug, int, 0600);
47#define DEBUGP(n, rdr, x, args...) do { \ 47#define DEBUGP(n, rdr, x, args...) do { \
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 1756b1f7cb72..5fee05661823 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1494,7 +1494,7 @@ __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
1494 seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; 1494 seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK;
1495 seq += keyptr->count; 1495 seq += keyptr->count;
1496 1496
1497 seq += ktime_get_real().tv64; 1497 seq += ktime_to_ns(ktime_get_real());
1498 1498
1499 return seq; 1499 return seq;
1500} 1500}
@@ -1556,7 +1556,7 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1556 * overlaps less than one time per MSL (2 minutes). 1556 * overlaps less than one time per MSL (2 minutes).
1557 * Choosing a clock of 64 ns period is OK. (period of 274 s) 1557 * Choosing a clock of 64 ns period is OK. (period of 274 s)
1558 */ 1558 */
1559 seq += ktime_get_real().tv64 >> 6; 1559 seq += ktime_to_ns(ktime_get_real()) >> 6;
1560#if 0 1560#if 0
1561 printk("init_seq(%lx, %lx, %d, %d) = %d\n", 1561 printk("init_seq(%lx, %lx, %d, %d) = %d\n",
1562 saddr, daddr, sport, dport, seq); 1562 saddr, daddr, sport, dport, seq);
@@ -1616,7 +1616,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
1616 seq = half_md4_transform(hash, keyptr->secret); 1616 seq = half_md4_transform(hash, keyptr->secret);
1617 seq |= ((u64)keyptr->count) << (32 - HASH_BITS); 1617 seq |= ((u64)keyptr->count) << (32 - HASH_BITS);
1618 1618
1619 seq += ktime_get_real().tv64; 1619 seq += ktime_to_ns(ktime_get_real());
1620 seq &= (1ull << 48) - 1; 1620 seq &= (1ull << 48) - 1;
1621#if 0 1621#if 0
1622 printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", 1622 printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n",
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index ec6b65ec69ea..0c66b802736a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -918,6 +918,31 @@ static const struct file_operations rtc_proc_fops = {
918}; 918};
919#endif 919#endif
920 920
921static resource_size_t rtc_size;
922
923static struct resource * __init rtc_request_region(resource_size_t size)
924{
925 struct resource *r;
926
927 if (RTC_IOMAPPED)
928 r = request_region(RTC_PORT(0), size, "rtc");
929 else
930 r = request_mem_region(RTC_PORT(0), size, "rtc");
931
932 if (r)
933 rtc_size = size;
934
935 return r;
936}
937
938static void rtc_release_region(void)
939{
940 if (RTC_IOMAPPED)
941 release_region(RTC_PORT(0), rtc_size);
942 else
943 release_mem_region(RTC_PORT(0), rtc_size);
944}
945
921static int __init rtc_init(void) 946static int __init rtc_init(void)
922{ 947{
923#ifdef CONFIG_PROC_FS 948#ifdef CONFIG_PROC_FS
@@ -968,10 +993,17 @@ found:
968 } 993 }
969no_irq: 994no_irq:
970#else 995#else
971 if (RTC_IOMAPPED) 996 r = rtc_request_region(RTC_IO_EXTENT);
972 r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); 997
973 else 998 /*
974 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); 999 * If we've already requested a smaller range (for example, because
1000 * PNPBIOS or ACPI told us how the device is configured), the request
1001 * above might fail because it's too big.
1002 *
1003 * If so, request just the range we actually use.
1004 */
1005 if (!r)
1006 r = rtc_request_region(RTC_IO_EXTENT_USED);
975 if (!r) { 1007 if (!r) {
976#ifdef RTC_IRQ 1008#ifdef RTC_IRQ
977 rtc_has_irq = 0; 1009 rtc_has_irq = 0;
@@ -992,10 +1024,7 @@ no_irq:
992 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ 1024 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
993 rtc_has_irq = 0; 1025 rtc_has_irq = 0;
994 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); 1026 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
995 if (RTC_IOMAPPED) 1027 rtc_release_region();
996 release_region(RTC_PORT(0), RTC_IO_EXTENT);
997 else
998 release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
999 return -EIO; 1028 return -EIO;
1000 } 1029 }
1001 hpet_rtc_timer_init(); 1030 hpet_rtc_timer_init();
@@ -1009,7 +1038,7 @@ no_irq:
1009 free_irq(RTC_IRQ, NULL); 1038 free_irq(RTC_IRQ, NULL);
1010 rtc_has_irq = 0; 1039 rtc_has_irq = 0;
1011#endif 1040#endif
1012 release_region(RTC_PORT(0), RTC_IO_EXTENT); 1041 rtc_release_region();
1013 return -ENODEV; 1042 return -ENODEV;
1014 } 1043 }
1015 1044
@@ -1091,10 +1120,7 @@ static void __exit rtc_exit (void)
1091 if (rtc_has_irq) 1120 if (rtc_has_irq)
1092 free_irq (rtc_irq, &rtc_port); 1121 free_irq (rtc_irq, &rtc_port);
1093#else 1122#else
1094 if (RTC_IOMAPPED) 1123 rtc_release_region();
1095 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1096 else
1097 release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
1098#ifdef RTC_IRQ 1124#ifdef RTC_IRQ
1099 if (rtc_has_irq) 1125 if (rtc_has_irq)
1100 free_irq (RTC_IRQ, NULL); 1126 free_irq (RTC_IRQ, NULL);