diff options
author | Paul Mackerras <paulus@samba.org> | 2007-04-29 22:38:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-29 22:38:01 -0400 |
commit | 49e1900d4cc2e7bcecb681fe60f0990bec2dcce8 (patch) | |
tree | 253801ebf57e0a23856a2c7be129c2c178f62fdf /drivers/char | |
parent | 34f6d749c0a328817d5e36274e53121c1db734dc (diff) | |
parent | b9099ff63c75216d6ca10bce5a1abcd9293c27e6 (diff) |
Merge branch 'linux-2.6' into for-2.6.22
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/mem.c | 2 | ||||
-rw-r--r-- | drivers/char/mxser.c | 48 | ||||
-rw-r--r-- | drivers/char/mxser_new.c | 45 | ||||
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 2 | ||||
-rw-r--r-- | drivers/char/random.c | 38 |
5 files changed, 45 insertions, 90 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index f5c160caf9f4..5f066963f171 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_mem(struct file *file, | |||
248 | { | 248 | { |
249 | if (!valid_mmap_phys_addr_range(pgoff, len)) | 249 | if (!valid_mmap_phys_addr_range(pgoff, len)) |
250 | return (unsigned long) -EINVAL; | 250 | return (unsigned long) -EINVAL; |
251 | return pgoff; | 251 | return pgoff << PAGE_SHIFT; |
252 | } | 252 | } |
253 | 253 | ||
254 | /* can't do an in-place private mapping if there's no MMU */ | 254 | /* can't do an in-place private mapping if there's no MMU */ |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index a61fb6da5d03..80a01150b86c 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -1338,43 +1338,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1338 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1338 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
1339 | * Caller should use TIOCGICOUNT to see which one it was | 1339 | * Caller should use TIOCGICOUNT to see which one it was |
1340 | */ | 1340 | */ |
1341 | case TIOCMIWAIT: { | 1341 | case TIOCMIWAIT: |
1342 | DECLARE_WAITQUEUE(wait, current); | 1342 | spin_lock_irqsave(&info->slock, flags); |
1343 | int ret; | 1343 | cnow = info->icount; /* note the counters on entry */ |
1344 | spin_unlock_irqrestore(&info->slock, flags); | ||
1345 | |||
1346 | wait_event_interruptible(info->delta_msr_wait, ({ | ||
1347 | cprev = cnow; | ||
1344 | spin_lock_irqsave(&info->slock, flags); | 1348 | spin_lock_irqsave(&info->slock, flags); |
1345 | cprev = info->icount; /* note the counters on entry */ | 1349 | cnow = info->icount; /* atomic copy */ |
1346 | spin_unlock_irqrestore(&info->slock, flags); | 1350 | spin_unlock_irqrestore(&info->slock, flags); |
1347 | 1351 | ||
1348 | add_wait_queue(&info->delta_msr_wait, &wait); | 1352 | ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
1349 | while (1) { | 1353 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
1350 | spin_lock_irqsave(&info->slock, flags); | 1354 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
1351 | cnow = info->icount; /* atomic copy */ | 1355 | ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)); |
1352 | spin_unlock_irqrestore(&info->slock, flags); | 1356 | })); |
1353 | 1357 | break; | |
1354 | set_current_state(TASK_INTERRUPTIBLE); | ||
1355 | if (((arg & TIOCM_RNG) && | ||
1356 | (cnow.rng != cprev.rng)) || | ||
1357 | ((arg & TIOCM_DSR) && | ||
1358 | (cnow.dsr != cprev.dsr)) || | ||
1359 | ((arg & TIOCM_CD) && | ||
1360 | (cnow.dcd != cprev.dcd)) || | ||
1361 | ((arg & TIOCM_CTS) && | ||
1362 | (cnow.cts != cprev.cts))) { | ||
1363 | ret = 0; | ||
1364 | break; | ||
1365 | } | ||
1366 | /* see if a signal did it */ | ||
1367 | if (signal_pending(current)) { | ||
1368 | ret = -ERESTARTSYS; | ||
1369 | break; | ||
1370 | } | ||
1371 | cprev = cnow; | ||
1372 | } | ||
1373 | current->state = TASK_RUNNING; | ||
1374 | remove_wait_queue(&info->delta_msr_wait, &wait); | ||
1375 | break; | ||
1376 | } | ||
1377 | /* NOTREACHED */ | ||
1378 | /* | 1358 | /* |
1379 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) | 1359 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) |
1380 | * Return: write counters to the user passed counter struct | 1360 | * Return: write counters to the user passed counter struct |
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 9af07e4999d5..f7603b6aeb87 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c | |||
@@ -1758,43 +1758,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, | |||
1758 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1758 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
1759 | * Caller should use TIOCGICOUNT to see which one it was | 1759 | * Caller should use TIOCGICOUNT to see which one it was |
1760 | */ | 1760 | */ |
1761 | case TIOCMIWAIT: { | 1761 | case TIOCMIWAIT: |
1762 | DECLARE_WAITQUEUE(wait, current); | ||
1763 | int ret; | ||
1764 | spin_lock_irqsave(&info->slock, flags); | 1762 | spin_lock_irqsave(&info->slock, flags); |
1765 | cprev = info->icount; /* note the counters on entry */ | 1763 | cnow = info->icount; /* note the counters on entry */ |
1766 | spin_unlock_irqrestore(&info->slock, flags); | 1764 | spin_unlock_irqrestore(&info->slock, flags); |
1767 | 1765 | ||
1768 | add_wait_queue(&info->delta_msr_wait, &wait); | 1766 | wait_event_interruptible(info->delta_msr_wait, ({ |
1769 | while (1) { | 1767 | cprev = cnow; |
1770 | spin_lock_irqsave(&info->slock, flags); | 1768 | spin_lock_irqsave(&info->slock, flags); |
1771 | cnow = info->icount; /* atomic copy */ | 1769 | cnow = info->icount; /* atomic copy */ |
1772 | spin_unlock_irqrestore(&info->slock, flags); | 1770 | spin_unlock_irqrestore(&info->slock, flags); |
1773 | 1771 | ||
1774 | set_current_state(TASK_INTERRUPTIBLE); | 1772 | ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
1775 | if (((arg & TIOCM_RNG) && | 1773 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
1776 | (cnow.rng != cprev.rng)) || | 1774 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
1777 | ((arg & TIOCM_DSR) && | 1775 | ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)); |
1778 | (cnow.dsr != cprev.dsr)) || | 1776 | })); |
1779 | ((arg & TIOCM_CD) && | ||
1780 | (cnow.dcd != cprev.dcd)) || | ||
1781 | ((arg & TIOCM_CTS) && | ||
1782 | (cnow.cts != cprev.cts))) { | ||
1783 | ret = 0; | ||
1784 | break; | ||
1785 | } | ||
1786 | /* see if a signal did it */ | ||
1787 | if (signal_pending(current)) { | ||
1788 | ret = -ERESTARTSYS; | ||
1789 | break; | ||
1790 | } | ||
1791 | cprev = cnow; | ||
1792 | } | ||
1793 | current->state = TASK_RUNNING; | ||
1794 | remove_wait_queue(&info->delta_msr_wait, &wait); | ||
1795 | break; | 1777 | break; |
1796 | } | ||
1797 | /* NOTREACHED */ | ||
1798 | /* | 1778 | /* |
1799 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) | 1779 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) |
1800 | * Return: write counters to the user passed counter struct | 1780 | * Return: write counters to the user passed counter struct |
@@ -2230,7 +2210,14 @@ end_intr: | |||
2230 | port->mon_data.rxcnt += cnt; | 2210 | port->mon_data.rxcnt += cnt; |
2231 | port->mon_data.up_rxcnt += cnt; | 2211 | port->mon_data.up_rxcnt += cnt; |
2232 | 2212 | ||
2213 | /* | ||
2214 | * We are called from an interrupt context with &port->slock | ||
2215 | * being held. Drop it temporarily in order to prevent | ||
2216 | * recursive locking. | ||
2217 | */ | ||
2218 | spin_unlock(&port->slock); | ||
2233 | tty_flip_buffer_push(tty); | 2219 | tty_flip_buffer_push(tty); |
2220 | spin_lock(&port->slock); | ||
2234 | } | 2221 | } |
2235 | 2222 | ||
2236 | static void mxser_transmit_chars(struct mxser_port *port) | 2223 | static void mxser_transmit_chars(struct mxser_port *port) |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 8d025e9b5bce..157b1d09ab55 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -4169,7 +4169,7 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4169 | netif_stop_queue(dev); | 4169 | netif_stop_queue(dev); |
4170 | 4170 | ||
4171 | /* copy data to device buffers */ | 4171 | /* copy data to device buffers */ |
4172 | memcpy(info->tx_buf, skb->data, skb->len); | 4172 | skb_copy_from_linear_data(skb, info->tx_buf, skb->len); |
4173 | info->tx_get = 0; | 4173 | info->tx_get = 0; |
4174 | info->tx_put = info->tx_count = skb->len; | 4174 | info->tx_put = info->tx_count = skb->len; |
4175 | 4175 | ||
diff --git a/drivers/char/random.c b/drivers/char/random.c index b9dc7aa1dfb3..46c1b97748b6 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -881,15 +881,15 @@ EXPORT_SYMBOL(get_random_bytes); | |||
881 | */ | 881 | */ |
882 | static void init_std_data(struct entropy_store *r) | 882 | static void init_std_data(struct entropy_store *r) |
883 | { | 883 | { |
884 | struct timeval tv; | 884 | ktime_t now; |
885 | unsigned long flags; | 885 | unsigned long flags; |
886 | 886 | ||
887 | spin_lock_irqsave(&r->lock, flags); | 887 | spin_lock_irqsave(&r->lock, flags); |
888 | r->entropy_count = 0; | 888 | r->entropy_count = 0; |
889 | spin_unlock_irqrestore(&r->lock, flags); | 889 | spin_unlock_irqrestore(&r->lock, flags); |
890 | 890 | ||
891 | do_gettimeofday(&tv); | 891 | now = ktime_get_real(); |
892 | add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4); | 892 | add_entropy_words(r, (__u32 *)&now, sizeof(now)/4); |
893 | add_entropy_words(r, (__u32 *)utsname(), | 893 | add_entropy_words(r, (__u32 *)utsname(), |
894 | sizeof(*(utsname()))/4); | 894 | sizeof(*(utsname()))/4); |
895 | } | 895 | } |
@@ -911,14 +911,12 @@ void rand_initialize_irq(int irq) | |||
911 | return; | 911 | return; |
912 | 912 | ||
913 | /* | 913 | /* |
914 | * If kmalloc returns null, we just won't use that entropy | 914 | * If kzalloc returns null, we just won't use that entropy |
915 | * source. | 915 | * source. |
916 | */ | 916 | */ |
917 | state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL); | 917 | state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL); |
918 | if (state) { | 918 | if (state) |
919 | memset(state, 0, sizeof(struct timer_rand_state)); | ||
920 | irq_timer_state[irq] = state; | 919 | irq_timer_state[irq] = state; |
921 | } | ||
922 | } | 920 | } |
923 | 921 | ||
924 | #ifdef CONFIG_BLOCK | 922 | #ifdef CONFIG_BLOCK |
@@ -927,14 +925,12 @@ void rand_initialize_disk(struct gendisk *disk) | |||
927 | struct timer_rand_state *state; | 925 | struct timer_rand_state *state; |
928 | 926 | ||
929 | /* | 927 | /* |
930 | * If kmalloc returns null, we just won't use that entropy | 928 | * If kzalloc returns null, we just won't use that entropy |
931 | * source. | 929 | * source. |
932 | */ | 930 | */ |
933 | state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL); | 931 | state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL); |
934 | if (state) { | 932 | if (state) |
935 | memset(state, 0, sizeof(struct timer_rand_state)); | ||
936 | disk->random = state; | 933 | disk->random = state; |
937 | } | ||
938 | } | 934 | } |
939 | #endif | 935 | #endif |
940 | 936 | ||
@@ -1469,7 +1465,6 @@ late_initcall(seqgen_init); | |||
1469 | __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, | 1465 | __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, |
1470 | __be16 sport, __be16 dport) | 1466 | __be16 sport, __be16 dport) |
1471 | { | 1467 | { |
1472 | struct timeval tv; | ||
1473 | __u32 seq; | 1468 | __u32 seq; |
1474 | __u32 hash[12]; | 1469 | __u32 hash[12]; |
1475 | struct keydata *keyptr = get_keyptr(); | 1470 | struct keydata *keyptr = get_keyptr(); |
@@ -1485,8 +1480,7 @@ __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, | |||
1485 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; | 1480 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; |
1486 | seq += keyptr->count; | 1481 | seq += keyptr->count; |
1487 | 1482 | ||
1488 | do_gettimeofday(&tv); | 1483 | seq += ktime_get_real().tv64; |
1489 | seq += tv.tv_usec + tv.tv_sec * 1000000; | ||
1490 | 1484 | ||
1491 | return seq; | 1485 | return seq; |
1492 | } | 1486 | } |
@@ -1521,7 +1515,6 @@ __u32 secure_ip_id(__be32 daddr) | |||
1521 | __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, | 1515 | __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, |
1522 | __be16 sport, __be16 dport) | 1516 | __be16 sport, __be16 dport) |
1523 | { | 1517 | { |
1524 | struct timeval tv; | ||
1525 | __u32 seq; | 1518 | __u32 seq; |
1526 | __u32 hash[4]; | 1519 | __u32 hash[4]; |
1527 | struct keydata *keyptr = get_keyptr(); | 1520 | struct keydata *keyptr = get_keyptr(); |
@@ -1543,12 +1536,11 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, | |||
1543 | * As close as possible to RFC 793, which | 1536 | * As close as possible to RFC 793, which |
1544 | * suggests using a 250 kHz clock. | 1537 | * suggests using a 250 kHz clock. |
1545 | * Further reading shows this assumes 2 Mb/s networks. | 1538 | * Further reading shows this assumes 2 Mb/s networks. |
1546 | * For 10 Mb/s Ethernet, a 1 MHz clock is appropriate. | 1539 | * For 10 Gb/s Ethernet, a 1 GHz clock is appropriate. |
1547 | * That's funny, Linux has one built in! Use it! | 1540 | * That's funny, Linux has one built in! Use it! |
1548 | * (Networks are faster now - should this be increased?) | 1541 | * (Networks are faster now - should this be increased?) |
1549 | */ | 1542 | */ |
1550 | do_gettimeofday(&tv); | 1543 | seq += ktime_get_real().tv64; |
1551 | seq += tv.tv_usec + tv.tv_sec * 1000000; | ||
1552 | #if 0 | 1544 | #if 0 |
1553 | printk("init_seq(%lx, %lx, %d, %d) = %d\n", | 1545 | printk("init_seq(%lx, %lx, %d, %d) = %d\n", |
1554 | saddr, daddr, sport, dport, seq); | 1546 | saddr, daddr, sport, dport, seq); |
@@ -1556,8 +1548,6 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, | |||
1556 | return seq; | 1548 | return seq; |
1557 | } | 1549 | } |
1558 | 1550 | ||
1559 | EXPORT_SYMBOL(secure_tcp_sequence_number); | ||
1560 | |||
1561 | /* Generate secure starting point for ephemeral IPV4 transport port search */ | 1551 | /* Generate secure starting point for ephemeral IPV4 transport port search */ |
1562 | u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) | 1552 | u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) |
1563 | { | 1553 | { |
@@ -1598,7 +1588,6 @@ u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, __be16 | |||
1598 | u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, | 1588 | u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, |
1599 | __be16 sport, __be16 dport) | 1589 | __be16 sport, __be16 dport) |
1600 | { | 1590 | { |
1601 | struct timeval tv; | ||
1602 | u64 seq; | 1591 | u64 seq; |
1603 | __u32 hash[4]; | 1592 | __u32 hash[4]; |
1604 | struct keydata *keyptr = get_keyptr(); | 1593 | struct keydata *keyptr = get_keyptr(); |
@@ -1611,8 +1600,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, | |||
1611 | seq = half_md4_transform(hash, keyptr->secret); | 1600 | seq = half_md4_transform(hash, keyptr->secret); |
1612 | seq |= ((u64)keyptr->count) << (32 - HASH_BITS); | 1601 | seq |= ((u64)keyptr->count) << (32 - HASH_BITS); |
1613 | 1602 | ||
1614 | do_gettimeofday(&tv); | 1603 | seq += ktime_get_real().tv64; |
1615 | seq += tv.tv_usec + tv.tv_sec * 1000000; | ||
1616 | seq &= (1ull << 48) - 1; | 1604 | seq &= (1ull << 48) - 1; |
1617 | #if 0 | 1605 | #if 0 |
1618 | printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", | 1606 | printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", |