aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-10-31 03:18:02 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-10-31 03:18:02 -0400
commit0803d540db06f53acd2fabf1347d5b665218f14a (patch)
treef5f8e5510a76bb59d3583478961daf5afc32df08 /drivers
parenta8884e3415c29c58a5875d54c109c4a7fcaa6fb4 (diff)
parent721d5dfe7e516954c501d5e9d0dfab379cf4241a (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers')
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/ata/ahci.c41
-rw-r--r--drivers/ata/ata_generic.c2
-rw-r--r--drivers/ata/ata_piix.c2
-rw-r--r--drivers/ata/libata-core.c35
-rw-r--r--drivers/ata/libata-eh.c14
-rw-r--r--drivers/ata/pata_acpi.c2
-rw-r--r--drivers/ata/pata_ali.c1
-rw-r--r--drivers/ata/pata_amd.c1
-rw-r--r--drivers/ata/pata_artop.c2
-rw-r--r--drivers/ata/pata_atiixp.c1
-rw-r--r--drivers/ata/pata_cmd640.c1
-rw-r--r--drivers/ata/pata_cmd64x.c2
-rw-r--r--drivers/ata/pata_cs5530.c1
-rw-r--r--drivers/ata/pata_cs5535.c2
-rw-r--r--drivers/ata/pata_cypress.c2
-rw-r--r--drivers/ata/pata_efar.c2
-rw-r--r--drivers/ata/pata_isapnp.c2
-rw-r--r--drivers/ata/pata_it821x.c7
-rw-r--r--drivers/ata/pata_jmicron.c2
-rw-r--r--drivers/ata/pata_legacy.c2
-rw-r--r--drivers/ata/pata_marvell.c2
-rw-r--r--drivers/ata/pata_mpiix.c2
-rw-r--r--drivers/ata/pata_netcell.c2
-rw-r--r--drivers/ata/pata_ninja32.c44
-rw-r--r--drivers/ata/pata_ns87410.c1
-rw-r--r--drivers/ata/pata_ns87415.c2
-rw-r--r--drivers/ata/pata_oldpiix.c2
-rw-r--r--drivers/ata/pata_opti.c1
-rw-r--r--drivers/ata/pata_optidma.c1
-rw-r--r--drivers/ata/pata_pcmcia.c2
-rw-r--r--drivers/ata/pata_pdc202xx_old.c2
-rw-r--r--drivers/ata/pata_platform.c2
-rw-r--r--drivers/ata/pata_qdi.c2
-rw-r--r--drivers/ata/pata_radisys.c2
-rw-r--r--drivers/ata/pata_sc1200.c2
-rw-r--r--drivers/ata/pata_scc.c2
-rw-r--r--drivers/ata/pata_serverworks.c1
-rw-r--r--drivers/ata/pata_sil680.c1
-rw-r--r--drivers/ata/pata_sis.c2
-rw-r--r--drivers/ata/pata_sl82c105.c1
-rw-r--r--drivers/ata/pata_triflex.c2
-rw-r--r--drivers/ata/pata_via.c1
-rw-r--r--drivers/ata/pata_winbond.c2
-rw-r--r--drivers/ata/sata_sil24.c5
-rw-r--r--drivers/base/sys.c10
-rw-r--r--drivers/block/loop.c5
-rw-r--r--drivers/bluetooth/bluecard_cs.c2
-rw-r--r--drivers/bluetooth/bt3c_cs.c6
-rw-r--r--drivers/bluetooth/btuart_cs.c6
-rw-r--r--drivers/bluetooth/dtl1_cs.c7
-rw-r--r--drivers/char/Kconfig22
-rw-r--r--drivers/char/Makefile2
-rw-r--r--drivers/char/ds1286.c585
-rw-r--r--drivers/char/ip27-rtc.c329
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c1
-rw-r--r--drivers/char/pcmcia/synclink_cs.c2
-rw-r--r--drivers/edac/Kconfig7
-rw-r--r--drivers/edac/Makefile1
-rw-r--r--drivers/edac/cell_edac.c3
-rw-r--r--drivers/edac/x38_edac.c524
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-dell.c1
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/usbhid/hid-core.c60
-rw-r--r--drivers/hid/usbhid/usbhid.h2
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c2
-rw-r--r--drivers/i2c/busses/scx200_i2c.c1
-rw-r--r--drivers/leds/leds-da903x.c2
-rw-r--r--drivers/md/dm-raid1.c3
-rw-r--r--drivers/md/dm-snap.c32
-rw-r--r--drivers/md/dm-snap.h2
-rw-r--r--drivers/md/md.c7
-rw-r--r--drivers/message/i2o/i2o_block.c12
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c1
-rw-r--r--drivers/misc/sgi-xp/Makefile4
-rw-r--r--drivers/misc/sgi-xp/xp.h4
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c4
-rw-r--r--drivers/misc/sony-laptop.c6
-rw-r--r--drivers/mmc/host/mmci.c5
-rw-r--r--drivers/net/amd8111e.c14
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_qmr.c57
-rw-r--r--drivers/net/ehea/ehea_qmr.h3
-rw-r--r--drivers/net/ibm_newemac/core.c2
-rw-r--r--drivers/net/mlx4/en_main.c1
-rw-r--r--drivers/net/mlx4/fw.c2
-rw-r--r--drivers/net/tulip/dmfe.c12
-rw-r--r--drivers/net/usb/dm9601.c15
-rw-r--r--drivers/net/via-velocity.c11
-rw-r--r--drivers/net/wan/syncppp.c5
-rw-r--r--drivers/net/wireless/ath5k/base.c33
-rw-r--r--drivers/net/wireless/p54/p54common.c5
-rw-r--r--drivers/net/wireless/p54/p54pci.c132
-rw-r--r--drivers/parport/parport_cs.c2
-rw-r--r--drivers/pci/quirks.c14
-rw-r--r--drivers/pcmcia/pcmcia_resource.c3
-rw-r--r--drivers/regulator/da903x.c29
-rw-r--r--drivers/rtc/rtc-ds3234.c4
-rw-r--r--drivers/rtc/rtc-s3c.c8
-rw-r--r--drivers/s390/char/tape_block.c6
-rw-r--r--drivers/s390/char/tape_core.c8
-rw-r--r--drivers/s390/cio/qdio_debug.c19
-rw-r--r--drivers/s390/cio/qdio_main.c1
-rw-r--r--drivers/s390/net/qeth_core_main.c3
-rw-r--r--drivers/s390/net/qeth_l2_main.c27
-rw-r--r--drivers/s390/net/qeth_l3_main.c13
-rw-r--r--drivers/s390/net/qeth_l3_sys.c7
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/serial/Kconfig4
-rw-r--r--drivers/serial/netx-serial.c4
-rw-r--r--drivers/usb/class/usbtmc.c2
-rw-r--r--drivers/usb/core/hcd.c35
-rw-r--r--drivers/usb/core/hcd.h1
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/usb/core/urb.c22
-rw-r--r--drivers/usb/serial/usb-serial.c1
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/video/backlight/corgi_lcd.c4
-rw-r--r--drivers/video/console/fbcon.c2
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/via/global.h3
-rw-r--r--drivers/watchdog/acquirewdt.c6
-rw-r--r--drivers/watchdog/advantechwdt.c6
-rw-r--r--drivers/watchdog/bfin_wdt.c2
-rw-r--r--drivers/watchdog/eurotechwdt.c4
-rw-r--r--drivers/watchdog/i6300esb.c3
-rw-r--r--drivers/watchdog/ib700wdt.c6
-rw-r--r--drivers/watchdog/indydog.c2
-rw-r--r--drivers/watchdog/mpcore_wdt.c4
-rw-r--r--drivers/watchdog/omap_wdt.c2
-rw-r--r--drivers/watchdog/pcwd_pci.c2
-rw-r--r--drivers/watchdog/pcwd_usb.c2
-rw-r--r--drivers/watchdog/rc32434_wdt.c3
-rw-r--r--drivers/watchdog/s3c2410_wdt.c2
-rw-r--r--drivers/watchdog/sa1100_wdt.c2
-rw-r--r--drivers/watchdog/sb_wdog.c4
-rw-r--r--drivers/watchdog/sbc8360.c6
-rw-r--r--drivers/watchdog/sbc_epx_c3.c2
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c2
-rw-r--r--drivers/watchdog/softdog.c3
-rw-r--r--drivers/watchdog/w83627hf_wdt.c6
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--drivers/watchdog/wafer5823wdt.c4
-rw-r--r--drivers/watchdog/wdt.c4
-rw-r--r--drivers/watchdog/wdt285.c3
-rw-r--r--drivers/watchdog/wdt_pci.c4
-rw-r--r--drivers/xen/events.c2
-rw-r--r--drivers/xen/manage.c2
-rw-r--r--drivers/xen/xencomm.c23
150 files changed, 1162 insertions, 1362 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig
index d38f43f593d4..2f557f570ade 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -68,6 +68,8 @@ source "drivers/ssb/Kconfig"
68 68
69source "drivers/mfd/Kconfig" 69source "drivers/mfd/Kconfig"
70 70
71source "drivers/regulator/Kconfig"
72
71source "drivers/media/Kconfig" 73source "drivers/media/Kconfig"
72 74
73source "drivers/video/Kconfig" 75source "drivers/video/Kconfig"
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index aeadd00411a1..a67b8e7c712d 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -49,6 +49,17 @@
49#define DRV_NAME "ahci" 49#define DRV_NAME "ahci"
50#define DRV_VERSION "3.0" 50#define DRV_VERSION "3.0"
51 51
52/* Enclosure Management Control */
53#define EM_CTRL_MSG_TYPE 0x000f0000
54
55/* Enclosure Management LED Message Type */
56#define EM_MSG_LED_HBA_PORT 0x0000000f
57#define EM_MSG_LED_PMP_SLOT 0x0000ff00
58#define EM_MSG_LED_VALUE 0xffff0000
59#define EM_MSG_LED_VALUE_ACTIVITY 0x00070000
60#define EM_MSG_LED_VALUE_OFF 0xfff80000
61#define EM_MSG_LED_VALUE_ON 0x00010000
62
52static int ahci_skip_host_reset; 63static int ahci_skip_host_reset;
53module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); 64module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444);
54MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); 65MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)");
@@ -588,6 +599,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
588 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ 599 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
589 { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ 600 { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */
590 601
602 /* Promise */
603 { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
604
591 /* Generic, PCI class code for AHCI */ 605 /* Generic, PCI class code for AHCI */
592 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 606 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
593 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, 607 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -1220,18 +1234,20 @@ static void ahci_sw_activity_blink(unsigned long arg)
1220 struct ahci_em_priv *emp = &pp->em_priv[link->pmp]; 1234 struct ahci_em_priv *emp = &pp->em_priv[link->pmp];
1221 unsigned long led_message = emp->led_state; 1235 unsigned long led_message = emp->led_state;
1222 u32 activity_led_state; 1236 u32 activity_led_state;
1237 unsigned long flags;
1223 1238
1224 led_message &= 0xffff0000; 1239 led_message &= EM_MSG_LED_VALUE;
1225 led_message |= ap->port_no | (link->pmp << 8); 1240 led_message |= ap->port_no | (link->pmp << 8);
1226 1241
1227 /* check to see if we've had activity. If so, 1242 /* check to see if we've had activity. If so,
1228 * toggle state of LED and reset timer. If not, 1243 * toggle state of LED and reset timer. If not,
1229 * turn LED to desired idle state. 1244 * turn LED to desired idle state.
1230 */ 1245 */
1246 spin_lock_irqsave(ap->lock, flags);
1231 if (emp->saved_activity != emp->activity) { 1247 if (emp->saved_activity != emp->activity) {
1232 emp->saved_activity = emp->activity; 1248 emp->saved_activity = emp->activity;
1233 /* get the current LED state */ 1249 /* get the current LED state */
1234 activity_led_state = led_message & 0x00010000; 1250 activity_led_state = led_message & EM_MSG_LED_VALUE_ON;
1235 1251
1236 if (activity_led_state) 1252 if (activity_led_state)
1237 activity_led_state = 0; 1253 activity_led_state = 0;
@@ -1239,17 +1255,18 @@ static void ahci_sw_activity_blink(unsigned long arg)
1239 activity_led_state = 1; 1255 activity_led_state = 1;
1240 1256
1241 /* clear old state */ 1257 /* clear old state */
1242 led_message &= 0xfff8ffff; 1258 led_message &= ~EM_MSG_LED_VALUE_ACTIVITY;
1243 1259
1244 /* toggle state */ 1260 /* toggle state */
1245 led_message |= (activity_led_state << 16); 1261 led_message |= (activity_led_state << 16);
1246 mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); 1262 mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100));
1247 } else { 1263 } else {
1248 /* switch to idle */ 1264 /* switch to idle */
1249 led_message &= 0xfff8ffff; 1265 led_message &= ~EM_MSG_LED_VALUE_ACTIVITY;
1250 if (emp->blink_policy == BLINK_OFF) 1266 if (emp->blink_policy == BLINK_OFF)
1251 led_message |= (1 << 16); 1267 led_message |= (1 << 16);
1252 } 1268 }
1269 spin_unlock_irqrestore(ap->lock, flags);
1253 ahci_transmit_led_message(ap, led_message, 4); 1270 ahci_transmit_led_message(ap, led_message, 4);
1254} 1271}
1255 1272
@@ -1294,7 +1311,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1294 struct ahci_em_priv *emp; 1311 struct ahci_em_priv *emp;
1295 1312
1296 /* get the slot number from the message */ 1313 /* get the slot number from the message */
1297 pmp = (state & 0x0000ff00) >> 8; 1314 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
1298 if (pmp < MAX_SLOTS) 1315 if (pmp < MAX_SLOTS)
1299 emp = &pp->em_priv[pmp]; 1316 emp = &pp->em_priv[pmp];
1300 else 1317 else
@@ -1319,7 +1336,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1319 message[0] |= (4 << 8); 1336 message[0] |= (4 << 8);
1320 1337
1321 /* ignore 0:4 of byte zero, fill in port info yourself */ 1338 /* ignore 0:4 of byte zero, fill in port info yourself */
1322 message[1] = ((state & 0xfffffff0) | ap->port_no); 1339 message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no);
1323 1340
1324 /* write message to EM_LOC */ 1341 /* write message to EM_LOC */
1325 writel(message[0], mmio + hpriv->em_loc); 1342 writel(message[0], mmio + hpriv->em_loc);
@@ -1362,7 +1379,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
1362 state = simple_strtoul(buf, NULL, 0); 1379 state = simple_strtoul(buf, NULL, 0);
1363 1380
1364 /* get the slot number from the message */ 1381 /* get the slot number from the message */
1365 pmp = (state & 0x0000ff00) >> 8; 1382 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
1366 if (pmp < MAX_SLOTS) 1383 if (pmp < MAX_SLOTS)
1367 emp = &pp->em_priv[pmp]; 1384 emp = &pp->em_priv[pmp];
1368 else 1385 else
@@ -1373,7 +1390,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
1373 * activity led through em_message 1390 * activity led through em_message
1374 */ 1391 */
1375 if (emp->blink_policy) 1392 if (emp->blink_policy)
1376 state &= 0xfff8ffff; 1393 state &= ~EM_MSG_LED_VALUE_ACTIVITY;
1377 1394
1378 return ahci_transmit_led_message(ap, state, size); 1395 return ahci_transmit_led_message(ap, state, size);
1379} 1396}
@@ -1392,16 +1409,16 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val)
1392 link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); 1409 link->flags &= ~(ATA_LFLAG_SW_ACTIVITY);
1393 1410
1394 /* set the LED to OFF */ 1411 /* set the LED to OFF */
1395 port_led_state &= 0xfff80000; 1412 port_led_state &= EM_MSG_LED_VALUE_OFF;
1396 port_led_state |= (ap->port_no | (link->pmp << 8)); 1413 port_led_state |= (ap->port_no | (link->pmp << 8));
1397 ahci_transmit_led_message(ap, port_led_state, 4); 1414 ahci_transmit_led_message(ap, port_led_state, 4);
1398 } else { 1415 } else {
1399 link->flags |= ATA_LFLAG_SW_ACTIVITY; 1416 link->flags |= ATA_LFLAG_SW_ACTIVITY;
1400 if (val == BLINK_OFF) { 1417 if (val == BLINK_OFF) {
1401 /* set LED to ON for idle */ 1418 /* set LED to ON for idle */
1402 port_led_state &= 0xfff80000; 1419 port_led_state &= EM_MSG_LED_VALUE_OFF;
1403 port_led_state |= (ap->port_no | (link->pmp << 8)); 1420 port_led_state |= (ap->port_no | (link->pmp << 8));
1404 port_led_state |= 0x00010000; /* check this */ 1421 port_led_state |= EM_MSG_LED_VALUE_ON; /* check this */
1405 ahci_transmit_led_message(ap, port_led_state, 4); 1422 ahci_transmit_led_message(ap, port_led_state, 4);
1406 } 1423 }
1407 } 1424 }
@@ -2612,7 +2629,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2612 u32 em_loc = readl(mmio + HOST_EM_LOC); 2629 u32 em_loc = readl(mmio + HOST_EM_LOC);
2613 u32 em_ctl = readl(mmio + HOST_EM_CTL); 2630 u32 em_ctl = readl(mmio + HOST_EM_CTL);
2614 2631
2615 messages = (em_ctl & 0x000f0000) >> 16; 2632 messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16;
2616 2633
2617 /* we only support LED message type right now */ 2634 /* we only support LED message type right now */
2618 if ((messages & 0x01) && (ahci_em_messages == 1)) { 2635 if ((messages & 0x01) && (ahci_em_messages == 1)) {
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 75a406f5e694..5c33767e66de 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * ata_generic.c - Generic PATA/SATA controller driver. 2 * ata_generic.c - Generic PATA/SATA controller driver.
3 * Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved. 3 * Copyright 2005 Red Hat Inc, all rights reserved.
4 * 4 *
5 * Elements from ide/pci/generic.c 5 * Elements from ide/pci/generic.c
6 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 6 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index e9e32ed6b1a3..52dc2d8b8f22 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -14,7 +14,7 @@
14 * 14 *
15 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 15 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
16 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 16 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
17 * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> 17 * Copyright (C) 2003 Red Hat Inc
18 * 18 *
19 * 19 *
20 * This program is free software; you can redistribute it and/or modify 20 * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8cb0b360bfd8..2ff633c119e2 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4156,29 +4156,33 @@ static int cable_is_40wire(struct ata_port *ap)
4156 struct ata_link *link; 4156 struct ata_link *link;
4157 struct ata_device *dev; 4157 struct ata_device *dev;
4158 4158
4159 /* If the controller thinks we are 40 wire, we are */ 4159 /* If the controller thinks we are 40 wire, we are. */
4160 if (ap->cbl == ATA_CBL_PATA40) 4160 if (ap->cbl == ATA_CBL_PATA40)
4161 return 1; 4161 return 1;
4162 /* If the controller thinks we are 80 wire, we are */ 4162
4163 /* If the controller thinks we are 80 wire, we are. */
4163 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) 4164 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA)
4164 return 0; 4165 return 0;
4165 /* If the system is known to be 40 wire short cable (eg laptop), 4166
4166 then we allow 80 wire modes even if the drive isn't sure */ 4167 /* If the system is known to be 40 wire short cable (eg
4168 * laptop), then we allow 80 wire modes even if the drive
4169 * isn't sure.
4170 */
4167 if (ap->cbl == ATA_CBL_PATA40_SHORT) 4171 if (ap->cbl == ATA_CBL_PATA40_SHORT)
4168 return 0; 4172 return 0;
4169 /* If the controller doesn't know we scan 4173
4170 4174 /* If the controller doesn't know, we scan.
4171 - Note: We look for all 40 wire detects at this point. 4175 *
4172 Any 80 wire detect is taken to be 80 wire cable 4176 * Note: We look for all 40 wire detects at this point. Any
4173 because 4177 * 80 wire detect is taken to be 80 wire cable because
4174 - In many setups only the one drive (slave if present) 4178 * - in many setups only the one drive (slave if present) will
4175 will give a valid detect 4179 * give a valid detect
4176 - If you have a non detect capable drive you don't 4180 * - if you have a non detect capable drive you don't want it
4177 want it to colour the choice 4181 * to colour the choice
4178 */ 4182 */
4179 ata_port_for_each_link(link, ap) { 4183 ata_port_for_each_link(link, ap) {
4180 ata_link_for_each_dev(dev, link) { 4184 ata_link_for_each_dev(dev, link) {
4181 if (!ata_is_40wire(dev)) 4185 if (ata_dev_enabled(dev) && !ata_is_40wire(dev))
4182 return 0; 4186 return 0;
4183 } 4187 }
4184 } 4188 }
@@ -4553,6 +4557,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
4553/** 4557/**
4554 * ata_qc_new_init - Request an available ATA command, and initialize it 4558 * ata_qc_new_init - Request an available ATA command, and initialize it
4555 * @dev: Device from whom we request an available command structure 4559 * @dev: Device from whom we request an available command structure
4560 * @tag: command tag
4556 * 4561 *
4557 * LOCKING: 4562 * LOCKING:
4558 * None. 4563 * None.
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5d687d7cffae..8077bdf5d30d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -603,6 +603,9 @@ void ata_scsi_error(struct Scsi_Host *host)
603 ata_link_for_each_dev(dev, link) { 603 ata_link_for_each_dev(dev, link) {
604 int devno = dev->devno; 604 int devno = dev->devno;
605 605
606 if (!ata_dev_enabled(dev))
607 continue;
608
606 ehc->saved_xfer_mode[devno] = dev->xfer_mode; 609 ehc->saved_xfer_mode[devno] = dev->xfer_mode;
607 if (ata_ncq_enabled(dev)) 610 if (ata_ncq_enabled(dev))
608 ehc->saved_ncq_enabled |= 1 << devno; 611 ehc->saved_ncq_enabled |= 1 << devno;
@@ -1161,6 +1164,7 @@ void ata_eh_detach_dev(struct ata_device *dev)
1161{ 1164{
1162 struct ata_link *link = dev->link; 1165 struct ata_link *link = dev->link;
1163 struct ata_port *ap = link->ap; 1166 struct ata_port *ap = link->ap;
1167 struct ata_eh_context *ehc = &link->eh_context;
1164 unsigned long flags; 1168 unsigned long flags;
1165 1169
1166 ata_dev_disable(dev); 1170 ata_dev_disable(dev);
@@ -1174,9 +1178,11 @@ void ata_eh_detach_dev(struct ata_device *dev)
1174 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; 1178 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
1175 } 1179 }
1176 1180
1177 /* clear per-dev EH actions */ 1181 /* clear per-dev EH info */
1178 ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); 1182 ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK);
1179 ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); 1183 ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK);
1184 ehc->saved_xfer_mode[dev->devno] = 0;
1185 ehc->saved_ncq_enabled &= ~(1 << dev->devno);
1180 1186
1181 spin_unlock_irqrestore(ap->lock, flags); 1187 spin_unlock_irqrestore(ap->lock, flags);
1182} 1188}
@@ -2787,6 +2793,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2787 2793
2788 /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ 2794 /* if data transfer is verified, clear DUBIOUS_XFER on ering top */
2789 ata_link_for_each_dev(dev, link) { 2795 ata_link_for_each_dev(dev, link) {
2796 if (!ata_dev_enabled(dev))
2797 continue;
2798
2790 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { 2799 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) {
2791 struct ata_ering_entry *ent; 2800 struct ata_ering_entry *ent;
2792 2801
@@ -2808,6 +2817,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2808 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; 2817 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno];
2809 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); 2818 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno));
2810 2819
2820 if (!ata_dev_enabled(dev))
2821 continue;
2822
2811 if (dev->xfer_mode != saved_xfer_mode || 2823 if (dev->xfer_mode != saved_xfer_mode ||
2812 ata_ncq_enabled(dev) != saved_ncq) 2824 ata_ncq_enabled(dev) != saved_ncq)
2813 dev->flags |= ATA_DFLAG_DUBIOUS_XFER; 2825 dev->flags |= ATA_DFLAG_DUBIOUS_XFER;
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index eb919c16a03e..e2e332d8ff95 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * ACPI PATA driver 2 * ACPI PATA driver
3 * 3 *
4 * (c) 2007 Red Hat <alan@redhat.com> 4 * (c) 2007 Red Hat
5 */ 5 */
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 5ca70fa1f587..73c466e452ca 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_ali.c - ALI 15x3 PATA for new ATA layer 2 * pata_ali.c - ALI 15x3 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based in part upon 5 * based in part upon
7 * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02 6 * linux/drivers/ide/pci/alim15x3.c Version 0.17 2003/01/02
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 57dd00f463d3..0ec9c7d9fe9d 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_amd.c - AMD PATA for new ATA layer 2 * pata_amd.c - AMD PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based on pata-sil680. Errata information is taken from data sheets 5 * Based on pata-sil680. Errata information is taken from data sheets
7 * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are 6 * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 0f513bc11193..6b3092c75ffe 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_artop.c - ARTOP ATA controller driver 2 * pata_artop.c - ARTOP ATA controller driver
3 * 3 *
4 * (C) 2006 Red Hat <alan@redhat.com> 4 * (C) 2006 Red Hat
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based in part on drivers/ide/pci/aec62xx.c 7 * Based in part on drivers/ide/pci/aec62xx.c
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index e8a0d99d7356..0e2cde8f9973 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_atiixp.c - ATI PATA for new ATA layer 2 * pata_atiixp.c - ATI PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based on 5 * Based on
7 * 6 *
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 2de30b990278..34a394264c3d 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_cmd640.c - CMD640 PCI PATA for new ATA layer 2 * pata_cmd640.c - CMD640 PCI PATA for new ATA layer
3 * (C) 2007 Red Hat Inc 3 * (C) 2007 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based upon 5 * Based upon
7 * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996 6 * linux/drivers/ide/pci/cmd640.c Version 1.02 Sep 01, 1996
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index ddd09b7d98c9..3167d8fed2f2 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_cmd64x.c - CMD64x PATA for new ATA layer 2 * pata_cmd64x.c - CMD64x PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * Based upon 6 * Based upon
7 * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 7 * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 0c4b271a9d5a..bba453381f44 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata-cs5530.c - CS5530 PATA for new ATA layer 2 * pata-cs5530.c - CS5530 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based upon cs5530.c by Mark Lord. 5 * based upon cs5530.c by Mark Lord.
7 * 6 *
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index f1b6556f0483..1b2d4a0f5f74 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata-cs5535.c - CS5535 PATA for new ATA layer 2 * pata-cs5535.c - CS5535 PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and 6 * based upon cs5535.c from AMD <Jens.Altmann@amd.com> as cleaned up and
7 * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de 7 * made readable and Linux style by Wolfgang Zuleger <wolfgang.zuleger@gmx.de
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index 2ff62608ae37..d546425cd380 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_cypress.c - Cypress PATA for new ATA layer 2 * pata_cypress.c - Cypress PATA for new ATA layer
3 * (C) 2006 Red Hat Inc 3 * (C) 2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox
5 * 5 *
6 * Based heavily on 6 * Based heavily on
7 * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 7 * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index 9fba82976ba6..ac6392ea35b0 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_efar.c - EFAR PIIX clone controller driver 2 * pata_efar.c - EFAR PIIX clone controller driver
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat
5 * 5 *
6 * Some parts based on ata_piix.c by Jeff Garzik and others. 6 * Some parts based on ata_piix.c by Jeff Garzik and others.
7 * 7 *
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 6a111baab523..15cdb9148aab 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -1,7 +1,7 @@
1 1
2/* 2/*
3 * pata-isapnp.c - ISA PnP PATA controller driver. 3 * pata-isapnp.c - ISA PnP PATA controller driver.
4 * Copyright 2005/2006 Red Hat Inc <alan@redhat.com>, all rights reserved. 4 * Copyright 2005/2006 Red Hat Inc, all rights reserved.
5 * 5 *
6 * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru> 6 * Based in part on ide-pnp.c by Andrey Panin <pazke@donpac.ru>
7 */ 7 */
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 0221c9a46769..860ede526282 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_it821x.c - IT821x PATA for new ATA layer 2 * pata_it821x.c - IT821x PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * based upon 7 * based upon
@@ -10,7 +10,7 @@
10 * 10 *
11 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 11 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004
12 * 12 *
13 * Copyright (C) 2004 Red Hat <alan@redhat.com> 13 * Copyright (C) 2004 Red Hat
14 * 14 *
15 * May be copied or modified under the terms of the GNU General Public License 15 * May be copied or modified under the terms of the GNU General Public License
16 * Based in part on the ITE vendor provided SCSI driver. 16 * Based in part on the ITE vendor provided SCSI driver.
@@ -557,9 +557,8 @@ static unsigned int it821x_read_id(struct ata_device *adev,
557 if (strstr(model_num, "Integrated Technology Express")) { 557 if (strstr(model_num, "Integrated Technology Express")) {
558 /* Set feature bits the firmware neglects */ 558 /* Set feature bits the firmware neglects */
559 id[49] |= 0x0300; /* LBA, DMA */ 559 id[49] |= 0x0300; /* LBA, DMA */
560 id[82] |= 0x0400; /* LBA48 */
561 id[83] &= 0x7FFF; 560 id[83] &= 0x7FFF;
562 id[83] |= 0x4000; /* Word 83 is valid */ 561 id[83] |= 0x4400; /* Word 83 is valid and LBA48 */
563 id[86] |= 0x0400; /* LBA48 on */ 562 id[86] |= 0x0400; /* LBA48 on */
564 id[ATA_ID_MAJOR_VER] |= 0x1F; 563 id[ATA_ID_MAJOR_VER] |= 0x1F;
565 } 564 }
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 73b7596816b4..38cf1ab2d289 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -4,7 +4,7 @@
4 * driven by AHCI in the usual configuration although 4 * driven by AHCI in the usual configuration although
5 * this driver can handle other setups if we need it. 5 * this driver can handle other setups if we need it.
6 * 6 *
7 * (c) 2006 Red Hat <alan@redhat.com> 7 * (c) 2006 Red Hat
8 */ 8 */
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index bc037ffce200..930c2208640b 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata-legacy.c - Legacy port PATA/SATA controller driver. 2 * pata-legacy.c - Legacy port PATA/SATA controller driver.
3 * Copyright 2005/2006 Red Hat <alan@redhat.com>, all rights reserved. 3 * Copyright 2005/2006 Red Hat, all rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 0d87eec84966..76e399bf8c1b 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -5,7 +5,7 @@
5 * isn't making full use of the device functionality but it is 5 * isn't making full use of the device functionality but it is
6 * easy to get working. 6 * easy to get working.
7 * 7 *
8 * (c) 2006 Red Hat <alan@redhat.com> 8 * (c) 2006 Red Hat
9 */ 9 */
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index 7d7e3fdab71f..7c8faa48b5f3 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_mpiix.c - Intel MPIIX PATA for new ATA layer 2 * pata_mpiix.c - Intel MPIIX PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * The MPIIX is different enough to the PIIX4 and friends that we give it 6 * The MPIIX is different enough to the PIIX4 and friends that we give it
7 * a separate driver. The old ide/pci code handles this by just not tuning 7 * a separate driver. The old ide/pci code handles this by just not tuning
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index d9719c8b9dbe..9dc05e1656a8 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_netcell.c - Netcell PATA driver 2 * pata_netcell.c - Netcell PATA driver
3 * 3 *
4 * (c) 2006 Red Hat <alan@redhat.com> 4 * (c) 2006 Red Hat
5 */ 5 */
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c
index 565e67cd13fa..4e466eae8b46 100644
--- a/drivers/ata/pata_ninja32.c
+++ b/drivers/ata/pata_ninja32.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_ninja32.c - Ninja32 PATA for new ATA layer 2 * pata_ninja32.c - Ninja32 PATA for new ATA layer
3 * (C) 2007 Red Hat Inc 3 * (C) 2007 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Note: The controller like many controllers has shared timings for 5 * Note: The controller like many controllers has shared timings for
7 * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back 6 * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back
@@ -45,7 +44,7 @@
45#include <linux/libata.h> 44#include <linux/libata.h>
46 45
47#define DRV_NAME "pata_ninja32" 46#define DRV_NAME "pata_ninja32"
48#define DRV_VERSION "0.0.1" 47#define DRV_VERSION "0.1.1"
49 48
50 49
51/** 50/**
@@ -89,6 +88,17 @@ static struct ata_port_operations ninja32_port_ops = {
89 .set_piomode = ninja32_set_piomode, 88 .set_piomode = ninja32_set_piomode,
90}; 89};
91 90
91static void ninja32_program(void __iomem *base)
92{
93 iowrite8(0x05, base + 0x01); /* Enable interrupt lines */
94 iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */
95 iowrite8(0x01, base + 0x03); /* Unknown */
96 iowrite8(0x20, base + 0x04); /* WAIT0 */
97 iowrite8(0x8f, base + 0x05); /* Unknown */
98 iowrite8(0xa4, base + 0x1c); /* Unknown */
99 iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */
100}
101
92static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) 102static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)
93{ 103{
94 struct ata_host *host; 104 struct ata_host *host;
@@ -134,18 +144,28 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)
134 ap->ioaddr.bmdma_addr = base; 144 ap->ioaddr.bmdma_addr = base;
135 ata_sff_std_ports(&ap->ioaddr); 145 ata_sff_std_ports(&ap->ioaddr);
136 146
137 iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ 147 ninja32_program(base);
138 iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */
139 iowrite8(0x01, base + 0x03); /* Unknown */
140 iowrite8(0x20, base + 0x04); /* WAIT0 */
141 iowrite8(0x8f, base + 0x05); /* Unknown */
142 iowrite8(0xa4, base + 0x1c); /* Unknown */
143 iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */
144 /* FIXME: Should we disable them at remove ? */ 148 /* FIXME: Should we disable them at remove ? */
145 return ata_host_activate(host, dev->irq, ata_sff_interrupt, 149 return ata_host_activate(host, dev->irq, ata_sff_interrupt,
146 IRQF_SHARED, &ninja32_sht); 150 IRQF_SHARED, &ninja32_sht);
147} 151}
148 152
153#ifdef CONFIG_PM
154
155static int ninja32_reinit_one(struct pci_dev *pdev)
156{
157 struct ata_host *host = dev_get_drvdata(&pdev->dev);
158 int rc;
159
160 rc = ata_pci_device_do_resume(pdev);
161 if (rc)
162 return rc;
163 ninja32_program(host->iomap[0]);
164 ata_host_resume(host);
165 return 0;
166}
167#endif
168
149static const struct pci_device_id ninja32[] = { 169static const struct pci_device_id ninja32[] = {
150 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 170 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
151 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 171 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -156,7 +176,11 @@ static struct pci_driver ninja32_pci_driver = {
156 .name = DRV_NAME, 176 .name = DRV_NAME,
157 .id_table = ninja32, 177 .id_table = ninja32,
158 .probe = ninja32_init_one, 178 .probe = ninja32_init_one,
159 .remove = ata_pci_remove_one 179 .remove = ata_pci_remove_one,
180#ifdef CONFIG_PM
181 .suspend = ata_pci_device_suspend,
182 .resume = ninja32_reinit_one,
183#endif
160}; 184};
161 185
162static int __init ninja32_init(void) 186static int __init ninja32_init(void)
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index be756b7ef07e..40d411c460de 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer 2 * pata_ns87410.c - National Semiconductor 87410 PATA for new ATA layer
3 * (C) 2006 Red Hat Inc 3 * (C) 2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index e0aa7eaaee0a..89bf5f865d6a 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_ns87415.c - NS87415 (non PARISC) PATA 2 * pata_ns87415.c - NS87415 (non PARISC) PATA
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * This is a fairly generic MWDMA controller. It has some limitations 6 * This is a fairly generic MWDMA controller. It has some limitations
7 * as it requires timing reloads on PIO/DMA transitions but it is otherwise 7 * as it requires timing reloads on PIO/DMA transitions but it is otherwise
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index df64f2443001..c0dbc46a348e 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_oldpiix.c - Intel PATA/SATA controllers 2 * pata_oldpiix.c - Intel PATA/SATA controllers
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat
5 * 5 *
6 * Some parts based on ata_piix.c by Jeff Garzik and others. 6 * Some parts based on ata_piix.c by Jeff Garzik and others.
7 * 7 *
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index fb2cf661b0e8..e4fa4d565e96 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_opti.c - ATI PATA for new ATA layer 2 * pata_opti.c - ATI PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based on 5 * Based on
7 * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 6 * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 4cd744456313..93bb6e91973f 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_optidma.c - Opti DMA PATA for new ATA layer 2 * pata_optidma.c - Opti DMA PATA for new ATA layer
3 * (C) 2006 Red Hat Inc 3 * (C) 2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * The Opti DMA controllers are related to the older PIO PCI controllers 5 * The Opti DMA controllers are related to the older PIO PCI controllers
7 * and indeed the VLB ones. The main differences are that the timing 6 * and indeed the VLB ones. The main differences are that the timing
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 02b596b9cf6a..271cb64d429e 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata_pcmcia.c - PCMCIA PATA controller driver. 2 * pata_pcmcia.c - PCMCIA PATA controller driver.
3 * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. 3 * Copyright 2005-2006 Red Hat Inc, all rights reserved.
4 * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz 4 * PCMCIA ident update Copyright 2006 Marcin Juszkiewicz
5 * <openembedded@hrw.one.pl> 5 * <openembedded@hrw.one.pl>
6 * 6 *
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index d2673060bc8d..799a6a098712 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer 2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c 7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 8f65ad61b8af..77e4e3b17f54 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Based on pata_pcmcia: 6 * Based on pata_pcmcia:
7 * 7 *
8 * Copyright 2005-2006 Red Hat Inc <alan@redhat.com>, all rights reserved. 8 * Copyright 2005-2006 Red Hat Inc, all rights reserved.
9 * 9 *
10 * This file is subject to the terms and conditions of the GNU General Public 10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive 11 * License. See the file "COPYING" in the main directory of this archive
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 63b7a1c165a5..3080f371222c 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata_qdi.c - QDI VLB ATA controllers 2 * pata_qdi.c - QDI VLB ATA controllers
3 * (C) 2006 Red Hat <alan@redhat.com> 3 * (C) 2006 Red Hat
4 * 4 *
5 * This driver mostly exists as a proof of concept for non PCI devices under 5 * This driver mostly exists as a proof of concept for non PCI devices under
6 * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly 6 * libata. While the QDI6580 was 'neat' in 1993 it is no longer terribly
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index 1c0d9fa7ee54..0b0aa452de14 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_radisys.c - Intel PATA/SATA controllers 2 * pata_radisys.c - Intel PATA/SATA controllers
3 * 3 *
4 * (C) 2006 Red Hat <alan@redhat.com> 4 * (C) 2006 Red Hat <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * Some parts based on ata_piix.c by Jeff Garzik and others. 6 * Some parts based on ata_piix.c by Jeff Garzik and others.
7 * 7 *
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 0278fd2b8fb1..9a4bdca54616 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * New ATA layer SC1200 driver Alan Cox <alan@redhat.com> 2 * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk>
3 * 3 *
4 * TODO: Mode selection filtering 4 * TODO: Mode selection filtering
5 * TODO: Can't enable second channel until ATA core has serialize 5 * TODO: Can't enable second channel until ATA core has serialize
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 16673d168573..cf3707e516a2 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -8,7 +8,7 @@
8 * Copyright 2003-2005 Jeff Garzik 8 * Copyright 2003-2005 Jeff Garzik
9 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 9 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
10 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 10 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
11 * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> 11 * Copyright (C) 2003 Red Hat Inc
12 * 12 *
13 * and drivers/ata/ahci.c: 13 * and drivers/ata/ahci.c:
14 * Copyright 2004-2005 Red Hat, Inc. 14 * Copyright 2004-2005 Red Hat, Inc.
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index ffd26d0dc50d..72e41c9f969b 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_serverworks.c - Serverworks PATA for new ATA layer 2 * pata_serverworks.c - Serverworks PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based upon 5 * based upon
7 * 6 *
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index a598bb36aafc..83580a59db58 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_sil680.c - SIL680 PATA for new ATA layer 2 * pata_sil680.c - SIL680 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * based upon 5 * based upon
7 * 6 *
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 26345d7b531c..d34236611752 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_sis.c - SiS ATA driver 2 * pata_sis.c - SiS ATA driver
3 * 3 *
4 * (C) 2005 Red Hat <alan@redhat.com> 4 * (C) 2005 Red Hat
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based upon linux/drivers/ide/pci/sis5513.c 7 * Based upon linux/drivers/ide/pci/sis5513.c
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 69877bd81815..1b0e7b6d8ef5 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_sl82c105.c - SL82C105 PATA for new ATA layer 2 * pata_sl82c105.c - SL82C105 PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Based in part on linux/drivers/ide/pci/sl82c105.c 5 * Based in part on linux/drivers/ide/pci/sl82c105.c
7 * SL82C105/Winbond 553 IDE driver 6 * SL82C105/Winbond 553 IDE driver
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index b181261f2743..ef9597517cdd 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pata_triflex.c - Compaq PATA for new ATA layer 2 * pata_triflex.c - Compaq PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@redhat.com> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * 5 *
6 * based upon 6 * based upon
7 * 7 *
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 8fdb2ce73210..681169c9c640 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * pata_via.c - VIA PATA for new ATA layer 2 * pata_via.c - VIA PATA for new ATA layer
3 * (C) 2005-2006 Red Hat Inc 3 * (C) 2005-2006 Red Hat Inc
4 * Alan Cox <alan@redhat.com>
5 * 4 *
6 * Documentation 5 * Documentation
7 * Most chipset documentation available under NDA only 6 * Most chipset documentation available under NDA only
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index a7606b044a61..319e164a3d74 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * pata_winbond.c - Winbond VLB ATA controllers 2 * pata_winbond.c - Winbond VLB ATA controllers
3 * (C) 2006 Red Hat <alan@redhat.com> 3 * (C) 2006 Red Hat
4 * 4 *
5 * Support for the Winbond 83759A when operating in advanced mode. 5 * Support for the Winbond 83759A when operating in advanced mode.
6 * Multichip mode is not currently supported. 6 * Multichip mode is not currently supported.
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 4621807a1a6a..ccee930f1e12 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1329,6 +1329,11 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1329 } 1329 }
1330 } 1330 }
1331 1331
1332 /* Set max read request size to 4096. This slightly increases
1333 * write throughput for pci-e variants.
1334 */
1335 pcie_set_readrq(pdev, 4096);
1336
1332 sil24_init_controller(host); 1337 sil24_init_controller(host);
1333 1338
1334 pci_set_master(pdev); 1339 pci_set_master(pdev);
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 75dd6e22faff..c98c31ec2f75 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -355,7 +355,7 @@ static void __sysdev_resume(struct sys_device *dev)
355 * sysdev_suspend - Suspend all system devices. 355 * sysdev_suspend - Suspend all system devices.
356 * @state: Power state to enter. 356 * @state: Power state to enter.
357 * 357 *
358 * We perform an almost identical operation as sys_device_shutdown() 358 * We perform an almost identical operation as sysdev_shutdown()
359 * above, though calling ->suspend() instead. Interrupts are disabled 359 * above, though calling ->suspend() instead. Interrupts are disabled
360 * when this called. Devices are responsible for both saving state and 360 * when this called. Devices are responsible for both saving state and
361 * quiescing or powering down the device. 361 * quiescing or powering down the device.
@@ -437,7 +437,7 @@ aux_driver:
437/** 437/**
438 * sysdev_resume - Bring system devices back to life. 438 * sysdev_resume - Bring system devices back to life.
439 * 439 *
440 * Similar to sys_device_suspend(), but we iterate the list forwards 440 * Similar to sysdev_suspend(), but we iterate the list forwards
441 * to guarantee that parent devices are resumed before their children. 441 * to guarantee that parent devices are resumed before their children.
442 * 442 *
443 * Note: Interrupts are disabled when called. 443 * Note: Interrupts are disabled when called.
@@ -488,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
488 if (end == buf) 488 if (end == buf)
489 return -EINVAL; 489 return -EINVAL;
490 *(unsigned long *)(ea->var) = new; 490 *(unsigned long *)(ea->var) = new;
491 return end - buf; 491 /* Always return full write size even if we didn't consume all */
492 return size;
492} 493}
493EXPORT_SYMBOL_GPL(sysdev_store_ulong); 494EXPORT_SYMBOL_GPL(sysdev_store_ulong);
494 495
@@ -511,7 +512,8 @@ ssize_t sysdev_store_int(struct sys_device *sysdev,
511 if (end == buf || new > INT_MAX || new < INT_MIN) 512 if (end == buf || new > INT_MAX || new < INT_MIN)
512 return -EINVAL; 513 return -EINVAL;
513 *(int *)(ea->var) = new; 514 *(int *)(ea->var) = new;
514 return end - buf; 515 /* Always return full write size even if we didn't consume all */
516 return size;
515} 517}
516EXPORT_SYMBOL_GPL(sysdev_store_int); 518EXPORT_SYMBOL_GPL(sysdev_store_int);
517 519
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 3f09cd8bcc38..5c4ee70d5cf3 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -40,8 +40,7 @@
40 * Heinz Mauelshagen <mge@sistina.com>, Feb 2002 40 * Heinz Mauelshagen <mge@sistina.com>, Feb 2002
41 * 41 *
42 * Support for falling back on the write file operation when the address space 42 * Support for falling back on the write file operation when the address space
43 * operations prepare_write and/or commit_write are not available on the 43 * operations write_begin is not available on the backing filesystem.
44 * backing filesystem.
45 * Anton Altaparmakov, 16 Feb 2005 44 * Anton Altaparmakov, 16 Feb 2005
46 * 45 *
47 * Still To Fix: 46 * Still To Fix:
@@ -765,7 +764,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
765 */ 764 */
766 if (!file->f_op->splice_read) 765 if (!file->f_op->splice_read)
767 goto out_putf; 766 goto out_putf;
768 if (aops->prepare_write || aops->write_begin) 767 if (aops->write_begin)
769 lo_flags |= LO_FLAGS_USE_AOPS; 768 lo_flags |= LO_FLAGS_USE_AOPS;
770 if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write) 769 if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
771 lo_flags |= LO_FLAGS_READ_ONLY; 770 lo_flags |= LO_FLAGS_READ_ONLY;
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index e6ee21d99d92..b0e569ba730d 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -867,7 +867,7 @@ static int bluecard_probe(struct pcmcia_device *link)
867 867
868 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 868 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
869 link->io.NumPorts1 = 8; 869 link->io.NumPorts1 = 8;
870 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 870 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
871 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 871 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
872 872
873 link->irq.Handler = bluecard_interrupt; 873 link->irq.Handler = bluecard_interrupt;
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 2cbe70b66470..b3e4d07a4ac2 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -343,6 +343,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
343 bt3c_info_t *info = dev_inst; 343 bt3c_info_t *info = dev_inst;
344 unsigned int iobase; 344 unsigned int iobase;
345 int iir; 345 int iir;
346 irqreturn_t r = IRQ_NONE;
346 347
347 BUG_ON(!info->hdev); 348 BUG_ON(!info->hdev);
348 349
@@ -374,11 +375,12 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
374 375
375 outb(iir, iobase + CONTROL); 376 outb(iir, iobase + CONTROL);
376 } 377 }
378 r = IRQ_HANDLED;
377 } 379 }
378 380
379 spin_unlock(&(info->lock)); 381 spin_unlock(&(info->lock));
380 382
381 return IRQ_HANDLED; 383 return r;
382} 384}
383 385
384 386
@@ -657,7 +659,7 @@ static int bt3c_probe(struct pcmcia_device *link)
657 659
658 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 660 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
659 link->io.NumPorts1 = 8; 661 link->io.NumPorts1 = 8;
660 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 662 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
661 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 663 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
662 664
663 link->irq.Handler = bt3c_interrupt; 665 link->irq.Handler = bt3c_interrupt;
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 8e556b7ff9f6..efd689a062eb 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -293,6 +293,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
293 unsigned int iobase; 293 unsigned int iobase;
294 int boguscount = 0; 294 int boguscount = 0;
295 int iir, lsr; 295 int iir, lsr;
296 irqreturn_t r = IRQ_NONE;
296 297
297 BUG_ON(!info->hdev); 298 BUG_ON(!info->hdev);
298 299
@@ -302,6 +303,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
302 303
303 iir = inb(iobase + UART_IIR) & UART_IIR_ID; 304 iir = inb(iobase + UART_IIR) & UART_IIR_ID;
304 while (iir) { 305 while (iir) {
306 r = IRQ_HANDLED;
305 307
306 /* Clear interrupt */ 308 /* Clear interrupt */
307 lsr = inb(iobase + UART_LSR); 309 lsr = inb(iobase + UART_LSR);
@@ -335,7 +337,7 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst)
335 337
336 spin_unlock(&(info->lock)); 338 spin_unlock(&(info->lock));
337 339
338 return IRQ_HANDLED; 340 return r;
339} 341}
340 342
341 343
@@ -586,7 +588,7 @@ static int btuart_probe(struct pcmcia_device *link)
586 588
587 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 589 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
588 link->io.NumPorts1 = 8; 590 link->io.NumPorts1 = 8;
589 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 591 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
590 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 592 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
591 593
592 link->irq.Handler = btuart_interrupt; 594 link->irq.Handler = btuart_interrupt;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index e6e6b037695a..901bdd95655f 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -297,6 +297,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
297 unsigned char msr; 297 unsigned char msr;
298 int boguscount = 0; 298 int boguscount = 0;
299 int iir, lsr; 299 int iir, lsr;
300 irqreturn_t r = IRQ_NONE;
300 301
301 BUG_ON(!info->hdev); 302 BUG_ON(!info->hdev);
302 303
@@ -307,6 +308,7 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
307 iir = inb(iobase + UART_IIR) & UART_IIR_ID; 308 iir = inb(iobase + UART_IIR) & UART_IIR_ID;
308 while (iir) { 309 while (iir) {
309 310
311 r = IRQ_HANDLED;
310 /* Clear interrupt */ 312 /* Clear interrupt */
311 lsr = inb(iobase + UART_LSR); 313 lsr = inb(iobase + UART_LSR);
312 314
@@ -343,11 +345,12 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst)
343 info->ri_latch = msr & UART_MSR_RI; 345 info->ri_latch = msr & UART_MSR_RI;
344 clear_bit(XMIT_WAITING, &(info->tx_state)); 346 clear_bit(XMIT_WAITING, &(info->tx_state));
345 dtl1_write_wakeup(info); 347 dtl1_write_wakeup(info);
348 r = IRQ_HANDLED;
346 } 349 }
347 350
348 spin_unlock(&(info->lock)); 351 spin_unlock(&(info->lock));
349 352
350 return IRQ_HANDLED; 353 return r;
351} 354}
352 355
353 356
@@ -568,7 +571,7 @@ static int dtl1_probe(struct pcmcia_device *link)
568 571
569 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 572 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
570 link->io.NumPorts1 = 8; 573 link->io.NumPorts1 = 8;
571 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 574 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
572 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 575 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
573 576
574 link->irq.Handler = dtl1_interrupt; 577 link->irq.Handler = dtl1_interrupt;
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 122254155ae1..43b35d0369d6 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -812,28 +812,6 @@ config JS_RTC
812 To compile this driver as a module, choose M here: the 812 To compile this driver as a module, choose M here: the
813 module will be called js-rtc. 813 module will be called js-rtc.
814 814
815config SGI_DS1286
816 tristate "SGI DS1286 RTC support"
817 depends on SGI_HAS_DS1286
818 help
819 If you say Y here and create a character special file /dev/rtc with
820 major number 10 and minor number 135 using mknod ("man mknod"), you
821 will get access to the real time clock built into your computer.
822 Every SGI has such a clock built in. It reports status information
823 via the file /proc/rtc and its behaviour is set by various ioctls on
824 /dev/rtc.
825
826config SGI_IP27_RTC
827 bool "SGI M48T35 RTC support"
828 depends on SGI_IP27
829 help
830 If you say Y here and create a character special file /dev/rtc with
831 major number 10 and minor number 135 using mknod ("man mknod"), you
832 will get access to the real time clock built into your computer.
833 Every SGI has such a clock built in. It reports status information
834 via the file /proc/rtc and its behaviour is set by various ioctls on
835 /dev/rtc.
836
837config GEN_RTC 815config GEN_RTC
838 tristate "Generic /dev/rtc emulation" 816 tristate "Generic /dev/rtc emulation"
839 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32 817 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 1a4247dccac4..438f71317c5c 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_RTC) += rtc.o
74obj-$(CONFIG_HPET) += hpet.o 74obj-$(CONFIG_HPET) += hpet.o
75obj-$(CONFIG_GEN_RTC) += genrtc.o 75obj-$(CONFIG_GEN_RTC) += genrtc.o
76obj-$(CONFIG_EFI_RTC) += efirtc.o 76obj-$(CONFIG_EFI_RTC) += efirtc.o
77obj-$(CONFIG_SGI_DS1286) += ds1286.o
78obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o
79obj-$(CONFIG_DS1302) += ds1302.o 77obj-$(CONFIG_DS1302) += ds1302.o
80obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ 78obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/
81ifeq ($(CONFIG_GENERIC_NVRAM),y) 79ifeq ($(CONFIG_GENERIC_NVRAM),y)
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
deleted file mode 100644
index 0a826d7be10e..000000000000
--- a/drivers/char/ds1286.c
+++ /dev/null
@@ -1,585 +0,0 @@
1/*
2 * DS1286 Real Time Clock interface for Linux
3 *
4 * Copyright (C) 1998, 1999, 2000 Ralf Baechle
5 *
6 * Based on code written by Paul Gortmaker.
7 *
8 * This driver allows use of the real time clock (built into nearly all
9 * computers) from user space. It exports the /dev/rtc interface supporting
10 * various ioctl() and also the /proc/rtc pseudo-file for status
11 * information.
12 *
13 * The ioctls can be used to set the interrupt behaviour and generation rate
14 * from the RTC via IRQ 8. Then the /dev/rtc interface can be used to make
15 * use of these timer interrupts, be they interval or alarm based.
16 *
17 * The /dev/rtc interface will block on reads until an interrupt has been
18 * received. If a RTC interrupt has already happened, it will output an
19 * unsigned long and then block. The output value contains the interrupt
20 * status in the low byte and the number of interrupts since the last read
21 * in the remaining high bytes. The /dev/rtc interface can also be used with
22 * the select(2) call.
23 *
24 * This program is free software; you can redistribute it and/or modify it
25 * under the terms of the GNU General Public License as published by the
26 * Free Software Foundation; either version 2 of the License, or (at your
27 * option) any later version.
28 */
29#include <linux/ds1286.h>
30#include <linux/smp_lock.h>
31#include <linux/types.h>
32#include <linux/errno.h>
33#include <linux/miscdevice.h>
34#include <linux/slab.h>
35#include <linux/ioport.h>
36#include <linux/fcntl.h>
37#include <linux/init.h>
38#include <linux/poll.h>
39#include <linux/rtc.h>
40#include <linux/spinlock.h>
41#include <linux/bcd.h>
42#include <linux/proc_fs.h>
43#include <linux/jiffies.h>
44
45#include <asm/uaccess.h>
46#include <asm/system.h>
47
48#define DS1286_VERSION "1.0"
49
50/*
51 * We sponge a minor off of the misc major. No need slurping
52 * up another valuable major dev number for this. If you add
53 * an ioctl, make sure you don't conflict with SPARC's RTC
54 * ioctls.
55 */
56
57static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait);
58
59static ssize_t ds1286_read(struct file *file, char *buf,
60 size_t count, loff_t *ppos);
61
62static int ds1286_ioctl(struct inode *inode, struct file *file,
63 unsigned int cmd, unsigned long arg);
64
65static unsigned int ds1286_poll(struct file *file, poll_table *wait);
66
67static void ds1286_get_alm_time (struct rtc_time *alm_tm);
68static void ds1286_get_time(struct rtc_time *rtc_tm);
69static int ds1286_set_time(struct rtc_time *rtc_tm);
70
71static inline unsigned char ds1286_is_updating(void);
72
73static DEFINE_SPINLOCK(ds1286_lock);
74
75static int ds1286_read_proc(char *page, char **start, off_t off,
76 int count, int *eof, void *data);
77
78/*
79 * Bits in rtc_status. (7 bits of room for future expansion)
80 */
81
82#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */
83#define RTC_TIMER_ON 0x02 /* missed irq timer active */
84
85static unsigned char ds1286_status; /* bitmapped status byte. */
86
87static unsigned char days_in_mo[] = {
88 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
89};
90
91/*
92 * Now all the various file operations that we export.
93 */
94
95static ssize_t ds1286_read(struct file *file, char *buf,
96 size_t count, loff_t *ppos)
97{
98 return -EIO;
99}
100
101static int ds1286_ioctl(struct inode *inode, struct file *file,
102 unsigned int cmd, unsigned long arg)
103{
104 struct rtc_time wtime;
105
106 switch (cmd) {
107 case RTC_AIE_OFF: /* Mask alarm int. enab. bit */
108 {
109 unsigned long flags;
110 unsigned char val;
111
112 if (!capable(CAP_SYS_TIME))
113 return -EACCES;
114
115 spin_lock_irqsave(&ds1286_lock, flags);
116 val = rtc_read(RTC_CMD);
117 val |= RTC_TDM;
118 rtc_write(val, RTC_CMD);
119 spin_unlock_irqrestore(&ds1286_lock, flags);
120
121 return 0;
122 }
123 case RTC_AIE_ON: /* Allow alarm interrupts. */
124 {
125 unsigned long flags;
126 unsigned char val;
127
128 if (!capable(CAP_SYS_TIME))
129 return -EACCES;
130
131 spin_lock_irqsave(&ds1286_lock, flags);
132 val = rtc_read(RTC_CMD);
133 val &= ~RTC_TDM;
134 rtc_write(val, RTC_CMD);
135 spin_unlock_irqrestore(&ds1286_lock, flags);
136
137 return 0;
138 }
139 case RTC_WIE_OFF: /* Mask watchdog int. enab. bit */
140 {
141 unsigned long flags;
142 unsigned char val;
143
144 if (!capable(CAP_SYS_TIME))
145 return -EACCES;
146
147 spin_lock_irqsave(&ds1286_lock, flags);
148 val = rtc_read(RTC_CMD);
149 val |= RTC_WAM;
150 rtc_write(val, RTC_CMD);
151 spin_unlock_irqrestore(&ds1286_lock, flags);
152
153 return 0;
154 }
155 case RTC_WIE_ON: /* Allow watchdog interrupts. */
156 {
157 unsigned long flags;
158 unsigned char val;
159
160 if (!capable(CAP_SYS_TIME))
161 return -EACCES;
162
163 spin_lock_irqsave(&ds1286_lock, flags);
164 val = rtc_read(RTC_CMD);
165 val &= ~RTC_WAM;
166 rtc_write(val, RTC_CMD);
167 spin_unlock_irqrestore(&ds1286_lock, flags);
168
169 return 0;
170 }
171 case RTC_ALM_READ: /* Read the present alarm time */
172 {
173 /*
174 * This returns a struct rtc_time. Reading >= 0xc0
175 * means "don't care" or "match all". Only the tm_hour,
176 * tm_min, and tm_sec values are filled in.
177 */
178
179 memset(&wtime, 0, sizeof(wtime));
180 ds1286_get_alm_time(&wtime);
181 break;
182 }
183 case RTC_ALM_SET: /* Store a time into the alarm */
184 {
185 /*
186 * This expects a struct rtc_time. Writing 0xff means
187 * "don't care" or "match all". Only the tm_hour,
188 * tm_min and tm_sec are used.
189 */
190 unsigned char hrs, min, sec;
191 struct rtc_time alm_tm;
192
193 if (!capable(CAP_SYS_TIME))
194 return -EACCES;
195
196 if (copy_from_user(&alm_tm, (struct rtc_time*)arg,
197 sizeof(struct rtc_time)))
198 return -EFAULT;
199
200 hrs = alm_tm.tm_hour;
201 min = alm_tm.tm_min;
202 sec = alm_tm.tm_sec;
203
204 if (hrs >= 24)
205 hrs = 0xff;
206
207 if (min >= 60)
208 min = 0xff;
209
210 if (sec != 0)
211 return -EINVAL;
212
213 min = bin2bcd(min);
214 min = bin2bcd(hrs);
215
216 spin_lock(&ds1286_lock);
217 rtc_write(hrs, RTC_HOURS_ALARM);
218 rtc_write(min, RTC_MINUTES_ALARM);
219 spin_unlock(&ds1286_lock);
220
221 return 0;
222 }
223 case RTC_RD_TIME: /* Read the time/date from RTC */
224 {
225 memset(&wtime, 0, sizeof(wtime));
226 ds1286_get_time(&wtime);
227 break;
228 }
229 case RTC_SET_TIME: /* Set the RTC */
230 {
231 struct rtc_time rtc_tm;
232
233 if (!capable(CAP_SYS_TIME))
234 return -EACCES;
235
236 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
237 sizeof(struct rtc_time)))
238 return -EFAULT;
239
240 return ds1286_set_time(&rtc_tm);
241 }
242 default:
243 return -EINVAL;
244 }
245 return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
246}
247
248/*
249 * We enforce only one user at a time here with the open/close.
250 * Also clear the previous interrupt data on an open, and clean
251 * up things on a close.
252 */
253
254static int ds1286_open(struct inode *inode, struct file *file)
255{
256 lock_kernel();
257 spin_lock_irq(&ds1286_lock);
258
259 if (ds1286_status & RTC_IS_OPEN)
260 goto out_busy;
261
262 ds1286_status |= RTC_IS_OPEN;
263
264 spin_unlock_irq(&ds1286_lock);
265 unlock_kernel();
266 return 0;
267
268out_busy:
269 spin_lock_irq(&ds1286_lock);
270 unlock_kernel();
271 return -EBUSY;
272}
273
274static int ds1286_release(struct inode *inode, struct file *file)
275{
276 ds1286_status &= ~RTC_IS_OPEN;
277
278 return 0;
279}
280
281static unsigned int ds1286_poll(struct file *file, poll_table *wait)
282{
283 poll_wait(file, &ds1286_wait, wait);
284
285 return 0;
286}
287
288/*
289 * The various file operations we support.
290 */
291
292static const struct file_operations ds1286_fops = {
293 .llseek = no_llseek,
294 .read = ds1286_read,
295 .poll = ds1286_poll,
296 .ioctl = ds1286_ioctl,
297 .open = ds1286_open,
298 .release = ds1286_release,
299};
300
301static struct miscdevice ds1286_dev=
302{
303 .minor = RTC_MINOR,
304 .name = "rtc",
305 .fops = &ds1286_fops,
306};
307
308static int __init ds1286_init(void)
309{
310 int err;
311
312 printk(KERN_INFO "DS1286 Real Time Clock Driver v%s\n", DS1286_VERSION);
313
314 err = misc_register(&ds1286_dev);
315 if (err)
316 goto out;
317
318 if (!create_proc_read_entry("driver/rtc", 0, 0, ds1286_read_proc, NULL)) {
319 err = -ENOMEM;
320
321 goto out_deregister;
322 }
323
324 return 0;
325
326out_deregister:
327 misc_deregister(&ds1286_dev);
328
329out:
330 return err;
331}
332
333static void __exit ds1286_exit(void)
334{
335 remove_proc_entry("driver/rtc", NULL);
336 misc_deregister(&ds1286_dev);
337}
338
339static char *days[] = {
340 "***", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
341};
342
343/*
344 * Info exported via "/proc/rtc".
345 */
346static int ds1286_proc_output(char *buf)
347{
348 char *p, *s;
349 struct rtc_time tm;
350 unsigned char hundredth, month, cmd, amode;
351
352 p = buf;
353
354 ds1286_get_time(&tm);
355 hundredth = rtc_read(RTC_HUNDREDTH_SECOND);
356 hundredth = bcd2bin(hundredth);
357
358 p += sprintf(p,
359 "rtc_time\t: %02d:%02d:%02d.%02d\n"
360 "rtc_date\t: %04d-%02d-%02d\n",
361 tm.tm_hour, tm.tm_min, tm.tm_sec, hundredth,
362 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
363
364 /*
365 * We implicitly assume 24hr mode here. Alarm values >= 0xc0 will
366 * match any value for that particular field. Values that are
367 * greater than a valid time, but less than 0xc0 shouldn't appear.
368 */
369 ds1286_get_alm_time(&tm);
370 p += sprintf(p, "alarm\t\t: %s ", days[tm.tm_wday]);
371 if (tm.tm_hour <= 24)
372 p += sprintf(p, "%02d:", tm.tm_hour);
373 else
374 p += sprintf(p, "**:");
375
376 if (tm.tm_min <= 59)
377 p += sprintf(p, "%02d\n", tm.tm_min);
378 else
379 p += sprintf(p, "**\n");
380
381 month = rtc_read(RTC_MONTH);
382 p += sprintf(p,
383 "oscillator\t: %s\n"
384 "square_wave\t: %s\n",
385 (month & RTC_EOSC) ? "disabled" : "enabled",
386 (month & RTC_ESQW) ? "disabled" : "enabled");
387
388 amode = ((rtc_read(RTC_MINUTES_ALARM) & 0x80) >> 5) |
389 ((rtc_read(RTC_HOURS_ALARM) & 0x80) >> 6) |
390 ((rtc_read(RTC_DAY_ALARM) & 0x80) >> 7);
391 if (amode == 7) s = "each minute";
392 else if (amode == 3) s = "minutes match";
393 else if (amode == 1) s = "hours and minutes match";
394 else if (amode == 0) s = "days, hours and minutes match";
395 else s = "invalid";
396 p += sprintf(p, "alarm_mode\t: %s\n", s);
397
398 cmd = rtc_read(RTC_CMD);
399 p += sprintf(p,
400 "alarm_enable\t: %s\n"
401 "wdog_alarm\t: %s\n"
402 "alarm_mask\t: %s\n"
403 "wdog_alarm_mask\t: %s\n"
404 "interrupt_mode\t: %s\n"
405 "INTB_mode\t: %s_active\n"
406 "interrupt_pins\t: %s\n",
407 (cmd & RTC_TDF) ? "yes" : "no",
408 (cmd & RTC_WAF) ? "yes" : "no",
409 (cmd & RTC_TDM) ? "disabled" : "enabled",
410 (cmd & RTC_WAM) ? "disabled" : "enabled",
411 (cmd & RTC_PU_LVL) ? "pulse" : "level",
412 (cmd & RTC_IBH_LO) ? "low" : "high",
413 (cmd & RTC_IPSW) ? "unswapped" : "swapped");
414
415 return p - buf;
416}
417
418static int ds1286_read_proc(char *page, char **start, off_t off,
419 int count, int *eof, void *data)
420{
421 int len = ds1286_proc_output (page);
422 if (len <= off+count) *eof = 1;
423 *start = page + off;
424 len -= off;
425 if (len>count)
426 len = count;
427 if (len<0)
428 len = 0;
429
430 return len;
431}
432
433/*
434 * Returns true if a clock update is in progress
435 */
436static inline unsigned char ds1286_is_updating(void)
437{
438 return rtc_read(RTC_CMD) & RTC_TE;
439}
440
441
442static void ds1286_get_time(struct rtc_time *rtc_tm)
443{
444 unsigned char save_control;
445 unsigned long flags;
446
447 /*
448 * read RTC once any update in progress is done. The update
449 * can take just over 2ms. We wait 10 to 20ms. There is no need to
450 * to poll-wait (up to 1s - eeccch) for the falling edge of RTC_UIP.
451 * If you need to know *exactly* when a second has started, enable
452 * periodic update complete interrupts, (via ioctl) and then
453 * immediately read /dev/rtc which will block until you get the IRQ.
454 * Once the read clears, read the RTC time (again via ioctl). Easy.
455 */
456
457 if (ds1286_is_updating() != 0)
458 msleep(20);
459
460 /*
461 * Only the values that we read from the RTC are set. We leave
462 * tm_wday, tm_yday and tm_isdst untouched. Even though the
463 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
464 * by the RTC when initially set to a non-zero value.
465 */
466 spin_lock_irqsave(&ds1286_lock, flags);
467 save_control = rtc_read(RTC_CMD);
468 rtc_write((save_control|RTC_TE), RTC_CMD);
469
470 rtc_tm->tm_sec = rtc_read(RTC_SECONDS);
471 rtc_tm->tm_min = rtc_read(RTC_MINUTES);
472 rtc_tm->tm_hour = rtc_read(RTC_HOURS) & 0x3f;
473 rtc_tm->tm_mday = rtc_read(RTC_DATE);
474 rtc_tm->tm_mon = rtc_read(RTC_MONTH) & 0x1f;
475 rtc_tm->tm_year = rtc_read(RTC_YEAR);
476
477 rtc_write(save_control, RTC_CMD);
478 spin_unlock_irqrestore(&ds1286_lock, flags);
479
480 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
481 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
482 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
483 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
484 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
485 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
486
487 /*
488 * Account for differences between how the RTC uses the values
489 * and how they are defined in a struct rtc_time;
490 */
491 if (rtc_tm->tm_year < 45)
492 rtc_tm->tm_year += 30;
493 if ((rtc_tm->tm_year += 40) < 70)
494 rtc_tm->tm_year += 100;
495
496 rtc_tm->tm_mon--;
497}
498
499static int ds1286_set_time(struct rtc_time *rtc_tm)
500{
501 unsigned char mon, day, hrs, min, sec, leap_yr;
502 unsigned char save_control;
503 unsigned int yrs;
504 unsigned long flags;
505
506
507 yrs = rtc_tm->tm_year + 1900;
508 mon = rtc_tm->tm_mon + 1; /* tm_mon starts at zero */
509 day = rtc_tm->tm_mday;
510 hrs = rtc_tm->tm_hour;
511 min = rtc_tm->tm_min;
512 sec = rtc_tm->tm_sec;
513
514 if (yrs < 1970)
515 return -EINVAL;
516
517 leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400));
518
519 if ((mon > 12) || (day == 0))
520 return -EINVAL;
521
522 if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr)))
523 return -EINVAL;
524
525 if ((hrs >= 24) || (min >= 60) || (sec >= 60))
526 return -EINVAL;
527
528 if ((yrs -= 1940) > 255) /* They are unsigned */
529 return -EINVAL;
530
531 if (yrs >= 100)
532 yrs -= 100;
533
534 sec = bin2bcd(sec);
535 min = bin2bcd(min);
536 hrs = bin2bcd(hrs);
537 day = bin2bcd(day);
538 mon = bin2bcd(mon);
539 yrs = bin2bcd(yrs);
540
541 spin_lock_irqsave(&ds1286_lock, flags);
542 save_control = rtc_read(RTC_CMD);
543 rtc_write((save_control|RTC_TE), RTC_CMD);
544
545 rtc_write(yrs, RTC_YEAR);
546 rtc_write(mon, RTC_MONTH);
547 rtc_write(day, RTC_DATE);
548 rtc_write(hrs, RTC_HOURS);
549 rtc_write(min, RTC_MINUTES);
550 rtc_write(sec, RTC_SECONDS);
551 rtc_write(0, RTC_HUNDREDTH_SECOND);
552
553 rtc_write(save_control, RTC_CMD);
554 spin_unlock_irqrestore(&ds1286_lock, flags);
555
556 return 0;
557}
558
559static void ds1286_get_alm_time(struct rtc_time *alm_tm)
560{
561 unsigned char cmd;
562 unsigned long flags;
563
564 /*
565 * Only the values that we read from the RTC are set. That
566 * means only tm_wday, tm_hour, tm_min.
567 */
568 spin_lock_irqsave(&ds1286_lock, flags);
569 alm_tm->tm_min = rtc_read(RTC_MINUTES_ALARM) & 0x7f;
570 alm_tm->tm_hour = rtc_read(RTC_HOURS_ALARM) & 0x1f;
571 alm_tm->tm_wday = rtc_read(RTC_DAY_ALARM) & 0x07;
572 cmd = rtc_read(RTC_CMD);
573 spin_unlock_irqrestore(&ds1286_lock, flags);
574
575 alm_tm->tm_min = bcd2bin(alm_tm->tm_min);
576 alm_tm->tm_hour = bcd2bin(alm_tm->tm_hour);
577 alm_tm->tm_sec = 0;
578}
579
580module_init(ds1286_init);
581module_exit(ds1286_exit);
582
583MODULE_AUTHOR("Ralf Baechle");
584MODULE_LICENSE("GPL");
585MODULE_ALIAS_MISCDEV(RTC_MINOR);
diff --git a/drivers/char/ip27-rtc.c b/drivers/char/ip27-rtc.c
deleted file mode 100644
index 2abd881b4cbc..000000000000
--- a/drivers/char/ip27-rtc.c
+++ /dev/null
@@ -1,329 +0,0 @@
1/*
2 * Driver for the SGS-Thomson M48T35 Timekeeper RAM chip
3 *
4 * Real Time Clock interface for Linux
5 *
6 * TODO: Implement periodic interrupts.
7 *
8 * Copyright (C) 2000 Silicon Graphics, Inc.
9 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
10 *
11 * Based on code written by Paul Gortmaker.
12 *
13 * This driver allows use of the real time clock (built into
14 * nearly all computers) from user space. It exports the /dev/rtc
15 * interface supporting various ioctl() and also the /proc/rtc
16 * pseudo-file for status information.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 *
23 */
24
25#define RTC_VERSION "1.09b"
26
27#include <linux/bcd.h>
28#include <linux/module.h>
29#include <linux/kernel.h>
30#include <linux/smp_lock.h>
31#include <linux/types.h>
32#include <linux/miscdevice.h>
33#include <linux/ioport.h>
34#include <linux/fcntl.h>
35#include <linux/rtc.h>
36#include <linux/init.h>
37#include <linux/poll.h>
38#include <linux/proc_fs.h>
39
40#include <asm/m48t35.h>
41#include <asm/sn/ioc3.h>
42#include <asm/io.h>
43#include <asm/uaccess.h>
44#include <asm/system.h>
45#include <asm/sn/klconfig.h>
46#include <asm/sn/sn0/ip27.h>
47#include <asm/sn/sn0/hub.h>
48#include <asm/sn/sn_private.h>
49
50static long rtc_ioctl(struct file *filp, unsigned int cmd,
51 unsigned long arg);
52
53static int rtc_read_proc(char *page, char **start, off_t off,
54 int count, int *eof, void *data);
55
56static void get_rtc_time(struct rtc_time *rtc_tm);
57
58/*
59 * Bits in rtc_status. (6 bits of room for future expansion)
60 */
61
62#define RTC_IS_OPEN 0x01 /* means /dev/rtc is in use */
63#define RTC_TIMER_ON 0x02 /* missed irq timer active */
64
65static unsigned char rtc_status; /* bitmapped status byte. */
66static unsigned long rtc_freq; /* Current periodic IRQ rate */
67static struct m48t35_rtc *rtc;
68
69/*
70 * If this driver ever becomes modularised, it will be really nice
71 * to make the epoch retain its value across module reload...
72 */
73
74static unsigned long epoch = 1970; /* year corresponding to 0x00 */
75
76static const unsigned char days_in_mo[] =
77{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
78
79static long rtc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
80{
81
82 struct rtc_time wtime;
83
84 switch (cmd) {
85 case RTC_RD_TIME: /* Read the time/date from RTC */
86 {
87 get_rtc_time(&wtime);
88 break;
89 }
90 case RTC_SET_TIME: /* Set the RTC */
91 {
92 struct rtc_time rtc_tm;
93 unsigned char mon, day, hrs, min, sec, leap_yr;
94 unsigned int yrs;
95
96 if (!capable(CAP_SYS_TIME))
97 return -EACCES;
98
99 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
100 sizeof(struct rtc_time)))
101 return -EFAULT;
102
103 yrs = rtc_tm.tm_year + 1900;
104 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */
105 day = rtc_tm.tm_mday;
106 hrs = rtc_tm.tm_hour;
107 min = rtc_tm.tm_min;
108 sec = rtc_tm.tm_sec;
109
110 if (yrs < 1970)
111 return -EINVAL;
112
113 leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400));
114
115 if ((mon > 12) || (day == 0))
116 return -EINVAL;
117
118 if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr)))
119 return -EINVAL;
120
121 if ((hrs >= 24) || (min >= 60) || (sec >= 60))
122 return -EINVAL;
123
124 if ((yrs -= epoch) > 255) /* They are unsigned */
125 return -EINVAL;
126
127 if (yrs > 169)
128 return -EINVAL;
129
130 if (yrs >= 100)
131 yrs -= 100;
132
133 sec = bin2bcd(sec);
134 min = bin2bcd(min);
135 hrs = bin2bcd(hrs);
136 day = bin2bcd(day);
137 mon = bin2bcd(mon);
138 yrs = bin2bcd(yrs);
139
140 spin_lock_irq(&rtc_lock);
141 rtc->control |= M48T35_RTC_SET;
142 rtc->year = yrs;
143 rtc->month = mon;
144 rtc->date = day;
145 rtc->hour = hrs;
146 rtc->min = min;
147 rtc->sec = sec;
148 rtc->control &= ~M48T35_RTC_SET;
149 spin_unlock_irq(&rtc_lock);
150
151 return 0;
152 }
153 default:
154 return -EINVAL;
155 }
156 return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
157}
158
159/*
160 * We enforce only one user at a time here with the open/close.
161 * Also clear the previous interrupt data on an open, and clean
162 * up things on a close.
163 */
164
165static int rtc_open(struct inode *inode, struct file *file)
166{
167 lock_kernel();
168 spin_lock_irq(&rtc_lock);
169
170 if (rtc_status & RTC_IS_OPEN) {
171 spin_unlock_irq(&rtc_lock);
172 unlock_kernel();
173 return -EBUSY;
174 }
175
176 rtc_status |= RTC_IS_OPEN;
177 spin_unlock_irq(&rtc_lock);
178 unlock_kernel();
179
180 return 0;
181}
182
183static int rtc_release(struct inode *inode, struct file *file)
184{
185 /*
186 * Turn off all interrupts once the device is no longer
187 * in use, and clear the data.
188 */
189
190 spin_lock_irq(&rtc_lock);
191 rtc_status &= ~RTC_IS_OPEN;
192 spin_unlock_irq(&rtc_lock);
193
194 return 0;
195}
196
197/*
198 * The various file operations we support.
199 */
200
201static const struct file_operations rtc_fops = {
202 .owner = THIS_MODULE,
203 .unlocked_ioctl = rtc_ioctl,
204 .open = rtc_open,
205 .release = rtc_release,
206};
207
208static struct miscdevice rtc_dev=
209{
210 RTC_MINOR,
211 "rtc",
212 &rtc_fops
213};
214
215static int __init rtc_init(void)
216{
217 rtc = (struct m48t35_rtc *)
218 (KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base + IOC3_BYTEBUS_DEV0);
219
220 printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION);
221 if (misc_register(&rtc_dev)) {
222 printk(KERN_ERR "rtc: cannot register misc device.\n");
223 return -ENODEV;
224 }
225 if (!create_proc_read_entry("driver/rtc", 0, NULL, rtc_read_proc, NULL)) {
226 printk(KERN_ERR "rtc: cannot create /proc/rtc.\n");
227 misc_deregister(&rtc_dev);
228 return -ENOENT;
229 }
230
231 rtc_freq = 1024;
232
233 return 0;
234}
235
236static void __exit rtc_exit (void)
237{
238 /* interrupts and timer disabled at this point by rtc_release */
239
240 remove_proc_entry ("rtc", NULL);
241 misc_deregister(&rtc_dev);
242}
243
244module_init(rtc_init);
245module_exit(rtc_exit);
246
247/*
248 * Info exported via "/proc/rtc".
249 */
250
251static int rtc_get_status(char *buf)
252{
253 char *p;
254 struct rtc_time tm;
255
256 /*
257 * Just emulate the standard /proc/rtc
258 */
259
260 p = buf;
261
262 get_rtc_time(&tm);
263
264 /*
265 * There is no way to tell if the luser has the RTC set for local
266 * time or for Universal Standard Time (GMT). Probably local though.
267 */
268 p += sprintf(p,
269 "rtc_time\t: %02d:%02d:%02d\n"
270 "rtc_date\t: %04d-%02d-%02d\n"
271 "rtc_epoch\t: %04lu\n"
272 "24hr\t\t: yes\n",
273 tm.tm_hour, tm.tm_min, tm.tm_sec,
274 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);
275
276 return p - buf;
277}
278
279static int rtc_read_proc(char *page, char **start, off_t off,
280 int count, int *eof, void *data)
281{
282 int len = rtc_get_status(page);
283 if (len <= off+count) *eof = 1;
284 *start = page + off;
285 len -= off;
286 if (len>count) len = count;
287 if (len<0) len = 0;
288 return len;
289}
290
291static void get_rtc_time(struct rtc_time *rtc_tm)
292{
293 /*
294 * Do we need to wait for the last update to finish?
295 */
296
297 /*
298 * Only the values that we read from the RTC are set. We leave
299 * tm_wday, tm_yday and tm_isdst untouched. Even though the
300 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
301 * by the RTC when initially set to a non-zero value.
302 */
303 spin_lock_irq(&rtc_lock);
304 rtc->control |= M48T35_RTC_READ;
305 rtc_tm->tm_sec = rtc->sec;
306 rtc_tm->tm_min = rtc->min;
307 rtc_tm->tm_hour = rtc->hour;
308 rtc_tm->tm_mday = rtc->date;
309 rtc_tm->tm_mon = rtc->month;
310 rtc_tm->tm_year = rtc->year;
311 rtc->control &= ~M48T35_RTC_READ;
312 spin_unlock_irq(&rtc_lock);
313
314 rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec);
315 rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min);
316 rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour);
317 rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday);
318 rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon);
319 rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year);
320
321 /*
322 * Account for differences between how the RTC uses the values
323 * and how they are defined in a struct rtc_time;
324 */
325 if ((rtc_tm->tm_year += (epoch - 1900)) <= 69)
326 rtc_tm->tm_year += 100;
327
328 rtc_tm->tm_mon--;
329}
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 835a33c8d5f5..1d7b429f7ffa 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -957,3 +957,4 @@ module_exit(cleanup_ipmi);
957MODULE_LICENSE("GPL"); 957MODULE_LICENSE("GPL");
958MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); 958MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
959MODULE_DESCRIPTION("Linux device interface for the IPMI message handler."); 959MODULE_DESCRIPTION("Linux device interface for the IPMI message handler.");
960MODULE_ALIAS("platform:ipmi_si");
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 9a626e50b793..4d64a02612a4 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -554,7 +554,7 @@ static int mgslpc_probe(struct pcmcia_device *link)
554 /* Initialize the struct pcmcia_device structure */ 554 /* Initialize the struct pcmcia_device structure */
555 555
556 /* Interrupt setup */ 556 /* Interrupt setup */
557 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 557 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
558 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 558 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
559 link->irq.Handler = NULL; 559 link->irq.Handler = NULL;
560 560
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 5a11e3cbcae2..e0dbd388757f 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -102,6 +102,13 @@ config EDAC_I3000
102 Support for error detection and correction on the Intel 102 Support for error detection and correction on the Intel
103 3000 and 3010 server chipsets. 103 3000 and 3010 server chipsets.
104 104
105config EDAC_X38
106 tristate "Intel X38"
107 depends on EDAC_MM_EDAC && PCI && X86
108 help
109 Support for error detection and correction on the Intel
110 X38 server chipsets.
111
105config EDAC_I82860 112config EDAC_I82860
106 tristate "Intel 82860" 113 tristate "Intel 82860"
107 depends on EDAC_MM_EDAC && PCI && X86_32 114 depends on EDAC_MM_EDAC && PCI && X86_32
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile
index e5e9104b5520..62c2d9bad8dc 100644
--- a/drivers/edac/Makefile
+++ b/drivers/edac/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_EDAC_I82443BXGX) += i82443bxgx_edac.o
26obj-$(CONFIG_EDAC_I82875P) += i82875p_edac.o 26obj-$(CONFIG_EDAC_I82875P) += i82875p_edac.o
27obj-$(CONFIG_EDAC_I82975X) += i82975x_edac.o 27obj-$(CONFIG_EDAC_I82975X) += i82975x_edac.o
28obj-$(CONFIG_EDAC_I3000) += i3000_edac.o 28obj-$(CONFIG_EDAC_I3000) += i3000_edac.o
29obj-$(CONFIG_EDAC_X38) += x38_edac.o
29obj-$(CONFIG_EDAC_I82860) += i82860_edac.o 30obj-$(CONFIG_EDAC_I82860) += i82860_edac.o
30obj-$(CONFIG_EDAC_R82600) += r82600_edac.o 31obj-$(CONFIG_EDAC_R82600) += r82600_edac.o
31obj-$(CONFIG_EDAC_PASEMI) += pasemi_edac.o 32obj-$(CONFIG_EDAC_PASEMI) += pasemi_edac.o
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
index 887072f5dc8b..cd2e3b8087e7 100644
--- a/drivers/edac/cell_edac.c
+++ b/drivers/edac/cell_edac.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#undef DEBUG 10#undef DEBUG
11 11
12#include <linux/edac.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/init.h> 14#include <linux/init.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -164,6 +165,8 @@ static int __devinit cell_edac_probe(struct platform_device *pdev)
164 if (regs == NULL) 165 if (regs == NULL)
165 return -ENODEV; 166 return -ENODEV;
166 167
168 edac_op_state = EDAC_OPSTATE_POLL;
169
167 /* Get channel population */ 170 /* Get channel population */
168 reg = in_be64(&regs->mic_mnt_cfg); 171 reg = in_be64(&regs->mic_mnt_cfg);
169 dev_dbg(&pdev->dev, "MIC_MNT_CFG = 0x%016lx\n", reg); 172 dev_dbg(&pdev->dev, "MIC_MNT_CFG = 0x%016lx\n", reg);
diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
new file mode 100644
index 000000000000..2406c2ce2844
--- /dev/null
+++ b/drivers/edac/x38_edac.c
@@ -0,0 +1,524 @@
1/*
2 * Intel X38 Memory Controller kernel module
3 * Copyright (C) 2008 Cluster Computing, Inc.
4 *
5 * This file may be distributed under the terms of the
6 * GNU General Public License.
7 *
8 * This file is based on i3200_edac.c
9 *
10 */
11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/pci.h>
15#include <linux/pci_ids.h>
16#include <linux/slab.h>
17#include <linux/edac.h>
18#include "edac_core.h"
19
20#define X38_REVISION "1.1"
21
22#define EDAC_MOD_STR "x38_edac"
23
24#define PCI_DEVICE_ID_INTEL_X38_HB 0x29e0
25
26#define X38_RANKS 8
27#define X38_RANKS_PER_CHANNEL 4
28#define X38_CHANNELS 2
29
30/* Intel X38 register addresses - device 0 function 0 - DRAM Controller */
31
32#define X38_MCHBAR_LOW 0x48 /* MCH Memory Mapped Register BAR */
33#define X38_MCHBAR_HIGH 0x4b
34#define X38_MCHBAR_MASK 0xfffffc000ULL /* bits 35:14 */
35#define X38_MMR_WINDOW_SIZE 16384
36
37#define X38_TOM 0xa0 /* Top of Memory (16b)
38 *
39 * 15:10 reserved
40 * 9:0 total populated physical memory
41 */
42#define X38_TOM_MASK 0x3ff /* bits 9:0 */
43#define X38_TOM_SHIFT 26 /* 64MiB grain */
44
45#define X38_ERRSTS 0xc8 /* Error Status Register (16b)
46 *
47 * 15 reserved
48 * 14 Isochronous TBWRR Run Behind FIFO Full
49 * (ITCV)
50 * 13 Isochronous TBWRR Run Behind FIFO Put
51 * (ITSTV)
52 * 12 reserved
53 * 11 MCH Thermal Sensor Event
54 * for SMI/SCI/SERR (GTSE)
55 * 10 reserved
56 * 9 LOCK to non-DRAM Memory Flag (LCKF)
57 * 8 reserved
58 * 7 DRAM Throttle Flag (DTF)
59 * 6:2 reserved
60 * 1 Multi-bit DRAM ECC Error Flag (DMERR)
61 * 0 Single-bit DRAM ECC Error Flag (DSERR)
62 */
63#define X38_ERRSTS_UE 0x0002
64#define X38_ERRSTS_CE 0x0001
65#define X38_ERRSTS_BITS (X38_ERRSTS_UE | X38_ERRSTS_CE)
66
67
68/* Intel MMIO register space - device 0 function 0 - MMR space */
69
70#define X38_C0DRB 0x200 /* Channel 0 DRAM Rank Boundary (16b x 4)
71 *
72 * 15:10 reserved
73 * 9:0 Channel 0 DRAM Rank Boundary Address
74 */
75#define X38_C1DRB 0x600 /* Channel 1 DRAM Rank Boundary (16b x 4) */
76#define X38_DRB_MASK 0x3ff /* bits 9:0 */
77#define X38_DRB_SHIFT 26 /* 64MiB grain */
78
79#define X38_C0ECCERRLOG 0x280 /* Channel 0 ECC Error Log (64b)
80 *
81 * 63:48 Error Column Address (ERRCOL)
82 * 47:32 Error Row Address (ERRROW)
83 * 31:29 Error Bank Address (ERRBANK)
84 * 28:27 Error Rank Address (ERRRANK)
85 * 26:24 reserved
86 * 23:16 Error Syndrome (ERRSYND)
87 * 15: 2 reserved
88 * 1 Multiple Bit Error Status (MERRSTS)
89 * 0 Correctable Error Status (CERRSTS)
90 */
91#define X38_C1ECCERRLOG 0x680 /* Channel 1 ECC Error Log (64b) */
92#define X38_ECCERRLOG_CE 0x1
93#define X38_ECCERRLOG_UE 0x2
94#define X38_ECCERRLOG_RANK_BITS 0x18000000
95#define X38_ECCERRLOG_SYNDROME_BITS 0xff0000
96
97#define X38_CAPID0 0xe0 /* see P.94 of spec for details */
98
99static int x38_channel_num;
100
101static int how_many_channel(struct pci_dev *pdev)
102{
103 unsigned char capid0_8b; /* 8th byte of CAPID0 */
104
105 pci_read_config_byte(pdev, X38_CAPID0 + 8, &capid0_8b);
106 if (capid0_8b & 0x20) { /* check DCD: Dual Channel Disable */
107 debugf0("In single channel mode.\n");
108 x38_channel_num = 1;
109 } else {
110 debugf0("In dual channel mode.\n");
111 x38_channel_num = 2;
112 }
113
114 return x38_channel_num;
115}
116
117static unsigned long eccerrlog_syndrome(u64 log)
118{
119 return (log & X38_ECCERRLOG_SYNDROME_BITS) >> 16;
120}
121
122static int eccerrlog_row(int channel, u64 log)
123{
124 return ((log & X38_ECCERRLOG_RANK_BITS) >> 27) |
125 (channel * X38_RANKS_PER_CHANNEL);
126}
127
128enum x38_chips {
129 X38 = 0,
130};
131
132struct x38_dev_info {
133 const char *ctl_name;
134};
135
136struct x38_error_info {
137 u16 errsts;
138 u16 errsts2;
139 u64 eccerrlog[X38_CHANNELS];
140};
141
142static const struct x38_dev_info x38_devs[] = {
143 [X38] = {
144 .ctl_name = "x38"},
145};
146
147static struct pci_dev *mci_pdev;
148static int x38_registered = 1;
149
150
151static void x38_clear_error_info(struct mem_ctl_info *mci)
152{
153 struct pci_dev *pdev;
154
155 pdev = to_pci_dev(mci->dev);
156
157 /*
158 * Clear any error bits.
159 * (Yes, we really clear bits by writing 1 to them.)
160 */
161 pci_write_bits16(pdev, X38_ERRSTS, X38_ERRSTS_BITS,
162 X38_ERRSTS_BITS);
163}
164
165static u64 x38_readq(const void __iomem *addr)
166{
167 return readl(addr) | (((u64)readl(addr + 4)) << 32);
168}
169
170static void x38_get_and_clear_error_info(struct mem_ctl_info *mci,
171 struct x38_error_info *info)
172{
173 struct pci_dev *pdev;
174 void __iomem *window = mci->pvt_info;
175
176 pdev = to_pci_dev(mci->dev);
177
178 /*
179 * This is a mess because there is no atomic way to read all the
180 * registers at once and the registers can transition from CE being
181 * overwritten by UE.
182 */
183 pci_read_config_word(pdev, X38_ERRSTS, &info->errsts);
184 if (!(info->errsts & X38_ERRSTS_BITS))
185 return;
186
187 info->eccerrlog[0] = x38_readq(window + X38_C0ECCERRLOG);
188 if (x38_channel_num == 2)
189 info->eccerrlog[1] = x38_readq(window + X38_C1ECCERRLOG);
190
191 pci_read_config_word(pdev, X38_ERRSTS, &info->errsts2);
192
193 /*
194 * If the error is the same for both reads then the first set
195 * of reads is valid. If there is a change then there is a CE
196 * with no info and the second set of reads is valid and
197 * should be UE info.
198 */
199 if ((info->errsts ^ info->errsts2) & X38_ERRSTS_BITS) {
200 info->eccerrlog[0] = x38_readq(window + X38_C0ECCERRLOG);
201 if (x38_channel_num == 2)
202 info->eccerrlog[1] =
203 x38_readq(window + X38_C1ECCERRLOG);
204 }
205
206 x38_clear_error_info(mci);
207}
208
209static void x38_process_error_info(struct mem_ctl_info *mci,
210 struct x38_error_info *info)
211{
212 int channel;
213 u64 log;
214
215 if (!(info->errsts & X38_ERRSTS_BITS))
216 return;
217
218 if ((info->errsts ^ info->errsts2) & X38_ERRSTS_BITS) {
219 edac_mc_handle_ce_no_info(mci, "UE overwrote CE");
220 info->errsts = info->errsts2;
221 }
222
223 for (channel = 0; channel < x38_channel_num; channel++) {
224 log = info->eccerrlog[channel];
225 if (log & X38_ECCERRLOG_UE) {
226 edac_mc_handle_ue(mci, 0, 0,
227 eccerrlog_row(channel, log), "x38 UE");
228 } else if (log & X38_ECCERRLOG_CE) {
229 edac_mc_handle_ce(mci, 0, 0,
230 eccerrlog_syndrome(log),
231 eccerrlog_row(channel, log), 0, "x38 CE");
232 }
233 }
234}
235
236static void x38_check(struct mem_ctl_info *mci)
237{
238 struct x38_error_info info;
239
240 debugf1("MC%d: %s()\n", mci->mc_idx, __func__);
241 x38_get_and_clear_error_info(mci, &info);
242 x38_process_error_info(mci, &info);
243}
244
245
246void __iomem *x38_map_mchbar(struct pci_dev *pdev)
247{
248 union {
249 u64 mchbar;
250 struct {
251 u32 mchbar_low;
252 u32 mchbar_high;
253 };
254 } u;
255 void __iomem *window;
256
257 pci_read_config_dword(pdev, X38_MCHBAR_LOW, &u.mchbar_low);
258 pci_write_config_dword(pdev, X38_MCHBAR_LOW, u.mchbar_low | 0x1);
259 pci_read_config_dword(pdev, X38_MCHBAR_HIGH, &u.mchbar_high);
260 u.mchbar &= X38_MCHBAR_MASK;
261
262 if (u.mchbar != (resource_size_t)u.mchbar) {
263 printk(KERN_ERR
264 "x38: mmio space beyond accessible range (0x%llx)\n",
265 (unsigned long long)u.mchbar);
266 return NULL;
267 }
268
269 window = ioremap_nocache(u.mchbar, X38_MMR_WINDOW_SIZE);
270 if (!window)
271 printk(KERN_ERR "x38: cannot map mmio space at 0x%llx\n",
272 (unsigned long long)u.mchbar);
273
274 return window;
275}
276
277
278static void x38_get_drbs(void __iomem *window,
279 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL])
280{
281 int i;
282
283 for (i = 0; i < X38_RANKS_PER_CHANNEL; i++) {
284 drbs[0][i] = readw(window + X38_C0DRB + 2*i) & X38_DRB_MASK;
285 drbs[1][i] = readw(window + X38_C1DRB + 2*i) & X38_DRB_MASK;
286 }
287}
288
289static bool x38_is_stacked(struct pci_dev *pdev,
290 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL])
291{
292 u16 tom;
293
294 pci_read_config_word(pdev, X38_TOM, &tom);
295 tom &= X38_TOM_MASK;
296
297 return drbs[X38_CHANNELS - 1][X38_RANKS_PER_CHANNEL - 1] == tom;
298}
299
300static unsigned long drb_to_nr_pages(
301 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL],
302 bool stacked, int channel, int rank)
303{
304 int n;
305
306 n = drbs[channel][rank];
307 if (rank > 0)
308 n -= drbs[channel][rank - 1];
309 if (stacked && (channel == 1) && drbs[channel][rank] ==
310 drbs[channel][X38_RANKS_PER_CHANNEL - 1]) {
311 n -= drbs[0][X38_RANKS_PER_CHANNEL - 1];
312 }
313
314 n <<= (X38_DRB_SHIFT - PAGE_SHIFT);
315 return n;
316}
317
318static int x38_probe1(struct pci_dev *pdev, int dev_idx)
319{
320 int rc;
321 int i;
322 struct mem_ctl_info *mci = NULL;
323 unsigned long last_page;
324 u16 drbs[X38_CHANNELS][X38_RANKS_PER_CHANNEL];
325 bool stacked;
326 void __iomem *window;
327
328 debugf0("MC: %s()\n", __func__);
329
330 window = x38_map_mchbar(pdev);
331 if (!window)
332 return -ENODEV;
333
334 x38_get_drbs(window, drbs);
335
336 how_many_channel(pdev);
337
338 /* FIXME: unconventional pvt_info usage */
339 mci = edac_mc_alloc(0, X38_RANKS, x38_channel_num, 0);
340 if (!mci)
341 return -ENOMEM;
342
343 debugf3("MC: %s(): init mci\n", __func__);
344
345 mci->dev = &pdev->dev;
346 mci->mtype_cap = MEM_FLAG_DDR2;
347
348 mci->edac_ctl_cap = EDAC_FLAG_SECDED;
349 mci->edac_cap = EDAC_FLAG_SECDED;
350
351 mci->mod_name = EDAC_MOD_STR;
352 mci->mod_ver = X38_REVISION;
353 mci->ctl_name = x38_devs[dev_idx].ctl_name;
354 mci->dev_name = pci_name(pdev);
355 mci->edac_check = x38_check;
356 mci->ctl_page_to_phys = NULL;
357 mci->pvt_info = window;
358
359 stacked = x38_is_stacked(pdev, drbs);
360
361 /*
362 * The dram rank boundary (DRB) reg values are boundary addresses
363 * for each DRAM rank with a granularity of 64MB. DRB regs are
364 * cumulative; the last one will contain the total memory
365 * contained in all ranks.
366 */
367 last_page = -1UL;
368 for (i = 0; i < mci->nr_csrows; i++) {
369 unsigned long nr_pages;
370 struct csrow_info *csrow = &mci->csrows[i];
371
372 nr_pages = drb_to_nr_pages(drbs, stacked,
373 i / X38_RANKS_PER_CHANNEL,
374 i % X38_RANKS_PER_CHANNEL);
375
376 if (nr_pages == 0) {
377 csrow->mtype = MEM_EMPTY;
378 continue;
379 }
380
381 csrow->first_page = last_page + 1;
382 last_page += nr_pages;
383 csrow->last_page = last_page;
384 csrow->nr_pages = nr_pages;
385
386 csrow->grain = nr_pages << PAGE_SHIFT;
387 csrow->mtype = MEM_DDR2;
388 csrow->dtype = DEV_UNKNOWN;
389 csrow->edac_mode = EDAC_UNKNOWN;
390 }
391
392 x38_clear_error_info(mci);
393
394 rc = -ENODEV;
395 if (edac_mc_add_mc(mci)) {
396 debugf3("MC: %s(): failed edac_mc_add_mc()\n", __func__);
397 goto fail;
398 }
399
400 /* get this far and it's successful */
401 debugf3("MC: %s(): success\n", __func__);
402 return 0;
403
404fail:
405 iounmap(window);
406 if (mci)
407 edac_mc_free(mci);
408
409 return rc;
410}
411
412static int __devinit x38_init_one(struct pci_dev *pdev,
413 const struct pci_device_id *ent)
414{
415 int rc;
416
417 debugf0("MC: %s()\n", __func__);
418
419 if (pci_enable_device(pdev) < 0)
420 return -EIO;
421
422 rc = x38_probe1(pdev, ent->driver_data);
423 if (!mci_pdev)
424 mci_pdev = pci_dev_get(pdev);
425
426 return rc;
427}
428
429static void __devexit x38_remove_one(struct pci_dev *pdev)
430{
431 struct mem_ctl_info *mci;
432
433 debugf0("%s()\n", __func__);
434
435 mci = edac_mc_del_mc(&pdev->dev);
436 if (!mci)
437 return;
438
439 iounmap(mci->pvt_info);
440
441 edac_mc_free(mci);
442}
443
444static const struct pci_device_id x38_pci_tbl[] __devinitdata = {
445 {
446 PCI_VEND_DEV(INTEL, X38_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
447 X38},
448 {
449 0,
450 } /* 0 terminated list. */
451};
452
453MODULE_DEVICE_TABLE(pci, x38_pci_tbl);
454
455static struct pci_driver x38_driver = {
456 .name = EDAC_MOD_STR,
457 .probe = x38_init_one,
458 .remove = __devexit_p(x38_remove_one),
459 .id_table = x38_pci_tbl,
460};
461
462static int __init x38_init(void)
463{
464 int pci_rc;
465
466 debugf3("MC: %s()\n", __func__);
467
468 /* Ensure that the OPSTATE is set correctly for POLL or NMI */
469 opstate_init();
470
471 pci_rc = pci_register_driver(&x38_driver);
472 if (pci_rc < 0)
473 goto fail0;
474
475 if (!mci_pdev) {
476 x38_registered = 0;
477 mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
478 PCI_DEVICE_ID_INTEL_X38_HB, NULL);
479 if (!mci_pdev) {
480 debugf0("x38 pci_get_device fail\n");
481 pci_rc = -ENODEV;
482 goto fail1;
483 }
484
485 pci_rc = x38_init_one(mci_pdev, x38_pci_tbl);
486 if (pci_rc < 0) {
487 debugf0("x38 init fail\n");
488 pci_rc = -ENODEV;
489 goto fail1;
490 }
491 }
492
493 return 0;
494
495fail1:
496 pci_unregister_driver(&x38_driver);
497
498fail0:
499 if (mci_pdev)
500 pci_dev_put(mci_pdev);
501
502 return pci_rc;
503}
504
505static void __exit x38_exit(void)
506{
507 debugf3("MC: %s()\n", __func__);
508
509 pci_unregister_driver(&x38_driver);
510 if (!x38_registered) {
511 x38_remove_one(mci_pdev);
512 pci_dev_put(mci_pdev);
513 }
514}
515
516module_init(x38_init);
517module_exit(x38_exit);
518
519MODULE_LICENSE("GPL");
520MODULE_AUTHOR("Cluster Computing, Inc. Hitoshi Mitake");
521MODULE_DESCRIPTION("MC support for Intel X38 memory hub controllers");
522
523module_param(edac_op_state, int, 0444);
524MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI");
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 743e6f8cb202..1903e7515650 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1263,6 +1263,7 @@ static const struct hid_device_id hid_blacklist[] = {
1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1268 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1269 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
diff --git a/drivers/hid/hid-dell.c b/drivers/hid/hid-dell.c
index 1a0d0dfc62fc..f5474300b83a 100644
--- a/drivers/hid/hid-dell.c
+++ b/drivers/hid/hid-dell.c
@@ -48,6 +48,7 @@ err_free:
48static const struct hid_device_id dell_devices[] = { 48static const struct hid_device_id dell_devices[] = {
49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
51 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
51 { } 52 { }
52}; 53};
53MODULE_DEVICE_TABLE(hid, dell_devices); 54MODULE_DEVICE_TABLE(hid, dell_devices);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index a0d6a6cb1842..5cc404291736 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -163,6 +163,9 @@
163 163
164#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 164#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
165 165
166#define USB_VENDOR_ID_GENERIC_13BA 0x13ba
167#define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017
168
166#define USB_VENDOR_ID_GLAB 0x06c2 169#define USB_VENDOR_ID_GLAB 0x06c2
167#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 170#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
168#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 171#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 42bdd83444c1..18e5ddd722cd 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/mutex.h>
23#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
24#include <linux/spinlock.h> 25#include <linux/spinlock.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
@@ -776,21 +777,10 @@ static int usbhid_start(struct hid_device *hid)
776 struct usb_interface *intf = to_usb_interface(hid->dev.parent); 777 struct usb_interface *intf = to_usb_interface(hid->dev.parent);
777 struct usb_host_interface *interface = intf->cur_altsetting; 778 struct usb_host_interface *interface = intf->cur_altsetting;
778 struct usb_device *dev = interface_to_usbdev(intf); 779 struct usb_device *dev = interface_to_usbdev(intf);
779 struct usbhid_device *usbhid; 780 struct usbhid_device *usbhid = hid->driver_data;
780 unsigned int n, insize = 0; 781 unsigned int n, insize = 0;
781 int ret; 782 int ret;
782 783
783 WARN_ON(hid->driver_data);
784
785 usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL);
786 if (usbhid == NULL) {
787 ret = -ENOMEM;
788 goto err;
789 }
790
791 hid->driver_data = usbhid;
792 usbhid->hid = hid;
793
794 usbhid->bufsize = HID_MIN_BUFFER_SIZE; 784 usbhid->bufsize = HID_MIN_BUFFER_SIZE;
795 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize); 785 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize);
796 hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize); 786 hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize);
@@ -804,6 +794,7 @@ static int usbhid_start(struct hid_device *hid)
804 if (insize > HID_MAX_BUFFER_SIZE) 794 if (insize > HID_MAX_BUFFER_SIZE)
805 insize = HID_MAX_BUFFER_SIZE; 795 insize = HID_MAX_BUFFER_SIZE;
806 796
797 mutex_lock(&usbhid->setup);
807 if (hid_alloc_buffers(dev, hid)) { 798 if (hid_alloc_buffers(dev, hid)) {
808 ret = -ENOMEM; 799 ret = -ENOMEM;
809 goto fail; 800 goto fail;
@@ -888,6 +879,9 @@ static int usbhid_start(struct hid_device *hid)
888 usbhid_init_reports(hid); 879 usbhid_init_reports(hid);
889 hid_dump_device(hid); 880 hid_dump_device(hid);
890 881
882 set_bit(HID_STARTED, &usbhid->iofl);
883 mutex_unlock(&usbhid->setup);
884
891 return 0; 885 return 0;
892 886
893fail: 887fail:
@@ -895,8 +889,7 @@ fail:
895 usb_free_urb(usbhid->urbout); 889 usb_free_urb(usbhid->urbout);
896 usb_free_urb(usbhid->urbctrl); 890 usb_free_urb(usbhid->urbctrl);
897 hid_free_buffers(dev, hid); 891 hid_free_buffers(dev, hid);
898 kfree(usbhid); 892 mutex_unlock(&usbhid->setup);
899err:
900 return ret; 893 return ret;
901} 894}
902 895
@@ -907,6 +900,8 @@ static void usbhid_stop(struct hid_device *hid)
907 if (WARN_ON(!usbhid)) 900 if (WARN_ON(!usbhid))
908 return; 901 return;
909 902
903 mutex_lock(&usbhid->setup);
904 clear_bit(HID_STARTED, &usbhid->iofl);
910 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 905 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
911 set_bit(HID_DISCONNECTED, &usbhid->iofl); 906 set_bit(HID_DISCONNECTED, &usbhid->iofl);
912 spin_unlock_irq(&usbhid->inlock); 907 spin_unlock_irq(&usbhid->inlock);
@@ -931,8 +926,7 @@ static void usbhid_stop(struct hid_device *hid)
931 usb_free_urb(usbhid->urbout); 926 usb_free_urb(usbhid->urbout);
932 927
933 hid_free_buffers(hid_to_usb_dev(hid), hid); 928 hid_free_buffers(hid_to_usb_dev(hid), hid);
934 kfree(usbhid); 929 mutex_unlock(&usbhid->setup);
935 hid->driver_data = NULL;
936} 930}
937 931
938static struct hid_ll_driver usb_hid_driver = { 932static struct hid_ll_driver usb_hid_driver = {
@@ -947,6 +941,7 @@ static struct hid_ll_driver usb_hid_driver = {
947static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) 941static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
948{ 942{
949 struct usb_device *dev = interface_to_usbdev(intf); 943 struct usb_device *dev = interface_to_usbdev(intf);
944 struct usbhid_device *usbhid;
950 struct hid_device *hid; 945 struct hid_device *hid;
951 size_t len; 946 size_t len;
952 int ret; 947 int ret;
@@ -1000,14 +995,26 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1000 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) 995 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0)
1001 hid->uniq[0] = 0; 996 hid->uniq[0] = 0;
1002 997
998 usbhid = kzalloc(sizeof(*usbhid), GFP_KERNEL);
999 if (usbhid == NULL) {
1000 ret = -ENOMEM;
1001 goto err;
1002 }
1003
1004 hid->driver_data = usbhid;
1005 usbhid->hid = hid;
1006 mutex_init(&usbhid->setup); /* needed on suspend/resume */
1007
1003 ret = hid_add_device(hid); 1008 ret = hid_add_device(hid);
1004 if (ret) { 1009 if (ret) {
1005 if (ret != -ENODEV) 1010 if (ret != -ENODEV)
1006 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1011 dev_err(&intf->dev, "can't add hid device: %d\n", ret);
1007 goto err; 1012 goto err_free;
1008 } 1013 }
1009 1014
1010 return 0; 1015 return 0;
1016err_free:
1017 kfree(usbhid);
1011err: 1018err:
1012 hid_destroy_device(hid); 1019 hid_destroy_device(hid);
1013 return ret; 1020 return ret;
@@ -1016,11 +1023,14 @@ err:
1016static void hid_disconnect(struct usb_interface *intf) 1023static void hid_disconnect(struct usb_interface *intf)
1017{ 1024{
1018 struct hid_device *hid = usb_get_intfdata(intf); 1025 struct hid_device *hid = usb_get_intfdata(intf);
1026 struct usbhid_device *usbhid;
1019 1027
1020 if (WARN_ON(!hid)) 1028 if (WARN_ON(!hid))
1021 return; 1029 return;
1022 1030
1031 usbhid = hid->driver_data;
1023 hid_destroy_device(hid); 1032 hid_destroy_device(hid);
1033 kfree(usbhid);
1024} 1034}
1025 1035
1026static int hid_suspend(struct usb_interface *intf, pm_message_t message) 1036static int hid_suspend(struct usb_interface *intf, pm_message_t message)
@@ -1028,11 +1038,18 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1028 struct hid_device *hid = usb_get_intfdata (intf); 1038 struct hid_device *hid = usb_get_intfdata (intf);
1029 struct usbhid_device *usbhid = hid->driver_data; 1039 struct usbhid_device *usbhid = hid->driver_data;
1030 1040
1041 mutex_lock(&usbhid->setup);
1042 if (!test_bit(HID_STARTED, &usbhid->iofl)) {
1043 mutex_unlock(&usbhid->setup);
1044 return 0;
1045 }
1046
1031 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 1047 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
1032 set_bit(HID_SUSPENDED, &usbhid->iofl); 1048 set_bit(HID_SUSPENDED, &usbhid->iofl);
1033 spin_unlock_irq(&usbhid->inlock); 1049 spin_unlock_irq(&usbhid->inlock);
1034 del_timer(&usbhid->io_retry); 1050 del_timer_sync(&usbhid->io_retry);
1035 usb_kill_urb(usbhid->urbin); 1051 usb_kill_urb(usbhid->urbin);
1052 mutex_unlock(&usbhid->setup);
1036 dev_dbg(&intf->dev, "suspend\n"); 1053 dev_dbg(&intf->dev, "suspend\n");
1037 return 0; 1054 return 0;
1038} 1055}
@@ -1043,9 +1060,16 @@ static int hid_resume(struct usb_interface *intf)
1043 struct usbhid_device *usbhid = hid->driver_data; 1060 struct usbhid_device *usbhid = hid->driver_data;
1044 int status; 1061 int status;
1045 1062
1063 mutex_lock(&usbhid->setup);
1064 if (!test_bit(HID_STARTED, &usbhid->iofl)) {
1065 mutex_unlock(&usbhid->setup);
1066 return 0;
1067 }
1068
1046 clear_bit(HID_SUSPENDED, &usbhid->iofl); 1069 clear_bit(HID_SUSPENDED, &usbhid->iofl);
1047 usbhid->retry_delay = 0; 1070 usbhid->retry_delay = 0;
1048 status = hid_start_in(hid); 1071 status = hid_start_in(hid);
1072 mutex_unlock(&usbhid->setup);
1049 dev_dbg(&intf->dev, "resume status %d\n", status); 1073 dev_dbg(&intf->dev, "resume status %d\n", status);
1050 return status; 1074 return status;
1051} 1075}
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index abedb13c623e..55973ff54008 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/mutex.h>
30#include <linux/timer.h> 31#include <linux/timer.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
32#include <linux/workqueue.h> 33#include <linux/workqueue.h>
@@ -73,6 +74,7 @@ struct usbhid_device {
73 dma_addr_t outbuf_dma; /* Output buffer dma */ 74 dma_addr_t outbuf_dma; /* Output buffer dma */
74 spinlock_t outlock; /* Output fifo spinlock */ 75 spinlock_t outlock; /* Output fifo spinlock */
75 76
77 struct mutex setup;
76 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 78 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
77 struct timer_list io_retry; /* Retry timer */ 79 struct timer_list io_retry; /* Retry timer */
78 unsigned long stop_retry; /* Time to give up, in jiffies */ 80 unsigned long stop_retry; /* Time to give up, in jiffies */
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index c772e02c2803..1fac4e233133 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -507,7 +507,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int
507 unsigned long timeout; 507 unsigned long timeout;
508 int ret; 508 int ret;
509 509
510 if (!readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN) 510 if (!(readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN))
511 return -EIO; 511 return -EIO;
512 512
513 ret = s3c24xx_i2c_set_master(i2c); 513 ret = s3c24xx_i2c_set_master(i2c);
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
index c3022a023449..e4c98539c517 100644
--- a/drivers/i2c/busses/scx200_i2c.c
+++ b/drivers/i2c/busses/scx200_i2c.c
@@ -81,6 +81,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
81 81
82static struct i2c_adapter scx200_i2c_ops = { 82static struct i2c_adapter scx200_i2c_ops = {
83 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
84 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
84 .id = I2C_HW_B_SCX200, 85 .id = I2C_HW_B_SCX200,
85 .algo_data = &scx200_i2c_data, 86 .algo_data = &scx200_i2c_data,
86 .name = "NatSemi SCx200 I2C", 87 .name = "NatSemi SCx200 I2C",
diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
index 2768c69257f6..1f3cc512eff8 100644
--- a/drivers/leds/leds-da903x.c
+++ b/drivers/leds/leds-da903x.c
@@ -58,7 +58,7 @@ static void da903x_led_work(struct work_struct *work)
58 offset = DA9030_LED_OFFSET(led->id); 58 offset = DA9030_LED_OFFSET(led->id);
59 val = led->flags & ~0x87; 59 val = led->flags & ~0x87;
60 val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */ 60 val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */
61 val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */ 61 val |= (0x7 - (led->new_brightness >> 5)) & 0x7; /* PWM<2:0> */
62 da903x_write(led->master, DA9030_LED1_CONTROL + offset, val); 62 da903x_write(led->master, DA9030_LED1_CONTROL + offset, val);
63 break; 63 break;
64 case DA9030_ID_VIBRA: 64 case DA9030_ID_VIBRA:
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 92dcc06832a4..9d7b53ed75b2 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -656,9 +656,10 @@ static void do_failures(struct mirror_set *ms, struct bio_list *failures)
656 return; 656 return;
657 657
658 if (!ms->log_failure) { 658 if (!ms->log_failure) {
659 while ((bio = bio_list_pop(failures))) 659 while ((bio = bio_list_pop(failures))) {
660 ms->in_sync = 0; 660 ms->in_sync = 0;
661 dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0); 661 dm_rh_mark_nosync(ms->rh, bio, bio->bi_size, 0);
662 }
662 return; 663 return;
663 } 664 }
664 665
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index b2d9d1ac28ad..6c96db26b87c 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -229,19 +229,21 @@ static void __insert_origin(struct origin *o)
229 */ 229 */
230static int register_snapshot(struct dm_snapshot *snap) 230static int register_snapshot(struct dm_snapshot *snap)
231{ 231{
232 struct origin *o; 232 struct origin *o, *new_o;
233 struct block_device *bdev = snap->origin->bdev; 233 struct block_device *bdev = snap->origin->bdev;
234 234
235 new_o = kmalloc(sizeof(*new_o), GFP_KERNEL);
236 if (!new_o)
237 return -ENOMEM;
238
235 down_write(&_origins_lock); 239 down_write(&_origins_lock);
236 o = __lookup_origin(bdev); 240 o = __lookup_origin(bdev);
237 241
238 if (!o) { 242 if (o)
243 kfree(new_o);
244 else {
239 /* New origin */ 245 /* New origin */
240 o = kmalloc(sizeof(*o), GFP_KERNEL); 246 o = new_o;
241 if (!o) {
242 up_write(&_origins_lock);
243 return -ENOMEM;
244 }
245 247
246 /* Initialise the struct */ 248 /* Initialise the struct */
247 INIT_LIST_HEAD(&o->snapshots); 249 INIT_LIST_HEAD(&o->snapshots);
@@ -368,6 +370,7 @@ static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snaps
368 struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool, 370 struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool,
369 GFP_NOIO); 371 GFP_NOIO);
370 372
373 atomic_inc(&s->pending_exceptions_count);
371 pe->snap = s; 374 pe->snap = s;
372 375
373 return pe; 376 return pe;
@@ -375,7 +378,11 @@ static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snaps
375 378
376static void free_pending_exception(struct dm_snap_pending_exception *pe) 379static void free_pending_exception(struct dm_snap_pending_exception *pe)
377{ 380{
378 mempool_free(pe, pe->snap->pending_pool); 381 struct dm_snapshot *s = pe->snap;
382
383 mempool_free(pe, s->pending_pool);
384 smp_mb__before_atomic_dec();
385 atomic_dec(&s->pending_exceptions_count);
379} 386}
380 387
381static void insert_completed_exception(struct dm_snapshot *s, 388static void insert_completed_exception(struct dm_snapshot *s,
@@ -600,6 +607,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
600 607
601 s->valid = 1; 608 s->valid = 1;
602 s->active = 0; 609 s->active = 0;
610 atomic_set(&s->pending_exceptions_count, 0);
603 init_rwsem(&s->lock); 611 init_rwsem(&s->lock);
604 spin_lock_init(&s->pe_lock); 612 spin_lock_init(&s->pe_lock);
605 s->ti = ti; 613 s->ti = ti;
@@ -726,6 +734,14 @@ static void snapshot_dtr(struct dm_target *ti)
726 /* After this returns there can be no new kcopyd jobs. */ 734 /* After this returns there can be no new kcopyd jobs. */
727 unregister_snapshot(s); 735 unregister_snapshot(s);
728 736
737 while (atomic_read(&s->pending_exceptions_count))
738 yield();
739 /*
740 * Ensure instructions in mempool_destroy aren't reordered
741 * before atomic_read.
742 */
743 smp_mb();
744
729#ifdef CONFIG_DM_DEBUG 745#ifdef CONFIG_DM_DEBUG
730 for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++) 746 for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++)
731 BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i])); 747 BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i]));
diff --git a/drivers/md/dm-snap.h b/drivers/md/dm-snap.h
index f07315fe2362..99c0106ede2d 100644
--- a/drivers/md/dm-snap.h
+++ b/drivers/md/dm-snap.h
@@ -160,6 +160,8 @@ struct dm_snapshot {
160 160
161 mempool_t *pending_pool; 161 mempool_t *pending_pool;
162 162
163 atomic_t pending_exceptions_count;
164
163 struct exception_table pending; 165 struct exception_table pending;
164 struct exception_table complete; 166 struct exception_table complete;
165 167
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b4162f6f1b79..9abf6ed16535 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3884,6 +3884,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3884 if (mode == 0) { 3884 if (mode == 0) {
3885 mdk_rdev_t *rdev; 3885 mdk_rdev_t *rdev;
3886 struct list_head *tmp; 3886 struct list_head *tmp;
3887 struct block_device *bdev;
3887 3888
3888 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); 3889 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
3889 3890
@@ -3940,6 +3941,12 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3940 mddev->degraded = 0; 3941 mddev->degraded = 0;
3941 mddev->barriers_work = 0; 3942 mddev->barriers_work = 0;
3942 mddev->safemode = 0; 3943 mddev->safemode = 0;
3944 bdev = bdget_disk(mddev->gendisk, 0);
3945 if (bdev) {
3946 blkdev_ioctl(bdev, 0, BLKRRPART, 0);
3947 bdput(bdev);
3948 }
3949 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
3943 3950
3944 } else if (mddev->pers) 3951 } else if (mddev->pers)
3945 printk(KERN_INFO "md: %s switched to read-only mode.\n", 3952 printk(KERN_INFO "md: %s switched to read-only mode.\n",
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 11a617ab4243..84bdc2ee69e6 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -567,8 +567,8 @@ static void i2o_block_biosparam(unsigned long capacity, unsigned short *cyls,
567 567
568/** 568/**
569 * i2o_block_open - Open the block device 569 * i2o_block_open - Open the block device
570 * @inode: inode for block device being opened 570 * @bdev: block device being opened
571 * @file: file to open 571 * @mode: file open mode
572 * 572 *
573 * Power up the device, mount and lock the media. This function is called, 573 * Power up the device, mount and lock the media. This function is called,
574 * if the block device is opened for access. 574 * if the block device is opened for access.
@@ -596,8 +596,8 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
596 596
597/** 597/**
598 * i2o_block_release - Release the I2O block device 598 * i2o_block_release - Release the I2O block device
599 * @inode: inode for block device being released 599 * @disk: gendisk device being released
600 * @file: file to close 600 * @mode: file open mode
601 * 601 *
602 * Unlock and unmount the media, and power down the device. Gets called if 602 * Unlock and unmount the media, and power down the device. Gets called if
603 * the block device is closed. 603 * the block device is closed.
@@ -643,8 +643,8 @@ static int i2o_block_getgeo(struct block_device *bdev, struct hd_geometry *geo)
643 643
644/** 644/**
645 * i2o_block_ioctl - Issue device specific ioctl calls. 645 * i2o_block_ioctl - Issue device specific ioctl calls.
646 * @inode: inode for block device ioctl 646 * @bdev: block device being opened
647 * @file: file for ioctl 647 * @mode: file open mode
648 * @cmd: ioctl command 648 * @cmd: ioctl command
649 * @arg: arg 649 * @arg: arg
650 * 650 *
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 08e26beefe64..ce39fa54949b 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -113,7 +113,6 @@ static int hdpu_nexus_probe(struct platform_device *pdev)
113 if (!hdpu_chassis_id) 113 if (!hdpu_chassis_id)
114 printk(KERN_WARNING "sky_nexus: " 114 printk(KERN_WARNING "sky_nexus: "
115 "Unable to create proc dir entry: sky_chassis_id\n"); 115 "Unable to create proc dir entry: sky_chassis_id\n");
116 }
117 116
118 return 0; 117 return 0;
119} 118}
diff --git a/drivers/misc/sgi-xp/Makefile b/drivers/misc/sgi-xp/Makefile
index 35ce28578075..4fc40d8e1bcc 100644
--- a/drivers/misc/sgi-xp/Makefile
+++ b/drivers/misc/sgi-xp/Makefile
@@ -5,14 +5,14 @@
5obj-$(CONFIG_SGI_XP) += xp.o 5obj-$(CONFIG_SGI_XP) += xp.o
6xp-y := xp_main.o 6xp-y := xp_main.o
7xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o 7xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o
8xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o xp_uv.o 8xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o
9xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o 9xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o
10xp-$(CONFIG_X86_64) += xp_uv.o 10xp-$(CONFIG_X86_64) += xp_uv.o
11 11
12obj-$(CONFIG_SGI_XP) += xpc.o 12obj-$(CONFIG_SGI_XP) += xpc.o
13xpc-y := xpc_main.o xpc_channel.o xpc_partition.o 13xpc-y := xpc_main.o xpc_channel.o xpc_partition.o
14xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o 14xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o
15xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o xpc_uv.o 15xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o
16xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o 16xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o
17xpc-$(CONFIG_X86_64) += xpc_uv.o 17xpc-$(CONFIG_X86_64) += xpc_uv.o
18 18
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h
index 859a5281c61b..ed1722e50049 100644
--- a/drivers/misc/sgi-xp/xp.h
+++ b/drivers/misc/sgi-xp/xp.h
@@ -19,7 +19,11 @@
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */ 20#include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */
21#define is_shub() ia64_platform_is("sn2") 21#define is_shub() ia64_platform_is("sn2")
22#ifdef CONFIG_IA64_SGI_UV
22#define is_uv() ia64_platform_is("uv") 23#define is_uv() ia64_platform_is("uv")
24#else
25#define is_uv() 0
26#endif
23#endif 27#endif
24#ifdef CONFIG_X86_64 28#ifdef CONFIG_X86_64
25#include <asm/genapic.h> 29#include <asm/genapic.h>
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 46325fc84811..e8d5cfbd32c2 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -1104,7 +1104,7 @@ xpc_do_exit(enum xp_retval reason)
1104 1104
1105 if (is_shub()) 1105 if (is_shub())
1106 xpc_exit_sn2(); 1106 xpc_exit_sn2();
1107 else 1107 else if (is_uv())
1108 xpc_exit_uv(); 1108 xpc_exit_uv();
1109} 1109}
1110 1110
@@ -1363,7 +1363,7 @@ out_2:
1363out_1: 1363out_1:
1364 if (is_shub()) 1364 if (is_shub())
1365 xpc_exit_sn2(); 1365 xpc_exit_sn2();
1366 else 1366 else if (is_uv())
1367 xpc_exit_uv(); 1367 xpc_exit_uv();
1368 return ret; 1368 return ret;
1369} 1369}
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 5a97d3a9d745..f483c4221f76 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -2315,8 +2315,10 @@ end:
2315 */ 2315 */
2316static int sony_pic_disable(struct acpi_device *device) 2316static int sony_pic_disable(struct acpi_device *device)
2317{ 2317{
2318 if (ACPI_FAILURE(acpi_evaluate_object(device->handle, 2318 acpi_status ret = acpi_evaluate_object(device->handle, "_DIS", NULL,
2319 "_DIS", NULL, NULL))) 2319 NULL);
2320
2321 if (ACPI_FAILURE(ret) && ret != AE_NOT_FOUND)
2320 return -ENXIO; 2322 return -ENXIO;
2321 2323
2322 dprintk("Device disabled\n"); 2324 dprintk("Device disabled\n");
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 696cf3647ceb..2fadf323c696 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -391,6 +391,7 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
391static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) 391static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
392{ 392{
393 struct mmci_host *host = mmc_priv(mmc); 393 struct mmci_host *host = mmc_priv(mmc);
394 unsigned long flags;
394 395
395 WARN_ON(host->mrq != NULL); 396 WARN_ON(host->mrq != NULL);
396 397
@@ -402,7 +403,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
402 return; 403 return;
403 } 404 }
404 405
405 spin_lock_irq(&host->lock); 406 spin_lock_irqsave(&host->lock, flags);
406 407
407 host->mrq = mrq; 408 host->mrq = mrq;
408 409
@@ -411,7 +412,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
411 412
412 mmci_start_command(host, mrq->cmd, 0); 413 mmci_start_command(host, mrq->cmd, 0);
413 414
414 spin_unlock_irq(&host->lock); 415 spin_unlock_irqrestore(&host->lock, flags);
415} 416}
416 417
417static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 418static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index c54967f7942a..ba1be0b3a8c8 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -833,12 +833,14 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget)
833 833
834 } while(intr0 & RINT0); 834 } while(intr0 & RINT0);
835 835
836 /* Receive descriptor is empty now */ 836 if (rx_pkt_limit > 0) {
837 spin_lock_irqsave(&lp->lock, flags); 837 /* Receive descriptor is empty now */
838 __netif_rx_complete(dev, napi); 838 spin_lock_irqsave(&lp->lock, flags);
839 writel(VAL0|RINTEN0, mmio + INTEN0); 839 __netif_rx_complete(dev, napi);
840 writel(VAL2 | RDMD0, mmio + CMD0); 840 writel(VAL0|RINTEN0, mmio + INTEN0);
841 spin_unlock_irqrestore(&lp->lock, flags); 841 writel(VAL2 | RDMD0, mmio + CMD0);
842 spin_unlock_irqrestore(&lp->lock, flags);
843 }
842 844
843rx_not_empty: 845rx_not_empty:
844 return num_rx_pkt; 846 return num_rx_pkt;
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 82dd1a891ce7..002d918fb4c7 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0094" 43#define DRV_VERSION "EHEA_0095"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index 9b61dc9865d1..9d006878f045 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -632,10 +632,13 @@ static void ehea_rebuild_busmap(void)
632 } 632 }
633} 633}
634 634
635static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add) 635static int ehea_update_busmap(unsigned long pfn, unsigned long nr_pages, int add)
636{ 636{
637 unsigned long i, start_section, end_section; 637 unsigned long i, start_section, end_section;
638 638
639 if (!nr_pages)
640 return 0;
641
639 if (!ehea_bmap) { 642 if (!ehea_bmap) {
640 ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL); 643 ehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL);
641 if (!ehea_bmap) 644 if (!ehea_bmap)
@@ -643,7 +646,7 @@ static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add)
643 } 646 }
644 647
645 start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE; 648 start_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE;
646 end_section = start_section + ((pgnum * PAGE_SIZE) / EHEA_SECTSIZE); 649 end_section = start_section + ((nr_pages * PAGE_SIZE) / EHEA_SECTSIZE);
647 /* Mark entries as valid or invalid only; address is assigned later */ 650 /* Mark entries as valid or invalid only; address is assigned later */
648 for (i = start_section; i < end_section; i++) { 651 for (i = start_section; i < end_section; i++) {
649 u64 flag; 652 u64 flag;
@@ -692,10 +695,54 @@ int ehea_rem_sect_bmap(unsigned long pfn, unsigned long nr_pages)
692 return ret; 695 return ret;
693} 696}
694 697
695static int ehea_create_busmap_callback(unsigned long pfn, 698static int ehea_is_hugepage(unsigned long pfn)
696 unsigned long nr_pages, void *arg) 699{
700 int page_order;
701
702 if (pfn & EHEA_HUGEPAGE_PFN_MASK)
703 return 0;
704
705 page_order = compound_order(pfn_to_page(pfn));
706 if (page_order + PAGE_SHIFT != EHEA_HUGEPAGESHIFT)
707 return 0;
708
709 return 1;
710}
711
712static int ehea_create_busmap_callback(unsigned long initial_pfn,
713 unsigned long total_nr_pages, void *arg)
697{ 714{
698 return ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_ADD_SECT); 715 int ret;
716 unsigned long pfn, start_pfn, end_pfn, nr_pages;
717
718 if ((total_nr_pages * PAGE_SIZE) < EHEA_HUGEPAGE_SIZE)
719 return ehea_update_busmap(initial_pfn, total_nr_pages,
720 EHEA_BUSMAP_ADD_SECT);
721
722 /* Given chunk is >= 16GB -> check for hugepages */
723 start_pfn = initial_pfn;
724 end_pfn = initial_pfn + total_nr_pages;
725 pfn = start_pfn;
726
727 while (pfn < end_pfn) {
728 if (ehea_is_hugepage(pfn)) {
729 /* Add mem found in front of the hugepage */
730 nr_pages = pfn - start_pfn;
731 ret = ehea_update_busmap(start_pfn, nr_pages,
732 EHEA_BUSMAP_ADD_SECT);
733 if (ret)
734 return ret;
735
736 /* Skip the hugepage */
737 pfn += (EHEA_HUGEPAGE_SIZE / PAGE_SIZE);
738 start_pfn = pfn;
739 } else
740 pfn += (EHEA_SECTSIZE / PAGE_SIZE);
741 }
742
743 /* Add mem found behind the hugepage(s) */
744 nr_pages = pfn - start_pfn;
745 return ehea_update_busmap(start_pfn, nr_pages, EHEA_BUSMAP_ADD_SECT);
699} 746}
700 747
701int ehea_create_busmap(void) 748int ehea_create_busmap(void)
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h
index 1e58dc06b7d2..0817c1e74a19 100644
--- a/drivers/net/ehea/ehea_qmr.h
+++ b/drivers/net/ehea/ehea_qmr.h
@@ -40,6 +40,9 @@
40#define EHEA_PAGESIZE (1UL << EHEA_PAGESHIFT) 40#define EHEA_PAGESIZE (1UL << EHEA_PAGESHIFT)
41#define EHEA_SECTSIZE (1UL << 24) 41#define EHEA_SECTSIZE (1UL << 24)
42#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT) 42#define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT)
43#define EHEA_HUGEPAGESHIFT 34
44#define EHEA_HUGEPAGE_SIZE (1UL << EHEA_HUGEPAGESHIFT)
45#define EHEA_HUGEPAGE_PFN_MASK ((EHEA_HUGEPAGE_SIZE - 1) >> PAGE_SHIFT)
43 46
44#if ((1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE) 47#if ((1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE)
45#error eHEA module cannot work if kernel sectionsize < ehea sectionsize 48#error eHEA module cannot work if kernel sectionsize < ehea sectionsize
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 2ee2622258f5..901212aa37cb 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2605,7 +2605,7 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2605 of_device_is_compatible(np, "ibm,emac-440gr")) 2605 of_device_is_compatible(np, "ibm,emac-440gr"))
2606 dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX; 2606 dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
2607 if (of_device_is_compatible(np, "ibm,emac-405ez")) { 2607 if (of_device_is_compatible(np, "ibm,emac-405ez")) {
2608#ifdef CONFIG_IBM_NEW_EMAC_NO_FLOW_CONTROL 2608#ifdef CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL
2609 dev->features |= EMAC_FTR_NO_FLOW_CONTROL_40x; 2609 dev->features |= EMAC_FTR_NO_FLOW_CONTROL_40x;
2610#else 2610#else
2611 printk(KERN_ERR "%s: Flow control not disabled!\n", 2611 printk(KERN_ERR "%s: Flow control not disabled!\n",
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index 1b0eebf84f76..4b9794e97a79 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -35,7 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/cpumask.h>
39 38
40#include <linux/mlx4/driver.h> 39#include <linux/mlx4/driver.h>
41#include <linux/mlx4/device.h> 40#include <linux/mlx4/device.h>
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index be09fdb79cb8..cee199ceba2f 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -360,9 +360,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
360#define QUERY_PORT_ETH_MTU_OFFSET 0x02 360#define QUERY_PORT_ETH_MTU_OFFSET 0x02
361#define QUERY_PORT_WIDTH_OFFSET 0x06 361#define QUERY_PORT_WIDTH_OFFSET 0x06
362#define QUERY_PORT_MAX_GID_PKEY_OFFSET 0x07 362#define QUERY_PORT_MAX_GID_PKEY_OFFSET 0x07
363#define QUERY_PORT_MAC_OFFSET 0x08
364#define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a 363#define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a
365#define QUERY_PORT_MAX_VL_OFFSET 0x0b 364#define QUERY_PORT_MAX_VL_OFFSET 0x0b
365#define QUERY_PORT_MAC_OFFSET 0x10
366 366
367 for (i = 1; i <= dev_cap->num_ports; ++i) { 367 for (i = 1; i <= dev_cap->num_ports; ++i) {
368 err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT, 368 err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT,
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 8e46a513a252..c91852f49a48 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -420,9 +420,13 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
420 /* Allocate Tx/Rx descriptor memory */ 420 /* Allocate Tx/Rx descriptor memory */
421 db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * 421 db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) *
422 DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr); 422 DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
423 if (!db->desc_pool_ptr)
424 goto err_out_res;
423 425
424 db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * 426 db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC *
425 TX_DESC_CNT + 4, &db->buf_pool_dma_ptr); 427 TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
428 if (!db->buf_pool_ptr)
429 goto err_out_free_desc;
426 430
427 db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr; 431 db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
428 db->first_tx_desc_dma = db->desc_pool_dma_ptr; 432 db->first_tx_desc_dma = db->desc_pool_dma_ptr;
@@ -469,7 +473,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
469 473
470 err = register_netdev (dev); 474 err = register_netdev (dev);
471 if (err) 475 if (err)
472 goto err_out_res; 476 goto err_out_free_buf;
473 477
474 printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, " 478 printk(KERN_INFO "%s: Davicom DM%04lx at pci%s, "
475 "%s, irq %d.\n", 479 "%s, irq %d.\n",
@@ -483,6 +487,12 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
483 487
484 return 0; 488 return 0;
485 489
490err_out_free_buf:
491 pci_free_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
492 db->buf_pool_ptr, db->buf_pool_dma_ptr);
493err_out_free_desc:
494 pci_free_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20,
495 db->desc_pool_ptr, db->desc_pool_dma_ptr);
486err_out_res: 496err_out_res:
487 pci_release_regions(pdev); 497 pci_release_regions(pdev);
488err_out_disable: 498err_out_disable:
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 78df2be8a728..db3377dae9d5 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -396,6 +396,20 @@ static void dm9601_set_multicast(struct net_device *net)
396 dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl); 396 dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
397} 397}
398 398
399static int dm9601_set_mac_address(struct net_device *net, void *p)
400{
401 struct sockaddr *addr = p;
402 struct usbnet *dev = netdev_priv(net);
403
404 if (!is_valid_ether_addr(addr->sa_data))
405 return -EINVAL;
406
407 memcpy(net->dev_addr, addr->sa_data, net->addr_len);
408 dm_write_async(dev, DM_PHY_ADDR, net->addr_len, net->dev_addr);
409
410 return 0;
411}
412
399static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) 413static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
400{ 414{
401 int ret; 415 int ret;
@@ -406,6 +420,7 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
406 420
407 dev->net->do_ioctl = dm9601_ioctl; 421 dev->net->do_ioctl = dm9601_ioctl;
408 dev->net->set_multicast_list = dm9601_set_multicast; 422 dev->net->set_multicast_list = dm9601_set_multicast;
423 dev->net->set_mac_address = dm9601_set_mac_address;
409 dev->net->ethtool_ops = &dm9601_ethtool_ops; 424 dev->net->ethtool_ops = &dm9601_ethtool_ops;
410 dev->net->hard_header_len += DM_TX_OVERHEAD; 425 dev->net->hard_header_len += DM_TX_OVERHEAD;
411 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 426 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 2dced383bcfb..3590ea5a902d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -521,7 +521,7 @@ static void __devexit velocity_remove1(struct pci_dev *pdev)
521 * we don't duplicate code for each option. 521 * we don't duplicate code for each option.
522 */ 522 */
523 523
524static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max, int def, char *name, char *devname) 524static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max, int def, char *name, const char *devname)
525{ 525{
526 if (val == -1) 526 if (val == -1)
527 *opt = def; 527 *opt = def;
@@ -550,7 +550,7 @@ static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max,
550 * we don't duplicate code for each option. 550 * we don't duplicate code for each option.
551 */ 551 */
552 552
553static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 flag, char *name, char *devname) 553static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 flag, char *name, const char *devname)
554{ 554{
555 (*opt) &= (~flag); 555 (*opt) &= (~flag);
556 if (val == -1) 556 if (val == -1)
@@ -576,7 +576,7 @@ static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 fla
576 * for the current device 576 * for the current device
577 */ 577 */
578 578
579static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname) 579static void __devinit velocity_get_options(struct velocity_opt *opts, int index, const char *devname)
580{ 580{
581 581
582 velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname); 582 velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname);
@@ -863,6 +863,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
863 static int first = 1; 863 static int first = 1;
864 struct net_device *dev; 864 struct net_device *dev;
865 int i; 865 int i;
866 const char *drv_string;
866 const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data]; 867 const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
867 struct velocity_info *vptr; 868 struct velocity_info *vptr;
868 struct mac_regs __iomem * regs; 869 struct mac_regs __iomem * regs;
@@ -935,7 +936,9 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
935 dev->dev_addr[i] = readb(&regs->PAR[i]); 936 dev->dev_addr[i] = readb(&regs->PAR[i]);
936 937
937 938
938 velocity_get_options(&vptr->options, velocity_nics, dev->name); 939 drv_string = dev_driver_string(&pdev->dev);
940
941 velocity_get_options(&vptr->options, velocity_nics, drv_string);
939 942
940 /* 943 /*
941 * Mask out the options cannot be set to the chip 944 * Mask out the options cannot be set to the chip
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 327d58589e12..6e92f7b44b1a 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -756,10 +756,11 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
756 case CISCO_ADDR_REQ: 756 case CISCO_ADDR_REQ:
757 /* Stolen from net/ipv4/devinet.c -- SIOCGIFADDR ioctl */ 757 /* Stolen from net/ipv4/devinet.c -- SIOCGIFADDR ioctl */
758 { 758 {
759 struct in_device *in_dev;
760 struct in_ifaddr *ifa;
761 __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */ 759 __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */
762#ifdef CONFIG_INET 760#ifdef CONFIG_INET
761 struct in_device *in_dev;
762 struct in_ifaddr *ifa;
763
763 rcu_read_lock(); 764 rcu_read_lock();
764 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) 765 if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
765 { 766 {
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 0f1d6bdd51a2..cfd4d052d666 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -661,8 +661,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
661{ 661{
662 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 662 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
663 struct ath5k_softc *sc = hw->priv; 663 struct ath5k_softc *sc = hw->priv;
664 struct ath5k_hw *ah = sc->ah; 664 int err;
665 int i, err;
666 665
667 pci_restore_state(pdev); 666 pci_restore_state(pdev);
668 667
@@ -688,16 +687,6 @@ ath5k_pci_resume(struct pci_dev *pdev)
688 goto err_irq; 687 goto err_irq;
689 ath5k_led_enable(sc); 688 ath5k_led_enable(sc);
690 689
691 /*
692 * Reset the key cache since some parts do not
693 * reset the contents on initial power up or resume.
694 *
695 * FIXME: This may need to be revisited when mac80211 becomes
696 * aware of suspend/resume.
697 */
698 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
699 ath5k_hw_reset_key(ah, i);
700
701 return 0; 690 return 0;
702err_irq: 691err_irq:
703 free_irq(pdev->irq, sc); 692 free_irq(pdev->irq, sc);
@@ -718,7 +707,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
718 struct ath5k_softc *sc = hw->priv; 707 struct ath5k_softc *sc = hw->priv;
719 struct ath5k_hw *ah = sc->ah; 708 struct ath5k_hw *ah = sc->ah;
720 u8 mac[ETH_ALEN]; 709 u8 mac[ETH_ALEN];
721 unsigned int i;
722 int ret; 710 int ret;
723 711
724 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device); 712 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
@@ -737,13 +725,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
737 __set_bit(ATH_STAT_MRRETRY, sc->status); 725 __set_bit(ATH_STAT_MRRETRY, sc->status);
738 726
739 /* 727 /*
740 * Reset the key cache since some parts do not
741 * reset the contents on initial power up.
742 */
743 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
744 ath5k_hw_reset_key(ah, i);
745
746 /*
747 * Collect the channel list. The 802.11 layer 728 * Collect the channel list. The 802.11 layer
748 * is resposible for filtering this list based 729 * is resposible for filtering this list based
749 * on settings like the phy mode and regulatory 730 * on settings like the phy mode and regulatory
@@ -2202,7 +2183,8 @@ ath5k_beacon_config(struct ath5k_softc *sc)
2202static int 2183static int
2203ath5k_init(struct ath5k_softc *sc, bool is_resume) 2184ath5k_init(struct ath5k_softc *sc, bool is_resume)
2204{ 2185{
2205 int ret; 2186 struct ath5k_hw *ah = sc->ah;
2187 int ret, i;
2206 2188
2207 mutex_lock(&sc->lock); 2189 mutex_lock(&sc->lock);
2208 2190
@@ -2235,10 +2217,17 @@ ath5k_init(struct ath5k_softc *sc, bool is_resume)
2235 if (ret) 2217 if (ret)
2236 goto done; 2218 goto done;
2237 2219
2220 /*
2221 * Reset the key cache since some parts do not reset the
2222 * contents on initial power up or resume from suspend.
2223 */
2224 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
2225 ath5k_hw_reset_key(ah, i);
2226
2238 __set_bit(ATH_STAT_STARTED, sc->status); 2227 __set_bit(ATH_STAT_STARTED, sc->status);
2239 2228
2240 /* Set ack to be sent at low bit-rates */ 2229 /* Set ack to be sent at low bit-rates */
2241 ath5k_hw_set_ack_bitrate_high(sc->ah, false); 2230 ath5k_hw_set_ack_bitrate_high(ah, false);
2242 2231
2243 mod_timer(&sc->calib_tim, round_jiffies(jiffies + 2232 mod_timer(&sc->calib_tim, round_jiffies(jiffies +
2244 msecs_to_jiffies(ath5k_calinterval * 1000))); 2233 msecs_to_jiffies(ath5k_calinterval * 1000)));
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 2d022f83774c..827ca0384a4c 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -319,7 +319,7 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
319 void *tmp; 319 void *tmp;
320 int err; 320 int err;
321 u8 *end = (u8 *)eeprom + len; 321 u8 *end = (u8 *)eeprom + len;
322 u16 synth; 322 u16 synth = 0;
323 DECLARE_MAC_BUF(mac); 323 DECLARE_MAC_BUF(mac);
324 324
325 wrap = (struct eeprom_pda_wrap *) eeprom; 325 wrap = (struct eeprom_pda_wrap *) eeprom;
@@ -422,7 +422,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
422 entry = (void *)entry + (entry_len + 1)*2; 422 entry = (void *)entry + (entry_len + 1)*2;
423 } 423 }
424 424
425 if (!priv->iq_autocal || !priv->output_limit || !priv->curve_data) { 425 if (!synth || !priv->iq_autocal || !priv->output_limit ||
426 !priv->curve_data) {
426 printk(KERN_ERR "p54: not all required entries found in eeprom!\n"); 427 printk(KERN_ERR "p54: not all required entries found in eeprom!\n");
427 err = -EINVAL; 428 err = -EINVAL;
428 goto err; 429 goto err;
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 1c2a02a741af..88b3cad8b65e 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -346,68 +346,6 @@ static void p54p_tx(struct ieee80211_hw *dev, struct p54_control_hdr *data,
346 printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy)); 346 printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
347} 347}
348 348
349static int p54p_open(struct ieee80211_hw *dev)
350{
351 struct p54p_priv *priv = dev->priv;
352 int err;
353
354 init_completion(&priv->boot_comp);
355 err = request_irq(priv->pdev->irq, &p54p_interrupt,
356 IRQF_SHARED, "p54pci", dev);
357 if (err) {
358 printk(KERN_ERR "%s: failed to register IRQ handler\n",
359 wiphy_name(dev->wiphy));
360 return err;
361 }
362
363 memset(priv->ring_control, 0, sizeof(*priv->ring_control));
364 err = p54p_upload_firmware(dev);
365 if (err) {
366 free_irq(priv->pdev->irq, dev);
367 return err;
368 }
369 priv->rx_idx_data = priv->tx_idx_data = 0;
370 priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0;
371
372 p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
373 ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
374
375 p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
376 ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
377
378 P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
379 P54P_READ(ring_control_base);
380 wmb();
381 udelay(10);
382
383 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
384 P54P_READ(int_enable);
385 wmb();
386 udelay(10);
387
388 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
389 P54P_READ(dev_int);
390
391 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
392 printk(KERN_ERR "%s: Cannot boot firmware!\n",
393 wiphy_name(dev->wiphy));
394 free_irq(priv->pdev->irq, dev);
395 return -ETIMEDOUT;
396 }
397
398 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
399 P54P_READ(int_enable);
400 wmb();
401 udelay(10);
402
403 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
404 P54P_READ(dev_int);
405 wmb();
406 udelay(10);
407
408 return 0;
409}
410
411static void p54p_stop(struct ieee80211_hw *dev) 349static void p54p_stop(struct ieee80211_hw *dev)
412{ 350{
413 struct p54p_priv *priv = dev->priv; 351 struct p54p_priv *priv = dev->priv;
@@ -474,6 +412,68 @@ static void p54p_stop(struct ieee80211_hw *dev)
474 memset(ring_control, 0, sizeof(*ring_control)); 412 memset(ring_control, 0, sizeof(*ring_control));
475} 413}
476 414
415static int p54p_open(struct ieee80211_hw *dev)
416{
417 struct p54p_priv *priv = dev->priv;
418 int err;
419
420 init_completion(&priv->boot_comp);
421 err = request_irq(priv->pdev->irq, &p54p_interrupt,
422 IRQF_SHARED, "p54pci", dev);
423 if (err) {
424 printk(KERN_ERR "%s: failed to register IRQ handler\n",
425 wiphy_name(dev->wiphy));
426 return err;
427 }
428
429 memset(priv->ring_control, 0, sizeof(*priv->ring_control));
430 err = p54p_upload_firmware(dev);
431 if (err) {
432 free_irq(priv->pdev->irq, dev);
433 return err;
434 }
435 priv->rx_idx_data = priv->tx_idx_data = 0;
436 priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0;
437
438 p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
439 ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
440
441 p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
442 ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
443
444 P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
445 P54P_READ(ring_control_base);
446 wmb();
447 udelay(10);
448
449 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
450 P54P_READ(int_enable);
451 wmb();
452 udelay(10);
453
454 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
455 P54P_READ(dev_int);
456
457 if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
458 printk(KERN_ERR "%s: Cannot boot firmware!\n",
459 wiphy_name(dev->wiphy));
460 p54p_stop(dev);
461 return -ETIMEDOUT;
462 }
463
464 P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
465 P54P_READ(int_enable);
466 wmb();
467 udelay(10);
468
469 P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
470 P54P_READ(dev_int);
471 wmb();
472 udelay(10);
473
474 return 0;
475}
476
477static int __devinit p54p_probe(struct pci_dev *pdev, 477static int __devinit p54p_probe(struct pci_dev *pdev,
478 const struct pci_device_id *id) 478 const struct pci_device_id *id)
479{ 479{
@@ -556,11 +556,13 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
556 spin_lock_init(&priv->lock); 556 spin_lock_init(&priv->lock);
557 tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev); 557 tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);
558 558
559 p54p_open(dev); 559 err = p54p_open(dev);
560 if (err)
561 goto err_free_common;
560 err = p54_read_eeprom(dev); 562 err = p54_read_eeprom(dev);
561 p54p_stop(dev); 563 p54p_stop(dev);
562 if (err) 564 if (err)
563 goto err_free_desc; 565 goto err_free_common;
564 566
565 err = ieee80211_register_hw(dev); 567 err = ieee80211_register_hw(dev);
566 if (err) { 568 if (err) {
@@ -573,8 +575,6 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
573 575
574 err_free_common: 576 err_free_common:
575 p54_free_common(dev); 577 p54_free_common(dev);
576
577 err_free_desc:
578 pci_free_consistent(pdev, sizeof(*priv->ring_control), 578 pci_free_consistent(pdev, sizeof(*priv->ring_control),
579 priv->ring_control, priv->ring_control_dma); 579 priv->ring_control, priv->ring_control_dma);
580 580
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index b1899e9c1f65..0cd5fbc7f2c2 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -112,7 +112,7 @@ static int parport_probe(struct pcmcia_device *link)
112 112
113 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 113 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
114 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 114 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
115 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 115 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
116 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 116 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
117 link->conf.Attributes = CONF_ENABLE_IRQ; 117 link->conf.Attributes = CONF_ENABLE_IRQ;
118 link->conf.IntType = INT_MEMORY_AND_IO; 118 link->conf.IntType = INT_MEMORY_AND_IO;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 96cf8ecd04ce..bbf66ea8fd87 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -43,20 +43,6 @@ static void __devinit quirk_mellanox_tavor(struct pci_dev *dev)
43DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor); 43DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor);
44DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor); 44DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor);
45 45
46/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
47int forbid_dac __read_mostly;
48EXPORT_SYMBOL(forbid_dac);
49
50static __devinit void via_no_dac(struct pci_dev *dev)
51{
52 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
53 dev_info(&dev->dev,
54 "VIA PCI bridge detected. Disabling DAC.\n");
55 forbid_dac = 1;
56 }
57}
58DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
59
60/* Deal with broken BIOS'es that neglect to enable passive release, 46/* Deal with broken BIOS'es that neglect to enable passive release,
61 which can cause problems in combination with the 82441FX/PPro MTRRs */ 47 which can cause problems in combination with the 82441FX/PPro MTRRs */
62static void quirk_passive_release(struct pci_dev *dev) 48static void quirk_passive_release(struct pci_dev *dev)
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index afea2b2558b5..76d4a98f0955 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -693,8 +693,9 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
693 type = 0; 693 type = 0;
694 if (s->functions > 1) /* All of this ought to be handled higher up */ 694 if (s->functions > 1) /* All of this ought to be handled higher up */
695 type = IRQF_SHARED; 695 type = IRQF_SHARED;
696 if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) 696 else if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
697 type = IRQF_SHARED; 697 type = IRQF_SHARED;
698 else printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n");
698 699
699#ifdef CONFIG_PCMCIA_PROBE 700#ifdef CONFIG_PCMCIA_PROBE
700 701
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 3688e339db87..773b29cec8be 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -79,6 +79,11 @@ struct da903x_regulator_info {
79 int enable_bit; 79 int enable_bit;
80}; 80};
81 81
82static inline struct device *to_da903x_dev(struct regulator_dev *rdev)
83{
84 return rdev_get_dev(rdev)->parent->parent;
85}
86
82static inline int check_range(struct da903x_regulator_info *info, 87static inline int check_range(struct da903x_regulator_info *info,
83 int min_uV, int max_uV) 88 int min_uV, int max_uV)
84{ 89{
@@ -93,7 +98,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
93 int min_uV, int max_uV) 98 int min_uV, int max_uV)
94{ 99{
95 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 100 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
96 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 101 struct device *da9034_dev = to_da903x_dev(rdev);
97 uint8_t val, mask; 102 uint8_t val, mask;
98 103
99 if (check_range(info, min_uV, max_uV)) { 104 if (check_range(info, min_uV, max_uV)) {
@@ -111,7 +116,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
111static int da903x_get_voltage(struct regulator_dev *rdev) 116static int da903x_get_voltage(struct regulator_dev *rdev)
112{ 117{
113 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 118 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
114 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 119 struct device *da9034_dev = to_da903x_dev(rdev);
115 uint8_t val, mask; 120 uint8_t val, mask;
116 int ret; 121 int ret;
117 122
@@ -128,7 +133,7 @@ static int da903x_get_voltage(struct regulator_dev *rdev)
128static int da903x_enable(struct regulator_dev *rdev) 133static int da903x_enable(struct regulator_dev *rdev)
129{ 134{
130 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 135 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
131 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 136 struct device *da9034_dev = to_da903x_dev(rdev);
132 137
133 return da903x_set_bits(da9034_dev, info->enable_reg, 138 return da903x_set_bits(da9034_dev, info->enable_reg,
134 1 << info->enable_bit); 139 1 << info->enable_bit);
@@ -137,7 +142,7 @@ static int da903x_enable(struct regulator_dev *rdev)
137static int da903x_disable(struct regulator_dev *rdev) 142static int da903x_disable(struct regulator_dev *rdev)
138{ 143{
139 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 144 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
140 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 145 struct device *da9034_dev = to_da903x_dev(rdev);
141 146
142 return da903x_clr_bits(da9034_dev, info->enable_reg, 147 return da903x_clr_bits(da9034_dev, info->enable_reg,
143 1 << info->enable_bit); 148 1 << info->enable_bit);
@@ -146,7 +151,7 @@ static int da903x_disable(struct regulator_dev *rdev)
146static int da903x_is_enabled(struct regulator_dev *rdev) 151static int da903x_is_enabled(struct regulator_dev *rdev)
147{ 152{
148 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 153 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
149 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 154 struct device *da9034_dev = to_da903x_dev(rdev);
150 uint8_t reg_val; 155 uint8_t reg_val;
151 int ret; 156 int ret;
152 157
@@ -162,7 +167,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev,
162 int min_uV, int max_uV) 167 int min_uV, int max_uV)
163{ 168{
164 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 169 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
165 struct device *da903x_dev = rdev_get_dev(rdev)->parent; 170 struct device *da903x_dev = to_da903x_dev(rdev);
166 uint8_t val, mask; 171 uint8_t val, mask;
167 int ret; 172 int ret;
168 173
@@ -189,7 +194,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
189 int min_uV, int max_uV) 194 int min_uV, int max_uV)
190{ 195{
191 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 196 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
192 struct device *da903x_dev = rdev_get_dev(rdev)->parent; 197 struct device *da903x_dev = to_da903x_dev(rdev);
193 uint8_t val, mask; 198 uint8_t val, mask;
194 int thresh; 199 int thresh;
195 200
@@ -215,7 +220,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
215static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) 220static int da9030_get_ldo14_voltage(struct regulator_dev *rdev)
216{ 221{
217 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 222 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
218 struct device *da903x_dev = rdev_get_dev(rdev)->parent; 223 struct device *da903x_dev = to_da903x_dev(rdev);
219 uint8_t val, mask; 224 uint8_t val, mask;
220 int ret; 225 int ret;
221 226
@@ -238,7 +243,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev,
238 int min_uV, int max_uV) 243 int min_uV, int max_uV)
239{ 244{
240 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 245 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
241 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 246 struct device *da9034_dev = to_da903x_dev(rdev);
242 uint8_t val, mask; 247 uint8_t val, mask;
243 int ret; 248 int ret;
244 249
@@ -264,7 +269,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
264 int min_uV, int max_uV) 269 int min_uV, int max_uV)
265{ 270{
266 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 271 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
267 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 272 struct device *da9034_dev = to_da903x_dev(rdev);
268 uint8_t val, mask; 273 uint8_t val, mask;
269 274
270 if (check_range(info, min_uV, max_uV)) { 275 if (check_range(info, min_uV, max_uV)) {
@@ -283,7 +288,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
283static int da9034_get_ldo12_voltage(struct regulator_dev *rdev) 288static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
284{ 289{
285 struct da903x_regulator_info *info = rdev_get_drvdata(rdev); 290 struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
286 struct device *da9034_dev = rdev_get_dev(rdev)->parent; 291 struct device *da9034_dev = to_da903x_dev(rdev);
287 uint8_t val, mask; 292 uint8_t val, mask;
288 int ret; 293 int ret;
289 294
@@ -466,7 +471,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
466 if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15) 471 if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15)
467 ri->desc.ops = &da9030_regulator_ldo1_15_ops; 472 ri->desc.ops = &da9030_regulator_ldo1_15_ops;
468 473
469 rdev = regulator_register(&ri->desc, pdev->dev.parent, ri); 474 rdev = regulator_register(&ri->desc, &pdev->dev, ri);
470 if (IS_ERR(rdev)) { 475 if (IS_ERR(rdev)) {
471 dev_err(&pdev->dev, "failed to register regulator %s\n", 476 dev_err(&pdev->dev, "failed to register regulator %s\n",
472 ri->desc.name); 477 ri->desc.name);
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index 37d131d03f33..45e5b106af73 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -189,7 +189,7 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
189 .set_time = ds3234_set_time, 189 .set_time = ds3234_set_time,
190}; 190};
191 191
192static int ds3234_probe(struct spi_device *spi) 192static int __devinit ds3234_probe(struct spi_device *spi)
193{ 193{
194 struct rtc_device *rtc; 194 struct rtc_device *rtc;
195 unsigned char tmp; 195 unsigned char tmp;
@@ -249,7 +249,7 @@ static int ds3234_probe(struct spi_device *spi)
249 return 0; 249 return 0;
250} 250}
251 251
252static int __exit ds3234_remove(struct spi_device *spi) 252static int __devexit ds3234_remove(struct spi_device *spi)
253{ 253{
254 struct ds3234 *chip = platform_get_drvdata(spi); 254 struct ds3234 *chip = platform_get_drvdata(spi);
255 struct rtc_device *rtc = chip->rtc; 255 struct rtc_device *rtc = chip->rtc;
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 910bc704939c..f59277bbedaa 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -455,6 +455,8 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
455 455
456 s3c_rtc_setfreq(&pdev->dev, 1); 456 s3c_rtc_setfreq(&pdev->dev, 1);
457 457
458 device_init_wakeup(&pdev->dev, 1);
459
458 /* register RTC and exit */ 460 /* register RTC and exit */
459 461
460 rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops, 462 rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops,
@@ -507,7 +509,7 @@ static int s3c_rtc_resume(struct platform_device *pdev)
507#define s3c_rtc_resume NULL 509#define s3c_rtc_resume NULL
508#endif 510#endif
509 511
510static struct platform_driver s3c2410_rtcdrv = { 512static struct platform_driver s3c2410_rtc_driver = {
511 .probe = s3c_rtc_probe, 513 .probe = s3c_rtc_probe,
512 .remove = __devexit_p(s3c_rtc_remove), 514 .remove = __devexit_p(s3c_rtc_remove),
513 .suspend = s3c_rtc_suspend, 515 .suspend = s3c_rtc_suspend,
@@ -523,12 +525,12 @@ static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics
523static int __init s3c_rtc_init(void) 525static int __init s3c_rtc_init(void)
524{ 526{
525 printk(banner); 527 printk(banner);
526 return platform_driver_register(&s3c2410_rtcdrv); 528 return platform_driver_register(&s3c2410_rtc_driver);
527} 529}
528 530
529static void __exit s3c_rtc_exit(void) 531static void __exit s3c_rtc_exit(void)
530{ 532{
531 platform_driver_unregister(&s3c2410_rtcdrv); 533 platform_driver_unregister(&s3c2410_rtc_driver);
532} 534}
533 535
534module_init(s3c_rtc_init); 536module_init(s3c_rtc_init);
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 023803dbb0c7..ae18baf59f06 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -76,7 +76,7 @@ tapeblock_trigger_requeue(struct tape_device *device)
76static void 76static void
77tapeblock_end_request(struct request *req, int error) 77tapeblock_end_request(struct request *req, int error)
78{ 78{
79 if (__blk_end_request(req, error, blk_rq_bytes(req))) 79 if (blk_end_request(req, error, blk_rq_bytes(req)))
80 BUG(); 80 BUG();
81} 81}
82 82
@@ -166,7 +166,7 @@ tapeblock_requeue(struct work_struct *work) {
166 nr_queued++; 166 nr_queued++;
167 spin_unlock(get_ccwdev_lock(device->cdev)); 167 spin_unlock(get_ccwdev_lock(device->cdev));
168 168
169 spin_lock(&device->blk_data.request_queue_lock); 169 spin_lock_irq(&device->blk_data.request_queue_lock);
170 while ( 170 while (
171 !blk_queue_plugged(queue) && 171 !blk_queue_plugged(queue) &&
172 elv_next_request(queue) && 172 elv_next_request(queue) &&
@@ -176,7 +176,9 @@ tapeblock_requeue(struct work_struct *work) {
176 if (rq_data_dir(req) == WRITE) { 176 if (rq_data_dir(req) == WRITE) {
177 DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); 177 DBF_EVENT(1, "TBLOCK: Rejecting write request\n");
178 blkdev_dequeue_request(req); 178 blkdev_dequeue_request(req);
179 spin_unlock_irq(&device->blk_data.request_queue_lock);
179 tapeblock_end_request(req, -EIO); 180 tapeblock_end_request(req, -EIO);
181 spin_lock_irq(&device->blk_data.request_queue_lock);
180 continue; 182 continue;
181 } 183 }
182 blkdev_dequeue_request(req); 184 blkdev_dequeue_request(req);
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index d7073dbf825c..f9bb51fa7f5b 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -1200,7 +1200,7 @@ tape_open(struct tape_device *device)
1200{ 1200{
1201 int rc; 1201 int rc;
1202 1202
1203 spin_lock(get_ccwdev_lock(device->cdev)); 1203 spin_lock_irq(get_ccwdev_lock(device->cdev));
1204 if (device->tape_state == TS_NOT_OPER) { 1204 if (device->tape_state == TS_NOT_OPER) {
1205 DBF_EVENT(6, "TAPE:nodev\n"); 1205 DBF_EVENT(6, "TAPE:nodev\n");
1206 rc = -ENODEV; 1206 rc = -ENODEV;
@@ -1218,7 +1218,7 @@ tape_open(struct tape_device *device)
1218 tape_state_set(device, TS_IN_USE); 1218 tape_state_set(device, TS_IN_USE);
1219 rc = 0; 1219 rc = 0;
1220 } 1220 }
1221 spin_unlock(get_ccwdev_lock(device->cdev)); 1221 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1222 return rc; 1222 return rc;
1223} 1223}
1224 1224
@@ -1228,11 +1228,11 @@ tape_open(struct tape_device *device)
1228int 1228int
1229tape_release(struct tape_device *device) 1229tape_release(struct tape_device *device)
1230{ 1230{
1231 spin_lock(get_ccwdev_lock(device->cdev)); 1231 spin_lock_irq(get_ccwdev_lock(device->cdev));
1232 if (device->tape_state == TS_IN_USE) 1232 if (device->tape_state == TS_IN_USE)
1233 tape_state_set(device, TS_UNUSED); 1233 tape_state_set(device, TS_UNUSED);
1234 module_put(device->discipline->owner); 1234 module_put(device->discipline->owner);
1235 spin_unlock(get_ccwdev_lock(device->cdev)); 1235 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1236 return 0; 1236 return 0;
1237} 1237}
1238 1238
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
index b5390821434f..f05590355be8 100644
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -20,6 +20,7 @@ static struct dentry *debugfs_root;
20#define MAX_DEBUGFS_QUEUES 32 20#define MAX_DEBUGFS_QUEUES 32
21static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL }; 21static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL };
22static DEFINE_MUTEX(debugfs_mutex); 22static DEFINE_MUTEX(debugfs_mutex);
23#define QDIO_DEBUGFS_NAME_LEN 40
23 24
24void qdio_allocate_do_dbf(struct qdio_initialize *init_data) 25void qdio_allocate_do_dbf(struct qdio_initialize *init_data)
25{ 26{
@@ -152,17 +153,6 @@ static int qstat_seq_open(struct inode *inode, struct file *filp)
152 filp->f_path.dentry->d_inode->i_private); 153 filp->f_path.dentry->d_inode->i_private);
153} 154}
154 155
155static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name)
156{
157 memset(name, 0, sizeof(name));
158 sprintf(name, "%s", dev_name(&cdev->dev));
159 if (q->is_input_q)
160 sprintf(name + strlen(name), "_input");
161 else
162 sprintf(name + strlen(name), "_output");
163 sprintf(name + strlen(name), "_%d", q->nr);
164}
165
166static void remove_debugfs_entry(struct qdio_q *q) 156static void remove_debugfs_entry(struct qdio_q *q)
167{ 157{
168 int i; 158 int i;
@@ -189,14 +179,17 @@ static struct file_operations debugfs_fops = {
189static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) 179static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev)
190{ 180{
191 int i = 0; 181 int i = 0;
192 char name[40]; 182 char name[QDIO_DEBUGFS_NAME_LEN];
193 183
194 while (debugfs_queues[i] != NULL) { 184 while (debugfs_queues[i] != NULL) {
195 i++; 185 i++;
196 if (i >= MAX_DEBUGFS_QUEUES) 186 if (i >= MAX_DEBUGFS_QUEUES)
197 return; 187 return;
198 } 188 }
199 get_queue_name(q, cdev, name); 189 snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%s_%d",
190 dev_name(&cdev->dev),
191 q->is_input_q ? "input" : "output",
192 q->nr);
200 debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, 193 debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,
201 debugfs_root, q, &debugfs_fops); 194 debugfs_root, q, &debugfs_fops);
202} 195}
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index a50682d2a0fa..7c8659151993 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -1083,7 +1083,6 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
1083 case -EIO: 1083 case -EIO:
1084 sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no); 1084 sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no);
1085 QDIO_DBF_TEXT2(1, setup, dbf_text); 1085 QDIO_DBF_TEXT2(1, setup, dbf_text);
1086 qdio_int_error(cdev);
1087 return; 1086 return;
1088 case -ETIMEDOUT: 1087 case -ETIMEDOUT:
1089 sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no); 1088 sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 7de410d5be4a..52d26592c72c 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3025,7 +3025,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3025 struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill, 3025 struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill,
3026 int offset) 3026 int offset)
3027{ 3027{
3028 int length = skb->len - offset; 3028 int length = skb->len;
3029 int length_here; 3029 int length_here;
3030 int element; 3030 int element;
3031 char *data; 3031 char *data;
@@ -3037,6 +3037,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3037 3037
3038 if (offset >= 0) { 3038 if (offset >= 0) {
3039 data = skb->data + offset; 3039 data = skb->data + offset;
3040 length -= offset;
3040 first_lap = 0; 3041 first_lap = 0;
3041 } 3042 }
3042 3043
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 955ba7a31b90..1b1e80336d2c 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -373,8 +373,6 @@ static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode)
373 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 373 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
374 374
375 qeth_set_allowed_threads(card, 0, 1); 375 qeth_set_allowed_threads(card, 0, 1);
376 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD))
377 return -ERESTARTSYS;
378 if (card->read.state == CH_STATE_UP && 376 if (card->read.state == CH_STATE_UP &&
379 card->write.state == CH_STATE_UP && 377 card->write.state == CH_STATE_UP &&
380 (card->state == CARD_STATE_UP)) { 378 (card->state == CARD_STATE_UP)) {
@@ -451,12 +449,15 @@ static void qeth_l2_process_inbound_buffer(struct qeth_card *card,
451 netif_rx(skb); 449 netif_rx(skb);
452 break; 450 break;
453 case QETH_HEADER_TYPE_OSN: 451 case QETH_HEADER_TYPE_OSN:
454 skb_push(skb, sizeof(struct qeth_hdr)); 452 if (card->info.type == QETH_CARD_TYPE_OSN) {
455 skb_copy_to_linear_data(skb, hdr, 453 skb_push(skb, sizeof(struct qeth_hdr));
454 skb_copy_to_linear_data(skb, hdr,
456 sizeof(struct qeth_hdr)); 455 sizeof(struct qeth_hdr));
457 len = skb->len; 456 len = skb->len;
458 card->osn_info.data_cb(skb); 457 card->osn_info.data_cb(skb);
459 break; 458 break;
459 }
460 /* else unknown */
460 default: 461 default:
461 dev_kfree_skb_any(skb); 462 dev_kfree_skb_any(skb);
462 QETH_DBF_TEXT(TRACE, 3, "inbunkno"); 463 QETH_DBF_TEXT(TRACE, 3, "inbunkno");
@@ -975,12 +976,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
975 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 976 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
976 977
977 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); 978 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1);
978 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD)) {
979 PRINT_WARN("set_online of card %s interrupted by user!\n",
980 CARD_BUS_ID(card));
981 return -ERESTARTSYS;
982 }
983
984 recover_flag = card->state; 979 recover_flag = card->state;
985 rc = ccw_device_set_online(CARD_RDEV(card)); 980 rc = ccw_device_set_online(CARD_RDEV(card));
986 if (rc) { 981 if (rc) {
@@ -1091,11 +1086,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev,
1091 if (card->dev && netif_carrier_ok(card->dev)) 1086 if (card->dev && netif_carrier_ok(card->dev))
1092 netif_carrier_off(card->dev); 1087 netif_carrier_off(card->dev);
1093 recover_flag = card->state; 1088 recover_flag = card->state;
1094 if (qeth_l2_stop_card(card, recovery_mode) == -ERESTARTSYS) { 1089 qeth_l2_stop_card(card, recovery_mode);
1095 PRINT_WARN("Stopping card %s interrupted by user!\n",
1096 CARD_BUS_ID(card));
1097 return -ERESTARTSYS;
1098 }
1099 rc = ccw_device_set_offline(CARD_DDEV(card)); 1090 rc = ccw_device_set_offline(CARD_DDEV(card));
1100 rc2 = ccw_device_set_offline(CARD_WDEV(card)); 1091 rc2 = ccw_device_set_offline(CARD_WDEV(card));
1101 rc3 = ccw_device_set_offline(CARD_RDEV(card)); 1092 rc3 = ccw_device_set_offline(CARD_RDEV(card));
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 99547dea44de..ed59fedd5922 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2064,8 +2064,6 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode)
2064 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 2064 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
2065 2065
2066 qeth_set_allowed_threads(card, 0, 1); 2066 qeth_set_allowed_threads(card, 0, 1);
2067 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD))
2068 return -ERESTARTSYS;
2069 if (card->read.state == CH_STATE_UP && 2067 if (card->read.state == CH_STATE_UP &&
2070 card->write.state == CH_STATE_UP && 2068 card->write.state == CH_STATE_UP &&
2071 (card->state == CARD_STATE_UP)) { 2069 (card->state == CARD_STATE_UP)) {
@@ -3049,11 +3047,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
3049 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); 3047 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
3050 3048
3051 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); 3049 qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1);
3052 if (qeth_wait_for_threads(card, ~QETH_RECOVER_THREAD)) {
3053 PRINT_WARN("set_online of card %s interrupted by user!\n",
3054 CARD_BUS_ID(card));
3055 return -ERESTARTSYS;
3056 }
3057 3050
3058 recover_flag = card->state; 3051 recover_flag = card->state;
3059 rc = ccw_device_set_online(CARD_RDEV(card)); 3052 rc = ccw_device_set_online(CARD_RDEV(card));
@@ -3170,11 +3163,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev,
3170 if (card->dev && netif_carrier_ok(card->dev)) 3163 if (card->dev && netif_carrier_ok(card->dev))
3171 netif_carrier_off(card->dev); 3164 netif_carrier_off(card->dev);
3172 recover_flag = card->state; 3165 recover_flag = card->state;
3173 if (qeth_l3_stop_card(card, recovery_mode) == -ERESTARTSYS) { 3166 qeth_l3_stop_card(card, recovery_mode);
3174 PRINT_WARN("Stopping card %s interrupted by user!\n",
3175 CARD_BUS_ID(card));
3176 return -ERESTARTSYS;
3177 }
3178 rc = ccw_device_set_offline(CARD_DDEV(card)); 3167 rc = ccw_device_set_offline(CARD_DDEV(card));
3179 rc2 = ccw_device_set_offline(CARD_WDEV(card)); 3168 rc2 = ccw_device_set_offline(CARD_WDEV(card));
3180 rc3 = ccw_device_set_offline(CARD_RDEV(card)); 3169 rc3 = ccw_device_set_offline(CARD_RDEV(card));
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index 210ddb639748..c144b9924d52 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -121,9 +121,6 @@ static ssize_t qeth_l3_dev_route6_show(struct device *dev,
121 if (!card) 121 if (!card)
122 return -EINVAL; 122 return -EINVAL;
123 123
124 if (!qeth_is_supported(card, IPA_IPV6))
125 return sprintf(buf, "%s\n", "n/a");
126
127 return qeth_l3_dev_route_show(card, &card->options.route6, buf); 124 return qeth_l3_dev_route_show(card, &card->options.route6, buf);
128} 125}
129 126
@@ -135,10 +132,6 @@ static ssize_t qeth_l3_dev_route6_store(struct device *dev,
135 if (!card) 132 if (!card)
136 return -EINVAL; 133 return -EINVAL;
137 134
138 if (!qeth_is_supported(card, IPA_IPV6)) {
139 return -EOPNOTSUPP;
140 }
141
142 return qeth_l3_dev_route_store(card, &card->options.route6, 135 return qeth_l3_dev_route_store(card, &card->options.route6,
143 QETH_PROT_IPV6, buf, count); 136 QETH_PROT_IPV6, buf, count);
144} 137}
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index c33bcb284df7..56f4e6bffc21 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -290,9 +290,11 @@
290#include <scsi/scsi_ioctl.h> 290#include <scsi/scsi_ioctl.h>
291#include "fdomain.h" 291#include "fdomain.h"
292 292
293#ifndef PCMCIA
293MODULE_AUTHOR("Rickard E. Faith"); 294MODULE_AUTHOR("Rickard E. Faith");
294MODULE_DESCRIPTION("Future domain SCSI driver"); 295MODULE_DESCRIPTION("Future domain SCSI driver");
295MODULE_LICENSE("GPL"); 296MODULE_LICENSE("GPL");
297#endif
296 298
297 299
298#define VERSION "$Revision: 5.51 $" 300#define VERSION "$Revision: 5.51 $"
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index c94d3c4b7521..579d63a81aa2 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1276,7 +1276,7 @@ config SERIAL_SGI_IOC3
1276 say Y or M. Otherwise, say N. 1276 say Y or M. Otherwise, say N.
1277 1277
1278config SERIAL_NETX 1278config SERIAL_NETX
1279 bool "NetX serial port support" 1279 tristate "NetX serial port support"
1280 depends on ARM && ARCH_NETX 1280 depends on ARM && ARCH_NETX
1281 select SERIAL_CORE 1281 select SERIAL_CORE
1282 help 1282 help
@@ -1288,7 +1288,7 @@ config SERIAL_NETX
1288 1288
1289config SERIAL_NETX_CONSOLE 1289config SERIAL_NETX_CONSOLE
1290 bool "Console on NetX serial port" 1290 bool "Console on NetX serial port"
1291 depends on SERIAL_NETX 1291 depends on SERIAL_NETX=y
1292 select SERIAL_CORE_CONSOLE 1292 select SERIAL_CORE_CONSOLE
1293 help 1293 help
1294 If you have enabled the serial port on the Hilscher NetX SoC 1294 If you have enabled the serial port on the Hilscher NetX SoC
diff --git a/drivers/serial/netx-serial.c b/drivers/serial/netx-serial.c
index 3f489329e8d3..3e5dda8518b7 100644
--- a/drivers/serial/netx-serial.c
+++ b/drivers/serial/netx-serial.c
@@ -42,8 +42,6 @@
42#define SERIAL_NX_MAJOR 204 42#define SERIAL_NX_MAJOR 204
43#define MINOR_START 170 43#define MINOR_START 170
44 44
45#ifdef CONFIG_SERIAL_NETX_CONSOLE
46
47enum uart_regs { 45enum uart_regs {
48 UART_DR = 0x00, 46 UART_DR = 0x00,
49 UART_SR = 0x04, 47 UART_SR = 0x04,
@@ -528,6 +526,8 @@ static struct netx_port netx_ports[] = {
528 } 526 }
529}; 527};
530 528
529#ifdef CONFIG_SERIAL_NETX_CONSOLE
530
531static void netx_console_putchar(struct uart_port *port, int ch) 531static void netx_console_putchar(struct uart_port *port, int ch)
532{ 532{
533 while (readl(port->membase + UART_FR) & FR_BUSY); 533 while (readl(port->membase + UART_FR) & FR_BUSY);
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 543811f6e6e8..8e74657f106c 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -133,7 +133,7 @@ static int usbtmc_release(struct inode *inode, struct file *file)
133 133
134static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data) 134static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data)
135{ 135{
136 char *buffer; 136 u8 *buffer;
137 struct device *dev; 137 struct device *dev;
138 int rv; 138 int rv;
139 int n; 139 int n;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fc9018e72a09..e1b42626d04d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -106,6 +106,9 @@ static DEFINE_SPINLOCK(hcd_root_hub_lock);
106/* used when updating an endpoint's URB list */ 106/* used when updating an endpoint's URB list */
107static DEFINE_SPINLOCK(hcd_urb_list_lock); 107static DEFINE_SPINLOCK(hcd_urb_list_lock);
108 108
109/* used to protect against unlinking URBs after the device is gone */
110static DEFINE_SPINLOCK(hcd_urb_unlink_lock);
111
109/* wait queue for synchronous unlinks */ 112/* wait queue for synchronous unlinks */
110DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue); 113DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue);
111 114
@@ -1376,10 +1379,25 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)
1376int usb_hcd_unlink_urb (struct urb *urb, int status) 1379int usb_hcd_unlink_urb (struct urb *urb, int status)
1377{ 1380{
1378 struct usb_hcd *hcd; 1381 struct usb_hcd *hcd;
1379 int retval; 1382 int retval = -EIDRM;
1383 unsigned long flags;
1380 1384
1381 hcd = bus_to_hcd(urb->dev->bus); 1385 /* Prevent the device and bus from going away while
1382 retval = unlink1(hcd, urb, status); 1386 * the unlink is carried out. If they are already gone
1387 * then urb->use_count must be 0, since disconnected
1388 * devices can't have any active URBs.
1389 */
1390 spin_lock_irqsave(&hcd_urb_unlink_lock, flags);
1391 if (atomic_read(&urb->use_count) > 0) {
1392 retval = 0;
1393 usb_get_dev(urb->dev);
1394 }
1395 spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags);
1396 if (retval == 0) {
1397 hcd = bus_to_hcd(urb->dev->bus);
1398 retval = unlink1(hcd, urb, status);
1399 usb_put_dev(urb->dev);
1400 }
1383 1401
1384 if (retval == 0) 1402 if (retval == 0)
1385 retval = -EINPROGRESS; 1403 retval = -EINPROGRESS;
@@ -1528,6 +1546,17 @@ void usb_hcd_disable_endpoint(struct usb_device *udev,
1528 hcd->driver->endpoint_disable(hcd, ep); 1546 hcd->driver->endpoint_disable(hcd, ep);
1529} 1547}
1530 1548
1549/* Protect against drivers that try to unlink URBs after the device
1550 * is gone, by waiting until all unlinks for @udev are finished.
1551 * Since we don't currently track URBs by device, simply wait until
1552 * nothing is running in the locked region of usb_hcd_unlink_urb().
1553 */
1554void usb_hcd_synchronize_unlinks(struct usb_device *udev)
1555{
1556 spin_lock_irq(&hcd_urb_unlink_lock);
1557 spin_unlock_irq(&hcd_urb_unlink_lock);
1558}
1559
1531/*-------------------------------------------------------------------------*/ 1560/*-------------------------------------------------------------------------*/
1532 1561
1533/* called in any context */ 1562/* called in any context */
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 2dcde61c465e..9465e70f4dd0 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -232,6 +232,7 @@ extern void usb_hcd_flush_endpoint(struct usb_device *udev,
232 struct usb_host_endpoint *ep); 232 struct usb_host_endpoint *ep);
233extern void usb_hcd_disable_endpoint(struct usb_device *udev, 233extern void usb_hcd_disable_endpoint(struct usb_device *udev,
234 struct usb_host_endpoint *ep); 234 struct usb_host_endpoint *ep);
235extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
235extern int usb_hcd_get_frame_number(struct usb_device *udev); 236extern int usb_hcd_get_frame_number(struct usb_device *udev);
236 237
237extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, 238extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 9b3f16bd12cb..b19cbfcd51da 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -659,6 +659,9 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
659 PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2); 659 PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2);
660 schedule_delayed_work(&hub->init_work, 660 schedule_delayed_work(&hub->init_work,
661 msecs_to_jiffies(delay)); 661 msecs_to_jiffies(delay));
662
663 /* Suppress autosuspend until init is done */
664 to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
662 return; /* Continues at init2: below */ 665 return; /* Continues at init2: below */
663 } else { 666 } else {
664 hub_power_on(hub, true); 667 hub_power_on(hub, true);
@@ -1429,6 +1432,7 @@ void usb_disconnect(struct usb_device **pdev)
1429 */ 1432 */
1430 dev_dbg (&udev->dev, "unregistering device\n"); 1433 dev_dbg (&udev->dev, "unregistering device\n");
1431 usb_disable_device(udev, 0); 1434 usb_disable_device(udev, 0);
1435 usb_hcd_synchronize_unlinks(udev);
1432 1436
1433 usb_unlock_device(udev); 1437 usb_unlock_device(udev);
1434 1438
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index f2638009a464..4342bd9c3bb6 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -474,6 +474,12 @@ EXPORT_SYMBOL_GPL(usb_submit_urb);
474 * indicating that the request has been canceled (rather than any other 474 * indicating that the request has been canceled (rather than any other
475 * code). 475 * code).
476 * 476 *
477 * Drivers should not call this routine or related routines, such as
478 * usb_kill_urb() or usb_unlink_anchored_urbs(), after their disconnect
479 * method has returned. The disconnect function should synchronize with
480 * a driver's I/O routines to insure that all URB-related activity has
481 * completed before it returns.
482 *
477 * This request is always asynchronous. Success is indicated by 483 * This request is always asynchronous. Success is indicated by
478 * returning -EINPROGRESS, at which time the URB will probably not yet 484 * returning -EINPROGRESS, at which time the URB will probably not yet
479 * have been given back to the device driver. When it is eventually 485 * have been given back to the device driver. When it is eventually
@@ -550,6 +556,9 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb);
550 * This routine may not be used in an interrupt context (such as a bottom 556 * This routine may not be used in an interrupt context (such as a bottom
551 * half or a completion handler), or when holding a spinlock, or in other 557 * half or a completion handler), or when holding a spinlock, or in other
552 * situations where the caller can't schedule(). 558 * situations where the caller can't schedule().
559 *
560 * This routine should not be called by a driver after its disconnect
561 * method has returned.
553 */ 562 */
554void usb_kill_urb(struct urb *urb) 563void usb_kill_urb(struct urb *urb)
555{ 564{
@@ -588,6 +597,9 @@ EXPORT_SYMBOL_GPL(usb_kill_urb);
588 * This routine may not be used in an interrupt context (such as a bottom 597 * This routine may not be used in an interrupt context (such as a bottom
589 * half or a completion handler), or when holding a spinlock, or in other 598 * half or a completion handler), or when holding a spinlock, or in other
590 * situations where the caller can't schedule(). 599 * situations where the caller can't schedule().
600 *
601 * This routine should not be called by a driver after its disconnect
602 * method has returned.
591 */ 603 */
592void usb_poison_urb(struct urb *urb) 604void usb_poison_urb(struct urb *urb)
593{ 605{
@@ -622,6 +634,9 @@ EXPORT_SYMBOL_GPL(usb_unpoison_urb);
622 * 634 *
623 * this allows all outstanding URBs to be killed starting 635 * this allows all outstanding URBs to be killed starting
624 * from the back of the queue 636 * from the back of the queue
637 *
638 * This routine should not be called by a driver after its disconnect
639 * method has returned.
625 */ 640 */
626void usb_kill_anchored_urbs(struct usb_anchor *anchor) 641void usb_kill_anchored_urbs(struct usb_anchor *anchor)
627{ 642{
@@ -651,6 +666,9 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);
651 * this allows all outstanding URBs to be poisoned starting 666 * this allows all outstanding URBs to be poisoned starting
652 * from the back of the queue. Newly added URBs will also be 667 * from the back of the queue. Newly added URBs will also be
653 * poisoned 668 * poisoned
669 *
670 * This routine should not be called by a driver after its disconnect
671 * method has returned.
654 */ 672 */
655void usb_poison_anchored_urbs(struct usb_anchor *anchor) 673void usb_poison_anchored_urbs(struct usb_anchor *anchor)
656{ 674{
@@ -672,6 +690,7 @@ void usb_poison_anchored_urbs(struct usb_anchor *anchor)
672 spin_unlock_irq(&anchor->lock); 690 spin_unlock_irq(&anchor->lock);
673} 691}
674EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); 692EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
693
675/** 694/**
676 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse 695 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
677 * @anchor: anchor the requests are bound to 696 * @anchor: anchor the requests are bound to
@@ -680,6 +699,9 @@ EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
680 * from the back of the queue. This function is asynchronous. 699 * from the back of the queue. This function is asynchronous.
681 * The unlinking is just tiggered. It may happen after this 700 * The unlinking is just tiggered. It may happen after this
682 * function has returned. 701 * function has returned.
702 *
703 * This routine should not be called by a driver after its disconnect
704 * method has returned.
683 */ 705 */
684void usb_unlink_anchored_urbs(struct usb_anchor *anchor) 706void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
685{ 707{
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 8be3f39891c7..794b5ffe4397 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -281,6 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
281 if (tty->driver_data) 281 if (tty->driver_data)
282 tty->driver_data = NULL; 282 tty->driver_data = NULL;
283 tty_port_tty_set(&port->port, NULL); 283 tty_port_tty_set(&port->port, NULL);
284 tty_kref_put(tty);
284 } 285 }
285 } 286 }
286 287
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index a2b9ebbef38e..fb9e20e624c1 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -333,6 +333,13 @@ UNUSUAL_DEV( 0x0482, 0x0103, 0x0100, 0x0100,
333 "Finecam S5", 333 "Finecam S5",
334 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), 334 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY),
335 335
336/* Patch submitted by Jens Taprogge <jens.taprogge@taprogge.org> */
337UNUSUAL_DEV( 0x0482, 0x0107, 0x0100, 0x0100,
338 "Kyocera",
339 "CONTAX SL300R T*",
340 US_SC_DEVICE, US_PR_DEVICE, NULL,
341 US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE),
342
336/* Reported by Paul Stewart <stewart@wetlogic.net> 343/* Reported by Paul Stewart <stewart@wetlogic.net>
337 * This entry is needed because the device reports Sub=ff */ 344 * This entry is needed because the device reports Sub=ff */
338UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, 345UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 2afd47eefe74..f8a4bb20f41a 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -439,7 +439,7 @@ static int corgi_bl_update_status(struct backlight_device *bd)
439 return corgi_bl_set_intensity(lcd, intensity); 439 return corgi_bl_set_intensity(lcd, intensity);
440} 440}
441 441
442void corgibl_limit_intensity(int limit) 442void corgi_lcd_limit_intensity(int limit)
443{ 443{
444 if (limit) 444 if (limit)
445 corgibl_flags |= CORGIBL_BATTLOW; 445 corgibl_flags |= CORGIBL_BATTLOW;
@@ -448,7 +448,7 @@ void corgibl_limit_intensity(int limit)
448 448
449 backlight_update_status(the_corgi_lcd->bl_dev); 449 backlight_update_status(the_corgi_lcd->bl_dev);
450} 450}
451EXPORT_SYMBOL(corgibl_limit_intensity); 451EXPORT_SYMBOL(corgi_lcd_limit_intensity);
452 452
453static struct backlight_ops corgi_bl_ops = { 453static struct backlight_ops corgi_bl_ops = {
454 .get_brightness = corgi_bl_get_intensity, 454 .get_brightness = corgi_bl_get_intensity,
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 64b3d30027b8..b92947d62ad6 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2118,7 +2118,7 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s
2118 height, width); 2118 height, width);
2119} 2119}
2120 2120
2121static __inline__ void updatescrollmode(struct display *p, 2121static void updatescrollmode(struct display *p,
2122 struct fb_info *info, 2122 struct fb_info *info,
2123 struct vc_data *vc) 2123 struct vc_data *vc)
2124{ 2124{
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index cd5f20da738a..6048b55f2878 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1262,8 +1262,8 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1262 case FBIOPUT_CON2FBMAP: 1262 case FBIOPUT_CON2FBMAP:
1263 arg = (unsigned long) compat_ptr(arg); 1263 arg = (unsigned long) compat_ptr(arg);
1264 case FBIOBLANK: 1264 case FBIOBLANK:
1265 ret = fb_ioctl(file, cmd, arg); 1265 mutex_unlock(&info->lock);
1266 break; 1266 return fb_ioctl(file, cmd, arg);
1267 1267
1268 case FBIOGET_FSCREENINFO: 1268 case FBIOGET_FSCREENINFO:
1269 ret = fb_get_fscreeninfo(inode, file, cmd, arg); 1269 ret = fb_get_fscreeninfo(inode, file, cmd, arg);
diff --git a/drivers/video/via/global.h b/drivers/video/via/global.h
index 8e5263c5b812..7543d5f7e309 100644
--- a/drivers/video/via/global.h
+++ b/drivers/video/via/global.h
@@ -38,7 +38,6 @@
38#include "iface.h" 38#include "iface.h"
39#include "viafbdev.h" 39#include "viafbdev.h"
40#include "chip.h" 40#include "chip.h"
41#include "debug.h"
42#include "accel.h" 41#include "accel.h"
43#include "share.h" 42#include "share.h"
44#include "dvi.h" 43#include "dvi.h"
@@ -48,12 +47,10 @@
48 47
49#include "lcd.h" 48#include "lcd.h"
50#include "ioctl.h" 49#include "ioctl.h"
51#include "viamode.h"
52#include "via_utility.h" 50#include "via_utility.h"
53#include "vt1636.h" 51#include "vt1636.h"
54#include "tblDPASetting.h" 52#include "tblDPASetting.h"
55#include "tbl1636.h" 53#include "tbl1636.h"
56#include "viafbdev.h"
57 54
58/* External struct*/ 55/* External struct*/
59 56
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
index 6e46a551395c..3e57aa4d643a 100644
--- a/drivers/watchdog/acquirewdt.c
+++ b/drivers/watchdog/acquirewdt.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Based on wdt.c. Original copyright messages: 4 * Based on wdt.c. Original copyright messages:
5 * 5 *
6 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 6 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
7 * http://www.redhat.com 7 * All Rights Reserved.
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
@@ -15,7 +15,7 @@
15 * warranty for any of this software. This material is provided 15 * warranty for any of this software. This material is provided
16 * "AS-IS" and at no charge. 16 * "AS-IS" and at no charge.
17 * 17 *
18 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 18 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
19 * 19 *
20 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 20 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
21 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 21 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
index a5110f93a755..a1d7856ea6e0 100644
--- a/drivers/watchdog/advantechwdt.c
+++ b/drivers/watchdog/advantechwdt.c
@@ -6,8 +6,8 @@
6 * Based on acquirewdt.c which is based on wdt.c. 6 * Based on acquirewdt.c which is based on wdt.c.
7 * Original copyright messages: 7 * Original copyright messages:
8 * 8 *
9 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 9 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
10 * http://www.redhat.com 10 * All Rights Reserved.
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -18,7 +18,7 @@
18 * warranty for any of this software. This material is provided 18 * warranty for any of this software. This material is provided
19 * "AS-IS" and at no charge. 19 * "AS-IS" and at no charge.
20 * 20 *
21 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 21 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
22 * 22 *
23 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 23 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
24 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 24 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 31b42253054e..067a57cb3f82 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -5,7 +5,7 @@
5 * Originally based on softdog.c 5 * Originally based on softdog.c
6 * Copyright 2006-2007 Analog Devices Inc. 6 * Copyright 2006-2007 Analog Devices Inc.
7 * Copyright 2006-2007 Michele d'Amico 7 * Copyright 2006-2007 Michele d'Amico
8 * Copyright 1996 Alan Cox <alan@redhat.com> 8 * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
9 * 9 *
10 * Enter bugs at http://blackfin.uclinux.org/ 10 * Enter bugs at http://blackfin.uclinux.org/
11 * 11 *
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c
index bbd14e34319f..a171fc6ae1cb 100644
--- a/drivers/watchdog/eurotechwdt.c
+++ b/drivers/watchdog/eurotechwdt.c
@@ -8,8 +8,8 @@
8 * Based on wdt.c. 8 * Based on wdt.c.
9 * Original copyright messages: 9 * Original copyright messages:
10 * 10 *
11 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 11 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
12 * http://www.redhat.com 12 * All Rights Reserved.
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index c13383f7fcb9..74f951c18b90 100644
--- a/drivers/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -394,8 +394,7 @@ static unsigned char __init esb_getdevice(void)
394 goto err_disable; 394 goto err_disable;
395 } 395 }
396 396
397 BASEADDR = ioremap(pci_resource_start(esb_pci, 0), 397 BASEADDR = pci_ioremap_bar(esb_pci, 0);
398 pci_resource_len(esb_pci, 0));
399 if (BASEADDR == NULL) { 398 if (BASEADDR == NULL) {
400 /* Something's wrong here, BASEADDR has to be set */ 399 /* Something's wrong here, BASEADDR has to be set */
401 printk(KERN_ERR PFX "failed to get BASEADDR\n"); 400 printk(KERN_ERR PFX "failed to get BASEADDR\n");
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index 8782ec1f5aa0..317ef2b16cff 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -11,8 +11,8 @@
11 * Based on acquirewdt.c which is based on wdt.c. 11 * Based on acquirewdt.c which is based on wdt.c.
12 * Original copyright messages: 12 * Original copyright messages:
13 * 13 *
14 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 14 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
15 * http://www.redhat.com 15 * All Rights Reserved.
16 * 16 *
17 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License 18 * modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
23 * warranty for any of this software. This material is provided 23 * warranty for any of this software. This material is provided
24 * "AS-IS" and at no charge. 24 * "AS-IS" and at no charge.
25 * 25 *
26 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 26 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
27 * 27 *
28 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 28 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
29 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 29 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c
index 73c9e7992feb..0f761db9a27c 100644
--- a/drivers/watchdog/indydog.c
+++ b/drivers/watchdog/indydog.c
@@ -9,7 +9,7 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * based on softdog.c by Alan Cox <alan@redhat.com> 12 * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk>
13 */ 13 */
14 14
15#include <linux/module.h> 15#include <linux/module.h>
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 2a9bfa81f9d6..1130ad697ce2 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -4,8 +4,8 @@
4 * (c) Copyright 2004 ARM Limited 4 * (c) Copyright 2004 ARM Limited
5 * 5 *
6 * Based on the SoftDog driver: 6 * Based on the SoftDog driver:
7 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 7 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
8 * http://www.redhat.com 8 * All Rights Reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 7bcbb7f4745f..2f2ce7429f5b 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -16,7 +16,7 @@
16 * 20030527: George G. Davis <gdavis@mvista.com> 16 * 20030527: George G. Davis <gdavis@mvista.com>
17 * Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c 17 * Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c
18 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu> 18 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
19 * Based on SoftDog driver by Alan Cox <alan@redhat.com> 19 * Based on SoftDog driver by Alan Cox <alan@lxorguk.ukuu.org.uk>
20 * 20 *
21 * Copyright (c) 2004 Texas Instruments. 21 * Copyright (c) 2004 Texas Instruments.
22 * 1. Modified to support OMAP1610 32-KHz watchdog timer 22 * 1. Modified to support OMAP1610 32-KHz watchdog timer
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
index 90eb1d4271d7..5d76422c402c 100644
--- a/drivers/watchdog/pcwd_pci.c
+++ b/drivers/watchdog/pcwd_pci.c
@@ -6,7 +6,7 @@
6 * Based on source code of the following authors: 6 * Based on source code of the following authors:
7 * Ken Hollis <kenji@bitgate.com>, 7 * Ken Hollis <kenji@bitgate.com>,
8 * Lindsay Harris <lindsay@bluegum.com>, 8 * Lindsay Harris <lindsay@bluegum.com>,
9 * Alan Cox <alan@redhat.com>, 9 * Alan Cox <alan@lxorguk.ukuu.org.uk>,
10 * Matt Domsch <Matt_Domsch@dell.com>, 10 * Matt Domsch <Matt_Domsch@dell.com>,
11 * Rob Radez <rob@osinvestor.com> 11 * Rob Radez <rob@osinvestor.com>
12 * 12 *
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index c1685c942de6..afb089695da8 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Based on source code of the following authors: 6 * Based on source code of the following authors:
7 * Ken Hollis <kenji@bitgate.com>, 7 * Ken Hollis <kenji@bitgate.com>,
8 * Alan Cox <alan@redhat.com>, 8 * Alan Cox <alan@lxorguk.ukuu.org.uk>,
9 * Matt Domsch <Matt_Domsch@dell.com>, 9 * Matt Domsch <Matt_Domsch@dell.com>,
10 * Rob Radez <rob@osinvestor.com>, 10 * Rob Radez <rob@osinvestor.com>,
11 * Greg Kroah-Hartman <greg@kroah.com> 11 * Greg Kroah-Hartman <greg@kroah.com>
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index c9c73b69c5e5..57027f4653ce 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -7,7 +7,8 @@
7 * based on 7 * based on
8 * SoftDog 0.05: A Software Watchdog Device 8 * SoftDog 0.05: A Software Watchdog Device
9 * 9 *
10 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 10 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
11 * All Rights Reserved.
11 * 12 *
12 * This program is free software; you can redistribute it and/or 13 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 14 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 86d42801de45..f7f6ce82a5e2 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -6,7 +6,7 @@
6 * S3C2410 Watchdog Timer Support 6 * S3C2410 Watchdog Timer Support
7 * 7 *
8 * Based on, softdog.c by Alan Cox, 8 * Based on, softdog.c by Alan Cox,
9 * (c) Copyright 1996 Alan Cox <alan@redhat.com> 9 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index 31a48437dc3d..ed01e4c2beff 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -2,7 +2,7 @@
2 * Watchdog driver for the SA11x0/PXA2xx 2 * Watchdog driver for the SA11x0/PXA2xx
3 * 3 *
4 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu> 4 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
5 * Based on SoftDog driver by Alan Cox <alan@redhat.com> 5 * Based on SoftDog driver by Alan Cox <alan@lxorguk.ukuu.org.uk>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 27e526a07c9a..38f5831c9291 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -35,8 +35,8 @@
35 * Based on various other watchdog drivers, which are probably all 35 * Based on various other watchdog drivers, which are probably all
36 * loosely based on something Alan Cox wrote years ago. 36 * loosely based on something Alan Cox wrote years ago.
37 * 37 *
38 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 38 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
39 * http://www.redhat.com 39 * All Rights Reserved.
40 * 40 *
41 * This program is free software; you can redistribute it and/or 41 * This program is free software; you can redistribute it and/or
42 * modify it under the terms of the GNU General Public License 42 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c
index fd83dd052d8c..ae74f6bcfa23 100644
--- a/drivers/watchdog/sbc8360.c
+++ b/drivers/watchdog/sbc8360.c
@@ -16,8 +16,8 @@
16 * Based on acquirewdt.c which is based on wdt.c. 16 * Based on acquirewdt.c which is based on wdt.c.
17 * Original copyright messages: 17 * Original copyright messages:
18 * 18 *
19 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 19 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
20 * http://www.redhat.com 20 * All Rights Reserved.
21 * 21 *
22 * This program is free software; you can redistribute it and/or 22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License 23 * modify it under the terms of the GNU General Public License
@@ -28,7 +28,7 @@
28 * warranty for any of this software. This material is provided 28 * warranty for any of this software. This material is provided
29 * "AS-IS" and at no charge. 29 * "AS-IS" and at no charge.
30 * 30 *
31 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 31 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
32 * 32 *
33 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> 33 * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
34 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT 34 * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
diff --git a/drivers/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c
index e5e470ca7759..06553debc7bc 100644
--- a/drivers/watchdog/sbc_epx_c3.c
+++ b/drivers/watchdog/sbc_epx_c3.c
@@ -10,7 +10,7 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 * 12 *
13 * based on softdog.c by Alan Cox <alan@redhat.com> 13 * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk>
14 */ 14 */
15 15
16#include <linux/module.h> 16#include <linux/module.h>
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index 988ff1d5b4be..2e56cad77d19 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SMsC 37B787 Watchdog Timer driver for Linux 2.6.x.x 2 * SMsC 37B787 Watchdog Timer driver for Linux 2.6.x.x
3 * 3 *
4 * Based on acquirewdt.c by Alan Cox <alan@redhat.com> 4 * Based on acquirewdt.c by Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * and some other existing drivers 5 * and some other existing drivers
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index c650464c5c63..7204f9662114 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * SoftDog 0.07: A Software Watchdog Device 2 * SoftDog 0.07: A Software Watchdog Device
3 * 3 *
4 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 4 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>, All Rights Reserved.
5 * http://www.redhat.com
6 * 5 *
7 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index 69396adaa5c3..916890abffdd 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -11,8 +11,8 @@
11 * 11 *
12 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> 12 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl>
13 * 13 *
14 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 14 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
15 * http://www.redhat.com 15 * All Rights Reserved.
16 * 16 *
17 * This program is free software; you can redistribute it and/or 17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License 18 * modify it under the terms of the GNU General Public License
@@ -23,7 +23,7 @@
23 * warranty for any of this software. This material is provided 23 * warranty for any of this software. This material is provided
24 * "AS-IS" and at no charge. 24 * "AS-IS" and at no charge.
25 * 25 *
26 * (c) Copyright 1995 Alan Cox <alan@redhat.com> 26 * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 445d30a01ed3..3c7aa412b1f3 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -12,8 +12,8 @@
12 * 12 *
13 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> 13 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl>
14 * 14 *
15 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 15 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
16 * http://www.redhat.com 16 * All Rights Reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License 19 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c
index 68377ae171ff..42e940c23891 100644
--- a/drivers/watchdog/wafer5823wdt.c
+++ b/drivers/watchdog/wafer5823wdt.c
@@ -10,8 +10,8 @@
10 * Based on advantechwdt.c which is based on wdt.c. 10 * Based on advantechwdt.c which is based on wdt.c.
11 * Original copyright messages: 11 * Original copyright messages:
12 * 12 *
13 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 13 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
14 * http://www.redhat.com 14 * All Rights Reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License 17 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index deeebb2b13ea..eddb9187e7b6 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Industrial Computer Source WDT500/501 driver 2 * Industrial Computer Source WDT500/501 driver
3 * 3 *
4 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 4 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
5 * http://www.redhat.com 5 * All Rights Reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c
index 191ea6302107..f55135662d78 100644
--- a/drivers/watchdog/wdt285.c
+++ b/drivers/watchdog/wdt285.c
@@ -6,7 +6,8 @@
6 * 6 *
7 * SoftDog 0.05: A Software Watchdog Device 7 * SoftDog 0.05: A Software Watchdog Device
8 * 8 *
9 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. 9 * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
10 * All Rights Reserved.
10 * 11 *
11 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c
index ed02bdb38c09..c45839a4a34d 100644
--- a/drivers/watchdog/wdt_pci.c
+++ b/drivers/watchdog/wdt_pci.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Industrial Computer Source PCI-WDT500/501 driver 2 * Industrial Computer Source PCI-WDT500/501 driver
3 * 3 *
4 * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved. 4 * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
5 * http://www.redhat.com 5 * All Rights Reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 9ce1ab6c268d..1e3b934a4cf7 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -774,7 +774,7 @@ void xen_poll_irq(int irq)
774 774
775 poll.nr_ports = 1; 775 poll.nr_ports = 1;
776 poll.timeout = 0; 776 poll.timeout = 0;
777 poll.ports = &evtchn; 777 set_xen_guest_handle(poll.ports, &evtchn);
778 778
779 if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0) 779 if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0)
780 BUG(); 780 BUG();
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index d0e87cbe157c..9b91617b9582 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -39,8 +39,6 @@ static int xen_suspend(void *data)
39 39
40 BUG_ON(!irqs_disabled()); 40 BUG_ON(!irqs_disabled());
41 41
42 load_cr3(swapper_pg_dir);
43
44 err = device_power_down(PMSG_SUSPEND); 42 err = device_power_down(PMSG_SUSPEND);
45 if (err) { 43 if (err) {
46 printk(KERN_ERR "xen_suspend: device_power_down failed: %d\n", 44 printk(KERN_ERR "xen_suspend: device_power_down failed: %d\n",
diff --git a/drivers/xen/xencomm.c b/drivers/xen/xencomm.c
index 797cb4e31f07..a240b2c20b99 100644
--- a/drivers/xen/xencomm.c
+++ b/drivers/xen/xencomm.c
@@ -23,13 +23,7 @@
23#include <asm/page.h> 23#include <asm/page.h>
24#include <xen/xencomm.h> 24#include <xen/xencomm.h>
25#include <xen/interface/xen.h> 25#include <xen/interface/xen.h>
26#ifdef __ia64__ 26#include <asm/xen/xencomm.h> /* for xencomm_is_phys_contiguous() */
27#include <asm/xen/xencomm.h> /* for is_kern_addr() */
28#endif
29
30#ifdef HAVE_XEN_PLATFORM_COMPAT_H
31#include <xen/platform-compat.h>
32#endif
33 27
34static int xencomm_init(struct xencomm_desc *desc, 28static int xencomm_init(struct xencomm_desc *desc,
35 void *buffer, unsigned long bytes) 29 void *buffer, unsigned long bytes)
@@ -157,20 +151,11 @@ static int xencomm_create(void *buffer, unsigned long bytes,
157 return 0; 151 return 0;
158} 152}
159 153
160/* check if memory address is within VMALLOC region */
161static int is_phys_contiguous(unsigned long addr)
162{
163 if (!is_kernel_addr(addr))
164 return 0;
165
166 return (addr < VMALLOC_START) || (addr >= VMALLOC_END);
167}
168
169static struct xencomm_handle *xencomm_create_inline(void *ptr) 154static struct xencomm_handle *xencomm_create_inline(void *ptr)
170{ 155{
171 unsigned long paddr; 156 unsigned long paddr;
172 157
173 BUG_ON(!is_phys_contiguous((unsigned long)ptr)); 158 BUG_ON(!xencomm_is_phys_contiguous((unsigned long)ptr));
174 159
175 paddr = (unsigned long)xencomm_pa(ptr); 160 paddr = (unsigned long)xencomm_pa(ptr);
176 BUG_ON(paddr & XENCOMM_INLINE_FLAG); 161 BUG_ON(paddr & XENCOMM_INLINE_FLAG);
@@ -202,7 +187,7 @@ struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes)
202 int rc; 187 int rc;
203 struct xencomm_desc *desc; 188 struct xencomm_desc *desc;
204 189
205 if (is_phys_contiguous((unsigned long)ptr)) 190 if (xencomm_is_phys_contiguous((unsigned long)ptr))
206 return xencomm_create_inline(ptr); 191 return xencomm_create_inline(ptr);
207 192
208 rc = xencomm_create(ptr, bytes, &desc, GFP_KERNEL); 193 rc = xencomm_create(ptr, bytes, &desc, GFP_KERNEL);
@@ -219,7 +204,7 @@ struct xencomm_handle *__xencomm_map_no_alloc(void *ptr, unsigned long bytes,
219 int rc; 204 int rc;
220 struct xencomm_desc *desc = NULL; 205 struct xencomm_desc *desc = NULL;
221 206
222 if (is_phys_contiguous((unsigned long)ptr)) 207 if (xencomm_is_phys_contiguous((unsigned long)ptr))
223 return xencomm_create_inline(ptr); 208 return xencomm_create_inline(ptr);
224 209
225 rc = xencomm_create_mini(ptr, bytes, xc_desc, 210 rc = xencomm_create_mini(ptr, bytes, xc_desc,