aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/.gitignore2
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/hangcheck-timer.c2
-rw-r--r--drivers/char/hw_random.c70
-rw-r--r--drivers/char/ip2/i2pack.h2
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c4
-rw-r--r--drivers/char/mmtimer.c90
-rw-r--r--drivers/char/n_hdlc.c2
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c162
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c151
-rw-r--r--drivers/char/pcmcia/synclink_cs.c132
-rw-r--r--drivers/char/random.c10
-rw-r--r--drivers/char/watchdog/Kconfig2
-rw-r--r--drivers/char/watchdog/ixp4xx_wdt.c4
-rw-r--r--drivers/char/watchdog/pcwd_usb.c1
15 files changed, 274 insertions, 362 deletions
diff --git a/drivers/char/.gitignore b/drivers/char/.gitignore
index 2b6b1d772ed7..73dfdcebfbba 100644
--- a/drivers/char/.gitignore
+++ b/drivers/char/.gitignore
@@ -1,3 +1,3 @@
1consolemap_deftbl.c 1consolemap_deftbl.c
2defkeymap.c 2defkeymap.c
3 3qtronixmap.c
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 84e68cdd451b..5ebd06b1b4ca 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -985,7 +985,7 @@ config HPET_MMAP
985 985
986config HANGCHECK_TIMER 986config HANGCHECK_TIMER
987 tristate "Hangcheck timer" 987 tristate "Hangcheck timer"
988 depends on X86 || IA64 || PPC64 || ARCH_S390 988 depends on X86 || IA64 || PPC64 || S390
989 help 989 help
990 The hangcheck-timer module detects when the system has gone 990 The hangcheck-timer module detects when the system has gone
991 out to lunch past a certain margin. It can reboot the system 991 out to lunch past a certain margin. It can reboot the system
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index 66e53dd450ff..40a67c86420c 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -120,7 +120,7 @@ __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks);
120#if defined(CONFIG_X86) 120#if defined(CONFIG_X86)
121# define HAVE_MONOTONIC 121# define HAVE_MONOTONIC
122# define TIMER_FREQ 1000000000ULL 122# define TIMER_FREQ 1000000000ULL
123#elif defined(CONFIG_ARCH_S390) 123#elif defined(CONFIG_S390)
124/* FA240000 is 1 Second in the IBM time universe (Page 4-38 Principles of Op for zSeries */ 124/* FA240000 is 1 Second in the IBM time universe (Page 4-38 Principles of Op for zSeries */
125# define TIMER_FREQ 0xFA240000ULL 125# define TIMER_FREQ 0xFA240000ULL
126#elif defined(CONFIG_IA64) 126#elif defined(CONFIG_IA64)
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c
index 6f673d2de0b1..49769f59ea1b 100644
--- a/drivers/char/hw_random.c
+++ b/drivers/char/hw_random.c
@@ -1,4 +1,9 @@
1/* 1/*
2 Added support for the AMD Geode LX RNG
3 (c) Copyright 2004-2005 Advanced Micro Devices, Inc.
4
5 derived from
6
2 Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) 7 Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG)
3 (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> 8 (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com>
4 9
@@ -95,6 +100,11 @@ static unsigned int via_data_present (void);
95static u32 via_data_read (void); 100static u32 via_data_read (void);
96#endif 101#endif
97 102
103static int __init geode_init(struct pci_dev *dev);
104static void geode_cleanup(void);
105static unsigned int geode_data_present (void);
106static u32 geode_data_read (void);
107
98struct rng_operations { 108struct rng_operations {
99 int (*init) (struct pci_dev *dev); 109 int (*init) (struct pci_dev *dev);
100 void (*cleanup) (void); 110 void (*cleanup) (void);
@@ -122,6 +132,7 @@ enum {
122 rng_hw_intel, 132 rng_hw_intel,
123 rng_hw_amd, 133 rng_hw_amd,
124 rng_hw_via, 134 rng_hw_via,
135 rng_hw_geode,
125}; 136};
126 137
127static struct rng_operations rng_vendor_ops[] = { 138static struct rng_operations rng_vendor_ops[] = {
@@ -139,6 +150,9 @@ static struct rng_operations rng_vendor_ops[] = {
139 /* rng_hw_via */ 150 /* rng_hw_via */
140 { via_init, via_cleanup, via_data_present, via_data_read, 1 }, 151 { via_init, via_cleanup, via_data_present, via_data_read, 1 },
141#endif 152#endif
153
154 /* rng_hw_geode */
155 { geode_init, geode_cleanup, geode_data_present, geode_data_read, 4 }
142}; 156};
143 157
144/* 158/*
@@ -159,6 +173,9 @@ static struct pci_device_id rng_pci_tbl[] = {
159 { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, 173 { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel },
160 { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, 174 { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel },
161 175
176 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_AES,
177 PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_geode },
178
162 { 0, }, /* terminate list */ 179 { 0, }, /* terminate list */
163}; 180};
164MODULE_DEVICE_TABLE (pci, rng_pci_tbl); 181MODULE_DEVICE_TABLE (pci, rng_pci_tbl);
@@ -460,6 +477,57 @@ static void via_cleanup(void)
460} 477}
461#endif 478#endif
462 479
480/***********************************************************************
481 *
482 * AMD Geode RNG operations
483 *
484 */
485
486static void __iomem *geode_rng_base = NULL;
487
488#define GEODE_RNG_DATA_REG 0x50
489#define GEODE_RNG_STATUS_REG 0x54
490
491static u32 geode_data_read(void)
492{
493 u32 val;
494
495 assert(geode_rng_base != NULL);
496 val = readl(geode_rng_base + GEODE_RNG_DATA_REG);
497 return val;
498}
499
500static unsigned int geode_data_present(void)
501{
502 u32 val;
503
504 assert(geode_rng_base != NULL);
505 val = readl(geode_rng_base + GEODE_RNG_STATUS_REG);
506 return val;
507}
508
509static void geode_cleanup(void)
510{
511 iounmap(geode_rng_base);
512 geode_rng_base = NULL;
513}
514
515static int geode_init(struct pci_dev *dev)
516{
517 unsigned long rng_base = pci_resource_start(dev, 0);
518
519 if (rng_base == 0)
520 return 1;
521
522 geode_rng_base = ioremap(rng_base, 0x58);
523
524 if (geode_rng_base == NULL) {
525 printk(KERN_ERR PFX "Cannot ioremap RNG memory\n");
526 return -EBUSY;
527 }
528
529 return 0;
530}
463 531
464/*********************************************************************** 532/***********************************************************************
465 * 533 *
@@ -574,7 +642,7 @@ static int __init rng_init (void)
574 642
575 DPRINTK ("ENTER\n"); 643 DPRINTK ("ENTER\n");
576 644
577 /* Probe for Intel, AMD RNGs */ 645 /* Probe for Intel, AMD, Geode RNGs */
578 for_each_pci_dev(pdev) { 646 for_each_pci_dev(pdev) {
579 ent = pci_match_id(rng_pci_tbl, pdev); 647 ent = pci_match_id(rng_pci_tbl, pdev);
580 if (ent) { 648 if (ent) {
diff --git a/drivers/char/ip2/i2pack.h b/drivers/char/ip2/i2pack.h
index e9b87a78622c..00342a677c90 100644
--- a/drivers/char/ip2/i2pack.h
+++ b/drivers/char/ip2/i2pack.h
@@ -358,7 +358,7 @@ typedef struct _failStat
358#define MB_OUT_STRIPPED 0x40 // Board has read all output from fifo 358#define MB_OUT_STRIPPED 0x40 // Board has read all output from fifo
359#define MB_FATAL_ERROR 0x20 // Board has encountered a fatal error 359#define MB_FATAL_ERROR 0x20 // Board has encountered a fatal error
360 360
361#pragma pack(4) // Reset padding to command-line default 361#pragma pack() // Reset padding to command-line default
362 362
363#endif // I2PACK_H 363#endif // I2PACK_H
364 364
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 1f56b4cf0f58..561430ed94af 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -787,7 +787,6 @@ int ipmi_destroy_user(ipmi_user_t user)
787 int i; 787 int i;
788 unsigned long flags; 788 unsigned long flags;
789 struct cmd_rcvr *rcvr; 789 struct cmd_rcvr *rcvr;
790 struct list_head *entry1, *entry2;
791 struct cmd_rcvr *rcvrs = NULL; 790 struct cmd_rcvr *rcvrs = NULL;
792 791
793 user->valid = 1; 792 user->valid = 1;
@@ -812,8 +811,7 @@ int ipmi_destroy_user(ipmi_user_t user)
812 * synchronize_rcu()) then free everything in that list. 811 * synchronize_rcu()) then free everything in that list.
813 */ 812 */
814 down(&intf->cmd_rcvrs_lock); 813 down(&intf->cmd_rcvrs_lock);
815 list_for_each_safe_rcu(entry1, entry2, &intf->cmd_rcvrs) { 814 list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) {
816 rcvr = list_entry(entry1, struct cmd_rcvr, link);
817 if (rcvr->user == user) { 815 if (rcvr->user == user) {
818 list_del_rcu(&rcvr->link); 816 list_del_rcu(&rcvr->link);
819 rcvr->next = rcvrs; 817 rcvr->next = rcvrs;
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 78c89a3e7825..c92378121b4c 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * Intel Multimedia Timer device implementation for SGI SN platforms. 2 * Timer device implementation for SGI SN platforms.
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (c) 2001-2006 Silicon Graphics, Inc. All rights reserved.
9 * 9 *
10 * This driver exports an API that should be supportable by any HPET or IA-PC 10 * This driver exports an API that should be supportable by any HPET or IA-PC
11 * multimedia timer. The code below is currently specific to the SGI Altix 11 * multimedia timer. The code below is currently specific to the SGI Altix
@@ -45,7 +45,7 @@ MODULE_LICENSE("GPL");
45/* name of the device, usually in /dev */ 45/* name of the device, usually in /dev */
46#define MMTIMER_NAME "mmtimer" 46#define MMTIMER_NAME "mmtimer"
47#define MMTIMER_DESC "SGI Altix RTC Timer" 47#define MMTIMER_DESC "SGI Altix RTC Timer"
48#define MMTIMER_VERSION "2.0" 48#define MMTIMER_VERSION "2.1"
49 49
50#define RTC_BITS 55 /* 55 bits for this implementation */ 50#define RTC_BITS 55 /* 55 bits for this implementation */
51 51
@@ -227,10 +227,7 @@ typedef struct mmtimer {
227 struct tasklet_struct tasklet; 227 struct tasklet_struct tasklet;
228} mmtimer_t; 228} mmtimer_t;
229 229
230/* 230static mmtimer_t ** timers;
231 * Total number of comparators is comparators/node * MAX nodes/running kernel
232 */
233static mmtimer_t timers[NUM_COMPARATORS*MAX_COMPACT_NODES];
234 231
235/** 232/**
236 * mmtimer_ioctl - ioctl interface for /dev/mmtimer 233 * mmtimer_ioctl - ioctl interface for /dev/mmtimer
@@ -441,29 +438,29 @@ static irqreturn_t
441mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 438mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
442{ 439{
443 int i; 440 int i;
444 mmtimer_t *base = timers + cpu_to_node(smp_processor_id()) *
445 NUM_COMPARATORS;
446 unsigned long expires = 0; 441 unsigned long expires = 0;
447 int result = IRQ_NONE; 442 int result = IRQ_NONE;
443 unsigned indx = cpu_to_node(smp_processor_id());
448 444
449 /* 445 /*
450 * Do this once for each comparison register 446 * Do this once for each comparison register
451 */ 447 */
452 for (i = 0; i < NUM_COMPARATORS; i++) { 448 for (i = 0; i < NUM_COMPARATORS; i++) {
449 mmtimer_t *base = timers[indx] + i;
453 /* Make sure this doesn't get reused before tasklet_sched */ 450 /* Make sure this doesn't get reused before tasklet_sched */
454 spin_lock(&base[i].lock); 451 spin_lock(&base->lock);
455 if (base[i].cpu == smp_processor_id()) { 452 if (base->cpu == smp_processor_id()) {
456 if (base[i].timer) 453 if (base->timer)
457 expires = base[i].timer->it.mmtimer.expires; 454 expires = base->timer->it.mmtimer.expires;
458 /* expires test won't work with shared irqs */ 455 /* expires test won't work with shared irqs */
459 if ((mmtimer_int_pending(i) > 0) || 456 if ((mmtimer_int_pending(i) > 0) ||
460 (expires && (expires < rtc_time()))) { 457 (expires && (expires < rtc_time()))) {
461 mmtimer_clr_int_pending(i); 458 mmtimer_clr_int_pending(i);
462 tasklet_schedule(&base[i].tasklet); 459 tasklet_schedule(&base->tasklet);
463 result = IRQ_HANDLED; 460 result = IRQ_HANDLED;
464 } 461 }
465 } 462 }
466 spin_unlock(&base[i].lock); 463 spin_unlock(&base->lock);
467 expires = 0; 464 expires = 0;
468 } 465 }
469 return result; 466 return result;
@@ -523,7 +520,7 @@ static int sgi_timer_del(struct k_itimer *timr)
523{ 520{
524 int i = timr->it.mmtimer.clock; 521 int i = timr->it.mmtimer.clock;
525 cnodeid_t nodeid = timr->it.mmtimer.node; 522 cnodeid_t nodeid = timr->it.mmtimer.node;
526 mmtimer_t *t = timers + nodeid * NUM_COMPARATORS +i; 523 mmtimer_t *t = timers[nodeid] + i;
527 unsigned long irqflags; 524 unsigned long irqflags;
528 525
529 if (i != TIMER_OFF) { 526 if (i != TIMER_OFF) {
@@ -609,11 +606,11 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
609 preempt_disable(); 606 preempt_disable();
610 607
611 nodeid = cpu_to_node(smp_processor_id()); 608 nodeid = cpu_to_node(smp_processor_id());
612 base = timers + nodeid * NUM_COMPARATORS;
613retry: 609retry:
614 /* Don't use an allocated timer, or a deleted one that's pending */ 610 /* Don't use an allocated timer, or a deleted one that's pending */
615 for(i = 0; i< NUM_COMPARATORS; i++) { 611 for(i = 0; i< NUM_COMPARATORS; i++) {
616 if (!base[i].timer && !base[i].tasklet.state) { 612 base = timers[nodeid] + i;
613 if (!base->timer && !base->tasklet.state) {
617 break; 614 break;
618 } 615 }
619 } 616 }
@@ -623,14 +620,14 @@ retry:
623 return -EBUSY; 620 return -EBUSY;
624 } 621 }
625 622
626 spin_lock_irqsave(&base[i].lock, irqflags); 623 spin_lock_irqsave(&base->lock, irqflags);
627 624
628 if (base[i].timer || base[i].tasklet.state != 0) { 625 if (base->timer || base->tasklet.state != 0) {
629 spin_unlock_irqrestore(&base[i].lock, irqflags); 626 spin_unlock_irqrestore(&base->lock, irqflags);
630 goto retry; 627 goto retry;
631 } 628 }
632 base[i].timer = timr; 629 base->timer = timr;
633 base[i].cpu = smp_processor_id(); 630 base->cpu = smp_processor_id();
634 631
635 timr->it.mmtimer.clock = i; 632 timr->it.mmtimer.clock = i;
636 timr->it.mmtimer.node = nodeid; 633 timr->it.mmtimer.node = nodeid;
@@ -645,11 +642,11 @@ retry:
645 } 642 }
646 } else { 643 } else {
647 timr->it.mmtimer.expires -= period; 644 timr->it.mmtimer.expires -= period;
648 if (reschedule_periodic_timer(base+i)) 645 if (reschedule_periodic_timer(base))
649 err = -EINVAL; 646 err = -EINVAL;
650 } 647 }
651 648
652 spin_unlock_irqrestore(&base[i].lock, irqflags); 649 spin_unlock_irqrestore(&base->lock, irqflags);
653 650
654 preempt_enable(); 651 preempt_enable();
655 652
@@ -675,6 +672,7 @@ static struct k_clock sgi_clock = {
675static int __init mmtimer_init(void) 672static int __init mmtimer_init(void)
676{ 673{
677 unsigned i; 674 unsigned i;
675 cnodeid_t node, maxn = -1;
678 676
679 if (!ia64_platform_is("sn2")) 677 if (!ia64_platform_is("sn2"))
680 return -1; 678 return -1;
@@ -691,14 +689,6 @@ static int __init mmtimer_init(void)
691 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / 689 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second /
692 2) / sn_rtc_cycles_per_second; 690 2) / sn_rtc_cycles_per_second;
693 691
694 for (i=0; i< NUM_COMPARATORS*MAX_COMPACT_NODES; i++) {
695 spin_lock_init(&timers[i].lock);
696 timers[i].timer = NULL;
697 timers[i].cpu = 0;
698 timers[i].i = i % NUM_COMPARATORS;
699 tasklet_init(&timers[i].tasklet, mmtimer_tasklet, (unsigned long) (timers+i));
700 }
701
702 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) { 692 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) {
703 printk(KERN_WARNING "%s: unable to allocate interrupt.", 693 printk(KERN_WARNING "%s: unable to allocate interrupt.",
704 MMTIMER_NAME); 694 MMTIMER_NAME);
@@ -712,6 +702,40 @@ static int __init mmtimer_init(void)
712 return -1; 702 return -1;
713 } 703 }
714 704
705 /* Get max numbered node, calculate slots needed */
706 for_each_online_node(node) {
707 maxn = node;
708 }
709 maxn++;
710
711 /* Allocate list of node ptrs to mmtimer_t's */
712 timers = kmalloc(sizeof(mmtimer_t *)*maxn, GFP_KERNEL);
713 if (timers == NULL) {
714 printk(KERN_ERR "%s: failed to allocate memory for device\n",
715 MMTIMER_NAME);
716 return -1;
717 }
718
719 /* Allocate mmtimer_t's for each online node */
720 for_each_online_node(node) {
721 timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node);
722 if (timers[node] == NULL) {
723 printk(KERN_ERR "%s: failed to allocate memory for device\n",
724 MMTIMER_NAME);
725 return -1;
726 }
727 for (i=0; i< NUM_COMPARATORS; i++) {
728 mmtimer_t * base = timers[node] + i;
729
730 spin_lock_init(&base->lock);
731 base->timer = NULL;
732 base->cpu = 0;
733 base->i = i;
734 tasklet_init(&base->tasklet, mmtimer_tasklet,
735 (unsigned long) (base));
736 }
737 }
738
715 sgi_clock_period = sgi_clock.res = NSEC_PER_SEC / sn_rtc_cycles_per_second; 739 sgi_clock_period = sgi_clock.res = NSEC_PER_SEC / sn_rtc_cycles_per_second;
716 register_posix_clock(CLOCK_SGI_CYCLE, &sgi_clock); 740 register_posix_clock(CLOCK_SGI_CYCLE, &sgi_clock);
717 741
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index c3660d8781a4..a133a62f3d55 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -562,7 +562,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
562} /* end of n_hdlc_tty_receive() */ 562} /* end of n_hdlc_tty_receive() */
563 563
564/** 564/**
565 * n_hdlc_tty_read - Called to retreive one frame of data (if available) 565 * n_hdlc_tty_read - Called to retrieve one frame of data (if available)
566 * @tty - pointer to tty instance data 566 * @tty - pointer to tty instance data
567 * @file - pointer to open file object 567 * @file - pointer to open file object
568 * @buf - pointer to returned data buffer 568 * @buf - pointer to returned data buffer
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 61681c9f3f72..649677b5dc36 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -66,7 +66,6 @@ static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte";
66#define T_100MSEC msecs_to_jiffies(100) 66#define T_100MSEC msecs_to_jiffies(100)
67#define T_500MSEC msecs_to_jiffies(500) 67#define T_500MSEC msecs_to_jiffies(500)
68 68
69static void cm4000_detach(dev_link_t *link);
70static void cm4000_release(dev_link_t *link); 69static void cm4000_release(dev_link_t *link);
71 70
72static int major; /* major number we get from the kernel */ 71static int major; /* major number we get from the kernel */
@@ -156,7 +155,6 @@ struct cm4000_dev {
156 /*sbuf*/ 512*sizeof(char) - \ 155 /*sbuf*/ 512*sizeof(char) - \
157 /*queue*/ 4*sizeof(wait_queue_head_t)) 156 /*queue*/ 4*sizeof(wait_queue_head_t))
158 157
159static dev_info_t dev_info = MODULE_NAME;
160static dev_link_t *dev_table[CM4000_MAX_DEV]; 158static dev_link_t *dev_table[CM4000_MAX_DEV];
161 159
162/* This table doesn't use spaces after the comma between fields and thus 160/* This table doesn't use spaces after the comma between fields and thus
@@ -1864,68 +1862,36 @@ cs_release:
1864 link->state &= ~DEV_CONFIG_PENDING; 1862 link->state &= ~DEV_CONFIG_PENDING;
1865} 1863}
1866 1864
1867static int cm4000_event(event_t event, int priority, 1865static int cm4000_suspend(struct pcmcia_device *p_dev)
1868 event_callback_args_t *args)
1869{ 1866{
1870 dev_link_t *link; 1867 dev_link_t *link = dev_to_instance(p_dev);
1871 struct cm4000_dev *dev; 1868 struct cm4000_dev *dev;
1872 int devno;
1873 1869
1874 link = args->client_data;
1875 dev = link->priv; 1870 dev = link->priv;
1876 1871
1877 DEBUGP(3, dev, "-> cm4000_event\n"); 1872 link->state |= DEV_SUSPEND;
1878 for (devno = 0; devno < CM4000_MAX_DEV; devno++) 1873 if (link->state & DEV_CONFIG)
1879 if (dev_table[devno] == link) 1874 pcmcia_release_configuration(link->handle);
1880 break; 1875 stop_monitor(dev);
1881 1876
1882 if (devno == CM4000_MAX_DEV) 1877 return 0;
1883 return CS_BAD_ADAPTER; 1878}
1884 1879
1885 switch (event) { 1880static int cm4000_resume(struct pcmcia_device *p_dev)
1886 case CS_EVENT_CARD_INSERTION: 1881{
1887 DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); 1882 dev_link_t *link = dev_to_instance(p_dev);
1888 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1883 struct cm4000_dev *dev;
1889 cm4000_config(link, devno); 1884
1890 break; 1885 dev = link->priv;
1891 case CS_EVENT_CARD_REMOVAL: 1886
1892 DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); 1887 link->state &= ~DEV_SUSPEND;
1893 link->state &= ~DEV_PRESENT; 1888 if (link->state & DEV_CONFIG)
1894 stop_monitor(dev); 1889 pcmcia_request_configuration(link->handle, &link->conf);
1895 break; 1890
1896 case CS_EVENT_PM_SUSPEND: 1891 if (link->open)
1897 DEBUGP(5, dev, "CS_EVENT_PM_SUSPEND " 1892 start_monitor(dev);
1898 "(fall-through to CS_EVENT_RESET_PHYSICAL)\n"); 1893
1899 link->state |= DEV_SUSPEND; 1894 return 0;
1900 /* fall-through */
1901 case CS_EVENT_RESET_PHYSICAL:
1902 DEBUGP(5, dev, "CS_EVENT_RESET_PHYSICAL\n");
1903 if (link->state & DEV_CONFIG) {
1904 DEBUGP(5, dev, "ReleaseConfiguration\n");
1905 pcmcia_release_configuration(link->handle);
1906 }
1907 stop_monitor(dev);
1908 break;
1909 case CS_EVENT_PM_RESUME:
1910 DEBUGP(5, dev, "CS_EVENT_PM_RESUME "
1911 "(fall-through to CS_EVENT_CARD_RESET)\n");
1912 link->state &= ~DEV_SUSPEND;
1913 /* fall-through */
1914 case CS_EVENT_CARD_RESET:
1915 DEBUGP(5, dev, "CS_EVENT_CARD_RESET\n");
1916 if ((link->state & DEV_CONFIG)) {
1917 DEBUGP(5, dev, "RequestConfiguration\n");
1918 pcmcia_request_configuration(link->handle, &link->conf);
1919 }
1920 if (link->open)
1921 start_monitor(dev);
1922 break;
1923 default:
1924 DEBUGP(5, dev, "unknown event %.2x\n", event);
1925 break;
1926 }
1927 DEBUGP(3, dev, "<- cm4000_event\n");
1928 return CS_SUCCESS;
1929} 1895}
1930 1896
1931static void cm4000_release(dev_link_t *link) 1897static void cm4000_release(dev_link_t *link)
@@ -1935,11 +1901,10 @@ static void cm4000_release(dev_link_t *link)
1935 pcmcia_release_io(link->handle, &link->io); 1901 pcmcia_release_io(link->handle, &link->io);
1936} 1902}
1937 1903
1938static dev_link_t *cm4000_attach(void) 1904static int cm4000_attach(struct pcmcia_device *p_dev)
1939{ 1905{
1940 struct cm4000_dev *dev; 1906 struct cm4000_dev *dev;
1941 dev_link_t *link; 1907 dev_link_t *link;
1942 client_reg_t client_reg;
1943 int i; 1908 int i;
1944 1909
1945 for (i = 0; i < CM4000_MAX_DEV; i++) 1910 for (i = 0; i < CM4000_MAX_DEV; i++)
@@ -1948,76 +1913,55 @@ static dev_link_t *cm4000_attach(void)
1948 1913
1949 if (i == CM4000_MAX_DEV) { 1914 if (i == CM4000_MAX_DEV) {
1950 printk(KERN_NOTICE MODULE_NAME ": all devices in use\n"); 1915 printk(KERN_NOTICE MODULE_NAME ": all devices in use\n");
1951 return NULL; 1916 return -ENODEV;
1952 } 1917 }
1953 1918
1954 /* create a new cm4000_cs device */ 1919 /* create a new cm4000_cs device */
1955 dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL); 1920 dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL);
1956 if (dev == NULL) 1921 if (dev == NULL)
1957 return NULL; 1922 return -ENOMEM;
1958 1923
1959 link = &dev->link; 1924 link = &dev->link;
1960 link->priv = dev; 1925 link->priv = dev;
1961 link->conf.IntType = INT_MEMORY_AND_IO; 1926 link->conf.IntType = INT_MEMORY_AND_IO;
1962 dev_table[i] = link; 1927 dev_table[i] = link;
1963 1928
1964 /* register with card services */
1965 client_reg.dev_info = &dev_info;
1966 client_reg.EventMask =
1967 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
1968 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
1969 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
1970 client_reg.Version = 0x0210;
1971 client_reg.event_callback_args.client_data = link;
1972
1973 i = pcmcia_register_client(&link->handle, &client_reg);
1974 if (i) {
1975 cs_error(link->handle, RegisterClient, i);
1976 cm4000_detach(link);
1977 return NULL;
1978 }
1979
1980 init_waitqueue_head(&dev->devq); 1929 init_waitqueue_head(&dev->devq);
1981 init_waitqueue_head(&dev->ioq); 1930 init_waitqueue_head(&dev->ioq);
1982 init_waitqueue_head(&dev->atrq); 1931 init_waitqueue_head(&dev->atrq);
1983 init_waitqueue_head(&dev->readq); 1932 init_waitqueue_head(&dev->readq);
1984 1933
1985 return link; 1934 link->handle = p_dev;
1986} 1935 p_dev->instance = link;
1987
1988static void cm4000_detach_by_devno(int devno, dev_link_t * link)
1989{
1990 struct cm4000_dev *dev = link->priv;
1991
1992 DEBUGP(3, dev, "-> detach_by_devno(devno=%d)\n", devno);
1993
1994 if (link->state & DEV_CONFIG) {
1995 DEBUGP(5, dev, "device still configured (try to release it)\n");
1996 cm4000_release(link);
1997 }
1998 1936
1999 if (link->handle) { 1937 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
2000 pcmcia_deregister_client(link->handle); 1938 cm4000_config(link, i);
2001 }
2002 1939
2003 dev_table[devno] = NULL; 1940 return 0;
2004 kfree(dev);
2005 return;
2006} 1941}
2007 1942
2008static void cm4000_detach(dev_link_t * link) 1943static void cm4000_detach(struct pcmcia_device *p_dev)
2009{ 1944{
2010 int i; 1945 dev_link_t *link = dev_to_instance(p_dev);
1946 struct cm4000_dev *dev = link->priv;
1947 int devno;
2011 1948
2012 /* find device */ 1949 /* find device */
2013 for (i = 0; i < CM4000_MAX_DEV; i++) 1950 for (devno = 0; devno < CM4000_MAX_DEV; devno++)
2014 if (dev_table[i] == link) 1951 if (dev_table[devno] == link)
2015 break; 1952 break;
2016 1953 if (devno == CM4000_MAX_DEV)
2017 if (i == CM4000_MAX_DEV)
2018 return; 1954 return;
2019 1955
2020 cm4000_detach_by_devno(i, link); 1956 link->state &= ~DEV_PRESENT;
1957 stop_monitor(dev);
1958
1959 if (link->state & DEV_CONFIG)
1960 cm4000_release(link);
1961
1962 dev_table[devno] = NULL;
1963 kfree(dev);
1964
2021 return; 1965 return;
2022} 1966}
2023 1967
@@ -2042,9 +1986,10 @@ static struct pcmcia_driver cm4000_driver = {
2042 .drv = { 1986 .drv = {
2043 .name = "cm4000_cs", 1987 .name = "cm4000_cs",
2044 }, 1988 },
2045 .attach = cm4000_attach, 1989 .probe = cm4000_attach,
2046 .detach = cm4000_detach, 1990 .remove = cm4000_detach,
2047 .event = cm4000_event, 1991 .suspend = cm4000_suspend,
1992 .resume = cm4000_resume,
2048 .id_table = cm4000_ids, 1993 .id_table = cm4000_ids,
2049}; 1994};
2050 1995
@@ -2064,13 +2009,8 @@ static int __init cmm_init(void)
2064 2009
2065static void __exit cmm_exit(void) 2010static void __exit cmm_exit(void)
2066{ 2011{
2067 int i;
2068
2069 printk(KERN_INFO MODULE_NAME ": unloading\n"); 2012 printk(KERN_INFO MODULE_NAME ": unloading\n");
2070 pcmcia_unregister_driver(&cm4000_driver); 2013 pcmcia_unregister_driver(&cm4000_driver);
2071 for (i = 0; i < CM4000_MAX_DEV; i++)
2072 if (dev_table[i])
2073 cm4000_detach_by_devno(i, dev_table[i]);
2074 unregister_chrdev(major, DEVICE_NAME); 2014 unregister_chrdev(major, DEVICE_NAME);
2075}; 2015};
2076 2016
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 4c698d908ffa..46eb371bf17e 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -65,7 +65,6 @@ static char *version =
65#define POLL_PERIOD msecs_to_jiffies(10) 65#define POLL_PERIOD msecs_to_jiffies(10)
66 66
67static void reader_release(dev_link_t *link); 67static void reader_release(dev_link_t *link);
68static void reader_detach(dev_link_t *link);
69 68
70static int major; 69static int major;
71 70
@@ -86,7 +85,6 @@ struct reader_dev {
86 struct timer_list poll_timer; 85 struct timer_list poll_timer;
87}; 86};
88 87
89static dev_info_t dev_info = MODULE_NAME;
90static dev_link_t *dev_table[CM_MAX_DEV]; 88static dev_link_t *dev_table[CM_MAX_DEV];
91 89
92#ifndef PCMCIA_DEBUG 90#ifndef PCMCIA_DEBUG
@@ -629,65 +627,26 @@ cs_release:
629 link->state &= ~DEV_CONFIG_PENDING; 627 link->state &= ~DEV_CONFIG_PENDING;
630} 628}
631 629
632static int reader_event(event_t event, int priority, 630static int reader_suspend(struct pcmcia_device *p_dev)
633 event_callback_args_t *args)
634{ 631{
635 dev_link_t *link; 632 dev_link_t *link = dev_to_instance(p_dev);
636 struct reader_dev *dev;
637 int devno;
638 633
639 link = args->client_data; 634 link->state |= DEV_SUSPEND;
640 dev = link->priv; 635 if (link->state & DEV_CONFIG)
641 DEBUGP(3, dev, "-> reader_event\n"); 636 pcmcia_release_configuration(link->handle);
642 for (devno = 0; devno < CM_MAX_DEV; devno++) {
643 if (dev_table[devno] == link)
644 break;
645 }
646 if (devno == CM_MAX_DEV)
647 return CS_BAD_ADAPTER;
648 637
649 switch (event) { 638 return 0;
650 case CS_EVENT_CARD_INSERTION: 639}
651 DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); 640
652 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 641static int reader_resume(struct pcmcia_device *p_dev)
653 reader_config(link, devno); 642{
654 break; 643 dev_link_t *link = dev_to_instance(p_dev);
655 case CS_EVENT_CARD_REMOVAL: 644
656 DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); 645 link->state &= ~DEV_SUSPEND;
657 link->state &= ~DEV_PRESENT; 646 if (link->state & DEV_CONFIG)
658 break; 647 pcmcia_request_configuration(link->handle, &link->conf);
659 case CS_EVENT_PM_SUSPEND: 648
660 DEBUGP(5, dev, "CS_EVENT_PM_SUSPEND " 649 return 0;
661 "(fall-through to CS_EVENT_RESET_PHYSICAL)\n");
662 link->state |= DEV_SUSPEND;
663
664 case CS_EVENT_RESET_PHYSICAL:
665 DEBUGP(5, dev, "CS_EVENT_RESET_PHYSICAL\n");
666 if (link->state & DEV_CONFIG) {
667 DEBUGP(5, dev, "ReleaseConfiguration\n");
668 pcmcia_release_configuration(link->handle);
669 }
670 break;
671 case CS_EVENT_PM_RESUME:
672 DEBUGP(5, dev, "CS_EVENT_PM_RESUME "
673 "(fall-through to CS_EVENT_CARD_RESET)\n");
674 link->state &= ~DEV_SUSPEND;
675
676 case CS_EVENT_CARD_RESET:
677 DEBUGP(5, dev, "CS_EVENT_CARD_RESET\n");
678 if ((link->state & DEV_CONFIG)) {
679 DEBUGP(5, dev, "RequestConfiguration\n");
680 pcmcia_request_configuration(link->handle,
681 &link->conf);
682 }
683 break;
684 default:
685 DEBUGP(5, dev, "reader_event: unknown event %.2x\n",
686 event);
687 break;
688 }
689 DEBUGP(3, dev, "<- reader_event\n");
690 return CS_SUCCESS;
691} 650}
692 651
693static void reader_release(dev_link_t *link) 652static void reader_release(dev_link_t *link)
@@ -697,11 +656,10 @@ static void reader_release(dev_link_t *link)
697 pcmcia_release_io(link->handle, &link->io); 656 pcmcia_release_io(link->handle, &link->io);
698} 657}
699 658
700static dev_link_t *reader_attach(void) 659static int reader_attach(struct pcmcia_device *p_dev)
701{ 660{
702 struct reader_dev *dev; 661 struct reader_dev *dev;
703 dev_link_t *link; 662 dev_link_t *link;
704 client_reg_t client_reg;
705 int i; 663 int i;
706 664
707 for (i = 0; i < CM_MAX_DEV; i++) { 665 for (i = 0; i < CM_MAX_DEV; i++) {
@@ -710,11 +668,11 @@ static dev_link_t *reader_attach(void)
710 } 668 }
711 669
712 if (i == CM_MAX_DEV) 670 if (i == CM_MAX_DEV)
713 return NULL; 671 return -ENODEV;
714 672
715 dev = kzalloc(sizeof(struct reader_dev), GFP_KERNEL); 673 dev = kzalloc(sizeof(struct reader_dev), GFP_KERNEL);
716 if (dev == NULL) 674 if (dev == NULL)
717 return NULL; 675 return -ENOMEM;
718 676
719 dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; 677 dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT;
720 dev->buffer_status = 0; 678 dev->buffer_status = 0;
@@ -725,20 +683,6 @@ static dev_link_t *reader_attach(void)
725 link->conf.IntType = INT_MEMORY_AND_IO; 683 link->conf.IntType = INT_MEMORY_AND_IO;
726 dev_table[i] = link; 684 dev_table[i] = link;
727 685
728 client_reg.dev_info = &dev_info;
729 client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
730 client_reg.EventMask=
731 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
732 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
733 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
734 client_reg.Version = 0x0210;
735 client_reg.event_callback_args.client_data = link;
736 i = pcmcia_register_client(&link->handle, &client_reg);
737 if (i) {
738 cs_error(link->handle, RegisterClient, i);
739 reader_detach(link);
740 return NULL;
741 }
742 init_waitqueue_head(&dev->devq); 686 init_waitqueue_head(&dev->devq);
743 init_waitqueue_head(&dev->poll_wait); 687 init_waitqueue_head(&dev->poll_wait);
744 init_waitqueue_head(&dev->read_wait); 688 init_waitqueue_head(&dev->read_wait);
@@ -746,39 +690,37 @@ static dev_link_t *reader_attach(void)
746 init_timer(&dev->poll_timer); 690 init_timer(&dev->poll_timer);
747 dev->poll_timer.function = &cm4040_do_poll; 691 dev->poll_timer.function = &cm4040_do_poll;
748 692
749 return link; 693 link->handle = p_dev;
750} 694 p_dev->instance = link;
751
752static void reader_detach_by_devno(int devno, dev_link_t *link)
753{
754 struct reader_dev *dev = link->priv;
755 695
756 if (link->state & DEV_CONFIG) { 696 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
757 DEBUGP(5, dev, "device still configured (try to release it)\n"); 697 reader_config(link, i);
758 reader_release(link);
759 }
760 698
761 pcmcia_deregister_client(link->handle); 699 return 0;
762 dev_table[devno] = NULL;
763 DEBUGP(5, dev, "freeing dev=%p\n", dev);
764 cm4040_stop_poll(dev);
765 kfree(dev);
766 return;
767} 700}
768 701
769static void reader_detach(dev_link_t *link) 702static void reader_detach(struct pcmcia_device *p_dev)
770{ 703{
771 int i; 704 dev_link_t *link = dev_to_instance(p_dev);
705 struct reader_dev *dev = link->priv;
706 int devno;
772 707
773 /* find device */ 708 /* find device */
774 for (i = 0; i < CM_MAX_DEV; i++) { 709 for (devno = 0; devno < CM_MAX_DEV; devno++) {
775 if (dev_table[i] == link) 710 if (dev_table[devno] == link)
776 break; 711 break;
777 } 712 }
778 if (i == CM_MAX_DEV) 713 if (devno == CM_MAX_DEV)
779 return; 714 return;
780 715
781 reader_detach_by_devno(i, link); 716 link->state &= ~DEV_PRESENT;
717
718 if (link->state & DEV_CONFIG)
719 reader_release(link);
720
721 dev_table[devno] = NULL;
722 kfree(dev);
723
782 return; 724 return;
783} 725}
784 726
@@ -804,9 +746,10 @@ static struct pcmcia_driver reader_driver = {
804 .drv = { 746 .drv = {
805 .name = "cm4040_cs", 747 .name = "cm4040_cs",
806 }, 748 },
807 .attach = reader_attach, 749 .probe = reader_attach,
808 .detach = reader_detach, 750 .remove = reader_detach,
809 .event = reader_event, 751 .suspend = reader_suspend,
752 .resume = reader_resume,
810 .id_table = cm4040_ids, 753 .id_table = cm4040_ids,
811}; 754};
812 755
@@ -825,14 +768,8 @@ static int __init cm4040_init(void)
825 768
826static void __exit cm4040_exit(void) 769static void __exit cm4040_exit(void)
827{ 770{
828 int i;
829
830 printk(KERN_INFO MODULE_NAME ": unloading\n"); 771 printk(KERN_INFO MODULE_NAME ": unloading\n");
831 pcmcia_unregister_driver(&reader_driver); 772 pcmcia_unregister_driver(&reader_driver);
832 for (i = 0; i < CM_MAX_DEV; i++) {
833 if (dev_table[i])
834 reader_detach_by_devno(i, dev_table[i]);
835 }
836 unregister_chrdev(major, DEVICE_NAME); 773 unregister_chrdev(major, DEVICE_NAME);
837} 774}
838 775
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 2c326ea53421..cf45b100eff1 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -486,13 +486,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
486 486
487static void mgslpc_config(dev_link_t *link); 487static void mgslpc_config(dev_link_t *link);
488static void mgslpc_release(u_long arg); 488static void mgslpc_release(u_long arg);
489static int mgslpc_event(event_t event, int priority, 489static void mgslpc_detach(struct pcmcia_device *p_dev);
490 event_callback_args_t *args);
491static dev_link_t *mgslpc_attach(void);
492static void mgslpc_detach(dev_link_t *);
493
494static dev_info_t dev_info = "synclink_cs";
495static dev_link_t *dev_list = NULL;
496 490
497/* 491/*
498 * 1st function defined in .text section. Calling this function in 492 * 1st function defined in .text section. Calling this function in
@@ -539,12 +533,10 @@ static void ldisc_receive_buf(struct tty_struct *tty,
539 } 533 }
540} 534}
541 535
542static dev_link_t *mgslpc_attach(void) 536static int mgslpc_attach(struct pcmcia_device *p_dev)
543{ 537{
544 MGSLPC_INFO *info; 538 MGSLPC_INFO *info;
545 dev_link_t *link; 539 dev_link_t *link;
546 client_reg_t client_reg;
547 int ret;
548 540
549 if (debug_level >= DEBUG_LEVEL_INFO) 541 if (debug_level >= DEBUG_LEVEL_INFO)
550 printk("mgslpc_attach\n"); 542 printk("mgslpc_attach\n");
@@ -552,7 +544,7 @@ static dev_link_t *mgslpc_attach(void)
552 info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); 544 info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
553 if (!info) { 545 if (!info) {
554 printk("Error can't allocate device instance data\n"); 546 printk("Error can't allocate device instance data\n");
555 return NULL; 547 return -ENOMEM;
556 } 548 }
557 549
558 memset(info, 0, sizeof(MGSLPC_INFO)); 550 memset(info, 0, sizeof(MGSLPC_INFO));
@@ -587,24 +579,15 @@ static dev_link_t *mgslpc_attach(void)
587 link->conf.Vcc = 50; 579 link->conf.Vcc = 50;
588 link->conf.IntType = INT_MEMORY_AND_IO; 580 link->conf.IntType = INT_MEMORY_AND_IO;
589 581
590 /* Register with Card Services */ 582 link->handle = p_dev;
591 link->next = dev_list; 583 p_dev->instance = link;
592 dev_list = link;
593
594 client_reg.dev_info = &dev_info;
595 client_reg.Version = 0x0210;
596 client_reg.event_callback_args.client_data = link;
597 584
598 ret = pcmcia_register_client(&link->handle, &client_reg); 585 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
599 if (ret != CS_SUCCESS) { 586 mgslpc_config(link);
600 cs_error(link->handle, RegisterClient, ret);
601 mgslpc_detach(link);
602 return NULL;
603 }
604 587
605 mgslpc_add_device(info); 588 mgslpc_add_device(info);
606 589
607 return link; 590 return 0;
608} 591}
609 592
610/* Card has been inserted. 593/* Card has been inserted.
@@ -736,85 +719,50 @@ static void mgslpc_release(u_long arg)
736 pcmcia_release_io(link->handle, &link->io); 719 pcmcia_release_io(link->handle, &link->io);
737 if (link->irq.AssignedIRQ) 720 if (link->irq.AssignedIRQ)
738 pcmcia_release_irq(link->handle, &link->irq); 721 pcmcia_release_irq(link->handle, &link->irq);
739 if (link->state & DEV_STALE_LINK)
740 mgslpc_detach(link);
741} 722}
742 723
743static void mgslpc_detach(dev_link_t *link) 724static void mgslpc_detach(struct pcmcia_device *p_dev)
744{ 725{
745 dev_link_t **linkp; 726 dev_link_t *link = dev_to_instance(p_dev);
746 727
747 if (debug_level >= DEBUG_LEVEL_INFO) 728 if (debug_level >= DEBUG_LEVEL_INFO)
748 printk("mgslpc_detach(0x%p)\n", link); 729 printk("mgslpc_detach(0x%p)\n", link);
749
750 /* find device */
751 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
752 if (*linkp == link) break;
753 if (*linkp == NULL)
754 return;
755 730
756 if (link->state & DEV_CONFIG) { 731 if (link->state & DEV_CONFIG) {
757 /* device is configured/active, mark it so when 732 ((MGSLPC_INFO *)link->priv)->stop = 1;
758 * release() is called a proper detach() occurs. 733 mgslpc_release((u_long)link);
759 */
760 if (debug_level >= DEBUG_LEVEL_INFO)
761 printk(KERN_DEBUG "synclinkpc: detach postponed, '%s' "
762 "still locked\n", link->dev->dev_name);
763 link->state |= DEV_STALE_LINK;
764 return;
765 } 734 }
766 735
767 /* Break the link with Card Services */
768 if (link->handle)
769 pcmcia_deregister_client(link->handle);
770
771 /* Unlink device structure, and free it */
772 *linkp = link->next;
773 mgslpc_remove_device((MGSLPC_INFO *)link->priv); 736 mgslpc_remove_device((MGSLPC_INFO *)link->priv);
774} 737}
775 738
776static int mgslpc_event(event_t event, int priority, 739static int mgslpc_suspend(struct pcmcia_device *dev)
777 event_callback_args_t *args)
778{ 740{
779 dev_link_t *link = args->client_data; 741 dev_link_t *link = dev_to_instance(dev);
780 MGSLPC_INFO *info = link->priv; 742 MGSLPC_INFO *info = link->priv;
781 743
782 if (debug_level >= DEBUG_LEVEL_INFO) 744 link->state |= DEV_SUSPEND;
783 printk("mgslpc_event(0x%06x)\n", event); 745 info->stop = 1;
784 746 if (link->state & DEV_CONFIG)
785 switch (event) { 747 pcmcia_release_configuration(link->handle);
786 case CS_EVENT_CARD_REMOVAL: 748
787 link->state &= ~DEV_PRESENT; 749 return 0;
788 if (link->state & DEV_CONFIG) {
789 ((MGSLPC_INFO *)link->priv)->stop = 1;
790 mgslpc_release((u_long)link);
791 }
792 break;
793 case CS_EVENT_CARD_INSERTION:
794 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
795 mgslpc_config(link);
796 break;
797 case CS_EVENT_PM_SUSPEND:
798 link->state |= DEV_SUSPEND;
799 /* Fall through... */
800 case CS_EVENT_RESET_PHYSICAL:
801 /* Mark the device as stopped, to block IO until later */
802 info->stop = 1;
803 if (link->state & DEV_CONFIG)
804 pcmcia_release_configuration(link->handle);
805 break;
806 case CS_EVENT_PM_RESUME:
807 link->state &= ~DEV_SUSPEND;
808 /* Fall through... */
809 case CS_EVENT_CARD_RESET:
810 if (link->state & DEV_CONFIG)
811 pcmcia_request_configuration(link->handle, &link->conf);
812 info->stop = 0;
813 break;
814 }
815 return 0;
816} 750}
817 751
752static int mgslpc_resume(struct pcmcia_device *dev)
753{
754 dev_link_t *link = dev_to_instance(dev);
755 MGSLPC_INFO *info = link->priv;
756
757 link->state &= ~DEV_SUSPEND;
758 if (link->state & DEV_CONFIG)
759 pcmcia_request_configuration(link->handle, &link->conf);
760 info->stop = 0;
761
762 return 0;
763}
764
765
818static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, 766static inline int mgslpc_paranoia_check(MGSLPC_INFO *info,
819 char *name, const char *routine) 767 char *name, const char *routine)
820{ 768{
@@ -3091,10 +3039,11 @@ static struct pcmcia_driver mgslpc_driver = {
3091 .drv = { 3039 .drv = {
3092 .name = "synclink_cs", 3040 .name = "synclink_cs",
3093 }, 3041 },
3094 .attach = mgslpc_attach, 3042 .probe = mgslpc_attach,
3095 .event = mgslpc_event, 3043 .remove = mgslpc_detach,
3096 .detach = mgslpc_detach,
3097 .id_table = mgslpc_ids, 3044 .id_table = mgslpc_ids,
3045 .suspend = mgslpc_suspend,
3046 .resume = mgslpc_resume,
3098}; 3047};
3099 3048
3100static struct tty_operations mgslpc_ops = { 3049static struct tty_operations mgslpc_ops = {
@@ -3138,7 +3087,6 @@ static void synclink_cs_cleanup(void)
3138 } 3087 }
3139 3088
3140 pcmcia_unregister_driver(&mgslpc_driver); 3089 pcmcia_unregister_driver(&mgslpc_driver);
3141 BUG_ON(dev_list != NULL);
3142} 3090}
3143 3091
3144static int __init synclink_cs_init(void) 3092static int __init synclink_cs_init(void)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7999da25fe40..bdfdfd28594d 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1554,10 +1554,8 @@ __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
1554 1554
1555EXPORT_SYMBOL(secure_tcp_sequence_number); 1555EXPORT_SYMBOL(secure_tcp_sequence_number);
1556 1556
1557 1557/* Generate secure starting point for ephemeral IPV4 transport port search */
1558 1558u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
1559/* Generate secure starting point for ephemeral TCP port search */
1560u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
1561{ 1559{
1562 struct keydata *keyptr = get_keyptr(); 1560 struct keydata *keyptr = get_keyptr();
1563 u32 hash[4]; 1561 u32 hash[4];
@@ -1575,7 +1573,7 @@ u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
1575} 1573}
1576 1574
1577#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1575#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1578u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport) 1576u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport)
1579{ 1577{
1580 struct keydata *keyptr = get_keyptr(); 1578 struct keydata *keyptr = get_keyptr();
1581 u32 hash[12]; 1579 u32 hash[12];
@@ -1586,7 +1584,7 @@ u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dp
1586 1584
1587 return twothirdsMD4Transform(daddr, hash); 1585 return twothirdsMD4Transform(daddr, hash);
1588} 1586}
1589EXPORT_SYMBOL(secure_tcpv6_port_ephemeral); 1587EXPORT_SYMBOL(secure_ipv6_port_ephemeral);
1590#endif 1588#endif
1591 1589
1592#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 1590#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index 344001b45af9..a6544790af60 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -438,7 +438,7 @@ config INDYDOG
438 438
439config ZVM_WATCHDOG 439config ZVM_WATCHDOG
440 tristate "z/VM Watchdog Timer" 440 tristate "z/VM Watchdog Timer"
441 depends on WATCHDOG && ARCH_S390 441 depends on WATCHDOG && S390
442 help 442 help
443 IBM s/390 and zSeries machines running under z/VM 5.1 or later 443 IBM s/390 and zSeries machines running under z/VM 5.1 or later
444 provide a virtual watchdog timer to their guest that cause a 444 provide a virtual watchdog timer to their guest that cause a
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c
index b5be8b11104a..3800835ca8f3 100644
--- a/drivers/char/watchdog/ixp4xx_wdt.c
+++ b/drivers/char/watchdog/ixp4xx_wdt.c
@@ -186,8 +186,8 @@ static int __init ixp4xx_wdt_init(void)
186 unsigned long processor_id; 186 unsigned long processor_id;
187 187
188 asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :); 188 asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
189 if (!(processor_id & 0xf)) { 189 if (!(processor_id & 0xf) && !cpu_is_ixp46x()) {
190 printk("IXP4XXX Watchdog: Rev. A0 CPU detected - " 190 printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - "
191 "watchdog disabled\n"); 191 "watchdog disabled\n");
192 192
193 return -ENODEV; 193 return -ENODEV;
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c
index 092e9b133750..1533f56baa42 100644
--- a/drivers/char/watchdog/pcwd_usb.c
+++ b/drivers/char/watchdog/pcwd_usb.c
@@ -151,7 +151,6 @@ static void usb_pcwd_disconnect (struct usb_interface *interface);
151 151
152/* usb specific object needed to register this driver with the usb subsystem */ 152/* usb specific object needed to register this driver with the usb subsystem */
153static struct usb_driver usb_pcwd_driver = { 153static struct usb_driver usb_pcwd_driver = {
154 .owner = THIS_MODULE,
155 .name = DRIVER_NAME, 154 .name = DRIVER_NAME,
156 .probe = usb_pcwd_probe, 155 .probe = usb_pcwd_probe,
157 .disconnect = usb_pcwd_disconnect, 156 .disconnect = usb_pcwd_disconnect,