aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-01-07 03:50:18 -0500
committerLen Brown <len.brown@intel.com>2006-01-07 03:50:18 -0500
commited03f430cdc8c802652467e9097606fedc2c7abc (patch)
tree30941ec1e6f93e99358fefe18175e5dd800a4379 /drivers/char
parented349a8a0a780ed27e2a765f16cee54d9b63bfee (diff)
parent6f957eaf79356a32e838f5f262ee9a60544b1d5b (diff)
Pull pnpacpi into acpica branch
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/.gitignore2
-rw-r--r--drivers/char/Kconfig24
-rw-r--r--drivers/char/drm/radeon_cp.c2
-rw-r--r--drivers/char/drm/radeon_drv.h1
-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.c6
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c6
-rw-r--r--drivers/char/keyboard.c10
-rw-r--r--drivers/char/mmtimer.c90
-rw-r--r--drivers/char/mwave/mwavepub.h2
-rw-r--r--drivers/char/n_hdlc.c2
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c175
-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/vc_screen.c2
-rw-r--r--drivers/char/watchdog/Kconfig2
-rw-r--r--drivers/char/watchdog/booke_wdt.c15
-rw-r--r--drivers/char/watchdog/ixp4xx_wdt.c4
-rw-r--r--drivers/char/watchdog/mpcore_wdt.c4
-rw-r--r--drivers/char/watchdog/pcwd_usb.c1
-rw-r--r--drivers/char/watchdog/wdrtas.c2
24 files changed, 315 insertions, 402 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 970f70d498f4..5ebd06b1b4ca 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -687,7 +687,7 @@ config NVRAM
687 687
688config RTC 688config RTC
689 tristate "Enhanced Real Time Clock Support" 689 tristate "Enhanced Real Time Clock Support"
690 depends on !PPC32 && !PARISC && !IA64 && !M68K 690 depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI)
691 ---help--- 691 ---help---
692 If you say Y here and create a character special file /dev/rtc with 692 If you say Y here and create a character special file /dev/rtc with
693 major number 10 and minor number 135 using mknod ("man mknod"), you 693 major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -735,7 +735,7 @@ config SGI_IP27_RTC
735 735
736config GEN_RTC 736config GEN_RTC
737 tristate "Generic /dev/rtc emulation" 737 tristate "Generic /dev/rtc emulation"
738 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC32 && !SPARC64 738 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC
739 ---help--- 739 ---help---
740 If you say Y here and create a character special file /dev/rtc with 740 If you say Y here and create a character special file /dev/rtc with
741 major number 10 and minor number 135 using mknod ("man mknod"), you 741 major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -943,6 +943,15 @@ config RAW_DRIVER
943 Applications should simply open the device (eg /dev/hda1) 943 Applications should simply open the device (eg /dev/hda1)
944 with the O_DIRECT flag. 944 with the O_DIRECT flag.
945 945
946config MAX_RAW_DEVS
947 int "Maximum number of RAW devices to support (1-8192)"
948 depends on RAW_DRIVER
949 default "256"
950 help
951 The maximum number of RAW devices that are supported.
952 Default is 256. Increase this number in case you need lots of
953 raw devices.
954
946config HPET 955config HPET
947 bool "HPET - High Precision Event Timer" if (X86 || IA64) 956 bool "HPET - High Precision Event Timer" if (X86 || IA64)
948 default n 957 default n
@@ -974,18 +983,9 @@ config HPET_MMAP
974 exposed to the user. If this applies to your hardware, 983 exposed to the user. If this applies to your hardware,
975 say N here. 984 say N here.
976 985
977config MAX_RAW_DEVS
978 int "Maximum number of RAW devices to support (1-8192)"
979 depends on RAW_DRIVER
980 default "256"
981 help
982 The maximum number of RAW devices that are supported.
983 Default is 256. Increase this number in case you need lots of
984 raw devices.
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/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 03839ea31092..342302d46743 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1311,7 +1311,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1311 1311
1312static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) 1312static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1313{ 1313{
1314 drm_radeon_private_t *dev_priv = dev->dev_private;; 1314 drm_radeon_private_t *dev_priv = dev->dev_private;
1315 DRM_DEBUG("\n"); 1315 DRM_DEBUG("\n");
1316 1316
1317 dev_priv->is_pci = init->is_pci; 1317 dev_priv->is_pci = init->is_pci;
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 7bda7e33d2bd..d92ccee3e54c 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -379,6 +379,7 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
379# define RADEON_PLL_WR_EN (1 << 7) 379# define RADEON_PLL_WR_EN (1 << 7)
380#define RADEON_CLOCK_CNTL_INDEX 0x0008 380#define RADEON_CLOCK_CNTL_INDEX 0x0008
381#define RADEON_CONFIG_APER_SIZE 0x0108 381#define RADEON_CONFIG_APER_SIZE 0x0108
382#define RADEON_CONFIG_MEMSIZE 0x00f8
382#define RADEON_CRTC_OFFSET 0x0224 383#define RADEON_CRTC_OFFSET 0x0224
383#define RADEON_CRTC_OFFSET_CNTL 0x0228 384#define RADEON_CRTC_OFFSET_CNTL 0x0228
384# define RADEON_CRTC_TILE_EN (1 << 15) 385# define RADEON_CRTC_TILE_EN (1 << 15)
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 6b302a930e5f..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;
@@ -2986,7 +2984,7 @@ static void send_panic_events(char *str)
2986 msg.cmd = 2; /* Platform event command. */ 2984 msg.cmd = 2; /* Platform event command. */
2987 msg.data = data; 2985 msg.data = data;
2988 msg.data_len = 8; 2986 msg.data_len = 8;
2989 data[0] = 0x21; /* Kernel generator ID, IPMI table 5-4 */ 2987 data[0] = 0x41; /* Kernel generator ID, IPMI table 5-4 */
2990 data[1] = 0x03; /* This is for IPMI 1.0. */ 2988 data[1] = 0x03; /* This is for IPMI 1.0. */
2991 data[2] = 0x20; /* OS Critical Stop, IPMI table 36-3 */ 2989 data[2] = 0x20; /* OS Critical Stop, IPMI table 36-3 */
2992 data[4] = 0x6f; /* Sensor specific, IPMI table 36-1 */ 2990 data[4] = 0x6f; /* Sensor specific, IPMI table 36-1 */
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 01a1f6badb53..beea450ee4b2 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2399,7 +2399,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
2399 new_smi->handlers->cleanup(new_smi->si_sm); 2399 new_smi->handlers->cleanup(new_smi->si_sm);
2400 kfree(new_smi->si_sm); 2400 kfree(new_smi->si_sm);
2401 } 2401 }
2402 new_smi->io_cleanup(new_smi); 2402 if (new_smi->io_cleanup)
2403 new_smi->io_cleanup(new_smi);
2403 2404
2404 return rv; 2405 return rv;
2405} 2406}
@@ -2518,7 +2519,8 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
2518 2519
2519 kfree(to_clean->si_sm); 2520 kfree(to_clean->si_sm);
2520 2521
2521 to_clean->io_cleanup(to_clean); 2522 if (to_clean->io_cleanup)
2523 to_clean->io_cleanup(to_clean);
2522} 2524}
2523 2525
2524static __exit void cleanup_ipmi_si(void) 2526static __exit void cleanup_ipmi_si(void)
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 449d029ad4f4..8b603b2d1c42 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -930,8 +930,8 @@ static void kbd_refresh_leds(struct input_handle *handle)
930} 930}
931 931
932#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ 932#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
933 defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) ||\ 933 defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\
934 defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ 934 defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\
935 (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) 935 (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC))
936 936
937#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ 937#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\
@@ -958,7 +958,7 @@ static unsigned short x86_keycodes[256] =
958extern int mac_hid_mouse_emulate_buttons(int, int, int); 958extern int mac_hid_mouse_emulate_buttons(int, int, int);
959#endif /* CONFIG_MAC_EMUMOUSEBTN */ 959#endif /* CONFIG_MAC_EMUMOUSEBTN */
960 960
961#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 961#ifdef CONFIG_SPARC
962static int sparc_l1_a_state = 0; 962static int sparc_l1_a_state = 0;
963extern void sun_do_break(void); 963extern void sun_do_break(void);
964#endif 964#endif
@@ -1045,7 +1045,7 @@ static void kbd_keycode(unsigned int keycode, int down,
1045 1045
1046 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) 1046 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT)
1047 sysrq_alt = down; 1047 sysrq_alt = down;
1048#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 1048#ifdef CONFIG_SPARC
1049 if (keycode == KEY_STOP) 1049 if (keycode == KEY_STOP)
1050 sparc_l1_a_state = down; 1050 sparc_l1_a_state = down;
1051#endif 1051#endif
@@ -1072,7 +1072,7 @@ static void kbd_keycode(unsigned int keycode, int down,
1072 return; 1072 return;
1073 } 1073 }
1074#endif 1074#endif
1075#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 1075#ifdef CONFIG_SPARC
1076 if (keycode == KEY_A && sparc_l1_a_state) { 1076 if (keycode == KEY_A && sparc_l1_a_state) {
1077 sparc_l1_a_state = 0; 1077 sparc_l1_a_state = 0;
1078 sun_do_break(); 1078 sun_do_break();
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/mwave/mwavepub.h b/drivers/char/mwave/mwavepub.h
index f1f9da7a65c1..60c961ae23b4 100644
--- a/drivers/char/mwave/mwavepub.h
+++ b/drivers/char/mwave/mwavepub.h
@@ -69,7 +69,7 @@ typedef struct _MW_ABILITIES {
69typedef struct _MW_READWRITE { 69typedef struct _MW_READWRITE {
70 unsigned short usDspAddress; /* The dsp address */ 70 unsigned short usDspAddress; /* The dsp address */
71 unsigned long ulDataLength; /* The size in bytes of the data or user buffer */ 71 unsigned long ulDataLength; /* The size in bytes of the data or user buffer */
72 void *pBuf; /* Input:variable sized buffer */ 72 void __user *pBuf; /* Input:variable sized buffer */
73} MW_READWRITE, *pMW_READWRITE; 73} MW_READWRITE, *pMW_READWRITE;
74 74
75#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1) 75#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1)
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 ef011ef5dc46..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
@@ -1444,6 +1442,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1444 dev_link_t *link; 1442 dev_link_t *link;
1445 int size; 1443 int size;
1446 int rc; 1444 int rc;
1445 void __user *argp = (void __user *)arg;
1447#ifdef PCMCIA_DEBUG 1446#ifdef PCMCIA_DEBUG
1448 char *ioctl_names[CM_IOC_MAXNR + 1] = { 1447 char *ioctl_names[CM_IOC_MAXNR + 1] = {
1449 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", 1448 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
@@ -1481,11 +1480,11 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1481 _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd); 1480 _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd);
1482 1481
1483 if (_IOC_DIR(cmd) & _IOC_READ) { 1482 if (_IOC_DIR(cmd) & _IOC_READ) {
1484 if (!access_ok(VERIFY_WRITE, (void *)arg, size)) 1483 if (!access_ok(VERIFY_WRITE, argp, size))
1485 return -EFAULT; 1484 return -EFAULT;
1486 } 1485 }
1487 if (_IOC_DIR(cmd) & _IOC_WRITE) { 1486 if (_IOC_DIR(cmd) & _IOC_WRITE) {
1488 if (!access_ok(VERIFY_READ, (void *)arg, size)) 1487 if (!access_ok(VERIFY_READ, argp, size))
1489 return -EFAULT; 1488 return -EFAULT;
1490 } 1489 }
1491 1490
@@ -1506,14 +1505,14 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1506 status |= CM_NO_READER; 1505 status |= CM_NO_READER;
1507 if (test_bit(IS_BAD_CARD, &dev->flags)) 1506 if (test_bit(IS_BAD_CARD, &dev->flags))
1508 status |= CM_BAD_CARD; 1507 status |= CM_BAD_CARD;
1509 if (copy_to_user((int *)arg, &status, sizeof(int))) 1508 if (copy_to_user(argp, &status, sizeof(int)))
1510 return -EFAULT; 1509 return -EFAULT;
1511 } 1510 }
1512 return 0; 1511 return 0;
1513 case CM_IOCGATR: 1512 case CM_IOCGATR:
1514 DEBUGP(4, dev, "... in CM_IOCGATR\n"); 1513 DEBUGP(4, dev, "... in CM_IOCGATR\n");
1515 { 1514 {
1516 struct atreq *atreq = (struct atreq *) arg; 1515 struct atreq __user *atreq = argp;
1517 int tmp; 1516 int tmp;
1518 /* allow nonblocking io and being interrupted */ 1517 /* allow nonblocking io and being interrupted */
1519 if (wait_event_interruptible 1518 if (wait_event_interruptible
@@ -1597,7 +1596,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1597 { 1596 {
1598 struct ptsreq krnptsreq; 1597 struct ptsreq krnptsreq;
1599 1598
1600 if (copy_from_user(&krnptsreq, (struct ptsreq *) arg, 1599 if (copy_from_user(&krnptsreq, argp,
1601 sizeof(struct ptsreq))) 1600 sizeof(struct ptsreq)))
1602 return -EFAULT; 1601 return -EFAULT;
1603 1602
@@ -1641,7 +1640,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1641 int old_pc_debug = 0; 1640 int old_pc_debug = 0;
1642 1641
1643 old_pc_debug = pc_debug; 1642 old_pc_debug = pc_debug;
1644 if (copy_from_user(&pc_debug, (int *)arg, sizeof(int))) 1643 if (copy_from_user(&pc_debug, argp, sizeof(int)))
1645 return -EFAULT; 1644 return -EFAULT;
1646 1645
1647 if (old_pc_debug != pc_debug) 1646 if (old_pc_debug != pc_debug)
@@ -1863,68 +1862,36 @@ cs_release:
1863 link->state &= ~DEV_CONFIG_PENDING; 1862 link->state &= ~DEV_CONFIG_PENDING;
1864} 1863}
1865 1864
1866static int cm4000_event(event_t event, int priority, 1865static int cm4000_suspend(struct pcmcia_device *p_dev)
1867 event_callback_args_t *args)
1868{ 1866{
1869 dev_link_t *link; 1867 dev_link_t *link = dev_to_instance(p_dev);
1870 struct cm4000_dev *dev; 1868 struct cm4000_dev *dev;
1871 int devno;
1872 1869
1873 link = args->client_data;
1874 dev = link->priv; 1870 dev = link->priv;
1875 1871
1876 DEBUGP(3, dev, "-> cm4000_event\n"); 1872 link->state |= DEV_SUSPEND;
1877 for (devno = 0; devno < CM4000_MAX_DEV; devno++) 1873 if (link->state & DEV_CONFIG)
1878 if (dev_table[devno] == link) 1874 pcmcia_release_configuration(link->handle);
1879 break; 1875 stop_monitor(dev);
1880 1876
1881 if (devno == CM4000_MAX_DEV) 1877 return 0;
1882 return CS_BAD_ADAPTER; 1878}
1883 1879
1884 switch (event) { 1880static int cm4000_resume(struct pcmcia_device *p_dev)
1885 case CS_EVENT_CARD_INSERTION: 1881{
1886 DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n"); 1882 dev_link_t *link = dev_to_instance(p_dev);
1887 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1883 struct cm4000_dev *dev;
1888 cm4000_config(link, devno); 1884
1889 break; 1885 dev = link->priv;
1890 case CS_EVENT_CARD_REMOVAL: 1886
1891 DEBUGP(5, dev, "CS_EVENT_CARD_REMOVAL\n"); 1887 link->state &= ~DEV_SUSPEND;
1892 link->state &= ~DEV_PRESENT; 1888 if (link->state & DEV_CONFIG)
1893 stop_monitor(dev); 1889 pcmcia_request_configuration(link->handle, &link->conf);
1894 break; 1890
1895 case CS_EVENT_PM_SUSPEND: 1891 if (link->open)
1896 DEBUGP(5, dev, "CS_EVENT_PM_SUSPEND " 1892 start_monitor(dev);
1897 "(fall-through to CS_EVENT_RESET_PHYSICAL)\n"); 1893
1898 link->state |= DEV_SUSPEND; 1894 return 0;
1899 /* fall-through */
1900 case CS_EVENT_RESET_PHYSICAL:
1901 DEBUGP(5, dev, "CS_EVENT_RESET_PHYSICAL\n");
1902 if (link->state & DEV_CONFIG) {
1903 DEBUGP(5, dev, "ReleaseConfiguration\n");
1904 pcmcia_release_configuration(link->handle);
1905 }
1906 stop_monitor(dev);
1907 break;
1908 case CS_EVENT_PM_RESUME:
1909 DEBUGP(5, dev, "CS_EVENT_PM_RESUME "
1910 "(fall-through to CS_EVENT_CARD_RESET)\n");
1911 link->state &= ~DEV_SUSPEND;
1912 /* fall-through */
1913 case CS_EVENT_CARD_RESET:
1914 DEBUGP(5, dev, "CS_EVENT_CARD_RESET\n");
1915 if ((link->state & DEV_CONFIG)) {
1916 DEBUGP(5, dev, "RequestConfiguration\n");
1917 pcmcia_request_configuration(link->handle, &link->conf);
1918 }
1919 if (link->open)
1920 start_monitor(dev);
1921 break;
1922 default:
1923 DEBUGP(5, dev, "unknown event %.2x\n", event);
1924 break;
1925 }
1926 DEBUGP(3, dev, "<- cm4000_event\n");
1927 return CS_SUCCESS;
1928} 1895}
1929 1896
1930static void cm4000_release(dev_link_t *link) 1897static void cm4000_release(dev_link_t *link)
@@ -1934,11 +1901,10 @@ static void cm4000_release(dev_link_t *link)
1934 pcmcia_release_io(link->handle, &link->io); 1901 pcmcia_release_io(link->handle, &link->io);
1935} 1902}
1936 1903
1937static dev_link_t *cm4000_attach(void) 1904static int cm4000_attach(struct pcmcia_device *p_dev)
1938{ 1905{
1939 struct cm4000_dev *dev; 1906 struct cm4000_dev *dev;
1940 dev_link_t *link; 1907 dev_link_t *link;
1941 client_reg_t client_reg;
1942 int i; 1908 int i;
1943 1909
1944 for (i = 0; i < CM4000_MAX_DEV; i++) 1910 for (i = 0; i < CM4000_MAX_DEV; i++)
@@ -1947,76 +1913,55 @@ static dev_link_t *cm4000_attach(void)
1947 1913
1948 if (i == CM4000_MAX_DEV) { 1914 if (i == CM4000_MAX_DEV) {
1949 printk(KERN_NOTICE MODULE_NAME ": all devices in use\n"); 1915 printk(KERN_NOTICE MODULE_NAME ": all devices in use\n");
1950 return NULL; 1916 return -ENODEV;
1951 } 1917 }
1952 1918
1953 /* create a new cm4000_cs device */ 1919 /* create a new cm4000_cs device */
1954 dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL); 1920 dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL);
1955 if (dev == NULL) 1921 if (dev == NULL)
1956 return NULL; 1922 return -ENOMEM;
1957 1923
1958 link = &dev->link; 1924 link = &dev->link;
1959 link->priv = dev; 1925 link->priv = dev;
1960 link->conf.IntType = INT_MEMORY_AND_IO; 1926 link->conf.IntType = INT_MEMORY_AND_IO;
1961 dev_table[i] = link; 1927 dev_table[i] = link;
1962 1928
1963 /* register with card services */
1964 client_reg.dev_info = &dev_info;
1965 client_reg.EventMask =
1966 CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
1967 CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
1968 CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
1969 client_reg.Version = 0x0210;
1970 client_reg.event_callback_args.client_data = link;
1971
1972 i = pcmcia_register_client(&link->handle, &client_reg);
1973 if (i) {
1974 cs_error(link->handle, RegisterClient, i);
1975 cm4000_detach(link);
1976 return NULL;
1977 }
1978
1979 init_waitqueue_head(&dev->devq); 1929 init_waitqueue_head(&dev->devq);
1980 init_waitqueue_head(&dev->ioq); 1930 init_waitqueue_head(&dev->ioq);
1981 init_waitqueue_head(&dev->atrq); 1931 init_waitqueue_head(&dev->atrq);
1982 init_waitqueue_head(&dev->readq); 1932 init_waitqueue_head(&dev->readq);
1983 1933
1984 return link; 1934 link->handle = p_dev;
1985} 1935 p_dev->instance = link;
1986
1987static void cm4000_detach_by_devno(int devno, dev_link_t * link)
1988{
1989 struct cm4000_dev *dev = link->priv;
1990
1991 DEBUGP(3, dev, "-> detach_by_devno(devno=%d)\n", devno);
1992
1993 if (link->state & DEV_CONFIG) {
1994 DEBUGP(5, dev, "device still configured (try to release it)\n");
1995 cm4000_release(link);
1996 }
1997 1936
1998 if (link->handle) { 1937 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1999 pcmcia_deregister_client(link->handle); 1938 cm4000_config(link, i);
2000 }
2001 1939
2002 dev_table[devno] = NULL; 1940 return 0;
2003 kfree(dev);
2004 return;
2005} 1941}
2006 1942
2007static void cm4000_detach(dev_link_t * link) 1943static void cm4000_detach(struct pcmcia_device *p_dev)
2008{ 1944{
2009 int i; 1945 dev_link_t *link = dev_to_instance(p_dev);
1946 struct cm4000_dev *dev = link->priv;
1947 int devno;
2010 1948
2011 /* find device */ 1949 /* find device */
2012 for (i = 0; i < CM4000_MAX_DEV; i++) 1950 for (devno = 0; devno < CM4000_MAX_DEV; devno++)
2013 if (dev_table[i] == link) 1951 if (dev_table[devno] == link)
2014 break; 1952 break;
2015 1953 if (devno == CM4000_MAX_DEV)
2016 if (i == CM4000_MAX_DEV)
2017 return; 1954 return;
2018 1955
2019 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
2020 return; 1965 return;
2021} 1966}
2022 1967
@@ -2041,9 +1986,10 @@ static struct pcmcia_driver cm4000_driver = {
2041 .drv = { 1986 .drv = {
2042 .name = "cm4000_cs", 1987 .name = "cm4000_cs",
2043 }, 1988 },
2044 .attach = cm4000_attach, 1989 .probe = cm4000_attach,
2045 .detach = cm4000_detach, 1990 .remove = cm4000_detach,
2046 .event = cm4000_event, 1991 .suspend = cm4000_suspend,
1992 .resume = cm4000_resume,
2047 .id_table = cm4000_ids, 1993 .id_table = cm4000_ids,
2048}; 1994};
2049 1995
@@ -2063,13 +2009,8 @@ static int __init cmm_init(void)
2063 2009
2064static void __exit cmm_exit(void) 2010static void __exit cmm_exit(void)
2065{ 2011{
2066 int i;
2067
2068 printk(KERN_INFO MODULE_NAME ": unloading\n"); 2012 printk(KERN_INFO MODULE_NAME ": unloading\n");
2069 pcmcia_unregister_driver(&cm4000_driver); 2013 pcmcia_unregister_driver(&cm4000_driver);
2070 for (i = 0; i < CM4000_MAX_DEV; i++)
2071 if (dev_table[i])
2072 cm4000_detach_by_devno(i, dev_table[i]);
2073 unregister_chrdev(major, DEVICE_NAME); 2014 unregister_chrdev(major, DEVICE_NAME);
2074}; 2015};
2075 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/vc_screen.c b/drivers/char/vc_screen.c
index f66c7ad6fd38..3c1dafaa3441 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -419,7 +419,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
419 while (this_round > 1) { 419 while (this_round > 1) {
420 unsigned short w; 420 unsigned short w;
421 421
422 w = get_unaligned(((const unsigned short *)con_buf0)); 422 w = get_unaligned(((unsigned short *)con_buf0));
423 vcs_scr_writew(vc, w, org++); 423 vcs_scr_writew(vc, w, org++);
424 con_buf0 += 2; 424 con_buf0 += 2;
425 this_round -= 2; 425 this_round -= 2;
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/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c
index 65830ec71042..b6640606b44d 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/char/watchdog/booke_wdt.c
@@ -72,7 +72,7 @@ static __inline__ void booke_wdt_ping(void)
72/* 72/*
73 * booke_wdt_write: 73 * booke_wdt_write:
74 */ 74 */
75static ssize_t booke_wdt_write (struct file *file, const char *buf, 75static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
76 size_t count, loff_t *ppos) 76 size_t count, loff_t *ppos)
77{ 77{
78 booke_wdt_ping(); 78 booke_wdt_ping();
@@ -92,14 +92,15 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
92 unsigned int cmd, unsigned long arg) 92 unsigned int cmd, unsigned long arg)
93{ 93{
94 u32 tmp = 0; 94 u32 tmp = 0;
95 u32 __user *p = (u32 __user *)arg;
95 96
96 switch (cmd) { 97 switch (cmd) {
97 case WDIOC_GETSUPPORT: 98 case WDIOC_GETSUPPORT:
98 if (copy_to_user ((struct watchdog_info *) arg, &ident, 99 if (copy_to_user ((struct watchdog_info __user *) arg, &ident,
99 sizeof(struct watchdog_info))) 100 sizeof(struct watchdog_info)))
100 return -EFAULT; 101 return -EFAULT;
101 case WDIOC_GETSTATUS: 102 case WDIOC_GETSTATUS:
102 return put_user(ident.options, (u32 *) arg); 103 return put_user(ident.options, p);
103 case WDIOC_GETBOOTSTATUS: 104 case WDIOC_GETBOOTSTATUS:
104 /* XXX: something is clearing TSR */ 105 /* XXX: something is clearing TSR */
105 tmp = mfspr(SPRN_TSR) & TSR_WRS(3); 106 tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
@@ -109,14 +110,14 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
109 booke_wdt_ping(); 110 booke_wdt_ping();
110 return 0; 111 return 0;
111 case WDIOC_SETTIMEOUT: 112 case WDIOC_SETTIMEOUT:
112 if (get_user(booke_wdt_period, (u32 *) arg)) 113 if (get_user(booke_wdt_period, p))
113 return -EFAULT; 114 return -EFAULT;
114 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); 115 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
115 return 0; 116 return 0;
116 case WDIOC_GETTIMEOUT: 117 case WDIOC_GETTIMEOUT:
117 return put_user(booke_wdt_period, (u32 *) arg); 118 return put_user(booke_wdt_period, p);
118 case WDIOC_SETOPTIONS: 119 case WDIOC_SETOPTIONS:
119 if (get_user(tmp, (u32 *) arg)) 120 if (get_user(tmp, p))
120 return -EINVAL; 121 return -EINVAL;
121 if (tmp == WDIOS_ENABLECARD) { 122 if (tmp == WDIOS_ENABLECARD) {
122 booke_wdt_ping(); 123 booke_wdt_ping();
@@ -172,7 +173,7 @@ static int __init booke_wdt_init(void)
172 int ret = 0; 173 int ret = 0;
173 174
174 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); 175 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n");
175 ident.firmware_version = cpu_specs[0].pvr_value; 176 ident.firmware_version = cur_cpu_spec->pvr_value;
176 177
177 ret = misc_register(&booke_wdt_miscdev); 178 ret = misc_register(&booke_wdt_miscdev);
178 if (ret) { 179 if (ret) {
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/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c
index 9defcf861b67..b4d843489881 100644
--- a/drivers/char/watchdog/mpcore_wdt.c
+++ b/drivers/char/watchdog/mpcore_wdt.c
@@ -180,10 +180,6 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data, size_t len,
180{ 180{
181 struct mpcore_wdt *wdt = file->private_data; 181 struct mpcore_wdt *wdt = file->private_data;
182 182
183 /* Can't seek (pwrite) on this device */
184 if (ppos != &file->f_pos)
185 return -ESPIPE;
186
187 /* 183 /*
188 * Refresh the timer. 184 * Refresh the timer.
189 */ 185 */
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,
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c
index 619e2ffca33f..dacfe31caccf 100644
--- a/drivers/char/watchdog/wdrtas.c
+++ b/drivers/char/watchdog/wdrtas.c
@@ -320,7 +320,7 @@ static int
320wdrtas_ioctl(struct inode *inode, struct file *file, 320wdrtas_ioctl(struct inode *inode, struct file *file,
321 unsigned int cmd, unsigned long arg) 321 unsigned int cmd, unsigned long arg)
322{ 322{
323 int __user *argp = (void *)arg; 323 int __user *argp = (void __user *)arg;
324 int i; 324 int i;
325 static struct watchdog_info wdinfo = { 325 static struct watchdog_info wdinfo = {
326 .options = WDRTAS_SUPPORTED_MASK, 326 .options = WDRTAS_SUPPORTED_MASK,