diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-11-12 06:39:21 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-12 06:39:21 -0500 |
commit | 708b8eae0fd532af73ea8350e6dcc10255ff7376 (patch) | |
tree | f336436934fd79bc91aff7112a9beb10bc4e839f /drivers | |
parent | d98d38f2014ab79f28c126ff175d034891f7aefc (diff) | |
parent | f21f237cf55494c3a4209de323281a3b0528da10 (diff) |
Merge branch 'linus' into core/locking
Diffstat (limited to 'drivers')
384 files changed, 5081 insertions, 4081 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 | ||
69 | source "drivers/mfd/Kconfig" | 69 | source "drivers/mfd/Kconfig" |
70 | 70 | ||
71 | source "drivers/regulator/Kconfig" | ||
72 | |||
71 | source "drivers/media/Kconfig" | 73 | source "drivers/media/Kconfig" |
72 | 74 | ||
73 | source "drivers/video/Kconfig" | 75 | source "drivers/video/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 2503f7b99b2f..fceb71a741c3 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -56,6 +56,7 @@ obj-$(CONFIG_MAC) += macintosh/ | |||
56 | obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/ | 56 | obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/ |
57 | obj-$(CONFIG_PARIDE) += block/paride/ | 57 | obj-$(CONFIG_PARIDE) += block/paride/ |
58 | obj-$(CONFIG_TC) += tc/ | 58 | obj-$(CONFIG_TC) += tc/ |
59 | obj-$(CONFIG_UWB) += uwb/ | ||
59 | obj-$(CONFIG_USB) += usb/ | 60 | obj-$(CONFIG_USB) += usb/ |
60 | obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/ | 61 | obj-$(CONFIG_USB_MUSB_HDRC) += usb/musb/ |
61 | obj-$(CONFIG_PCI) += usb/ | 62 | obj-$(CONFIG_PCI) += usb/ |
@@ -101,4 +102,3 @@ obj-$(CONFIG_SSB) += ssb/ | |||
101 | obj-$(CONFIG_VIRTIO) += virtio/ | 102 | obj-$(CONFIG_VIRTIO) += virtio/ |
102 | obj-$(CONFIG_REGULATOR) += regulator/ | 103 | obj-$(CONFIG_REGULATOR) += regulator/ |
103 | obj-$(CONFIG_STAGING) += staging/ | 104 | obj-$(CONFIG_STAGING) += staging/ |
104 | obj-$(CONFIG_UWB) += uwb/ | ||
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 9d568d417eaa..cb046c3fc3f2 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -262,6 +262,7 @@ static int acpi_lid_send_state(struct acpi_button *button) | |||
262 | return -ENODEV; | 262 | return -ENODEV; |
263 | /* input layer checks if event is redundant */ | 263 | /* input layer checks if event is redundant */ |
264 | input_report_switch(button->input, SW_LID, !state); | 264 | input_report_switch(button->input, SW_LID, !state); |
265 | input_sync(button->input); | ||
265 | return 0; | 266 | return 0; |
266 | } | 267 | } |
267 | 268 | ||
@@ -285,8 +286,8 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) | |||
285 | input_report_key(input, keycode, 1); | 286 | input_report_key(input, keycode, 1); |
286 | input_sync(input); | 287 | input_sync(input); |
287 | input_report_key(input, keycode, 0); | 288 | input_report_key(input, keycode, 0); |
289 | input_sync(input); | ||
288 | } | 290 | } |
289 | input_sync(input); | ||
290 | 291 | ||
291 | acpi_bus_generate_proc_event(button->device, event, | 292 | acpi_bus_generate_proc_event(button->device, event, |
292 | ++button->pushed); | 293 | ++button->pushed); |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index dc98f7a6f2c4..dbcf260ea93f 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -38,7 +38,10 @@ | |||
38 | 38 | ||
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | #endif | 40 | #endif |
41 | |||
42 | #ifdef CONFIG_X86 | ||
41 | #include <asm/cpufeature.h> | 43 | #include <asm/cpufeature.h> |
44 | #endif | ||
42 | 45 | ||
43 | #include <acpi/acpi_bus.h> | 46 | #include <acpi/acpi_bus.h> |
44 | #include <acpi/processor.h> | 47 | #include <acpi/processor.h> |
@@ -360,11 +363,13 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
360 | * the BIOS is older than the CPU and does not know its frequencies | 363 | * the BIOS is older than the CPU and does not know its frequencies |
361 | */ | 364 | */ |
362 | update_bios: | 365 | update_bios: |
366 | #ifdef CONFIG_X86 | ||
363 | if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){ | 367 | if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){ |
364 | if(boot_cpu_has(X86_FEATURE_EST)) | 368 | if(boot_cpu_has(X86_FEATURE_EST)) |
365 | printk(KERN_WARNING FW_BUG "BIOS needs update for CPU " | 369 | printk(KERN_WARNING FW_BUG "BIOS needs update for CPU " |
366 | "frequency support\n"); | 370 | "frequency support\n"); |
367 | } | 371 | } |
372 | #endif | ||
368 | return result; | 373 | return result; |
369 | } | 374 | } |
370 | 375 | ||
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 26571bafb158..80c0868d0480 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -163,6 +163,8 @@ static void acpi_pm_end(void) | |||
163 | acpi_target_sleep_state = ACPI_STATE_S0; | 163 | acpi_target_sleep_state = ACPI_STATE_S0; |
164 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 164 | acpi_sleep_tts_switch(acpi_target_sleep_state); |
165 | } | 165 | } |
166 | #else /* !CONFIG_ACPI_SLEEP */ | ||
167 | #define acpi_target_sleep_state ACPI_STATE_S0 | ||
166 | #endif /* CONFIG_ACPI_SLEEP */ | 168 | #endif /* CONFIG_ACPI_SLEEP */ |
167 | 169 | ||
168 | #ifdef CONFIG_SUSPEND | 170 | #ifdef CONFIG_SUSPEND |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 2a632f8b7a05..66aac06f2ac5 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -371,6 +371,7 @@ static void bt_poll_rfkill(struct input_polled_dev *poll_dev) | |||
371 | RFKILL_STATE_HARD_BLOCKED); | 371 | RFKILL_STATE_HARD_BLOCKED); |
372 | input_report_switch(poll_dev->input, SW_RFKILL_ALL, | 372 | input_report_switch(poll_dev->input, SW_RFKILL_ALL, |
373 | new_rfk_state); | 373 | new_rfk_state); |
374 | input_sync(poll_dev->input); | ||
374 | } | 375 | } |
375 | } | 376 | } |
376 | 377 | ||
@@ -842,6 +843,7 @@ static int __init toshiba_acpi_init(void) | |||
842 | set_bit(EV_SW, toshiba_acpi.poll_dev->input->evbit); | 843 | set_bit(EV_SW, toshiba_acpi.poll_dev->input->evbit); |
843 | set_bit(SW_RFKILL_ALL, toshiba_acpi.poll_dev->input->swbit); | 844 | set_bit(SW_RFKILL_ALL, toshiba_acpi.poll_dev->input->swbit); |
844 | input_report_switch(toshiba_acpi.poll_dev->input, SW_RFKILL_ALL, TRUE); | 845 | input_report_switch(toshiba_acpi.poll_dev->input, SW_RFKILL_ALL, TRUE); |
846 | input_sync(toshiba_acpi.poll_dev->input); | ||
845 | 847 | ||
846 | ret = input_register_polled_device(toshiba_acpi.poll_dev); | 848 | ret = input_register_polled_device(toshiba_acpi.poll_dev); |
847 | if (ret) { | 849 | if (ret) { |
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 | |||
52 | static int ahci_skip_host_reset; | 63 | static int ahci_skip_host_reset; |
53 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | 64 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); |
54 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | 65 | MODULE_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..8e37be19bbf5 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 |
@@ -738,7 +738,6 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
738 | * do_pata_set_dmamode - Initialize host controller PATA PIO timings | 738 | * do_pata_set_dmamode - Initialize host controller PATA PIO timings |
739 | * @ap: Port whose timings we are configuring | 739 | * @ap: Port whose timings we are configuring |
740 | * @adev: Drive in question | 740 | * @adev: Drive in question |
741 | * @udma: udma mode, 0 - 6 | ||
742 | * @isich: set if the chip is an ICH device | 741 | * @isich: set if the chip is an ICH device |
743 | * | 742 | * |
744 | * Set UDMA mode for device, in host controller PCI config space. | 743 | * Set UDMA mode for device, in host controller PCI config space. |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8cb0b360bfd8..4214bfb13bbd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -612,7 +612,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) | |||
612 | if (tf->flags & ATA_TFLAG_LBA48) { | 612 | if (tf->flags & ATA_TFLAG_LBA48) { |
613 | block |= (u64)tf->hob_lbah << 40; | 613 | block |= (u64)tf->hob_lbah << 40; |
614 | block |= (u64)tf->hob_lbam << 32; | 614 | block |= (u64)tf->hob_lbam << 32; |
615 | block |= tf->hob_lbal << 24; | 615 | block |= (u64)tf->hob_lbal << 24; |
616 | } else | 616 | } else |
617 | block |= (tf->device & 0xf) << 24; | 617 | block |= (tf->device & 0xf) << 24; |
618 | 618 | ||
@@ -1268,7 +1268,7 @@ u64 ata_tf_to_lba48(const struct ata_taskfile *tf) | |||
1268 | 1268 | ||
1269 | sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40; | 1269 | sectors |= ((u64)(tf->hob_lbah & 0xff)) << 40; |
1270 | sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32; | 1270 | sectors |= ((u64)(tf->hob_lbam & 0xff)) << 32; |
1271 | sectors |= (tf->hob_lbal & 0xff) << 24; | 1271 | sectors |= ((u64)(tf->hob_lbal & 0xff)) << 24; |
1272 | sectors |= (tf->lbah & 0xff) << 16; | 1272 | sectors |= (tf->lbah & 0xff) << 16; |
1273 | sectors |= (tf->lbam & 0xff) << 8; | 1273 | sectors |= (tf->lbam & 0xff) << 8; |
1274 | sectors |= (tf->lbal & 0xff); | 1274 | sectors |= (tf->lbal & 0xff); |
@@ -1602,7 +1602,6 @@ unsigned long ata_id_xfermask(const u16 *id) | |||
1602 | /** | 1602 | /** |
1603 | * ata_pio_queue_task - Queue port_task | 1603 | * ata_pio_queue_task - Queue port_task |
1604 | * @ap: The ata_port to queue port_task for | 1604 | * @ap: The ata_port to queue port_task for |
1605 | * @fn: workqueue function to be scheduled | ||
1606 | * @data: data for @fn to use | 1605 | * @data: data for @fn to use |
1607 | * @delay: delay time in msecs for workqueue function | 1606 | * @delay: delay time in msecs for workqueue function |
1608 | * | 1607 | * |
@@ -1713,6 +1712,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1713 | else | 1712 | else |
1714 | tag = 0; | 1713 | tag = 0; |
1715 | 1714 | ||
1715 | if (test_and_set_bit(tag, &ap->qc_allocated)) | ||
1716 | BUG(); | ||
1716 | qc = __ata_qc_from_tag(ap, tag); | 1717 | qc = __ata_qc_from_tag(ap, tag); |
1717 | 1718 | ||
1718 | qc->tag = tag; | 1719 | qc->tag = tag; |
@@ -2159,6 +2160,10 @@ retry: | |||
2159 | static inline u8 ata_dev_knobble(struct ata_device *dev) | 2160 | static inline u8 ata_dev_knobble(struct ata_device *dev) |
2160 | { | 2161 | { |
2161 | struct ata_port *ap = dev->link->ap; | 2162 | struct ata_port *ap = dev->link->ap; |
2163 | |||
2164 | if (ata_dev_blacklisted(dev) & ATA_HORKAGE_BRIDGE_OK) | ||
2165 | return 0; | ||
2166 | |||
2162 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); | 2167 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); |
2163 | } | 2168 | } |
2164 | 2169 | ||
@@ -4021,6 +4026,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4021 | 4026 | ||
4022 | /* Weird ATAPI devices */ | 4027 | /* Weird ATAPI devices */ |
4023 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | 4028 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
4029 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, | ||
4024 | 4030 | ||
4025 | /* Devices we expect to fail diagnostics */ | 4031 | /* Devices we expect to fail diagnostics */ |
4026 | 4032 | ||
@@ -4063,6 +4069,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4063 | { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, }, | 4069 | { "TSSTcorp CDDVDW SH-S202N", "SB00", ATA_HORKAGE_IVB, }, |
4064 | { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, }, | 4070 | { "TSSTcorp CDDVDW SH-S202N", "SB01", ATA_HORKAGE_IVB, }, |
4065 | 4071 | ||
4072 | /* Devices that do not need bridging limits applied */ | ||
4073 | { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, | ||
4074 | |||
4066 | /* End Marker */ | 4075 | /* End Marker */ |
4067 | { } | 4076 | { } |
4068 | }; | 4077 | }; |
@@ -4156,29 +4165,33 @@ static int cable_is_40wire(struct ata_port *ap) | |||
4156 | struct ata_link *link; | 4165 | struct ata_link *link; |
4157 | struct ata_device *dev; | 4166 | struct ata_device *dev; |
4158 | 4167 | ||
4159 | /* If the controller thinks we are 40 wire, we are */ | 4168 | /* If the controller thinks we are 40 wire, we are. */ |
4160 | if (ap->cbl == ATA_CBL_PATA40) | 4169 | if (ap->cbl == ATA_CBL_PATA40) |
4161 | return 1; | 4170 | return 1; |
4162 | /* If the controller thinks we are 80 wire, we are */ | 4171 | |
4172 | /* If the controller thinks we are 80 wire, we are. */ | ||
4163 | if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) | 4173 | if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) |
4164 | return 0; | 4174 | return 0; |
4165 | /* If the system is known to be 40 wire short cable (eg laptop), | 4175 | |
4166 | then we allow 80 wire modes even if the drive isn't sure */ | 4176 | /* If the system is known to be 40 wire short cable (eg |
4177 | * laptop), then we allow 80 wire modes even if the drive | ||
4178 | * isn't sure. | ||
4179 | */ | ||
4167 | if (ap->cbl == ATA_CBL_PATA40_SHORT) | 4180 | if (ap->cbl == ATA_CBL_PATA40_SHORT) |
4168 | return 0; | 4181 | return 0; |
4169 | /* If the controller doesn't know we scan | 4182 | |
4170 | 4183 | /* If the controller doesn't know, we scan. | |
4171 | - Note: We look for all 40 wire detects at this point. | 4184 | * |
4172 | Any 80 wire detect is taken to be 80 wire cable | 4185 | * Note: We look for all 40 wire detects at this point. Any |
4173 | because | 4186 | * 80 wire detect is taken to be 80 wire cable because |
4174 | - In many setups only the one drive (slave if present) | 4187 | * - in many setups only the one drive (slave if present) will |
4175 | will give a valid detect | 4188 | * give a valid detect |
4176 | - If you have a non detect capable drive you don't | 4189 | * - if you have a non detect capable drive you don't want it |
4177 | want it to colour the choice | 4190 | * to colour the choice |
4178 | */ | 4191 | */ |
4179 | ata_port_for_each_link(link, ap) { | 4192 | ata_port_for_each_link(link, ap) { |
4180 | ata_link_for_each_dev(dev, link) { | 4193 | ata_link_for_each_dev(dev, link) { |
4181 | if (!ata_is_40wire(dev)) | 4194 | if (ata_dev_enabled(dev) && !ata_is_40wire(dev)) |
4182 | return 0; | 4195 | return 0; |
4183 | } | 4196 | } |
4184 | } | 4197 | } |
@@ -4434,7 +4447,8 @@ int atapi_check_dma(struct ata_queued_cmd *qc) | |||
4434 | /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a | 4447 | /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a |
4435 | * few ATAPI devices choke on such DMA requests. | 4448 | * few ATAPI devices choke on such DMA requests. |
4436 | */ | 4449 | */ |
4437 | if (unlikely(qc->nbytes & 15)) | 4450 | if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) && |
4451 | unlikely(qc->nbytes & 15)) | ||
4438 | return 1; | 4452 | return 1; |
4439 | 4453 | ||
4440 | if (ap->ops->check_atapi_dma) | 4454 | if (ap->ops->check_atapi_dma) |
@@ -4551,27 +4565,55 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4551 | } | 4565 | } |
4552 | 4566 | ||
4553 | /** | 4567 | /** |
4554 | * ata_qc_new_init - Request an available ATA command, and initialize it | 4568 | * ata_qc_new - Request an available ATA command, for queueing |
4569 | * @ap: Port associated with device @dev | ||
4555 | * @dev: Device from whom we request an available command structure | 4570 | * @dev: Device from whom we request an available command structure |
4556 | * | 4571 | * |
4557 | * LOCKING: | 4572 | * LOCKING: |
4558 | * None. | 4573 | * None. |
4559 | */ | 4574 | */ |
4560 | 4575 | ||
4561 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | 4576 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) |
4562 | { | 4577 | { |
4563 | struct ata_port *ap = dev->link->ap; | 4578 | struct ata_queued_cmd *qc = NULL; |
4564 | struct ata_queued_cmd *qc; | 4579 | unsigned int i; |
4565 | 4580 | ||
4581 | /* no command while frozen */ | ||
4566 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4582 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
4567 | return NULL; | 4583 | return NULL; |
4568 | 4584 | ||
4569 | qc = __ata_qc_from_tag(ap, tag); | 4585 | /* the last tag is reserved for internal command. */ |
4586 | for (i = 0; i < ATA_MAX_QUEUE - 1; i++) | ||
4587 | if (!test_and_set_bit(i, &ap->qc_allocated)) { | ||
4588 | qc = __ata_qc_from_tag(ap, i); | ||
4589 | break; | ||
4590 | } | ||
4591 | |||
4592 | if (qc) | ||
4593 | qc->tag = i; | ||
4594 | |||
4595 | return qc; | ||
4596 | } | ||
4597 | |||
4598 | /** | ||
4599 | * ata_qc_new_init - Request an available ATA command, and initialize it | ||
4600 | * @dev: Device from whom we request an available command structure | ||
4601 | * @tag: command tag | ||
4602 | * | ||
4603 | * LOCKING: | ||
4604 | * None. | ||
4605 | */ | ||
4606 | |||
4607 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) | ||
4608 | { | ||
4609 | struct ata_port *ap = dev->link->ap; | ||
4610 | struct ata_queued_cmd *qc; | ||
4611 | |||
4612 | qc = ata_qc_new(ap); | ||
4570 | if (qc) { | 4613 | if (qc) { |
4571 | qc->scsicmd = NULL; | 4614 | qc->scsicmd = NULL; |
4572 | qc->ap = ap; | 4615 | qc->ap = ap; |
4573 | qc->dev = dev; | 4616 | qc->dev = dev; |
4574 | qc->tag = tag; | ||
4575 | 4617 | ||
4576 | ata_qc_reinit(qc); | 4618 | ata_qc_reinit(qc); |
4577 | } | 4619 | } |
@@ -4579,6 +4621,31 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | |||
4579 | return qc; | 4621 | return qc; |
4580 | } | 4622 | } |
4581 | 4623 | ||
4624 | /** | ||
4625 | * ata_qc_free - free unused ata_queued_cmd | ||
4626 | * @qc: Command to complete | ||
4627 | * | ||
4628 | * Designed to free unused ata_queued_cmd object | ||
4629 | * in case something prevents using it. | ||
4630 | * | ||
4631 | * LOCKING: | ||
4632 | * spin_lock_irqsave(host lock) | ||
4633 | */ | ||
4634 | void ata_qc_free(struct ata_queued_cmd *qc) | ||
4635 | { | ||
4636 | struct ata_port *ap = qc->ap; | ||
4637 | unsigned int tag; | ||
4638 | |||
4639 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ | ||
4640 | |||
4641 | qc->flags = 0; | ||
4642 | tag = qc->tag; | ||
4643 | if (likely(ata_tag_valid(tag))) { | ||
4644 | qc->tag = ATA_TAG_POISON; | ||
4645 | clear_bit(tag, &ap->qc_allocated); | ||
4646 | } | ||
4647 | } | ||
4648 | |||
4582 | void __ata_qc_complete(struct ata_queued_cmd *qc) | 4649 | void __ata_qc_complete(struct ata_queued_cmd *qc) |
4583 | { | 4650 | { |
4584 | struct ata_port *ap = qc->ap; | 4651 | struct ata_port *ap = qc->ap; |
@@ -4643,7 +4710,6 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) | |||
4643 | /** | 4710 | /** |
4644 | * ata_qc_complete - Complete an active ATA command | 4711 | * ata_qc_complete - Complete an active ATA command |
4645 | * @qc: Command to complete | 4712 | * @qc: Command to complete |
4646 | * @err_mask: ATA Status register contents | ||
4647 | * | 4713 | * |
4648 | * Indicate to the mid and upper layers that an ATA | 4714 | * Indicate to the mid and upper layers that an ATA |
4649 | * command has completed, with either an ok or not-ok status. | 4715 | * command has completed, with either an ok or not-ok status. |
@@ -5924,7 +5990,7 @@ static void ata_port_detach(struct ata_port *ap) | |||
5924 | * to us. Restore SControl and disable all existing devices. | 5990 | * to us. Restore SControl and disable all existing devices. |
5925 | */ | 5991 | */ |
5926 | __ata_port_for_each_link(link, ap) { | 5992 | __ata_port_for_each_link(link, ap) { |
5927 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); | 5993 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); |
5928 | ata_link_for_each_dev(dev, link) | 5994 | ata_link_for_each_dev(dev, link) |
5929 | ata_dev_disable(dev); | 5995 | ata_dev_disable(dev); |
5930 | } | 5996 | } |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 5d687d7cffae..32da9a93ce44 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -603,13 +603,13 @@ 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; |
609 | } | 612 | } |
610 | |||
611 | /* set last reset timestamp to some time in the past */ | ||
612 | ehc->last_reset = jiffies - 60 * HZ; | ||
613 | } | 613 | } |
614 | 614 | ||
615 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; | 615 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; |
@@ -1161,6 +1161,7 @@ void ata_eh_detach_dev(struct ata_device *dev) | |||
1161 | { | 1161 | { |
1162 | struct ata_link *link = dev->link; | 1162 | struct ata_link *link = dev->link; |
1163 | struct ata_port *ap = link->ap; | 1163 | struct ata_port *ap = link->ap; |
1164 | struct ata_eh_context *ehc = &link->eh_context; | ||
1164 | unsigned long flags; | 1165 | unsigned long flags; |
1165 | 1166 | ||
1166 | ata_dev_disable(dev); | 1167 | ata_dev_disable(dev); |
@@ -1174,9 +1175,11 @@ void ata_eh_detach_dev(struct ata_device *dev) | |||
1174 | ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; | 1175 | ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; |
1175 | } | 1176 | } |
1176 | 1177 | ||
1177 | /* clear per-dev EH actions */ | 1178 | /* clear per-dev EH info */ |
1178 | ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); | 1179 | 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); | 1180 | ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); |
1181 | ehc->saved_xfer_mode[dev->devno] = 0; | ||
1182 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); | ||
1180 | 1183 | ||
1181 | spin_unlock_irqrestore(ap->lock, flags); | 1184 | spin_unlock_irqrestore(ap->lock, flags); |
1182 | } | 1185 | } |
@@ -2275,17 +2278,21 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2275 | if (link->flags & ATA_LFLAG_NO_SRST) | 2278 | if (link->flags & ATA_LFLAG_NO_SRST) |
2276 | softreset = NULL; | 2279 | softreset = NULL; |
2277 | 2280 | ||
2278 | now = jiffies; | 2281 | /* make sure each reset attemp is at least COOL_DOWN apart */ |
2279 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); | 2282 | if (ehc->i.flags & ATA_EHI_DID_RESET) { |
2280 | if (time_before(now, deadline)) | 2283 | now = jiffies; |
2281 | schedule_timeout_uninterruptible(deadline - now); | 2284 | WARN_ON(time_after(ehc->last_reset, now)); |
2285 | deadline = ata_deadline(ehc->last_reset, | ||
2286 | ATA_EH_RESET_COOL_DOWN); | ||
2287 | if (time_before(now, deadline)) | ||
2288 | schedule_timeout_uninterruptible(deadline - now); | ||
2289 | } | ||
2282 | 2290 | ||
2283 | spin_lock_irqsave(ap->lock, flags); | 2291 | spin_lock_irqsave(ap->lock, flags); |
2284 | ap->pflags |= ATA_PFLAG_RESETTING; | 2292 | ap->pflags |= ATA_PFLAG_RESETTING; |
2285 | spin_unlock_irqrestore(ap->lock, flags); | 2293 | spin_unlock_irqrestore(ap->lock, flags); |
2286 | 2294 | ||
2287 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2295 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2288 | ehc->last_reset = jiffies; | ||
2289 | 2296 | ||
2290 | ata_link_for_each_dev(dev, link) { | 2297 | ata_link_for_each_dev(dev, link) { |
2291 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2298 | /* If we issue an SRST then an ATA drive (not ATAPI) |
@@ -2373,7 +2380,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2373 | /* | 2380 | /* |
2374 | * Perform reset | 2381 | * Perform reset |
2375 | */ | 2382 | */ |
2376 | ehc->last_reset = jiffies; | ||
2377 | if (ata_is_host_link(link)) | 2383 | if (ata_is_host_link(link)) |
2378 | ata_eh_freeze_port(ap); | 2384 | ata_eh_freeze_port(ap); |
2379 | 2385 | ||
@@ -2385,6 +2391,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2385 | reset == softreset ? "soft" : "hard"); | 2391 | reset == softreset ? "soft" : "hard"); |
2386 | 2392 | ||
2387 | /* mark that this EH session started with reset */ | 2393 | /* mark that this EH session started with reset */ |
2394 | ehc->last_reset = jiffies; | ||
2388 | if (reset == hardreset) | 2395 | if (reset == hardreset) |
2389 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; | 2396 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; |
2390 | else | 2397 | else |
@@ -2529,7 +2536,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2529 | ata_eh_done(link, NULL, ATA_EH_RESET); | 2536 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2530 | if (slave) | 2537 | if (slave) |
2531 | ata_eh_done(slave, NULL, ATA_EH_RESET); | 2538 | ata_eh_done(slave, NULL, ATA_EH_RESET); |
2532 | ehc->last_reset = jiffies; | 2539 | ehc->last_reset = jiffies; /* update to completion time */ |
2533 | ehc->i.action |= ATA_EH_REVALIDATE; | 2540 | ehc->i.action |= ATA_EH_REVALIDATE; |
2534 | 2541 | ||
2535 | rc = 0; | 2542 | rc = 0; |
@@ -2787,6 +2794,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2787 | 2794 | ||
2788 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ | 2795 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ |
2789 | ata_link_for_each_dev(dev, link) { | 2796 | ata_link_for_each_dev(dev, link) { |
2797 | if (!ata_dev_enabled(dev)) | ||
2798 | continue; | ||
2799 | |||
2790 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { | 2800 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { |
2791 | struct ata_ering_entry *ent; | 2801 | struct ata_ering_entry *ent; |
2792 | 2802 | ||
@@ -2808,6 +2818,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]; | 2818 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; |
2809 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); | 2819 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); |
2810 | 2820 | ||
2821 | if (!ata_dev_enabled(dev)) | ||
2822 | continue; | ||
2823 | |||
2811 | if (dev->xfer_mode != saved_xfer_mode || | 2824 | if (dev->xfer_mode != saved_xfer_mode || |
2812 | ata_ncq_enabled(dev) != saved_ncq) | 2825 | ata_ncq_enabled(dev) != saved_ncq) |
2813 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; | 2826 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4b95c4387e9e..47c7afcb36f2 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -190,7 +190,7 @@ static ssize_t ata_scsi_park_show(struct device *device, | |||
190 | struct ata_port *ap; | 190 | struct ata_port *ap; |
191 | struct ata_link *link; | 191 | struct ata_link *link; |
192 | struct ata_device *dev; | 192 | struct ata_device *dev; |
193 | unsigned long flags; | 193 | unsigned long flags, now; |
194 | unsigned int uninitialized_var(msecs); | 194 | unsigned int uninitialized_var(msecs); |
195 | int rc = 0; | 195 | int rc = 0; |
196 | 196 | ||
@@ -208,10 +208,11 @@ static ssize_t ata_scsi_park_show(struct device *device, | |||
208 | } | 208 | } |
209 | 209 | ||
210 | link = dev->link; | 210 | link = dev->link; |
211 | now = jiffies; | ||
211 | if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && | 212 | if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && |
212 | link->eh_context.unloaded_mask & (1 << dev->devno) && | 213 | link->eh_context.unloaded_mask & (1 << dev->devno) && |
213 | time_after(dev->unpark_deadline, jiffies)) | 214 | time_after(dev->unpark_deadline, now)) |
214 | msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies); | 215 | msecs = jiffies_to_msecs(dev->unpark_deadline - now); |
215 | else | 216 | else |
216 | msecs = 0; | 217 | msecs = 0; |
217 | 218 | ||
@@ -708,11 +709,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
708 | { | 709 | { |
709 | struct ata_queued_cmd *qc; | 710 | struct ata_queued_cmd *qc; |
710 | 711 | ||
711 | if (cmd->request->tag != -1) | 712 | qc = ata_qc_new_init(dev); |
712 | qc = ata_qc_new_init(dev, cmd->request->tag); | ||
713 | else | ||
714 | qc = ata_qc_new_init(dev, 0); | ||
715 | |||
716 | if (qc) { | 713 | if (qc) { |
717 | qc->scsicmd = cmd; | 714 | qc->scsicmd = cmd; |
718 | qc->scsidone = done; | 715 | qc->scsidone = done; |
@@ -1107,8 +1104,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1107 | 1104 | ||
1108 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); | 1105 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); |
1109 | depth = min(ATA_MAX_QUEUE - 1, depth); | 1106 | depth = min(ATA_MAX_QUEUE - 1, depth); |
1110 | scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); | 1107 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); |
1111 | scsi_activate_tcq(sdev, depth); | ||
1112 | } | 1108 | } |
1113 | 1109 | ||
1114 | return 0; | 1110 | return 0; |
@@ -1948,11 +1944,6 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |||
1948 | hdr[1] |= (1 << 7); | 1944 | hdr[1] |= (1 << 7); |
1949 | 1945 | ||
1950 | memcpy(rbuf, hdr, sizeof(hdr)); | 1946 | memcpy(rbuf, hdr, sizeof(hdr)); |
1951 | |||
1952 | /* if ncq, set tags supported */ | ||
1953 | if (ata_id_has_ncq(args->id)) | ||
1954 | rbuf[7] |= (1 << 1); | ||
1955 | |||
1956 | memcpy(&rbuf[8], "ATA ", 8); | 1947 | memcpy(&rbuf[8], "ATA ", 8); |
1957 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); | 1948 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); |
1958 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); | 1949 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index d3831d39bdaa..fe2839e58774 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -74,7 +74,7 @@ extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); | |||
74 | extern void ata_force_cbl(struct ata_port *ap); | 74 | extern void ata_force_cbl(struct ata_port *ap); |
75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); | 75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); |
76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); | 76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); |
77 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); | 77 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
78 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 78 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
79 | u64 block, u32 n_block, unsigned int tf_flags, | 79 | u64 block, u32 n_block, unsigned int tf_flags, |
80 | unsigned int tag); | 80 | unsigned int tag); |
@@ -103,6 +103,7 @@ extern int ata_dev_configure(struct ata_device *dev); | |||
103 | extern int sata_down_spd_limit(struct ata_link *link); | 103 | extern int sata_down_spd_limit(struct ata_link *link); |
104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); | 104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); |
105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); | 105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); |
106 | extern void ata_qc_free(struct ata_queued_cmd *qc); | ||
106 | extern void ata_qc_issue(struct ata_queued_cmd *qc); | 107 | extern void ata_qc_issue(struct ata_queued_cmd *qc); |
107 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); | 108 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
108 | extern int atapi_check_dma(struct ata_queued_cmd *qc); | 109 | extern int atapi_check_dma(struct ata_queued_cmd *qc); |
@@ -118,22 +119,6 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host); | |||
118 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); | 119 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); |
119 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); | 120 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); |
120 | 121 | ||
121 | /** | ||
122 | * ata_qc_free - free unused ata_queued_cmd | ||
123 | * @qc: Command to complete | ||
124 | * | ||
125 | * Designed to free unused ata_queued_cmd object | ||
126 | * in case something prevents using it. | ||
127 | * | ||
128 | * LOCKING: | ||
129 | * spin_lock_irqsave(host lock) | ||
130 | */ | ||
131 | static inline void ata_qc_free(struct ata_queued_cmd *qc) | ||
132 | { | ||
133 | qc->flags = 0; | ||
134 | qc->tag = ATA_TAG_POISON; | ||
135 | } | ||
136 | |||
137 | /* libata-acpi.c */ | 122 | /* libata-acpi.c */ |
138 | #ifdef CONFIG_ATA_ACPI | 123 | #ifdef CONFIG_ATA_ACPI |
139 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); | 124 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); |
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..8b236af84c2e 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 |
@@ -72,7 +72,6 @@ | |||
72 | /** | 72 | /** |
73 | * cs5535_cable_detect - detect cable type | 73 | * cs5535_cable_detect - detect cable type |
74 | * @ap: Port to detect on | 74 | * @ap: Port to detect on |
75 | * @deadline: deadline jiffies for the operation | ||
76 | * | 75 | * |
77 | * Perform cable detection for ATA66 capable cable. Return a libata | 76 | * Perform cable detection for ATA66 capable cable. Return a libata |
78 | * cable type. | 77 | * cable type. |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index 73f8332cb679..afed92976198 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
@@ -110,7 +110,6 @@ static inline int cs5536_write(struct pci_dev *pdev, int reg, int val) | |||
110 | /** | 110 | /** |
111 | * cs5536_cable_detect - detect cable type | 111 | * cs5536_cable_detect - detect cable type |
112 | * @ap: Port to detect on | 112 | * @ap: Port to detect on |
113 | * @deadline: deadline jiffies for the operation | ||
114 | * | 113 | * |
115 | * Perform cable detection for ATA66 capable cable. Return a libata | 114 | * Perform cable detection for ATA66 capable cable. Return a libata |
116 | * cable type. | 115 | * cable type. |
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 | ||
91 | static 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 | |||
92 | static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 102 | static 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 | |||
155 | static 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 | |||
149 | static const struct pci_device_id ninja32[] = { | 169 | static 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 | ||
162 | static int __init ninja32_init(void) | 186 | static 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..64b2e2281ee7 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 | * |
@@ -416,6 +416,7 @@ static struct pcmcia_device_id pcmcia_devices[] = { | |||
416 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 416 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |
417 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), | 417 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), |
418 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), | 418 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), |
419 | PCMCIA_DEVICE_PROD_ID2("Flash Card", 0x5a362506), | ||
419 | PCMCIA_DEVICE_NULL, | 420 | PCMCIA_DEVICE_NULL, |
420 | }; | 421 | }; |
421 | 422 | ||
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_sch.c b/drivers/ata/pata_sch.c index c8cc027789fe..6aeeeeb34124 100644 --- a/drivers/ata/pata_sch.c +++ b/drivers/ata/pata_sch.c | |||
@@ -83,7 +83,7 @@ static struct ata_port_operations sch_pata_ops = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct ata_port_info sch_port_info = { | 85 | static struct ata_port_info sch_port_info = { |
86 | .flags = 0, | 86 | .flags = ATA_FLAG_SLAVE_POSS, |
87 | .pio_mask = ATA_PIO4, /* pio0-4 */ | 87 | .pio_mask = ATA_PIO4, /* pio0-4 */ |
88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ | 88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ |
89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ | 89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ |
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_nv.c b/drivers/ata/sata_nv.c index fae3841de0d8..6f1460614325 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -307,10 +307,10 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | |||
307 | 307 | ||
308 | static void nv_nf2_freeze(struct ata_port *ap); | 308 | static void nv_nf2_freeze(struct ata_port *ap); |
309 | static void nv_nf2_thaw(struct ata_port *ap); | 309 | static void nv_nf2_thaw(struct ata_port *ap); |
310 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
311 | unsigned long deadline); | ||
310 | static void nv_ck804_freeze(struct ata_port *ap); | 312 | static void nv_ck804_freeze(struct ata_port *ap); |
311 | static void nv_ck804_thaw(struct ata_port *ap); | 313 | static void nv_ck804_thaw(struct ata_port *ap); |
312 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
313 | unsigned long deadline); | ||
314 | static int nv_adma_slave_config(struct scsi_device *sdev); | 314 | static int nv_adma_slave_config(struct scsi_device *sdev); |
315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); | 315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); |
316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); | 316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); |
@@ -405,17 +405,8 @@ static struct scsi_host_template nv_swncq_sht = { | |||
405 | .slave_configure = nv_swncq_slave_config, | 405 | .slave_configure = nv_swncq_slave_config, |
406 | }; | 406 | }; |
407 | 407 | ||
408 | /* OSDL bz3352 reports that some nv controllers can't determine device | ||
409 | * signature reliably and nv_hardreset is implemented to work around | ||
410 | * the problem. This was reported on nf3 and it's unclear whether any | ||
411 | * other controllers are affected. However, the workaround has been | ||
412 | * applied to all variants and there isn't much to gain by trying to | ||
413 | * find out exactly which ones are affected at this point especially | ||
414 | * because NV has moved over to ahci for newer controllers. | ||
415 | */ | ||
416 | static struct ata_port_operations nv_common_ops = { | 408 | static struct ata_port_operations nv_common_ops = { |
417 | .inherits = &ata_bmdma_port_ops, | 409 | .inherits = &ata_bmdma_port_ops, |
418 | .hardreset = nv_hardreset, | ||
419 | .scr_read = nv_scr_read, | 410 | .scr_read = nv_scr_read, |
420 | .scr_write = nv_scr_write, | 411 | .scr_write = nv_scr_write, |
421 | }; | 412 | }; |
@@ -429,12 +420,22 @@ static struct ata_port_operations nv_generic_ops = { | |||
429 | .hardreset = ATA_OP_NULL, | 420 | .hardreset = ATA_OP_NULL, |
430 | }; | 421 | }; |
431 | 422 | ||
423 | /* OSDL bz3352 reports that nf2/3 controllers can't determine device | ||
424 | * signature reliably. Also, the following thread reports detection | ||
425 | * failure on cold boot with the standard debouncing timing. | ||
426 | * | ||
427 | * http://thread.gmane.org/gmane.linux.ide/34098 | ||
428 | * | ||
429 | * Debounce with hotplug timing and request follow-up SRST. | ||
430 | */ | ||
432 | static struct ata_port_operations nv_nf2_ops = { | 431 | static struct ata_port_operations nv_nf2_ops = { |
433 | .inherits = &nv_common_ops, | 432 | .inherits = &nv_common_ops, |
434 | .freeze = nv_nf2_freeze, | 433 | .freeze = nv_nf2_freeze, |
435 | .thaw = nv_nf2_thaw, | 434 | .thaw = nv_nf2_thaw, |
435 | .hardreset = nv_nf2_hardreset, | ||
436 | }; | 436 | }; |
437 | 437 | ||
438 | /* CK804 finally gets hardreset right */ | ||
438 | static struct ata_port_operations nv_ck804_ops = { | 439 | static struct ata_port_operations nv_ck804_ops = { |
439 | .inherits = &nv_common_ops, | 440 | .inherits = &nv_common_ops, |
440 | .freeze = nv_ck804_freeze, | 441 | .freeze = nv_ck804_freeze, |
@@ -443,7 +444,7 @@ static struct ata_port_operations nv_ck804_ops = { | |||
443 | }; | 444 | }; |
444 | 445 | ||
445 | static struct ata_port_operations nv_adma_ops = { | 446 | static struct ata_port_operations nv_adma_ops = { |
446 | .inherits = &nv_common_ops, | 447 | .inherits = &nv_ck804_ops, |
447 | 448 | ||
448 | .check_atapi_dma = nv_adma_check_atapi_dma, | 449 | .check_atapi_dma = nv_adma_check_atapi_dma, |
449 | .sff_tf_read = nv_adma_tf_read, | 450 | .sff_tf_read = nv_adma_tf_read, |
@@ -467,7 +468,7 @@ static struct ata_port_operations nv_adma_ops = { | |||
467 | }; | 468 | }; |
468 | 469 | ||
469 | static struct ata_port_operations nv_swncq_ops = { | 470 | static struct ata_port_operations nv_swncq_ops = { |
470 | .inherits = &nv_common_ops, | 471 | .inherits = &nv_generic_ops, |
471 | 472 | ||
472 | .qc_defer = ata_std_qc_defer, | 473 | .qc_defer = ata_std_qc_defer, |
473 | .qc_prep = nv_swncq_qc_prep, | 474 | .qc_prep = nv_swncq_qc_prep, |
@@ -1553,6 +1554,17 @@ static void nv_nf2_thaw(struct ata_port *ap) | |||
1553 | iowrite8(mask, scr_addr + NV_INT_ENABLE); | 1554 | iowrite8(mask, scr_addr + NV_INT_ENABLE); |
1554 | } | 1555 | } |
1555 | 1556 | ||
1557 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
1558 | unsigned long deadline) | ||
1559 | { | ||
1560 | bool online; | ||
1561 | int rc; | ||
1562 | |||
1563 | rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | ||
1564 | &online, NULL); | ||
1565 | return online ? -EAGAIN : rc; | ||
1566 | } | ||
1567 | |||
1556 | static void nv_ck804_freeze(struct ata_port *ap) | 1568 | static void nv_ck804_freeze(struct ata_port *ap) |
1557 | { | 1569 | { |
1558 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; | 1570 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; |
@@ -1605,21 +1617,6 @@ static void nv_mcp55_thaw(struct ata_port *ap) | |||
1605 | ata_sff_thaw(ap); | 1617 | ata_sff_thaw(ap); |
1606 | } | 1618 | } |
1607 | 1619 | ||
1608 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
1609 | unsigned long deadline) | ||
1610 | { | ||
1611 | int rc; | ||
1612 | |||
1613 | /* SATA hardreset fails to retrieve proper device signature on | ||
1614 | * some controllers. Request follow up SRST. For more info, | ||
1615 | * see http://bugzilla.kernel.org/show_bug.cgi?id=3352 | ||
1616 | */ | ||
1617 | rc = sata_sff_hardreset(link, class, deadline); | ||
1618 | if (rc) | ||
1619 | return rc; | ||
1620 | return -EAGAIN; | ||
1621 | } | ||
1622 | |||
1623 | static void nv_adma_error_handler(struct ata_port *ap) | 1620 | static void nv_adma_error_handler(struct ata_port *ap) |
1624 | { | 1621 | { |
1625 | struct nv_adma_port_priv *pp = ap->private_data; | 1622 | struct nv_adma_port_priv *pp = ap->private_data; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 750d8cdc00cd..ba9a2570a742 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -153,6 +153,10 @@ static void pdc_freeze(struct ata_port *ap); | |||
153 | static void pdc_sata_freeze(struct ata_port *ap); | 153 | static void pdc_sata_freeze(struct ata_port *ap); |
154 | static void pdc_thaw(struct ata_port *ap); | 154 | static void pdc_thaw(struct ata_port *ap); |
155 | static void pdc_sata_thaw(struct ata_port *ap); | 155 | static void pdc_sata_thaw(struct ata_port *ap); |
156 | static int pdc_pata_softreset(struct ata_link *link, unsigned int *class, | ||
157 | unsigned long deadline); | ||
158 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
159 | unsigned long deadline); | ||
156 | static void pdc_error_handler(struct ata_port *ap); | 160 | static void pdc_error_handler(struct ata_port *ap); |
157 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | 161 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); |
158 | static int pdc_pata_cable_detect(struct ata_port *ap); | 162 | static int pdc_pata_cable_detect(struct ata_port *ap); |
@@ -186,6 +190,7 @@ static struct ata_port_operations pdc_sata_ops = { | |||
186 | .scr_read = pdc_sata_scr_read, | 190 | .scr_read = pdc_sata_scr_read, |
187 | .scr_write = pdc_sata_scr_write, | 191 | .scr_write = pdc_sata_scr_write, |
188 | .port_start = pdc_sata_port_start, | 192 | .port_start = pdc_sata_port_start, |
193 | .hardreset = pdc_sata_hardreset, | ||
189 | }; | 194 | }; |
190 | 195 | ||
191 | /* First-generation chips need a more restrictive ->check_atapi_dma op */ | 196 | /* First-generation chips need a more restrictive ->check_atapi_dma op */ |
@@ -200,6 +205,7 @@ static struct ata_port_operations pdc_pata_ops = { | |||
200 | .freeze = pdc_freeze, | 205 | .freeze = pdc_freeze, |
201 | .thaw = pdc_thaw, | 206 | .thaw = pdc_thaw, |
202 | .port_start = pdc_common_port_start, | 207 | .port_start = pdc_common_port_start, |
208 | .softreset = pdc_pata_softreset, | ||
203 | }; | 209 | }; |
204 | 210 | ||
205 | static const struct ata_port_info pdc_port_info[] = { | 211 | static const struct ata_port_info pdc_port_info[] = { |
@@ -693,6 +699,20 @@ static void pdc_sata_thaw(struct ata_port *ap) | |||
693 | readl(host_mmio + hotplug_offset); /* flush */ | 699 | readl(host_mmio + hotplug_offset); /* flush */ |
694 | } | 700 | } |
695 | 701 | ||
702 | static int pdc_pata_softreset(struct ata_link *link, unsigned int *class, | ||
703 | unsigned long deadline) | ||
704 | { | ||
705 | pdc_reset_port(link->ap); | ||
706 | return ata_sff_softreset(link, class, deadline); | ||
707 | } | ||
708 | |||
709 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
710 | unsigned long deadline) | ||
711 | { | ||
712 | pdc_reset_port(link->ap); | ||
713 | return sata_sff_hardreset(link, class, deadline); | ||
714 | } | ||
715 | |||
696 | static void pdc_error_handler(struct ata_port *ap) | 716 | static void pdc_error_handler(struct ata_port *ap) |
697 | { | 717 | { |
698 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | 718 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) |
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/ata/sata_via.c b/drivers/ata/sata_via.c index 5b72e734300a..c18935f0bda2 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -44,11 +44,16 @@ | |||
44 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
45 | 45 | ||
46 | #define DRV_NAME "sata_via" | 46 | #define DRV_NAME "sata_via" |
47 | #define DRV_VERSION "2.3" | 47 | #define DRV_VERSION "2.4" |
48 | 48 | ||
49 | /* | ||
50 | * vt8251 is different from other sata controllers of VIA. It has two | ||
51 | * channels, each channel has both Master and Slave slot. | ||
52 | */ | ||
49 | enum board_ids_enum { | 53 | enum board_ids_enum { |
50 | vt6420, | 54 | vt6420, |
51 | vt6421, | 55 | vt6421, |
56 | vt8251, | ||
52 | }; | 57 | }; |
53 | 58 | ||
54 | enum { | 59 | enum { |
@@ -70,6 +75,8 @@ enum { | |||
70 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 75 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
71 | static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 76 | static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
72 | static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 77 | static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
78 | static int vt8251_scr_read(struct ata_link *link, unsigned int scr, u32 *val); | ||
79 | static int vt8251_scr_write(struct ata_link *link, unsigned int scr, u32 val); | ||
73 | static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | 80 | static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); |
74 | static void svia_noop_freeze(struct ata_port *ap); | 81 | static void svia_noop_freeze(struct ata_port *ap); |
75 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); | 82 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); |
@@ -79,12 +86,12 @@ static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); | |||
79 | 86 | ||
80 | static const struct pci_device_id svia_pci_tbl[] = { | 87 | static const struct pci_device_id svia_pci_tbl[] = { |
81 | { PCI_VDEVICE(VIA, 0x5337), vt6420 }, | 88 | { PCI_VDEVICE(VIA, 0x5337), vt6420 }, |
82 | { PCI_VDEVICE(VIA, 0x0591), vt6420 }, | 89 | { PCI_VDEVICE(VIA, 0x0591), vt6420 }, /* 2 sata chnls (Master) */ |
83 | { PCI_VDEVICE(VIA, 0x3149), vt6420 }, | 90 | { PCI_VDEVICE(VIA, 0x3149), vt6420 }, /* 2 sata chnls (Master) */ |
84 | { PCI_VDEVICE(VIA, 0x3249), vt6421 }, | 91 | { PCI_VDEVICE(VIA, 0x3249), vt6421 }, /* 2 sata chnls, 1 pata chnl */ |
85 | { PCI_VDEVICE(VIA, 0x5287), vt6420 }, | ||
86 | { PCI_VDEVICE(VIA, 0x5372), vt6420 }, | 92 | { PCI_VDEVICE(VIA, 0x5372), vt6420 }, |
87 | { PCI_VDEVICE(VIA, 0x7372), vt6420 }, | 93 | { PCI_VDEVICE(VIA, 0x7372), vt6420 }, |
94 | { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */ | ||
88 | 95 | ||
89 | { } /* terminate list */ | 96 | { } /* terminate list */ |
90 | }; | 97 | }; |
@@ -128,6 +135,13 @@ static struct ata_port_operations vt6421_sata_ops = { | |||
128 | .scr_write = svia_scr_write, | 135 | .scr_write = svia_scr_write, |
129 | }; | 136 | }; |
130 | 137 | ||
138 | static struct ata_port_operations vt8251_ops = { | ||
139 | .inherits = &svia_base_ops, | ||
140 | .hardreset = sata_std_hardreset, | ||
141 | .scr_read = vt8251_scr_read, | ||
142 | .scr_write = vt8251_scr_write, | ||
143 | }; | ||
144 | |||
131 | static const struct ata_port_info vt6420_port_info = { | 145 | static const struct ata_port_info vt6420_port_info = { |
132 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 146 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
133 | .pio_mask = 0x1f, | 147 | .pio_mask = 0x1f, |
@@ -152,6 +166,15 @@ static struct ata_port_info vt6421_pport_info = { | |||
152 | .port_ops = &vt6421_pata_ops, | 166 | .port_ops = &vt6421_pata_ops, |
153 | }; | 167 | }; |
154 | 168 | ||
169 | static struct ata_port_info vt8251_port_info = { | ||
170 | .flags = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS | | ||
171 | ATA_FLAG_NO_LEGACY, | ||
172 | .pio_mask = 0x1f, | ||
173 | .mwdma_mask = 0x07, | ||
174 | .udma_mask = ATA_UDMA6, | ||
175 | .port_ops = &vt8251_ops, | ||
176 | }; | ||
177 | |||
155 | MODULE_AUTHOR("Jeff Garzik"); | 178 | MODULE_AUTHOR("Jeff Garzik"); |
156 | MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); | 179 | MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); |
157 | MODULE_LICENSE("GPL"); | 180 | MODULE_LICENSE("GPL"); |
@@ -174,6 +197,83 @@ static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) | |||
174 | return 0; | 197 | return 0; |
175 | } | 198 | } |
176 | 199 | ||
200 | static int vt8251_scr_read(struct ata_link *link, unsigned int scr, u32 *val) | ||
201 | { | ||
202 | static const u8 ipm_tbl[] = { 1, 2, 6, 0 }; | ||
203 | struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); | ||
204 | int slot = 2 * link->ap->port_no + link->pmp; | ||
205 | u32 v = 0; | ||
206 | u8 raw; | ||
207 | |||
208 | switch (scr) { | ||
209 | case SCR_STATUS: | ||
210 | pci_read_config_byte(pdev, 0xA0 + slot, &raw); | ||
211 | |||
212 | /* read the DET field, bit0 and 1 of the config byte */ | ||
213 | v |= raw & 0x03; | ||
214 | |||
215 | /* read the SPD field, bit4 of the configure byte */ | ||
216 | if (raw & (1 << 4)) | ||
217 | v |= 0x02 << 4; | ||
218 | else | ||
219 | v |= 0x01 << 4; | ||
220 | |||
221 | /* read the IPM field, bit2 and 3 of the config byte */ | ||
222 | v |= ipm_tbl[(raw >> 2) & 0x3]; | ||
223 | break; | ||
224 | |||
225 | case SCR_ERROR: | ||
226 | /* devices other than 5287 uses 0xA8 as base */ | ||
227 | WARN_ON(pdev->device != 0x5287); | ||
228 | pci_read_config_dword(pdev, 0xB0 + slot * 4, &v); | ||
229 | break; | ||
230 | |||
231 | case SCR_CONTROL: | ||
232 | pci_read_config_byte(pdev, 0xA4 + slot, &raw); | ||
233 | |||
234 | /* read the DET field, bit0 and bit1 */ | ||
235 | v |= ((raw & 0x02) << 1) | (raw & 0x01); | ||
236 | |||
237 | /* read the IPM field, bit2 and bit3 */ | ||
238 | v |= ((raw >> 2) & 0x03) << 8; | ||
239 | break; | ||
240 | |||
241 | default: | ||
242 | return -EINVAL; | ||
243 | } | ||
244 | |||
245 | *val = v; | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static int vt8251_scr_write(struct ata_link *link, unsigned int scr, u32 val) | ||
250 | { | ||
251 | struct pci_dev *pdev = to_pci_dev(link->ap->host->dev); | ||
252 | int slot = 2 * link->ap->port_no + link->pmp; | ||
253 | u32 v = 0; | ||
254 | |||
255 | switch (scr) { | ||
256 | case SCR_ERROR: | ||
257 | /* devices other than 5287 uses 0xA8 as base */ | ||
258 | WARN_ON(pdev->device != 0x5287); | ||
259 | pci_write_config_dword(pdev, 0xB0 + slot * 4, val); | ||
260 | return 0; | ||
261 | |||
262 | case SCR_CONTROL: | ||
263 | /* set the DET field */ | ||
264 | v |= ((val & 0x4) >> 1) | (val & 0x1); | ||
265 | |||
266 | /* set the IPM field */ | ||
267 | v |= ((val >> 8) & 0x3) << 2; | ||
268 | |||
269 | pci_write_config_byte(pdev, 0xA4 + slot, v); | ||
270 | return 0; | ||
271 | |||
272 | default: | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | } | ||
276 | |||
177 | /** | 277 | /** |
178 | * svia_tf_load - send taskfile registers to host controller | 278 | * svia_tf_load - send taskfile registers to host controller |
179 | * @ap: Port to which output is sent | 279 | * @ap: Port to which output is sent |
@@ -396,6 +496,30 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
396 | return 0; | 496 | return 0; |
397 | } | 497 | } |
398 | 498 | ||
499 | static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | ||
500 | { | ||
501 | const struct ata_port_info *ppi[] = { &vt8251_port_info, NULL }; | ||
502 | struct ata_host *host; | ||
503 | int i, rc; | ||
504 | |||
505 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | ||
506 | if (rc) | ||
507 | return rc; | ||
508 | *r_host = host; | ||
509 | |||
510 | rc = pcim_iomap_regions(pdev, 1 << 5, DRV_NAME); | ||
511 | if (rc) { | ||
512 | dev_printk(KERN_ERR, &pdev->dev, "failed to iomap PCI BAR 5\n"); | ||
513 | return rc; | ||
514 | } | ||
515 | |||
516 | /* 8251 hosts four sata ports as M/S of the two channels */ | ||
517 | for (i = 0; i < host->n_ports; i++) | ||
518 | ata_slave_link_init(host->ports[i]); | ||
519 | |||
520 | return 0; | ||
521 | } | ||
522 | |||
399 | static void svia_configure(struct pci_dev *pdev) | 523 | static void svia_configure(struct pci_dev *pdev) |
400 | { | 524 | { |
401 | u8 tmp8; | 525 | u8 tmp8; |
@@ -451,10 +575,10 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
451 | if (rc) | 575 | if (rc) |
452 | return rc; | 576 | return rc; |
453 | 577 | ||
454 | if (board_id == vt6420) | 578 | if (board_id == vt6421) |
455 | bar_sizes = &svia_bar_sizes[0]; | ||
456 | else | ||
457 | bar_sizes = &vt6421_bar_sizes[0]; | 579 | bar_sizes = &vt6421_bar_sizes[0]; |
580 | else | ||
581 | bar_sizes = &svia_bar_sizes[0]; | ||
458 | 582 | ||
459 | for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) | 583 | for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) |
460 | if ((pci_resource_start(pdev, i) == 0) || | 584 | if ((pci_resource_start(pdev, i) == 0) || |
@@ -467,10 +591,19 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
467 | return -ENODEV; | 591 | return -ENODEV; |
468 | } | 592 | } |
469 | 593 | ||
470 | if (board_id == vt6420) | 594 | switch (board_id) { |
595 | case vt6420: | ||
471 | rc = vt6420_prepare_host(pdev, &host); | 596 | rc = vt6420_prepare_host(pdev, &host); |
472 | else | 597 | break; |
598 | case vt6421: | ||
473 | rc = vt6421_prepare_host(pdev, &host); | 599 | rc = vt6421_prepare_host(pdev, &host); |
600 | break; | ||
601 | case vt8251: | ||
602 | rc = vt8251_prepare_host(pdev, &host); | ||
603 | break; | ||
604 | default: | ||
605 | rc = -EINVAL; | ||
606 | } | ||
474 | if (rc) | 607 | if (rc) |
475 | return rc; | 608 | return rc; |
476 | 609 | ||
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 | } |
493 | EXPORT_SYMBOL_GPL(sysdev_store_ulong); | 494 | EXPORT_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 | } |
516 | EXPORT_SYMBOL_GPL(sysdev_store_int); | 518 | EXPORT_SYMBOL_GPL(sysdev_store_int); |
517 | 519 | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 4023885353e0..12de1fdaa6c6 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -96,6 +96,8 @@ static const struct pci_device_id cciss_pci_device_id[] = { | |||
96 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245}, | 96 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245}, |
97 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247}, | 97 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247}, |
98 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, | 98 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, |
99 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, | ||
100 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, | ||
99 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 101 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
100 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | 102 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, |
101 | {0,} | 103 | {0,} |
@@ -133,6 +135,8 @@ static struct board_type products[] = { | |||
133 | {0x3245103C, "Smart Array P410i", &SA5_access}, | 135 | {0x3245103C, "Smart Array P410i", &SA5_access}, |
134 | {0x3247103C, "Smart Array P411", &SA5_access}, | 136 | {0x3247103C, "Smart Array P411", &SA5_access}, |
135 | {0x3249103C, "Smart Array P812", &SA5_access}, | 137 | {0x3249103C, "Smart Array P812", &SA5_access}, |
138 | {0x324A103C, "Smart Array P712m", &SA5_access}, | ||
139 | {0x324B103C, "Smart Array P711m", &SA5_access}, | ||
136 | {0xFFFF103C, "Unknown Smart Array", &SA5_access}, | 140 | {0xFFFF103C, "Unknown Smart Array", &SA5_access}, |
137 | }; | 141 | }; |
138 | 142 | ||
@@ -1366,6 +1370,7 @@ static void cciss_add_disk(ctlr_info_t *h, struct gendisk *disk, | |||
1366 | disk->first_minor = drv_index << NWD_SHIFT; | 1370 | disk->first_minor = drv_index << NWD_SHIFT; |
1367 | disk->fops = &cciss_fops; | 1371 | disk->fops = &cciss_fops; |
1368 | disk->private_data = &h->drv[drv_index]; | 1372 | disk->private_data = &h->drv[drv_index]; |
1373 | disk->driverfs_dev = &h->pdev->dev; | ||
1369 | 1374 | ||
1370 | /* Set up queue information */ | 1375 | /* Set up queue information */ |
1371 | blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); | 1376 | blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); |
@@ -3404,7 +3409,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3404 | int i; | 3409 | int i; |
3405 | int j = 0; | 3410 | int j = 0; |
3406 | int rc; | 3411 | int rc; |
3407 | int dac; | 3412 | int dac, return_code; |
3413 | InquiryData_struct *inq_buff = NULL; | ||
3408 | 3414 | ||
3409 | i = alloc_cciss_hba(); | 3415 | i = alloc_cciss_hba(); |
3410 | if (i < 0) | 3416 | if (i < 0) |
@@ -3510,6 +3516,25 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3510 | /* Turn the interrupts on so we can service requests */ | 3516 | /* Turn the interrupts on so we can service requests */ |
3511 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); | 3517 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); |
3512 | 3518 | ||
3519 | /* Get the firmware version */ | ||
3520 | inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL); | ||
3521 | if (inq_buff == NULL) { | ||
3522 | printk(KERN_ERR "cciss: out of memory\n"); | ||
3523 | goto clean4; | ||
3524 | } | ||
3525 | |||
3526 | return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff, | ||
3527 | sizeof(InquiryData_struct), 0, 0 , 0, TYPE_CMD); | ||
3528 | if (return_code == IO_OK) { | ||
3529 | hba[i]->firm_ver[0] = inq_buff->data_byte[32]; | ||
3530 | hba[i]->firm_ver[1] = inq_buff->data_byte[33]; | ||
3531 | hba[i]->firm_ver[2] = inq_buff->data_byte[34]; | ||
3532 | hba[i]->firm_ver[3] = inq_buff->data_byte[35]; | ||
3533 | } else { /* send command failed */ | ||
3534 | printk(KERN_WARNING "cciss: unable to determine firmware" | ||
3535 | " version of controller\n"); | ||
3536 | } | ||
3537 | |||
3513 | cciss_procinit(i); | 3538 | cciss_procinit(i); |
3514 | 3539 | ||
3515 | hba[i]->cciss_max_sectors = 2048; | 3540 | hba[i]->cciss_max_sectors = 2048; |
@@ -3520,6 +3545,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3520 | return 1; | 3545 | return 1; |
3521 | 3546 | ||
3522 | clean4: | 3547 | clean4: |
3548 | kfree(inq_buff); | ||
3523 | #ifdef CONFIG_CISS_SCSI_TAPE | 3549 | #ifdef CONFIG_CISS_SCSI_TAPE |
3524 | kfree(hba[i]->scsi_rejects.complete); | 3550 | kfree(hba[i]->scsi_rejects.complete); |
3525 | #endif | 3551 | #endif |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 47d233c6d0b3..5d39df14ed90 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -567,7 +567,12 @@ static int __init cpqarray_init(void) | |||
567 | num_cntlrs_reg++; | 567 | num_cntlrs_reg++; |
568 | } | 568 | } |
569 | 569 | ||
570 | return(num_cntlrs_reg); | 570 | if (num_cntlrs_reg) |
571 | return 0; | ||
572 | else { | ||
573 | pci_unregister_driver(&cpqarray_pci_driver); | ||
574 | return -ENODEV; | ||
575 | } | ||
571 | } | 576 | } |
572 | 577 | ||
573 | /* Function to find the first free pointer into our hba[] array */ | 578 | /* Function to find the first free pointer into our hba[] array */ |
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/bpa10x.c b/drivers/bluetooth/bpa10x.c index 32f3a8ed8d3d..b936d8ce2728 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -443,8 +443,8 @@ static void bpa10x_destruct(struct hci_dev *hdev) | |||
443 | 443 | ||
444 | BT_DBG("%s", hdev->name); | 444 | BT_DBG("%s", hdev->name); |
445 | 445 | ||
446 | kfree(data->rx_skb[0]); | 446 | kfree_skb(data->rx_skb[0]); |
447 | kfree(data->rx_skb[1]); | 447 | kfree_skb(data->rx_skb[1]); |
448 | kfree(data); | 448 | kfree(data); |
449 | } | 449 | } |
450 | 450 | ||
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/btsdio.c b/drivers/bluetooth/btsdio.c index 58630cc1eff2..cda6c7cc944b 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c | |||
@@ -152,7 +152,7 @@ static int btsdio_rx_packet(struct btsdio_data *data) | |||
152 | 152 | ||
153 | err = sdio_readsb(data->func, skb->data, REG_RDAT, len - 4); | 153 | err = sdio_readsb(data->func, skb->data, REG_RDAT, len - 4); |
154 | if (err < 0) { | 154 | if (err < 0) { |
155 | kfree(skb); | 155 | kfree_skb(skb); |
156 | return err; | 156 | return err; |
157 | } | 157 | } |
158 | 158 | ||
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/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 9aaa86b232b1..2eecb779437b 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -495,9 +495,10 @@ static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode) | |||
495 | return cdrom_open(gd.cd_info, bdev, mode); | 495 | return cdrom_open(gd.cd_info, bdev, mode); |
496 | } | 496 | } |
497 | 497 | ||
498 | static int gdrom_bdops_release(struct block_device *bdev, fmode_t mode) | 498 | static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode) |
499 | { | 499 | { |
500 | return cdrom_release(gd.cd_info, mode); | 500 | cdrom_release(gd.cd_info, mode); |
501 | return 0; | ||
501 | } | 502 | } |
502 | 503 | ||
503 | static int gdrom_bdops_mediachanged(struct gendisk *disk) | 504 | static int gdrom_bdops_mediachanged(struct gendisk *disk) |
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 | ||
815 | config 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 | |||
826 | config 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 | |||
837 | config GEN_RTC | 815 | config 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 | |||
74 | obj-$(CONFIG_HPET) += hpet.o | 74 | obj-$(CONFIG_HPET) += hpet.o |
75 | obj-$(CONFIG_GEN_RTC) += genrtc.o | 75 | obj-$(CONFIG_GEN_RTC) += genrtc.o |
76 | obj-$(CONFIG_EFI_RTC) += efirtc.o | 76 | obj-$(CONFIG_EFI_RTC) += efirtc.o |
77 | obj-$(CONFIG_SGI_DS1286) += ds1286.o | ||
78 | obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o | ||
79 | obj-$(CONFIG_DS1302) += ds1302.o | 77 | obj-$(CONFIG_DS1302) += ds1302.o |
80 | obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ | 78 | obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ |
81 | ifeq ($(CONFIG_GENERIC_NVRAM),y) | 79 | ifeq ($(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 | |||
57 | static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait); | ||
58 | |||
59 | static ssize_t ds1286_read(struct file *file, char *buf, | ||
60 | size_t count, loff_t *ppos); | ||
61 | |||
62 | static int ds1286_ioctl(struct inode *inode, struct file *file, | ||
63 | unsigned int cmd, unsigned long arg); | ||
64 | |||
65 | static unsigned int ds1286_poll(struct file *file, poll_table *wait); | ||
66 | |||
67 | static void ds1286_get_alm_time (struct rtc_time *alm_tm); | ||
68 | static void ds1286_get_time(struct rtc_time *rtc_tm); | ||
69 | static int ds1286_set_time(struct rtc_time *rtc_tm); | ||
70 | |||
71 | static inline unsigned char ds1286_is_updating(void); | ||
72 | |||
73 | static DEFINE_SPINLOCK(ds1286_lock); | ||
74 | |||
75 | static 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 | |||
85 | static unsigned char ds1286_status; /* bitmapped status byte. */ | ||
86 | |||
87 | static 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 | |||
95 | static ssize_t ds1286_read(struct file *file, char *buf, | ||
96 | size_t count, loff_t *ppos) | ||
97 | { | ||
98 | return -EIO; | ||
99 | } | ||
100 | |||
101 | static 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 | |||
254 | static 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 | |||
268 | out_busy: | ||
269 | spin_lock_irq(&ds1286_lock); | ||
270 | unlock_kernel(); | ||
271 | return -EBUSY; | ||
272 | } | ||
273 | |||
274 | static int ds1286_release(struct inode *inode, struct file *file) | ||
275 | { | ||
276 | ds1286_status &= ~RTC_IS_OPEN; | ||
277 | |||
278 | return 0; | ||
279 | } | ||
280 | |||
281 | static 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 | |||
292 | static 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 | |||
301 | static struct miscdevice ds1286_dev= | ||
302 | { | ||
303 | .minor = RTC_MINOR, | ||
304 | .name = "rtc", | ||
305 | .fops = &ds1286_fops, | ||
306 | }; | ||
307 | |||
308 | static 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 | |||
326 | out_deregister: | ||
327 | misc_deregister(&ds1286_dev); | ||
328 | |||
329 | out: | ||
330 | return err; | ||
331 | } | ||
332 | |||
333 | static void __exit ds1286_exit(void) | ||
334 | { | ||
335 | remove_proc_entry("driver/rtc", NULL); | ||
336 | misc_deregister(&ds1286_dev); | ||
337 | } | ||
338 | |||
339 | static char *days[] = { | ||
340 | "***", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" | ||
341 | }; | ||
342 | |||
343 | /* | ||
344 | * Info exported via "/proc/rtc". | ||
345 | */ | ||
346 | static 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 | |||
418 | static 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 | */ | ||
436 | static inline unsigned char ds1286_is_updating(void) | ||
437 | { | ||
438 | return rtc_read(RTC_CMD) & RTC_TE; | ||
439 | } | ||
440 | |||
441 | |||
442 | static 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 | |||
499 | static 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 | |||
559 | static 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 | |||
580 | module_init(ds1286_init); | ||
581 | module_exit(ds1286_exit); | ||
582 | |||
583 | MODULE_AUTHOR("Ralf Baechle"); | ||
584 | MODULE_LICENSE("GPL"); | ||
585 | MODULE_ALIAS_MISCDEV(RTC_MINOR); | ||
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 408f5f92cb4e..53fdc7ff3870 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -427,9 +427,6 @@ static int hpet_release(struct inode *inode, struct file *file) | |||
427 | if (irq) | 427 | if (irq) |
428 | free_irq(irq, devp); | 428 | free_irq(irq, devp); |
429 | 429 | ||
430 | if (file->f_flags & FASYNC) | ||
431 | hpet_fasync(-1, file, 0); | ||
432 | |||
433 | file->private_data = NULL; | 430 | file->private_data = NULL; |
434 | return 0; | 431 | return 0; |
435 | } | 432 | } |
diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c index c422e870dc52..cd0ba51f7c80 100644 --- a/drivers/char/hw_random/amd-rng.c +++ b/drivers/char/hw_random/amd-rng.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * derived from | 11 | * derived from |
12 | * | 12 | * |
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | 13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) |
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | 14 | * (c) Copyright 2001 Red Hat Inc |
15 | * | 15 | * |
16 | * derived from | 16 | * derived from |
17 | * | 17 | * |
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c index fed4ef5569f5..64d513f68368 100644 --- a/drivers/char/hw_random/geode-rng.c +++ b/drivers/char/hw_random/geode-rng.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * derived from | 11 | * derived from |
12 | * | 12 | * |
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | 13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) |
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | 14 | * (c) Copyright 2001 Red Hat Inc |
15 | * | 15 | * |
16 | * derived from | 16 | * derived from |
17 | * | 17 | * |
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 8a2fce0756ec..5dcbe603eca2 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * derived from | 11 | * derived from |
12 | * | 12 | * |
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | 13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) |
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | 14 | * (c) Copyright 2001 Red Hat Inc |
15 | * | 15 | * |
16 | * derived from | 16 | * derived from |
17 | * | 17 | * |
diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c index 128202e18fc9..4e9573c1d39e 100644 --- a/drivers/char/hw_random/via-rng.c +++ b/drivers/char/hw_random/via-rng.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * derived from | 11 | * derived from |
12 | * | 12 | * |
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | 13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) |
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | 14 | * (c) Copyright 2001 Red Hat Inc |
15 | * | 15 | * |
16 | * derived from | 16 | * derived from |
17 | * | 17 | * |
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 | |||
50 | static long rtc_ioctl(struct file *filp, unsigned int cmd, | ||
51 | unsigned long arg); | ||
52 | |||
53 | static int rtc_read_proc(char *page, char **start, off_t off, | ||
54 | int count, int *eof, void *data); | ||
55 | |||
56 | static 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 | |||
65 | static unsigned char rtc_status; /* bitmapped status byte. */ | ||
66 | static unsigned long rtc_freq; /* Current periodic IRQ rate */ | ||
67 | static 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 | |||
74 | static unsigned long epoch = 1970; /* year corresponding to 0x00 */ | ||
75 | |||
76 | static const unsigned char days_in_mo[] = | ||
77 | {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | ||
78 | |||
79 | static 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 | |||
165 | static 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 | |||
183 | static 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 | |||
201 | static 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 | |||
208 | static struct miscdevice rtc_dev= | ||
209 | { | ||
210 | RTC_MINOR, | ||
211 | "rtc", | ||
212 | &rtc_fops | ||
213 | }; | ||
214 | |||
215 | static 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 | |||
236 | static 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 | |||
244 | module_init(rtc_init); | ||
245 | module_exit(rtc_exit); | ||
246 | |||
247 | /* | ||
248 | * Info exported via "/proc/rtc". | ||
249 | */ | ||
250 | |||
251 | static 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 | |||
279 | static 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 | |||
291 | static 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..41fc11dc921c 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -162,8 +162,6 @@ static int ipmi_release(struct inode *inode, struct file *file) | |||
162 | if (rv) | 162 | if (rv) |
163 | return rv; | 163 | return rv; |
164 | 164 | ||
165 | ipmi_fasync (-1, file, 0); | ||
166 | |||
167 | /* FIXME - free the messages in the list. */ | 165 | /* FIXME - free the messages in the list. */ |
168 | kfree(priv); | 166 | kfree(priv); |
169 | 167 | ||
@@ -957,3 +955,4 @@ module_exit(cleanup_ipmi); | |||
957 | MODULE_LICENSE("GPL"); | 955 | MODULE_LICENSE("GPL"); |
958 | MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); | 956 | MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); |
959 | MODULE_DESCRIPTION("Linux device interface for the IPMI message handler."); | 957 | MODULE_DESCRIPTION("Linux device interface for the IPMI message handler."); |
958 | MODULE_ALIAS("platform:ipmi_si"); | ||
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 235fab0bdf79..a4d57e31f713 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -870,7 +870,6 @@ static int ipmi_close(struct inode *ino, struct file *filep) | |||
870 | clear_bit(0, &ipmi_wdog_open); | 870 | clear_bit(0, &ipmi_wdog_open); |
871 | } | 871 | } |
872 | 872 | ||
873 | ipmi_fasync(-1, filep, 0); | ||
874 | expect_close = 0; | 873 | expect_close = 0; |
875 | 874 | ||
876 | return 0; | 875 | return 0; |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 7d30ee1d3fca..04e4549299ba 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -7,12 +7,14 @@ | |||
7 | * Original driver code supplied by Multi-Tech | 7 | * Original driver code supplied by Multi-Tech |
8 | * | 8 | * |
9 | * Changes | 9 | * Changes |
10 | * 1/9/98 alan@redhat.com Merge to 2.0.x kernel tree | 10 | * 1/9/98 alan@lxorguk.ukuu.org.uk |
11 | * Merge to 2.0.x kernel tree | ||
11 | * Obtain and use official major/minors | 12 | * Obtain and use official major/minors |
12 | * Loader switched to a misc device | 13 | * Loader switched to a misc device |
13 | * (fixed range check bug as a side effect) | 14 | * (fixed range check bug as a side effect) |
14 | * Printk clean up | 15 | * Printk clean up |
15 | * 9/12/98 alan@redhat.com Rough port to 2.1.x | 16 | * 9/12/98 alan@lxorguk.ukuu.org.uk |
17 | * Rough port to 2.1.x | ||
16 | * | 18 | * |
17 | * 10/6/99 sameer Merged the ISA and PCI drivers to | 19 | * 10/6/99 sameer Merged the ISA and PCI drivers to |
18 | * a new unified driver. | 20 | * a new unified driver. |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 8beef50f95a0..047766915411 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -14,7 +14,8 @@ | |||
14 | * (at your option) any later version. | 14 | * (at your option) any later version. |
15 | * | 15 | * |
16 | * Fed through a cleanup, indent and remove of non 2.6 code by Alan Cox | 16 | * Fed through a cleanup, indent and remove of non 2.6 code by Alan Cox |
17 | * <alan@redhat.com>. The original 1.8 code is available on www.moxa.com. | 17 | * <alan@lxorguk.ukuu.org.uk>. The original 1.8 code is available on |
18 | * www.moxa.com. | ||
18 | * - Fixed x86_64 cleanness | 19 | * - Fixed x86_64 cleanness |
19 | */ | 20 | */ |
20 | 21 | ||
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/char/random.c b/drivers/char/random.c index 705a839f1796..675076f5fca8 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1139,18 +1139,12 @@ static int random_fasync(int fd, struct file *filp, int on) | |||
1139 | return fasync_helper(fd, filp, on, &fasync); | 1139 | return fasync_helper(fd, filp, on, &fasync); |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static int random_release(struct inode *inode, struct file *filp) | ||
1143 | { | ||
1144 | return fasync_helper(-1, filp, 0, &fasync); | ||
1145 | } | ||
1146 | |||
1147 | const struct file_operations random_fops = { | 1142 | const struct file_operations random_fops = { |
1148 | .read = random_read, | 1143 | .read = random_read, |
1149 | .write = random_write, | 1144 | .write = random_write, |
1150 | .poll = random_poll, | 1145 | .poll = random_poll, |
1151 | .unlocked_ioctl = random_ioctl, | 1146 | .unlocked_ioctl = random_ioctl, |
1152 | .fasync = random_fasync, | 1147 | .fasync = random_fasync, |
1153 | .release = random_release, | ||
1154 | }; | 1148 | }; |
1155 | 1149 | ||
1156 | const struct file_operations urandom_fops = { | 1150 | const struct file_operations urandom_fops = { |
@@ -1158,7 +1152,6 @@ const struct file_operations urandom_fops = { | |||
1158 | .write = random_write, | 1152 | .write = random_write, |
1159 | .unlocked_ioctl = random_ioctl, | 1153 | .unlocked_ioctl = random_ioctl, |
1160 | .fasync = random_fasync, | 1154 | .fasync = random_fasync, |
1161 | .release = random_release, | ||
1162 | }; | 1155 | }; |
1163 | 1156 | ||
1164 | /*************************************************************** | 1157 | /*************************************************************** |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 32dc89720d58..20d6efb6324e 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -788,8 +788,6 @@ static int rtc_release(struct inode *inode, struct file *file) | |||
788 | } | 788 | } |
789 | spin_unlock_irq(&rtc_lock); | 789 | spin_unlock_irq(&rtc_lock); |
790 | 790 | ||
791 | if (file->f_flags & FASYNC) | ||
792 | rtc_fasync(-1, file, 0); | ||
793 | no_irq: | 791 | no_irq: |
794 | #endif | 792 | #endif |
795 | 793 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 85e0eb76eeab..2457b07dabd6 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -898,7 +898,6 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on) | |||
898 | 898 | ||
899 | static int sonypi_misc_release(struct inode *inode, struct file *file) | 899 | static int sonypi_misc_release(struct inode *inode, struct file *file) |
900 | { | 900 | { |
901 | sonypi_misc_fasync(-1, file, 0); | ||
902 | mutex_lock(&sonypi_device.lock); | 901 | mutex_lock(&sonypi_device.lock); |
903 | sonypi_device.open_count--; | 902 | sonypi_device.open_count--; |
904 | mutex_unlock(&sonypi_device.lock); | 903 | mutex_unlock(&sonypi_device.lock); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index d8f83e26e4a4..a5af6072e2b3 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -1644,7 +1644,10 @@ static void reset_terminal(struct vc_data *vc, int do_clear) | |||
1644 | vc->vc_tab_stop[1] = | 1644 | vc->vc_tab_stop[1] = |
1645 | vc->vc_tab_stop[2] = | 1645 | vc->vc_tab_stop[2] = |
1646 | vc->vc_tab_stop[3] = | 1646 | vc->vc_tab_stop[3] = |
1647 | vc->vc_tab_stop[4] = 0x01010101; | 1647 | vc->vc_tab_stop[4] = |
1648 | vc->vc_tab_stop[5] = | ||
1649 | vc->vc_tab_stop[6] = | ||
1650 | vc->vc_tab_stop[7] = 0x01010101; | ||
1648 | 1651 | ||
1649 | vc->vc_bell_pitch = DEFAULT_BELL_PITCH; | 1652 | vc->vc_bell_pitch = DEFAULT_BELL_PITCH; |
1650 | vc->vc_bell_duration = DEFAULT_BELL_DURATION; | 1653 | vc->vc_bell_duration = DEFAULT_BELL_DURATION; |
@@ -1935,7 +1938,10 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | |||
1935 | vc->vc_tab_stop[1] = | 1938 | vc->vc_tab_stop[1] = |
1936 | vc->vc_tab_stop[2] = | 1939 | vc->vc_tab_stop[2] = |
1937 | vc->vc_tab_stop[3] = | 1940 | vc->vc_tab_stop[3] = |
1938 | vc->vc_tab_stop[4] = 0; | 1941 | vc->vc_tab_stop[4] = |
1942 | vc->vc_tab_stop[5] = | ||
1943 | vc->vc_tab_stop[6] = | ||
1944 | vc->vc_tab_stop[7] = 0; | ||
1939 | } | 1945 | } |
1940 | return; | 1946 | return; |
1941 | case 'm': | 1947 | case 'm': |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 5bed73329ef8..8504a2108557 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -65,12 +65,14 @@ static void cpuidle_idle_call(void) | |||
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | 67 | ||
68 | #if 0 | ||
69 | /* shows regressions, re-enable for 2.6.29 */ | ||
68 | /* | 70 | /* |
69 | * run any timers that can be run now, at this point | 71 | * run any timers that can be run now, at this point |
70 | * before calculating the idle duration etc. | 72 | * before calculating the idle duration etc. |
71 | */ | 73 | */ |
72 | hrtimer_peek_ahead_timers(); | 74 | hrtimer_peek_ahead_timers(); |
73 | 75 | #endif | |
74 | /* ask the governor for the next state */ | 76 | /* ask the governor for the next state */ |
75 | next_state = cpuidle_curr_governor->select(dev); | 77 | next_state = cpuidle_curr_governor->select(dev); |
76 | if (need_resched()) | 78 | if (need_resched()) |
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c index ec249d2db633..d883e1b8bb8c 100644 --- a/drivers/dca/dca-core.c +++ b/drivers/dca/dca-core.c | |||
@@ -270,6 +270,6 @@ static void __exit dca_exit(void) | |||
270 | dca_sysfs_exit(); | 270 | dca_sysfs_exit(); |
271 | } | 271 | } |
272 | 272 | ||
273 | module_init(dca_init); | 273 | subsys_initcall(dca_init); |
274 | module_exit(dca_exit); | 274 | module_exit(dca_exit); |
275 | 275 | ||
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 43b8cefad2c6..ecd743f7cc61 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/workqueue.h> | 35 | #include <linux/workqueue.h> |
36 | #include <linux/i7300_idle.h> | ||
36 | #include "ioatdma.h" | 37 | #include "ioatdma.h" |
37 | #include "ioatdma_registers.h" | 38 | #include "ioatdma_registers.h" |
38 | #include "ioatdma_hw.h" | 39 | #include "ioatdma_hw.h" |
@@ -171,8 +172,10 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device) | |||
171 | xfercap_scale = readb(device->reg_base + IOAT_XFERCAP_OFFSET); | 172 | xfercap_scale = readb(device->reg_base + IOAT_XFERCAP_OFFSET); |
172 | xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); | 173 | xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); |
173 | 174 | ||
174 | #if CONFIG_I7300_IDLE_IOAT_CHANNEL | 175 | #ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL |
175 | device->common.chancnt--; | 176 | if (i7300_idle_platform_probe(NULL, NULL) == 0) { |
177 | device->common.chancnt--; | ||
178 | } | ||
176 | #endif | 179 | #endif |
177 | for (i = 0; i < device->common.chancnt; i++) { | 180 | for (i = 0; i < device->common.chancnt; i++) { |
178 | ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); | 181 | ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); |
@@ -522,7 +525,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx) | |||
522 | } | 525 | } |
523 | 526 | ||
524 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 527 | hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
525 | if (new->async_tx.callback) { | 528 | if (first->async_tx.callback) { |
526 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; | 529 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; |
527 | if (first != new) { | 530 | if (first != new) { |
528 | /* move callback into to last desc */ | 531 | /* move callback into to last desc */ |
@@ -614,7 +617,7 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx) | |||
614 | } | 617 | } |
615 | 618 | ||
616 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS; | 619 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_CP_STS; |
617 | if (new->async_tx.callback) { | 620 | if (first->async_tx.callback) { |
618 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; | 621 | hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; |
619 | if (first != new) { | 622 | if (first != new) { |
620 | /* move callback into to last desc */ | 623 | /* move callback into to last desc */ |
@@ -804,6 +807,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
804 | struct ioat_desc_sw *desc, *_desc; | 807 | struct ioat_desc_sw *desc, *_desc; |
805 | int in_use_descs = 0; | 808 | int in_use_descs = 0; |
806 | 809 | ||
810 | /* Before freeing channel resources first check | ||
811 | * if they have been previously allocated for this channel. | ||
812 | */ | ||
813 | if (ioat_chan->desccount == 0) | ||
814 | return; | ||
815 | |||
807 | tasklet_disable(&ioat_chan->cleanup_task); | 816 | tasklet_disable(&ioat_chan->cleanup_task); |
808 | ioat_dma_memcpy_cleanup(ioat_chan); | 817 | ioat_dma_memcpy_cleanup(ioat_chan); |
809 | 818 | ||
@@ -866,6 +875,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
866 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; | 875 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; |
867 | ioat_chan->pending = 0; | 876 | ioat_chan->pending = 0; |
868 | ioat_chan->dmacount = 0; | 877 | ioat_chan->dmacount = 0; |
878 | ioat_chan->desccount = 0; | ||
869 | ioat_chan->watchdog_completion = 0; | 879 | ioat_chan->watchdog_completion = 0; |
870 | ioat_chan->last_compl_desc_addr_hw = 0; | 880 | ioat_chan->last_compl_desc_addr_hw = 0; |
871 | ioat_chan->watchdog_tcp_cookie = | 881 | ioat_chan->watchdog_tcp_cookie = |
diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c index e763d723e4cf..9f6fe46a9b87 100644 --- a/drivers/dma/iovlock.c +++ b/drivers/dma/iovlock.c | |||
@@ -55,7 +55,6 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len) | |||
55 | int nr_iovecs = 0; | 55 | int nr_iovecs = 0; |
56 | int iovec_len_used = 0; | 56 | int iovec_len_used = 0; |
57 | int iovec_pages_used = 0; | 57 | int iovec_pages_used = 0; |
58 | long err; | ||
59 | 58 | ||
60 | /* don't pin down non-user-based iovecs */ | 59 | /* don't pin down non-user-based iovecs */ |
61 | if (segment_eq(get_fs(), KERNEL_DS)) | 60 | if (segment_eq(get_fs(), KERNEL_DS)) |
@@ -72,23 +71,21 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len) | |||
72 | local_list = kmalloc(sizeof(*local_list) | 71 | local_list = kmalloc(sizeof(*local_list) |
73 | + (nr_iovecs * sizeof (struct dma_page_list)) | 72 | + (nr_iovecs * sizeof (struct dma_page_list)) |
74 | + (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL); | 73 | + (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL); |
75 | if (!local_list) { | 74 | if (!local_list) |
76 | err = -ENOMEM; | ||
77 | goto out; | 75 | goto out; |
78 | } | ||
79 | 76 | ||
80 | /* list of pages starts right after the page list array */ | 77 | /* list of pages starts right after the page list array */ |
81 | pages = (struct page **) &local_list->page_list[nr_iovecs]; | 78 | pages = (struct page **) &local_list->page_list[nr_iovecs]; |
82 | 79 | ||
80 | local_list->nr_iovecs = 0; | ||
81 | |||
83 | for (i = 0; i < nr_iovecs; i++) { | 82 | for (i = 0; i < nr_iovecs; i++) { |
84 | struct dma_page_list *page_list = &local_list->page_list[i]; | 83 | struct dma_page_list *page_list = &local_list->page_list[i]; |
85 | 84 | ||
86 | len -= iov[i].iov_len; | 85 | len -= iov[i].iov_len; |
87 | 86 | ||
88 | if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) { | 87 | if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) |
89 | err = -EFAULT; | ||
90 | goto unpin; | 88 | goto unpin; |
91 | } | ||
92 | 89 | ||
93 | page_list->nr_pages = num_pages_spanned(&iov[i]); | 90 | page_list->nr_pages = num_pages_spanned(&iov[i]); |
94 | page_list->base_address = iov[i].iov_base; | 91 | page_list->base_address = iov[i].iov_base; |
@@ -109,10 +106,8 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len) | |||
109 | NULL); | 106 | NULL); |
110 | up_read(¤t->mm->mmap_sem); | 107 | up_read(¤t->mm->mmap_sem); |
111 | 108 | ||
112 | if (ret != page_list->nr_pages) { | 109 | if (ret != page_list->nr_pages) |
113 | err = -ENOMEM; | ||
114 | goto unpin; | 110 | goto unpin; |
115 | } | ||
116 | 111 | ||
117 | local_list->nr_iovecs = i + 1; | 112 | local_list->nr_iovecs = i + 1; |
118 | } | 113 | } |
@@ -122,7 +117,7 @@ struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len) | |||
122 | unpin: | 117 | unpin: |
123 | dma_unpin_iovec_pages(local_list); | 118 | dma_unpin_iovec_pages(local_list); |
124 | out: | 119 | out: |
125 | return ERR_PTR(err); | 120 | return NULL; |
126 | } | 121 | } |
127 | 122 | ||
128 | void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list) | 123 | void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list) |
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 | ||
105 | config 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 | |||
105 | config EDAC_I82860 | 112 | config 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 | |||
26 | obj-$(CONFIG_EDAC_I82875P) += i82875p_edac.o | 26 | obj-$(CONFIG_EDAC_I82875P) += i82875p_edac.o |
27 | obj-$(CONFIG_EDAC_I82975X) += i82975x_edac.o | 27 | obj-$(CONFIG_EDAC_I82975X) += i82975x_edac.o |
28 | obj-$(CONFIG_EDAC_I3000) += i3000_edac.o | 28 | obj-$(CONFIG_EDAC_I3000) += i3000_edac.o |
29 | obj-$(CONFIG_EDAC_X38) += x38_edac.o | ||
29 | obj-$(CONFIG_EDAC_I82860) += i82860_edac.o | 30 | obj-$(CONFIG_EDAC_I82860) += i82860_edac.o |
30 | obj-$(CONFIG_EDAC_R82600) += r82600_edac.o | 31 | obj-$(CONFIG_EDAC_R82600) += r82600_edac.o |
31 | obj-$(CONFIG_EDAC_PASEMI) += pasemi_edac.o | 32 | obj-$(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(®s->mic_mnt_cfg); | 171 | reg = in_be64(®s->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 | |||
99 | static int x38_channel_num; | ||
100 | |||
101 | static 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 | |||
117 | static unsigned long eccerrlog_syndrome(u64 log) | ||
118 | { | ||
119 | return (log & X38_ECCERRLOG_SYNDROME_BITS) >> 16; | ||
120 | } | ||
121 | |||
122 | static int eccerrlog_row(int channel, u64 log) | ||
123 | { | ||
124 | return ((log & X38_ECCERRLOG_RANK_BITS) >> 27) | | ||
125 | (channel * X38_RANKS_PER_CHANNEL); | ||
126 | } | ||
127 | |||
128 | enum x38_chips { | ||
129 | X38 = 0, | ||
130 | }; | ||
131 | |||
132 | struct x38_dev_info { | ||
133 | const char *ctl_name; | ||
134 | }; | ||
135 | |||
136 | struct x38_error_info { | ||
137 | u16 errsts; | ||
138 | u16 errsts2; | ||
139 | u64 eccerrlog[X38_CHANNELS]; | ||
140 | }; | ||
141 | |||
142 | static const struct x38_dev_info x38_devs[] = { | ||
143 | [X38] = { | ||
144 | .ctl_name = "x38"}, | ||
145 | }; | ||
146 | |||
147 | static struct pci_dev *mci_pdev; | ||
148 | static int x38_registered = 1; | ||
149 | |||
150 | |||
151 | static 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 | |||
165 | static u64 x38_readq(const void __iomem *addr) | ||
166 | { | ||
167 | return readl(addr) | (((u64)readl(addr + 4)) << 32); | ||
168 | } | ||
169 | |||
170 | static 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 | |||
209 | static 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 | |||
236 | static 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 | |||
246 | void __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 | |||
278 | static 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 | |||
289 | static 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 | |||
300 | static 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 | |||
318 | static 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 | |||
404 | fail: | ||
405 | iounmap(window); | ||
406 | if (mci) | ||
407 | edac_mc_free(mci); | ||
408 | |||
409 | return rc; | ||
410 | } | ||
411 | |||
412 | static 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 | |||
429 | static 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 | |||
444 | static 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 | |||
453 | MODULE_DEVICE_TABLE(pci, x38_pci_tbl); | ||
454 | |||
455 | static 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 | |||
462 | static 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 | |||
495 | fail1: | ||
496 | pci_unregister_driver(&x38_driver); | ||
497 | |||
498 | fail0: | ||
499 | if (mci_pdev) | ||
500 | pci_dev_put(mci_pdev); | ||
501 | |||
502 | return pci_rc; | ||
503 | } | ||
504 | |||
505 | static 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 | |||
516 | module_init(x38_init); | ||
517 | module_exit(x38_exit); | ||
518 | |||
519 | MODULE_LICENSE("GPL"); | ||
520 | MODULE_AUTHOR("Cluster Computing, Inc. Hitoshi Mitake"); | ||
521 | MODULE_DESCRIPTION("MC support for Intel X38 memory hub controllers"); | ||
522 | |||
523 | module_param(edac_op_state, int, 0444); | ||
524 | MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=Poll,1=NMI"); | ||
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index 3fccdd484100..6b9be42c7b98 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -587,8 +587,7 @@ static void create_units(struct fw_device *device) | |||
587 | unit->device.bus = &fw_bus_type; | 587 | unit->device.bus = &fw_bus_type; |
588 | unit->device.type = &fw_unit_type; | 588 | unit->device.type = &fw_unit_type; |
589 | unit->device.parent = &device->device; | 589 | unit->device.parent = &device->device; |
590 | snprintf(unit->device.bus_id, sizeof(unit->device.bus_id), | 590 | dev_set_name(&unit->device, "%s.%d", dev_name(&device->device), i++); |
591 | "%s.%d", device->device.bus_id, i++); | ||
592 | 591 | ||
593 | init_fw_attribute_group(&unit->device, | 592 | init_fw_attribute_group(&unit->device, |
594 | fw_unit_attributes, | 593 | fw_unit_attributes, |
@@ -711,8 +710,7 @@ static void fw_device_init(struct work_struct *work) | |||
711 | device->device.type = &fw_device_type; | 710 | device->device.type = &fw_device_type; |
712 | device->device.parent = device->card->device; | 711 | device->device.parent = device->card->device; |
713 | device->device.devt = MKDEV(fw_cdev_major, minor); | 712 | device->device.devt = MKDEV(fw_cdev_major, minor); |
714 | snprintf(device->device.bus_id, sizeof(device->device.bus_id), | 713 | dev_set_name(&device->device, "fw%d", minor); |
715 | "fw%d", minor); | ||
716 | 714 | ||
717 | init_fw_attribute_group(&device->device, | 715 | init_fw_attribute_group(&device->device, |
718 | fw_device_attributes, | 716 | fw_device_attributes, |
@@ -741,13 +739,13 @@ static void fw_device_init(struct work_struct *work) | |||
741 | if (device->config_rom_retries) | 739 | if (device->config_rom_retries) |
742 | fw_notify("created device %s: GUID %08x%08x, S%d00, " | 740 | fw_notify("created device %s: GUID %08x%08x, S%d00, " |
743 | "%d config ROM retries\n", | 741 | "%d config ROM retries\n", |
744 | device->device.bus_id, | 742 | dev_name(&device->device), |
745 | device->config_rom[3], device->config_rom[4], | 743 | device->config_rom[3], device->config_rom[4], |
746 | 1 << device->max_speed, | 744 | 1 << device->max_speed, |
747 | device->config_rom_retries); | 745 | device->config_rom_retries); |
748 | else | 746 | else |
749 | fw_notify("created device %s: GUID %08x%08x, S%d00\n", | 747 | fw_notify("created device %s: GUID %08x%08x, S%d00\n", |
750 | device->device.bus_id, | 748 | dev_name(&device->device), |
751 | device->config_rom[3], device->config_rom[4], | 749 | device->config_rom[3], device->config_rom[4], |
752 | 1 << device->max_speed); | 750 | 1 << device->max_speed); |
753 | device->config_rom_retries = 0; | 751 | device->config_rom_retries = 0; |
@@ -883,12 +881,12 @@ static void fw_device_refresh(struct work_struct *work) | |||
883 | FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) | 881 | FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) |
884 | goto gone; | 882 | goto gone; |
885 | 883 | ||
886 | fw_notify("refreshed device %s\n", device->device.bus_id); | 884 | fw_notify("refreshed device %s\n", dev_name(&device->device)); |
887 | device->config_rom_retries = 0; | 885 | device->config_rom_retries = 0; |
888 | goto out; | 886 | goto out; |
889 | 887 | ||
890 | give_up: | 888 | give_up: |
891 | fw_notify("giving up on refresh of device %s\n", device->device.bus_id); | 889 | fw_notify("giving up on refresh of device %s\n", dev_name(&device->device)); |
892 | gone: | 890 | gone: |
893 | atomic_set(&device->state, FW_DEVICE_SHUTDOWN); | 891 | atomic_set(&device->state, FW_DEVICE_SHUTDOWN); |
894 | fw_device_shutdown(work); | 892 | fw_device_shutdown(work); |
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 251416f2148f..46610b090415 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -476,6 +476,7 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
476 | if (ab == NULL) | 476 | if (ab == NULL) |
477 | return -ENOMEM; | 477 | return -ENOMEM; |
478 | 478 | ||
479 | ab->next = NULL; | ||
479 | memset(&ab->descriptor, 0, sizeof(ab->descriptor)); | 480 | memset(&ab->descriptor, 0, sizeof(ab->descriptor)); |
480 | ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | | 481 | ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | |
481 | DESCRIPTOR_STATUS | | 482 | DESCRIPTOR_STATUS | |
@@ -496,6 +497,21 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
496 | return 0; | 497 | return 0; |
497 | } | 498 | } |
498 | 499 | ||
500 | static void ar_context_release(struct ar_context *ctx) | ||
501 | { | ||
502 | struct ar_buffer *ab, *ab_next; | ||
503 | size_t offset; | ||
504 | dma_addr_t ab_bus; | ||
505 | |||
506 | for (ab = ctx->current_buffer; ab; ab = ab_next) { | ||
507 | ab_next = ab->next; | ||
508 | offset = offsetof(struct ar_buffer, data); | ||
509 | ab_bus = le32_to_cpu(ab->descriptor.data_address) - offset; | ||
510 | dma_free_coherent(ctx->ohci->card.device, PAGE_SIZE, | ||
511 | ab, ab_bus); | ||
512 | } | ||
513 | } | ||
514 | |||
499 | #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) | 515 | #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) |
500 | #define cond_le32_to_cpu(v) \ | 516 | #define cond_le32_to_cpu(v) \ |
501 | (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) | 517 | (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) |
@@ -2349,8 +2365,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2349 | 2365 | ||
2350 | ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); | 2366 | ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); |
2351 | if (ohci == NULL) { | 2367 | if (ohci == NULL) { |
2352 | fw_error("Could not malloc fw_ohci data.\n"); | 2368 | err = -ENOMEM; |
2353 | return -ENOMEM; | 2369 | goto fail; |
2354 | } | 2370 | } |
2355 | 2371 | ||
2356 | fw_card_initialize(&ohci->card, &ohci_driver, &dev->dev); | 2372 | fw_card_initialize(&ohci->card, &ohci_driver, &dev->dev); |
@@ -2359,7 +2375,7 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2359 | 2375 | ||
2360 | err = pci_enable_device(dev); | 2376 | err = pci_enable_device(dev); |
2361 | if (err) { | 2377 | if (err) { |
2362 | fw_error("Failed to enable OHCI hardware.\n"); | 2378 | fw_error("Failed to enable OHCI hardware\n"); |
2363 | goto fail_free; | 2379 | goto fail_free; |
2364 | } | 2380 | } |
2365 | 2381 | ||
@@ -2427,9 +2443,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2427 | ohci->ir_context_list = kzalloc(size, GFP_KERNEL); | 2443 | ohci->ir_context_list = kzalloc(size, GFP_KERNEL); |
2428 | 2444 | ||
2429 | if (ohci->it_context_list == NULL || ohci->ir_context_list == NULL) { | 2445 | if (ohci->it_context_list == NULL || ohci->ir_context_list == NULL) { |
2430 | fw_error("Out of memory for it/ir contexts.\n"); | ||
2431 | err = -ENOMEM; | 2446 | err = -ENOMEM; |
2432 | goto fail_registers; | 2447 | goto fail_contexts; |
2433 | } | 2448 | } |
2434 | 2449 | ||
2435 | /* self-id dma buffer allocation */ | 2450 | /* self-id dma buffer allocation */ |
@@ -2438,9 +2453,8 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2438 | &ohci->self_id_bus, | 2453 | &ohci->self_id_bus, |
2439 | GFP_KERNEL); | 2454 | GFP_KERNEL); |
2440 | if (ohci->self_id_cpu == NULL) { | 2455 | if (ohci->self_id_cpu == NULL) { |
2441 | fw_error("Out of memory for self ID buffer.\n"); | ||
2442 | err = -ENOMEM; | 2456 | err = -ENOMEM; |
2443 | goto fail_registers; | 2457 | goto fail_contexts; |
2444 | } | 2458 | } |
2445 | 2459 | ||
2446 | bus_options = reg_read(ohci, OHCI1394_BusOptions); | 2460 | bus_options = reg_read(ohci, OHCI1394_BusOptions); |
@@ -2454,15 +2468,19 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2454 | goto fail_self_id; | 2468 | goto fail_self_id; |
2455 | 2469 | ||
2456 | fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n", | 2470 | fw_notify("Added fw-ohci device %s, OHCI version %x.%x\n", |
2457 | dev->dev.bus_id, version >> 16, version & 0xff); | 2471 | dev_name(&dev->dev), version >> 16, version & 0xff); |
2458 | return 0; | 2472 | return 0; |
2459 | 2473 | ||
2460 | fail_self_id: | 2474 | fail_self_id: |
2461 | dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, | 2475 | dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, |
2462 | ohci->self_id_cpu, ohci->self_id_bus); | 2476 | ohci->self_id_cpu, ohci->self_id_bus); |
2463 | fail_registers: | 2477 | fail_contexts: |
2464 | kfree(ohci->it_context_list); | ||
2465 | kfree(ohci->ir_context_list); | 2478 | kfree(ohci->ir_context_list); |
2479 | kfree(ohci->it_context_list); | ||
2480 | context_release(&ohci->at_response_ctx); | ||
2481 | context_release(&ohci->at_request_ctx); | ||
2482 | ar_context_release(&ohci->ar_response_ctx); | ||
2483 | ar_context_release(&ohci->ar_request_ctx); | ||
2466 | pci_iounmap(dev, ohci->registers); | 2484 | pci_iounmap(dev, ohci->registers); |
2467 | fail_iomem: | 2485 | fail_iomem: |
2468 | pci_release_region(dev, 0); | 2486 | pci_release_region(dev, 0); |
@@ -2471,6 +2489,9 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2471 | fail_free: | 2489 | fail_free: |
2472 | kfree(&ohci->card); | 2490 | kfree(&ohci->card); |
2473 | ohci_pmac_off(dev); | 2491 | ohci_pmac_off(dev); |
2492 | fail: | ||
2493 | if (err == -ENOMEM) | ||
2494 | fw_error("Out of memory\n"); | ||
2474 | 2495 | ||
2475 | return err; | 2496 | return err; |
2476 | } | 2497 | } |
@@ -2491,8 +2512,19 @@ static void pci_remove(struct pci_dev *dev) | |||
2491 | 2512 | ||
2492 | software_reset(ohci); | 2513 | software_reset(ohci); |
2493 | free_irq(dev->irq, ohci); | 2514 | free_irq(dev->irq, ohci); |
2515 | |||
2516 | if (ohci->next_config_rom && ohci->next_config_rom != ohci->config_rom) | ||
2517 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
2518 | ohci->next_config_rom, ohci->next_config_rom_bus); | ||
2519 | if (ohci->config_rom) | ||
2520 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
2521 | ohci->config_rom, ohci->config_rom_bus); | ||
2494 | dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, | 2522 | dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, |
2495 | ohci->self_id_cpu, ohci->self_id_bus); | 2523 | ohci->self_id_cpu, ohci->self_id_bus); |
2524 | ar_context_release(&ohci->ar_request_ctx); | ||
2525 | ar_context_release(&ohci->ar_response_ctx); | ||
2526 | context_release(&ohci->at_request_ctx); | ||
2527 | context_release(&ohci->at_response_ctx); | ||
2496 | kfree(ohci->it_context_list); | 2528 | kfree(ohci->it_context_list); |
2497 | kfree(ohci->ir_context_list); | 2529 | kfree(ohci->ir_context_list); |
2498 | pci_iounmap(dev, ohci->registers); | 2530 | pci_iounmap(dev, ohci->registers); |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index ef0b9b419c27..97df6dac3a82 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -173,6 +173,9 @@ struct sbp2_target { | |||
173 | int blocked; /* ditto */ | 173 | int blocked; /* ditto */ |
174 | }; | 174 | }; |
175 | 175 | ||
176 | /* Impossible login_id, to detect logout attempt before successful login */ | ||
177 | #define INVALID_LOGIN_ID 0x10000 | ||
178 | |||
176 | /* | 179 | /* |
177 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | 180 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be |
178 | * provided in the config rom. Most devices do provide a value, which | 181 | * provided in the config rom. Most devices do provide a value, which |
@@ -788,9 +791,20 @@ static void sbp2_release_target(struct kref *kref) | |||
788 | scsi_remove_device(sdev); | 791 | scsi_remove_device(sdev); |
789 | scsi_device_put(sdev); | 792 | scsi_device_put(sdev); |
790 | } | 793 | } |
791 | sbp2_send_management_orb(lu, tgt->node_id, lu->generation, | 794 | if (lu->login_id != INVALID_LOGIN_ID) { |
792 | SBP2_LOGOUT_REQUEST, lu->login_id, NULL); | 795 | int generation, node_id; |
793 | 796 | /* | |
797 | * tgt->node_id may be obsolete here if we failed | ||
798 | * during initial login or after a bus reset where | ||
799 | * the topology changed. | ||
800 | */ | ||
801 | generation = device->generation; | ||
802 | smp_rmb(); /* node_id vs. generation */ | ||
803 | node_id = device->node_id; | ||
804 | sbp2_send_management_orb(lu, node_id, generation, | ||
805 | SBP2_LOGOUT_REQUEST, | ||
806 | lu->login_id, NULL); | ||
807 | } | ||
794 | fw_core_remove_address_handler(&lu->address_handler); | 808 | fw_core_remove_address_handler(&lu->address_handler); |
795 | list_del(&lu->link); | 809 | list_del(&lu->link); |
796 | kfree(lu); | 810 | kfree(lu); |
@@ -805,19 +819,20 @@ static void sbp2_release_target(struct kref *kref) | |||
805 | 819 | ||
806 | static struct workqueue_struct *sbp2_wq; | 820 | static struct workqueue_struct *sbp2_wq; |
807 | 821 | ||
822 | static void sbp2_target_put(struct sbp2_target *tgt) | ||
823 | { | ||
824 | kref_put(&tgt->kref, sbp2_release_target); | ||
825 | } | ||
826 | |||
808 | /* | 827 | /* |
809 | * Always get the target's kref when scheduling work on one its units. | 828 | * Always get the target's kref when scheduling work on one its units. |
810 | * Each workqueue job is responsible to call sbp2_target_put() upon return. | 829 | * Each workqueue job is responsible to call sbp2_target_put() upon return. |
811 | */ | 830 | */ |
812 | static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay) | 831 | static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay) |
813 | { | 832 | { |
814 | if (queue_delayed_work(sbp2_wq, &lu->work, delay)) | 833 | kref_get(&lu->tgt->kref); |
815 | kref_get(&lu->tgt->kref); | 834 | if (!queue_delayed_work(sbp2_wq, &lu->work, delay)) |
816 | } | 835 | sbp2_target_put(lu->tgt); |
817 | |||
818 | static void sbp2_target_put(struct sbp2_target *tgt) | ||
819 | { | ||
820 | kref_put(&tgt->kref, sbp2_release_target); | ||
821 | } | 836 | } |
822 | 837 | ||
823 | /* | 838 | /* |
@@ -978,6 +993,7 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) | |||
978 | 993 | ||
979 | lu->tgt = tgt; | 994 | lu->tgt = tgt; |
980 | lu->lun = lun_entry & 0xffff; | 995 | lu->lun = lun_entry & 0xffff; |
996 | lu->login_id = INVALID_LOGIN_ID; | ||
981 | lu->retries = 0; | 997 | lu->retries = 0; |
982 | lu->has_sdev = false; | 998 | lu->has_sdev = false; |
983 | lu->blocked = false; | 999 | lu->blocked = false; |
@@ -1119,7 +1135,7 @@ static int sbp2_probe(struct device *dev) | |||
1119 | tgt->unit = unit; | 1135 | tgt->unit = unit; |
1120 | kref_init(&tgt->kref); | 1136 | kref_init(&tgt->kref); |
1121 | INIT_LIST_HEAD(&tgt->lu_list); | 1137 | INIT_LIST_HEAD(&tgt->lu_list); |
1122 | tgt->bus_id = unit->device.bus_id; | 1138 | tgt->bus_id = dev_name(&unit->device); |
1123 | tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; | 1139 | tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; |
1124 | 1140 | ||
1125 | if (fw_device_enable_phys_dma(device) < 0) | 1141 | if (fw_device_enable_phys_dma(device) < 0) |
@@ -1147,7 +1163,7 @@ static int sbp2_probe(struct device *dev) | |||
1147 | 1163 | ||
1148 | /* Do the login in a workqueue so we can easily reschedule retries. */ | 1164 | /* Do the login in a workqueue so we can easily reschedule retries. */ |
1149 | list_for_each_entry(lu, &tgt->lu_list, link) | 1165 | list_for_each_entry(lu, &tgt->lu_list, link) |
1150 | sbp2_queue_work(lu, 0); | 1166 | sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); |
1151 | return 0; | 1167 | return 0; |
1152 | 1168 | ||
1153 | fail_tgt_put: | 1169 | fail_tgt_put: |
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index c1b81077c4a8..5e204713002d 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -413,7 +413,7 @@ static void | |||
413 | update_tree(struct fw_card *card, struct fw_node *root) | 413 | update_tree(struct fw_card *card, struct fw_node *root) |
414 | { | 414 | { |
415 | struct list_head list0, list1; | 415 | struct list_head list0, list1; |
416 | struct fw_node *node0, *node1; | 416 | struct fw_node *node0, *node1, *next1; |
417 | int i, event; | 417 | int i, event; |
418 | 418 | ||
419 | INIT_LIST_HEAD(&list0); | 419 | INIT_LIST_HEAD(&list0); |
@@ -485,7 +485,9 @@ update_tree(struct fw_card *card, struct fw_node *root) | |||
485 | } | 485 | } |
486 | 486 | ||
487 | node0 = fw_node(node0->link.next); | 487 | node0 = fw_node(node0->link.next); |
488 | node1 = fw_node(node1->link.next); | 488 | next1 = fw_node(node1->link.next); |
489 | fw_node_put(node1); | ||
490 | node1 = next1; | ||
489 | } | 491 | } |
490 | } | 492 | } |
491 | 493 | ||
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 027f58ce81ad..aed7dbb17cda 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -248,7 +248,7 @@ struct fw_card { | |||
248 | struct fw_node *local_node; | 248 | struct fw_node *local_node; |
249 | struct fw_node *root_node; | 249 | struct fw_node *root_node; |
250 | struct fw_node *irm_node; | 250 | struct fw_node *irm_node; |
251 | int color; | 251 | u8 color; /* must be u8 to match the definition in struct fw_node */ |
252 | int gap_count; | 252 | int gap_count; |
253 | bool beta_repeaters_present; | 253 | bool beta_repeaters_present; |
254 | 254 | ||
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 3e526b6d00cb..8daf4793ac32 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -81,9 +81,9 @@ static void dmi_table(u8 *buf, int len, int num, | |||
81 | const struct dmi_header *dm = (const struct dmi_header *)data; | 81 | const struct dmi_header *dm = (const struct dmi_header *)data; |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * We want to know the total length (formated area and strings) | 84 | * We want to know the total length (formatted area and |
85 | * before decoding to make sure we won't run off the table in | 85 | * strings) before decoding to make sure we won't run off the |
86 | * dmi_decode or dmi_string | 86 | * table in dmi_decode or dmi_string |
87 | */ | 87 | */ |
88 | data += dm->length; | 88 | data += dm->length; |
89 | while ((data - buf < len - 1) && (data[0] || data[1])) | 89 | while ((data - buf < len - 1) && (data[0] || data[1])) |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 96f416afc3f6..3ab1e9cc4692 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -266,11 +266,19 @@ int drm_init(struct drm_driver *driver) | |||
266 | for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) { | 266 | for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) { |
267 | pid = (struct pci_device_id *)&driver->pci_driver.id_table[i]; | 267 | pid = (struct pci_device_id *)&driver->pci_driver.id_table[i]; |
268 | 268 | ||
269 | /* Loop around setting up a DRM device for each PCI device | ||
270 | * matching our ID and device class. If we had the internal | ||
271 | * function that pci_get_subsys and pci_get_class used, we'd | ||
272 | * be able to just pass pid in instead of doing a two-stage | ||
273 | * thing. | ||
274 | */ | ||
269 | pdev = NULL; | 275 | pdev = NULL; |
270 | /* pass back in pdev to account for multiple identical cards */ | ||
271 | while ((pdev = | 276 | while ((pdev = |
272 | pci_get_subsys(pid->vendor, pid->device, pid->subvendor, | 277 | pci_get_subsys(pid->vendor, pid->device, pid->subvendor, |
273 | pid->subdevice, pdev)) != NULL) { | 278 | pid->subdevice, pdev)) != NULL) { |
279 | if ((pdev->class & pid->class_mask) != pid->class) | ||
280 | continue; | ||
281 | |||
274 | /* stealth mode requires a manual probe */ | 282 | /* stealth mode requires a manual probe */ |
275 | pci_dev_get(pdev); | 283 | pci_dev_get(pdev); |
276 | drm_get_dev(pdev, pid, driver); | 284 | drm_get_dev(pdev, pid, driver); |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 0d46627663b1..78eeed5caaff 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -406,8 +406,6 @@ int drm_release(struct inode *inode, struct file *filp) | |||
406 | if (dev->driver->driver_features & DRIVER_GEM) | 406 | if (dev->driver->driver_features & DRIVER_GEM) |
407 | drm_gem_release(dev, file_priv); | 407 | drm_gem_release(dev, file_priv); |
408 | 408 | ||
409 | drm_fasync(-1, filp, 0); | ||
410 | |||
411 | mutex_lock(&dev->ctxlist_mutex); | 409 | mutex_lock(&dev->ctxlist_mutex); |
412 | if (!list_empty(&dev->ctxlist)) { | 410 | if (!list_empty(&dev->ctxlist)) { |
413 | struct drm_ctx_list *pos, *n; | 411 | struct drm_ctx_list *pos, *n; |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 212a94f715b2..15c8dabc3e97 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -280,8 +280,6 @@ int drm_irq_uninstall(struct drm_device * dev) | |||
280 | 280 | ||
281 | drm_vblank_cleanup(dev); | 281 | drm_vblank_cleanup(dev); |
282 | 282 | ||
283 | dev->locked_tasklet_func = NULL; | ||
284 | |||
285 | return 0; | 283 | return 0; |
286 | } | 284 | } |
287 | EXPORT_SYMBOL(drm_irq_uninstall); | 285 | EXPORT_SYMBOL(drm_irq_uninstall); |
@@ -699,81 +697,3 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
699 | drm_vbl_send_signals(dev, crtc); | 697 | drm_vbl_send_signals(dev, crtc); |
700 | } | 698 | } |
701 | EXPORT_SYMBOL(drm_handle_vblank); | 699 | EXPORT_SYMBOL(drm_handle_vblank); |
702 | |||
703 | /** | ||
704 | * Tasklet wrapper function. | ||
705 | * | ||
706 | * \param data DRM device in disguise. | ||
707 | * | ||
708 | * Attempts to grab the HW lock and calls the driver callback on success. On | ||
709 | * failure, leave the lock marked as contended so the callback can be called | ||
710 | * from drm_unlock(). | ||
711 | */ | ||
712 | static void drm_locked_tasklet_func(unsigned long data) | ||
713 | { | ||
714 | struct drm_device *dev = (struct drm_device *)data; | ||
715 | unsigned long irqflags; | ||
716 | void (*tasklet_func)(struct drm_device *); | ||
717 | |||
718 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | ||
719 | tasklet_func = dev->locked_tasklet_func; | ||
720 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
721 | |||
722 | if (!tasklet_func || | ||
723 | !drm_lock_take(&dev->lock, | ||
724 | DRM_KERNEL_CONTEXT)) { | ||
725 | return; | ||
726 | } | ||
727 | |||
728 | dev->lock.lock_time = jiffies; | ||
729 | atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); | ||
730 | |||
731 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | ||
732 | tasklet_func = dev->locked_tasklet_func; | ||
733 | dev->locked_tasklet_func = NULL; | ||
734 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
735 | |||
736 | if (tasklet_func != NULL) | ||
737 | tasklet_func(dev); | ||
738 | |||
739 | drm_lock_free(&dev->lock, | ||
740 | DRM_KERNEL_CONTEXT); | ||
741 | } | ||
742 | |||
743 | /** | ||
744 | * Schedule a tasklet to call back a driver hook with the HW lock held. | ||
745 | * | ||
746 | * \param dev DRM device. | ||
747 | * \param func Driver callback. | ||
748 | * | ||
749 | * This is intended for triggering actions that require the HW lock from an | ||
750 | * interrupt handler. The lock will be grabbed ASAP after the interrupt handler | ||
751 | * completes. Note that the callback may be called from interrupt or process | ||
752 | * context, it must not make any assumptions about this. Also, the HW lock will | ||
753 | * be held with the kernel context or any client context. | ||
754 | */ | ||
755 | void drm_locked_tasklet(struct drm_device *dev, void (*func)(struct drm_device *)) | ||
756 | { | ||
757 | unsigned long irqflags; | ||
758 | static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0); | ||
759 | |||
760 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ) || | ||
761 | test_bit(TASKLET_STATE_SCHED, &drm_tasklet.state)) | ||
762 | return; | ||
763 | |||
764 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | ||
765 | |||
766 | if (dev->locked_tasklet_func) { | ||
767 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
768 | return; | ||
769 | } | ||
770 | |||
771 | dev->locked_tasklet_func = func; | ||
772 | |||
773 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
774 | |||
775 | drm_tasklet.data = (unsigned long)dev; | ||
776 | |||
777 | tasklet_hi_schedule(&drm_tasklet); | ||
778 | } | ||
779 | EXPORT_SYMBOL(drm_locked_tasklet); | ||
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c index 888159e03d26..1cfa72031f8f 100644 --- a/drivers/gpu/drm/drm_lock.c +++ b/drivers/gpu/drm/drm_lock.c | |||
@@ -154,8 +154,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
154 | int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | 154 | int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) |
155 | { | 155 | { |
156 | struct drm_lock *lock = data; | 156 | struct drm_lock *lock = data; |
157 | unsigned long irqflags; | ||
158 | void (*tasklet_func)(struct drm_device *); | ||
159 | 157 | ||
160 | if (lock->context == DRM_KERNEL_CONTEXT) { | 158 | if (lock->context == DRM_KERNEL_CONTEXT) { |
161 | DRM_ERROR("Process %d using kernel context %d\n", | 159 | DRM_ERROR("Process %d using kernel context %d\n", |
@@ -163,13 +161,6 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
163 | return -EINVAL; | 161 | return -EINVAL; |
164 | } | 162 | } |
165 | 163 | ||
166 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | ||
167 | tasklet_func = dev->locked_tasklet_func; | ||
168 | dev->locked_tasklet_func = NULL; | ||
169 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
170 | if (tasklet_func != NULL) | ||
171 | tasklet_func(dev); | ||
172 | |||
173 | atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); | 164 | atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); |
174 | 165 | ||
175 | /* kernel_context_switch isn't used by any of the x86 drm | 166 | /* kernel_context_switch isn't used by any of the x86 drm |
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 141e33004a76..66c96ec66672 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -92,7 +92,6 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, | |||
92 | 92 | ||
93 | spin_lock_init(&dev->count_lock); | 93 | spin_lock_init(&dev->count_lock); |
94 | spin_lock_init(&dev->drw_lock); | 94 | spin_lock_init(&dev->drw_lock); |
95 | spin_lock_init(&dev->tasklet_lock); | ||
96 | spin_lock_init(&dev->lock.spinlock); | 95 | spin_lock_init(&dev->lock.spinlock); |
97 | init_timer(&dev->timer); | 96 | init_timer(&dev->timer); |
98 | mutex_init(&dev->struct_mutex); | 97 | mutex_init(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 5ba78e4fd2b5..d8fb5d8ee7ea 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile | |||
@@ -3,13 +3,14 @@ | |||
3 | # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. | 3 | # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. |
4 | 4 | ||
5 | ccflags-y := -Iinclude/drm | 5 | ccflags-y := -Iinclude/drm |
6 | i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_opregion.o \ | 6 | i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \ |
7 | i915_suspend.o \ | 7 | i915_suspend.o \ |
8 | i915_gem.o \ | 8 | i915_gem.o \ |
9 | i915_gem_debug.o \ | 9 | i915_gem_debug.o \ |
10 | i915_gem_proc.o \ | 10 | i915_gem_proc.o \ |
11 | i915_gem_tiling.o | 11 | i915_gem_tiling.o |
12 | 12 | ||
13 | i915-$(CONFIG_ACPI) += i915_opregion.o | ||
13 | i915-$(CONFIG_COMPAT) += i915_ioc32.o | 14 | i915-$(CONFIG_COMPAT) += i915_ioc32.o |
14 | 15 | ||
15 | obj-$(CONFIG_DRM_I915) += i915.o | 16 | obj-$(CONFIG_DRM_I915) += i915.o |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 01de536e0211..0d215e38606a 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -154,6 +154,9 @@ static int i915_dma_cleanup(struct drm_device * dev) | |||
154 | if (I915_NEED_GFX_HWS(dev)) | 154 | if (I915_NEED_GFX_HWS(dev)) |
155 | i915_free_hws(dev); | 155 | i915_free_hws(dev); |
156 | 156 | ||
157 | dev_priv->sarea = NULL; | ||
158 | dev_priv->sarea_priv = NULL; | ||
159 | |||
157 | return 0; | 160 | return 0; |
158 | } | 161 | } |
159 | 162 | ||
@@ -442,7 +445,7 @@ static void i915_emit_breadcrumb(struct drm_device *dev) | |||
442 | 445 | ||
443 | BEGIN_LP_RING(4); | 446 | BEGIN_LP_RING(4); |
444 | OUT_RING(MI_STORE_DWORD_INDEX); | 447 | OUT_RING(MI_STORE_DWORD_INDEX); |
445 | OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT); | 448 | OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT); |
446 | OUT_RING(dev_priv->counter); | 449 | OUT_RING(dev_priv->counter); |
447 | OUT_RING(0); | 450 | OUT_RING(0); |
448 | ADVANCE_LP_RING(); | 451 | ADVANCE_LP_RING(); |
@@ -573,7 +576,7 @@ static int i915_dispatch_flip(struct drm_device * dev) | |||
573 | 576 | ||
574 | BEGIN_LP_RING(4); | 577 | BEGIN_LP_RING(4); |
575 | OUT_RING(MI_STORE_DWORD_INDEX); | 578 | OUT_RING(MI_STORE_DWORD_INDEX); |
576 | OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT); | 579 | OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT); |
577 | OUT_RING(dev_priv->counter); | 580 | OUT_RING(dev_priv->counter); |
578 | OUT_RING(0); | 581 | OUT_RING(0); |
579 | ADVANCE_LP_RING(); | 582 | ADVANCE_LP_RING(); |
@@ -608,7 +611,6 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, | |||
608 | struct drm_file *file_priv) | 611 | struct drm_file *file_priv) |
609 | { | 612 | { |
610 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 613 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
611 | u32 *hw_status = dev_priv->hw_status_page; | ||
612 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) | 614 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) |
613 | dev_priv->sarea_priv; | 615 | dev_priv->sarea_priv; |
614 | drm_i915_batchbuffer_t *batch = data; | 616 | drm_i915_batchbuffer_t *batch = data; |
@@ -634,7 +636,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, | |||
634 | mutex_unlock(&dev->struct_mutex); | 636 | mutex_unlock(&dev->struct_mutex); |
635 | 637 | ||
636 | if (sarea_priv) | 638 | if (sarea_priv) |
637 | sarea_priv->last_dispatch = (int)hw_status[5]; | 639 | sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); |
638 | return ret; | 640 | return ret; |
639 | } | 641 | } |
640 | 642 | ||
@@ -642,7 +644,6 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
642 | struct drm_file *file_priv) | 644 | struct drm_file *file_priv) |
643 | { | 645 | { |
644 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 646 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
645 | u32 *hw_status = dev_priv->hw_status_page; | ||
646 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) | 647 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) |
647 | dev_priv->sarea_priv; | 648 | dev_priv->sarea_priv; |
648 | drm_i915_cmdbuffer_t *cmdbuf = data; | 649 | drm_i915_cmdbuffer_t *cmdbuf = data; |
@@ -670,7 +671,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
670 | } | 671 | } |
671 | 672 | ||
672 | if (sarea_priv) | 673 | if (sarea_priv) |
673 | sarea_priv->last_dispatch = (int)hw_status[5]; | 674 | sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); |
674 | return 0; | 675 | return 0; |
675 | } | 676 | } |
676 | 677 | ||
@@ -849,8 +850,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
849 | * be lost or delayed | 850 | * be lost or delayed |
850 | */ | 851 | */ |
851 | if (!IS_I945G(dev) && !IS_I945GM(dev) && !IS_I965GM(dev)) | 852 | if (!IS_I945G(dev) && !IS_I945GM(dev) && !IS_I965GM(dev)) |
852 | if (pci_enable_msi(dev->pdev)) | 853 | pci_enable_msi(dev->pdev); |
853 | DRM_ERROR("failed to enable MSI\n"); | ||
854 | 854 | ||
855 | intel_opregion_init(dev); | 855 | intel_opregion_init(dev); |
856 | 856 | ||
@@ -960,6 +960,7 @@ struct drm_ioctl_desc i915_ioctls[] = { | |||
960 | DRM_IOCTL_DEF(DRM_I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, 0), | 960 | DRM_IOCTL_DEF(DRM_I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, 0), |
961 | DRM_IOCTL_DEF(DRM_I915_GEM_SET_TILING, i915_gem_set_tiling, 0), | 961 | DRM_IOCTL_DEF(DRM_I915_GEM_SET_TILING, i915_gem_set_tiling, 0), |
962 | DRM_IOCTL_DEF(DRM_I915_GEM_GET_TILING, i915_gem_get_tiling, 0), | 962 | DRM_IOCTL_DEF(DRM_I915_GEM_GET_TILING, i915_gem_get_tiling, 0), |
963 | DRM_IOCTL_DEF(DRM_I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, 0), | ||
963 | }; | 964 | }; |
964 | 965 | ||
965 | int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); | 966 | int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index f20ffe17df71..ef1c0b8f8d07 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define _I915_DRV_H_ | 31 | #define _I915_DRV_H_ |
32 | 32 | ||
33 | #include "i915_reg.h" | 33 | #include "i915_reg.h" |
34 | #include <linux/io-mapping.h> | ||
34 | 35 | ||
35 | /* General customization: | 36 | /* General customization: |
36 | */ | 37 | */ |
@@ -87,13 +88,6 @@ struct mem_block { | |||
87 | struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */ | 88 | struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */ |
88 | }; | 89 | }; |
89 | 90 | ||
90 | typedef struct _drm_i915_vbl_swap { | ||
91 | struct list_head head; | ||
92 | drm_drawable_t drw_id; | ||
93 | unsigned int pipe; | ||
94 | unsigned int sequence; | ||
95 | } drm_i915_vbl_swap_t; | ||
96 | |||
97 | struct opregion_header; | 91 | struct opregion_header; |
98 | struct opregion_acpi; | 92 | struct opregion_acpi; |
99 | struct opregion_swsci; | 93 | struct opregion_swsci; |
@@ -145,10 +139,6 @@ typedef struct drm_i915_private { | |||
145 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | 139 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; |
146 | int vblank_pipe; | 140 | int vblank_pipe; |
147 | 141 | ||
148 | spinlock_t swaps_lock; | ||
149 | drm_i915_vbl_swap_t vbl_swaps; | ||
150 | unsigned int swaps_pending; | ||
151 | |||
152 | struct intel_opregion opregion; | 142 | struct intel_opregion opregion; |
153 | 143 | ||
154 | /* Register state */ | 144 | /* Register state */ |
@@ -156,6 +146,7 @@ typedef struct drm_i915_private { | |||
156 | u32 saveDSPACNTR; | 146 | u32 saveDSPACNTR; |
157 | u32 saveDSPBCNTR; | 147 | u32 saveDSPBCNTR; |
158 | u32 saveDSPARB; | 148 | u32 saveDSPARB; |
149 | u32 saveRENDERSTANDBY; | ||
159 | u32 savePIPEACONF; | 150 | u32 savePIPEACONF; |
160 | u32 savePIPEBCONF; | 151 | u32 savePIPEBCONF; |
161 | u32 savePIPEASRC; | 152 | u32 savePIPEASRC; |
@@ -240,12 +231,11 @@ typedef struct drm_i915_private { | |||
240 | u8 saveDACDATA[256*3]; /* 256 3-byte colors */ | 231 | u8 saveDACDATA[256*3]; /* 256 3-byte colors */ |
241 | u8 saveCR[37]; | 232 | u8 saveCR[37]; |
242 | 233 | ||
243 | /** Work task for vblank-related ring access */ | ||
244 | struct work_struct vblank_work; | ||
245 | |||
246 | struct { | 234 | struct { |
247 | struct drm_mm gtt_space; | 235 | struct drm_mm gtt_space; |
248 | 236 | ||
237 | struct io_mapping *gtt_mapping; | ||
238 | |||
249 | /** | 239 | /** |
250 | * List of objects currently involved in rendering from the | 240 | * List of objects currently involved in rendering from the |
251 | * ringbuffer. | 241 | * ringbuffer. |
@@ -441,7 +431,6 @@ extern int i915_irq_wait(struct drm_device *dev, void *data, | |||
441 | void i915_user_irq_get(struct drm_device *dev); | 431 | void i915_user_irq_get(struct drm_device *dev); |
442 | void i915_user_irq_put(struct drm_device *dev); | 432 | void i915_user_irq_put(struct drm_device *dev); |
443 | 433 | ||
444 | extern void i915_vblank_work_handler(struct work_struct *work); | ||
445 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); | 434 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); |
446 | extern void i915_driver_irq_preinstall(struct drm_device * dev); | 435 | extern void i915_driver_irq_preinstall(struct drm_device * dev); |
447 | extern int i915_driver_irq_postinstall(struct drm_device *dev); | 436 | extern int i915_driver_irq_postinstall(struct drm_device *dev); |
@@ -502,6 +491,8 @@ int i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
502 | struct drm_file *file_priv); | 491 | struct drm_file *file_priv); |
503 | int i915_gem_get_tiling(struct drm_device *dev, void *data, | 492 | int i915_gem_get_tiling(struct drm_device *dev, void *data, |
504 | struct drm_file *file_priv); | 493 | struct drm_file *file_priv); |
494 | int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, | ||
495 | struct drm_file *file_priv); | ||
505 | void i915_gem_load(struct drm_device *dev); | 496 | void i915_gem_load(struct drm_device *dev); |
506 | int i915_gem_proc_init(struct drm_minor *minor); | 497 | int i915_gem_proc_init(struct drm_minor *minor); |
507 | void i915_gem_proc_cleanup(struct drm_minor *minor); | 498 | void i915_gem_proc_cleanup(struct drm_minor *minor); |
@@ -539,11 +530,18 @@ extern int i915_restore_state(struct drm_device *dev); | |||
539 | extern int i915_save_state(struct drm_device *dev); | 530 | extern int i915_save_state(struct drm_device *dev); |
540 | extern int i915_restore_state(struct drm_device *dev); | 531 | extern int i915_restore_state(struct drm_device *dev); |
541 | 532 | ||
533 | #ifdef CONFIG_ACPI | ||
542 | /* i915_opregion.c */ | 534 | /* i915_opregion.c */ |
543 | extern int intel_opregion_init(struct drm_device *dev); | 535 | extern int intel_opregion_init(struct drm_device *dev); |
544 | extern void intel_opregion_free(struct drm_device *dev); | 536 | extern void intel_opregion_free(struct drm_device *dev); |
545 | extern void opregion_asle_intr(struct drm_device *dev); | 537 | extern void opregion_asle_intr(struct drm_device *dev); |
546 | extern void opregion_enable_asle(struct drm_device *dev); | 538 | extern void opregion_enable_asle(struct drm_device *dev); |
539 | #else | ||
540 | static inline int intel_opregion_init(struct drm_device *dev) { return 0; } | ||
541 | static inline void intel_opregion_free(struct drm_device *dev) { return; } | ||
542 | static inline void opregion_asle_intr(struct drm_device *dev) { return; } | ||
543 | static inline void opregion_enable_asle(struct drm_device *dev) { return; } | ||
544 | #endif | ||
547 | 545 | ||
548 | /** | 546 | /** |
549 | * Lock test for when it's just for synchronization of ring access. | 547 | * Lock test for when it's just for synchronization of ring access. |
@@ -610,8 +608,9 @@ extern void opregion_enable_asle(struct drm_device *dev); | |||
610 | * The area from dword 0x20 to 0x3ff is available for driver usage. | 608 | * The area from dword 0x20 to 0x3ff is available for driver usage. |
611 | */ | 609 | */ |
612 | #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg]) | 610 | #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg]) |
613 | #define READ_BREADCRUMB(dev_priv) READ_HWSP(dev_priv, 5) | 611 | #define READ_BREADCRUMB(dev_priv) READ_HWSP(dev_priv, I915_BREADCRUMB_INDEX) |
614 | #define I915_GEM_HWS_INDEX 0x20 | 612 | #define I915_GEM_HWS_INDEX 0x20 |
613 | #define I915_BREADCRUMB_INDEX 0x21 | ||
615 | 614 | ||
616 | extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | 615 | extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); |
617 | 616 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 17ae330ff269..6b4a2bd20640 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -79,6 +79,28 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data, | |||
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | int | ||
83 | i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, | ||
84 | struct drm_file *file_priv) | ||
85 | { | ||
86 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
87 | struct drm_i915_gem_get_aperture *args = data; | ||
88 | struct drm_i915_gem_object *obj_priv; | ||
89 | |||
90 | if (!(dev->driver->driver_features & DRIVER_GEM)) | ||
91 | return -ENODEV; | ||
92 | |||
93 | args->aper_size = dev->gtt_total; | ||
94 | args->aper_available_size = args->aper_size; | ||
95 | |||
96 | list_for_each_entry(obj_priv, &dev_priv->mm.active_list, list) { | ||
97 | if (obj_priv->pin_count > 0) | ||
98 | args->aper_available_size -= obj_priv->obj->size; | ||
99 | } | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
82 | 104 | ||
83 | /** | 105 | /** |
84 | * Creates a new mm object and returns a handle to it. | 106 | * Creates a new mm object and returns a handle to it. |
@@ -171,35 +193,50 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
171 | return 0; | 193 | return 0; |
172 | } | 194 | } |
173 | 195 | ||
174 | /* | 196 | /* This is the fast write path which cannot handle |
175 | * Try to write quickly with an atomic kmap. Return true on success. | 197 | * page faults in the source data |
176 | * | ||
177 | * If this fails (which includes a partial write), we'll redo the whole | ||
178 | * thing with the slow version. | ||
179 | * | ||
180 | * This is a workaround for the low performance of iounmap (approximate | ||
181 | * 10% cpu cost on normal 3D workloads). kmap_atomic on HIGHMEM kernels | ||
182 | * happens to let us map card memory without taking IPIs. When the vmap | ||
183 | * rework lands we should be able to dump this hack. | ||
184 | */ | 198 | */ |
185 | static inline int fast_user_write(unsigned long pfn, char __user *user_data, | 199 | |
186 | int l, int o) | 200 | static inline int |
201 | fast_user_write(struct io_mapping *mapping, | ||
202 | loff_t page_base, int page_offset, | ||
203 | char __user *user_data, | ||
204 | int length) | ||
187 | { | 205 | { |
188 | #ifdef CONFIG_HIGHMEM | ||
189 | unsigned long unwritten; | ||
190 | char *vaddr_atomic; | 206 | char *vaddr_atomic; |
207 | unsigned long unwritten; | ||
191 | 208 | ||
192 | vaddr_atomic = kmap_atomic_pfn(pfn, KM_USER0); | 209 | vaddr_atomic = io_mapping_map_atomic_wc(mapping, page_base); |
193 | #if WATCH_PWRITE | 210 | unwritten = __copy_from_user_inatomic_nocache(vaddr_atomic + page_offset, |
194 | DRM_INFO("pwrite i %d o %d l %d pfn %ld vaddr %p\n", | 211 | user_data, length); |
195 | i, o, l, pfn, vaddr_atomic); | 212 | io_mapping_unmap_atomic(vaddr_atomic); |
196 | #endif | 213 | if (unwritten) |
197 | unwritten = __copy_from_user_inatomic_nocache(vaddr_atomic + o, user_data, l); | 214 | return -EFAULT; |
198 | kunmap_atomic(vaddr_atomic, KM_USER0); | 215 | return 0; |
199 | return !unwritten; | 216 | } |
200 | #else | 217 | |
218 | /* Here's the write path which can sleep for | ||
219 | * page faults | ||
220 | */ | ||
221 | |||
222 | static inline int | ||
223 | slow_user_write(struct io_mapping *mapping, | ||
224 | loff_t page_base, int page_offset, | ||
225 | char __user *user_data, | ||
226 | int length) | ||
227 | { | ||
228 | char __iomem *vaddr; | ||
229 | unsigned long unwritten; | ||
230 | |||
231 | vaddr = io_mapping_map_wc(mapping, page_base); | ||
232 | if (vaddr == NULL) | ||
233 | return -EFAULT; | ||
234 | unwritten = __copy_from_user(vaddr + page_offset, | ||
235 | user_data, length); | ||
236 | io_mapping_unmap(vaddr); | ||
237 | if (unwritten) | ||
238 | return -EFAULT; | ||
201 | return 0; | 239 | return 0; |
202 | #endif | ||
203 | } | 240 | } |
204 | 241 | ||
205 | static int | 242 | static int |
@@ -208,10 +245,12 @@ i915_gem_gtt_pwrite(struct drm_device *dev, struct drm_gem_object *obj, | |||
208 | struct drm_file *file_priv) | 245 | struct drm_file *file_priv) |
209 | { | 246 | { |
210 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 247 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
248 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
211 | ssize_t remain; | 249 | ssize_t remain; |
212 | loff_t offset; | 250 | loff_t offset, page_base; |
213 | char __user *user_data; | 251 | char __user *user_data; |
214 | int ret = 0; | 252 | int page_offset, page_length; |
253 | int ret; | ||
215 | 254 | ||
216 | user_data = (char __user *) (uintptr_t) args->data_ptr; | 255 | user_data = (char __user *) (uintptr_t) args->data_ptr; |
217 | remain = args->size; | 256 | remain = args->size; |
@@ -235,57 +274,37 @@ i915_gem_gtt_pwrite(struct drm_device *dev, struct drm_gem_object *obj, | |||
235 | obj_priv->dirty = 1; | 274 | obj_priv->dirty = 1; |
236 | 275 | ||
237 | while (remain > 0) { | 276 | while (remain > 0) { |
238 | unsigned long pfn; | ||
239 | int i, o, l; | ||
240 | |||
241 | /* Operation in this page | 277 | /* Operation in this page |
242 | * | 278 | * |
243 | * i = page number | 279 | * page_base = page offset within aperture |
244 | * o = offset within page | 280 | * page_offset = offset within page |
245 | * l = bytes to copy | 281 | * page_length = bytes to copy for this page |
246 | */ | 282 | */ |
247 | i = offset >> PAGE_SHIFT; | 283 | page_base = (offset & ~(PAGE_SIZE-1)); |
248 | o = offset & (PAGE_SIZE-1); | 284 | page_offset = offset & (PAGE_SIZE-1); |
249 | l = remain; | 285 | page_length = remain; |
250 | if ((o + l) > PAGE_SIZE) | 286 | if ((page_offset + remain) > PAGE_SIZE) |
251 | l = PAGE_SIZE - o; | 287 | page_length = PAGE_SIZE - page_offset; |
252 | 288 | ||
253 | pfn = (dev->agp->base >> PAGE_SHIFT) + i; | 289 | ret = fast_user_write (dev_priv->mm.gtt_mapping, page_base, |
254 | 290 | page_offset, user_data, page_length); | |
255 | if (!fast_user_write(pfn, user_data, l, o)) { | 291 | |
256 | unsigned long unwritten; | 292 | /* If we get a fault while copying data, then (presumably) our |
257 | char __iomem *vaddr; | 293 | * source page isn't available. In this case, use the |
258 | 294 | * non-atomic function | |
259 | vaddr = ioremap_wc(pfn << PAGE_SHIFT, PAGE_SIZE); | 295 | */ |
260 | #if WATCH_PWRITE | 296 | if (ret) { |
261 | DRM_INFO("pwrite slow i %d o %d l %d " | 297 | ret = slow_user_write (dev_priv->mm.gtt_mapping, |
262 | "pfn %ld vaddr %p\n", | 298 | page_base, page_offset, |
263 | i, o, l, pfn, vaddr); | 299 | user_data, page_length); |
264 | #endif | 300 | if (ret) |
265 | if (vaddr == NULL) { | ||
266 | ret = -EFAULT; | ||
267 | goto fail; | ||
268 | } | ||
269 | unwritten = __copy_from_user(vaddr + o, user_data, l); | ||
270 | #if WATCH_PWRITE | ||
271 | DRM_INFO("unwritten %ld\n", unwritten); | ||
272 | #endif | ||
273 | iounmap(vaddr); | ||
274 | if (unwritten) { | ||
275 | ret = -EFAULT; | ||
276 | goto fail; | 301 | goto fail; |
277 | } | ||
278 | } | 302 | } |
279 | 303 | ||
280 | remain -= l; | 304 | remain -= page_length; |
281 | user_data += l; | 305 | user_data += page_length; |
282 | offset += l; | 306 | offset += page_length; |
283 | } | 307 | } |
284 | #if WATCH_PWRITE && 1 | ||
285 | i915_gem_clflush_object(obj); | ||
286 | i915_gem_dump_object(obj, args->offset + args->size, __func__, ~0); | ||
287 | i915_gem_clflush_object(obj); | ||
288 | #endif | ||
289 | 308 | ||
290 | fail: | 309 | fail: |
291 | i915_gem_object_unpin(obj); | 310 | i915_gem_object_unpin(obj); |
@@ -1436,11 +1455,9 @@ i915_gem_object_set_domain_range(struct drm_gem_object *obj, | |||
1436 | read_domains, write_domain); | 1455 | read_domains, write_domain); |
1437 | 1456 | ||
1438 | /* Wait on any GPU rendering to the object to be flushed. */ | 1457 | /* Wait on any GPU rendering to the object to be flushed. */ |
1439 | if (obj->write_domain & ~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT)) { | 1458 | ret = i915_gem_object_wait_rendering(obj); |
1440 | ret = i915_gem_object_wait_rendering(obj); | 1459 | if (ret) |
1441 | if (ret) | 1460 | return ret; |
1442 | return ret; | ||
1443 | } | ||
1444 | 1461 | ||
1445 | if (obj_priv->page_cpu_valid == NULL) { | 1462 | if (obj_priv->page_cpu_valid == NULL) { |
1446 | obj_priv->page_cpu_valid = drm_calloc(1, obj->size / PAGE_SIZE, | 1463 | obj_priv->page_cpu_valid = drm_calloc(1, obj->size / PAGE_SIZE, |
@@ -1503,12 +1520,12 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
1503 | struct drm_i915_gem_exec_object *entry) | 1520 | struct drm_i915_gem_exec_object *entry) |
1504 | { | 1521 | { |
1505 | struct drm_device *dev = obj->dev; | 1522 | struct drm_device *dev = obj->dev; |
1523 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1506 | struct drm_i915_gem_relocation_entry reloc; | 1524 | struct drm_i915_gem_relocation_entry reloc; |
1507 | struct drm_i915_gem_relocation_entry __user *relocs; | 1525 | struct drm_i915_gem_relocation_entry __user *relocs; |
1508 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 1526 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
1509 | int i, ret; | 1527 | int i, ret; |
1510 | uint32_t last_reloc_offset = -1; | 1528 | void __iomem *reloc_page; |
1511 | void __iomem *reloc_page = NULL; | ||
1512 | 1529 | ||
1513 | /* Choose the GTT offset for our buffer and put it there. */ | 1530 | /* Choose the GTT offset for our buffer and put it there. */ |
1514 | ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); | 1531 | ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); |
@@ -1631,26 +1648,11 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
1631 | * perform. | 1648 | * perform. |
1632 | */ | 1649 | */ |
1633 | reloc_offset = obj_priv->gtt_offset + reloc.offset; | 1650 | reloc_offset = obj_priv->gtt_offset + reloc.offset; |
1634 | if (reloc_page == NULL || | 1651 | reloc_page = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, |
1635 | (last_reloc_offset & ~(PAGE_SIZE - 1)) != | 1652 | (reloc_offset & |
1636 | (reloc_offset & ~(PAGE_SIZE - 1))) { | 1653 | ~(PAGE_SIZE - 1))); |
1637 | if (reloc_page != NULL) | ||
1638 | iounmap(reloc_page); | ||
1639 | |||
1640 | reloc_page = ioremap_wc(dev->agp->base + | ||
1641 | (reloc_offset & | ||
1642 | ~(PAGE_SIZE - 1)), | ||
1643 | PAGE_SIZE); | ||
1644 | last_reloc_offset = reloc_offset; | ||
1645 | if (reloc_page == NULL) { | ||
1646 | drm_gem_object_unreference(target_obj); | ||
1647 | i915_gem_object_unpin(obj); | ||
1648 | return -ENOMEM; | ||
1649 | } | ||
1650 | } | ||
1651 | |||
1652 | reloc_entry = (uint32_t __iomem *)(reloc_page + | 1654 | reloc_entry = (uint32_t __iomem *)(reloc_page + |
1653 | (reloc_offset & (PAGE_SIZE - 1))); | 1655 | (reloc_offset & (PAGE_SIZE - 1))); |
1654 | reloc_val = target_obj_priv->gtt_offset + reloc.delta; | 1656 | reloc_val = target_obj_priv->gtt_offset + reloc.delta; |
1655 | 1657 | ||
1656 | #if WATCH_BUF | 1658 | #if WATCH_BUF |
@@ -1659,6 +1661,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
1659 | readl(reloc_entry), reloc_val); | 1661 | readl(reloc_entry), reloc_val); |
1660 | #endif | 1662 | #endif |
1661 | writel(reloc_val, reloc_entry); | 1663 | writel(reloc_val, reloc_entry); |
1664 | io_mapping_unmap_atomic(reloc_page); | ||
1662 | 1665 | ||
1663 | /* Write the updated presumed offset for this entry back out | 1666 | /* Write the updated presumed offset for this entry back out |
1664 | * to the user. | 1667 | * to the user. |
@@ -1674,9 +1677,6 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
1674 | drm_gem_object_unreference(target_obj); | 1677 | drm_gem_object_unreference(target_obj); |
1675 | } | 1678 | } |
1676 | 1679 | ||
1677 | if (reloc_page != NULL) | ||
1678 | iounmap(reloc_page); | ||
1679 | |||
1680 | #if WATCH_BUF | 1680 | #if WATCH_BUF |
1681 | if (0) | 1681 | if (0) |
1682 | i915_gem_dump_object(obj, 128, __func__, ~0); | 1682 | i915_gem_dump_object(obj, 128, __func__, ~0); |
@@ -2518,6 +2518,10 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, | |||
2518 | if (ret != 0) | 2518 | if (ret != 0) |
2519 | return ret; | 2519 | return ret; |
2520 | 2520 | ||
2521 | dev_priv->mm.gtt_mapping = io_mapping_create_wc(dev->agp->base, | ||
2522 | dev->agp->agp_info.aper_size | ||
2523 | * 1024 * 1024); | ||
2524 | |||
2521 | mutex_lock(&dev->struct_mutex); | 2525 | mutex_lock(&dev->struct_mutex); |
2522 | BUG_ON(!list_empty(&dev_priv->mm.active_list)); | 2526 | BUG_ON(!list_empty(&dev_priv->mm.active_list)); |
2523 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); | 2527 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); |
@@ -2535,11 +2539,13 @@ int | |||
2535 | i915_gem_leavevt_ioctl(struct drm_device *dev, void *data, | 2539 | i915_gem_leavevt_ioctl(struct drm_device *dev, void *data, |
2536 | struct drm_file *file_priv) | 2540 | struct drm_file *file_priv) |
2537 | { | 2541 | { |
2542 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
2538 | int ret; | 2543 | int ret; |
2539 | 2544 | ||
2540 | ret = i915_gem_idle(dev); | 2545 | ret = i915_gem_idle(dev); |
2541 | drm_irq_uninstall(dev); | 2546 | drm_irq_uninstall(dev); |
2542 | 2547 | ||
2548 | io_mapping_free(dev_priv->mm.gtt_mapping); | ||
2543 | return ret; | 2549 | return ret; |
2544 | } | 2550 | } |
2545 | 2551 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 26f48932a51e..82752d6177a4 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -80,211 +80,6 @@ i915_pipe_enabled(struct drm_device *dev, int pipe) | |||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | ||
84 | * Emit blits for scheduled buffer swaps. | ||
85 | * | ||
86 | * This function will be called with the HW lock held. | ||
87 | * Because this function must grab the ring mutex (dev->struct_mutex), | ||
88 | * it can no longer run at soft irq time. We'll fix this when we do | ||
89 | * the DRI2 swap buffer work. | ||
90 | */ | ||
91 | static void i915_vblank_tasklet(struct drm_device *dev) | ||
92 | { | ||
93 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
94 | unsigned long irqflags; | ||
95 | struct list_head *list, *tmp, hits, *hit; | ||
96 | int nhits, nrects, slice[2], upper[2], lower[2], i; | ||
97 | unsigned counter[2]; | ||
98 | struct drm_drawable_info *drw; | ||
99 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; | ||
100 | u32 cpp = dev_priv->cpp; | ||
101 | u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | | ||
102 | XY_SRC_COPY_BLT_WRITE_ALPHA | | ||
103 | XY_SRC_COPY_BLT_WRITE_RGB) | ||
104 | : XY_SRC_COPY_BLT_CMD; | ||
105 | u32 src_pitch = sarea_priv->pitch * cpp; | ||
106 | u32 dst_pitch = sarea_priv->pitch * cpp; | ||
107 | u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); | ||
108 | RING_LOCALS; | ||
109 | |||
110 | mutex_lock(&dev->struct_mutex); | ||
111 | |||
112 | if (IS_I965G(dev) && sarea_priv->front_tiled) { | ||
113 | cmd |= XY_SRC_COPY_BLT_DST_TILED; | ||
114 | dst_pitch >>= 2; | ||
115 | } | ||
116 | if (IS_I965G(dev) && sarea_priv->back_tiled) { | ||
117 | cmd |= XY_SRC_COPY_BLT_SRC_TILED; | ||
118 | src_pitch >>= 2; | ||
119 | } | ||
120 | |||
121 | counter[0] = drm_vblank_count(dev, 0); | ||
122 | counter[1] = drm_vblank_count(dev, 1); | ||
123 | |||
124 | DRM_DEBUG("\n"); | ||
125 | |||
126 | INIT_LIST_HEAD(&hits); | ||
127 | |||
128 | nhits = nrects = 0; | ||
129 | |||
130 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); | ||
131 | |||
132 | /* Find buffer swaps scheduled for this vertical blank */ | ||
133 | list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) { | ||
134 | drm_i915_vbl_swap_t *vbl_swap = | ||
135 | list_entry(list, drm_i915_vbl_swap_t, head); | ||
136 | int pipe = vbl_swap->pipe; | ||
137 | |||
138 | if ((counter[pipe] - vbl_swap->sequence) > (1<<23)) | ||
139 | continue; | ||
140 | |||
141 | list_del(list); | ||
142 | dev_priv->swaps_pending--; | ||
143 | drm_vblank_put(dev, pipe); | ||
144 | |||
145 | spin_unlock(&dev_priv->swaps_lock); | ||
146 | spin_lock(&dev->drw_lock); | ||
147 | |||
148 | drw = drm_get_drawable_info(dev, vbl_swap->drw_id); | ||
149 | |||
150 | list_for_each(hit, &hits) { | ||
151 | drm_i915_vbl_swap_t *swap_cmp = | ||
152 | list_entry(hit, drm_i915_vbl_swap_t, head); | ||
153 | struct drm_drawable_info *drw_cmp = | ||
154 | drm_get_drawable_info(dev, swap_cmp->drw_id); | ||
155 | |||
156 | /* Make sure both drawables are still | ||
157 | * around and have some rectangles before | ||
158 | * we look inside to order them for the | ||
159 | * blts below. | ||
160 | */ | ||
161 | if (drw_cmp && drw_cmp->num_rects > 0 && | ||
162 | drw && drw->num_rects > 0 && | ||
163 | drw_cmp->rects[0].y1 > drw->rects[0].y1) { | ||
164 | list_add_tail(list, hit); | ||
165 | break; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | spin_unlock(&dev->drw_lock); | ||
170 | |||
171 | /* List of hits was empty, or we reached the end of it */ | ||
172 | if (hit == &hits) | ||
173 | list_add_tail(list, hits.prev); | ||
174 | |||
175 | nhits++; | ||
176 | |||
177 | spin_lock(&dev_priv->swaps_lock); | ||
178 | } | ||
179 | |||
180 | if (nhits == 0) { | ||
181 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | ||
182 | mutex_unlock(&dev->struct_mutex); | ||
183 | return; | ||
184 | } | ||
185 | |||
186 | spin_unlock(&dev_priv->swaps_lock); | ||
187 | |||
188 | i915_kernel_lost_context(dev); | ||
189 | |||
190 | if (IS_I965G(dev)) { | ||
191 | BEGIN_LP_RING(4); | ||
192 | |||
193 | OUT_RING(GFX_OP_DRAWRECT_INFO_I965); | ||
194 | OUT_RING(0); | ||
195 | OUT_RING(((sarea_priv->width - 1) & 0xffff) | ((sarea_priv->height - 1) << 16)); | ||
196 | OUT_RING(0); | ||
197 | ADVANCE_LP_RING(); | ||
198 | } else { | ||
199 | BEGIN_LP_RING(6); | ||
200 | |||
201 | OUT_RING(GFX_OP_DRAWRECT_INFO); | ||
202 | OUT_RING(0); | ||
203 | OUT_RING(0); | ||
204 | OUT_RING(sarea_priv->width | sarea_priv->height << 16); | ||
205 | OUT_RING(sarea_priv->width | sarea_priv->height << 16); | ||
206 | OUT_RING(0); | ||
207 | |||
208 | ADVANCE_LP_RING(); | ||
209 | } | ||
210 | |||
211 | sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT; | ||
212 | |||
213 | upper[0] = upper[1] = 0; | ||
214 | slice[0] = max(sarea_priv->pipeA_h / nhits, 1); | ||
215 | slice[1] = max(sarea_priv->pipeB_h / nhits, 1); | ||
216 | lower[0] = sarea_priv->pipeA_y + slice[0]; | ||
217 | lower[1] = sarea_priv->pipeB_y + slice[0]; | ||
218 | |||
219 | spin_lock(&dev->drw_lock); | ||
220 | |||
221 | /* Emit blits for buffer swaps, partitioning both outputs into as many | ||
222 | * slices as there are buffer swaps scheduled in order to avoid tearing | ||
223 | * (based on the assumption that a single buffer swap would always | ||
224 | * complete before scanout starts). | ||
225 | */ | ||
226 | for (i = 0; i++ < nhits; | ||
227 | upper[0] = lower[0], lower[0] += slice[0], | ||
228 | upper[1] = lower[1], lower[1] += slice[1]) { | ||
229 | if (i == nhits) | ||
230 | lower[0] = lower[1] = sarea_priv->height; | ||
231 | |||
232 | list_for_each(hit, &hits) { | ||
233 | drm_i915_vbl_swap_t *swap_hit = | ||
234 | list_entry(hit, drm_i915_vbl_swap_t, head); | ||
235 | struct drm_clip_rect *rect; | ||
236 | int num_rects, pipe; | ||
237 | unsigned short top, bottom; | ||
238 | |||
239 | drw = drm_get_drawable_info(dev, swap_hit->drw_id); | ||
240 | |||
241 | /* The drawable may have been destroyed since | ||
242 | * the vblank swap was queued | ||
243 | */ | ||
244 | if (!drw) | ||
245 | continue; | ||
246 | |||
247 | rect = drw->rects; | ||
248 | pipe = swap_hit->pipe; | ||
249 | top = upper[pipe]; | ||
250 | bottom = lower[pipe]; | ||
251 | |||
252 | for (num_rects = drw->num_rects; num_rects--; rect++) { | ||
253 | int y1 = max(rect->y1, top); | ||
254 | int y2 = min(rect->y2, bottom); | ||
255 | |||
256 | if (y1 >= y2) | ||
257 | continue; | ||
258 | |||
259 | BEGIN_LP_RING(8); | ||
260 | |||
261 | OUT_RING(cmd); | ||
262 | OUT_RING(ropcpp | dst_pitch); | ||
263 | OUT_RING((y1 << 16) | rect->x1); | ||
264 | OUT_RING((y2 << 16) | rect->x2); | ||
265 | OUT_RING(sarea_priv->front_offset); | ||
266 | OUT_RING((y1 << 16) | rect->x1); | ||
267 | OUT_RING(src_pitch); | ||
268 | OUT_RING(sarea_priv->back_offset); | ||
269 | |||
270 | ADVANCE_LP_RING(); | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | |||
275 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | ||
276 | mutex_unlock(&dev->struct_mutex); | ||
277 | |||
278 | list_for_each_safe(hit, tmp, &hits) { | ||
279 | drm_i915_vbl_swap_t *swap_hit = | ||
280 | list_entry(hit, drm_i915_vbl_swap_t, head); | ||
281 | |||
282 | list_del(hit); | ||
283 | |||
284 | drm_free(swap_hit, sizeof(*swap_hit), DRM_MEM_DRIVER); | ||
285 | } | ||
286 | } | ||
287 | |||
288 | /* Called from drm generic code, passed a 'crtc', which | 83 | /* Called from drm generic code, passed a 'crtc', which |
289 | * we use as a pipe index | 84 | * we use as a pipe index |
290 | */ | 85 | */ |
@@ -322,40 +117,6 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int pipe) | |||
322 | return count; | 117 | return count; |
323 | } | 118 | } |
324 | 119 | ||
325 | void | ||
326 | i915_vblank_work_handler(struct work_struct *work) | ||
327 | { | ||
328 | drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t, | ||
329 | vblank_work); | ||
330 | struct drm_device *dev = dev_priv->dev; | ||
331 | unsigned long irqflags; | ||
332 | |||
333 | if (dev->lock.hw_lock == NULL) { | ||
334 | i915_vblank_tasklet(dev); | ||
335 | return; | ||
336 | } | ||
337 | |||
338 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | ||
339 | dev->locked_tasklet_func = i915_vblank_tasklet; | ||
340 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
341 | |||
342 | /* Try to get the lock now, if this fails, the lock | ||
343 | * holder will execute the tasklet during unlock | ||
344 | */ | ||
345 | if (!drm_lock_take(&dev->lock, DRM_KERNEL_CONTEXT)) | ||
346 | return; | ||
347 | |||
348 | dev->lock.lock_time = jiffies; | ||
349 | atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); | ||
350 | |||
351 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | ||
352 | dev->locked_tasklet_func = NULL; | ||
353 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
354 | |||
355 | i915_vblank_tasklet(dev); | ||
356 | drm_lock_free(&dev->lock, DRM_KERNEL_CONTEXT); | ||
357 | } | ||
358 | |||
359 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 120 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
360 | { | 121 | { |
361 | struct drm_device *dev = (struct drm_device *) arg; | 122 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -433,9 +194,6 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
433 | if (iir & I915_ASLE_INTERRUPT) | 194 | if (iir & I915_ASLE_INTERRUPT) |
434 | opregion_asle_intr(dev); | 195 | opregion_asle_intr(dev); |
435 | 196 | ||
436 | if (vblank && dev_priv->swaps_pending > 0) | ||
437 | schedule_work(&dev_priv->vblank_work); | ||
438 | |||
439 | return IRQ_HANDLED; | 197 | return IRQ_HANDLED; |
440 | } | 198 | } |
441 | 199 | ||
@@ -454,12 +212,10 @@ static int i915_emit_irq(struct drm_device * dev) | |||
454 | if (dev_priv->sarea_priv) | 212 | if (dev_priv->sarea_priv) |
455 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter; | 213 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter; |
456 | 214 | ||
457 | BEGIN_LP_RING(6); | 215 | BEGIN_LP_RING(4); |
458 | OUT_RING(MI_STORE_DWORD_INDEX); | 216 | OUT_RING(MI_STORE_DWORD_INDEX); |
459 | OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT); | 217 | OUT_RING(I915_BREADCRUMB_INDEX << MI_STORE_DWORD_INDEX_SHIFT); |
460 | OUT_RING(dev_priv->counter); | 218 | OUT_RING(dev_priv->counter); |
461 | OUT_RING(0); | ||
462 | OUT_RING(0); | ||
463 | OUT_RING(MI_USER_INTERRUPT); | 219 | OUT_RING(MI_USER_INTERRUPT); |
464 | ADVANCE_LP_RING(); | 220 | ADVANCE_LP_RING(); |
465 | 221 | ||
@@ -696,123 +452,21 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data, | |||
696 | int i915_vblank_swap(struct drm_device *dev, void *data, | 452 | int i915_vblank_swap(struct drm_device *dev, void *data, |
697 | struct drm_file *file_priv) | 453 | struct drm_file *file_priv) |
698 | { | 454 | { |
699 | drm_i915_private_t *dev_priv = dev->dev_private; | 455 | /* The delayed swap mechanism was fundamentally racy, and has been |
700 | drm_i915_vblank_swap_t *swap = data; | 456 | * removed. The model was that the client requested a delayed flip/swap |
701 | drm_i915_vbl_swap_t *vbl_swap, *vbl_old; | 457 | * from the kernel, then waited for vblank before continuing to perform |
702 | unsigned int pipe, seqtype, curseq; | 458 | * rendering. The problem was that the kernel might wake the client |
703 | unsigned long irqflags; | 459 | * up before it dispatched the vblank swap (since the lock has to be |
704 | struct list_head *list; | 460 | * held while touching the ringbuffer), in which case the client would |
705 | int ret; | 461 | * clear and start the next frame before the swap occurred, and |
706 | 462 | * flicker would occur in addition to likely missing the vblank. | |
707 | if (!dev_priv || !dev_priv->sarea_priv) { | 463 | * |
708 | DRM_ERROR("%s called with no initialization\n", __func__); | 464 | * In the absence of this ioctl, userland falls back to a correct path |
709 | return -EINVAL; | 465 | * of waiting for a vblank, then dispatching the swap on its own. |
710 | } | 466 | * Context switching to userland and back is plenty fast enough for |
711 | 467 | * meeting the requirements of vblank swapping. | |
712 | if (dev_priv->sarea_priv->rotation) { | ||
713 | DRM_DEBUG("Rotation not supported\n"); | ||
714 | return -EINVAL; | ||
715 | } | ||
716 | |||
717 | if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | | ||
718 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) { | ||
719 | DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); | ||
720 | return -EINVAL; | ||
721 | } | ||
722 | |||
723 | pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; | ||
724 | |||
725 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); | ||
726 | |||
727 | if (!(dev_priv->vblank_pipe & (1 << pipe))) { | ||
728 | DRM_ERROR("Invalid pipe %d\n", pipe); | ||
729 | return -EINVAL; | ||
730 | } | ||
731 | |||
732 | spin_lock_irqsave(&dev->drw_lock, irqflags); | ||
733 | |||
734 | if (!drm_get_drawable_info(dev, swap->drawable)) { | ||
735 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | ||
736 | DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); | ||
737 | return -EINVAL; | ||
738 | } | ||
739 | |||
740 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | ||
741 | |||
742 | /* | ||
743 | * We take the ref here and put it when the swap actually completes | ||
744 | * in the tasklet. | ||
745 | */ | 468 | */ |
746 | ret = drm_vblank_get(dev, pipe); | 469 | return -EINVAL; |
747 | if (ret) | ||
748 | return ret; | ||
749 | curseq = drm_vblank_count(dev, pipe); | ||
750 | |||
751 | if (seqtype == _DRM_VBLANK_RELATIVE) | ||
752 | swap->sequence += curseq; | ||
753 | |||
754 | if ((curseq - swap->sequence) <= (1<<23)) { | ||
755 | if (swap->seqtype & _DRM_VBLANK_NEXTONMISS) { | ||
756 | swap->sequence = curseq + 1; | ||
757 | } else { | ||
758 | DRM_DEBUG("Missed target sequence\n"); | ||
759 | drm_vblank_put(dev, pipe); | ||
760 | return -EINVAL; | ||
761 | } | ||
762 | } | ||
763 | |||
764 | vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER); | ||
765 | |||
766 | if (!vbl_swap) { | ||
767 | DRM_ERROR("Failed to allocate memory to queue swap\n"); | ||
768 | drm_vblank_put(dev, pipe); | ||
769 | return -ENOMEM; | ||
770 | } | ||
771 | |||
772 | vbl_swap->drw_id = swap->drawable; | ||
773 | vbl_swap->pipe = pipe; | ||
774 | vbl_swap->sequence = swap->sequence; | ||
775 | |||
776 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); | ||
777 | |||
778 | list_for_each(list, &dev_priv->vbl_swaps.head) { | ||
779 | vbl_old = list_entry(list, drm_i915_vbl_swap_t, head); | ||
780 | |||
781 | if (vbl_old->drw_id == swap->drawable && | ||
782 | vbl_old->pipe == pipe && | ||
783 | vbl_old->sequence == swap->sequence) { | ||
784 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | ||
785 | drm_vblank_put(dev, pipe); | ||
786 | drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER); | ||
787 | DRM_DEBUG("Already scheduled\n"); | ||
788 | return 0; | ||
789 | } | ||
790 | } | ||
791 | |||
792 | if (dev_priv->swaps_pending >= 10) { | ||
793 | DRM_DEBUG("Too many swaps queued\n"); | ||
794 | DRM_DEBUG(" pipe 0: %d pipe 1: %d\n", | ||
795 | drm_vblank_count(dev, 0), | ||
796 | drm_vblank_count(dev, 1)); | ||
797 | |||
798 | list_for_each(list, &dev_priv->vbl_swaps.head) { | ||
799 | vbl_old = list_entry(list, drm_i915_vbl_swap_t, head); | ||
800 | DRM_DEBUG("\tdrw %x pipe %d seq %x\n", | ||
801 | vbl_old->drw_id, vbl_old->pipe, | ||
802 | vbl_old->sequence); | ||
803 | } | ||
804 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | ||
805 | drm_vblank_put(dev, pipe); | ||
806 | drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER); | ||
807 | return -EBUSY; | ||
808 | } | ||
809 | |||
810 | list_add_tail(&vbl_swap->head, &dev_priv->vbl_swaps.head); | ||
811 | dev_priv->swaps_pending++; | ||
812 | |||
813 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | ||
814 | |||
815 | return 0; | ||
816 | } | 470 | } |
817 | 471 | ||
818 | /* drm_dma.h hooks | 472 | /* drm_dma.h hooks |
@@ -831,11 +485,6 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
831 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 485 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
832 | int ret, num_pipes = 2; | 486 | int ret, num_pipes = 2; |
833 | 487 | ||
834 | spin_lock_init(&dev_priv->swaps_lock); | ||
835 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); | ||
836 | INIT_WORK(&dev_priv->vblank_work, i915_vblank_work_handler); | ||
837 | dev_priv->swaps_pending = 0; | ||
838 | |||
839 | /* Set initial unmasked IRQs to just the selected vblank pipes. */ | 488 | /* Set initial unmasked IRQs to just the selected vblank pipes. */ |
840 | dev_priv->irq_mask_reg = ~0; | 489 | dev_priv->irq_mask_reg = ~0; |
841 | 490 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 5c2d9f206d05..0e476eba36e6 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -527,6 +527,9 @@ | |||
527 | #define C0DRB3 0x10206 | 527 | #define C0DRB3 0x10206 |
528 | #define C1DRB3 0x10606 | 528 | #define C1DRB3 0x10606 |
529 | 529 | ||
530 | /** GM965 GM45 render standby register */ | ||
531 | #define MCHBAR_RENDER_STANDBY 0x111B8 | ||
532 | |||
530 | /* | 533 | /* |
531 | * Overlay regs | 534 | * Overlay regs |
532 | */ | 535 | */ |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 603fe742ccd4..5ddc6e595c0c 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -240,6 +240,10 @@ int i915_save_state(struct drm_device *dev) | |||
240 | 240 | ||
241 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | 241 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); |
242 | 242 | ||
243 | /* Render Standby */ | ||
244 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
245 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
246 | |||
243 | /* Display arbitration control */ | 247 | /* Display arbitration control */ |
244 | dev_priv->saveDSPARB = I915_READ(DSPARB); | 248 | dev_priv->saveDSPARB = I915_READ(DSPARB); |
245 | 249 | ||
@@ -365,6 +369,11 @@ int i915_restore_state(struct drm_device *dev) | |||
365 | 369 | ||
366 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); | 370 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); |
367 | 371 | ||
372 | /* Render Standby */ | ||
373 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
374 | I915_WRITE(MCHBAR_RENDER_STANDBY, dev_priv->saveRENDERSTANDBY); | ||
375 | |||
376 | /* Display arbitration */ | ||
368 | I915_WRITE(DSPARB, dev_priv->saveDSPARB); | 377 | I915_WRITE(DSPARB, dev_priv->saveDSPARB); |
369 | 378 | ||
370 | /* Pipe & plane A info */ | 379 | /* Pipe & plane A info */ |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index 59a2132a8f57..abdc1ae38467 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
@@ -653,15 +653,16 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev, | |||
653 | RADEON_WRITE(RADEON_SCRATCH_UMSK, 0x7); | 653 | RADEON_WRITE(RADEON_SCRATCH_UMSK, 0x7); |
654 | 654 | ||
655 | /* Turn on bus mastering */ | 655 | /* Turn on bus mastering */ |
656 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS400) || | 656 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || |
657 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || | ||
658 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) { | 657 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) { |
659 | /* rs400, rs690/rs740 */ | 658 | /* rs600/rs690/rs740 */ |
660 | tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RS400_BUS_MASTER_DIS; | 659 | tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RS600_BUS_MASTER_DIS; |
661 | RADEON_WRITE(RADEON_BUS_CNTL, tmp); | 660 | RADEON_WRITE(RADEON_BUS_CNTL, tmp); |
662 | } else if (!(((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV380) || | 661 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV350) || |
663 | ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R423))) { | 662 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R420) || |
664 | /* r1xx, r2xx, r300, r(v)350, r420/r481, rs480 */ | 663 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS400) || |
664 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480)) { | ||
665 | /* r1xx, r2xx, r300, r(v)350, r420/r481, rs400/rs480 */ | ||
665 | tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS; | 666 | tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS; |
666 | RADEON_WRITE(RADEON_BUS_CNTL, tmp); | 667 | RADEON_WRITE(RADEON_BUS_CNTL, tmp); |
667 | } /* PCIE cards appears to not need this */ | 668 | } /* PCIE cards appears to not need this */ |
@@ -1750,6 +1751,12 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) | |||
1750 | else | 1751 | else |
1751 | dev_priv->flags |= RADEON_IS_PCI; | 1752 | dev_priv->flags |= RADEON_IS_PCI; |
1752 | 1753 | ||
1754 | ret = drm_addmap(dev, drm_get_resource_start(dev, 2), | ||
1755 | drm_get_resource_len(dev, 2), _DRM_REGISTERS, | ||
1756 | _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio); | ||
1757 | if (ret != 0) | ||
1758 | return ret; | ||
1759 | |||
1753 | DRM_DEBUG("%s card detected\n", | 1760 | DRM_DEBUG("%s card detected\n", |
1754 | ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); | 1761 | ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); |
1755 | return ret; | 1762 | return ret; |
@@ -1766,12 +1773,6 @@ int radeon_driver_firstopen(struct drm_device *dev) | |||
1766 | 1773 | ||
1767 | dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE; | 1774 | dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE; |
1768 | 1775 | ||
1769 | ret = drm_addmap(dev, drm_get_resource_start(dev, 2), | ||
1770 | drm_get_resource_len(dev, 2), _DRM_REGISTERS, | ||
1771 | _DRM_READ_ONLY, &dev_priv->mmio); | ||
1772 | if (ret != 0) | ||
1773 | return ret; | ||
1774 | |||
1775 | dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0); | 1776 | dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0); |
1776 | ret = drm_addmap(dev, dev_priv->fb_aper_offset, | 1777 | ret = drm_addmap(dev, dev_priv->fb_aper_offset, |
1777 | drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, | 1778 | drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, |
@@ -1787,6 +1788,9 @@ int radeon_driver_unload(struct drm_device *dev) | |||
1787 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1788 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1788 | 1789 | ||
1789 | DRM_DEBUG("\n"); | 1790 | DRM_DEBUG("\n"); |
1791 | |||
1792 | drm_rmmap(dev, dev_priv->mmio); | ||
1793 | |||
1790 | drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER); | 1794 | drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER); |
1791 | 1795 | ||
1792 | dev->dev_private = NULL; | 1796 | dev->dev_private = NULL; |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 4dbb813910c3..7a183789be97 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
@@ -287,7 +287,6 @@ typedef struct drm_radeon_private { | |||
287 | unsigned long gart_textures_offset; | 287 | unsigned long gart_textures_offset; |
288 | 288 | ||
289 | drm_local_map_t *sarea; | 289 | drm_local_map_t *sarea; |
290 | drm_local_map_t *mmio; | ||
291 | drm_local_map_t *cp_ring; | 290 | drm_local_map_t *cp_ring; |
292 | drm_local_map_t *ring_rptr; | 291 | drm_local_map_t *ring_rptr; |
293 | drm_local_map_t *gart_textures; | 292 | drm_local_map_t *gart_textures; |
@@ -318,6 +317,7 @@ typedef struct drm_radeon_private { | |||
318 | 317 | ||
319 | int num_gb_pipes; | 318 | int num_gb_pipes; |
320 | int track_flush; | 319 | int track_flush; |
320 | drm_local_map_t *mmio; | ||
321 | } drm_radeon_private_t; | 321 | } drm_radeon_private_t; |
322 | 322 | ||
323 | typedef struct drm_radeon_buf_priv { | 323 | typedef struct drm_radeon_buf_priv { |
@@ -447,12 +447,12 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
447 | * handling, not bus mastering itself. | 447 | * handling, not bus mastering itself. |
448 | */ | 448 | */ |
449 | #define RADEON_BUS_CNTL 0x0030 | 449 | #define RADEON_BUS_CNTL 0x0030 |
450 | /* r1xx, r2xx, r300, r(v)350, r420/r481, rs480 */ | 450 | /* r1xx, r2xx, r300, r(v)350, r420/r481, rs400/rs480 */ |
451 | # define RADEON_BUS_MASTER_DIS (1 << 6) | 451 | # define RADEON_BUS_MASTER_DIS (1 << 6) |
452 | /* rs400, rs690/rs740 */ | 452 | /* rs600/rs690/rs740 */ |
453 | # define RS400_BUS_MASTER_DIS (1 << 14) | 453 | # define RS600_BUS_MASTER_DIS (1 << 14) |
454 | # define RS400_MSI_REARM (1 << 20) | 454 | # define RS600_MSI_REARM (1 << 20) |
455 | /* see RS480_MSI_REARM in AIC_CNTL for rs480 */ | 455 | /* see RS400_MSI_REARM in AIC_CNTL for rs480 */ |
456 | 456 | ||
457 | #define RADEON_BUS_CNTL1 0x0034 | 457 | #define RADEON_BUS_CNTL1 0x0034 |
458 | # define RADEON_PMI_BM_DIS (1 << 2) | 458 | # define RADEON_PMI_BM_DIS (1 << 2) |
@@ -937,7 +937,7 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
937 | 937 | ||
938 | #define RADEON_AIC_CNTL 0x01d0 | 938 | #define RADEON_AIC_CNTL 0x01d0 |
939 | # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) | 939 | # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) |
940 | # define RS480_MSI_REARM (1 << 3) | 940 | # define RS400_MSI_REARM (1 << 3) |
941 | #define RADEON_AIC_STAT 0x01d4 | 941 | #define RADEON_AIC_STAT 0x01d4 |
942 | #define RADEON_AIC_PT_BASE 0x01d8 | 942 | #define RADEON_AIC_PT_BASE 0x01d8 |
943 | #define RADEON_AIC_LO_ADDR 0x01dc | 943 | #define RADEON_AIC_LO_ADDR 0x01dc |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index f5999a91614e..b4fd8ca701a4 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -247,7 +247,6 @@ config HID_SUNPLUS | |||
247 | 247 | ||
248 | config THRUSTMASTER_FF | 248 | config THRUSTMASTER_FF |
249 | tristate "ThrustMaster devices support" | 249 | tristate "ThrustMaster devices support" |
250 | default m | ||
251 | depends on USB_HID | 250 | depends on USB_HID |
252 | select INPUT_FF_MEMLESS | 251 | select INPUT_FF_MEMLESS |
253 | help | 252 | help |
@@ -256,7 +255,6 @@ config THRUSTMASTER_FF | |||
256 | 255 | ||
257 | config ZEROPLUS_FF | 256 | config ZEROPLUS_FF |
258 | tristate "Zeroplus based game controller support" | 257 | tristate "Zeroplus based game controller support" |
259 | default m | ||
260 | depends on USB_HID | 258 | depends on USB_HID |
261 | select INPUT_FF_MEMLESS | 259 | select INPUT_FF_MEMLESS |
262 | help | 260 | help |
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index fd7f896b34f7..c6ab4ba60c52 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -312,13 +312,6 @@ static int apple_probe(struct hid_device *hdev, | |||
312 | unsigned int connect_mask = HID_CONNECT_DEFAULT; | 312 | unsigned int connect_mask = HID_CONNECT_DEFAULT; |
313 | int ret; | 313 | int ret; |
314 | 314 | ||
315 | /* return something else or move to hid layer? device will reside | ||
316 | allocated */ | ||
317 | if (id->bus == BUS_USB && (quirks & APPLE_IGNORE_MOUSE) && | ||
318 | to_usb_interface(hdev->dev.parent)->cur_altsetting-> | ||
319 | desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) | ||
320 | return -ENODEV; | ||
321 | |||
322 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); | 315 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); |
323 | if (asc == NULL) { | 316 | if (asc == NULL) { |
324 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); | 317 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); |
@@ -367,38 +360,32 @@ static const struct hid_device_id apple_devices[] = { | |||
367 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, | 360 | .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, |
368 | 361 | ||
369 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), | 362 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI), |
370 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 363 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
371 | APPLE_IGNORE_MOUSE }, | ||
372 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), | 364 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO), |
373 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 365 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
374 | APPLE_IGNORE_MOUSE }, | ||
375 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), | 366 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI), |
376 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 367 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
377 | APPLE_IGNORE_MOUSE }, | ||
378 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), | 368 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO), |
379 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 369 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
380 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | 370 | APPLE_ISO_KEYBOARD }, |
381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), | 371 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS), |
382 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 372 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
383 | APPLE_IGNORE_MOUSE }, | ||
384 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), | 373 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI), |
385 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 374 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
386 | APPLE_IGNORE_MOUSE }, | ||
387 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), | 375 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO), |
388 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 376 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
389 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | 377 | APPLE_ISO_KEYBOARD }, |
390 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), | 378 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS), |
391 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 379 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
392 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 380 | APPLE_RDESC_JIS }, |
393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), | 381 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI), |
394 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 382 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
395 | APPLE_IGNORE_MOUSE }, | ||
396 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), | 383 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO), |
397 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 384 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
398 | APPLE_IGNORE_MOUSE | APPLE_ISO_KEYBOARD }, | 385 | APPLE_ISO_KEYBOARD }, |
399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), | 386 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS), |
400 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 387 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
401 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS}, | 388 | APPLE_RDESC_JIS }, |
402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), | 389 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI), |
403 | .driver_data = APPLE_HAS_FN }, | 390 | .driver_data = APPLE_HAS_FN }, |
404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), | 391 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO), |
@@ -406,14 +393,12 @@ static const struct hid_device_id apple_devices[] = { | |||
406 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), | 393 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS), |
407 | .driver_data = APPLE_HAS_FN }, | 394 | .driver_data = APPLE_HAS_FN }, |
408 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), | 395 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI), |
409 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 396 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
410 | APPLE_IGNORE_MOUSE }, | ||
411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), | 397 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO), |
412 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 398 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
413 | APPLE_IGNORE_MOUSE }, | ||
414 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), | 399 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS), |
415 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 400 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | |
416 | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 401 | APPLE_RDESC_JIS }, |
417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | 402 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), |
418 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 403 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), | 404 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), |
@@ -422,25 +407,21 @@ static const struct hid_device_id apple_devices[] = { | |||
422 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), | 407 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), |
423 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 408 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
424 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), | 409 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), |
425 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, | 410 | .driver_data = APPLE_HAS_FN }, |
426 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), | 411 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), |
427 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | | 412 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
428 | APPLE_IGNORE_MOUSE }, | ||
429 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), | 413 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS), |
430 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 414 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
431 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), | 415 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), |
432 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE }, | 416 | .driver_data = APPLE_HAS_FN }, |
433 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), | 417 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), |
434 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD | | 418 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
435 | APPLE_IGNORE_MOUSE }, | ||
436 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), | 419 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), |
437 | .driver_data = APPLE_HAS_FN | APPLE_IGNORE_MOUSE | APPLE_RDESC_JIS }, | 420 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
438 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), | 421 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), |
439 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 422 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
440 | APPLE_IGNORE_MOUSE }, | ||
441 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), | 423 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), |
442 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | | 424 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
443 | APPLE_IGNORE_MOUSE }, | ||
444 | 425 | ||
445 | /* Apple wireless Mighty Mouse */ | 426 | /* Apple wireless Mighty Mouse */ |
446 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), | 427 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 721a36d97582..d3671b4049c0 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1263,7 +1263,10 @@ 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) }, |
1268 | { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, | ||
1269 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, | ||
1267 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | 1270 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, |
1268 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, | 1271 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
1269 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, | 1272 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, |
@@ -1275,8 +1278,6 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1275 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) }, | 1278 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) }, |
1276 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, | 1279 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, |
1277 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, | 1280 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, |
1278 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3) }, | ||
1279 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150) }, | ||
1280 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, | 1281 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, |
1281 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, | 1282 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, |
1282 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, | 1283 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, |
@@ -1295,6 +1296,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1295 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, | 1296 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
1296 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | 1297 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
1297 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1298 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1299 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, | ||
1298 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 1300 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
1299 | 1301 | ||
1300 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, | 1302 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, |
@@ -1406,6 +1408,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1406 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, | 1408 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, |
1407 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, | 1409 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, |
1408 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, | 1410 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)}, |
1411 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)}, | ||
1409 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, | 1412 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, |
1410 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, | 1413 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, |
1411 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, | 1414 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, |
@@ -1541,6 +1544,40 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1541 | { } | 1544 | { } |
1542 | }; | 1545 | }; |
1543 | 1546 | ||
1547 | /** | ||
1548 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer | ||
1549 | * | ||
1550 | * There are composite devices for which we want to ignore only a certain | ||
1551 | * interface. This is a list of devices for which only the mouse interface will | ||
1552 | * be ignored. This allows a dedicated driver to take care of the interface. | ||
1553 | */ | ||
1554 | static const struct hid_device_id hid_mouse_ignore_list[] = { | ||
1555 | /* appletouch driver */ | ||
1556 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | ||
1557 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | ||
1558 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | ||
1559 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO) }, | ||
1560 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS) }, | ||
1561 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI) }, | ||
1562 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO) }, | ||
1563 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS) }, | ||
1564 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI) }, | ||
1565 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO) }, | ||
1566 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) }, | ||
1567 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, | ||
1568 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, | ||
1569 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, | ||
1570 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI) }, | ||
1571 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO) }, | ||
1572 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS) }, | ||
1573 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, | ||
1574 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, | ||
1575 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, | ||
1576 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | ||
1577 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | ||
1578 | { } | ||
1579 | }; | ||
1580 | |||
1544 | static bool hid_ignore(struct hid_device *hdev) | 1581 | static bool hid_ignore(struct hid_device *hdev) |
1545 | { | 1582 | { |
1546 | switch (hdev->vendor) { | 1583 | switch (hdev->vendor) { |
@@ -1557,6 +1594,10 @@ static bool hid_ignore(struct hid_device *hdev) | |||
1557 | break; | 1594 | break; |
1558 | } | 1595 | } |
1559 | 1596 | ||
1597 | if (hdev->type == HID_TYPE_USBMOUSE && | ||
1598 | hid_match_id(hdev, hid_mouse_ignore_list)) | ||
1599 | return true; | ||
1600 | |||
1560 | return !!hid_match_id(hdev, hid_ignore_list); | 1601 | return !!hid_match_id(hdev, hid_ignore_list); |
1561 | } | 1602 | } |
1562 | 1603 | ||
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: | |||
48 | static const struct hid_device_id dell_devices[] = { | 48 | static 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 | }; |
53 | MODULE_DEVICE_TABLE(hid, dell_devices); | 54 | MODULE_DEVICE_TABLE(hid, dell_devices); |
diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c index ac5120f542cc..04a0afec52ac 100644 --- a/drivers/hid/hid-gyration.c +++ b/drivers/hid/hid-gyration.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Copyright (c) 1999 Andreas Gal | 4 | * Copyright (c) 1999 Andreas Gal |
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
8 | * Copyright (c) 2007 Paul Walmsley | 7 | * Copyright (c) 2007 Paul Walmsley |
9 | * Copyright (c) 2008 Jiri Slaby | 8 | * Copyright (c) 2008 Jiri Slaby |
9 | * Copyright (c) 2006-2008 Jiri Kosina | ||
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
@@ -40,6 +40,7 @@ static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
40 | case 0x025: gy_map_key_clear(KEY_PVR); break; | 40 | case 0x025: gy_map_key_clear(KEY_PVR); break; |
41 | case 0x046: gy_map_key_clear(KEY_MEDIA); break; | 41 | case 0x046: gy_map_key_clear(KEY_MEDIA); break; |
42 | case 0x047: gy_map_key_clear(KEY_MP3); break; | 42 | case 0x047: gy_map_key_clear(KEY_MP3); break; |
43 | case 0x048: gy_map_key_clear(KEY_MEDIA); break; | ||
43 | case 0x049: gy_map_key_clear(KEY_CAMERA); break; | 44 | case 0x049: gy_map_key_clear(KEY_CAMERA); break; |
44 | case 0x04a: gy_map_key_clear(KEY_VIDEO); break; | 45 | case 0x04a: gy_map_key_clear(KEY_VIDEO); break; |
45 | 46 | ||
@@ -68,6 +69,7 @@ static int gyration_event(struct hid_device *hdev, struct hid_field *field, | |||
68 | 69 | ||
69 | static const struct hid_device_id gyration_devices[] = { | 70 | static const struct hid_device_id gyration_devices[] = { |
70 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, | 71 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, |
72 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, | ||
71 | { } | 73 | { } |
72 | }; | 74 | }; |
73 | MODULE_DEVICE_TABLE(hid, gyration_devices); | 75 | MODULE_DEVICE_TABLE(hid, gyration_devices); |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index d9a1ba920c23..f05bcbbbb0d5 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -89,6 +89,7 @@ | |||
89 | 89 | ||
90 | #define USB_VENDOR_ID_ASUS 0x0b05 | 90 | #define USB_VENDOR_ID_ASUS 0x0b05 |
91 | #define USB_DEVICE_ID_ASUS_LCM 0x1726 | 91 | #define USB_DEVICE_ID_ASUS_LCM 0x1726 |
92 | #define USB_DEVICE_ID_ASUS_LCM2 0x175b | ||
92 | 93 | ||
93 | #define USB_VENDOR_ID_ATEN 0x0557 | 94 | #define USB_VENDOR_ID_ATEN 0x0557 |
94 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 | 95 | #define USB_DEVICE_ID_ATEN_UC100KM 0x2004 |
@@ -162,6 +163,9 @@ | |||
162 | 163 | ||
163 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | 164 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc |
164 | 165 | ||
166 | #define USB_VENDOR_ID_GENERIC_13BA 0x13ba | ||
167 | #define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017 | ||
168 | |||
165 | #define USB_VENDOR_ID_GLAB 0x06c2 | 169 | #define USB_VENDOR_ID_GLAB 0x06c2 |
166 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | 170 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 |
167 | #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 | 171 | #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 |
@@ -236,6 +240,7 @@ | |||
236 | 240 | ||
237 | #define USB_VENDOR_ID_GYRATION 0x0c16 | 241 | #define USB_VENDOR_ID_GYRATION 0x0c16 |
238 | #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 | 242 | #define USB_DEVICE_ID_GYRATION_REMOTE 0x0002 |
243 | #define USB_DEVICE_ID_GYRATION_REMOTE_2 0x0003 | ||
239 | 244 | ||
240 | #define USB_VENDOR_ID_HAPP 0x078b | 245 | #define USB_VENDOR_ID_HAPP 0x078b |
241 | #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 | 246 | #define USB_DEVICE_ID_UGCI_DRIVING 0x0010 |
@@ -248,6 +253,9 @@ | |||
248 | #define USB_VENDOR_ID_KBGEAR 0x084e | 253 | #define USB_VENDOR_ID_KBGEAR 0x084e |
249 | #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 | 254 | #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001 |
250 | 255 | ||
256 | #define USB_VENDOR_ID_KWORLD 0x1b80 | ||
257 | #define USB_DEVICE_ID_KWORLD_RADIO_FM700 0xd700 | ||
258 | |||
251 | #define USB_VENDOR_ID_LABTEC 0x1020 | 259 | #define USB_VENDOR_ID_LABTEC 0x1020 |
252 | #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 | 260 | #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 |
253 | 261 | ||
@@ -268,8 +276,6 @@ | |||
268 | #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 | 276 | #define USB_DEVICE_ID_LD_MACHINETEST 0x2040 |
269 | 277 | ||
270 | #define USB_VENDOR_ID_LOGITECH 0x046d | 278 | #define USB_VENDOR_ID_LOGITECH 0x046d |
271 | #define USB_DEVICE_ID_LOGITECH_LX3 0xc044 | ||
272 | #define USB_DEVICE_ID_LOGITECH_V150 0xc047 | ||
273 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | 279 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
274 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 | 280 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 |
275 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f | 281 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f |
@@ -350,6 +356,7 @@ | |||
350 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 356 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
351 | 357 | ||
352 | #define USB_VENDOR_ID_SONY 0x054c | 358 | #define USB_VENDOR_ID_SONY 0x054c |
359 | #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b | ||
353 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | 360 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 |
354 | 361 | ||
355 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | 362 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 |
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 406d8c82abf1..2bae340eafe2 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
@@ -287,11 +287,6 @@ static const struct hid_device_id lg_devices[] = { | |||
287 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), | 287 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), |
288 | .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, | 288 | .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, |
289 | 289 | ||
290 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_LX3), | ||
291 | .driver_data = LG_INVERT_HWHEEL }, | ||
292 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_V150), | ||
293 | .driver_data = LG_INVERT_HWHEEL }, | ||
294 | |||
295 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), | 290 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D), |
296 | .driver_data = LG_NOGET }, | 291 | .driver_data = LG_NOGET }, |
297 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), | 292 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 3af8095a7de1..86e563b8d644 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Copyright (c) 1999 Andreas Gal | 4 | * Copyright (c) 1999 Andreas Gal |
5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> |
6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc |
7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
8 | * Copyright (c) 2007 Paul Walmsley | 7 | * Copyright (c) 2007 Paul Walmsley |
9 | * Copyright (c) 2008 Jiri Slaby | 8 | * Copyright (c) 2008 Jiri Slaby |
9 | * Copyright (c) 2006-2008 Jiri Kosina | ||
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
@@ -23,6 +23,26 @@ | |||
23 | 23 | ||
24 | #include "hid-ids.h" | 24 | #include "hid-ids.h" |
25 | 25 | ||
26 | #define VAIO_RDESC_CONSTANT 0x0001 | ||
27 | |||
28 | struct sony_sc { | ||
29 | unsigned long quirks; | ||
30 | }; | ||
31 | |||
32 | /* Sony Vaio VGX has wrongly mouse pointer declared as constant */ | ||
33 | static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
34 | unsigned int rsize) | ||
35 | { | ||
36 | struct sony_sc *sc = hid_get_drvdata(hdev); | ||
37 | |||
38 | if ((sc->quirks & VAIO_RDESC_CONSTANT) && | ||
39 | rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { | ||
40 | dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " | ||
41 | "descriptor\n"); | ||
42 | rdesc[55] = 0x06; | ||
43 | } | ||
44 | } | ||
45 | |||
26 | /* | 46 | /* |
27 | * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller | 47 | * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller |
28 | * to "operational". Without this, the ps3 controller will not report any | 48 | * to "operational". Without this, the ps3 controller will not report any |
@@ -56,6 +76,17 @@ static int sony_set_operational(struct hid_device *hdev) | |||
56 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | 76 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) |
57 | { | 77 | { |
58 | int ret; | 78 | int ret; |
79 | unsigned long quirks = id->driver_data; | ||
80 | struct sony_sc *sc; | ||
81 | |||
82 | sc = kzalloc(sizeof(*sc), GFP_KERNEL); | ||
83 | if (sc == NULL) { | ||
84 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); | ||
85 | return -ENOMEM; | ||
86 | } | ||
87 | |||
88 | sc->quirks = quirks; | ||
89 | hid_set_drvdata(hdev, sc); | ||
59 | 90 | ||
60 | ret = hid_parse(hdev); | 91 | ret = hid_parse(hdev); |
61 | if (ret) { | 92 | if (ret) { |
@@ -78,11 +109,20 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
78 | err_stop: | 109 | err_stop: |
79 | hid_hw_stop(hdev); | 110 | hid_hw_stop(hdev); |
80 | err_free: | 111 | err_free: |
112 | kfree(sc); | ||
81 | return ret; | 113 | return ret; |
82 | } | 114 | } |
83 | 115 | ||
116 | static void sony_remove(struct hid_device *hdev) | ||
117 | { | ||
118 | hid_hw_stop(hdev); | ||
119 | kfree(hid_get_drvdata(hdev)); | ||
120 | } | ||
121 | |||
84 | static const struct hid_device_id sony_devices[] = { | 122 | static const struct hid_device_id sony_devices[] = { |
85 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 123 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
124 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), | ||
125 | .driver_data = VAIO_RDESC_CONSTANT }, | ||
86 | { } | 126 | { } |
87 | }; | 127 | }; |
88 | MODULE_DEVICE_TABLE(hid, sony_devices); | 128 | MODULE_DEVICE_TABLE(hid, sony_devices); |
@@ -91,6 +131,8 @@ static struct hid_driver sony_driver = { | |||
91 | .name = "sony", | 131 | .name = "sony", |
92 | .id_table = sony_devices, | 132 | .id_table = sony_devices, |
93 | .probe = sony_probe, | 133 | .probe = sony_probe, |
134 | .remove = sony_remove, | ||
135 | .report_fixup = sony_report_fixup, | ||
94 | }; | 136 | }; |
95 | 137 | ||
96 | static int sony_init(void) | 138 | static int sony_init(void) |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index af3edb98df43..894d52e05bf9 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -264,6 +264,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
264 | default: | 264 | default: |
265 | ret = -ENOTTY; | 265 | ret = -ENOTTY; |
266 | } | 266 | } |
267 | unlock_kernel(); | ||
267 | return ret; | 268 | return ret; |
268 | } | 269 | } |
269 | 270 | ||
@@ -403,7 +404,7 @@ out: | |||
403 | return result; | 404 | return result; |
404 | } | 405 | } |
405 | 406 | ||
406 | void __exit hidraw_exit(void) | 407 | void hidraw_exit(void) |
407 | { | 408 | { |
408 | dev_t dev_id = MKDEV(hidraw_major, 0); | 409 | dev_t dev_id = MKDEV(hidraw_major, 0); |
409 | 410 | ||
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 705a43cdeea4..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 | ||
893 | fail: | 887 | fail: |
@@ -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); |
899 | err: | ||
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 | ||
938 | static struct hid_ll_driver usb_hid_driver = { | 932 | static struct hid_ll_driver usb_hid_driver = { |
@@ -947,6 +941,7 @@ static struct hid_ll_driver usb_hid_driver = { | |||
947 | static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | 941 | static 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; |
@@ -972,6 +967,9 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
972 | hid->vendor = le16_to_cpu(dev->descriptor.idVendor); | 967 | hid->vendor = le16_to_cpu(dev->descriptor.idVendor); |
973 | hid->product = le16_to_cpu(dev->descriptor.idProduct); | 968 | hid->product = le16_to_cpu(dev->descriptor.idProduct); |
974 | hid->name[0] = 0; | 969 | hid->name[0] = 0; |
970 | if (intf->cur_altsetting->desc.bInterfaceProtocol == | ||
971 | USB_INTERFACE_PROTOCOL_MOUSE) | ||
972 | hid->type = HID_TYPE_USBMOUSE; | ||
975 | 973 | ||
976 | if (dev->manufacturer) | 974 | if (dev->manufacturer) |
977 | strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); | 975 | strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); |
@@ -997,14 +995,26 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
997 | if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) | 995 | if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) |
998 | hid->uniq[0] = 0; | 996 | hid->uniq[0] = 0; |
999 | 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 | |||
1000 | ret = hid_add_device(hid); | 1008 | ret = hid_add_device(hid); |
1001 | if (ret) { | 1009 | if (ret) { |
1002 | if (ret != -ENODEV) | 1010 | if (ret != -ENODEV) |
1003 | 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); |
1004 | goto err; | 1012 | goto err_free; |
1005 | } | 1013 | } |
1006 | 1014 | ||
1007 | return 0; | 1015 | return 0; |
1016 | err_free: | ||
1017 | kfree(usbhid); | ||
1008 | err: | 1018 | err: |
1009 | hid_destroy_device(hid); | 1019 | hid_destroy_device(hid); |
1010 | return ret; | 1020 | return ret; |
@@ -1013,11 +1023,14 @@ err: | |||
1013 | static void hid_disconnect(struct usb_interface *intf) | 1023 | static void hid_disconnect(struct usb_interface *intf) |
1014 | { | 1024 | { |
1015 | struct hid_device *hid = usb_get_intfdata(intf); | 1025 | struct hid_device *hid = usb_get_intfdata(intf); |
1026 | struct usbhid_device *usbhid; | ||
1016 | 1027 | ||
1017 | if (WARN_ON(!hid)) | 1028 | if (WARN_ON(!hid)) |
1018 | return; | 1029 | return; |
1019 | 1030 | ||
1031 | usbhid = hid->driver_data; | ||
1020 | hid_destroy_device(hid); | 1032 | hid_destroy_device(hid); |
1033 | kfree(usbhid); | ||
1021 | } | 1034 | } |
1022 | 1035 | ||
1023 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) | 1036 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) |
@@ -1025,11 +1038,18 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1025 | struct hid_device *hid = usb_get_intfdata (intf); | 1038 | struct hid_device *hid = usb_get_intfdata (intf); |
1026 | struct usbhid_device *usbhid = hid->driver_data; | 1039 | struct usbhid_device *usbhid = hid->driver_data; |
1027 | 1040 | ||
1041 | mutex_lock(&usbhid->setup); | ||
1042 | if (!test_bit(HID_STARTED, &usbhid->iofl)) { | ||
1043 | mutex_unlock(&usbhid->setup); | ||
1044 | return 0; | ||
1045 | } | ||
1046 | |||
1028 | spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ | 1047 | spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ |
1029 | set_bit(HID_SUSPENDED, &usbhid->iofl); | 1048 | set_bit(HID_SUSPENDED, &usbhid->iofl); |
1030 | spin_unlock_irq(&usbhid->inlock); | 1049 | spin_unlock_irq(&usbhid->inlock); |
1031 | del_timer(&usbhid->io_retry); | 1050 | del_timer_sync(&usbhid->io_retry); |
1032 | usb_kill_urb(usbhid->urbin); | 1051 | usb_kill_urb(usbhid->urbin); |
1052 | mutex_unlock(&usbhid->setup); | ||
1033 | dev_dbg(&intf->dev, "suspend\n"); | 1053 | dev_dbg(&intf->dev, "suspend\n"); |
1034 | return 0; | 1054 | return 0; |
1035 | } | 1055 | } |
@@ -1040,9 +1060,16 @@ static int hid_resume(struct usb_interface *intf) | |||
1040 | struct usbhid_device *usbhid = hid->driver_data; | 1060 | struct usbhid_device *usbhid = hid->driver_data; |
1041 | int status; | 1061 | int status; |
1042 | 1062 | ||
1063 | mutex_lock(&usbhid->setup); | ||
1064 | if (!test_bit(HID_STARTED, &usbhid->iofl)) { | ||
1065 | mutex_unlock(&usbhid->setup); | ||
1066 | return 0; | ||
1067 | } | ||
1068 | |||
1043 | clear_bit(HID_SUSPENDED, &usbhid->iofl); | 1069 | clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1044 | usbhid->retry_delay = 0; | 1070 | usbhid->retry_delay = 0; |
1045 | status = hid_start_in(hid); | 1071 | status = hid_start_in(hid); |
1072 | mutex_unlock(&usbhid->setup); | ||
1046 | dev_dbg(&intf->dev, "resume status %d\n", status); | 1073 | dev_dbg(&intf->dev, "resume status %d\n", status); |
1047 | return status; | 1074 | return status; |
1048 | } | 1075 | } |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index babd65dd46ad..83e851a5ed30 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -242,8 +242,6 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
242 | struct hiddev_list *list = file->private_data; | 242 | struct hiddev_list *list = file->private_data; |
243 | unsigned long flags; | 243 | unsigned long flags; |
244 | 244 | ||
245 | hiddev_fasync(-1, file, 0); | ||
246 | |||
247 | spin_lock_irqsave(&list->hiddev->list_lock, flags); | 245 | spin_lock_irqsave(&list->hiddev->list_lock, flags); |
248 | list_del(&list->node); | 246 | list_del(&list->node); |
249 | spin_unlock_irqrestore(&list->hiddev->list_lock, flags); | 247 | spin_unlock_irqrestore(&list->hiddev->list_lock, flags); |
@@ -436,8 +434,7 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, | |||
436 | if (copy_to_user(user_arg, uref, sizeof(*uref))) | 434 | if (copy_to_user(user_arg, uref, sizeof(*uref))) |
437 | goto fault; | 435 | goto fault; |
438 | 436 | ||
439 | kfree(uref_multi); | 437 | goto goodreturn; |
440 | return 0; | ||
441 | 438 | ||
442 | default: | 439 | default: |
443 | if (cmd != HIDIOCGUSAGE && | 440 | if (cmd != HIDIOCGUSAGE && |
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/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index bc011da79e14..be3285912cb7 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -116,6 +116,18 @@ static const char* temperature_sensors_sets[][36] = { | |||
116 | /* Set 9: Macbook Pro 3,1 (Santa Rosa) */ | 116 | /* Set 9: Macbook Pro 3,1 (Santa Rosa) */ |
117 | { "TALP", "TB0T", "TC0D", "TC0P", "TG0D", "TG0H", "TTF0", "TW0P", | 117 | { "TALP", "TB0T", "TC0D", "TC0P", "TG0D", "TG0H", "TTF0", "TW0P", |
118 | "Th0H", "Th1H", "Th2H", "Tm0P", "Ts0P", NULL }, | 118 | "Th0H", "Th1H", "Th2H", "Tm0P", "Ts0P", NULL }, |
119 | /* Set 10: iMac 5,1 */ | ||
120 | { "TA0P", "TC0D", "TC0P", "TG0D", "TH0P", "TO0P", "Tm0P", NULL }, | ||
121 | /* Set 11: Macbook 5,1 */ | ||
122 | { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0P", "TN0D", "TN0P", | ||
123 | "TTF0", "Th0H", "Th1H", "ThFH", "Ts0P", "Ts0S", NULL }, | ||
124 | /* Set 12: Macbook Pro 5,1 */ | ||
125 | { "TB0T", "TB1T", "TB2T", "TB3T", "TC0D", "TC0F", "TC0P", "TG0D", | ||
126 | "TG0F", "TG0H", "TG0P", "TG0T", "TG1H", "TN0D", "TN0P", "TTF0", | ||
127 | "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL }, | ||
128 | /* Set 13: iMac 8,1 */ | ||
129 | { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TG0P", "TH0P", | ||
130 | "TL0P", "TO0P", "TW0P", "Tm0P", "Tp0P", NULL }, | ||
119 | }; | 131 | }; |
120 | 132 | ||
121 | /* List of keys used to read/write fan speeds */ | 133 | /* List of keys used to read/write fan speeds */ |
@@ -1276,6 +1288,14 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
1276 | { .accelerometer = 1, .light = 1, .temperature_set = 8 }, | 1288 | { .accelerometer = 1, .light = 1, .temperature_set = 8 }, |
1277 | /* MacBook Pro 3: accelerometer, backlight and temperature set 9 */ | 1289 | /* MacBook Pro 3: accelerometer, backlight and temperature set 9 */ |
1278 | { .accelerometer = 1, .light = 1, .temperature_set = 9 }, | 1290 | { .accelerometer = 1, .light = 1, .temperature_set = 9 }, |
1291 | /* iMac 5: light sensor only, temperature set 10 */ | ||
1292 | { .accelerometer = 0, .light = 0, .temperature_set = 10 }, | ||
1293 | /* MacBook 5: accelerometer, backlight and temperature set 11 */ | ||
1294 | { .accelerometer = 1, .light = 1, .temperature_set = 11 }, | ||
1295 | /* MacBook Pro 5: accelerometer, backlight and temperature set 12 */ | ||
1296 | { .accelerometer = 1, .light = 1, .temperature_set = 12 }, | ||
1297 | /* iMac 8: light sensor only, temperature set 13 */ | ||
1298 | { .accelerometer = 0, .light = 0, .temperature_set = 13 }, | ||
1279 | }; | 1299 | }; |
1280 | 1300 | ||
1281 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1301 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
@@ -1285,6 +1305,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1285 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | 1305 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), |
1286 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") }, | 1306 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") }, |
1287 | &applesmc_dmi_data[7]}, | 1307 | &applesmc_dmi_data[7]}, |
1308 | { applesmc_dmi_match, "Apple MacBook Pro 5", { | ||
1309 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | ||
1310 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5") }, | ||
1311 | &applesmc_dmi_data[12]}, | ||
1288 | { applesmc_dmi_match, "Apple MacBook Pro 4", { | 1312 | { applesmc_dmi_match, "Apple MacBook Pro 4", { |
1289 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | 1313 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), |
1290 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4") }, | 1314 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4") }, |
@@ -1305,6 +1329,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1305 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1329 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1306 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") }, | 1330 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") }, |
1307 | &applesmc_dmi_data[6]}, | 1331 | &applesmc_dmi_data[6]}, |
1332 | { applesmc_dmi_match, "Apple MacBook 5", { | ||
1333 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | ||
1334 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5") }, | ||
1335 | &applesmc_dmi_data[11]}, | ||
1308 | { applesmc_dmi_match, "Apple MacBook", { | 1336 | { applesmc_dmi_match, "Apple MacBook", { |
1309 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1337 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1310 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, | 1338 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, |
@@ -1317,6 +1345,14 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1317 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1345 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1318 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, | 1346 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, |
1319 | &applesmc_dmi_data[4]}, | 1347 | &applesmc_dmi_data[4]}, |
1348 | { applesmc_dmi_match, "Apple iMac 8", { | ||
1349 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | ||
1350 | DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") }, | ||
1351 | &applesmc_dmi_data[13]}, | ||
1352 | { applesmc_dmi_match, "Apple iMac 5", { | ||
1353 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | ||
1354 | DMI_MATCH(DMI_PRODUCT_NAME, "iMac5") }, | ||
1355 | &applesmc_dmi_data[10]}, | ||
1320 | { applesmc_dmi_match, "Apple iMac", { | 1356 | { applesmc_dmi_match, "Apple iMac", { |
1321 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1357 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1322 | DMI_MATCH(DMI_PRODUCT_NAME,"iMac") }, | 1358 | DMI_MATCH(DMI_PRODUCT_NAME,"iMac") }, |
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 | ||
82 | static struct i2c_adapter scx200_i2c_ops = { | 82 | static 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/ide/alim15x3.c b/drivers/ide/alim15x3.c index daf9dce39e52..e56c7b72f9e2 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 1998-2000 Andre Hedrick (andre@linux-ide.org) | 6 | * Copyright (C) 1998-2000 Andre Hedrick (andre@linux-ide.org) |
7 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
8 | * Copyright (C) 2002 Alan Cox <alan@redhat.com> | 8 | * Copyright (C) 2002 Alan Cox |
9 | * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> | 9 | * ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw> |
10 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> | 10 | * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> |
11 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 11 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> |
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index a7909e9c720e..f5afd46ed51c 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c | |||
@@ -52,7 +52,7 @@ | |||
52 | * different clocks on read/write. This requires overloading rw_disk and | 52 | * different clocks on read/write. This requires overloading rw_disk and |
53 | * other deeply crazy things. Thanks to <http://www.hoerstreich.de> for | 53 | * other deeply crazy things. Thanks to <http://www.hoerstreich.de> for |
54 | * keeping me sane. | 54 | * keeping me sane. |
55 | * Alan Cox <alan@redhat.com> | 55 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
56 | * | 56 | * |
57 | * - fix the clock turnaround code: it was writing to the wrong ports when | 57 | * - fix the clock turnaround code: it was writing to the wrong ports when |
58 | * called for the secondary channel, caching the current clock mode per- | 58 | * called for the secondary channel, caching the current clock mode per- |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 48b5eda3ab41..42ab6d8715f2 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1250,7 +1250,8 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1250 | * separate masks. | 1250 | * separate masks. |
1251 | */ | 1251 | */ |
1252 | alignment = queue_dma_alignment(q) | q->dma_pad_mask; | 1252 | alignment = queue_dma_alignment(q) | q->dma_pad_mask; |
1253 | if ((unsigned long)buf & alignment || rq->data_len & alignment | 1253 | if ((unsigned long)buf & alignment |
1254 | || rq->data_len & q->dma_pad_mask | ||
1254 | || object_is_on_stack(buf)) | 1255 | || object_is_on_stack(buf)) |
1255 | drive->dma = 0; | 1256 | drive->dma = 0; |
1256 | } | 1257 | } |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index e5adebe8ac2c..eb9fac4d0f0c 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) | 2 | * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) |
3 | * Copyright (C) 1998-2002 Linux ATA Development | 3 | * Copyright (C) 1998-2002 Linux ATA Development |
4 | * Andre Hedrick <andre@linux-ide.org> | 4 | * Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 5 | * Copyright (C) 2003 Red Hat |
6 | * Copyright (C) 2003-2005, 2007 Bartlomiej Zolnierkiewicz | 6 | * Copyright (C) 2003-2005, 2007 Bartlomiej Zolnierkiewicz |
7 | */ | 7 | */ |
8 | 8 | ||
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 7b6662854374..b8078b3231f7 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -281,7 +281,12 @@ static int ide_gd_media_changed(struct gendisk *disk) | |||
281 | static int ide_gd_revalidate_disk(struct gendisk *disk) | 281 | static int ide_gd_revalidate_disk(struct gendisk *disk) |
282 | { | 282 | { |
283 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 283 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
284 | set_capacity(disk, ide_gd_capacity(idkp->drive)); | 284 | ide_drive_t *drive = idkp->drive; |
285 | |||
286 | if (ide_gd_media_changed(disk)) | ||
287 | drive->disk_ops->get_capacity(drive); | ||
288 | |||
289 | set_capacity(disk, ide_gd_capacity(drive)); | ||
285 | return 0; | 290 | return 0; |
286 | } | 291 | } |
287 | 292 | ||
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index bb7a1ed8094e..5d6ba14e211d 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> |
3 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 3 | * Copyright (C) 2003 Red Hat |
4 | * | 4 | * |
5 | */ | 5 | */ |
6 | 6 | ||
diff --git a/drivers/ide/ide-pci-generic.c b/drivers/ide/ide-pci-generic.c index 474f96a7c076..bddae2b329a0 100644 --- a/drivers/ide/ide-pci-generic.c +++ b/drivers/ide/ide-pci-generic.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
3 | * Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com> | 3 | * Portions (C) Copyright 2002 Red Hat Inc |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License as published by the | 6 | * under the terms of the GNU General Public License as published by the |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index c31d0dd7a532..f3cddd1b2f8f 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1997-1998 Mark Lord | 2 | * Copyright (C) 1997-1998 Mark Lord |
3 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 3 | * Copyright (C) 2003 Red Hat |
4 | * | 4 | * |
5 | * Some code was moved here from ide.c, see it for original copyrights. | 5 | * Some code was moved here from ide.c, see it for original copyrights. |
6 | */ | 6 | */ |
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index 995e18bb3139..ef004089761b 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004 Red Hat <alan@redhat.com> | 2 | * Copyright (C) 2004 Red Hat |
3 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 3 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
4 | * | 4 | * |
5 | * May be copied or modified under the terms of the GNU General Public License | 5 | * May be copied or modified under the terms of the GNU General Public License |
diff --git a/drivers/ide/jmicron.c b/drivers/ide/jmicron.c index 9a68433cf46d..bf2be6431b20 100644 --- a/drivers/ide/jmicron.c +++ b/drivers/ide/jmicron.c | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * Copyright (C) 2006 Red Hat <alan@redhat.com> | 3 | * Copyright (C) 2006 Red Hat |
4 | * | 4 | * |
5 | * May be copied or modified under the terms of the GNU General Public License | 5 | * May be copied or modified under the terms of the GNU General Public License |
6 | */ | 6 | */ |
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c index d63f9fdca76b..61d2d920a5cd 100644 --- a/drivers/ide/piix.c +++ b/drivers/ide/piix.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer | 2 | * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer |
3 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> | 3 | * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> |
4 | * Copyright (C) 2003 Red Hat Inc <alan@redhat.com> | 4 | * Copyright (C) 2003 Red Hat |
5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> | 5 | * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> |
6 | * | 6 | * |
7 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index f26aa5d54efb..0f48f9dacfa5 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * This code is based on drivers/ide/pci/siimage.c: | 6 | * This code is based on drivers/ide/pci/siimage.c: |
7 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 7 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
8 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 8 | * Copyright (C) 2003 Red Hat |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c index c3107df7773d..7d622d20bc4c 100644 --- a/drivers/ide/siimage.c +++ b/drivers/ide/siimage.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
3 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 3 | * Copyright (C) 2003 Red Hat |
4 | * Copyright (C) 2007-2008 MontaVista Software, Inc. | 4 | * Copyright (C) 2007-2008 MontaVista Software, Inc. |
5 | * Copyright (C) 2007-2008 Bartlomiej Zolnierkiewicz | 5 | * Copyright (C) 2007-2008 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index fa660f931a11..9120063e8f87 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c | |||
@@ -26,12 +26,13 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch, | |||
26 | unsigned int sp = (cr >> 4) & 3; | 26 | unsigned int sp = (cr >> 4) & 3; |
27 | unsigned int clock = gbus_clock / (4 - sp); | 27 | unsigned int clock = gbus_clock / (4 - sp); |
28 | unsigned int cycle = 1000000000 / clock; | 28 | unsigned int cycle = 1000000000 / clock; |
29 | unsigned int wt, shwt; | 29 | unsigned int shwt; |
30 | int wt; | ||
30 | 31 | ||
31 | /* Minimum DIOx- active time */ | 32 | /* Minimum DIOx- active time */ |
32 | wt = DIV_ROUND_UP(t->act8b, cycle) - 2; | 33 | wt = DIV_ROUND_UP(t->act8b, cycle) - 2; |
33 | /* IORDY setup time: 35ns */ | 34 | /* IORDY setup time: 35ns */ |
34 | wt = max(wt, DIV_ROUND_UP(35, cycle)); | 35 | wt = max_t(int, wt, DIV_ROUND_UP(35, cycle)); |
35 | /* actual wait-cycle is max(wt & ~1, 1) */ | 36 | /* actual wait-cycle is max(wt & ~1, 1) */ |
36 | if (wt > 2 && (wt & 1)) | 37 | if (wt > 2 && (wt & 1)) |
37 | wt++; | 38 | wt++; |
@@ -39,10 +40,17 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch, | |||
39 | /* Address-valid to DIOR/DIOW setup */ | 40 | /* Address-valid to DIOR/DIOW setup */ |
40 | shwt = DIV_ROUND_UP(t->setup, cycle); | 41 | shwt = DIV_ROUND_UP(t->setup, cycle); |
41 | 42 | ||
43 | /* -DIOx recovery time (SHWT * 4) and cycle time requirement */ | ||
44 | while ((shwt * 4 + wt + (wt ? 2 : 3)) * cycle < t->cycle) | ||
45 | shwt++; | ||
46 | if (shwt > 7) { | ||
47 | pr_warning("tx4938ide: SHWT violation (%d)\n", shwt); | ||
48 | shwt = 7; | ||
49 | } | ||
42 | pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n", | 50 | pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n", |
43 | ebus_ch, cycle, wt, shwt); | 51 | ebus_ch, cycle, wt, shwt); |
44 | 52 | ||
45 | __raw_writeq((cr & ~(0x3f007ull)) | (wt << 12) | shwt, | 53 | __raw_writeq((cr & ~0x3f007ull) | (wt << 12) | shwt, |
46 | &tx4938_ebuscptr->cr[ebus_ch]); | 54 | &tx4938_ebuscptr->cr[ebus_ch]); |
47 | } | 55 | } |
48 | 56 | ||
@@ -228,7 +236,7 @@ static int __init tx4938ide_probe(struct platform_device *pdev) | |||
228 | struct resource *res; | 236 | struct resource *res; |
229 | struct tx4938ide_platform_info *pdata = pdev->dev.platform_data; | 237 | struct tx4938ide_platform_info *pdata = pdev->dev.platform_data; |
230 | int irq, ret, i; | 238 | int irq, ret, i; |
231 | unsigned long mapbase; | 239 | unsigned long mapbase, mapctl; |
232 | struct ide_port_info d = tx4938ide_port_info; | 240 | struct ide_port_info d = tx4938ide_port_info; |
233 | 241 | ||
234 | irq = platform_get_irq(pdev, 0); | 242 | irq = platform_get_irq(pdev, 0); |
@@ -242,38 +250,43 @@ static int __init tx4938ide_probe(struct platform_device *pdev) | |||
242 | res->end - res->start + 1, "tx4938ide")) | 250 | res->end - res->start + 1, "tx4938ide")) |
243 | return -EBUSY; | 251 | return -EBUSY; |
244 | mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, | 252 | mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, |
245 | res->end - res->start + 1); | 253 | 8 << pdata->ioport_shift); |
246 | if (!mapbase) | 254 | mapctl = (unsigned long)devm_ioremap(&pdev->dev, |
255 | res->start + 0x10000 + | ||
256 | (6 << pdata->ioport_shift), | ||
257 | 1 << pdata->ioport_shift); | ||
258 | if (!mapbase || !mapctl) | ||
247 | return -EBUSY; | 259 | return -EBUSY; |
248 | 260 | ||
249 | memset(&hw, 0, sizeof(hw)); | 261 | memset(&hw, 0, sizeof(hw)); |
250 | if (pdata->ioport_shift) { | 262 | if (pdata->ioport_shift) { |
251 | unsigned long port = mapbase; | 263 | unsigned long port = mapbase; |
264 | unsigned long ctl = mapctl; | ||
252 | 265 | ||
253 | hw.io_ports_array[0] = port; | 266 | hw.io_ports_array[0] = port; |
254 | #ifdef __BIG_ENDIAN | 267 | #ifdef __BIG_ENDIAN |
255 | port++; | 268 | port++; |
269 | ctl++; | ||
256 | #endif | 270 | #endif |
257 | for (i = 1; i <= 7; i++) | 271 | for (i = 1; i <= 7; i++) |
258 | hw.io_ports_array[i] = | 272 | hw.io_ports_array[i] = |
259 | port + (i << pdata->ioport_shift); | 273 | port + (i << pdata->ioport_shift); |
260 | hw.io_ports.ctl_addr = | 274 | hw.io_ports.ctl_addr = ctl; |
261 | port + 0x10000 + (6 << pdata->ioport_shift); | ||
262 | } else | 275 | } else |
263 | ide_std_init_ports(&hw, mapbase, mapbase + 0x10006); | 276 | ide_std_init_ports(&hw, mapbase, mapctl); |
264 | hw.irq = irq; | 277 | hw.irq = irq; |
265 | hw.dev = &pdev->dev; | 278 | hw.dev = &pdev->dev; |
266 | 279 | ||
267 | pr_info("TX4938 IDE interface (base %#lx, irq %d)\n", mapbase, hw.irq); | 280 | pr_info("TX4938 IDE interface (base %#lx, ctl %#lx, irq %d)\n", |
281 | mapbase, mapctl, hw.irq); | ||
268 | if (pdata->gbus_clock) | 282 | if (pdata->gbus_clock) |
269 | tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0); | 283 | tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0); |
270 | else | 284 | else |
271 | d.port_ops = NULL; | 285 | d.port_ops = NULL; |
272 | ret = ide_host_add(&d, hws, &host); | 286 | ret = ide_host_add(&d, hws, &host); |
273 | if (ret) | 287 | if (!ret) |
274 | return ret; | 288 | platform_set_drvdata(pdev, host); |
275 | platform_set_drvdata(pdev, host); | 289 | return ret; |
276 | return 0; | ||
277 | } | 290 | } |
278 | 291 | ||
279 | static int __exit tx4938ide_remove(struct platform_device *pdev) | 292 | static int __exit tx4938ide_remove(struct platform_device *pdev) |
diff --git a/drivers/idle/Kconfig b/drivers/idle/Kconfig index f5b26dd579e4..108264de0ac9 100644 --- a/drivers/idle/Kconfig +++ b/drivers/idle/Kconfig | |||
@@ -5,12 +5,13 @@ config I7300_IDLE_IOAT_CHANNEL | |||
5 | bool | 5 | bool |
6 | 6 | ||
7 | config I7300_IDLE | 7 | config I7300_IDLE |
8 | tristate "Intel chipset idle power saving driver" | 8 | tristate "Intel chipset idle memory power saving driver" |
9 | select I7300_IDLE_IOAT_CHANNEL | 9 | select I7300_IDLE_IOAT_CHANNEL |
10 | depends on X86_64 | 10 | depends on X86_64 && EXPERIMENTAL |
11 | help | 11 | help |
12 | Enable idle power savings with certain Intel server chipsets. | 12 | Enable memory power savings when idle with certain Intel server |
13 | The chipset must have I/O AT support, such as the Intel 7300. | 13 | chipsets. The chipset must have I/O AT support, such as the |
14 | The power savings depends on the type and quantity of DRAM devices. | 14 | Intel 7300. The power savings depends on the type and quantity of |
15 | DRAM devices. | ||
15 | 16 | ||
16 | endmenu | 17 | endmenu |
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c index 59d1bbc3cd3c..fb176f6ef9f8 100644 --- a/drivers/idle/i7300_idle.c +++ b/drivers/idle/i7300_idle.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/debugfs.h> | 26 | #include <linux/debugfs.h> |
27 | #include <linux/stop_machine.h> | 27 | #include <linux/stop_machine.h> |
28 | #include <linux/i7300_idle.h> | ||
28 | 29 | ||
29 | #include <asm/idle.h> | 30 | #include <asm/idle.h> |
30 | 31 | ||
@@ -34,6 +35,8 @@ | |||
34 | #define I7300_IDLE_DRIVER_VERSION "1.55" | 35 | #define I7300_IDLE_DRIVER_VERSION "1.55" |
35 | #define I7300_PRINT "i7300_idle:" | 36 | #define I7300_PRINT "i7300_idle:" |
36 | 37 | ||
38 | #define MAX_STOP_RETRIES 10 | ||
39 | |||
37 | static int debug; | 40 | static int debug; |
38 | module_param_named(debug, debug, uint, 0644); | 41 | module_param_named(debug, debug, uint, 0644); |
39 | MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); | 42 | MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); |
@@ -46,12 +49,12 @@ MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); | |||
46 | * 0 = No throttling | 49 | * 0 = No throttling |
47 | * 1 = Throttle when > 4 activations per eval window (Maximum throttling) | 50 | * 1 = Throttle when > 4 activations per eval window (Maximum throttling) |
48 | * 2 = Throttle when > 8 activations | 51 | * 2 = Throttle when > 8 activations |
49 | * 168 = Throttle when > 168 activations (Minimum throttling) | 52 | * 168 = Throttle when > 672 activations (Minimum throttling) |
50 | */ | 53 | */ |
51 | #define MAX_THRTLWLIMIT 168 | 54 | #define MAX_THROTTLE_LOW_LIMIT 168 |
52 | static uint i7300_idle_thrtlowlm = 1; | 55 | static uint throttle_low_limit = 1; |
53 | module_param_named(thrtlwlimit, i7300_idle_thrtlowlm, uint, 0644); | 56 | module_param_named(throttle_low_limit, throttle_low_limit, uint, 0644); |
54 | MODULE_PARM_DESC(thrtlwlimit, | 57 | MODULE_PARM_DESC(throttle_low_limit, |
55 | "Value for THRTLOWLM activation field " | 58 | "Value for THRTLOWLM activation field " |
56 | "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); | 59 | "(0 = disable throttle, 1 = Max throttle, 168 = Min throttle)"); |
57 | 60 | ||
@@ -110,9 +113,9 @@ static int i7300_idle_ioat_start(void) | |||
110 | static void i7300_idle_ioat_stop(void) | 113 | static void i7300_idle_ioat_stop(void) |
111 | { | 114 | { |
112 | int i; | 115 | int i; |
113 | u8 sts; | 116 | u64 sts; |
114 | 117 | ||
115 | for (i = 0; i < 5; i++) { | 118 | for (i = 0; i < MAX_STOP_RETRIES; i++) { |
116 | writeb(IOAT_CHANCMD_RESET, | 119 | writeb(IOAT_CHANCMD_RESET, |
117 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); | 120 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); |
118 | 121 | ||
@@ -126,9 +129,10 @@ static void i7300_idle_ioat_stop(void) | |||
126 | 129 | ||
127 | } | 130 | } |
128 | 131 | ||
129 | if (i == 5) | 132 | if (i == MAX_STOP_RETRIES) { |
130 | dprintk("failed to suspend+reset I/O AT after 5 retries\n"); | 133 | dprintk("failed to stop I/O AT after %d retries\n", |
131 | 134 | MAX_STOP_RETRIES); | |
135 | } | ||
132 | } | 136 | } |
133 | 137 | ||
134 | /* Test I/O AT by copying 1024 byte from 2k to 1k */ | 138 | /* Test I/O AT by copying 1024 byte from 2k to 1k */ |
@@ -275,7 +279,7 @@ static void __exit i7300_idle_ioat_exit(void) | |||
275 | i7300_idle_ioat_stop(); | 279 | i7300_idle_ioat_stop(); |
276 | 280 | ||
277 | /* Wait for a while for the channel to halt before releasing */ | 281 | /* Wait for a while for the channel to halt before releasing */ |
278 | for (i = 0; i < 10; i++) { | 282 | for (i = 0; i < MAX_STOP_RETRIES; i++) { |
279 | writeb(IOAT_CHANCMD_RESET, | 283 | writeb(IOAT_CHANCMD_RESET, |
280 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); | 284 | ioat_chanbase + IOAT1_CHANCMD_OFFSET); |
281 | 285 | ||
@@ -389,9 +393,9 @@ static void i7300_idle_start(void) | |||
389 | new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; | 393 | new_ctl = i7300_idle_thrtctl_saved & ~DIMM_THRTCTL_THRMHUNT; |
390 | pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); | 394 | pci_write_config_byte(fbd_dev, DIMM_THRTCTL, new_ctl); |
391 | 395 | ||
392 | limit = i7300_idle_thrtlowlm; | 396 | limit = throttle_low_limit; |
393 | if (unlikely(limit > MAX_THRTLWLIMIT)) | 397 | if (unlikely(limit > MAX_THROTTLE_LOW_LIMIT)) |
394 | limit = MAX_THRTLWLIMIT; | 398 | limit = MAX_THROTTLE_LOW_LIMIT; |
395 | 399 | ||
396 | pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); | 400 | pci_write_config_byte(fbd_dev, DIMM_THRTLOW, limit); |
397 | 401 | ||
@@ -440,7 +444,7 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val, | |||
440 | static ktime_t idle_begin_time; | 444 | static ktime_t idle_begin_time; |
441 | static int time_init = 1; | 445 | static int time_init = 1; |
442 | 446 | ||
443 | if (!i7300_idle_thrtlowlm) | 447 | if (!throttle_low_limit) |
444 | return 0; | 448 | return 0; |
445 | 449 | ||
446 | if (unlikely(time_init)) { | 450 | if (unlikely(time_init)) { |
@@ -505,77 +509,8 @@ static struct notifier_block i7300_idle_nb = { | |||
505 | .notifier_call = i7300_idle_notifier, | 509 | .notifier_call = i7300_idle_notifier, |
506 | }; | 510 | }; |
507 | 511 | ||
508 | /* | ||
509 | * I/O AT controls (PCI bus 0 device 8 function 0) | ||
510 | * DIMM controls (PCI bus 0 device 16 function 1) | ||
511 | */ | ||
512 | #define IOAT_BUS 0 | ||
513 | #define IOAT_DEVFN PCI_DEVFN(8, 0) | ||
514 | #define MEMCTL_BUS 0 | ||
515 | #define MEMCTL_DEVFN PCI_DEVFN(16, 1) | ||
516 | |||
517 | struct fbd_ioat { | ||
518 | unsigned int vendor; | ||
519 | unsigned int ioat_dev; | ||
520 | }; | ||
521 | |||
522 | /* | ||
523 | * The i5000 chip-set has the same hooks as the i7300 | ||
524 | * but support is disabled by default because this driver | ||
525 | * has not been validated on that platform. | ||
526 | */ | ||
527 | #define SUPPORT_I5000 0 | ||
528 | |||
529 | static const struct fbd_ioat fbd_ioat_list[] = { | ||
530 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB}, | ||
531 | #if SUPPORT_I5000 | ||
532 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT}, | ||
533 | #endif | ||
534 | {0, 0} | ||
535 | }; | ||
536 | |||
537 | /* table of devices that work with this driver */ | ||
538 | static const struct pci_device_id pci_tbl[] = { | ||
539 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) }, | ||
540 | #if SUPPORT_I5000 | ||
541 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, | ||
542 | #endif | ||
543 | { } /* Terminating entry */ | ||
544 | }; | ||
545 | |||
546 | MODULE_DEVICE_TABLE(pci, pci_tbl); | 512 | MODULE_DEVICE_TABLE(pci, pci_tbl); |
547 | 513 | ||
548 | /* Check for known platforms with I/O-AT */ | ||
549 | static int __init i7300_idle_platform_probe(void) | ||
550 | { | ||
551 | int i; | ||
552 | |||
553 | fbd_dev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN); | ||
554 | if (!fbd_dev) | ||
555 | return -ENODEV; | ||
556 | |||
557 | for (i = 0; pci_tbl[i].vendor != 0; i++) { | ||
558 | if (fbd_dev->vendor == pci_tbl[i].vendor && | ||
559 | fbd_dev->device == pci_tbl[i].device) { | ||
560 | break; | ||
561 | } | ||
562 | } | ||
563 | if (pci_tbl[i].vendor == 0) | ||
564 | return -ENODEV; | ||
565 | |||
566 | ioat_dev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN); | ||
567 | if (!ioat_dev) | ||
568 | return -ENODEV; | ||
569 | |||
570 | for (i = 0; fbd_ioat_list[i].vendor != 0; i++) { | ||
571 | if (ioat_dev->vendor == fbd_ioat_list[i].vendor && | ||
572 | ioat_dev->device == fbd_ioat_list[i].ioat_dev) { | ||
573 | return 0; | ||
574 | } | ||
575 | } | ||
576 | return -ENODEV; | ||
577 | } | ||
578 | |||
579 | int stats_open_generic(struct inode *inode, struct file *fp) | 514 | int stats_open_generic(struct inode *inode, struct file *fp) |
580 | { | 515 | { |
581 | fp->private_data = inode->i_private; | 516 | fp->private_data = inode->i_private; |
@@ -617,7 +552,7 @@ static int __init i7300_idle_init(void) | |||
617 | cpus_clear(idle_cpumask); | 552 | cpus_clear(idle_cpumask); |
618 | total_us = 0; | 553 | total_us = 0; |
619 | 554 | ||
620 | if (i7300_idle_platform_probe()) | 555 | if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev)) |
621 | return -ENODEV; | 556 | return -ENODEV; |
622 | 557 | ||
623 | if (i7300_idle_thrt_save()) | 558 | if (i7300_idle_thrt_save()) |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 2f83543a9dfc..c19f23267157 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -1270,8 +1270,14 @@ static int dv1394_mmap(struct file *file, struct vm_area_struct *vma) | |||
1270 | struct video_card *video = file_to_video_card(file); | 1270 | struct video_card *video = file_to_video_card(file); |
1271 | int retval = -EINVAL; | 1271 | int retval = -EINVAL; |
1272 | 1272 | ||
1273 | /* serialize mmap */ | 1273 | /* |
1274 | mutex_lock(&video->mtx); | 1274 | * We cannot use the blocking variant mutex_lock here because .mmap |
1275 | * is called with mmap_sem held, while .ioctl, .read, .write acquire | ||
1276 | * video->mtx and subsequently call copy_to/from_user which will | ||
1277 | * grab mmap_sem in case of a page fault. | ||
1278 | */ | ||
1279 | if (!mutex_trylock(&video->mtx)) | ||
1280 | return -EAGAIN; | ||
1275 | 1281 | ||
1276 | if ( ! video_card_initialized(video) ) { | 1282 | if ( ! video_card_initialized(video) ) { |
1277 | retval = do_dv1394_init_default(video); | 1283 | retval = do_dv1394_init_default(video); |
@@ -1828,9 +1834,6 @@ static int dv1394_release(struct inode *inode, struct file *file) | |||
1828 | /* OK to free the DMA buffer, no more mappings can exist */ | 1834 | /* OK to free the DMA buffer, no more mappings can exist */ |
1829 | do_dv1394_shutdown(video, 1); | 1835 | do_dv1394_shutdown(video, 1); |
1830 | 1836 | ||
1831 | /* clean up async I/O users */ | ||
1832 | dv1394_fasync(-1, file, 0); | ||
1833 | |||
1834 | /* give someone else a turn */ | 1837 | /* give someone else a turn */ |
1835 | clear_bit(0, &video->open); | 1838 | clear_bit(0, &video->open); |
1836 | 1839 | ||
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index 8dd09d850419..237d0c9d69c6 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c | |||
@@ -155,11 +155,11 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
155 | memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); | 155 | memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); |
156 | h->device.parent = dev; | 156 | h->device.parent = dev; |
157 | set_dev_node(&h->device, dev_to_node(dev)); | 157 | set_dev_node(&h->device, dev_to_node(dev)); |
158 | snprintf(h->device.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); | 158 | dev_set_name(&h->device, "fw-host%d", h->id); |
159 | 159 | ||
160 | h->host_dev.parent = &h->device; | 160 | h->host_dev.parent = &h->device; |
161 | h->host_dev.class = &hpsb_host_class; | 161 | h->host_dev.class = &hpsb_host_class; |
162 | snprintf(h->host_dev.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); | 162 | dev_set_name(&h->host_dev, "fw-host%d", h->id); |
163 | 163 | ||
164 | if (device_register(&h->device)) | 164 | if (device_register(&h->device)) |
165 | goto fail; | 165 | goto fail; |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 2376b729e876..9e39f73282ee 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -826,13 +826,11 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, | |||
826 | memcpy(&ne->device, &nodemgr_dev_template_ne, | 826 | memcpy(&ne->device, &nodemgr_dev_template_ne, |
827 | sizeof(ne->device)); | 827 | sizeof(ne->device)); |
828 | ne->device.parent = &host->device; | 828 | ne->device.parent = &host->device; |
829 | snprintf(ne->device.bus_id, BUS_ID_SIZE, "%016Lx", | 829 | dev_set_name(&ne->device, "%016Lx", (unsigned long long)(ne->guid)); |
830 | (unsigned long long)(ne->guid)); | ||
831 | 830 | ||
832 | ne->node_dev.parent = &ne->device; | 831 | ne->node_dev.parent = &ne->device; |
833 | ne->node_dev.class = &nodemgr_ne_class; | 832 | ne->node_dev.class = &nodemgr_ne_class; |
834 | snprintf(ne->node_dev.bus_id, BUS_ID_SIZE, "%016Lx", | 833 | dev_set_name(&ne->node_dev, "%016Lx", (unsigned long long)(ne->guid)); |
835 | (unsigned long long)(ne->guid)); | ||
836 | 834 | ||
837 | if (device_register(&ne->device)) | 835 | if (device_register(&ne->device)) |
838 | goto fail_devreg; | 836 | goto fail_devreg; |
@@ -932,13 +930,11 @@ static void nodemgr_register_device(struct node_entry *ne, | |||
932 | 930 | ||
933 | ud->device.parent = parent; | 931 | ud->device.parent = parent; |
934 | 932 | ||
935 | snprintf(ud->device.bus_id, BUS_ID_SIZE, "%s-%u", | 933 | dev_set_name(&ud->device, "%s-%u", dev_name(&ne->device), ud->id); |
936 | ne->device.bus_id, ud->id); | ||
937 | 934 | ||
938 | ud->unit_dev.parent = &ud->device; | 935 | ud->unit_dev.parent = &ud->device; |
939 | ud->unit_dev.class = &nodemgr_ud_class; | 936 | ud->unit_dev.class = &nodemgr_ud_class; |
940 | snprintf(ud->unit_dev.bus_id, BUS_ID_SIZE, "%s-%u", | 937 | dev_set_name(&ud->unit_dev, "%s-%u", dev_name(&ne->device), ud->id); |
941 | ne->device.bus_id, ud->id); | ||
942 | 938 | ||
943 | if (device_register(&ud->device)) | 939 | if (device_register(&ud->device)) |
944 | goto fail_devreg; | 940 | goto fail_devreg; |
@@ -953,7 +949,7 @@ static void nodemgr_register_device(struct node_entry *ne, | |||
953 | fail_classdevreg: | 949 | fail_classdevreg: |
954 | device_unregister(&ud->device); | 950 | device_unregister(&ud->device); |
955 | fail_devreg: | 951 | fail_devreg: |
956 | HPSB_ERR("Failed to create unit %s", ud->device.bus_id); | 952 | HPSB_ERR("Failed to create unit %s", dev_name(&ud->device)); |
957 | } | 953 | } |
958 | 954 | ||
959 | 955 | ||
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 9f19ac492106..bf7e761c12b1 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -2268,7 +2268,8 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer, | |||
2268 | return -EFAULT; | 2268 | return -EFAULT; |
2269 | } | 2269 | } |
2270 | 2270 | ||
2271 | mutex_lock(&fi->state_mutex); | 2271 | if (!mutex_trylock(&fi->state_mutex)) |
2272 | return -EAGAIN; | ||
2272 | 2273 | ||
2273 | switch (fi->state) { | 2274 | switch (fi->state) { |
2274 | case opened: | 2275 | case opened: |
@@ -2548,7 +2549,8 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma) | |||
2548 | struct file_info *fi = file->private_data; | 2549 | struct file_info *fi = file->private_data; |
2549 | int ret; | 2550 | int ret; |
2550 | 2551 | ||
2551 | mutex_lock(&fi->state_mutex); | 2552 | if (!mutex_trylock(&fi->state_mutex)) |
2553 | return -EAGAIN; | ||
2552 | 2554 | ||
2553 | if (fi->iso_state == RAW1394_ISO_INACTIVE) | 2555 | if (fi->iso_state == RAW1394_ISO_INACTIVE) |
2554 | ret = -EINVAL; | 2556 | ret = -EINVAL; |
@@ -2669,7 +2671,8 @@ static long raw1394_ioctl(struct file *file, unsigned int cmd, | |||
2669 | break; | 2671 | break; |
2670 | } | 2672 | } |
2671 | 2673 | ||
2672 | mutex_lock(&fi->state_mutex); | 2674 | if (!mutex_trylock(&fi->state_mutex)) |
2675 | return -EAGAIN; | ||
2673 | 2676 | ||
2674 | switch (fi->iso_state) { | 2677 | switch (fi->iso_state) { |
2675 | case RAW1394_ISO_INACTIVE: | 2678 | case RAW1394_ISO_INACTIVE: |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index d85af1b67027..eb36a81dd09b 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -358,8 +358,6 @@ static int ib_uverbs_event_close(struct inode *inode, struct file *filp) | |||
358 | } | 358 | } |
359 | spin_unlock_irq(&file->lock); | 359 | spin_unlock_irq(&file->lock); |
360 | 360 | ||
361 | ib_uverbs_event_fasync(-1, filp, 0); | ||
362 | |||
363 | if (file->is_async) { | 361 | if (file->is_async) { |
364 | ib_unregister_event_handler(&file->uverbs_file->event_handler); | 362 | ib_unregister_event_handler(&file->uverbs_file->event_handler); |
365 | kref_put(&file->uverbs_file->ref, ib_uverbs_release_file); | 363 | kref_put(&file->uverbs_file->ref, ib_uverbs_release_file); |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 3524bef62be6..1070db330d35 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -235,7 +235,6 @@ static int evdev_release(struct inode *inode, struct file *file) | |||
235 | evdev_ungrab(evdev, client); | 235 | evdev_ungrab(evdev, client); |
236 | mutex_unlock(&evdev->mutex); | 236 | mutex_unlock(&evdev->mutex); |
237 | 237 | ||
238 | evdev_fasync(-1, file, 0); | ||
239 | evdev_detach_client(evdev, client); | 238 | evdev_detach_client(evdev, client); |
240 | kfree(client); | 239 | kfree(client); |
241 | 240 | ||
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 65d7077a75a1..a85b1485e774 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -244,7 +244,6 @@ static int joydev_release(struct inode *inode, struct file *file) | |||
244 | struct joydev_client *client = file->private_data; | 244 | struct joydev_client *client = file->private_data; |
245 | struct joydev *joydev = client->joydev; | 245 | struct joydev *joydev = client->joydev; |
246 | 246 | ||
247 | joydev_fasync(-1, file, 0); | ||
248 | joydev_detach_client(joydev, client); | 247 | joydev_detach_client(joydev, client); |
249 | kfree(client); | 248 | kfree(client); |
250 | 249 | ||
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index 82ec6b1b6467..216a559f55ea 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
@@ -71,7 +71,6 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, | |||
71 | static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait); | 71 | static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait); |
72 | 72 | ||
73 | static int hp_sdc_rtc_open(struct inode *inode, struct file *file); | 73 | static int hp_sdc_rtc_open(struct inode *inode, struct file *file); |
74 | static int hp_sdc_rtc_release(struct inode *inode, struct file *file); | ||
75 | static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on); | 74 | static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on); |
76 | 75 | ||
77 | static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off, | 76 | static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off, |
@@ -414,17 +413,6 @@ static int hp_sdc_rtc_open(struct inode *inode, struct file *file) | |||
414 | return 0; | 413 | return 0; |
415 | } | 414 | } |
416 | 415 | ||
417 | static int hp_sdc_rtc_release(struct inode *inode, struct file *file) | ||
418 | { | ||
419 | /* Turn off interrupts? */ | ||
420 | |||
421 | if (file->f_flags & FASYNC) { | ||
422 | hp_sdc_rtc_fasync (-1, file, 0); | ||
423 | } | ||
424 | |||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on) | 416 | static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on) |
429 | { | 417 | { |
430 | return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue); | 418 | return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue); |
@@ -680,7 +668,6 @@ static const struct file_operations hp_sdc_rtc_fops = { | |||
680 | .poll = hp_sdc_rtc_poll, | 668 | .poll = hp_sdc_rtc_poll, |
681 | .ioctl = hp_sdc_rtc_ioctl, | 669 | .ioctl = hp_sdc_rtc_ioctl, |
682 | .open = hp_sdc_rtc_open, | 670 | .open = hp_sdc_rtc_open, |
683 | .release = hp_sdc_rtc_release, | ||
684 | .fasync = hp_sdc_rtc_fasync, | 671 | .fasync = hp_sdc_rtc_fasync, |
685 | }; | 672 | }; |
686 | 673 | ||
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index ce238f59b3c8..be3a15f5b25d 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c | |||
@@ -174,5 +174,6 @@ static void __exit sgi_buttons_exit(void) | |||
174 | platform_driver_unregister(&sgi_buttons_driver); | 174 | platform_driver_unregister(&sgi_buttons_driver); |
175 | } | 175 | } |
176 | 176 | ||
177 | MODULE_LICENSE("GPL"); | ||
177 | module_init(sgi_buttons_init); | 178 | module_init(sgi_buttons_init); |
178 | module_exit(sgi_buttons_exit); | 179 | module_exit(sgi_buttons_exit); |
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index f488b6852baf..4e9934259775 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -25,8 +25,8 @@ config MOUSE_PS2 | |||
25 | mice with wheels and extra buttons, Microsoft, Logitech or Genius | 25 | mice with wheels and extra buttons, Microsoft, Logitech or Genius |
26 | compatible. | 26 | compatible. |
27 | 27 | ||
28 | Synaptics TouchPad users might be interested in a specialized | 28 | Synaptics, ALPS or Elantech TouchPad users might be interested |
29 | XFree86 driver at: | 29 | in a specialized Xorg/XFree86 driver at: |
30 | <http://w1.894.telia.com/~u89404340/touchpad/index.html> | 30 | <http://w1.894.telia.com/~u89404340/touchpad/index.html> |
31 | and a new version of GPM at: | 31 | and a new version of GPM at: |
32 | <http://www.geocities.com/dt_or/gpm/gpm.html> | 32 | <http://www.geocities.com/dt_or/gpm/gpm.html> |
@@ -87,6 +87,27 @@ config MOUSE_PS2_TRACKPOINT | |||
87 | 87 | ||
88 | If unsure, say Y. | 88 | If unsure, say Y. |
89 | 89 | ||
90 | config MOUSE_PS2_ELANTECH | ||
91 | bool "Elantech PS/2 protocol extension" | ||
92 | depends on MOUSE_PS2 | ||
93 | help | ||
94 | Say Y here if you have an Elantech PS/2 touchpad connected | ||
95 | to your system. | ||
96 | |||
97 | Note that if you enable this driver you will need an updated | ||
98 | X.org Synaptics driver that does not require ABS_PRESSURE | ||
99 | reports from the touchpad (i.e. post 1.5.0 version). You can | ||
100 | grab a patch for the driver here: | ||
101 | |||
102 | http://userweb.kernel.org/~dtor/synaptics-no-abspressure.patch | ||
103 | |||
104 | If unsure, say N. | ||
105 | |||
106 | This driver exposes some configuration registers via sysfs | ||
107 | entries. For further information, | ||
108 | see <file:Documentation/input/elantech.txt>. | ||
109 | |||
110 | |||
90 | config MOUSE_PS2_TOUCHKIT | 111 | config MOUSE_PS2_TOUCHKIT |
91 | bool "eGalax TouchKit PS/2 protocol extension" | 112 | bool "eGalax TouchKit PS/2 protocol extension" |
92 | depends on MOUSE_PS2 | 113 | depends on MOUSE_PS2 |
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 8e6e69097801..96f1dd8037f8 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile | |||
@@ -21,6 +21,7 @@ obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o | |||
21 | psmouse-objs := psmouse-base.o synaptics.o | 21 | psmouse-objs := psmouse-base.o synaptics.o |
22 | 22 | ||
23 | psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o | 23 | psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o |
24 | psmouse-$(CONFIG_MOUSE_PS2_ELANTECH) += elantech.o | ||
24 | psmouse-$(CONFIG_MOUSE_PS2_OLPC) += hgpk.o | 25 | psmouse-$(CONFIG_MOUSE_PS2_OLPC) += hgpk.o |
25 | psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o | 26 | psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o |
26 | psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o | 27 | psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c new file mode 100644 index 000000000000..b9a25d57bc5e --- /dev/null +++ b/drivers/input/mouse/elantech.c | |||
@@ -0,0 +1,674 @@ | |||
1 | /* | ||
2 | * Elantech Touchpad driver (v5) | ||
3 | * | ||
4 | * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published | ||
8 | * by the Free Software Foundation. | ||
9 | * | ||
10 | * Trademarks are the property of their respective owners. | ||
11 | */ | ||
12 | |||
13 | #include <linux/delay.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/input.h> | ||
16 | #include <linux/serio.h> | ||
17 | #include <linux/libps2.h> | ||
18 | #include "psmouse.h" | ||
19 | #include "elantech.h" | ||
20 | |||
21 | #define elantech_debug(format, arg...) \ | ||
22 | do { \ | ||
23 | if (etd->debug) \ | ||
24 | printk(KERN_DEBUG format, ##arg); \ | ||
25 | } while (0) | ||
26 | |||
27 | /* | ||
28 | * Send a Synaptics style sliced query command | ||
29 | */ | ||
30 | static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, | ||
31 | unsigned char *param) | ||
32 | { | ||
33 | if (psmouse_sliced_command(psmouse, c) || | ||
34 | ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
35 | pr_err("elantech.c: synaptics_send_cmd query 0x%02x failed.\n", c); | ||
36 | return -1; | ||
37 | } | ||
38 | |||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * A retrying version of ps2_command | ||
44 | */ | ||
45 | static int elantech_ps2_command(struct psmouse *psmouse, | ||
46 | unsigned char *param, int command) | ||
47 | { | ||
48 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
49 | struct elantech_data *etd = psmouse->private; | ||
50 | int rc; | ||
51 | int tries = ETP_PS2_COMMAND_TRIES; | ||
52 | |||
53 | do { | ||
54 | rc = ps2_command(ps2dev, param, command); | ||
55 | if (rc == 0) | ||
56 | break; | ||
57 | tries--; | ||
58 | elantech_debug("elantech.c: retrying ps2 command 0x%02x (%d).\n", | ||
59 | command, tries); | ||
60 | msleep(ETP_PS2_COMMAND_DELAY); | ||
61 | } while (tries > 0); | ||
62 | |||
63 | if (rc) | ||
64 | pr_err("elantech.c: ps2 command 0x%02x failed.\n", command); | ||
65 | |||
66 | return rc; | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * Send an Elantech style special command to read a value from a register | ||
71 | */ | ||
72 | static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg, | ||
73 | unsigned char *val) | ||
74 | { | ||
75 | struct elantech_data *etd = psmouse->private; | ||
76 | unsigned char param[3]; | ||
77 | int rc = 0; | ||
78 | |||
79 | if (reg < 0x10 || reg > 0x26) | ||
80 | return -1; | ||
81 | |||
82 | if (reg > 0x11 && reg < 0x20) | ||
83 | return -1; | ||
84 | |||
85 | switch (etd->hw_version) { | ||
86 | case 1: | ||
87 | if (psmouse_sliced_command(psmouse, ETP_REGISTER_READ) || | ||
88 | psmouse_sliced_command(psmouse, reg) || | ||
89 | ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
90 | rc = -1; | ||
91 | } | ||
92 | break; | ||
93 | |||
94 | case 2: | ||
95 | if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
96 | elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READ) || | ||
97 | elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
98 | elantech_ps2_command(psmouse, NULL, reg) || | ||
99 | elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) { | ||
100 | rc = -1; | ||
101 | } | ||
102 | break; | ||
103 | } | ||
104 | |||
105 | if (rc) | ||
106 | pr_err("elantech.c: failed to read register 0x%02x.\n", reg); | ||
107 | else | ||
108 | *val = param[0]; | ||
109 | |||
110 | return rc; | ||
111 | } | ||
112 | |||
113 | /* | ||
114 | * Send an Elantech style special command to write a register with a value | ||
115 | */ | ||
116 | static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg, | ||
117 | unsigned char val) | ||
118 | { | ||
119 | struct elantech_data *etd = psmouse->private; | ||
120 | int rc = 0; | ||
121 | |||
122 | if (reg < 0x10 || reg > 0x26) | ||
123 | return -1; | ||
124 | |||
125 | if (reg > 0x11 && reg < 0x20) | ||
126 | return -1; | ||
127 | |||
128 | switch (etd->hw_version) { | ||
129 | case 1: | ||
130 | if (psmouse_sliced_command(psmouse, ETP_REGISTER_WRITE) || | ||
131 | psmouse_sliced_command(psmouse, reg) || | ||
132 | psmouse_sliced_command(psmouse, val) || | ||
133 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11)) { | ||
134 | rc = -1; | ||
135 | } | ||
136 | break; | ||
137 | |||
138 | case 2: | ||
139 | if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
140 | elantech_ps2_command(psmouse, NULL, ETP_REGISTER_WRITE) || | ||
141 | elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
142 | elantech_ps2_command(psmouse, NULL, reg) || | ||
143 | elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
144 | elantech_ps2_command(psmouse, NULL, val) || | ||
145 | elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) { | ||
146 | rc = -1; | ||
147 | } | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | if (rc) | ||
152 | pr_err("elantech.c: failed to write register 0x%02x with value 0x%02x.\n", | ||
153 | reg, val); | ||
154 | |||
155 | return rc; | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * Dump a complete mouse movement packet to the syslog | ||
160 | */ | ||
161 | static void elantech_packet_dump(unsigned char *packet, int size) | ||
162 | { | ||
163 | int i; | ||
164 | |||
165 | printk(KERN_DEBUG "elantech.c: PS/2 packet ["); | ||
166 | for (i = 0; i < size; i++) | ||
167 | printk("%s0x%02x ", (i) ? ", " : " ", packet[i]); | ||
168 | printk("]\n"); | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * Interpret complete data packets and report absolute mode input events for | ||
173 | * hardware version 1. (4 byte packets) | ||
174 | */ | ||
175 | static void elantech_report_absolute_v1(struct psmouse *psmouse) | ||
176 | { | ||
177 | struct input_dev *dev = psmouse->dev; | ||
178 | struct elantech_data *etd = psmouse->private; | ||
179 | unsigned char *packet = psmouse->packet; | ||
180 | int fingers; | ||
181 | |||
182 | if (etd->fw_version_maj == 0x01) { | ||
183 | /* byte 0: D U p1 p2 1 p3 R L | ||
184 | byte 1: f 0 th tw x9 x8 y9 y8 */ | ||
185 | fingers = ((packet[1] & 0x80) >> 7) + | ||
186 | ((packet[1] & 0x30) >> 4); | ||
187 | } else { | ||
188 | /* byte 0: n1 n0 p2 p1 1 p3 R L | ||
189 | byte 1: 0 0 0 0 x9 x8 y9 y8 */ | ||
190 | fingers = (packet[0] & 0xc0) >> 6; | ||
191 | } | ||
192 | |||
193 | input_report_key(dev, BTN_TOUCH, fingers != 0); | ||
194 | |||
195 | /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0 | ||
196 | byte 3: y7 y6 y5 y4 y3 y2 y1 y0 */ | ||
197 | if (fingers) { | ||
198 | input_report_abs(dev, ABS_X, | ||
199 | ((packet[1] & 0x0c) << 6) | packet[2]); | ||
200 | input_report_abs(dev, ABS_Y, ETP_YMAX_V1 - | ||
201 | (((packet[1] & 0x03) << 8) | packet[3])); | ||
202 | } | ||
203 | |||
204 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); | ||
205 | input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); | ||
206 | input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); | ||
207 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | ||
208 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | ||
209 | |||
210 | if ((etd->fw_version_maj == 0x01) && | ||
211 | (etd->capabilities & ETP_CAP_HAS_ROCKER)) { | ||
212 | /* rocker up */ | ||
213 | input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); | ||
214 | /* rocker down */ | ||
215 | input_report_key(dev, BTN_BACK, packet[0] & 0x80); | ||
216 | } | ||
217 | |||
218 | input_sync(dev); | ||
219 | } | ||
220 | |||
221 | /* | ||
222 | * Interpret complete data packets and report absolute mode input events for | ||
223 | * hardware version 2. (6 byte packets) | ||
224 | */ | ||
225 | static void elantech_report_absolute_v2(struct psmouse *psmouse) | ||
226 | { | ||
227 | struct input_dev *dev = psmouse->dev; | ||
228 | unsigned char *packet = psmouse->packet; | ||
229 | int fingers, x1, y1, x2, y2; | ||
230 | |||
231 | /* byte 0: n1 n0 . . . . R L */ | ||
232 | fingers = (packet[0] & 0xc0) >> 6; | ||
233 | input_report_key(dev, BTN_TOUCH, fingers != 0); | ||
234 | |||
235 | switch (fingers) { | ||
236 | case 1: | ||
237 | /* byte 1: x15 x14 x13 x12 x11 x10 x9 x8 | ||
238 | byte 2: x7 x6 x5 x4 x4 x2 x1 x0 */ | ||
239 | input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]); | ||
240 | /* byte 4: y15 y14 y13 y12 y11 y10 y8 y8 | ||
241 | byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */ | ||
242 | input_report_abs(dev, ABS_Y, ETP_YMAX_V2 - | ||
243 | ((packet[4] << 8) | packet[5])); | ||
244 | break; | ||
245 | |||
246 | case 2: | ||
247 | /* The coordinate of each finger is reported separately with | ||
248 | a lower resolution for two finger touches */ | ||
249 | /* byte 0: . . ay8 ax8 . . . . | ||
250 | byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */ | ||
251 | x1 = ((packet[0] & 0x10) << 4) | packet[1]; | ||
252 | /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ | ||
253 | y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); | ||
254 | /* byte 3: . . by8 bx8 . . . . | ||
255 | byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */ | ||
256 | x2 = ((packet[3] & 0x10) << 4) | packet[4]; | ||
257 | /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ | ||
258 | y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); | ||
259 | /* For compatibility with the X Synaptics driver scale up one | ||
260 | coordinate and report as ordinary mouse movent */ | ||
261 | input_report_abs(dev, ABS_X, x1 << 2); | ||
262 | input_report_abs(dev, ABS_Y, y1 << 2); | ||
263 | /* For compatibility with the proprietary X Elantech driver | ||
264 | report both coordinates as hat coordinates */ | ||
265 | input_report_abs(dev, ABS_HAT0X, x1); | ||
266 | input_report_abs(dev, ABS_HAT0Y, y1); | ||
267 | input_report_abs(dev, ABS_HAT1X, x2); | ||
268 | input_report_abs(dev, ABS_HAT1Y, y2); | ||
269 | break; | ||
270 | } | ||
271 | |||
272 | input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); | ||
273 | input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); | ||
274 | input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3); | ||
275 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | ||
276 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | ||
277 | |||
278 | input_sync(dev); | ||
279 | } | ||
280 | |||
281 | static int elantech_check_parity_v1(struct psmouse *psmouse) | ||
282 | { | ||
283 | struct elantech_data *etd = psmouse->private; | ||
284 | unsigned char *packet = psmouse->packet; | ||
285 | unsigned char p1, p2, p3; | ||
286 | |||
287 | /* Parity bits are placed differently */ | ||
288 | if (etd->fw_version_maj == 0x01) { | ||
289 | /* byte 0: D U p1 p2 1 p3 R L */ | ||
290 | p1 = (packet[0] & 0x20) >> 5; | ||
291 | p2 = (packet[0] & 0x10) >> 4; | ||
292 | } else { | ||
293 | /* byte 0: n1 n0 p2 p1 1 p3 R L */ | ||
294 | p1 = (packet[0] & 0x10) >> 4; | ||
295 | p2 = (packet[0] & 0x20) >> 5; | ||
296 | } | ||
297 | |||
298 | p3 = (packet[0] & 0x04) >> 2; | ||
299 | |||
300 | return etd->parity[packet[1]] == p1 && | ||
301 | etd->parity[packet[2]] == p2 && | ||
302 | etd->parity[packet[3]] == p3; | ||
303 | } | ||
304 | |||
305 | /* | ||
306 | * Process byte stream from mouse and handle complete packets | ||
307 | */ | ||
308 | static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) | ||
309 | { | ||
310 | struct elantech_data *etd = psmouse->private; | ||
311 | |||
312 | if (psmouse->pktcnt < psmouse->pktsize) | ||
313 | return PSMOUSE_GOOD_DATA; | ||
314 | |||
315 | if (etd->debug > 1) | ||
316 | elantech_packet_dump(psmouse->packet, psmouse->pktsize); | ||
317 | |||
318 | switch (etd->hw_version) { | ||
319 | case 1: | ||
320 | if (etd->paritycheck && !elantech_check_parity_v1(psmouse)) | ||
321 | return PSMOUSE_BAD_DATA; | ||
322 | |||
323 | elantech_report_absolute_v1(psmouse); | ||
324 | break; | ||
325 | |||
326 | case 2: | ||
327 | /* We don't know how to check parity in protocol v2 */ | ||
328 | elantech_report_absolute_v2(psmouse); | ||
329 | break; | ||
330 | } | ||
331 | |||
332 | return PSMOUSE_FULL_PACKET; | ||
333 | } | ||
334 | |||
335 | /* | ||
336 | * Put the touchpad into absolute mode | ||
337 | */ | ||
338 | static int elantech_set_absolute_mode(struct psmouse *psmouse) | ||
339 | { | ||
340 | struct elantech_data *etd = psmouse->private; | ||
341 | unsigned char val; | ||
342 | int tries = ETP_READ_BACK_TRIES; | ||
343 | int rc = 0; | ||
344 | |||
345 | switch (etd->hw_version) { | ||
346 | case 1: | ||
347 | etd->reg_10 = 0x16; | ||
348 | etd->reg_11 = 0x8f; | ||
349 | if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || | ||
350 | elantech_write_reg(psmouse, 0x11, etd->reg_11)) { | ||
351 | rc = -1; | ||
352 | } | ||
353 | break; | ||
354 | |||
355 | case 2: | ||
356 | /* Windows driver values */ | ||
357 | etd->reg_10 = 0x54; | ||
358 | etd->reg_11 = 0x88; /* 0x8a */ | ||
359 | etd->reg_21 = 0x60; /* 0x00 */ | ||
360 | if (elantech_write_reg(psmouse, 0x10, etd->reg_10) || | ||
361 | elantech_write_reg(psmouse, 0x11, etd->reg_11) || | ||
362 | elantech_write_reg(psmouse, 0x21, etd->reg_21)) { | ||
363 | rc = -1; | ||
364 | break; | ||
365 | } | ||
366 | /* | ||
367 | * Read back reg 0x10. The touchpad is probably initalising | ||
368 | * and not ready until we read back the value we just wrote. | ||
369 | */ | ||
370 | do { | ||
371 | rc = elantech_read_reg(psmouse, 0x10, &val); | ||
372 | if (rc == 0) | ||
373 | break; | ||
374 | tries--; | ||
375 | elantech_debug("elantech.c: retrying read (%d).\n", | ||
376 | tries); | ||
377 | msleep(ETP_READ_BACK_DELAY); | ||
378 | } while (tries > 0); | ||
379 | if (rc) | ||
380 | pr_err("elantech.c: failed to read back register 0x10.\n"); | ||
381 | break; | ||
382 | } | ||
383 | |||
384 | if (rc) | ||
385 | pr_err("elantech.c: failed to initialise registers.\n"); | ||
386 | |||
387 | return rc; | ||
388 | } | ||
389 | |||
390 | /* | ||
391 | * Set the appropriate event bits for the input subsystem | ||
392 | */ | ||
393 | static void elantech_set_input_params(struct psmouse *psmouse) | ||
394 | { | ||
395 | struct input_dev *dev = psmouse->dev; | ||
396 | struct elantech_data *etd = psmouse->private; | ||
397 | |||
398 | __set_bit(EV_KEY, dev->evbit); | ||
399 | __set_bit(EV_ABS, dev->evbit); | ||
400 | |||
401 | __set_bit(BTN_LEFT, dev->keybit); | ||
402 | __set_bit(BTN_RIGHT, dev->keybit); | ||
403 | |||
404 | __set_bit(BTN_TOUCH, dev->keybit); | ||
405 | __set_bit(BTN_TOOL_FINGER, dev->keybit); | ||
406 | __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); | ||
407 | __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); | ||
408 | |||
409 | switch (etd->hw_version) { | ||
410 | case 1: | ||
411 | /* Rocker button */ | ||
412 | if ((etd->fw_version_maj == 0x01) && | ||
413 | (etd->capabilities & ETP_CAP_HAS_ROCKER)) { | ||
414 | __set_bit(BTN_FORWARD, dev->keybit); | ||
415 | __set_bit(BTN_BACK, dev->keybit); | ||
416 | } | ||
417 | input_set_abs_params(dev, ABS_X, ETP_XMIN_V1, ETP_XMAX_V1, 0, 0); | ||
418 | input_set_abs_params(dev, ABS_Y, ETP_YMIN_V1, ETP_YMAX_V1, 0, 0); | ||
419 | break; | ||
420 | |||
421 | case 2: | ||
422 | input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); | ||
423 | input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); | ||
424 | input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); | ||
425 | input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); | ||
426 | input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); | ||
427 | input_set_abs_params(dev, ABS_HAT1Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); | ||
428 | break; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | struct elantech_attr_data { | ||
433 | size_t field_offset; | ||
434 | unsigned char reg; | ||
435 | }; | ||
436 | |||
437 | /* | ||
438 | * Display a register value by reading a sysfs entry | ||
439 | */ | ||
440 | static ssize_t elantech_show_int_attr(struct psmouse *psmouse, void *data, | ||
441 | char *buf) | ||
442 | { | ||
443 | struct elantech_data *etd = psmouse->private; | ||
444 | struct elantech_attr_data *attr = data; | ||
445 | unsigned char *reg = (unsigned char *) etd + attr->field_offset; | ||
446 | int rc = 0; | ||
447 | |||
448 | if (attr->reg) | ||
449 | rc = elantech_read_reg(psmouse, attr->reg, reg); | ||
450 | |||
451 | return sprintf(buf, "0x%02x\n", (attr->reg && rc) ? -1 : *reg); | ||
452 | } | ||
453 | |||
454 | /* | ||
455 | * Write a register value by writing a sysfs entry | ||
456 | */ | ||
457 | static ssize_t elantech_set_int_attr(struct psmouse *psmouse, | ||
458 | void *data, const char *buf, size_t count) | ||
459 | { | ||
460 | struct elantech_data *etd = psmouse->private; | ||
461 | struct elantech_attr_data *attr = data; | ||
462 | unsigned char *reg = (unsigned char *) etd + attr->field_offset; | ||
463 | unsigned long value; | ||
464 | int err; | ||
465 | |||
466 | err = strict_strtoul(buf, 16, &value); | ||
467 | if (err) | ||
468 | return err; | ||
469 | |||
470 | if (value > 0xff) | ||
471 | return -EINVAL; | ||
472 | |||
473 | /* Do we need to preserve some bits for version 2 hardware too? */ | ||
474 | if (etd->hw_version == 1) { | ||
475 | if (attr->reg == 0x10) | ||
476 | /* Force absolute mode always on */ | ||
477 | value |= ETP_R10_ABSOLUTE_MODE; | ||
478 | else if (attr->reg == 0x11) | ||
479 | /* Force 4 byte mode always on */ | ||
480 | value |= ETP_R11_4_BYTE_MODE; | ||
481 | } | ||
482 | |||
483 | if (!attr->reg || elantech_write_reg(psmouse, attr->reg, value) == 0) | ||
484 | *reg = value; | ||
485 | |||
486 | return count; | ||
487 | } | ||
488 | |||
489 | #define ELANTECH_INT_ATTR(_name, _register) \ | ||
490 | static struct elantech_attr_data elantech_attr_##_name = { \ | ||
491 | .field_offset = offsetof(struct elantech_data, _name), \ | ||
492 | .reg = _register, \ | ||
493 | }; \ | ||
494 | PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ | ||
495 | &elantech_attr_##_name, \ | ||
496 | elantech_show_int_attr, \ | ||
497 | elantech_set_int_attr) | ||
498 | |||
499 | ELANTECH_INT_ATTR(reg_10, 0x10); | ||
500 | ELANTECH_INT_ATTR(reg_11, 0x11); | ||
501 | ELANTECH_INT_ATTR(reg_20, 0x20); | ||
502 | ELANTECH_INT_ATTR(reg_21, 0x21); | ||
503 | ELANTECH_INT_ATTR(reg_22, 0x22); | ||
504 | ELANTECH_INT_ATTR(reg_23, 0x23); | ||
505 | ELANTECH_INT_ATTR(reg_24, 0x24); | ||
506 | ELANTECH_INT_ATTR(reg_25, 0x25); | ||
507 | ELANTECH_INT_ATTR(reg_26, 0x26); | ||
508 | ELANTECH_INT_ATTR(debug, 0); | ||
509 | ELANTECH_INT_ATTR(paritycheck, 0); | ||
510 | |||
511 | static struct attribute *elantech_attrs[] = { | ||
512 | &psmouse_attr_reg_10.dattr.attr, | ||
513 | &psmouse_attr_reg_11.dattr.attr, | ||
514 | &psmouse_attr_reg_20.dattr.attr, | ||
515 | &psmouse_attr_reg_21.dattr.attr, | ||
516 | &psmouse_attr_reg_22.dattr.attr, | ||
517 | &psmouse_attr_reg_23.dattr.attr, | ||
518 | &psmouse_attr_reg_24.dattr.attr, | ||
519 | &psmouse_attr_reg_25.dattr.attr, | ||
520 | &psmouse_attr_reg_26.dattr.attr, | ||
521 | &psmouse_attr_debug.dattr.attr, | ||
522 | &psmouse_attr_paritycheck.dattr.attr, | ||
523 | NULL | ||
524 | }; | ||
525 | |||
526 | static struct attribute_group elantech_attr_group = { | ||
527 | .attrs = elantech_attrs, | ||
528 | }; | ||
529 | |||
530 | /* | ||
531 | * Use magic knock to detect Elantech touchpad | ||
532 | */ | ||
533 | int elantech_detect(struct psmouse *psmouse, int set_properties) | ||
534 | { | ||
535 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
536 | unsigned char param[3]; | ||
537 | |||
538 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); | ||
539 | |||
540 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || | ||
541 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
542 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
543 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
544 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
545 | pr_err("elantech.c: sending Elantech magic knock failed.\n"); | ||
546 | return -1; | ||
547 | } | ||
548 | |||
549 | /* | ||
550 | * Report this in case there are Elantech models that use a different | ||
551 | * set of magic numbers | ||
552 | */ | ||
553 | if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) { | ||
554 | pr_info("elantech.c: unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", | ||
555 | param[0], param[1], param[2]); | ||
556 | return -1; | ||
557 | } | ||
558 | |||
559 | if (set_properties) { | ||
560 | psmouse->vendor = "Elantech"; | ||
561 | psmouse->name = "Touchpad"; | ||
562 | } | ||
563 | |||
564 | return 0; | ||
565 | } | ||
566 | |||
567 | /* | ||
568 | * Clean up sysfs entries when disconnecting | ||
569 | */ | ||
570 | static void elantech_disconnect(struct psmouse *psmouse) | ||
571 | { | ||
572 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, | ||
573 | &elantech_attr_group); | ||
574 | kfree(psmouse->private); | ||
575 | psmouse->private = NULL; | ||
576 | } | ||
577 | |||
578 | /* | ||
579 | * Put the touchpad back into absolute mode when reconnecting | ||
580 | */ | ||
581 | static int elantech_reconnect(struct psmouse *psmouse) | ||
582 | { | ||
583 | if (elantech_detect(psmouse, 0)) | ||
584 | return -1; | ||
585 | |||
586 | if (elantech_set_absolute_mode(psmouse)) { | ||
587 | pr_err("elantech.c: failed to put touchpad back into absolute mode.\n"); | ||
588 | return -1; | ||
589 | } | ||
590 | |||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | /* | ||
595 | * Initialize the touchpad and create sysfs entries | ||
596 | */ | ||
597 | int elantech_init(struct psmouse *psmouse) | ||
598 | { | ||
599 | struct elantech_data *etd; | ||
600 | int i, error; | ||
601 | unsigned char param[3]; | ||
602 | |||
603 | etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); | ||
604 | psmouse->private = etd; | ||
605 | if (!etd) | ||
606 | return -1; | ||
607 | |||
608 | etd->parity[0] = 1; | ||
609 | for (i = 1; i < 256; i++) | ||
610 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; | ||
611 | |||
612 | /* | ||
613 | * Find out what version hardware this is | ||
614 | */ | ||
615 | if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { | ||
616 | pr_err("elantech.c: failed to query firmware version.\n"); | ||
617 | goto init_fail; | ||
618 | } | ||
619 | pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", | ||
620 | param[0], param[1], param[2]); | ||
621 | etd->fw_version_maj = param[0]; | ||
622 | etd->fw_version_min = param[2]; | ||
623 | |||
624 | /* | ||
625 | * Assume every version greater than this is new EeePC style | ||
626 | * hardware with 6 byte packets | ||
627 | */ | ||
628 | if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) { | ||
629 | etd->hw_version = 2; | ||
630 | /* For now show extra debug information */ | ||
631 | etd->debug = 1; | ||
632 | /* Don't know how to do parity checking for version 2 */ | ||
633 | etd->paritycheck = 0; | ||
634 | } else { | ||
635 | etd->hw_version = 1; | ||
636 | etd->paritycheck = 1; | ||
637 | } | ||
638 | pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n", | ||
639 | etd->hw_version, etd->fw_version_maj, etd->fw_version_min); | ||
640 | |||
641 | if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) { | ||
642 | pr_err("elantech.c: failed to query capabilities.\n"); | ||
643 | goto init_fail; | ||
644 | } | ||
645 | pr_info("elantech.c: Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n", | ||
646 | param[0], param[1], param[2]); | ||
647 | etd->capabilities = param[0]; | ||
648 | |||
649 | if (elantech_set_absolute_mode(psmouse)) { | ||
650 | pr_err("elantech.c: failed to put touchpad into absolute mode.\n"); | ||
651 | goto init_fail; | ||
652 | } | ||
653 | |||
654 | elantech_set_input_params(psmouse); | ||
655 | |||
656 | error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, | ||
657 | &elantech_attr_group); | ||
658 | if (error) { | ||
659 | pr_err("elantech.c: failed to create sysfs attributes, error: %d.\n", | ||
660 | error); | ||
661 | goto init_fail; | ||
662 | } | ||
663 | |||
664 | psmouse->protocol_handler = elantech_process_byte; | ||
665 | psmouse->disconnect = elantech_disconnect; | ||
666 | psmouse->reconnect = elantech_reconnect; | ||
667 | psmouse->pktsize = etd->hw_version == 2 ? 6 : 4; | ||
668 | |||
669 | return 0; | ||
670 | |||
671 | init_fail: | ||
672 | kfree(etd); | ||
673 | return -1; | ||
674 | } | ||
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h new file mode 100644 index 000000000000..bee282b540bc --- /dev/null +++ b/drivers/input/mouse/elantech.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Elantech Touchpad driver (v5) | ||
3 | * | ||
4 | * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published | ||
8 | * by the Free Software Foundation. | ||
9 | * | ||
10 | * Trademarks are the property of their respective owners. | ||
11 | */ | ||
12 | |||
13 | #ifndef _ELANTECH_H | ||
14 | #define _ELANTECH_H | ||
15 | |||
16 | /* | ||
17 | * Command values for Synaptics style queries | ||
18 | */ | ||
19 | #define ETP_FW_VERSION_QUERY 0x01 | ||
20 | #define ETP_CAPABILITIES_QUERY 0x02 | ||
21 | |||
22 | /* | ||
23 | * Command values for register reading or writing | ||
24 | */ | ||
25 | #define ETP_REGISTER_READ 0x10 | ||
26 | #define ETP_REGISTER_WRITE 0x11 | ||
27 | |||
28 | /* | ||
29 | * Hardware version 2 custom PS/2 command value | ||
30 | */ | ||
31 | #define ETP_PS2_CUSTOM_COMMAND 0xf8 | ||
32 | |||
33 | /* | ||
34 | * Times to retry a ps2_command and millisecond delay between tries | ||
35 | */ | ||
36 | #define ETP_PS2_COMMAND_TRIES 3 | ||
37 | #define ETP_PS2_COMMAND_DELAY 500 | ||
38 | |||
39 | /* | ||
40 | * Times to try to read back a register and millisecond delay between tries | ||
41 | */ | ||
42 | #define ETP_READ_BACK_TRIES 5 | ||
43 | #define ETP_READ_BACK_DELAY 2000 | ||
44 | |||
45 | /* | ||
46 | * Register bitmasks for hardware version 1 | ||
47 | */ | ||
48 | #define ETP_R10_ABSOLUTE_MODE 0x04 | ||
49 | #define ETP_R11_4_BYTE_MODE 0x02 | ||
50 | |||
51 | /* | ||
52 | * Capability bitmasks | ||
53 | */ | ||
54 | #define ETP_CAP_HAS_ROCKER 0x04 | ||
55 | |||
56 | /* | ||
57 | * One hard to find application note states that X axis range is 0 to 576 | ||
58 | * and Y axis range is 0 to 384 for harware version 1. | ||
59 | * Edge fuzz might be necessary because of bezel around the touchpad | ||
60 | */ | ||
61 | #define ETP_EDGE_FUZZ_V1 32 | ||
62 | |||
63 | #define ETP_XMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1) | ||
64 | #define ETP_XMAX_V1 (576 - ETP_EDGE_FUZZ_V1) | ||
65 | #define ETP_YMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1) | ||
66 | #define ETP_YMAX_V1 (384 - ETP_EDGE_FUZZ_V1) | ||
67 | |||
68 | /* | ||
69 | * It seems the resolution for hardware version 2 doubled. | ||
70 | * Hence the X and Y ranges are doubled too. | ||
71 | * The bezel around the pad also appears to be smaller | ||
72 | */ | ||
73 | #define ETP_EDGE_FUZZ_V2 8 | ||
74 | |||
75 | #define ETP_XMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2) | ||
76 | #define ETP_XMAX_V2 (1152 - ETP_EDGE_FUZZ_V2) | ||
77 | #define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2) | ||
78 | #define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2) | ||
79 | |||
80 | /* | ||
81 | * For two finger touches the coordinate of each finger gets reported | ||
82 | * separately but with reduced resolution. | ||
83 | */ | ||
84 | #define ETP_2FT_FUZZ 4 | ||
85 | |||
86 | #define ETP_2FT_XMIN ( 0 + ETP_2FT_FUZZ) | ||
87 | #define ETP_2FT_XMAX (288 - ETP_2FT_FUZZ) | ||
88 | #define ETP_2FT_YMIN ( 0 + ETP_2FT_FUZZ) | ||
89 | #define ETP_2FT_YMAX (192 - ETP_2FT_FUZZ) | ||
90 | |||
91 | struct elantech_data { | ||
92 | unsigned char reg_10; | ||
93 | unsigned char reg_11; | ||
94 | unsigned char reg_20; | ||
95 | unsigned char reg_21; | ||
96 | unsigned char reg_22; | ||
97 | unsigned char reg_23; | ||
98 | unsigned char reg_24; | ||
99 | unsigned char reg_25; | ||
100 | unsigned char reg_26; | ||
101 | unsigned char debug; | ||
102 | unsigned char capabilities; | ||
103 | unsigned char fw_version_maj; | ||
104 | unsigned char fw_version_min; | ||
105 | unsigned char hw_version; | ||
106 | unsigned char paritycheck; | ||
107 | unsigned char parity[256]; | ||
108 | }; | ||
109 | |||
110 | #ifdef CONFIG_MOUSE_PS2_ELANTECH | ||
111 | int elantech_detect(struct psmouse *psmouse, int set_properties); | ||
112 | int elantech_init(struct psmouse *psmouse); | ||
113 | #else | ||
114 | static inline int elantech_detect(struct psmouse *psmouse, int set_properties) | ||
115 | { | ||
116 | return -ENOSYS; | ||
117 | } | ||
118 | static inline int elantech_init(struct psmouse *psmouse) | ||
119 | { | ||
120 | return -ENOSYS; | ||
121 | } | ||
122 | #endif /* CONFIG_MOUSE_PS2_ELANTECH */ | ||
123 | |||
124 | #endif | ||
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 126e977e199e..f8f86de694bb 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "lifebook.h" | 29 | #include "lifebook.h" |
30 | #include "trackpoint.h" | 30 | #include "trackpoint.h" |
31 | #include "touchkit_ps2.h" | 31 | #include "touchkit_ps2.h" |
32 | #include "elantech.h" | ||
32 | 33 | ||
33 | #define DRIVER_DESC "PS/2 mouse driver" | 34 | #define DRIVER_DESC "PS/2 mouse driver" |
34 | 35 | ||
@@ -650,6 +651,19 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
650 | max_proto = PSMOUSE_IMEX; | 651 | max_proto = PSMOUSE_IMEX; |
651 | } | 652 | } |
652 | 653 | ||
654 | /* | ||
655 | * Try Elantech touchpad. | ||
656 | */ | ||
657 | if (max_proto > PSMOUSE_IMEX && | ||
658 | elantech_detect(psmouse, set_properties) == 0) { | ||
659 | if (!set_properties || elantech_init(psmouse) == 0) | ||
660 | return PSMOUSE_ELANTECH; | ||
661 | /* | ||
662 | * Init failed, try basic relative protocols | ||
663 | */ | ||
664 | max_proto = PSMOUSE_IMEX; | ||
665 | } | ||
666 | |||
653 | if (max_proto > PSMOUSE_IMEX) { | 667 | if (max_proto > PSMOUSE_IMEX) { |
654 | if (genius_detect(psmouse, set_properties) == 0) | 668 | if (genius_detect(psmouse, set_properties) == 0) |
655 | return PSMOUSE_GENPS; | 669 | return PSMOUSE_GENPS; |
@@ -789,6 +803,15 @@ static const struct psmouse_protocol psmouse_protocols[] = { | |||
789 | .detect = hgpk_detect, | 803 | .detect = hgpk_detect, |
790 | }, | 804 | }, |
791 | #endif | 805 | #endif |
806 | #ifdef CONFIG_MOUSE_PS2_ELANTECH | ||
807 | { | ||
808 | .type = PSMOUSE_ELANTECH, | ||
809 | .name = "ETPS/2", | ||
810 | .alias = "elantech", | ||
811 | .detect = elantech_detect, | ||
812 | .init = elantech_init, | ||
813 | }, | ||
814 | #endif | ||
792 | { | 815 | { |
793 | .type = PSMOUSE_CORTRON, | 816 | .type = PSMOUSE_CORTRON, |
794 | .name = "CortronPS/2", | 817 | .name = "CortronPS/2", |
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 8b608a1cdd12..54ed267894bd 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -90,6 +90,7 @@ enum psmouse_type { | |||
90 | PSMOUSE_TOUCHKIT_PS2, | 90 | PSMOUSE_TOUCHKIT_PS2, |
91 | PSMOUSE_CORTRON, | 91 | PSMOUSE_CORTRON, |
92 | PSMOUSE_HGPK, | 92 | PSMOUSE_HGPK, |
93 | PSMOUSE_ELANTECH, | ||
93 | PSMOUSE_AUTO /* This one should always be last */ | 94 | PSMOUSE_AUTO /* This one should always be last */ |
94 | }; | 95 | }; |
95 | 96 | ||
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 8137e50ded87..d8c056fe7e98 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -519,7 +519,6 @@ static int mousedev_release(struct inode *inode, struct file *file) | |||
519 | struct mousedev_client *client = file->private_data; | 519 | struct mousedev_client *client = file->private_data; |
520 | struct mousedev *mousedev = client->mousedev; | 520 | struct mousedev *mousedev = client->mousedev; |
521 | 521 | ||
522 | mousedev_fasync(-1, file, 0); | ||
523 | mousedev_detach_client(mousedev, client); | 522 | mousedev_detach_client(mousedev, client); |
524 | kfree(client); | 523 | kfree(client); |
525 | 524 | ||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index a321aea2c7b5..eec375cd10e6 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -135,6 +135,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { | |||
135 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), | 135 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), |
136 | }, | 136 | }, |
137 | }, | 137 | }, |
138 | { | ||
139 | .ident = "Blue FB5601", | ||
140 | .matches = { | ||
141 | DMI_MATCH(DMI_SYS_VENDOR, "blue"), | ||
142 | DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"), | ||
143 | DMI_MATCH(DMI_PRODUCT_VERSION, "M606"), | ||
144 | }, | ||
145 | }, | ||
138 | { } | 146 | { } |
139 | }; | 147 | }; |
140 | 148 | ||
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 470770c09260..06bbd0e74c6f 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -135,7 +135,6 @@ static int serio_raw_release(struct inode *inode, struct file *file) | |||
135 | 135 | ||
136 | mutex_lock(&serio_raw_mutex); | 136 | mutex_lock(&serio_raw_mutex); |
137 | 137 | ||
138 | serio_raw_fasync(-1, file, 0); | ||
139 | serio_raw_cleanup(serio_raw); | 138 | serio_raw_cleanup(serio_raw); |
140 | 139 | ||
141 | mutex_unlock(&serio_raw_mutex); | 140 | mutex_unlock(&serio_raw_mutex); |
diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c index f1fddb18d70d..1f3cc512eff8 100644 --- a/drivers/leds/leds-da903x.c +++ b/drivers/leds/leds-da903x.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/leds.h> | 19 | #include <linux/leds.h> |
20 | #include <linux/workqueue.h> | ||
20 | #include <linux/mfd/da903x.h> | 21 | #include <linux/mfd/da903x.h> |
21 | 22 | ||
22 | #define DA9030_LED1_CONTROL 0x20 | 23 | #define DA9030_LED1_CONTROL 0x20 |
@@ -57,7 +58,7 @@ static void da903x_led_work(struct work_struct *work) | |||
57 | offset = DA9030_LED_OFFSET(led->id); | 58 | offset = DA9030_LED_OFFSET(led->id); |
58 | val = led->flags & ~0x87; | 59 | val = led->flags & ~0x87; |
59 | val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */ | 60 | val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */ |
60 | val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */ | 61 | val |= (0x7 - (led->new_brightness >> 5)) & 0x7; /* PWM<2:0> */ |
61 | da903x_write(led->master, DA9030_LED1_CONTROL + offset, val); | 62 | da903x_write(led->master, DA9030_LED1_CONTROL + offset, val); |
62 | break; | 63 | break; |
63 | case DA9030_ID_VIBRA: | 64 | case DA9030_ID_VIBRA: |
diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c index 53a25b1c2dae..44fa757d8254 100644 --- a/drivers/leds/leds-hp-disk.c +++ b/drivers/leds/leds-hp-disk.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/input.h> | 28 | #include <linux/input.h> |
29 | #include <linux/kthread.h> | 29 | #include <linux/kthread.h> |
30 | #include <linux/version.h> | ||
31 | #include <linux/leds.h> | 30 | #include <linux/leds.h> |
32 | #include <acpi/acpi_drivers.h> | 31 | #include <acpi/acpi_drivers.h> |
33 | 32 | ||
@@ -49,7 +48,7 @@ static struct acpi_hpled adev; | |||
49 | 48 | ||
50 | static acpi_status hpled_acpi_write(acpi_handle handle, int reg) | 49 | static acpi_status hpled_acpi_write(acpi_handle handle, int reg) |
51 | { | 50 | { |
52 | unsigned long ret; /* Not used when writing */ | 51 | unsigned long long ret; /* Not used when writing */ |
53 | union acpi_object in_obj[1]; | 52 | union acpi_object in_obj[1]; |
54 | struct acpi_object_list args = { 1, in_obj }; | 53 | struct acpi_object_list args = { 1, in_obj }; |
55 | 54 | ||
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 | */ |
230 | static int register_snapshot(struct dm_snapshot *snap) | 230 | static 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 | ||
376 | static void free_pending_exception(struct dm_snap_pending_exception *pe) | 379 | static 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 | ||
381 | static void insert_completed_exception(struct dm_snapshot *s, | 388 | static 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/linear.c b/drivers/md/linear.c index 190147c79e79..3b90c5c924ec 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -148,6 +148,8 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
148 | 148 | ||
149 | min_sectors = conf->array_sectors; | 149 | min_sectors = conf->array_sectors; |
150 | sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *)); | 150 | sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *)); |
151 | if (min_sectors == 0) | ||
152 | min_sectors = 1; | ||
151 | 153 | ||
152 | /* min_sectors is the minimum spacing that will fit the hash | 154 | /* min_sectors is the minimum spacing that will fit the hash |
153 | * table in one PAGE. This may be much smaller than needed. | 155 | * table in one PAGE. This may be much smaller than needed. |
diff --git a/drivers/md/md.c b/drivers/md/md.c index c1a837ca193c..1b1d32694f6f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -222,6 +222,9 @@ static void mddev_put(mddev_t *mddev) | |||
222 | list_del(&mddev->all_mddevs); | 222 | list_del(&mddev->all_mddevs); |
223 | spin_unlock(&all_mddevs_lock); | 223 | spin_unlock(&all_mddevs_lock); |
224 | blk_cleanup_queue(mddev->queue); | 224 | blk_cleanup_queue(mddev->queue); |
225 | if (mddev->sysfs_state) | ||
226 | sysfs_put(mddev->sysfs_state); | ||
227 | mddev->sysfs_state = NULL; | ||
225 | kobject_put(&mddev->kobj); | 228 | kobject_put(&mddev->kobj); |
226 | } else | 229 | } else |
227 | spin_unlock(&all_mddevs_lock); | 230 | spin_unlock(&all_mddevs_lock); |
@@ -1459,6 +1462,8 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1459 | kobject_del(&rdev->kobj); | 1462 | kobject_del(&rdev->kobj); |
1460 | goto fail; | 1463 | goto fail; |
1461 | } | 1464 | } |
1465 | rdev->sysfs_state = sysfs_get_dirent(rdev->kobj.sd, "state"); | ||
1466 | |||
1462 | list_add_rcu(&rdev->same_set, &mddev->disks); | 1467 | list_add_rcu(&rdev->same_set, &mddev->disks); |
1463 | bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); | 1468 | bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); |
1464 | return 0; | 1469 | return 0; |
@@ -1488,7 +1493,8 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) | |||
1488 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); | 1493 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); |
1489 | rdev->mddev = NULL; | 1494 | rdev->mddev = NULL; |
1490 | sysfs_remove_link(&rdev->kobj, "block"); | 1495 | sysfs_remove_link(&rdev->kobj, "block"); |
1491 | 1496 | sysfs_put(rdev->sysfs_state); | |
1497 | rdev->sysfs_state = NULL; | ||
1492 | /* We need to delay this, otherwise we can deadlock when | 1498 | /* We need to delay this, otherwise we can deadlock when |
1493 | * writing to 'remove' to "dev/state". We also need | 1499 | * writing to 'remove' to "dev/state". We also need |
1494 | * to delay it due to rcu usage. | 1500 | * to delay it due to rcu usage. |
@@ -1923,8 +1929,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1923 | 1929 | ||
1924 | err = 0; | 1930 | err = 0; |
1925 | } | 1931 | } |
1926 | if (!err) | 1932 | if (!err && rdev->sysfs_state) |
1927 | sysfs_notify(&rdev->kobj, NULL, "state"); | 1933 | sysfs_notify_dirent(rdev->sysfs_state); |
1928 | return err ? err : len; | 1934 | return err ? err : len; |
1929 | } | 1935 | } |
1930 | static struct rdev_sysfs_entry rdev_state = | 1936 | static struct rdev_sysfs_entry rdev_state = |
@@ -2019,7 +2025,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2019 | rdev->raid_disk = -1; | 2025 | rdev->raid_disk = -1; |
2020 | return err; | 2026 | return err; |
2021 | } else | 2027 | } else |
2022 | sysfs_notify(&rdev->kobj, NULL, "state"); | 2028 | sysfs_notify_dirent(rdev->sysfs_state); |
2023 | sprintf(nm, "rd%d", rdev->raid_disk); | 2029 | sprintf(nm, "rd%d", rdev->raid_disk); |
2024 | if (sysfs_create_link(&rdev->mddev->kobj, &rdev->kobj, nm)) | 2030 | if (sysfs_create_link(&rdev->mddev->kobj, &rdev->kobj, nm)) |
2025 | printk(KERN_WARNING | 2031 | printk(KERN_WARNING |
@@ -2036,7 +2042,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2036 | clear_bit(Faulty, &rdev->flags); | 2042 | clear_bit(Faulty, &rdev->flags); |
2037 | clear_bit(WriteMostly, &rdev->flags); | 2043 | clear_bit(WriteMostly, &rdev->flags); |
2038 | set_bit(In_sync, &rdev->flags); | 2044 | set_bit(In_sync, &rdev->flags); |
2039 | sysfs_notify(&rdev->kobj, NULL, "state"); | 2045 | sysfs_notify_dirent(rdev->sysfs_state); |
2040 | } | 2046 | } |
2041 | return len; | 2047 | return len; |
2042 | } | 2048 | } |
@@ -2770,7 +2776,7 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) | |||
2770 | if (err) | 2776 | if (err) |
2771 | return err; | 2777 | return err; |
2772 | else { | 2778 | else { |
2773 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 2779 | sysfs_notify_dirent(mddev->sysfs_state); |
2774 | return len; | 2780 | return len; |
2775 | } | 2781 | } |
2776 | } | 2782 | } |
@@ -3457,6 +3463,11 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
3457 | disk->fops = &md_fops; | 3463 | disk->fops = &md_fops; |
3458 | disk->private_data = mddev; | 3464 | disk->private_data = mddev; |
3459 | disk->queue = mddev->queue; | 3465 | disk->queue = mddev->queue; |
3466 | /* Allow extended partitions. This makes the | ||
3467 | * 'mdp' device redundant, but we can really | ||
3468 | * remove it now. | ||
3469 | */ | ||
3470 | disk->flags |= GENHD_FL_EXT_DEVT; | ||
3460 | add_disk(disk); | 3471 | add_disk(disk); |
3461 | mddev->gendisk = disk; | 3472 | mddev->gendisk = disk; |
3462 | error = kobject_init_and_add(&mddev->kobj, &md_ktype, | 3473 | error = kobject_init_and_add(&mddev->kobj, &md_ktype, |
@@ -3465,8 +3476,10 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
3465 | if (error) | 3476 | if (error) |
3466 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", | 3477 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", |
3467 | disk->disk_name); | 3478 | disk->disk_name); |
3468 | else | 3479 | else { |
3469 | kobject_uevent(&mddev->kobj, KOBJ_ADD); | 3480 | kobject_uevent(&mddev->kobj, KOBJ_ADD); |
3481 | mddev->sysfs_state = sysfs_get_dirent(mddev->kobj.sd, "array_state"); | ||
3482 | } | ||
3470 | return NULL; | 3483 | return NULL; |
3471 | } | 3484 | } |
3472 | 3485 | ||
@@ -3477,7 +3490,7 @@ static void md_safemode_timeout(unsigned long data) | |||
3477 | if (!atomic_read(&mddev->writes_pending)) { | 3490 | if (!atomic_read(&mddev->writes_pending)) { |
3478 | mddev->safemode = 1; | 3491 | mddev->safemode = 1; |
3479 | if (mddev->external) | 3492 | if (mddev->external) |
3480 | set_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags); | 3493 | sysfs_notify_dirent(mddev->sysfs_state); |
3481 | } | 3494 | } |
3482 | md_wakeup_thread(mddev->thread); | 3495 | md_wakeup_thread(mddev->thread); |
3483 | } | 3496 | } |
@@ -3578,7 +3591,7 @@ static int do_md_run(mddev_t * mddev) | |||
3578 | return -EINVAL; | 3591 | return -EINVAL; |
3579 | } | 3592 | } |
3580 | } | 3593 | } |
3581 | sysfs_notify(&rdev->kobj, NULL, "state"); | 3594 | sysfs_notify_dirent(rdev->sysfs_state); |
3582 | } | 3595 | } |
3583 | 3596 | ||
3584 | md_probe(mddev->unit, NULL, NULL); | 3597 | md_probe(mddev->unit, NULL, NULL); |
@@ -3740,7 +3753,7 @@ static int do_md_run(mddev_t * mddev) | |||
3740 | 3753 | ||
3741 | mddev->changed = 1; | 3754 | mddev->changed = 1; |
3742 | md_new_event(mddev); | 3755 | md_new_event(mddev); |
3743 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 3756 | sysfs_notify_dirent(mddev->sysfs_state); |
3744 | sysfs_notify(&mddev->kobj, NULL, "sync_action"); | 3757 | sysfs_notify(&mddev->kobj, NULL, "sync_action"); |
3745 | sysfs_notify(&mddev->kobj, NULL, "degraded"); | 3758 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
3746 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | 3759 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); |
@@ -3767,7 +3780,7 @@ static int restart_array(mddev_t *mddev) | |||
3767 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3780 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
3768 | md_wakeup_thread(mddev->thread); | 3781 | md_wakeup_thread(mddev->thread); |
3769 | md_wakeup_thread(mddev->sync_thread); | 3782 | md_wakeup_thread(mddev->sync_thread); |
3770 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 3783 | sysfs_notify_dirent(mddev->sysfs_state); |
3771 | return 0; | 3784 | return 0; |
3772 | } | 3785 | } |
3773 | 3786 | ||
@@ -3847,7 +3860,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
3847 | module_put(mddev->pers->owner); | 3860 | module_put(mddev->pers->owner); |
3848 | mddev->pers = NULL; | 3861 | mddev->pers = NULL; |
3849 | /* tell userspace to handle 'inactive' */ | 3862 | /* tell userspace to handle 'inactive' */ |
3850 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 3863 | sysfs_notify_dirent(mddev->sysfs_state); |
3851 | 3864 | ||
3852 | set_capacity(disk, 0); | 3865 | set_capacity(disk, 0); |
3853 | mddev->changed = 1; | 3866 | mddev->changed = 1; |
@@ -3927,13 +3940,14 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
3927 | mddev->degraded = 0; | 3940 | mddev->degraded = 0; |
3928 | mddev->barriers_work = 0; | 3941 | mddev->barriers_work = 0; |
3929 | mddev->safemode = 0; | 3942 | mddev->safemode = 0; |
3943 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | ||
3930 | 3944 | ||
3931 | } else if (mddev->pers) | 3945 | } else if (mddev->pers) |
3932 | printk(KERN_INFO "md: %s switched to read-only mode.\n", | 3946 | printk(KERN_INFO "md: %s switched to read-only mode.\n", |
3933 | mdname(mddev)); | 3947 | mdname(mddev)); |
3934 | err = 0; | 3948 | err = 0; |
3935 | md_new_event(mddev); | 3949 | md_new_event(mddev); |
3936 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 3950 | sysfs_notify_dirent(mddev->sysfs_state); |
3937 | out: | 3951 | out: |
3938 | return err; | 3952 | return err; |
3939 | } | 3953 | } |
@@ -4297,7 +4311,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
4297 | if (err) | 4311 | if (err) |
4298 | export_rdev(rdev); | 4312 | export_rdev(rdev); |
4299 | else | 4313 | else |
4300 | sysfs_notify(&rdev->kobj, NULL, "state"); | 4314 | sysfs_notify_dirent(rdev->sysfs_state); |
4301 | 4315 | ||
4302 | md_update_sb(mddev, 1); | 4316 | md_update_sb(mddev, 1); |
4303 | if (mddev->degraded) | 4317 | if (mddev->degraded) |
@@ -4938,7 +4952,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, | |||
4938 | if (_IOC_TYPE(cmd) == MD_MAJOR && mddev->ro && mddev->pers) { | 4952 | if (_IOC_TYPE(cmd) == MD_MAJOR && mddev->ro && mddev->pers) { |
4939 | if (mddev->ro == 2) { | 4953 | if (mddev->ro == 2) { |
4940 | mddev->ro = 0; | 4954 | mddev->ro = 0; |
4941 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 4955 | sysfs_notify_dirent(mddev->sysfs_state); |
4942 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 4956 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
4943 | md_wakeup_thread(mddev->thread); | 4957 | md_wakeup_thread(mddev->thread); |
4944 | } else { | 4958 | } else { |
@@ -5612,7 +5626,7 @@ void md_write_start(mddev_t *mddev, struct bio *bi) | |||
5612 | spin_unlock_irq(&mddev->write_lock); | 5626 | spin_unlock_irq(&mddev->write_lock); |
5613 | } | 5627 | } |
5614 | if (did_change) | 5628 | if (did_change) |
5615 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 5629 | sysfs_notify_dirent(mddev->sysfs_state); |
5616 | wait_event(mddev->sb_wait, | 5630 | wait_event(mddev->sb_wait, |
5617 | !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && | 5631 | !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && |
5618 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | 5632 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); |
@@ -5655,7 +5669,7 @@ int md_allow_write(mddev_t *mddev) | |||
5655 | mddev->safemode = 1; | 5669 | mddev->safemode = 1; |
5656 | spin_unlock_irq(&mddev->write_lock); | 5670 | spin_unlock_irq(&mddev->write_lock); |
5657 | md_update_sb(mddev, 0); | 5671 | md_update_sb(mddev, 0); |
5658 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 5672 | sysfs_notify_dirent(mddev->sysfs_state); |
5659 | } else | 5673 | } else |
5660 | spin_unlock_irq(&mddev->write_lock); | 5674 | spin_unlock_irq(&mddev->write_lock); |
5661 | 5675 | ||
@@ -6048,9 +6062,6 @@ void md_check_recovery(mddev_t *mddev) | |||
6048 | if (mddev->bitmap) | 6062 | if (mddev->bitmap) |
6049 | bitmap_daemon_work(mddev->bitmap); | 6063 | bitmap_daemon_work(mddev->bitmap); |
6050 | 6064 | ||
6051 | if (test_and_clear_bit(MD_NOTIFY_ARRAY_STATE, &mddev->flags)) | ||
6052 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
6053 | |||
6054 | if (mddev->ro) | 6065 | if (mddev->ro) |
6055 | return; | 6066 | return; |
6056 | 6067 | ||
@@ -6103,7 +6114,7 @@ void md_check_recovery(mddev_t *mddev) | |||
6103 | mddev->safemode = 0; | 6114 | mddev->safemode = 0; |
6104 | spin_unlock_irq(&mddev->write_lock); | 6115 | spin_unlock_irq(&mddev->write_lock); |
6105 | if (did_change) | 6116 | if (did_change) |
6106 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | 6117 | sysfs_notify_dirent(mddev->sysfs_state); |
6107 | } | 6118 | } |
6108 | 6119 | ||
6109 | if (mddev->flags) | 6120 | if (mddev->flags) |
@@ -6111,7 +6122,7 @@ void md_check_recovery(mddev_t *mddev) | |||
6111 | 6122 | ||
6112 | rdev_for_each(rdev, rtmp, mddev) | 6123 | rdev_for_each(rdev, rtmp, mddev) |
6113 | if (test_and_clear_bit(StateChanged, &rdev->flags)) | 6124 | if (test_and_clear_bit(StateChanged, &rdev->flags)) |
6114 | sysfs_notify(&rdev->kobj, NULL, "state"); | 6125 | sysfs_notify_dirent(rdev->sysfs_state); |
6115 | 6126 | ||
6116 | 6127 | ||
6117 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && | 6128 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && |
@@ -6221,7 +6232,7 @@ void md_check_recovery(mddev_t *mddev) | |||
6221 | 6232 | ||
6222 | void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev) | 6233 | void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev) |
6223 | { | 6234 | { |
6224 | sysfs_notify(&rdev->kobj, NULL, "state"); | 6235 | sysfs_notify_dirent(rdev->sysfs_state); |
6225 | wait_event_timeout(rdev->blocked_wait, | 6236 | wait_event_timeout(rdev->blocked_wait, |
6226 | !test_bit(Blocked, &rdev->flags), | 6237 | !test_bit(Blocked, &rdev->flags), |
6227 | msecs_to_jiffies(5000)); | 6238 | msecs_to_jiffies(5000)); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index da5129a24b18..970a96ef9b18 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1137,7 +1137,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1137 | if (!enough(conf)) | 1137 | if (!enough(conf)) |
1138 | return -EINVAL; | 1138 | return -EINVAL; |
1139 | 1139 | ||
1140 | if (rdev->raid_disk) | 1140 | if (rdev->raid_disk >= 0) |
1141 | first = last = rdev->raid_disk; | 1141 | first = last = rdev->raid_disk; |
1142 | 1142 | ||
1143 | if (rdev->saved_raid_disk >= 0 && | 1143 | if (rdev->saved_raid_disk >= 0 && |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 5689d1f1d444..8557bf12cfb4 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -223,6 +223,8 @@ static void dvb_frontend_init(struct dvb_frontend *fe) | |||
223 | if (fe->ops.init) | 223 | if (fe->ops.init) |
224 | fe->ops.init(fe); | 224 | fe->ops.init(fe); |
225 | if (fe->ops.tuner_ops.init) { | 225 | if (fe->ops.tuner_ops.init) { |
226 | if (fe->ops.i2c_gate_ctrl) | ||
227 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
226 | fe->ops.tuner_ops.init(fe); | 228 | fe->ops.tuner_ops.init(fe); |
227 | if (fe->ops.i2c_gate_ctrl) | 229 | if (fe->ops.i2c_gate_ctrl) |
228 | fe->ops.i2c_gate_ctrl(fe, 0); | 230 | fe->ops.i2c_gate_ctrl(fe, 0); |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 3c13bcfa6385..62b68c291d99 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -261,7 +261,7 @@ config DVB_USB_DW2102 | |||
261 | Say Y here to support the DvbWorld DVB-S/S2 USB2.0 receivers | 261 | Say Y here to support the DvbWorld DVB-S/S2 USB2.0 receivers |
262 | and the TeVii S650. | 262 | and the TeVii S650. |
263 | 263 | ||
264 | config DVB_USB_CINERGY_T2 | 264 | config DVB_USB_CINERGY_T2 |
265 | tristate "Terratec CinergyT2/qanu USB 2.0 DVB-T receiver" | 265 | tristate "Terratec CinergyT2/qanu USB 2.0 DVB-T receiver" |
266 | depends on DVB_USB | 266 | depends on DVB_USB |
267 | help | 267 | help |
@@ -283,6 +283,7 @@ config DVB_USB_ANYSEE | |||
283 | config DVB_USB_DTV5100 | 283 | config DVB_USB_DTV5100 |
284 | tristate "AME DTV-5100 USB2.0 DVB-T support" | 284 | tristate "AME DTV-5100 USB2.0 DVB-T support" |
285 | depends on DVB_USB | 285 | depends on DVB_USB |
286 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | ||
286 | select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE | 287 | select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE |
287 | help | 288 | help |
288 | Say Y here to support the AME DTV-5100 USB2.0 DVB-T receiver. | 289 | Say Y here to support the AME DTV-5100 USB2.0 DVB-T receiver. |
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index cb0829c038ce..847d8fdd9ec4 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c | |||
@@ -31,13 +31,13 @@ | |||
31 | #include "mc44s80x.h" | 31 | #include "mc44s80x.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | int dvb_usb_af9015_debug; | 34 | static int dvb_usb_af9015_debug; |
35 | module_param_named(debug, dvb_usb_af9015_debug, int, 0644); | 35 | module_param_named(debug, dvb_usb_af9015_debug, int, 0644); |
36 | MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); | 36 | MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); |
37 | int dvb_usb_af9015_remote; | 37 | static int dvb_usb_af9015_remote; |
38 | module_param_named(remote, dvb_usb_af9015_remote, int, 0644); | 38 | module_param_named(remote, dvb_usb_af9015_remote, int, 0644); |
39 | MODULE_PARM_DESC(remote, "select remote"); | 39 | MODULE_PARM_DESC(remote, "select remote"); |
40 | int dvb_usb_af9015_dual_mode; | 40 | static int dvb_usb_af9015_dual_mode; |
41 | module_param_named(dual_mode, dvb_usb_af9015_dual_mode, int, 0644); | 41 | module_param_named(dual_mode, dvb_usb_af9015_dual_mode, int, 0644); |
42 | MODULE_PARM_DESC(dual_mode, "enable dual mode"); | 42 | MODULE_PARM_DESC(dual_mode, "enable dual mode"); |
43 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 43 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
@@ -46,7 +46,7 @@ static DEFINE_MUTEX(af9015_usb_mutex); | |||
46 | 46 | ||
47 | static struct af9015_config af9015_config; | 47 | static struct af9015_config af9015_config; |
48 | static struct dvb_usb_device_properties af9015_properties[2]; | 48 | static struct dvb_usb_device_properties af9015_properties[2]; |
49 | int af9015_properties_count = ARRAY_SIZE(af9015_properties); | 49 | static int af9015_properties_count = ARRAY_SIZE(af9015_properties); |
50 | 50 | ||
51 | static struct af9013_config af9015_af9013_config[] = { | 51 | static struct af9013_config af9015_af9013_config[] = { |
52 | { | 52 | { |
@@ -549,7 +549,7 @@ static int af9015_eeprom_dump(struct dvb_usb_device *d) | |||
549 | return 0; | 549 | return 0; |
550 | } | 550 | } |
551 | 551 | ||
552 | int af9015_download_ir_table(struct dvb_usb_device *d) | 552 | static int af9015_download_ir_table(struct dvb_usb_device *d) |
553 | { | 553 | { |
554 | int i, packets = 0, ret; | 554 | int i, packets = 0, ret; |
555 | u16 addr = 0x9a56; /* ir-table start address */ | 555 | u16 addr = 0x9a56; /* ir-table start address */ |
@@ -999,7 +999,7 @@ static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
999 | } | 999 | } |
1000 | 1000 | ||
1001 | /* init 2nd I2C adapter */ | 1001 | /* init 2nd I2C adapter */ |
1002 | int af9015_i2c_init(struct dvb_usb_device *d) | 1002 | static int af9015_i2c_init(struct dvb_usb_device *d) |
1003 | { | 1003 | { |
1004 | int ret; | 1004 | int ret; |
1005 | struct af9015_state *state = d->priv; | 1005 | struct af9015_state *state = d->priv; |
@@ -1419,7 +1419,7 @@ static int af9015_usb_probe(struct usb_interface *intf, | |||
1419 | return ret; | 1419 | return ret; |
1420 | } | 1420 | } |
1421 | 1421 | ||
1422 | void af9015_i2c_exit(struct dvb_usb_device *d) | 1422 | static void af9015_i2c_exit(struct dvb_usb_device *d) |
1423 | { | 1423 | { |
1424 | struct af9015_state *state = d->priv; | 1424 | struct af9015_state *state = d->priv; |
1425 | deb_info("%s: \n", __func__); | 1425 | deb_info("%s: \n", __func__); |
diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h index 882e8a4b3681..6c3c97293316 100644 --- a/drivers/media/dvb/dvb-usb/af9015.h +++ b/drivers/media/dvb/dvb-usb/af9015.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #define DVB_USB_LOG_PREFIX "af9015" | 27 | #define DVB_USB_LOG_PREFIX "af9015" |
28 | #include "dvb-usb.h" | 28 | #include "dvb-usb.h" |
29 | 29 | ||
30 | extern int dvb_usb_af9015_debug; | ||
31 | #define deb_info(args...) dprintk(dvb_usb_af9015_debug, 0x01, args) | 30 | #define deb_info(args...) dprintk(dvb_usb_af9015_debug, 0x01, args) |
32 | #define deb_rc(args...) dprintk(dvb_usb_af9015_debug, 0x02, args) | 31 | #define deb_rc(args...) dprintk(dvb_usb_af9015_debug, 0x02, args) |
33 | #define deb_xfer(args...) dprintk(dvb_usb_af9015_debug, 0x04, args) | 32 | #define deb_xfer(args...) dprintk(dvb_usb_af9015_debug, 0x04, args) |
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index c786359fba03..cd2edbcaa097 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c | |||
@@ -46,7 +46,7 @@ module_param_named(delsys, dvb_usb_anysee_delsys, int, 0644); | |||
46 | MODULE_PARM_DESC(delsys, "select delivery mode (0=DVB-C, 1=DVB-T)"); | 46 | MODULE_PARM_DESC(delsys, "select delivery mode (0=DVB-C, 1=DVB-T)"); |
47 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 47 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
48 | 48 | ||
49 | static struct mutex anysee_usb_mutex; | 49 | static DEFINE_MUTEX(anysee_usb_mutex); |
50 | 50 | ||
51 | static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | 51 | static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, |
52 | u8 *rbuf, u8 rlen) | 52 | u8 *rbuf, u8 rlen) |
@@ -456,8 +456,6 @@ static int anysee_probe(struct usb_interface *intf, | |||
456 | struct usb_host_interface *alt; | 456 | struct usb_host_interface *alt; |
457 | int ret; | 457 | int ret; |
458 | 458 | ||
459 | mutex_init(&anysee_usb_mutex); | ||
460 | |||
461 | /* There is one interface with two alternate settings. | 459 | /* There is one interface with two alternate settings. |
462 | Alternate setting 0 is for bulk transfer. | 460 | Alternate setting 0 is for bulk transfer. |
463 | Alternate setting 1 is for isochronous transfer. | 461 | Alternate setting 1 is for isochronous transfer. |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 5cef12a07f72..6fe71c6745eb 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c | |||
@@ -13,14 +13,14 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, | |||
13 | { | 13 | { |
14 | int actlen,ret = -ENOMEM; | 14 | int actlen,ret = -ENOMEM; |
15 | 15 | ||
16 | if (!d || wbuf == NULL || wlen == 0) | ||
17 | return -EINVAL; | ||
18 | |||
16 | if (d->props.generic_bulk_ctrl_endpoint == 0) { | 19 | if (d->props.generic_bulk_ctrl_endpoint == 0) { |
17 | err("endpoint for generic control not specified."); | 20 | err("endpoint for generic control not specified."); |
18 | return -EINVAL; | 21 | return -EINVAL; |
19 | } | 22 | } |
20 | 23 | ||
21 | if (wbuf == NULL || wlen == 0) | ||
22 | return -EINVAL; | ||
23 | |||
24 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) | 24 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) |
25 | return ret; | 25 | return ret; |
26 | 26 | ||
diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c index 21c1060cf10e..692b68a9e73b 100644 --- a/drivers/media/dvb/frontends/af9013.c +++ b/drivers/media/dvb/frontends/af9013.c | |||
@@ -1187,7 +1187,7 @@ static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
1187 | if (tmp) | 1187 | if (tmp) |
1188 | *status |= FE_HAS_SYNC | FE_HAS_LOCK; | 1188 | *status |= FE_HAS_SYNC | FE_HAS_LOCK; |
1189 | 1189 | ||
1190 | if (!*status & FE_HAS_SIGNAL) { | 1190 | if (!(*status & FE_HAS_SIGNAL)) { |
1191 | /* AGC lock */ | 1191 | /* AGC lock */ |
1192 | ret = af9013_read_reg_bits(state, 0xd1a0, 6, 1, &tmp); | 1192 | ret = af9013_read_reg_bits(state, 0xd1a0, 6, 1, &tmp); |
1193 | if (ret) | 1193 | if (ret) |
@@ -1196,7 +1196,7 @@ static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
1196 | *status |= FE_HAS_SIGNAL; | 1196 | *status |= FE_HAS_SIGNAL; |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | if (!*status & FE_HAS_CARRIER) { | 1199 | if (!(*status & FE_HAS_CARRIER)) { |
1200 | /* CFO lock */ | 1200 | /* CFO lock */ |
1201 | ret = af9013_read_reg_bits(state, 0xd333, 7, 1, &tmp); | 1201 | ret = af9013_read_reg_bits(state, 0xd333, 7, 1, &tmp); |
1202 | if (ret) | 1202 | if (ret) |
@@ -1205,7 +1205,7 @@ static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
1205 | *status |= FE_HAS_CARRIER; | 1205 | *status |= FE_HAS_CARRIER; |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | if (!*status & FE_HAS_CARRIER) { | 1208 | if (!(*status & FE_HAS_CARRIER)) { |
1209 | /* SFOE lock */ | 1209 | /* SFOE lock */ |
1210 | ret = af9013_read_reg_bits(state, 0xd334, 6, 1, &tmp); | 1210 | ret = af9013_read_reg_bits(state, 0xd334, 6, 1, &tmp); |
1211 | if (ret) | 1211 | if (ret) |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index 04cd7c04bdde..5189c4eb439f 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -355,6 +355,20 @@ config USB_SI470X | |||
355 | tristate "Silicon Labs Si470x FM Radio Receiver support" | 355 | tristate "Silicon Labs Si470x FM Radio Receiver support" |
356 | depends on USB && VIDEO_V4L2 | 356 | depends on USB && VIDEO_V4L2 |
357 | ---help--- | 357 | ---help--- |
358 | This is a driver for USB devices with the Silicon Labs SI470x | ||
359 | chip. Currently these devices are known to work: | ||
360 | - 10c4:818a: Silicon Labs USB FM Radio Reference Design | ||
361 | - 06e1:a155: ADS/Tech FM Radio Receiver (formerly Instant FM Music) | ||
362 | - 1b80:d700: KWorld USB FM Radio SnapMusic Mobile 700 (FM700) | ||
363 | |||
364 | Sound is provided by the ALSA USB Audio/MIDI driver. Therefore | ||
365 | if you don't want to use the device solely for RDS receiving, | ||
366 | it is recommended to also select SND_USB_AUDIO. | ||
367 | |||
368 | Please have a look at the documentation, especially on how | ||
369 | to redirect the audio stream from the radio to your sound device: | ||
370 | Documentation/video4linux/si470x.txt | ||
371 | |||
358 | Say Y here if you want to connect this type of radio to your | 372 | Say Y here if you want to connect this type of radio to your |
359 | computer's USB port. | 373 | computer's USB port. |
360 | 374 | ||
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 5920cd306975..3e1830293de5 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Driver for USB radios for the Silicon Labs Si470x FM Radio Receivers: | 4 | * Driver for USB radios for the Silicon Labs Si470x FM Radio Receivers: |
5 | * - Silicon Labs USB FM Radio Reference Design | 5 | * - Silicon Labs USB FM Radio Reference Design |
6 | * - ADS/Tech FM Radio Receiver (formerly Instant FM Music) (RDX-155-EF) | 6 | * - ADS/Tech FM Radio Receiver (formerly Instant FM Music) (RDX-155-EF) |
7 | * - KWorld USB FM Radio SnapMusic Mobile 700 (FM700) | ||
7 | * | 8 | * |
8 | * Copyright (c) 2008 Tobias Lorenz <tobias.lorenz@gmx.net> | 9 | * Copyright (c) 2008 Tobias Lorenz <tobias.lorenz@gmx.net> |
9 | * | 10 | * |
@@ -24,19 +25,6 @@ | |||
24 | 25 | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * User Notes: | ||
28 | * - USB Audio is provided by the alsa snd_usb_audio module. | ||
29 | * For listing you have to redirect the sound, for example using: | ||
30 | * arecord -D hw:1,0 -r96000 -c2 -f S16_LE | artsdsp aplay -B - | ||
31 | * - regarding module parameters in /sys/module/radio_si470x/parameters: | ||
32 | * the contents of read-only files (0444) are not updated, even if | ||
33 | * space, band and de are changed using private video controls | ||
34 | * - increase tune_timeout, if you often get -EIO errors | ||
35 | * - hw_freq_seek returns -EAGAIN, when timed out or band limit is reached | ||
36 | */ | ||
37 | |||
38 | |||
39 | /* | ||
40 | * History: | 28 | * History: |
41 | * 2008-01-12 Tobias Lorenz <tobias.lorenz@gmx.net> | 29 | * 2008-01-12 Tobias Lorenz <tobias.lorenz@gmx.net> |
42 | * Version 1.0.0 | 30 | * Version 1.0.0 |
@@ -105,6 +93,9 @@ | |||
105 | * - afc indication | 93 | * - afc indication |
106 | * - more safety checks, let si470x_get_freq return errno | 94 | * - more safety checks, let si470x_get_freq return errno |
107 | * - vidioc behavior corrected according to v4l2 spec | 95 | * - vidioc behavior corrected according to v4l2 spec |
96 | * 2008-10-20 Alexey Klimov <klimov.linux@gmail.com> | ||
97 | * - add support for KWorld USB FM Radio FM700 | ||
98 | * - blacklisted KWorld radio in hid-core.c and hid-ids.h | ||
108 | * | 99 | * |
109 | * ToDo: | 100 | * ToDo: |
110 | * - add firmware download/update support | 101 | * - add firmware download/update support |
@@ -145,6 +136,8 @@ static struct usb_device_id si470x_usb_driver_id_table[] = { | |||
145 | { USB_DEVICE_AND_INTERFACE_INFO(0x10c4, 0x818a, USB_CLASS_HID, 0, 0) }, | 136 | { USB_DEVICE_AND_INTERFACE_INFO(0x10c4, 0x818a, USB_CLASS_HID, 0, 0) }, |
146 | /* ADS/Tech FM Radio Receiver (formerly Instant FM Music) */ | 137 | /* ADS/Tech FM Radio Receiver (formerly Instant FM Music) */ |
147 | { USB_DEVICE_AND_INTERFACE_INFO(0x06e1, 0xa155, USB_CLASS_HID, 0, 0) }, | 138 | { USB_DEVICE_AND_INTERFACE_INFO(0x06e1, 0xa155, USB_CLASS_HID, 0, 0) }, |
139 | /* KWorld USB FM Radio SnapMusic Mobile 700 (FM700) */ | ||
140 | { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) }, | ||
148 | /* Terminating entry */ | 141 | /* Terminating entry */ |
149 | { } | 142 | { } |
150 | }; | 143 | }; |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index a8c068e1de1c..1740b9ebdcef 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -1476,12 +1476,9 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp) | |||
1476 | { | 1476 | { |
1477 | struct cafe_camera *cam; | 1477 | struct cafe_camera *cam; |
1478 | 1478 | ||
1479 | lock_kernel(); | ||
1480 | cam = cafe_find_dev(iminor(inode)); | 1479 | cam = cafe_find_dev(iminor(inode)); |
1481 | if (cam == NULL) { | 1480 | if (cam == NULL) |
1482 | unlock_kernel(); | ||
1483 | return -ENODEV; | 1481 | return -ENODEV; |
1484 | } | ||
1485 | filp->private_data = cam; | 1482 | filp->private_data = cam; |
1486 | 1483 | ||
1487 | mutex_lock(&cam->s_mutex); | 1484 | mutex_lock(&cam->s_mutex); |
@@ -1493,7 +1490,6 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp) | |||
1493 | } | 1490 | } |
1494 | (cam->users)++; | 1491 | (cam->users)++; |
1495 | mutex_unlock(&cam->s_mutex); | 1492 | mutex_unlock(&cam->s_mutex); |
1496 | unlock_kernel(); | ||
1497 | return 0; | 1493 | return 0; |
1498 | } | 1494 | } |
1499 | 1495 | ||
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c index bd5d9de5a008..e6ca4012b5f0 100644 --- a/drivers/media/video/compat_ioctl32.c +++ b/drivers/media/video/compat_ioctl32.c | |||
@@ -867,6 +867,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
867 | case VIDIOC_STREAMON32: | 867 | case VIDIOC_STREAMON32: |
868 | case VIDIOC_STREAMOFF32: | 868 | case VIDIOC_STREAMOFF32: |
869 | case VIDIOC_G_PARM: | 869 | case VIDIOC_G_PARM: |
870 | case VIDIOC_S_PARM: | ||
870 | case VIDIOC_G_STD: | 871 | case VIDIOC_G_STD: |
871 | case VIDIOC_S_STD: | 872 | case VIDIOC_S_STD: |
872 | case VIDIOC_G_TUNER: | 873 | case VIDIOC_G_TUNER: |
@@ -885,6 +886,8 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
885 | case VIDIOC_S_INPUT32: | 886 | case VIDIOC_S_INPUT32: |
886 | case VIDIOC_TRY_FMT32: | 887 | case VIDIOC_TRY_FMT32: |
887 | case VIDIOC_S_HW_FREQ_SEEK: | 888 | case VIDIOC_S_HW_FREQ_SEEK: |
889 | case VIDIOC_ENUM_FRAMESIZES: | ||
890 | case VIDIOC_ENUM_FRAMEINTERVALS: | ||
888 | ret = do_video_ioctl(file, cmd, arg); | 891 | ret = do_video_ioctl(file, cmd, arg); |
889 | break; | 892 | break; |
890 | 893 | ||
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 7a1a7830a6b3..7874d9790a51 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -448,7 +448,14 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) | |||
448 | mutex_init(&cx->gpio_lock); | 448 | mutex_init(&cx->gpio_lock); |
449 | 449 | ||
450 | spin_lock_init(&cx->lock); | 450 | spin_lock_init(&cx->lock); |
451 | spin_lock_init(&cx->dma_reg_lock); | 451 | |
452 | cx->work_queue = create_singlethread_workqueue(cx->name); | ||
453 | if (cx->work_queue == NULL) { | ||
454 | CX18_ERR("Could not create work queue\n"); | ||
455 | return -1; | ||
456 | } | ||
457 | |||
458 | INIT_WORK(&cx->work, cx18_work_handler); | ||
452 | 459 | ||
453 | /* start counting open_id at 1 */ | 460 | /* start counting open_id at 1 */ |
454 | cx->open_id = 1; | 461 | cx->open_id = 1; |
@@ -581,10 +588,10 @@ static void cx18_load_and_init_modules(struct cx18 *cx) | |||
581 | 588 | ||
582 | #ifdef MODULE | 589 | #ifdef MODULE |
583 | /* load modules */ | 590 | /* load modules */ |
584 | #ifndef CONFIG_MEDIA_TUNER | 591 | #ifdef CONFIG_MEDIA_TUNER_MODULE |
585 | hw = cx18_request_module(cx, hw, "tuner", CX18_HW_TUNER); | 592 | hw = cx18_request_module(cx, hw, "tuner", CX18_HW_TUNER); |
586 | #endif | 593 | #endif |
587 | #ifndef CONFIG_VIDEO_CS5345 | 594 | #ifdef CONFIG_VIDEO_CS5345_MODULE |
588 | hw = cx18_request_module(cx, hw, "cs5345", CX18_HW_CS5345); | 595 | hw = cx18_request_module(cx, hw, "cs5345", CX18_HW_CS5345); |
589 | #endif | 596 | #endif |
590 | #endif | 597 | #endif |
@@ -832,6 +839,7 @@ free_map: | |||
832 | free_mem: | 839 | free_mem: |
833 | release_mem_region(cx->base_addr, CX18_MEM_SIZE); | 840 | release_mem_region(cx->base_addr, CX18_MEM_SIZE); |
834 | free_workqueue: | 841 | free_workqueue: |
842 | destroy_workqueue(cx->work_queue); | ||
835 | err: | 843 | err: |
836 | if (retval == 0) | 844 | if (retval == 0) |
837 | retval = -ENODEV; | 845 | retval = -ENODEV; |
@@ -932,6 +940,9 @@ static void cx18_remove(struct pci_dev *pci_dev) | |||
932 | 940 | ||
933 | cx18_halt_firmware(cx); | 941 | cx18_halt_firmware(cx); |
934 | 942 | ||
943 | flush_workqueue(cx->work_queue); | ||
944 | destroy_workqueue(cx->work_queue); | ||
945 | |||
935 | cx18_streams_cleanup(cx, 1); | 946 | cx18_streams_cleanup(cx, 1); |
936 | 947 | ||
937 | exit_cx18_i2c(cx); | 948 | exit_cx18_i2c(cx); |
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index a4b1708fafe7..bbdd5f25041d 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -199,12 +199,15 @@ struct cx18_options { | |||
199 | #define CX18_F_S_APPL_IO 8 /* this stream is used read/written by an application */ | 199 | #define CX18_F_S_APPL_IO 8 /* this stream is used read/written by an application */ |
200 | 200 | ||
201 | /* per-cx18, i_flags */ | 201 | /* per-cx18, i_flags */ |
202 | #define CX18_F_I_LOADED_FW 0 /* Loaded the firmware the first time */ | 202 | #define CX18_F_I_LOADED_FW 0 /* Loaded firmware 1st time */ |
203 | #define CX18_F_I_EOS 4 /* End of encoder stream reached */ | 203 | #define CX18_F_I_EOS 4 /* End of encoder stream */ |
204 | #define CX18_F_I_RADIO_USER 5 /* The radio tuner is selected */ | 204 | #define CX18_F_I_RADIO_USER 5 /* radio tuner is selected */ |
205 | #define CX18_F_I_ENC_PAUSED 13 /* the encoder is paused */ | 205 | #define CX18_F_I_ENC_PAUSED 13 /* the encoder is paused */ |
206 | #define CX18_F_I_INITED 21 /* set after first open */ | 206 | #define CX18_F_I_HAVE_WORK 15 /* there is work to be done */ |
207 | #define CX18_F_I_FAILED 22 /* set if first open failed */ | 207 | #define CX18_F_I_WORK_HANDLER_DVB 18 /* work to be done for DVB */ |
208 | #define CX18_F_I_INITED 21 /* set after first open */ | ||
209 | #define CX18_F_I_FAILED 22 /* set if first open failed */ | ||
210 | #define CX18_F_I_WORK_INITED 23 /* worker thread initialized */ | ||
208 | 211 | ||
209 | /* These are the VBI types as they appear in the embedded VBI private packets. */ | 212 | /* These are the VBI types as they appear in the embedded VBI private packets. */ |
210 | #define CX18_SLICED_TYPE_TELETEXT_B (1) | 213 | #define CX18_SLICED_TYPE_TELETEXT_B (1) |
@@ -402,8 +405,6 @@ struct cx18 { | |||
402 | spinlock_t lock; /* lock access to this struct */ | 405 | spinlock_t lock; /* lock access to this struct */ |
403 | int search_pack_header; | 406 | int search_pack_header; |
404 | 407 | ||
405 | spinlock_t dma_reg_lock; /* lock access to DMA engine registers */ | ||
406 | |||
407 | int open_id; /* incremented each time an open occurs, used as | 408 | int open_id; /* incremented each time an open occurs, used as |
408 | unique ID. Starts at 1, so 0 can be used as | 409 | unique ID. Starts at 1, so 0 can be used as |
409 | uninitialized value in the stream->id. */ | 410 | uninitialized value in the stream->id. */ |
@@ -433,6 +434,9 @@ struct cx18 { | |||
433 | /* when the current DMA is finished this queue is woken up */ | 434 | /* when the current DMA is finished this queue is woken up */ |
434 | wait_queue_head_t dma_waitq; | 435 | wait_queue_head_t dma_waitq; |
435 | 436 | ||
437 | struct workqueue_struct *work_queue; | ||
438 | struct work_struct work; | ||
439 | |||
436 | /* i2c */ | 440 | /* i2c */ |
437 | struct i2c_adapter i2c_adap[2]; | 441 | struct i2c_adapter i2c_adap[2]; |
438 | struct i2c_algo_bit_data i2c_algo[2]; | 442 | struct i2c_algo_bit_data i2c_algo[2]; |
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index afc694e7bdb2..4542e2e5e3d7 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include "cx18-dvb.h" | 23 | #include "cx18-dvb.h" |
24 | #include "cx18-io.h" | 24 | #include "cx18-io.h" |
25 | #include "cx18-streams.h" | 25 | #include "cx18-streams.h" |
26 | #include "cx18-queue.h" | ||
27 | #include "cx18-scb.h" | ||
26 | #include "cx18-cards.h" | 28 | #include "cx18-cards.h" |
27 | #include "s5h1409.h" | 29 | #include "s5h1409.h" |
28 | #include "mxl5005s.h" | 30 | #include "mxl5005s.h" |
@@ -300,3 +302,24 @@ static int dvb_register(struct cx18_stream *stream) | |||
300 | 302 | ||
301 | return ret; | 303 | return ret; |
302 | } | 304 | } |
305 | |||
306 | void cx18_dvb_work_handler(struct cx18 *cx) | ||
307 | { | ||
308 | struct cx18_buffer *buf; | ||
309 | struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_TS]; | ||
310 | |||
311 | while ((buf = cx18_dequeue(s, &s->q_full)) != NULL) { | ||
312 | if (s->dvb.enabled) | ||
313 | dvb_dmx_swfilter(&s->dvb.demux, buf->buf, | ||
314 | buf->bytesused); | ||
315 | |||
316 | cx18_enqueue(s, buf, &s->q_free); | ||
317 | cx18_buf_sync_for_device(s, buf); | ||
318 | if (s->handle == CX18_INVALID_TASK_HANDLE) /* FIXME: improve */ | ||
319 | continue; | ||
320 | |||
321 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, | ||
322 | (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, | ||
323 | 1, buf->id, s->buf_size); | ||
324 | } | ||
325 | } | ||
diff --git a/drivers/media/video/cx18/cx18-dvb.h b/drivers/media/video/cx18/cx18-dvb.h index bf8d8f6f5455..bbdcefc87f28 100644 --- a/drivers/media/video/cx18/cx18-dvb.h +++ b/drivers/media/video/cx18/cx18-dvb.h | |||
@@ -23,3 +23,4 @@ | |||
23 | 23 | ||
24 | int cx18_dvb_register(struct cx18_stream *stream); | 24 | int cx18_dvb_register(struct cx18_stream *stream); |
25 | void cx18_dvb_unregister(struct cx18_stream *stream); | 25 | void cx18_dvb_unregister(struct cx18_stream *stream); |
26 | void cx18_dvb_work_handler(struct cx18 *cx); | ||
diff --git a/drivers/media/video/cx18/cx18-io.c b/drivers/media/video/cx18/cx18-io.c index 700ab9439c16..220fae8d4ad7 100644 --- a/drivers/media/video/cx18/cx18-io.c +++ b/drivers/media/video/cx18/cx18-io.c | |||
@@ -88,6 +88,19 @@ void cx18_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr) | |||
88 | cx18_log_write_retries(cx, i, addr); | 88 | cx18_log_write_retries(cx, i, addr); |
89 | } | 89 | } |
90 | 90 | ||
91 | void _cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr, | ||
92 | u32 eval, u32 mask) | ||
93 | { | ||
94 | int i; | ||
95 | eval &= mask; | ||
96 | for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { | ||
97 | cx18_writel_noretry(cx, val, addr); | ||
98 | if (eval == (cx18_readl_noretry(cx, addr) & mask)) | ||
99 | break; | ||
100 | } | ||
101 | cx18_log_write_retries(cx, i, addr); | ||
102 | } | ||
103 | |||
91 | void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr) | 104 | void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr) |
92 | { | 105 | { |
93 | int i; | 106 | int i; |
@@ -218,7 +231,7 @@ void cx18_memset_io(struct cx18 *cx, void __iomem *addr, int val, size_t count) | |||
218 | void cx18_sw1_irq_enable(struct cx18 *cx, u32 val) | 231 | void cx18_sw1_irq_enable(struct cx18 *cx, u32 val) |
219 | { | 232 | { |
220 | u32 r; | 233 | u32 r; |
221 | cx18_write_reg(cx, val, SW1_INT_STATUS); | 234 | cx18_write_reg_expect(cx, val, SW1_INT_STATUS, ~val, val); |
222 | r = cx18_read_reg(cx, SW1_INT_ENABLE_PCI); | 235 | r = cx18_read_reg(cx, SW1_INT_ENABLE_PCI); |
223 | cx18_write_reg(cx, r | val, SW1_INT_ENABLE_PCI); | 236 | cx18_write_reg(cx, r | val, SW1_INT_ENABLE_PCI); |
224 | } | 237 | } |
@@ -233,7 +246,7 @@ void cx18_sw1_irq_disable(struct cx18 *cx, u32 val) | |||
233 | void cx18_sw2_irq_enable(struct cx18 *cx, u32 val) | 246 | void cx18_sw2_irq_enable(struct cx18 *cx, u32 val) |
234 | { | 247 | { |
235 | u32 r; | 248 | u32 r; |
236 | cx18_write_reg(cx, val, SW2_INT_STATUS); | 249 | cx18_write_reg_expect(cx, val, SW2_INT_STATUS, ~val, val); |
237 | r = cx18_read_reg(cx, SW2_INT_ENABLE_PCI); | 250 | r = cx18_read_reg(cx, SW2_INT_ENABLE_PCI); |
238 | cx18_write_reg(cx, r | val, SW2_INT_ENABLE_PCI); | 251 | cx18_write_reg(cx, r | val, SW2_INT_ENABLE_PCI); |
239 | } | 252 | } |
diff --git a/drivers/media/video/cx18/cx18-io.h b/drivers/media/video/cx18/cx18-io.h index 287a5e8bf67b..425244453ea7 100644 --- a/drivers/media/video/cx18/cx18-io.h +++ b/drivers/media/video/cx18/cx18-io.h | |||
@@ -133,6 +133,8 @@ static inline void cx18_writel(struct cx18 *cx, u32 val, void __iomem *addr) | |||
133 | cx18_writel_noretry(cx, val, addr); | 133 | cx18_writel_noretry(cx, val, addr); |
134 | } | 134 | } |
135 | 135 | ||
136 | void _cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr, | ||
137 | u32 eval, u32 mask); | ||
136 | 138 | ||
137 | static inline | 139 | static inline |
138 | void cx18_writew_noretry(struct cx18 *cx, u16 val, void __iomem *addr) | 140 | void cx18_writew_noretry(struct cx18 *cx, u16 val, void __iomem *addr) |
@@ -271,6 +273,21 @@ static inline void cx18_write_reg(struct cx18 *cx, u32 val, u32 reg) | |||
271 | cx18_write_reg_noretry(cx, val, reg); | 273 | cx18_write_reg_noretry(cx, val, reg); |
272 | } | 274 | } |
273 | 275 | ||
276 | static inline void _cx18_write_reg_expect(struct cx18 *cx, u32 val, u32 reg, | ||
277 | u32 eval, u32 mask) | ||
278 | { | ||
279 | _cx18_writel_expect(cx, val, cx->reg_mem + reg, eval, mask); | ||
280 | } | ||
281 | |||
282 | static inline void cx18_write_reg_expect(struct cx18 *cx, u32 val, u32 reg, | ||
283 | u32 eval, u32 mask) | ||
284 | { | ||
285 | if (cx18_retry_mmio) | ||
286 | _cx18_write_reg_expect(cx, val, reg, eval, mask); | ||
287 | else | ||
288 | cx18_write_reg_noretry(cx, val, reg); | ||
289 | } | ||
290 | |||
274 | 291 | ||
275 | static inline u32 cx18_read_reg_noretry(struct cx18 *cx, u32 reg) | 292 | static inline u32 cx18_read_reg_noretry(struct cx18 *cx, u32 reg) |
276 | { | 293 | { |
diff --git a/drivers/media/video/cx18/cx18-irq.c b/drivers/media/video/cx18/cx18-irq.c index 360330f5463f..5fbfbd0f1493 100644 --- a/drivers/media/video/cx18/cx18-irq.c +++ b/drivers/media/video/cx18/cx18-irq.c | |||
@@ -29,8 +29,20 @@ | |||
29 | #include "cx18-mailbox.h" | 29 | #include "cx18-mailbox.h" |
30 | #include "cx18-vbi.h" | 30 | #include "cx18-vbi.h" |
31 | #include "cx18-scb.h" | 31 | #include "cx18-scb.h" |
32 | #include "cx18-dvb.h" | ||
32 | 33 | ||
33 | #define DMA_MAGIC_COOKIE 0x000001fe | 34 | void cx18_work_handler(struct work_struct *work) |
35 | { | ||
36 | struct cx18 *cx = container_of(work, struct cx18, work); | ||
37 | if (test_and_clear_bit(CX18_F_I_WORK_INITED, &cx->i_flags)) { | ||
38 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | ||
39 | /* This thread must use the FIFO scheduler as it | ||
40 | * is realtime sensitive. */ | ||
41 | sched_setscheduler(current, SCHED_FIFO, ¶m); | ||
42 | } | ||
43 | if (test_and_clear_bit(CX18_F_I_WORK_HANDLER_DVB, &cx->i_flags)) | ||
44 | cx18_dvb_work_handler(cx); | ||
45 | } | ||
34 | 46 | ||
35 | static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | 47 | static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) |
36 | { | 48 | { |
@@ -67,17 +79,11 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | |||
67 | if (buf) { | 79 | if (buf) { |
68 | cx18_buf_sync_for_cpu(s, buf); | 80 | cx18_buf_sync_for_cpu(s, buf); |
69 | if (s->type == CX18_ENC_STREAM_TYPE_TS && s->dvb.enabled) { | 81 | if (s->type == CX18_ENC_STREAM_TYPE_TS && s->dvb.enabled) { |
70 | /* process the buffer here */ | 82 | CX18_DEBUG_HI_DMA("TS recv bytesused = %d\n", |
71 | CX18_DEBUG_HI_DMA("TS recv and sent bytesused=%d\n", | ||
72 | buf->bytesused); | ||
73 | |||
74 | dvb_dmx_swfilter(&s->dvb.demux, buf->buf, | ||
75 | buf->bytesused); | 83 | buf->bytesused); |
76 | 84 | ||
77 | cx18_buf_sync_for_device(s, buf); | 85 | set_bit(CX18_F_I_WORK_HANDLER_DVB, &cx->i_flags); |
78 | cx18_vapi(cx, CX18_CPU_DE_SET_MDL, 5, s->handle, | 86 | set_bit(CX18_F_I_HAVE_WORK, &cx->i_flags); |
79 | (void __iomem *)&cx->scb->cpu_mdl[buf->id] - cx->enc_mem, | ||
80 | 1, buf->id, s->buf_size); | ||
81 | } else | 87 | } else |
82 | set_bit(CX18_F_B_NEED_BUF_SWAP, &buf->b_flags); | 88 | set_bit(CX18_F_B_NEED_BUF_SWAP, &buf->b_flags); |
83 | } else { | 89 | } else { |
@@ -109,7 +115,7 @@ static void epu_debug(struct cx18 *cx, struct cx18_mailbox *mb) | |||
109 | CX18_INFO("FW version: %s\n", p - 1); | 115 | CX18_INFO("FW version: %s\n", p - 1); |
110 | } | 116 | } |
111 | 117 | ||
112 | static void hpu_cmd(struct cx18 *cx, u32 sw1) | 118 | static void epu_cmd(struct cx18 *cx, u32 sw1) |
113 | { | 119 | { |
114 | struct cx18_mailbox mb; | 120 | struct cx18_mailbox mb; |
115 | 121 | ||
@@ -125,12 +131,31 @@ static void hpu_cmd(struct cx18 *cx, u32 sw1) | |||
125 | epu_debug(cx, &mb); | 131 | epu_debug(cx, &mb); |
126 | break; | 132 | break; |
127 | default: | 133 | default: |
128 | CX18_WARN("Unexpected mailbox command %08x\n", mb.cmd); | 134 | CX18_WARN("Unknown CPU_TO_EPU mailbox command %#08x\n", |
135 | mb.cmd); | ||
129 | break; | 136 | break; |
130 | } | 137 | } |
131 | } | 138 | } |
132 | if (sw1 & (IRQ_APU_TO_EPU | IRQ_HPU_TO_EPU)) | 139 | |
133 | CX18_WARN("Unexpected interrupt %08x\n", sw1); | 140 | if (sw1 & IRQ_APU_TO_EPU) { |
141 | cx18_memcpy_fromio(cx, &mb, &cx->scb->apu2epu_mb, sizeof(mb)); | ||
142 | CX18_WARN("Unknown APU_TO_EPU mailbox command %#08x\n", mb.cmd); | ||
143 | } | ||
144 | |||
145 | if (sw1 & IRQ_HPU_TO_EPU) { | ||
146 | cx18_memcpy_fromio(cx, &mb, &cx->scb->hpu2epu_mb, sizeof(mb)); | ||
147 | CX18_WARN("Unknown HPU_TO_EPU mailbox command %#08x\n", mb.cmd); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | static void xpu_ack(struct cx18 *cx, u32 sw2) | ||
152 | { | ||
153 | if (sw2 & IRQ_CPU_TO_EPU_ACK) | ||
154 | wake_up(&cx->mb_cpu_waitq); | ||
155 | if (sw2 & IRQ_APU_TO_EPU_ACK) | ||
156 | wake_up(&cx->mb_apu_waitq); | ||
157 | if (sw2 & IRQ_HPU_TO_EPU_ACK) | ||
158 | wake_up(&cx->mb_hpu_waitq); | ||
134 | } | 159 | } |
135 | 160 | ||
136 | irqreturn_t cx18_irq_handler(int irq, void *dev_id) | 161 | irqreturn_t cx18_irq_handler(int irq, void *dev_id) |
@@ -140,43 +165,36 @@ irqreturn_t cx18_irq_handler(int irq, void *dev_id) | |||
140 | u32 sw2, sw2_mask; | 165 | u32 sw2, sw2_mask; |
141 | u32 hw2, hw2_mask; | 166 | u32 hw2, hw2_mask; |
142 | 167 | ||
143 | spin_lock(&cx->dma_reg_lock); | 168 | sw1_mask = cx18_read_reg(cx, SW1_INT_ENABLE_PCI); |
144 | 169 | sw1 = cx18_read_reg(cx, SW1_INT_STATUS) & sw1_mask; | |
170 | sw2_mask = cx18_read_reg(cx, SW2_INT_ENABLE_PCI); | ||
171 | sw2 = cx18_read_reg(cx, SW2_INT_STATUS) & sw2_mask; | ||
145 | hw2_mask = cx18_read_reg(cx, HW2_INT_MASK5_PCI); | 172 | hw2_mask = cx18_read_reg(cx, HW2_INT_MASK5_PCI); |
146 | hw2 = cx18_read_reg(cx, HW2_INT_CLR_STATUS) & hw2_mask; | 173 | hw2 = cx18_read_reg(cx, HW2_INT_CLR_STATUS) & hw2_mask; |
147 | sw2_mask = cx18_read_reg(cx, SW2_INT_ENABLE_PCI) | IRQ_EPU_TO_HPU_ACK; | ||
148 | sw2 = cx18_read_reg(cx, SW2_INT_STATUS) & sw2_mask; | ||
149 | sw1_mask = cx18_read_reg(cx, SW1_INT_ENABLE_PCI) | IRQ_EPU_TO_HPU; | ||
150 | sw1 = cx18_read_reg(cx, SW1_INT_STATUS) & sw1_mask; | ||
151 | 174 | ||
152 | cx18_write_reg(cx, sw2&sw2_mask, SW2_INT_STATUS); | 175 | if (sw1) |
153 | cx18_write_reg(cx, sw1&sw1_mask, SW1_INT_STATUS); | 176 | cx18_write_reg_expect(cx, sw1, SW1_INT_STATUS, ~sw1, sw1); |
154 | cx18_write_reg(cx, hw2&hw2_mask, HW2_INT_CLR_STATUS); | 177 | if (sw2) |
178 | cx18_write_reg_expect(cx, sw2, SW2_INT_STATUS, ~sw2, sw2); | ||
179 | if (hw2) | ||
180 | cx18_write_reg_expect(cx, hw2, HW2_INT_CLR_STATUS, ~hw2, hw2); | ||
155 | 181 | ||
156 | if (sw1 || sw2 || hw2) | 182 | if (sw1 || sw2 || hw2) |
157 | CX18_DEBUG_HI_IRQ("SW1: %x SW2: %x HW2: %x\n", sw1, sw2, hw2); | 183 | CX18_DEBUG_HI_IRQ("SW1: %x SW2: %x HW2: %x\n", sw1, sw2, hw2); |
158 | 184 | ||
159 | /* To do: interrupt-based I2C handling | 185 | /* To do: interrupt-based I2C handling |
160 | if (hw2 & 0x00c00000) { | 186 | if (hw2 & (HW2_I2C1_INT|HW2_I2C2_INT)) { |
161 | } | 187 | } |
162 | */ | 188 | */ |
163 | 189 | ||
164 | if (sw2) { | 190 | if (sw2) |
165 | if (sw2 & (cx18_readl(cx, &cx->scb->cpu2hpu_irq_ack) | | 191 | xpu_ack(cx, sw2); |
166 | cx18_readl(cx, &cx->scb->cpu2epu_irq_ack))) | ||
167 | wake_up(&cx->mb_cpu_waitq); | ||
168 | if (sw2 & (cx18_readl(cx, &cx->scb->apu2hpu_irq_ack) | | ||
169 | cx18_readl(cx, &cx->scb->apu2epu_irq_ack))) | ||
170 | wake_up(&cx->mb_apu_waitq); | ||
171 | if (sw2 & cx18_readl(cx, &cx->scb->epu2hpu_irq_ack)) | ||
172 | wake_up(&cx->mb_epu_waitq); | ||
173 | if (sw2 & cx18_readl(cx, &cx->scb->hpu2epu_irq_ack)) | ||
174 | wake_up(&cx->mb_hpu_waitq); | ||
175 | } | ||
176 | 192 | ||
177 | if (sw1) | 193 | if (sw1) |
178 | hpu_cmd(cx, sw1); | 194 | epu_cmd(cx, sw1); |
179 | spin_unlock(&cx->dma_reg_lock); | 195 | |
196 | if (test_and_clear_bit(CX18_F_I_HAVE_WORK, &cx->i_flags)) | ||
197 | queue_work(cx->work_queue, &cx->work); | ||
180 | 198 | ||
181 | return (hw2 | sw1 | sw2) ? IRQ_HANDLED : IRQ_NONE; | 199 | return (sw1 || sw2 || hw2) ? IRQ_HANDLED : IRQ_NONE; |
182 | } | 200 | } |
diff --git a/drivers/media/video/cx18/cx18-irq.h b/drivers/media/video/cx18/cx18-irq.h index 379f704f5cba..6173ca3bc9e4 100644 --- a/drivers/media/video/cx18/cx18-irq.h +++ b/drivers/media/video/cx18/cx18-irq.h | |||
@@ -32,6 +32,4 @@ | |||
32 | 32 | ||
33 | irqreturn_t cx18_irq_handler(int irq, void *dev_id); | 33 | irqreturn_t cx18_irq_handler(int irq, void *dev_id); |
34 | 34 | ||
35 | void cx18_irq_work_handler(struct work_struct *work); | 35 | void cx18_work_handler(struct work_struct *work); |
36 | void cx18_dma_stream_dec_prepare(struct cx18_stream *s, u32 offset, int lock); | ||
37 | void cx18_unfinished_dma(unsigned long arg); | ||
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index 9d18dd22de76..acff7dfb60df 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c | |||
@@ -83,7 +83,7 @@ static const struct cx18_api_info api_info[] = { | |||
83 | API_ENTRY(CPU, CX18_CPU_DE_SET_MDL_ACK, 0), | 83 | API_ENTRY(CPU, CX18_CPU_DE_SET_MDL_ACK, 0), |
84 | API_ENTRY(CPU, CX18_CPU_DE_SET_MDL, API_FAST), | 84 | API_ENTRY(CPU, CX18_CPU_DE_SET_MDL, API_FAST), |
85 | API_ENTRY(CPU, CX18_APU_RESETAI, API_FAST), | 85 | API_ENTRY(CPU, CX18_APU_RESETAI, API_FAST), |
86 | API_ENTRY(CPU, CX18_CPU_DE_RELEASE_MDL, 0), | 86 | API_ENTRY(CPU, CX18_CPU_DE_RELEASE_MDL, API_SLOW), |
87 | API_ENTRY(0, 0, 0), | 87 | API_ENTRY(0, 0, 0), |
88 | }; | 88 | }; |
89 | 89 | ||
@@ -176,7 +176,7 @@ long cx18_mb_ack(struct cx18 *cx, const struct cx18_mailbox *mb) | |||
176 | 176 | ||
177 | cx18_setup_page(cx, SCB_OFFSET); | 177 | cx18_setup_page(cx, SCB_OFFSET); |
178 | cx18_write_sync(cx, mb->request, &ack_mb->ack); | 178 | cx18_write_sync(cx, mb->request, &ack_mb->ack); |
179 | cx18_write_reg(cx, ack_irq, SW2_INT_SET); | 179 | cx18_write_reg_expect(cx, ack_irq, SW2_INT_SET, ack_irq, ack_irq); |
180 | return 0; | 180 | return 0; |
181 | } | 181 | } |
182 | 182 | ||
@@ -225,7 +225,7 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[]) | |||
225 | } | 225 | } |
226 | if (info->flags & API_FAST) | 226 | if (info->flags & API_FAST) |
227 | timeout /= 2; | 227 | timeout /= 2; |
228 | cx18_write_reg(cx, irq, SW1_INT_SET); | 228 | cx18_write_reg_expect(cx, irq, SW1_INT_SET, irq, irq); |
229 | 229 | ||
230 | while (!sig && cx18_readl(cx, &mb->ack) != cx18_readl(cx, &mb->request) | 230 | while (!sig && cx18_readl(cx, &mb->ack) != cx18_readl(cx, &mb->request) |
231 | && cnt < 660) { | 231 | && cnt < 660) { |
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c index a33ba04a2686..174682c2582f 100644 --- a/drivers/media/video/cx18/cx18-queue.c +++ b/drivers/media/video/cx18/cx18-queue.c | |||
@@ -88,15 +88,13 @@ struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id, | |||
88 | 88 | ||
89 | if (buf->id != id) | 89 | if (buf->id != id) |
90 | continue; | 90 | continue; |
91 | |||
91 | buf->bytesused = bytesused; | 92 | buf->bytesused = bytesused; |
92 | /* the transport buffers are handled differently, | 93 | atomic_dec(&s->q_free.buffers); |
93 | they are not moved to the full queue */ | 94 | atomic_inc(&s->q_full.buffers); |
94 | if (s->type != CX18_ENC_STREAM_TYPE_TS) { | 95 | s->q_full.bytesused += buf->bytesused; |
95 | atomic_dec(&s->q_free.buffers); | 96 | list_move_tail(&buf->list, &s->q_full.list); |
96 | atomic_inc(&s->q_full.buffers); | 97 | |
97 | s->q_full.bytesused += buf->bytesused; | ||
98 | list_move_tail(&buf->list, &s->q_full.list); | ||
99 | } | ||
100 | spin_unlock(&s->qlock); | 98 | spin_unlock(&s->qlock); |
101 | return buf; | 99 | return buf; |
102 | } | 100 | } |
diff --git a/drivers/media/video/cx18/cx18-scb.h b/drivers/media/video/cx18/cx18-scb.h index 86b4cb15d163..594713bbed68 100644 --- a/drivers/media/video/cx18/cx18-scb.h +++ b/drivers/media/video/cx18/cx18-scb.h | |||
@@ -128,22 +128,22 @@ struct cx18_scb { | |||
128 | u32 apu2cpu_irq; | 128 | u32 apu2cpu_irq; |
129 | /* Value to write to register SW2 register set (0xC7003140) after the | 129 | /* Value to write to register SW2 register set (0xC7003140) after the |
130 | command is cleared */ | 130 | command is cleared */ |
131 | u32 apu2cpu_irq_ack; | 131 | u32 cpu2apu_irq_ack; |
132 | u32 reserved2[13]; | 132 | u32 reserved2[13]; |
133 | 133 | ||
134 | u32 hpu2cpu_mb_offset; | 134 | u32 hpu2cpu_mb_offset; |
135 | u32 hpu2cpu_irq; | 135 | u32 hpu2cpu_irq; |
136 | u32 hpu2cpu_irq_ack; | 136 | u32 cpu2hpu_irq_ack; |
137 | u32 reserved3[13]; | 137 | u32 reserved3[13]; |
138 | 138 | ||
139 | u32 ppu2cpu_mb_offset; | 139 | u32 ppu2cpu_mb_offset; |
140 | u32 ppu2cpu_irq; | 140 | u32 ppu2cpu_irq; |
141 | u32 ppu2cpu_irq_ack; | 141 | u32 cpu2ppu_irq_ack; |
142 | u32 reserved4[13]; | 142 | u32 reserved4[13]; |
143 | 143 | ||
144 | u32 epu2cpu_mb_offset; | 144 | u32 epu2cpu_mb_offset; |
145 | u32 epu2cpu_irq; | 145 | u32 epu2cpu_irq; |
146 | u32 epu2cpu_irq_ack; | 146 | u32 cpu2epu_irq_ack; |
147 | u32 reserved5[13]; | 147 | u32 reserved5[13]; |
148 | u32 reserved6[8]; | 148 | u32 reserved6[8]; |
149 | 149 | ||
@@ -153,22 +153,22 @@ struct cx18_scb { | |||
153 | u32 reserved11[7]; | 153 | u32 reserved11[7]; |
154 | u32 cpu2apu_mb_offset; | 154 | u32 cpu2apu_mb_offset; |
155 | u32 cpu2apu_irq; | 155 | u32 cpu2apu_irq; |
156 | u32 cpu2apu_irq_ack; | 156 | u32 apu2cpu_irq_ack; |
157 | u32 reserved12[13]; | 157 | u32 reserved12[13]; |
158 | 158 | ||
159 | u32 hpu2apu_mb_offset; | 159 | u32 hpu2apu_mb_offset; |
160 | u32 hpu2apu_irq; | 160 | u32 hpu2apu_irq; |
161 | u32 hpu2apu_irq_ack; | 161 | u32 apu2hpu_irq_ack; |
162 | u32 reserved13[13]; | 162 | u32 reserved13[13]; |
163 | 163 | ||
164 | u32 ppu2apu_mb_offset; | 164 | u32 ppu2apu_mb_offset; |
165 | u32 ppu2apu_irq; | 165 | u32 ppu2apu_irq; |
166 | u32 ppu2apu_irq_ack; | 166 | u32 apu2ppu_irq_ack; |
167 | u32 reserved14[13]; | 167 | u32 reserved14[13]; |
168 | 168 | ||
169 | u32 epu2apu_mb_offset; | 169 | u32 epu2apu_mb_offset; |
170 | u32 epu2apu_irq; | 170 | u32 epu2apu_irq; |
171 | u32 epu2apu_irq_ack; | 171 | u32 apu2epu_irq_ack; |
172 | u32 reserved15[13]; | 172 | u32 reserved15[13]; |
173 | u32 reserved16[8]; | 173 | u32 reserved16[8]; |
174 | 174 | ||
@@ -178,22 +178,22 @@ struct cx18_scb { | |||
178 | u32 reserved21[7]; | 178 | u32 reserved21[7]; |
179 | u32 cpu2hpu_mb_offset; | 179 | u32 cpu2hpu_mb_offset; |
180 | u32 cpu2hpu_irq; | 180 | u32 cpu2hpu_irq; |
181 | u32 cpu2hpu_irq_ack; | 181 | u32 hpu2cpu_irq_ack; |
182 | u32 reserved22[13]; | 182 | u32 reserved22[13]; |
183 | 183 | ||
184 | u32 apu2hpu_mb_offset; | 184 | u32 apu2hpu_mb_offset; |
185 | u32 apu2hpu_irq; | 185 | u32 apu2hpu_irq; |
186 | u32 apu2hpu_irq_ack; | 186 | u32 hpu2apu_irq_ack; |
187 | u32 reserved23[13]; | 187 | u32 reserved23[13]; |
188 | 188 | ||
189 | u32 ppu2hpu_mb_offset; | 189 | u32 ppu2hpu_mb_offset; |
190 | u32 ppu2hpu_irq; | 190 | u32 ppu2hpu_irq; |
191 | u32 ppu2hpu_irq_ack; | 191 | u32 hpu2ppu_irq_ack; |
192 | u32 reserved24[13]; | 192 | u32 reserved24[13]; |
193 | 193 | ||
194 | u32 epu2hpu_mb_offset; | 194 | u32 epu2hpu_mb_offset; |
195 | u32 epu2hpu_irq; | 195 | u32 epu2hpu_irq; |
196 | u32 epu2hpu_irq_ack; | 196 | u32 hpu2epu_irq_ack; |
197 | u32 reserved25[13]; | 197 | u32 reserved25[13]; |
198 | u32 reserved26[8]; | 198 | u32 reserved26[8]; |
199 | 199 | ||
@@ -203,22 +203,22 @@ struct cx18_scb { | |||
203 | u32 reserved31[7]; | 203 | u32 reserved31[7]; |
204 | u32 cpu2ppu_mb_offset; | 204 | u32 cpu2ppu_mb_offset; |
205 | u32 cpu2ppu_irq; | 205 | u32 cpu2ppu_irq; |
206 | u32 cpu2ppu_irq_ack; | 206 | u32 ppu2cpu_irq_ack; |
207 | u32 reserved32[13]; | 207 | u32 reserved32[13]; |
208 | 208 | ||
209 | u32 apu2ppu_mb_offset; | 209 | u32 apu2ppu_mb_offset; |
210 | u32 apu2ppu_irq; | 210 | u32 apu2ppu_irq; |
211 | u32 apu2ppu_irq_ack; | 211 | u32 ppu2apu_irq_ack; |
212 | u32 reserved33[13]; | 212 | u32 reserved33[13]; |
213 | 213 | ||
214 | u32 hpu2ppu_mb_offset; | 214 | u32 hpu2ppu_mb_offset; |
215 | u32 hpu2ppu_irq; | 215 | u32 hpu2ppu_irq; |
216 | u32 hpu2ppu_irq_ack; | 216 | u32 ppu2hpu_irq_ack; |
217 | u32 reserved34[13]; | 217 | u32 reserved34[13]; |
218 | 218 | ||
219 | u32 epu2ppu_mb_offset; | 219 | u32 epu2ppu_mb_offset; |
220 | u32 epu2ppu_irq; | 220 | u32 epu2ppu_irq; |
221 | u32 epu2ppu_irq_ack; | 221 | u32 ppu2epu_irq_ack; |
222 | u32 reserved35[13]; | 222 | u32 reserved35[13]; |
223 | u32 reserved36[8]; | 223 | u32 reserved36[8]; |
224 | 224 | ||
@@ -228,22 +228,22 @@ struct cx18_scb { | |||
228 | u32 reserved41[7]; | 228 | u32 reserved41[7]; |
229 | u32 cpu2epu_mb_offset; | 229 | u32 cpu2epu_mb_offset; |
230 | u32 cpu2epu_irq; | 230 | u32 cpu2epu_irq; |
231 | u32 cpu2epu_irq_ack; | 231 | u32 epu2cpu_irq_ack; |
232 | u32 reserved42[13]; | 232 | u32 reserved42[13]; |
233 | 233 | ||
234 | u32 apu2epu_mb_offset; | 234 | u32 apu2epu_mb_offset; |
235 | u32 apu2epu_irq; | 235 | u32 apu2epu_irq; |
236 | u32 apu2epu_irq_ack; | 236 | u32 epu2apu_irq_ack; |
237 | u32 reserved43[13]; | 237 | u32 reserved43[13]; |
238 | 238 | ||
239 | u32 hpu2epu_mb_offset; | 239 | u32 hpu2epu_mb_offset; |
240 | u32 hpu2epu_irq; | 240 | u32 hpu2epu_irq; |
241 | u32 hpu2epu_irq_ack; | 241 | u32 epu2hpu_irq_ack; |
242 | u32 reserved44[13]; | 242 | u32 reserved44[13]; |
243 | 243 | ||
244 | u32 ppu2epu_mb_offset; | 244 | u32 ppu2epu_mb_offset; |
245 | u32 ppu2epu_irq; | 245 | u32 ppu2epu_irq; |
246 | u32 ppu2epu_irq_ack; | 246 | u32 epu2ppu_irq_ack; |
247 | u32 reserved45[13]; | 247 | u32 reserved45[13]; |
248 | u32 reserved46[8]; | 248 | u32 reserved46[8]; |
249 | 249 | ||
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 078be6319556..d3ae5b4dfca7 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1078,7 +1078,7 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1078 | } | 1078 | } |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | if (blackbird_initialize_codec(dev) < 0) { | 1081 | if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) { |
1082 | if (drv) | 1082 | if (drv) |
1083 | drv->request_release(drv); | 1083 | drv->request_release(drv); |
1084 | unlock_kernel(); | 1084 | unlock_kernel(); |
@@ -1109,6 +1109,8 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1109 | fh->mpegq.field); | 1109 | fh->mpegq.field); |
1110 | unlock_kernel(); | 1110 | unlock_kernel(); |
1111 | 1111 | ||
1112 | atomic_inc(&dev->core->mpeg_users); | ||
1113 | |||
1112 | return 0; | 1114 | return 0; |
1113 | } | 1115 | } |
1114 | 1116 | ||
@@ -1118,7 +1120,7 @@ static int mpeg_release(struct inode *inode, struct file *file) | |||
1118 | struct cx8802_dev *dev = fh->dev; | 1120 | struct cx8802_dev *dev = fh->dev; |
1119 | struct cx8802_driver *drv = NULL; | 1121 | struct cx8802_driver *drv = NULL; |
1120 | 1122 | ||
1121 | if (dev->mpeg_active) | 1123 | if (dev->mpeg_active && atomic_read(&dev->core->mpeg_users) == 1) |
1122 | blackbird_stop_codec(dev); | 1124 | blackbird_stop_codec(dev); |
1123 | 1125 | ||
1124 | cx8802_cancel_buffers(fh->dev); | 1126 | cx8802_cancel_buffers(fh->dev); |
@@ -1138,6 +1140,8 @@ static int mpeg_release(struct inode *inode, struct file *file) | |||
1138 | if (drv) | 1140 | if (drv) |
1139 | drv->request_release(drv); | 1141 | drv->request_release(drv); |
1140 | 1142 | ||
1143 | atomic_dec(&dev->core->mpeg_users); | ||
1144 | |||
1141 | return 0; | 1145 | return 0; |
1142 | } | 1146 | } |
1143 | 1147 | ||
@@ -1158,6 +1162,10 @@ static unsigned int | |||
1158 | mpeg_poll(struct file *file, struct poll_table_struct *wait) | 1162 | mpeg_poll(struct file *file, struct poll_table_struct *wait) |
1159 | { | 1163 | { |
1160 | struct cx8802_fh *fh = file->private_data; | 1164 | struct cx8802_fh *fh = file->private_data; |
1165 | struct cx8802_dev *dev = fh->dev; | ||
1166 | |||
1167 | if (!dev->mpeg_active) | ||
1168 | blackbird_start_codec(file, fh); | ||
1161 | 1169 | ||
1162 | return videobuf_poll_stream(file, &fh->mpegq, wait); | 1170 | return videobuf_poll_stream(file, &fh->mpegq, wait); |
1163 | } | 1171 | } |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index cf6c30d4e545..309ca5e68063 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -598,6 +598,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
598 | struct videobuf_dvb_frontend *fe0, *fe1 = NULL; | 598 | struct videobuf_dvb_frontend *fe0, *fe1 = NULL; |
599 | int mfe_shared = 0; /* bus not shared by default */ | 599 | int mfe_shared = 0; /* bus not shared by default */ |
600 | 600 | ||
601 | if (0 != core->i2c_rc) { | ||
602 | printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name); | ||
603 | goto frontend_detach; | ||
604 | } | ||
605 | |||
601 | /* Get the first frontend */ | 606 | /* Get the first frontend */ |
602 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | 607 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); |
603 | if (!fe0) | 608 | if (!fe0) |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index a1c435b4b1cd..3ebdcd1d83f8 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -769,10 +769,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, | |||
769 | struct cx8802_dev *dev; | 769 | struct cx8802_dev *dev; |
770 | struct cx88_core *core; | 770 | struct cx88_core *core; |
771 | int err; | 771 | int err; |
772 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) | ||
773 | struct videobuf_dvb_frontend *demod; | ||
774 | int i; | ||
775 | #endif | ||
776 | 772 | ||
777 | /* general setup */ | 773 | /* general setup */ |
778 | core = cx88_core_get(pci_dev); | 774 | core = cx88_core_get(pci_dev); |
@@ -803,15 +799,21 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, | |||
803 | mutex_init(&dev->frontends.lock); | 799 | mutex_init(&dev->frontends.lock); |
804 | INIT_LIST_HEAD(&dev->frontends.felist); | 800 | INIT_LIST_HEAD(&dev->frontends.felist); |
805 | 801 | ||
806 | if (core->board.num_frontends) | 802 | if (core->board.num_frontends) { |
807 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); | 803 | struct videobuf_dvb_frontend *fe; |
808 | 804 | int i; | |
809 | for (i = 1; i <= core->board.num_frontends; i++) { | 805 | |
810 | demod = videobuf_dvb_alloc_frontend(&dev->frontends, i); | 806 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, |
811 | if(demod == NULL) { | 807 | core->board.num_frontends); |
812 | printk(KERN_ERR "%s() failed to alloc\n", __func__); | 808 | for (i = 1; i <= core->board.num_frontends; i++) { |
813 | err = -ENOMEM; | 809 | fe = videobuf_dvb_alloc_frontend(&dev->frontends, i); |
814 | goto fail_free; | 810 | if(fe == NULL) { |
811 | printk(KERN_ERR "%s() failed to alloc\n", | ||
812 | __func__); | ||
813 | videobuf_dvb_dealloc_frontends(&dev->frontends); | ||
814 | err = -ENOMEM; | ||
815 | goto fail_free; | ||
816 | } | ||
815 | } | 817 | } |
816 | } | 818 | } |
817 | #endif | 819 | #endif |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 61265fd04d56..b96ce991d968 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1216,8 +1216,12 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | |||
1216 | struct cx8800_fh *fh = priv; | 1216 | struct cx8800_fh *fh = priv; |
1217 | struct cx8800_dev *dev = fh->dev; | 1217 | struct cx8800_dev *dev = fh->dev; |
1218 | 1218 | ||
1219 | if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) | 1219 | /* We should remember that this driver also supports teletext, */ |
1220 | /* so we have to test if the v4l2_buf_type is VBI capture data. */ | ||
1221 | if (unlikely((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) && | ||
1222 | (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))) | ||
1220 | return -EINVAL; | 1223 | return -EINVAL; |
1224 | |||
1221 | if (unlikely(i != fh->type)) | 1225 | if (unlikely(i != fh->type)) |
1222 | return -EINVAL; | 1226 | return -EINVAL; |
1223 | 1227 | ||
@@ -1232,8 +1236,10 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | |||
1232 | struct cx8800_dev *dev = fh->dev; | 1236 | struct cx8800_dev *dev = fh->dev; |
1233 | int err, res; | 1237 | int err, res; |
1234 | 1238 | ||
1235 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1239 | if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) && |
1240 | (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE)) | ||
1236 | return -EINVAL; | 1241 | return -EINVAL; |
1242 | |||
1237 | if (i != fh->type) | 1243 | if (i != fh->type) |
1238 | return -EINVAL; | 1244 | return -EINVAL; |
1239 | 1245 | ||
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 76207c2856b7..f4240965be32 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -352,6 +352,7 @@ struct cx88_core { | |||
352 | /* various v4l controls */ | 352 | /* various v4l controls */ |
353 | u32 freq; | 353 | u32 freq; |
354 | atomic_t users; | 354 | atomic_t users; |
355 | atomic_t mpeg_users; | ||
355 | 356 | ||
356 | /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ | 357 | /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ |
357 | struct cx8802_dev *dvbdev; | 358 | struct cx8802_dev *dvbdev; |
diff --git a/drivers/media/video/gspca/Kconfig b/drivers/media/video/gspca/Kconfig index 4d0817471c9f..6b557c057fac 100644 --- a/drivers/media/video/gspca/Kconfig +++ b/drivers/media/video/gspca/Kconfig | |||
@@ -3,16 +3,16 @@ menuconfig USB_GSPCA | |||
3 | depends on VIDEO_V4L2 | 3 | depends on VIDEO_V4L2 |
4 | default m | 4 | default m |
5 | ---help--- | 5 | ---help--- |
6 | Say Y here if you want to enable selecting webcams based | 6 | Say Y here if you want to enable selecting webcams based |
7 | on the GSPCA framework. | 7 | on the GSPCA framework. |
8 | 8 | ||
9 | See <file:Documentation/video4linux/gspca.txt> for more info. | 9 | See <file:Documentation/video4linux/gspca.txt> for more info. |
10 | 10 | ||
11 | This driver uses the Video For Linux API. You must say Y or M to | 11 | This driver uses the Video For Linux API. You must say Y or M to |
12 | "Video For Linux" to use this driver. | 12 | "Video For Linux" to use this driver. |
13 | 13 | ||
14 | To compile this driver as modules, choose M here: the | 14 | To compile this driver as modules, choose M here: the |
15 | modules will be called gspca_main. | 15 | modules will be called gspca_main. |
16 | 16 | ||
17 | 17 | ||
18 | if USB_GSPCA && VIDEO_V4L2 | 18 | if USB_GSPCA && VIDEO_V4L2 |
@@ -23,190 +23,190 @@ config USB_GSPCA_CONEX | |||
23 | tristate "Conexant Camera Driver" | 23 | tristate "Conexant Camera Driver" |
24 | depends on VIDEO_V4L2 && USB_GSPCA | 24 | depends on VIDEO_V4L2 && USB_GSPCA |
25 | help | 25 | help |
26 | Say Y here if you want support for cameras based on the Conexant chip. | 26 | Say Y here if you want support for cameras based on the Conexant chip. |
27 | 27 | ||
28 | To compile this driver as a module, choose M here: the | 28 | To compile this driver as a module, choose M here: the |
29 | module will be called gspca_conex. | 29 | module will be called gspca_conex. |
30 | 30 | ||
31 | config USB_GSPCA_ETOMS | 31 | config USB_GSPCA_ETOMS |
32 | tristate "Etoms USB Camera Driver" | 32 | tristate "Etoms USB Camera Driver" |
33 | depends on VIDEO_V4L2 && USB_GSPCA | 33 | depends on VIDEO_V4L2 && USB_GSPCA |
34 | help | 34 | help |
35 | Say Y here if you want support for cameras based on the Etoms chip. | 35 | Say Y here if you want support for cameras based on the Etoms chip. |
36 | 36 | ||
37 | To compile this driver as a module, choose M here: the | 37 | To compile this driver as a module, choose M here: the |
38 | module will be called gspca_etoms. | 38 | module will be called gspca_etoms. |
39 | 39 | ||
40 | config USB_GSPCA_FINEPIX | 40 | config USB_GSPCA_FINEPIX |
41 | tristate "Fujifilm FinePix USB V4L2 driver" | 41 | tristate "Fujifilm FinePix USB V4L2 driver" |
42 | depends on VIDEO_V4L2 && USB_GSPCA | 42 | depends on VIDEO_V4L2 && USB_GSPCA |
43 | help | 43 | help |
44 | Say Y here if you want support for cameras based on the FinePix chip. | 44 | Say Y here if you want support for cameras based on the FinePix chip. |
45 | 45 | ||
46 | To compile this driver as a module, choose M here: the | 46 | To compile this driver as a module, choose M here: the |
47 | module will be called gspca_finepix. | 47 | module will be called gspca_finepix. |
48 | 48 | ||
49 | config USB_GSPCA_MARS | 49 | config USB_GSPCA_MARS |
50 | tristate "Mars USB Camera Driver" | 50 | tristate "Mars USB Camera Driver" |
51 | depends on VIDEO_V4L2 && USB_GSPCA | 51 | depends on VIDEO_V4L2 && USB_GSPCA |
52 | help | 52 | help |
53 | Say Y here if you want support for cameras based on the Mars chip. | 53 | Say Y here if you want support for cameras based on the Mars chip. |
54 | 54 | ||
55 | To compile this driver as a module, choose M here: the | 55 | To compile this driver as a module, choose M here: the |
56 | module will be called gspca_mars. | 56 | module will be called gspca_mars. |
57 | 57 | ||
58 | config USB_GSPCA_OV519 | 58 | config USB_GSPCA_OV519 |
59 | tristate "OV519 USB Camera Driver" | 59 | tristate "OV519 USB Camera Driver" |
60 | depends on VIDEO_V4L2 && USB_GSPCA | 60 | depends on VIDEO_V4L2 && USB_GSPCA |
61 | help | 61 | help |
62 | Say Y here if you want support for cameras based on the OV519 chip. | 62 | Say Y here if you want support for cameras based on the OV519 chip. |
63 | 63 | ||
64 | To compile this driver as a module, choose M here: the | 64 | To compile this driver as a module, choose M here: the |
65 | module will be called gspca_ov519. | 65 | module will be called gspca_ov519. |
66 | 66 | ||
67 | config USB_GSPCA_PAC207 | 67 | config USB_GSPCA_PAC207 |
68 | tristate "Pixart PAC207 USB Camera Driver" | 68 | tristate "Pixart PAC207 USB Camera Driver" |
69 | depends on VIDEO_V4L2 && USB_GSPCA | 69 | depends on VIDEO_V4L2 && USB_GSPCA |
70 | help | 70 | help |
71 | Say Y here if you want support for cameras based on the PAC207 chip. | 71 | Say Y here if you want support for cameras based on the PAC207 chip. |
72 | 72 | ||
73 | To compile this driver as a module, choose M here: the | 73 | To compile this driver as a module, choose M here: the |
74 | module will be called gspca_pac207. | 74 | module will be called gspca_pac207. |
75 | 75 | ||
76 | config USB_GSPCA_PAC7311 | 76 | config USB_GSPCA_PAC7311 |
77 | tristate "Pixart PAC7311 USB Camera Driver" | 77 | tristate "Pixart PAC7311 USB Camera Driver" |
78 | depends on VIDEO_V4L2 && USB_GSPCA | 78 | depends on VIDEO_V4L2 && USB_GSPCA |
79 | help | 79 | help |
80 | Say Y here if you want support for cameras based on the PAC7311 chip. | 80 | Say Y here if you want support for cameras based on the PAC7311 chip. |
81 | 81 | ||
82 | To compile this driver as a module, choose M here: the | 82 | To compile this driver as a module, choose M here: the |
83 | module will be called gspca_pac7311. | 83 | module will be called gspca_pac7311. |
84 | 84 | ||
85 | config USB_GSPCA_SONIXB | 85 | config USB_GSPCA_SONIXB |
86 | tristate "SN9C102 USB Camera Driver" | 86 | tristate "SN9C102 USB Camera Driver" |
87 | depends on VIDEO_V4L2 && USB_GSPCA | 87 | depends on VIDEO_V4L2 && USB_GSPCA |
88 | help | 88 | help |
89 | Say Y here if you want support for cameras based on the SONIXB chip. | 89 | Say Y here if you want support for cameras based on the SONIXB chip. |
90 | 90 | ||
91 | To compile this driver as a module, choose M here: the | 91 | To compile this driver as a module, choose M here: the |
92 | module will be called gspca_sonixb. | 92 | module will be called gspca_sonixb. |
93 | 93 | ||
94 | config USB_GSPCA_SONIXJ | 94 | config USB_GSPCA_SONIXJ |
95 | tristate "SONIX JPEG USB Camera Driver" | 95 | tristate "SONIX JPEG USB Camera Driver" |
96 | depends on VIDEO_V4L2 && USB_GSPCA | 96 | depends on VIDEO_V4L2 && USB_GSPCA |
97 | help | 97 | help |
98 | Say Y here if you want support for cameras based on the SONIXJ chip. | 98 | Say Y here if you want support for cameras based on the SONIXJ chip. |
99 | 99 | ||
100 | To compile this driver as a module, choose M here: the | 100 | To compile this driver as a module, choose M here: the |
101 | module will be called gspca_sonixj | 101 | module will be called gspca_sonixj |
102 | 102 | ||
103 | config USB_GSPCA_SPCA500 | 103 | config USB_GSPCA_SPCA500 |
104 | tristate "SPCA500 USB Camera Driver" | 104 | tristate "SPCA500 USB Camera Driver" |
105 | depends on VIDEO_V4L2 && USB_GSPCA | 105 | depends on VIDEO_V4L2 && USB_GSPCA |
106 | help | 106 | help |
107 | Say Y here if you want support for cameras based on the SPCA500 chip. | 107 | Say Y here if you want support for cameras based on the SPCA500 chip. |
108 | 108 | ||
109 | To compile this driver as a module, choose M here: the | 109 | To compile this driver as a module, choose M here: the |
110 | module will be called gspca_spca500. | 110 | module will be called gspca_spca500. |
111 | 111 | ||
112 | config USB_GSPCA_SPCA501 | 112 | config USB_GSPCA_SPCA501 |
113 | tristate "SPCA501 USB Camera Driver" | 113 | tristate "SPCA501 USB Camera Driver" |
114 | depends on VIDEO_V4L2 && USB_GSPCA | 114 | depends on VIDEO_V4L2 && USB_GSPCA |
115 | help | 115 | help |
116 | Say Y here if you want support for cameras based on the SPCA501 chip. | 116 | Say Y here if you want support for cameras based on the SPCA501 chip. |
117 | 117 | ||
118 | To compile this driver as a module, choose M here: the | 118 | To compile this driver as a module, choose M here: the |
119 | module will be called gspca_spca501. | 119 | module will be called gspca_spca501. |
120 | 120 | ||
121 | config USB_GSPCA_SPCA505 | 121 | config USB_GSPCA_SPCA505 |
122 | tristate "SPCA505 USB Camera Driver" | 122 | tristate "SPCA505 USB Camera Driver" |
123 | depends on VIDEO_V4L2 && USB_GSPCA | 123 | depends on VIDEO_V4L2 && USB_GSPCA |
124 | help | 124 | help |
125 | Say Y here if you want support for cameras based on the SPCA505 chip. | 125 | Say Y here if you want support for cameras based on the SPCA505 chip. |
126 | 126 | ||
127 | To compile this driver as a module, choose M here: the | 127 | To compile this driver as a module, choose M here: the |
128 | module will be called gspca_spca505. | 128 | module will be called gspca_spca505. |
129 | 129 | ||
130 | config USB_GSPCA_SPCA506 | 130 | config USB_GSPCA_SPCA506 |
131 | tristate "SPCA506 USB Camera Driver" | 131 | tristate "SPCA506 USB Camera Driver" |
132 | depends on VIDEO_V4L2 && USB_GSPCA | 132 | depends on VIDEO_V4L2 && USB_GSPCA |
133 | help | 133 | help |
134 | Say Y here if you want support for cameras based on the SPCA506 chip. | 134 | Say Y here if you want support for cameras based on the SPCA506 chip. |
135 | 135 | ||
136 | To compile this driver as a module, choose M here: the | 136 | To compile this driver as a module, choose M here: the |
137 | module will be called gspca_spca506. | 137 | module will be called gspca_spca506. |
138 | 138 | ||
139 | config USB_GSPCA_SPCA508 | 139 | config USB_GSPCA_SPCA508 |
140 | tristate "SPCA508 USB Camera Driver" | 140 | tristate "SPCA508 USB Camera Driver" |
141 | depends on VIDEO_V4L2 && USB_GSPCA | 141 | depends on VIDEO_V4L2 && USB_GSPCA |
142 | help | 142 | help |
143 | Say Y here if you want support for cameras based on the SPCA508 chip. | 143 | Say Y here if you want support for cameras based on the SPCA508 chip. |
144 | 144 | ||
145 | To compile this driver as a module, choose M here: the | 145 | To compile this driver as a module, choose M here: the |
146 | module will be called gspca_spca508. | 146 | module will be called gspca_spca508. |
147 | 147 | ||
148 | config USB_GSPCA_SPCA561 | 148 | config USB_GSPCA_SPCA561 |
149 | tristate "SPCA561 USB Camera Driver" | 149 | tristate "SPCA561 USB Camera Driver" |
150 | depends on VIDEO_V4L2 && USB_GSPCA | 150 | depends on VIDEO_V4L2 && USB_GSPCA |
151 | help | 151 | help |
152 | Say Y here if you want support for cameras based on the SPCA561 chip. | 152 | Say Y here if you want support for cameras based on the SPCA561 chip. |
153 | 153 | ||
154 | To compile this driver as a module, choose M here: the | 154 | To compile this driver as a module, choose M here: the |
155 | module will be called gspca_spca561. | 155 | module will be called gspca_spca561. |
156 | 156 | ||
157 | config USB_GSPCA_STK014 | 157 | config USB_GSPCA_STK014 |
158 | tristate "Syntek DV4000 (STK014) USB Camera Driver" | 158 | tristate "Syntek DV4000 (STK014) USB Camera Driver" |
159 | depends on VIDEO_V4L2 && USB_GSPCA | 159 | depends on VIDEO_V4L2 && USB_GSPCA |
160 | help | 160 | help |
161 | Say Y here if you want support for cameras based on the STK014 chip. | 161 | Say Y here if you want support for cameras based on the STK014 chip. |
162 | 162 | ||
163 | To compile this driver as a module, choose M here: the | 163 | To compile this driver as a module, choose M here: the |
164 | module will be called gspca_stk014. | 164 | module will be called gspca_stk014. |
165 | 165 | ||
166 | config USB_GSPCA_SUNPLUS | 166 | config USB_GSPCA_SUNPLUS |
167 | tristate "SUNPLUS USB Camera Driver" | 167 | tristate "SUNPLUS USB Camera Driver" |
168 | depends on VIDEO_V4L2 && USB_GSPCA | 168 | depends on VIDEO_V4L2 && USB_GSPCA |
169 | help | 169 | help |
170 | Say Y here if you want support for cameras based on the Sunplus | 170 | Say Y here if you want support for cameras based on the Sunplus |
171 | SPCA504(abc) SPCA533 SPCA536 chips. | 171 | SPCA504(abc) SPCA533 SPCA536 chips. |
172 | 172 | ||
173 | To compile this driver as a module, choose M here: the | 173 | To compile this driver as a module, choose M here: the |
174 | module will be called gspca_spca5xx. | 174 | module will be called gspca_spca5xx. |
175 | 175 | ||
176 | config USB_GSPCA_T613 | 176 | config USB_GSPCA_T613 |
177 | tristate "T613 (JPEG Compliance) USB Camera Driver" | 177 | tristate "T613 (JPEG Compliance) USB Camera Driver" |
178 | depends on VIDEO_V4L2 && USB_GSPCA | 178 | depends on VIDEO_V4L2 && USB_GSPCA |
179 | help | 179 | help |
180 | Say Y here if you want support for cameras based on the T613 chip. | 180 | Say Y here if you want support for cameras based on the T613 chip. |
181 | 181 | ||
182 | To compile this driver as a module, choose M here: the | 182 | To compile this driver as a module, choose M here: the |
183 | module will be called gspca_t613. | 183 | module will be called gspca_t613. |
184 | 184 | ||
185 | config USB_GSPCA_TV8532 | 185 | config USB_GSPCA_TV8532 |
186 | tristate "TV8532 USB Camera Driver" | 186 | tristate "TV8532 USB Camera Driver" |
187 | depends on VIDEO_V4L2 && USB_GSPCA | 187 | depends on VIDEO_V4L2 && USB_GSPCA |
188 | help | 188 | help |
189 | Say Y here if you want support for cameras based on the TV8531 chip. | 189 | Say Y here if you want support for cameras based on the TV8531 chip. |
190 | 190 | ||
191 | To compile this driver as a module, choose M here: the | 191 | To compile this driver as a module, choose M here: the |
192 | module will be called gspca_tv8532. | 192 | module will be called gspca_tv8532. |
193 | 193 | ||
194 | config USB_GSPCA_VC032X | 194 | config USB_GSPCA_VC032X |
195 | tristate "VC032X USB Camera Driver" | 195 | tristate "VC032X USB Camera Driver" |
196 | depends on VIDEO_V4L2 && USB_GSPCA | 196 | depends on VIDEO_V4L2 && USB_GSPCA |
197 | help | 197 | help |
198 | Say Y here if you want support for cameras based on the VC032X chip. | 198 | Say Y here if you want support for cameras based on the VC032X chip. |
199 | 199 | ||
200 | To compile this driver as a module, choose M here: the | 200 | To compile this driver as a module, choose M here: the |
201 | module will be called gspca_vc032x. | 201 | module will be called gspca_vc032x. |
202 | 202 | ||
203 | config USB_GSPCA_ZC3XX | 203 | config USB_GSPCA_ZC3XX |
204 | tristate "VC3xx USB Camera Driver" | 204 | tristate "ZC3XX USB Camera Driver" |
205 | depends on VIDEO_V4L2 && USB_GSPCA | 205 | depends on VIDEO_V4L2 && USB_GSPCA |
206 | help | 206 | help |
207 | Say Y here if you want support for cameras based on the ZC3XX chip. | 207 | Say Y here if you want support for cameras based on the ZC3XX chip. |
208 | 208 | ||
209 | To compile this driver as a module, choose M here: the | 209 | To compile this driver as a module, choose M here: the |
210 | module will be called gspca_zc3xx. | 210 | module will be called gspca_zc3xx. |
211 | 211 | ||
212 | endif | 212 | endif |
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index d0a4451dc46f..8b3101d347c3 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -2266,7 +2266,7 @@ static const struct usb_action hdcs2020b_NoFliker[] = { | |||
2266 | {} | 2266 | {} |
2267 | }; | 2267 | }; |
2268 | 2268 | ||
2269 | static const struct usb_action hv7131bxx_Initial[] = { | 2269 | static const struct usb_action hv7131bxx_Initial[] = { /* 320x240 */ |
2270 | {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, | 2270 | {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, |
2271 | {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, | 2271 | {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, |
2272 | {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, | 2272 | {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, |
@@ -2290,7 +2290,7 @@ static const struct usb_action hv7131bxx_Initial[] = { | |||
2290 | {0xaa, 0x14, 0x0001}, | 2290 | {0xaa, 0x14, 0x0001}, |
2291 | {0xaa, 0x15, 0x00e8}, | 2291 | {0xaa, 0x15, 0x00e8}, |
2292 | {0xaa, 0x16, 0x0002}, | 2292 | {0xaa, 0x16, 0x0002}, |
2293 | {0xaa, 0x17, 0x0086}, | 2293 | {0xaa, 0x17, 0x0086}, /* 00,17,88,aa */ |
2294 | {0xaa, 0x31, 0x0038}, | 2294 | {0xaa, 0x31, 0x0038}, |
2295 | {0xaa, 0x32, 0x0038}, | 2295 | {0xaa, 0x32, 0x0038}, |
2296 | {0xaa, 0x33, 0x0038}, | 2296 | {0xaa, 0x33, 0x0038}, |
@@ -2309,7 +2309,7 @@ static const struct usb_action hv7131bxx_Initial[] = { | |||
2309 | {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, | 2309 | {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, |
2310 | {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, | 2310 | {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, |
2311 | {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, | 2311 | {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, |
2312 | {0xaa, 0x02, 0x0080}, /* {0xaa, 0x02, 0x0090}; */ | 2312 | {0xaa, 0x02, 0x0090}, /* 00,02,80,aa */ |
2313 | {0xa1, 0x01, 0x0002}, | 2313 | {0xa1, 0x01, 0x0002}, |
2314 | {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, | 2314 | {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, |
2315 | {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, | 2315 | {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, |
@@ -2374,7 +2374,7 @@ static const struct usb_action hv7131bxx_Initial[] = { | |||
2374 | {} | 2374 | {} |
2375 | }; | 2375 | }; |
2376 | 2376 | ||
2377 | static const struct usb_action hv7131bxx_InitialScale[] = { | 2377 | static const struct usb_action hv7131bxx_InitialScale[] = { /* 640x480*/ |
2378 | {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, | 2378 | {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, |
2379 | {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, | 2379 | {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, |
2380 | {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, | 2380 | {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, |
@@ -6388,6 +6388,8 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
6388 | /*fixme: is it really write to 011d and 018d for all other sensors? */ | 6388 | /*fixme: is it really write to 011d and 018d for all other sensors? */ |
6389 | brightness = sd->brightness; | 6389 | brightness = sd->brightness; |
6390 | reg_w(gspca_dev->dev, brightness, 0x011d); | 6390 | reg_w(gspca_dev->dev, brightness, 0x011d); |
6391 | if (sd->sensor == SENSOR_HV7131B) | ||
6392 | return; | ||
6391 | if (brightness < 0x70) | 6393 | if (brightness < 0x70) |
6392 | brightness += 0x10; | 6394 | brightness += 0x10; |
6393 | else | 6395 | else |
@@ -6529,6 +6531,7 @@ static void setquality(struct gspca_dev *gspca_dev) | |||
6529 | 6531 | ||
6530 | switch (sd->sensor) { | 6532 | switch (sd->sensor) { |
6531 | case SENSOR_GC0305: | 6533 | case SENSOR_GC0305: |
6534 | case SENSOR_HV7131B: | ||
6532 | case SENSOR_OV7620: | 6535 | case SENSOR_OV7620: |
6533 | case SENSOR_PO2030: | 6536 | case SENSOR_PO2030: |
6534 | return; | 6537 | return; |
@@ -7209,7 +7212,6 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
7209 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; | 7212 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; |
7210 | zc3_init = init_tb[(int) sd->sensor][mode]; | 7213 | zc3_init = init_tb[(int) sd->sensor][mode]; |
7211 | switch (sd->sensor) { | 7214 | switch (sd->sensor) { |
7212 | case SENSOR_HV7131B: | ||
7213 | case SENSOR_HV7131C: | 7215 | case SENSOR_HV7131C: |
7214 | zcxx_probeSensor(gspca_dev); | 7216 | zcxx_probeSensor(gspca_dev); |
7215 | break; | 7217 | break; |
diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig index 0069898bddab..c46bfb1569e3 100644 --- a/drivers/media/video/ivtv/Kconfig +++ b/drivers/media/video/ivtv/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_IVTV | 1 | config VIDEO_IVTV |
2 | tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" | 2 | tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" |
3 | depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL | 3 | depends on VIDEO_V4L2 && PCI && I2C |
4 | depends on INPUT # due to VIDEO_IR | 4 | depends on INPUT # due to VIDEO_IR |
5 | select I2C_ALGOBIT | 5 | select I2C_ALGOBIT |
6 | select VIDEO_IR | 6 | select VIDEO_IR |
@@ -12,7 +12,6 @@ config VIDEO_IVTV | |||
12 | select VIDEO_SAA711X | 12 | select VIDEO_SAA711X |
13 | select VIDEO_SAA717X | 13 | select VIDEO_SAA717X |
14 | select VIDEO_SAA7127 | 14 | select VIDEO_SAA7127 |
15 | select VIDEO_TVAUDIO | ||
16 | select VIDEO_CS53L32A | 15 | select VIDEO_CS53L32A |
17 | select VIDEO_M52790 | 16 | select VIDEO_M52790 |
18 | select VIDEO_WM8775 | 17 | select VIDEO_WM8775 |
@@ -32,7 +31,7 @@ config VIDEO_IVTV | |||
32 | 31 | ||
33 | config VIDEO_FB_IVTV | 32 | config VIDEO_FB_IVTV |
34 | tristate "Conexant cx23415 framebuffer support" | 33 | tristate "Conexant cx23415 framebuffer support" |
35 | depends on VIDEO_IVTV && FB && EXPERIMENTAL | 34 | depends on VIDEO_IVTV && FB |
36 | select FB_CFB_FILLRECT | 35 | select FB_CFB_FILLRECT |
37 | select FB_CFB_COPYAREA | 36 | select FB_CFB_COPYAREA |
38 | select FB_CFB_IMAGEBLIT | 37 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index d36485023b68..b69cc1d55e5b 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -875,43 +875,43 @@ static void ivtv_load_and_init_modules(struct ivtv *itv) | |||
875 | 875 | ||
876 | #ifdef MODULE | 876 | #ifdef MODULE |
877 | /* load modules */ | 877 | /* load modules */ |
878 | #ifndef CONFIG_MEDIA_TUNER | 878 | #ifdef CONFIG_MEDIA_TUNER_MODULE |
879 | hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER); | 879 | hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER); |
880 | #endif | 880 | #endif |
881 | #ifndef CONFIG_VIDEO_CX25840 | 881 | #ifdef CONFIG_VIDEO_CX25840_MODULE |
882 | hw = ivtv_request_module(itv, hw, "cx25840", IVTV_HW_CX25840); | 882 | hw = ivtv_request_module(itv, hw, "cx25840", IVTV_HW_CX25840); |
883 | #endif | 883 | #endif |
884 | #ifndef CONFIG_VIDEO_SAA711X | 884 | #ifdef CONFIG_VIDEO_SAA711X_MODULE |
885 | hw = ivtv_request_module(itv, hw, "saa7115", IVTV_HW_SAA711X); | 885 | hw = ivtv_request_module(itv, hw, "saa7115", IVTV_HW_SAA711X); |
886 | #endif | 886 | #endif |
887 | #ifndef CONFIG_VIDEO_SAA7127 | 887 | #ifdef CONFIG_VIDEO_SAA7127_MODULE |
888 | hw = ivtv_request_module(itv, hw, "saa7127", IVTV_HW_SAA7127); | 888 | hw = ivtv_request_module(itv, hw, "saa7127", IVTV_HW_SAA7127); |
889 | #endif | 889 | #endif |
890 | #ifndef CONFIG_VIDEO_SAA717X | 890 | #ifdef CONFIG_VIDEO_SAA717X_MODULE |
891 | hw = ivtv_request_module(itv, hw, "saa717x", IVTV_HW_SAA717X); | 891 | hw = ivtv_request_module(itv, hw, "saa717x", IVTV_HW_SAA717X); |
892 | #endif | 892 | #endif |
893 | #ifndef CONFIG_VIDEO_UPD64031A | 893 | #ifdef CONFIG_VIDEO_UPD64031A_MODULE |
894 | hw = ivtv_request_module(itv, hw, "upd64031a", IVTV_HW_UPD64031A); | 894 | hw = ivtv_request_module(itv, hw, "upd64031a", IVTV_HW_UPD64031A); |
895 | #endif | 895 | #endif |
896 | #ifndef CONFIG_VIDEO_UPD64083 | 896 | #ifdef CONFIG_VIDEO_UPD64083_MODULE |
897 | hw = ivtv_request_module(itv, hw, "upd64083", IVTV_HW_UPD6408X); | 897 | hw = ivtv_request_module(itv, hw, "upd64083", IVTV_HW_UPD6408X); |
898 | #endif | 898 | #endif |
899 | #ifndef CONFIG_VIDEO_MSP3400 | 899 | #ifdef CONFIG_VIDEO_MSP3400_MODULE |
900 | hw = ivtv_request_module(itv, hw, "msp3400", IVTV_HW_MSP34XX); | 900 | hw = ivtv_request_module(itv, hw, "msp3400", IVTV_HW_MSP34XX); |
901 | #endif | 901 | #endif |
902 | #ifndef CONFIG_VIDEO_VP27SMPX | 902 | #ifdef CONFIG_VIDEO_VP27SMPX_MODULE |
903 | hw = ivtv_request_module(itv, hw, "vp27smpx", IVTV_HW_VP27SMPX); | 903 | hw = ivtv_request_module(itv, hw, "vp27smpx", IVTV_HW_VP27SMPX); |
904 | #endif | 904 | #endif |
905 | #ifndef CONFIG_VIDEO_WM8775 | 905 | #ifdef CONFIG_VIDEO_WM8775_MODULE |
906 | hw = ivtv_request_module(itv, hw, "wm8775", IVTV_HW_WM8775); | 906 | hw = ivtv_request_module(itv, hw, "wm8775", IVTV_HW_WM8775); |
907 | #endif | 907 | #endif |
908 | #ifndef CONFIG_VIDEO_WM8739 | 908 | #ifdef CONFIG_VIDEO_WM8739_MODULE |
909 | hw = ivtv_request_module(itv, hw, "wm8739", IVTV_HW_WM8739); | 909 | hw = ivtv_request_module(itv, hw, "wm8739", IVTV_HW_WM8739); |
910 | #endif | 910 | #endif |
911 | #ifndef CONFIG_VIDEO_CS53L32A | 911 | #ifdef CONFIG_VIDEO_CS53L32A_MODULE |
912 | hw = ivtv_request_module(itv, hw, "cs53l32a", IVTV_HW_CS53L32A); | 912 | hw = ivtv_request_module(itv, hw, "cs53l32a", IVTV_HW_CS53L32A); |
913 | #endif | 913 | #endif |
914 | #ifndef CONFIG_VIDEO_M52790 | 914 | #ifdef CONFIG_VIDEO_M52790_MODULE |
915 | hw = ivtv_request_module(itv, hw, "m52790", IVTV_HW_M52790); | 915 | hw = ivtv_request_module(itv, hw, "m52790", IVTV_HW_M52790); |
916 | #endif | 916 | #endif |
917 | #endif | 917 | #endif |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index adf2ba79496a..37860698f782 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -47,7 +47,7 @@ module_param(debug, int, 0); | |||
47 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); | 47 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
48 | 48 | ||
49 | #define SAA7110_MAX_INPUT 9 /* 6 CVBS, 3 SVHS */ | 49 | #define SAA7110_MAX_INPUT 9 /* 6 CVBS, 3 SVHS */ |
50 | #define SAA7110_MAX_OUTPUT 0 /* its a decoder only */ | 50 | #define SAA7110_MAX_OUTPUT 1 /* 1 YUV */ |
51 | 51 | ||
52 | #define SAA7110_NR_REG 0x35 | 52 | #define SAA7110_NR_REG 0x35 |
53 | 53 | ||
@@ -327,7 +327,7 @@ saa7110_command (struct i2c_client *client, | |||
327 | 327 | ||
328 | case DECODER_SET_INPUT: | 328 | case DECODER_SET_INPUT: |
329 | v = *(int *) arg; | 329 | v = *(int *) arg; |
330 | if (v < 0 || v > SAA7110_MAX_INPUT) { | 330 | if (v < 0 || v >= SAA7110_MAX_INPUT) { |
331 | v4l_dbg(1, debug, client, "input=%d not available\n", v); | 331 | v4l_dbg(1, debug, client, "input=%d not available\n", v); |
332 | return -EINVAL; | 332 | return -EINVAL; |
333 | } | 333 | } |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 249184452949..dfbe08a9ad9b 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -941,7 +941,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
941 | dev->name,(unsigned long long)pci_resource_start(pci_dev,0)); | 941 | dev->name,(unsigned long long)pci_resource_start(pci_dev,0)); |
942 | goto fail1; | 942 | goto fail1; |
943 | } | 943 | } |
944 | dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000); | 944 | dev->lmmio = ioremap(pci_resource_start(pci_dev, 0), |
945 | pci_resource_len(pci_dev, 0)); | ||
945 | dev->bmmio = (__u8 __iomem *)dev->lmmio; | 946 | dev->bmmio = (__u8 __iomem *)dev->lmmio; |
946 | if (NULL == dev->lmmio) { | 947 | if (NULL == dev->lmmio) { |
947 | err = -EIO; | 948 | err = -EIO; |
diff --git a/drivers/media/video/usbvideo/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c index 28421d386f1e..c710bcd1df48 100644 --- a/drivers/media/video/usbvideo/ibmcam.c +++ b/drivers/media/video/usbvideo/ibmcam.c | |||
@@ -3695,7 +3695,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * | |||
3695 | unsigned char video_ep = 0; | 3695 | unsigned char video_ep = 0; |
3696 | 3696 | ||
3697 | if (debug >= 1) | 3697 | if (debug >= 1) |
3698 | dev_info(&uvd->dev->dev, "ibmcam_probe(%p,%u.)\n", intf, ifnum); | 3698 | dev_info(&dev->dev, "ibmcam_probe(%p,%u.)\n", intf, ifnum); |
3699 | 3699 | ||
3700 | /* We don't handle multi-config cameras */ | 3700 | /* We don't handle multi-config cameras */ |
3701 | if (dev->descriptor.bNumConfigurations != 1) | 3701 | if (dev->descriptor.bNumConfigurations != 1) |
@@ -3746,7 +3746,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * | |||
3746 | brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */ | 3746 | brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */ |
3747 | break; | 3747 | break; |
3748 | } | 3748 | } |
3749 | dev_info(&uvd->dev->dev, | 3749 | dev_info(&dev->dev, |
3750 | "%s USB camera found (model %d, rev. 0x%04x)\n", | 3750 | "%s USB camera found (model %d, rev. 0x%04x)\n", |
3751 | brand, model, le16_to_cpu(dev->descriptor.bcdDevice)); | 3751 | brand, model, le16_to_cpu(dev->descriptor.bcdDevice)); |
3752 | } while (0); | 3752 | } while (0); |
@@ -3754,7 +3754,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * | |||
3754 | /* Validate found interface: must have one ISO endpoint */ | 3754 | /* Validate found interface: must have one ISO endpoint */ |
3755 | nas = intf->num_altsetting; | 3755 | nas = intf->num_altsetting; |
3756 | if (debug > 0) | 3756 | if (debug > 0) |
3757 | dev_info(&uvd->dev->dev, "Number of alternate settings=%d.\n", | 3757 | dev_info(&dev->dev, "Number of alternate settings=%d.\n", |
3758 | nas); | 3758 | nas); |
3759 | if (nas < 2) { | 3759 | if (nas < 2) { |
3760 | err("Too few alternate settings for this camera!"); | 3760 | err("Too few alternate settings for this camera!"); |
@@ -3799,7 +3799,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * | |||
3799 | actInterface = i; | 3799 | actInterface = i; |
3800 | maxPS = le16_to_cpu(endpoint->wMaxPacketSize); | 3800 | maxPS = le16_to_cpu(endpoint->wMaxPacketSize); |
3801 | if (debug > 0) | 3801 | if (debug > 0) |
3802 | dev_info(&uvd->dev->dev, | 3802 | dev_info(&dev->dev, |
3803 | "Active setting=%d. " | 3803 | "Active setting=%d. " |
3804 | "maxPS=%d.\n", i, maxPS); | 3804 | "maxPS=%d.\n", i, maxPS); |
3805 | } else | 3805 | } else |
@@ -3840,7 +3840,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * | |||
3840 | RESTRICT_TO_RANGE(framerate, 0, 5); | 3840 | RESTRICT_TO_RANGE(framerate, 0, 5); |
3841 | break; | 3841 | break; |
3842 | default: | 3842 | default: |
3843 | dev_info(&uvd->dev->dev, "IBM camera: using 320x240\n"); | 3843 | dev_info(&dev->dev, "IBM camera: using 320x240\n"); |
3844 | size = SIZE_320x240; | 3844 | size = SIZE_320x240; |
3845 | /* No break here */ | 3845 | /* No break here */ |
3846 | case SIZE_320x240: | 3846 | case SIZE_320x240: |
@@ -3869,7 +3869,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * | |||
3869 | canvasY = 120; | 3869 | canvasY = 120; |
3870 | break; | 3870 | break; |
3871 | default: | 3871 | default: |
3872 | dev_info(&uvd->dev->dev, "IBM NetCamera: using 176x144\n"); | 3872 | dev_info(&dev->dev, "IBM NetCamera: using 176x144\n"); |
3873 | size = SIZE_176x144; | 3873 | size = SIZE_176x144; |
3874 | /* No break here */ | 3874 | /* No break here */ |
3875 | case SIZE_176x144: | 3875 | case SIZE_176x144: |
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index f5233f3d9eff..b89f476cd0a9 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -559,12 +559,6 @@ mptctl_fasync(int fd, struct file *filep, int mode) | |||
559 | return ret; | 559 | return ret; |
560 | } | 560 | } |
561 | 561 | ||
562 | static int | ||
563 | mptctl_release(struct inode *inode, struct file *filep) | ||
564 | { | ||
565 | return fasync_helper(-1, filep, 0, &async_queue); | ||
566 | } | ||
567 | |||
568 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 562 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
569 | /* | 563 | /* |
570 | * MPT ioctl handler | 564 | * MPT ioctl handler |
@@ -2706,7 +2700,6 @@ mptctl_hp_targetinfo(unsigned long arg) | |||
2706 | static const struct file_operations mptctl_fops = { | 2700 | static const struct file_operations mptctl_fops = { |
2707 | .owner = THIS_MODULE, | 2701 | .owner = THIS_MODULE, |
2708 | .llseek = no_llseek, | 2702 | .llseek = no_llseek, |
2709 | .release = mptctl_release, | ||
2710 | .fasync = mptctl_fasync, | 2703 | .fasync = mptctl_fasync, |
2711 | .unlocked_ioctl = mptctl_ioctl, | 2704 | .unlocked_ioctl = mptctl_ioctl, |
2712 | #ifdef CONFIG_COMPAT | 2705 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c index a1abf95cf751..603ffd008c73 100644 --- a/drivers/message/fusion/mptlan.c +++ b/drivers/message/fusion/mptlan.c | |||
@@ -77,12 +77,6 @@ MODULE_VERSION(my_VERSION); | |||
77 | * Fusion MPT LAN private structures | 77 | * Fusion MPT LAN private structures |
78 | */ | 78 | */ |
79 | 79 | ||
80 | struct NAA_Hosed { | ||
81 | u16 NAA; | ||
82 | u8 ieee[FC_ALEN]; | ||
83 | struct NAA_Hosed *next; | ||
84 | }; | ||
85 | |||
86 | struct BufferControl { | 80 | struct BufferControl { |
87 | struct sk_buff *skb; | 81 | struct sk_buff *skb; |
88 | dma_addr_t dma; | 82 | dma_addr_t dma; |
@@ -159,11 +153,6 @@ static u8 LanCtx = MPT_MAX_PROTOCOL_DRIVERS; | |||
159 | static u32 max_buckets_out = 127; | 153 | static u32 max_buckets_out = 127; |
160 | static u32 tx_max_out_p = 127 - 16; | 154 | static u32 tx_max_out_p = 127 - 16; |
161 | 155 | ||
162 | #ifdef QLOGIC_NAA_WORKAROUND | ||
163 | static struct NAA_Hosed *mpt_bad_naa = NULL; | ||
164 | DEFINE_RWLOCK(bad_naa_lock); | ||
165 | #endif | ||
166 | |||
167 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 156 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
168 | /** | 157 | /** |
169 | * lan_reply - Handle all data sent from the hardware. | 158 | * lan_reply - Handle all data sent from the hardware. |
@@ -780,30 +769,6 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev) | |||
780 | // ctx, skb, skb->data)); | 769 | // ctx, skb, skb->data)); |
781 | 770 | ||
782 | mac = skb_mac_header(skb); | 771 | mac = skb_mac_header(skb); |
783 | #ifdef QLOGIC_NAA_WORKAROUND | ||
784 | { | ||
785 | struct NAA_Hosed *nh; | ||
786 | |||
787 | /* Munge the NAA for Tx packets to QLogic boards, which don't follow | ||
788 | RFC 2625. The longer I look at this, the more my opinion of Qlogic | ||
789 | drops. */ | ||
790 | read_lock_irq(&bad_naa_lock); | ||
791 | for (nh = mpt_bad_naa; nh != NULL; nh=nh->next) { | ||
792 | if ((nh->ieee[0] == mac[0]) && | ||
793 | (nh->ieee[1] == mac[1]) && | ||
794 | (nh->ieee[2] == mac[2]) && | ||
795 | (nh->ieee[3] == mac[3]) && | ||
796 | (nh->ieee[4] == mac[4]) && | ||
797 | (nh->ieee[5] == mac[5])) { | ||
798 | cur_naa = nh->NAA; | ||
799 | dlprintk ((KERN_INFO "mptlan/sdu_send: using NAA value " | ||
800 | "= %04x.\n", cur_naa)); | ||
801 | break; | ||
802 | } | ||
803 | } | ||
804 | read_unlock_irq(&bad_naa_lock); | ||
805 | } | ||
806 | #endif | ||
807 | 772 | ||
808 | pTrans->TransactionDetails[0] = cpu_to_le32((cur_naa << 16) | | 773 | pTrans->TransactionDetails[0] = cpu_to_le32((cur_naa << 16) | |
809 | (mac[0] << 8) | | 774 | (mac[0] << 8) | |
@@ -1572,79 +1537,6 @@ mpt_lan_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
1572 | 1537 | ||
1573 | fcllc = (struct fcllc *)skb->data; | 1538 | fcllc = (struct fcllc *)skb->data; |
1574 | 1539 | ||
1575 | #ifdef QLOGIC_NAA_WORKAROUND | ||
1576 | { | ||
1577 | u16 source_naa = fch->stype, found = 0; | ||
1578 | |||
1579 | /* Workaround for QLogic not following RFC 2625 in regards to the NAA | ||
1580 | value. */ | ||
1581 | |||
1582 | if ((source_naa & 0xF000) == 0) | ||
1583 | source_naa = swab16(source_naa); | ||
1584 | |||
1585 | if (fcllc->ethertype == htons(ETH_P_ARP)) | ||
1586 | dlprintk ((KERN_INFO "mptlan/type_trans: got arp req/rep w/ naa of " | ||
1587 | "%04x.\n", source_naa)); | ||
1588 | |||
1589 | if ((fcllc->ethertype == htons(ETH_P_ARP)) && | ||
1590 | ((source_naa >> 12) != MPT_LAN_NAA_RFC2625)){ | ||
1591 | struct NAA_Hosed *nh, *prevnh; | ||
1592 | int i; | ||
1593 | |||
1594 | dlprintk ((KERN_INFO "mptlan/type_trans: ARP Req/Rep from " | ||
1595 | "system with non-RFC 2625 NAA value (%04x).\n", | ||
1596 | source_naa)); | ||
1597 | |||
1598 | write_lock_irq(&bad_naa_lock); | ||
1599 | for (prevnh = nh = mpt_bad_naa; nh != NULL; | ||
1600 | prevnh=nh, nh=nh->next) { | ||
1601 | if ((nh->ieee[0] == fch->saddr[0]) && | ||
1602 | (nh->ieee[1] == fch->saddr[1]) && | ||
1603 | (nh->ieee[2] == fch->saddr[2]) && | ||
1604 | (nh->ieee[3] == fch->saddr[3]) && | ||
1605 | (nh->ieee[4] == fch->saddr[4]) && | ||
1606 | (nh->ieee[5] == fch->saddr[5])) { | ||
1607 | found = 1; | ||
1608 | dlprintk ((KERN_INFO "mptlan/type_trans: ARP Re" | ||
1609 | "q/Rep w/ bad NAA from system already" | ||
1610 | " in DB.\n")); | ||
1611 | break; | ||
1612 | } | ||
1613 | } | ||
1614 | |||
1615 | if ((!found) && (nh == NULL)) { | ||
1616 | |||
1617 | nh = kmalloc(sizeof(struct NAA_Hosed), GFP_KERNEL); | ||
1618 | dlprintk ((KERN_INFO "mptlan/type_trans: ARP Req/Rep w/" | ||
1619 | " bad NAA from system not yet in DB.\n")); | ||
1620 | |||
1621 | if (nh != NULL) { | ||
1622 | nh->next = NULL; | ||
1623 | if (!mpt_bad_naa) | ||
1624 | mpt_bad_naa = nh; | ||
1625 | if (prevnh) | ||
1626 | prevnh->next = nh; | ||
1627 | |||
1628 | nh->NAA = source_naa; /* Set the S_NAA value. */ | ||
1629 | for (i = 0; i < FC_ALEN; i++) | ||
1630 | nh->ieee[i] = fch->saddr[i]; | ||
1631 | dlprintk ((KERN_INFO "Got ARP from %02x:%02x:%02x:%02x:" | ||
1632 | "%02x:%02x with non-compliant S_NAA value.\n", | ||
1633 | fch->saddr[0], fch->saddr[1], fch->saddr[2], | ||
1634 | fch->saddr[3], fch->saddr[4],fch->saddr[5])); | ||
1635 | } else { | ||
1636 | printk (KERN_ERR "mptlan/type_trans: Unable to" | ||
1637 | " kmalloc a NAA_Hosed struct.\n"); | ||
1638 | } | ||
1639 | } else if (!found) { | ||
1640 | printk (KERN_ERR "mptlan/type_trans: found not" | ||
1641 | " set, but nh isn't null. Evil " | ||
1642 | "funkiness abounds.\n"); | ||
1643 | } | ||
1644 | write_unlock_irq(&bad_naa_lock); | ||
1645 | } | ||
1646 | } | ||
1647 | #endif | ||
1648 | 1540 | ||
1649 | /* Strip the SNAP header from ARP packets since we don't | 1541 | /* Strip the SNAP header from ARP packets since we don't |
1650 | * pass them through to the 802.2/SNAP layers. | 1542 | * pass them through to the 802.2/SNAP layers. |
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/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index a3fabdbe6ca6..f3384c32b9a1 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -1097,28 +1097,17 @@ static int cfg_fasync(int fd, struct file *fp, int on) | |||
1097 | static int cfg_release(struct inode *inode, struct file *file) | 1097 | static int cfg_release(struct inode *inode, struct file *file) |
1098 | { | 1098 | { |
1099 | ulong id = (ulong) file->private_data; | 1099 | ulong id = (ulong) file->private_data; |
1100 | struct i2o_cfg_info *p1, *p2; | 1100 | struct i2o_cfg_info *p, **q; |
1101 | unsigned long flags; | 1101 | unsigned long flags; |
1102 | 1102 | ||
1103 | lock_kernel(); | 1103 | lock_kernel(); |
1104 | p1 = p2 = NULL; | ||
1105 | |||
1106 | spin_lock_irqsave(&i2o_config_lock, flags); | 1104 | spin_lock_irqsave(&i2o_config_lock, flags); |
1107 | for (p1 = open_files; p1;) { | 1105 | for (q = &open_files; (p = *q) != NULL; q = &p->next) { |
1108 | if (p1->q_id == id) { | 1106 | if (p->q_id == id) { |
1109 | 1107 | *q = p->next; | |
1110 | if (p1->fasync) | 1108 | kfree(p); |
1111 | cfg_fasync(-1, file, 0); | ||
1112 | if (p2) | ||
1113 | p2->next = p1->next; | ||
1114 | else | ||
1115 | open_files = p1->next; | ||
1116 | |||
1117 | kfree(p1); | ||
1118 | break; | 1109 | break; |
1119 | } | 1110 | } |
1120 | p2 = p1; | ||
1121 | p1 = p1->next; | ||
1122 | } | 1111 | } |
1123 | spin_unlock_irqrestore(&i2o_config_lock, flags); | 1112 | spin_unlock_irqrestore(&i2o_config_lock, flags); |
1124 | unlock_kernel(); | 1113 | unlock_kernel(); |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 5a79d2d4cdae..257277394f8c 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -81,7 +81,7 @@ config MFD_TMIO | |||
81 | 81 | ||
82 | config MFD_T7L66XB | 82 | config MFD_T7L66XB |
83 | bool "Support Toshiba T7L66XB" | 83 | bool "Support Toshiba T7L66XB" |
84 | depends on ARM | 84 | depends on ARM && HAVE_CLK |
85 | select MFD_CORE | 85 | select MFD_CORE |
86 | select MFD_TMIO | 86 | select MFD_TMIO |
87 | help | 87 | help |
@@ -89,7 +89,7 @@ config MFD_T7L66XB | |||
89 | 89 | ||
90 | config MFD_TC6387XB | 90 | config MFD_TC6387XB |
91 | bool "Support Toshiba TC6387XB" | 91 | bool "Support Toshiba TC6387XB" |
92 | depends on ARM | 92 | depends on ARM && HAVE_CLK |
93 | select MFD_CORE | 93 | select MFD_CORE |
94 | select MFD_TMIO | 94 | select MFD_TMIO |
95 | help | 95 | help |
@@ -103,8 +103,20 @@ config MFD_TC6393XB | |||
103 | help | 103 | help |
104 | Support for Toshiba Mobile IO Controller TC6393XB | 104 | Support for Toshiba Mobile IO Controller TC6393XB |
105 | 105 | ||
106 | config PMIC_DA903X | ||
107 | bool "Dialog Semiconductor DA9030/DA9034 PMIC Support" | ||
108 | depends on I2C=y | ||
109 | help | ||
110 | Say yes here to support for Dialog Semiconductor DA9030 (a.k.a | ||
111 | ARAVA) and DA9034 (a.k.a MICCO), these are Power Management IC | ||
112 | usually found on PXA processors-based platforms. This includes | ||
113 | the I2C driver and the core APIs _only_, you have to select | ||
114 | individual components like LCD backlight, voltage regulators, | ||
115 | LEDs and battery-charger under the corresponding menus. | ||
116 | |||
106 | config MFD_WM8400 | 117 | config MFD_WM8400 |
107 | tristate "Support Wolfson Microelectronics WM8400" | 118 | tristate "Support Wolfson Microelectronics WM8400" |
119 | depends on I2C | ||
108 | help | 120 | help |
109 | Support for the Wolfson Microelecronics WM8400 PMIC and audio | 121 | Support for the Wolfson Microelecronics WM8400 PMIC and audio |
110 | CODEC. This driver adds provides common support for accessing | 122 | CODEC. This driver adds provides common support for accessing |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 0acefe8aff87..9a5ad8af9116 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -30,3 +30,5 @@ ifeq ($(CONFIG_SA1100_ASSABET),y) | |||
30 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-assabet.o | 30 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-assabet.o |
31 | endif | 31 | endif |
32 | obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o | 32 | obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o |
33 | |||
34 | obj-$(CONFIG_PMIC_DA903X) += da903x.o \ No newline at end of file | ||
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/panasonic-laptop.c b/drivers/misc/panasonic-laptop.c index a2cb598d8ab5..4a1bc64485d5 100644 --- a/drivers/misc/panasonic-laptop.c +++ b/drivers/misc/panasonic-laptop.c | |||
@@ -116,7 +116,6 @@ | |||
116 | * | 116 | * |
117 | */ | 117 | */ |
118 | 118 | ||
119 | #include <linux/version.h> | ||
120 | #include <linux/kernel.h> | 119 | #include <linux/kernel.h> |
121 | #include <linux/module.h> | 120 | #include <linux/module.h> |
122 | #include <linux/init.h> | 121 | #include <linux/init.h> |
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 @@ | |||
5 | obj-$(CONFIG_SGI_XP) += xp.o | 5 | obj-$(CONFIG_SGI_XP) += xp.o |
6 | xp-y := xp_main.o | 6 | xp-y := xp_main.o |
7 | xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o | 7 | xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o |
8 | xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o xp_uv.o | 8 | xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o |
9 | xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o | 9 | xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o |
10 | xp-$(CONFIG_X86_64) += xp_uv.o | 10 | xp-$(CONFIG_X86_64) += xp_uv.o |
11 | 11 | ||
12 | obj-$(CONFIG_SGI_XP) += xpc.o | 12 | obj-$(CONFIG_SGI_XP) += xpc.o |
13 | xpc-y := xpc_main.o xpc_channel.o xpc_partition.o | 13 | xpc-y := xpc_main.o xpc_channel.o xpc_partition.o |
14 | xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o | 14 | xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o |
15 | xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o xpc_uv.o | 15 | xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o |
16 | xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o | 16 | xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o |
17 | xpc-$(CONFIG_X86_64) += xpc_uv.o | 17 | xpc-$(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: | |||
1363 | out_1: | 1363 | out_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..06f07e19dc70 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -1920,7 +1920,6 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on) | |||
1920 | 1920 | ||
1921 | static int sonypi_misc_release(struct inode *inode, struct file *file) | 1921 | static int sonypi_misc_release(struct inode *inode, struct file *file) |
1922 | { | 1922 | { |
1923 | sonypi_misc_fasync(-1, file, 0); | ||
1924 | atomic_dec(&sonypi_compat.open_count); | 1923 | atomic_dec(&sonypi_compat.open_count); |
1925 | return 0; | 1924 | return 0; |
1926 | } | 1925 | } |
@@ -2315,8 +2314,10 @@ end: | |||
2315 | */ | 2314 | */ |
2316 | static int sony_pic_disable(struct acpi_device *device) | 2315 | static int sony_pic_disable(struct acpi_device *device) |
2317 | { | 2316 | { |
2318 | if (ACPI_FAILURE(acpi_evaluate_object(device->handle, | 2317 | acpi_status ret = acpi_evaluate_object(device->handle, "_DIS", NULL, |
2319 | "_DIS", NULL, NULL))) | 2318 | NULL); |
2319 | |||
2320 | if (ACPI_FAILURE(ret) && ret != AE_NOT_FOUND) | ||
2320 | return -ENXIO; | 2321 | return -ENXIO; |
2321 | 2322 | ||
2322 | dprintk("Device disabled\n"); | 2323 | dprintk("Device disabled\n"); |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 0d9b2d6f9ebf..f210a8ee6861 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -216,8 +216,7 @@ int mmc_add_card(struct mmc_card *card) | |||
216 | int ret; | 216 | int ret; |
217 | const char *type; | 217 | const char *type; |
218 | 218 | ||
219 | snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), | 219 | dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca); |
220 | "%s:%04x", mmc_hostname(card->host), card->rca); | ||
221 | 220 | ||
222 | switch (card->type) { | 221 | switch (card->type) { |
223 | case MMC_TYPE_MMC: | 222 | case MMC_TYPE_MMC: |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 044d84eeed7c..f7284b905eb3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -280,7 +280,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) | |||
280 | (card->host->ios.clock / 1000); | 280 | (card->host->ios.clock / 1000); |
281 | 281 | ||
282 | if (data->flags & MMC_DATA_WRITE) | 282 | if (data->flags & MMC_DATA_WRITE) |
283 | limit_us = 250000; | 283 | /* |
284 | * The limit is really 250 ms, but that is | ||
285 | * insufficient for some crappy cards. | ||
286 | */ | ||
287 | limit_us = 300000; | ||
284 | else | 288 | else |
285 | limit_us = 100000; | 289 | limit_us = 100000; |
286 | 290 | ||
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 6da80fd4d974..5e945e64ead7 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -73,8 +73,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) | |||
73 | if (err) | 73 | if (err) |
74 | goto free; | 74 | goto free; |
75 | 75 | ||
76 | snprintf(host->class_dev.bus_id, BUS_ID_SIZE, | 76 | dev_set_name(&host->class_dev, "mmc%d", host->index); |
77 | "mmc%d", host->index); | ||
78 | 77 | ||
79 | host->parent = dev; | 78 | host->parent = dev; |
80 | host->class_dev.parent = dev; | 79 | host->class_dev.parent = dev; |
@@ -121,7 +120,7 @@ int mmc_add_host(struct mmc_host *host) | |||
121 | WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && | 120 | WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && |
122 | !host->ops->enable_sdio_irq); | 121 | !host->ops->enable_sdio_irq); |
123 | 122 | ||
124 | led_trigger_register_simple(host->class_dev.bus_id, &host->led); | 123 | led_trigger_register_simple(dev_name(&host->class_dev), &host->led); |
125 | 124 | ||
126 | err = device_add(&host->class_dev); | 125 | err = device_add(&host->class_dev); |
127 | if (err) | 126 | if (err) |
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 233d0f9b3c4b..46284b527397 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
@@ -239,8 +239,7 @@ int sdio_add_func(struct sdio_func *func) | |||
239 | { | 239 | { |
240 | int ret; | 240 | int ret; |
241 | 241 | ||
242 | snprintf(func->dev.bus_id, sizeof(func->dev.bus_id), | 242 | dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); |
243 | "%s:%d", mmc_card_id(func->card), func->num); | ||
244 | 243 | ||
245 | ret = device_add(&func->dev); | 244 | ret = device_add(&func->dev); |
246 | if (ret == 0) | 245 | if (ret == 0) |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 07faf5412a1f..ad00e1632317 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -1348,7 +1348,7 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
1348 | goto fail_add_host; | 1348 | goto fail_add_host; |
1349 | 1349 | ||
1350 | dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", | 1350 | dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", |
1351 | mmc->class_dev.bus_id, | 1351 | dev_name(&mmc->class_dev), |
1352 | host->dma_dev ? "" : ", no DMA", | 1352 | host->dma_dev ? "" : ", no DMA", |
1353 | (host->pdata && host->pdata->get_ro) | 1353 | (host->pdata && host->pdata->get_ro) |
1354 | ? "" : ", no WP", | 1354 | ? "" : ", no WP", |
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) | |||
391 | static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) | 391 | static 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 | ||
417 | static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | 418 | static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 30f64b1f2354..4d010a984bed 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1733,7 +1733,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
1733 | mmc_add_host(mmc); | 1733 | mmc_add_host(mmc); |
1734 | 1734 | ||
1735 | printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n", | 1735 | printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n", |
1736 | mmc_hostname(mmc), host->hw_name, mmc_dev(mmc)->bus_id, | 1736 | mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)), |
1737 | (host->flags & SDHCI_USE_ADMA)?"A":"", | 1737 | (host->flags & SDHCI_USE_ADMA)?"A":"", |
1738 | (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); | 1738 | (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); |
1739 | 1739 | ||
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 13844843e8de..82554ddec6b3 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -632,7 +632,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
632 | 632 | ||
633 | if (host->req) { | 633 | if (host->req) { |
634 | printk(KERN_ERR "%s : unfinished request detected\n", | 634 | printk(KERN_ERR "%s : unfinished request detected\n", |
635 | sock->dev.bus_id); | 635 | dev_name(&sock->dev)); |
636 | mrq->cmd->error = -ETIMEDOUT; | 636 | mrq->cmd->error = -ETIMEDOUT; |
637 | goto err_out; | 637 | goto err_out; |
638 | } | 638 | } |
@@ -672,7 +672,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
672 | ? PCI_DMA_TODEVICE | 672 | ? PCI_DMA_TODEVICE |
673 | : PCI_DMA_FROMDEVICE)) { | 673 | : PCI_DMA_FROMDEVICE)) { |
674 | printk(KERN_ERR "%s : scatterlist map failed\n", | 674 | printk(KERN_ERR "%s : scatterlist map failed\n", |
675 | sock->dev.bus_id); | 675 | dev_name(&sock->dev)); |
676 | mrq->cmd->error = -ENOMEM; | 676 | mrq->cmd->error = -ENOMEM; |
677 | goto err_out; | 677 | goto err_out; |
678 | } | 678 | } |
@@ -684,7 +684,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
684 | : PCI_DMA_FROMDEVICE); | 684 | : PCI_DMA_FROMDEVICE); |
685 | if (host->sg_len < 1) { | 685 | if (host->sg_len < 1) { |
686 | printk(KERN_ERR "%s : scatterlist map failed\n", | 686 | printk(KERN_ERR "%s : scatterlist map failed\n", |
687 | sock->dev.bus_id); | 687 | dev_name(&sock->dev)); |
688 | tifm_unmap_sg(sock, &host->bounce_buf, 1, | 688 | tifm_unmap_sg(sock, &host->bounce_buf, 1, |
689 | r_data->flags & MMC_DATA_WRITE | 689 | r_data->flags & MMC_DATA_WRITE |
690 | ? PCI_DMA_TODEVICE | 690 | ? PCI_DMA_TODEVICE |
@@ -748,7 +748,7 @@ static void tifm_sd_end_cmd(unsigned long data) | |||
748 | 748 | ||
749 | if (!mrq) { | 749 | if (!mrq) { |
750 | printk(KERN_ERR " %s : no request to complete?\n", | 750 | printk(KERN_ERR " %s : no request to complete?\n", |
751 | sock->dev.bus_id); | 751 | dev_name(&sock->dev)); |
752 | spin_unlock_irqrestore(&sock->lock, flags); | 752 | spin_unlock_irqrestore(&sock->lock, flags); |
753 | return; | 753 | return; |
754 | } | 754 | } |
@@ -789,7 +789,7 @@ static void tifm_sd_abort(unsigned long data) | |||
789 | printk(KERN_ERR | 789 | printk(KERN_ERR |
790 | "%s : card failed to respond for a long period of time " | 790 | "%s : card failed to respond for a long period of time " |
791 | "(%x, %x)\n", | 791 | "(%x, %x)\n", |
792 | host->dev->dev.bus_id, host->req->cmd->opcode, host->cmd_flags); | 792 | dev_name(&host->dev->dev), host->req->cmd->opcode, host->cmd_flags); |
793 | 793 | ||
794 | tifm_eject(host->dev); | 794 | tifm_eject(host->dev); |
795 | } | 795 | } |
@@ -906,7 +906,7 @@ static int tifm_sd_initialize_host(struct tifm_sd *host) | |||
906 | 906 | ||
907 | if (rc) { | 907 | if (rc) { |
908 | printk(KERN_ERR "%s : controller failed to reset\n", | 908 | printk(KERN_ERR "%s : controller failed to reset\n", |
909 | sock->dev.bus_id); | 909 | dev_name(&sock->dev)); |
910 | return -ENODEV; | 910 | return -ENODEV; |
911 | } | 911 | } |
912 | 912 | ||
@@ -933,7 +933,7 @@ static int tifm_sd_initialize_host(struct tifm_sd *host) | |||
933 | if (rc) { | 933 | if (rc) { |
934 | printk(KERN_ERR | 934 | printk(KERN_ERR |
935 | "%s : card not ready - probe failed on initialization\n", | 935 | "%s : card not ready - probe failed on initialization\n", |
936 | sock->dev.bus_id); | 936 | dev_name(&sock->dev)); |
937 | return -ENODEV; | 937 | return -ENODEV; |
938 | } | 938 | } |
939 | 939 | ||
@@ -954,7 +954,7 @@ static int tifm_sd_probe(struct tifm_dev *sock) | |||
954 | if (!(TIFM_SOCK_STATE_OCCUPIED | 954 | if (!(TIFM_SOCK_STATE_OCCUPIED |
955 | & readl(sock->addr + SOCK_PRESENT_STATE))) { | 955 | & readl(sock->addr + SOCK_PRESENT_STATE))) { |
956 | printk(KERN_WARNING "%s : card gone, unexpectedly\n", | 956 | printk(KERN_WARNING "%s : card gone, unexpectedly\n", |
957 | sock->dev.bus_id); | 957 | dev_name(&sock->dev)); |
958 | return rc; | 958 | return rc; |
959 | } | 959 | } |
960 | 960 | ||
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 3e6f5d8609e8..d74ec46aa032 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -406,19 +406,6 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) | |||
406 | /* Set the default CFI lock/unlock addresses */ | 406 | /* Set the default CFI lock/unlock addresses */ |
407 | cfi->addr_unlock1 = 0x555; | 407 | cfi->addr_unlock1 = 0x555; |
408 | cfi->addr_unlock2 = 0x2aa; | 408 | cfi->addr_unlock2 = 0x2aa; |
409 | /* Modify the unlock address if we are in compatibility mode */ | ||
410 | if ( /* x16 in x8 mode */ | ||
411 | ((cfi->device_type == CFI_DEVICETYPE_X8) && | ||
412 | (cfi->cfiq->InterfaceDesc == | ||
413 | CFI_INTERFACE_X8_BY_X16_ASYNC)) || | ||
414 | /* x32 in x16 mode */ | ||
415 | ((cfi->device_type == CFI_DEVICETYPE_X16) && | ||
416 | (cfi->cfiq->InterfaceDesc == | ||
417 | CFI_INTERFACE_X16_BY_X32_ASYNC))) | ||
418 | { | ||
419 | cfi->addr_unlock1 = 0xaaa; | ||
420 | cfi->addr_unlock2 = 0x555; | ||
421 | } | ||
422 | 409 | ||
423 | } /* CFI mode */ | 410 | } /* CFI mode */ |
424 | else if (cfi->cfi_mode == CFI_MODE_JEDEC) { | 411 | else if (cfi->cfi_mode == CFI_MODE_JEDEC) { |
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c index f84ab6182148..2f3f2f719ba4 100644 --- a/drivers/mtd/chips/jedec_probe.c +++ b/drivers/mtd/chips/jedec_probe.c | |||
@@ -1808,9 +1808,7 @@ static inline u32 jedec_read_mfr(struct map_info *map, uint32_t base, | |||
1808 | * several first banks can contain 0x7f instead of actual ID | 1808 | * several first banks can contain 0x7f instead of actual ID |
1809 | */ | 1809 | */ |
1810 | do { | 1810 | do { |
1811 | uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), | 1811 | uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), map, cfi); |
1812 | cfi_interleave(cfi), | ||
1813 | cfi->device_type); | ||
1814 | mask = (1 << (cfi->device_type * 8)) - 1; | 1812 | mask = (1 << (cfi->device_type * 8)) - 1; |
1815 | result = map_read(map, base + ofs); | 1813 | result = map_read(map, base + ofs); |
1816 | bank++; | 1814 | bank++; |
@@ -1824,7 +1822,7 @@ static inline u32 jedec_read_id(struct map_info *map, uint32_t base, | |||
1824 | { | 1822 | { |
1825 | map_word result; | 1823 | map_word result; |
1826 | unsigned long mask; | 1824 | unsigned long mask; |
1827 | u32 ofs = cfi_build_cmd_addr(1, cfi_interleave(cfi), cfi->device_type); | 1825 | u32 ofs = cfi_build_cmd_addr(1, map, cfi); |
1828 | mask = (1 << (cfi->device_type * 8)) -1; | 1826 | mask = (1 << (cfi->device_type * 8)) -1; |
1829 | result = map_read(map, base + ofs); | 1827 | result = map_read(map, base + ofs); |
1830 | return result.x[0] & mask; | 1828 | return result.x[0] & mask; |
@@ -2067,8 +2065,8 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, | |||
2067 | 2065 | ||
2068 | } | 2066 | } |
2069 | /* Ensure the unlock addresses we try stay inside the map */ | 2067 | /* Ensure the unlock addresses we try stay inside the map */ |
2070 | probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, cfi_interleave(cfi), cfi->device_type); | 2068 | probe_offset1 = cfi_build_cmd_addr(cfi->addr_unlock1, map, cfi); |
2071 | probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, cfi_interleave(cfi), cfi->device_type); | 2069 | probe_offset2 = cfi_build_cmd_addr(cfi->addr_unlock2, map, cfi); |
2072 | if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) || | 2070 | if ( ((base + probe_offset1 + map_bankwidth(map)) >= map->size) || |
2073 | ((base + probe_offset2 + map_bankwidth(map)) >= map->size)) | 2071 | ((base + probe_offset2 + map_bankwidth(map)) >= map->size)) |
2074 | goto retry; | 2072 | goto retry; |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 8387e05daae2..e39b21d3e168 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <asm/arch/gpmc.h> | 38 | #include <asm/arch/gpmc.h> |
39 | #include <asm/arch/onenand.h> | 39 | #include <asm/arch/onenand.h> |
40 | #include <asm/arch/gpio.h> | 40 | #include <asm/arch/gpio.h> |
41 | #include <asm/arch/gpmc.h> | ||
42 | #include <asm/arch/pm.h> | 41 | #include <asm/arch/pm.h> |
43 | 42 | ||
44 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index 3a7bc524af33..c7a4f3bcc2bc 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -94,7 +94,7 @@ | |||
94 | #include <asm/io.h> | 94 | #include <asm/io.h> |
95 | #include <asm/irq.h> | 95 | #include <asm/irq.h> |
96 | 96 | ||
97 | static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n"; | 97 | static char version[] __devinitdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n"; |
98 | 98 | ||
99 | #ifdef EL3_DEBUG | 99 | #ifdef EL3_DEBUG |
100 | static int el3_debug = EL3_DEBUG; | 100 | static int el3_debug = EL3_DEBUG; |
@@ -186,7 +186,7 @@ static int max_interrupt_work = 10; | |||
186 | static int nopnp; | 186 | static int nopnp; |
187 | #endif | 187 | #endif |
188 | 188 | ||
189 | static int __init el3_common_init(struct net_device *dev); | 189 | static int __devinit el3_common_init(struct net_device *dev); |
190 | static void el3_common_remove(struct net_device *dev); | 190 | static void el3_common_remove(struct net_device *dev); |
191 | static ushort id_read_eeprom(int index); | 191 | static ushort id_read_eeprom(int index); |
192 | static ushort read_eeprom(int ioaddr, int index); | 192 | static ushort read_eeprom(int ioaddr, int index); |
@@ -537,7 +537,7 @@ static struct mca_driver el3_mca_driver = { | |||
537 | static int mca_registered; | 537 | static int mca_registered; |
538 | #endif /* CONFIG_MCA */ | 538 | #endif /* CONFIG_MCA */ |
539 | 539 | ||
540 | static int __init el3_common_init(struct net_device *dev) | 540 | static int __devinit el3_common_init(struct net_device *dev) |
541 | { | 541 | { |
542 | struct el3_private *lp = netdev_priv(dev); | 542 | struct el3_private *lp = netdev_priv(dev); |
543 | int err; | 543 | int err; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f749b40f954e..11f143f4adf6 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2010,9 +2010,13 @@ config IGB_LRO | |||
2010 | If in doubt, say N. | 2010 | If in doubt, say N. |
2011 | 2011 | ||
2012 | config IGB_DCA | 2012 | config IGB_DCA |
2013 | bool "Enable DCA" | 2013 | bool "Direct Cache Access (DCA) Support" |
2014 | default y | 2014 | default y |
2015 | depends on IGB && DCA && !(IGB=y && DCA=m) | 2015 | depends on IGB && DCA && !(IGB=y && DCA=m) |
2016 | ---help--- | ||
2017 | Say Y here if you want to use Direct Cache Access (DCA) in the | ||
2018 | driver. DCA is a method for warming the CPU cache before data | ||
2019 | is used, with the intent of lessening the impact of cache misses. | ||
2016 | 2020 | ||
2017 | source "drivers/net/ixp2000/Kconfig" | 2021 | source "drivers/net/ixp2000/Kconfig" |
2018 | 2022 | ||
@@ -2437,9 +2441,13 @@ config IXGBE | |||
2437 | will be called ixgbe. | 2441 | will be called ixgbe. |
2438 | 2442 | ||
2439 | config IXGBE_DCA | 2443 | config IXGBE_DCA |
2440 | bool | 2444 | bool "Direct Cache Access (DCA) Support" |
2441 | default y | 2445 | default y |
2442 | depends on IXGBE && DCA && !(IXGBE=y && DCA=m) | 2446 | depends on IXGBE && DCA && !(IXGBE=y && DCA=m) |
2447 | ---help--- | ||
2448 | Say Y here if you want to use Direct Cache Access (DCA) in the | ||
2449 | driver. DCA is a method for warming the CPU cache before data | ||
2450 | is used, with the intent of lessening the impact of cache misses. | ||
2443 | 2451 | ||
2444 | config IXGB | 2452 | config IXGB |
2445 | tristate "Intel(R) PRO/10GbE support" | 2453 | tristate "Intel(R) PRO/10GbE support" |
@@ -2489,9 +2497,13 @@ config MYRI10GE | |||
2489 | will be called myri10ge. | 2497 | will be called myri10ge. |
2490 | 2498 | ||
2491 | config MYRI10GE_DCA | 2499 | config MYRI10GE_DCA |
2492 | bool | 2500 | bool "Direct Cache Access (DCA) Support" |
2493 | default y | 2501 | default y |
2494 | depends on MYRI10GE && DCA && !(MYRI10GE=y && DCA=m) | 2502 | depends on MYRI10GE && DCA && !(MYRI10GE=y && DCA=m) |
2503 | ---help--- | ||
2504 | Say Y here if you want to use Direct Cache Access (DCA) in the | ||
2505 | driver. DCA is a method for warming the CPU cache before data | ||
2506 | is used, with the intent of lessening the impact of cache misses. | ||
2495 | 2507 | ||
2496 | config NETXEN_NIC | 2508 | config NETXEN_NIC |
2497 | tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" | 2509 | tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" |
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index c54967f7942a..07a6697e3635 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c | |||
@@ -644,10 +644,6 @@ This function frees the transmiter and receiver descriptor rings. | |||
644 | */ | 644 | */ |
645 | static void amd8111e_free_ring(struct amd8111e_priv* lp) | 645 | static void amd8111e_free_ring(struct amd8111e_priv* lp) |
646 | { | 646 | { |
647 | |||
648 | /* Free transmit and receive skbs */ | ||
649 | amd8111e_free_skbs(lp->amd8111e_net_dev); | ||
650 | |||
651 | /* Free transmit and receive descriptor rings */ | 647 | /* Free transmit and receive descriptor rings */ |
652 | if(lp->rx_ring){ | 648 | if(lp->rx_ring){ |
653 | pci_free_consistent(lp->pci_dev, | 649 | pci_free_consistent(lp->pci_dev, |
@@ -833,12 +829,14 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget) | |||
833 | 829 | ||
834 | } while(intr0 & RINT0); | 830 | } while(intr0 & RINT0); |
835 | 831 | ||
836 | /* Receive descriptor is empty now */ | 832 | if (rx_pkt_limit > 0) { |
837 | spin_lock_irqsave(&lp->lock, flags); | 833 | /* Receive descriptor is empty now */ |
838 | __netif_rx_complete(dev, napi); | 834 | spin_lock_irqsave(&lp->lock, flags); |
839 | writel(VAL0|RINTEN0, mmio + INTEN0); | 835 | __netif_rx_complete(dev, napi); |
840 | writel(VAL2 | RDMD0, mmio + CMD0); | 836 | writel(VAL0|RINTEN0, mmio + INTEN0); |
841 | spin_unlock_irqrestore(&lp->lock, flags); | 837 | writel(VAL2 | RDMD0, mmio + CMD0); |
838 | spin_unlock_irqrestore(&lp->lock, flags); | ||
839 | } | ||
842 | 840 | ||
843 | rx_not_empty: | 841 | rx_not_empty: |
844 | return num_rx_pkt; | 842 | return num_rx_pkt; |
@@ -1231,7 +1229,9 @@ static int amd8111e_close(struct net_device * dev) | |||
1231 | 1229 | ||
1232 | amd8111e_disable_interrupt(lp); | 1230 | amd8111e_disable_interrupt(lp); |
1233 | amd8111e_stop_chip(lp); | 1231 | amd8111e_stop_chip(lp); |
1234 | amd8111e_free_ring(lp); | 1232 | |
1233 | /* Free transmit and receive skbs */ | ||
1234 | amd8111e_free_skbs(lp->amd8111e_net_dev); | ||
1235 | 1235 | ||
1236 | netif_carrier_off(lp->amd8111e_net_dev); | 1236 | netif_carrier_off(lp->amd8111e_net_dev); |
1237 | 1237 | ||
@@ -1241,6 +1241,7 @@ static int amd8111e_close(struct net_device * dev) | |||
1241 | 1241 | ||
1242 | spin_unlock_irq(&lp->lock); | 1242 | spin_unlock_irq(&lp->lock); |
1243 | free_irq(dev->irq, dev); | 1243 | free_irq(dev->irq, dev); |
1244 | amd8111e_free_ring(lp); | ||
1244 | 1245 | ||
1245 | /* Update the statistics before closing */ | 1246 | /* Update the statistics before closing */ |
1246 | amd8111e_get_stats(dev); | 1247 | amd8111e_get_stats(dev); |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 0fa53464efb2..6f431a887e7e 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -1080,7 +1080,8 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add | |||
1080 | init_timer(&lp->check_timer); | 1080 | init_timer(&lp->check_timer); |
1081 | lp->check_timer.data = (unsigned long)dev; | 1081 | lp->check_timer.data = (unsigned long)dev; |
1082 | lp->check_timer.function = at91ether_check_link; | 1082 | lp->check_timer.function = at91ether_check_link; |
1083 | } | 1083 | } else if (lp->board_data.phy_irq_pin >= 32) |
1084 | gpio_request(lp->board_data.phy_irq_pin, "ethernet_phy"); | ||
1084 | 1085 | ||
1085 | /* Display ethernet banner */ | 1086 | /* Display ethernet banner */ |
1086 | printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%s)\n", | 1087 | printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%s)\n", |
@@ -1167,6 +1168,9 @@ static int __devexit at91ether_remove(struct platform_device *pdev) | |||
1167 | struct net_device *dev = platform_get_drvdata(pdev); | 1168 | struct net_device *dev = platform_get_drvdata(pdev); |
1168 | struct at91_private *lp = netdev_priv(dev); | 1169 | struct at91_private *lp = netdev_priv(dev); |
1169 | 1170 | ||
1171 | if (lp->board_data.phy_irq_pin >= 32) | ||
1172 | gpio_free(lp->board_data.phy_irq_pin); | ||
1173 | |||
1170 | unregister_netdev(dev); | 1174 | unregister_netdev(dev); |
1171 | free_irq(dev->irq, dev); | 1175 | free_irq(dev->irq, dev); |
1172 | dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); | 1176 | dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); |
diff --git a/drivers/net/atl1e/atl1e.h b/drivers/net/atl1e/atl1e.h index b645fa0f3f64..c49550d507a0 100644 --- a/drivers/net/atl1e/atl1e.h +++ b/drivers/net/atl1e/atl1e.h | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/vmalloc.h> | 46 | #include <linux/vmalloc.h> |
47 | #include <linux/pagemap.h> | 47 | #include <linux/pagemap.h> |
48 | #include <linux/tcp.h> | 48 | #include <linux/tcp.h> |
49 | #include <linux/mii.h> | ||
50 | #include <linux/ethtool.h> | 49 | #include <linux/ethtool.h> |
51 | #include <linux/if_vlan.h> | 50 | #include <linux/if_vlan.h> |
52 | #include <linux/workqueue.h> | 51 | #include <linux/workqueue.h> |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 3cf59a7f5a1c..246d92b42636 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -2310,7 +2310,8 @@ static void atl1_tx_queue(struct atl1_adapter *adapter, u16 count, | |||
2310 | if (tpd != ptpd) | 2310 | if (tpd != ptpd) |
2311 | memcpy(tpd, ptpd, sizeof(struct tx_packet_desc)); | 2311 | memcpy(tpd, ptpd, sizeof(struct tx_packet_desc)); |
2312 | tpd->buffer_addr = cpu_to_le64(buffer_info->dma); | 2312 | tpd->buffer_addr = cpu_to_le64(buffer_info->dma); |
2313 | tpd->word2 = (cpu_to_le16(buffer_info->length) & | 2313 | tpd->word2 &= ~(TPD_BUFLEN_MASK << TPD_BUFLEN_SHIFT); |
2314 | tpd->word2 |= (cpu_to_le16(buffer_info->length) & | ||
2314 | TPD_BUFLEN_MASK) << TPD_BUFLEN_SHIFT; | 2315 | TPD_BUFLEN_MASK) << TPD_BUFLEN_SHIFT; |
2315 | 2316 | ||
2316 | /* | 2317 | /* |
@@ -2409,8 +2410,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2409 | vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) | | 2410 | vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) | |
2410 | ((vlan_tag >> 9) & 0x8); | 2411 | ((vlan_tag >> 9) & 0x8); |
2411 | ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; | 2412 | ptpd->word3 |= 1 << TPD_INS_VL_TAG_SHIFT; |
2412 | ptpd->word3 |= (vlan_tag & TPD_VL_TAGGED_MASK) << | 2413 | ptpd->word2 |= (vlan_tag & TPD_VLANTAG_MASK) << |
2413 | TPD_VL_TAGGED_SHIFT; | 2414 | TPD_VLANTAG_SHIFT; |
2414 | } | 2415 | } |
2415 | 2416 | ||
2416 | tso = atl1_tso(adapter, skb, ptpd); | 2417 | tso = atl1_tso(adapter, skb, ptpd); |
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h index a5015b14a429..ffa73fc8d95e 100644 --- a/drivers/net/atlx/atl1.h +++ b/drivers/net/atlx/atl1.h | |||
@@ -504,7 +504,7 @@ struct rx_free_desc { | |||
504 | #define TPD_PKTNT_MASK 0x0001 | 504 | #define TPD_PKTNT_MASK 0x0001 |
505 | #define TPD_PKTINT_SHIFT 15 | 505 | #define TPD_PKTINT_SHIFT 15 |
506 | #define TPD_VLANTAG_MASK 0xFFFF | 506 | #define TPD_VLANTAG_MASK 0xFFFF |
507 | #define TPD_VLAN_SHIFT 16 | 507 | #define TPD_VLANTAG_SHIFT 16 |
508 | 508 | ||
509 | /* tpd word 3 bits 0:13 */ | 509 | /* tpd word 3 bits 0:13 */ |
510 | #define TPD_EOP_MASK 0x0001 | 510 | #define TPD_EOP_MASK 0x0001 |
diff --git a/drivers/net/bnx2x_init.h b/drivers/net/bnx2x_init.h index 130927cfc75b..a6c0b3abba29 100644 --- a/drivers/net/bnx2x_init.h +++ b/drivers/net/bnx2x_init.h | |||
@@ -564,14 +564,15 @@ static const struct arb_line write_arb_addr[NUM_WR_Q-1] = { | |||
564 | 564 | ||
565 | static void bnx2x_init_pxp(struct bnx2x *bp) | 565 | static void bnx2x_init_pxp(struct bnx2x *bp) |
566 | { | 566 | { |
567 | u16 devctl; | ||
567 | int r_order, w_order; | 568 | int r_order, w_order; |
568 | u32 val, i; | 569 | u32 val, i; |
569 | 570 | ||
570 | pci_read_config_word(bp->pdev, | 571 | pci_read_config_word(bp->pdev, |
571 | bp->pcie_cap + PCI_EXP_DEVCTL, (u16 *)&val); | 572 | bp->pcie_cap + PCI_EXP_DEVCTL, &devctl); |
572 | DP(NETIF_MSG_HW, "read 0x%x from devctl\n", (u16)val); | 573 | DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl); |
573 | w_order = ((val & PCI_EXP_DEVCTL_PAYLOAD) >> 5); | 574 | w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5); |
574 | r_order = ((val & PCI_EXP_DEVCTL_READRQ) >> 12); | 575 | r_order = ((devctl & PCI_EXP_DEVCTL_READRQ) >> 12); |
575 | 576 | ||
576 | if (r_order > MAX_RD_ORD) { | 577 | if (r_order > MAX_RD_ORD) { |
577 | DP(NETIF_MSG_HW, "read order of %d order adjusted to %d\n", | 578 | DP(NETIF_MSG_HW, "read order of %d order adjusted to %d\n", |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index fce745148ff9..600210d7eff9 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -59,8 +59,8 @@ | |||
59 | #include "bnx2x.h" | 59 | #include "bnx2x.h" |
60 | #include "bnx2x_init.h" | 60 | #include "bnx2x_init.h" |
61 | 61 | ||
62 | #define DRV_MODULE_VERSION "1.45.22" | 62 | #define DRV_MODULE_VERSION "1.45.23" |
63 | #define DRV_MODULE_RELDATE "2008/09/09" | 63 | #define DRV_MODULE_RELDATE "2008/11/03" |
64 | #define BNX2X_BC_VER 0x040200 | 64 | #define BNX2X_BC_VER 0x040200 |
65 | 65 | ||
66 | /* Time in jiffies before concluding the transmitter is hung */ | 66 | /* Time in jiffies before concluding the transmitter is hung */ |
@@ -6481,6 +6481,7 @@ load_int_disable: | |||
6481 | bnx2x_free_irq(bp); | 6481 | bnx2x_free_irq(bp); |
6482 | load_error: | 6482 | load_error: |
6483 | bnx2x_free_mem(bp); | 6483 | bnx2x_free_mem(bp); |
6484 | bp->port.pmf = 0; | ||
6484 | 6485 | ||
6485 | /* TBD we really need to reset the chip | 6486 | /* TBD we really need to reset the chip |
6486 | if we want to recover from this */ | 6487 | if we want to recover from this */ |
@@ -6791,6 +6792,7 @@ unload_error: | |||
6791 | /* Report UNLOAD_DONE to MCP */ | 6792 | /* Report UNLOAD_DONE to MCP */ |
6792 | if (!BP_NOMCP(bp)) | 6793 | if (!BP_NOMCP(bp)) |
6793 | bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE); | 6794 | bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE); |
6795 | bp->port.pmf = 0; | ||
6794 | 6796 | ||
6795 | /* Free SKBs, SGEs, TPA pool and driver internals */ | 6797 | /* Free SKBs, SGEs, TPA pool and driver internals */ |
6796 | bnx2x_free_skbs(bp); | 6798 | bnx2x_free_skbs(bp); |
@@ -10204,8 +10206,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
10204 | return -ENOMEM; | 10206 | return -ENOMEM; |
10205 | } | 10207 | } |
10206 | 10208 | ||
10207 | netif_carrier_off(dev); | ||
10208 | |||
10209 | bp = netdev_priv(dev); | 10209 | bp = netdev_priv(dev); |
10210 | bp->msglevel = debug; | 10210 | bp->msglevel = debug; |
10211 | 10211 | ||
@@ -10229,6 +10229,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
10229 | goto init_one_exit; | 10229 | goto init_one_exit; |
10230 | } | 10230 | } |
10231 | 10231 | ||
10232 | netif_carrier_off(dev); | ||
10233 | |||
10232 | bp->common.name = board_info[ent->driver_data].name; | 10234 | bp->common.name = board_info[ent->driver_data].name; |
10233 | printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," | 10235 | printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," |
10234 | " IRQ %d, ", dev->name, bp->common.name, | 10236 | " IRQ %d, ", dev->name, bp->common.name, |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index ade5f3f6693b..87437c788476 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -169,11 +169,14 @@ static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_ | |||
169 | /* clear slave from tx_hashtbl */ | 169 | /* clear slave from tx_hashtbl */ |
170 | tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl; | 170 | tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl; |
171 | 171 | ||
172 | index = SLAVE_TLB_INFO(slave).head; | 172 | /* skip this if we've already freed the tx hash table */ |
173 | while (index != TLB_NULL_INDEX) { | 173 | if (tx_hash_table) { |
174 | u32 next_index = tx_hash_table[index].next; | 174 | index = SLAVE_TLB_INFO(slave).head; |
175 | tlb_init_table_entry(&tx_hash_table[index], save_load); | 175 | while (index != TLB_NULL_INDEX) { |
176 | index = next_index; | 176 | u32 next_index = tx_hash_table[index].next; |
177 | tlb_init_table_entry(&tx_hash_table[index], save_load); | ||
178 | index = next_index; | ||
179 | } | ||
177 | } | 180 | } |
178 | 181 | ||
179 | tlb_init_slave(slave); | 182 | tlb_init_slave(slave); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 832739f38db4..a3efba59eee9 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1979,6 +1979,20 @@ void bond_destroy(struct bonding *bond) | |||
1979 | unregister_netdevice(bond->dev); | 1979 | unregister_netdevice(bond->dev); |
1980 | } | 1980 | } |
1981 | 1981 | ||
1982 | static void bond_destructor(struct net_device *bond_dev) | ||
1983 | { | ||
1984 | struct bonding *bond = bond_dev->priv; | ||
1985 | |||
1986 | if (bond->wq) | ||
1987 | destroy_workqueue(bond->wq); | ||
1988 | |||
1989 | netif_addr_lock_bh(bond_dev); | ||
1990 | bond_mc_list_destroy(bond); | ||
1991 | netif_addr_unlock_bh(bond_dev); | ||
1992 | |||
1993 | free_netdev(bond_dev); | ||
1994 | } | ||
1995 | |||
1982 | /* | 1996 | /* |
1983 | * First release a slave and than destroy the bond if no more slaves iare left. | 1997 | * First release a slave and than destroy the bond if no more slaves iare left. |
1984 | * Must be under rtnl_lock when this function is called. | 1998 | * Must be under rtnl_lock when this function is called. |
@@ -2376,6 +2390,9 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2376 | continue; | 2390 | continue; |
2377 | 2391 | ||
2378 | case BOND_LINK_DOWN: | 2392 | case BOND_LINK_DOWN: |
2393 | if (slave->link_failure_count < UINT_MAX) | ||
2394 | slave->link_failure_count++; | ||
2395 | |||
2379 | slave->link = BOND_LINK_DOWN; | 2396 | slave->link = BOND_LINK_DOWN; |
2380 | 2397 | ||
2381 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || | 2398 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || |
@@ -4550,7 +4567,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) | |||
4550 | 4567 | ||
4551 | bond_set_mode_ops(bond, bond->params.mode); | 4568 | bond_set_mode_ops(bond, bond->params.mode); |
4552 | 4569 | ||
4553 | bond_dev->destructor = free_netdev; | 4570 | bond_dev->destructor = bond_destructor; |
4554 | 4571 | ||
4555 | /* Initialize the device options */ | 4572 | /* Initialize the device options */ |
4556 | bond_dev->tx_queue_len = 0; | 4573 | bond_dev->tx_queue_len = 0; |
@@ -4589,20 +4606,6 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) | |||
4589 | return 0; | 4606 | return 0; |
4590 | } | 4607 | } |
4591 | 4608 | ||
4592 | /* De-initialize device specific data. | ||
4593 | * Caller must hold rtnl_lock. | ||
4594 | */ | ||
4595 | static void bond_deinit(struct net_device *bond_dev) | ||
4596 | { | ||
4597 | struct bonding *bond = bond_dev->priv; | ||
4598 | |||
4599 | list_del(&bond->bond_list); | ||
4600 | |||
4601 | #ifdef CONFIG_PROC_FS | ||
4602 | bond_remove_proc_entry(bond); | ||
4603 | #endif | ||
4604 | } | ||
4605 | |||
4606 | static void bond_work_cancel_all(struct bonding *bond) | 4609 | static void bond_work_cancel_all(struct bonding *bond) |
4607 | { | 4610 | { |
4608 | write_lock_bh(&bond->lock); | 4611 | write_lock_bh(&bond->lock); |
@@ -4624,6 +4627,22 @@ static void bond_work_cancel_all(struct bonding *bond) | |||
4624 | cancel_delayed_work(&bond->ad_work); | 4627 | cancel_delayed_work(&bond->ad_work); |
4625 | } | 4628 | } |
4626 | 4629 | ||
4630 | /* De-initialize device specific data. | ||
4631 | * Caller must hold rtnl_lock. | ||
4632 | */ | ||
4633 | static void bond_deinit(struct net_device *bond_dev) | ||
4634 | { | ||
4635 | struct bonding *bond = bond_dev->priv; | ||
4636 | |||
4637 | list_del(&bond->bond_list); | ||
4638 | |||
4639 | bond_work_cancel_all(bond); | ||
4640 | |||
4641 | #ifdef CONFIG_PROC_FS | ||
4642 | bond_remove_proc_entry(bond); | ||
4643 | #endif | ||
4644 | } | ||
4645 | |||
4627 | /* Unregister and free all bond devices. | 4646 | /* Unregister and free all bond devices. |
4628 | * Caller must hold rtnl_lock. | 4647 | * Caller must hold rtnl_lock. |
4629 | */ | 4648 | */ |
@@ -4635,9 +4654,6 @@ static void bond_free_all(void) | |||
4635 | struct net_device *bond_dev = bond->dev; | 4654 | struct net_device *bond_dev = bond->dev; |
4636 | 4655 | ||
4637 | bond_work_cancel_all(bond); | 4656 | bond_work_cancel_all(bond); |
4638 | netif_addr_lock_bh(bond_dev); | ||
4639 | bond_mc_list_destroy(bond); | ||
4640 | netif_addr_unlock_bh(bond_dev); | ||
4641 | /* Release the bonded slaves */ | 4657 | /* Release the bonded slaves */ |
4642 | bond_release_all(bond_dev); | 4658 | bond_release_all(bond_dev); |
4643 | bond_destroy(bond); | 4659 | bond_destroy(bond); |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 65d0a9103297..7e8a63106bdf 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -32,14 +32,14 @@ | |||
32 | #include <linux/skbuff.h> | 32 | #include <linux/skbuff.h> |
33 | #include <linux/ethtool.h> | 33 | #include <linux/ethtool.h> |
34 | 34 | ||
35 | #include <asm/arch/svinto.h>/* DMA and register descriptions */ | 35 | #include <arch/svinto.h>/* DMA and register descriptions */ |
36 | #include <asm/io.h> /* CRIS_LED_* I/O functions */ | 36 | #include <asm/io.h> /* CRIS_LED_* I/O functions */ |
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/dma.h> | 38 | #include <asm/dma.h> |
39 | #include <asm/system.h> | 39 | #include <asm/system.h> |
40 | #include <asm/ethernet.h> | 40 | #include <asm/ethernet.h> |
41 | #include <asm/cache.h> | 41 | #include <asm/cache.h> |
42 | #include <asm/arch/io_interface_mux.h> | 42 | #include <arch/io_interface_mux.h> |
43 | 43 | ||
44 | //#define ETHDEBUG | 44 | //#define ETHDEBUG |
45 | #define D(x) | 45 | #define D(x) |
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 | ||
635 | static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add) | 635 | static 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 | ||
695 | static int ehea_create_busmap_callback(unsigned long pfn, | 698 | static 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 | |||
712 | static 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 | ||
701 | int ehea_create_busmap(void) | 748 | int 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/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index cb51c1fb0338..a6f49d025787 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -1099,7 +1099,9 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, | |||
1099 | ndev->stop = fs_enet_close; | 1099 | ndev->stop = fs_enet_close; |
1100 | ndev->get_stats = fs_enet_get_stats; | 1100 | ndev->get_stats = fs_enet_get_stats; |
1101 | ndev->set_multicast_list = fs_set_multicast_list; | 1101 | ndev->set_multicast_list = fs_set_multicast_list; |
1102 | 1102 | #ifdef CONFIG_NET_POLL_CONTROLLER | |
1103 | ndev->poll_controller = fs_enet_netpoll; | ||
1104 | #endif | ||
1103 | if (fpi->use_napi) | 1105 | if (fpi->use_napi) |
1104 | netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi, | 1106 | netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi, |
1105 | fpi->napi_weight); | 1107 | fpi->napi_weight); |
@@ -1209,7 +1211,7 @@ static void __exit fs_cleanup(void) | |||
1209 | static void fs_enet_netpoll(struct net_device *dev) | 1211 | static void fs_enet_netpoll(struct net_device *dev) |
1210 | { | 1212 | { |
1211 | disable_irq(dev->irq); | 1213 | disable_irq(dev->irq); |
1212 | fs_enet_interrupt(dev->irq, dev, NULL); | 1214 | fs_enet_interrupt(dev->irq, dev); |
1213 | enable_irq(dev->irq); | 1215 | enable_irq(dev->irq); |
1214 | } | 1216 | } |
1215 | #endif | 1217 | #endif |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 64b201134fdb..83a5cb6aa23b 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -586,6 +586,18 @@ static void gfar_configure_serdes(struct net_device *dev) | |||
586 | struct gfar_mii __iomem *regs = | 586 | struct gfar_mii __iomem *regs = |
587 | (void __iomem *)&priv->regs->gfar_mii_regs; | 587 | (void __iomem *)&priv->regs->gfar_mii_regs; |
588 | int tbipa = gfar_read(&priv->regs->tbipa); | 588 | int tbipa = gfar_read(&priv->regs->tbipa); |
589 | struct mii_bus *bus = gfar_get_miibus(priv); | ||
590 | |||
591 | if (bus) | ||
592 | mutex_lock(&bus->mdio_lock); | ||
593 | |||
594 | /* If the link is already up, we must already be ok, and don't need to | ||
595 | * configure and reset the TBI<->SerDes link. Maybe U-Boot configured | ||
596 | * everything for us? Resetting it takes the link down and requires | ||
597 | * several seconds for it to come back. | ||
598 | */ | ||
599 | if (gfar_local_mdio_read(regs, tbipa, MII_BMSR) & BMSR_LSTATUS) | ||
600 | goto done; | ||
589 | 601 | ||
590 | /* Single clk mode, mii mode off(for serdes communication) */ | 602 | /* Single clk mode, mii mode off(for serdes communication) */ |
591 | gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); | 603 | gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); |
@@ -596,6 +608,10 @@ static void gfar_configure_serdes(struct net_device *dev) | |||
596 | 608 | ||
597 | gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | | 609 | gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | |
598 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); | 610 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); |
611 | |||
612 | done: | ||
613 | if (bus) | ||
614 | mutex_unlock(&bus->mdio_lock); | ||
599 | } | 615 | } |
600 | 616 | ||
601 | static void init_registers(struct net_device *dev) | 617 | static void init_registers(struct net_device *dev) |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index bf73eea98010..0e2595d24933 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
@@ -269,6 +269,27 @@ static struct device_driver gianfar_mdio_driver = { | |||
269 | .remove = gfar_mdio_remove, | 269 | .remove = gfar_mdio_remove, |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static int match_mdio_bus(struct device *dev, void *data) | ||
273 | { | ||
274 | const struct gfar_private *priv = data; | ||
275 | const struct platform_device *pdev = to_platform_device(dev); | ||
276 | |||
277 | return !strcmp(pdev->name, gianfar_mdio_driver.name) && | ||
278 | pdev->id == priv->einfo->mdio_bus; | ||
279 | } | ||
280 | |||
281 | /* Given a gfar_priv structure, find the mii_bus controlled by this device (not | ||
282 | * necessarily the same as the bus the gfar's PHY is on), if one exists. | ||
283 | * Normally only the first gianfar controls a mii_bus. */ | ||
284 | struct mii_bus *gfar_get_miibus(const struct gfar_private *priv) | ||
285 | { | ||
286 | /*const*/ struct device *d; | ||
287 | |||
288 | d = bus_find_device(gianfar_mdio_driver.bus, NULL, (void *)priv, | ||
289 | match_mdio_bus); | ||
290 | return d ? dev_get_drvdata(d) : NULL; | ||
291 | } | ||
292 | |||
272 | int __init gfar_mdio_init(void) | 293 | int __init gfar_mdio_init(void) |
273 | { | 294 | { |
274 | return driver_register(&gianfar_mdio_driver); | 295 | return driver_register(&gianfar_mdio_driver); |
diff --git a/drivers/net/gianfar_mii.h b/drivers/net/gianfar_mii.h index 2af28b16a0e2..02dc970ca1ff 100644 --- a/drivers/net/gianfar_mii.h +++ b/drivers/net/gianfar_mii.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #ifndef __GIANFAR_MII_H | 18 | #ifndef __GIANFAR_MII_H |
19 | #define __GIANFAR_MII_H | 19 | #define __GIANFAR_MII_H |
20 | 20 | ||
21 | struct gfar_private; /* forward ref */ | ||
22 | |||
21 | #define MIIMIND_BUSY 0x00000001 | 23 | #define MIIMIND_BUSY 0x00000001 |
22 | #define MIIMIND_NOTVALID 0x00000004 | 24 | #define MIIMIND_NOTVALID 0x00000004 |
23 | 25 | ||
@@ -44,6 +46,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); | |||
44 | int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, | 46 | int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, |
45 | int regnum, u16 value); | 47 | int regnum, u16 value); |
46 | int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum); | 48 | int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum); |
49 | struct mii_bus *gfar_get_miibus(const struct gfar_private *priv); | ||
47 | int __init gfar_mdio_init(void); | 50 | int __init gfar_mdio_init(void); |
48 | void gfar_mdio_exit(void); | 51 | void gfar_mdio_exit(void); |
49 | #endif /* GIANFAR_PHY_H */ | 52 | #endif /* GIANFAR_PHY_H */ |
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/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c index 2482d61662a2..2e67ae015d91 100644 --- a/drivers/net/irda/ks959-sir.c +++ b/drivers/net/irda/ks959-sir.c | |||
@@ -118,7 +118,6 @@ | |||
118 | #include <linux/errno.h> | 118 | #include <linux/errno.h> |
119 | #include <linux/init.h> | 119 | #include <linux/init.h> |
120 | #include <linux/slab.h> | 120 | #include <linux/slab.h> |
121 | #include <linux/module.h> | ||
122 | #include <linux/kref.h> | 121 | #include <linux/kref.h> |
123 | #include <linux/usb.h> | 122 | #include <linux/usb.h> |
124 | #include <linux/device.h> | 123 | #include <linux/device.h> |
diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c index 1e0de93fd618..3843b5faba8b 100644 --- a/drivers/net/irda/ksdazzle-sir.c +++ b/drivers/net/irda/ksdazzle-sir.c | |||
@@ -82,7 +82,6 @@ | |||
82 | #include <linux/errno.h> | 82 | #include <linux/errno.h> |
83 | #include <linux/init.h> | 83 | #include <linux/init.h> |
84 | #include <linux/slab.h> | 84 | #include <linux/slab.h> |
85 | #include <linux/module.h> | ||
86 | #include <linux/kref.h> | 85 | #include <linux/kref.h> |
87 | #include <linux/usb.h> | 86 | #include <linux/usb.h> |
88 | #include <linux/device.h> | 87 | #include <linux/device.h> |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 3b43bfd85a0f..b1ac63ab8c16 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -76,15 +76,6 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
76 | 76 | ||
77 | skb->protocol = eth_type_trans(skb,dev); | 77 | skb->protocol = eth_type_trans(skb,dev); |
78 | 78 | ||
79 | #ifdef LOOPBACK_TSO | ||
80 | if (skb_is_gso(skb)) { | ||
81 | BUG_ON(skb->protocol != htons(ETH_P_IP)); | ||
82 | BUG_ON(ip_hdr(skb)->protocol != IPPROTO_TCP); | ||
83 | |||
84 | emulate_large_send_offload(skb); | ||
85 | return 0; | ||
86 | } | ||
87 | #endif | ||
88 | dev->last_rx = jiffies; | 79 | dev->last_rx = jiffies; |
89 | 80 | ||
90 | /* it's OK to use per_cpu_ptr() because BHs are off */ | 81 | /* it's OK to use per_cpu_ptr() because BHs are off */ |
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/en_netdev.c b/drivers/net/mlx4/en_netdev.c index a339afbeed38..a3f732418c49 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -706,7 +706,7 @@ tx_err: | |||
706 | mlx4_en_release_rss_steer(priv); | 706 | mlx4_en_release_rss_steer(priv); |
707 | rx_err: | 707 | rx_err: |
708 | for (i = 0; i < priv->rx_ring_num; i++) | 708 | for (i = 0; i < priv->rx_ring_num; i++) |
709 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[rx_index]); | 709 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); |
710 | cq_err: | 710 | cq_err: |
711 | while (rx_index--) | 711 | while (rx_index--) |
712 | mlx4_en_deactivate_cq(priv, &priv->rx_cq[rx_index]); | 712 | mlx4_en_deactivate_cq(priv, &priv->rx_cq[rx_index]); |
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/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index a9c8c08044b1..b9dcdbd369f8 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1066,9 +1066,12 @@ static int smi_wait_ready(struct mv643xx_eth_shared_private *msp) | |||
1066 | return 0; | 1066 | return 0; |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | if (!wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp), | 1069 | if (!smi_is_done(msp)) { |
1070 | msecs_to_jiffies(100))) | 1070 | wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp), |
1071 | return -ETIMEDOUT; | 1071 | msecs_to_jiffies(100)); |
1072 | if (!smi_is_done(msp)) | ||
1073 | return -ETIMEDOUT; | ||
1074 | } | ||
1072 | 1075 | ||
1073 | return 0; | 1076 | return 0; |
1074 | } | 1077 | } |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index b1556b2e404c..a5f428bcc0eb 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -75,7 +75,7 @@ | |||
75 | #include "myri10ge_mcp.h" | 75 | #include "myri10ge_mcp.h" |
76 | #include "myri10ge_mcp_gen_header.h" | 76 | #include "myri10ge_mcp_gen_header.h" |
77 | 77 | ||
78 | #define MYRI10GE_VERSION_STR "1.4.3-1.371" | 78 | #define MYRI10GE_VERSION_STR "1.4.3-1.375" |
79 | 79 | ||
80 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 80 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
81 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 81 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
@@ -1393,6 +1393,7 @@ myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index) | |||
1393 | if (tx->req == tx->done) { | 1393 | if (tx->req == tx->done) { |
1394 | tx->queue_active = 0; | 1394 | tx->queue_active = 0; |
1395 | put_be32(htonl(1), tx->send_stop); | 1395 | put_be32(htonl(1), tx->send_stop); |
1396 | mmiowb(); | ||
1396 | } | 1397 | } |
1397 | __netif_tx_unlock(dev_queue); | 1398 | __netif_tx_unlock(dev_queue); |
1398 | } | 1399 | } |
@@ -2864,6 +2865,7 @@ again: | |||
2864 | if ((mgp->dev->real_num_tx_queues > 1) && tx->queue_active == 0) { | 2865 | if ((mgp->dev->real_num_tx_queues > 1) && tx->queue_active == 0) { |
2865 | tx->queue_active = 1; | 2866 | tx->queue_active = 1; |
2866 | put_be32(htonl(1), tx->send_go); | 2867 | put_be32(htonl(1), tx->send_go); |
2868 | mmiowb(); | ||
2867 | } | 2869 | } |
2868 | tx->pkt_start++; | 2870 | tx->pkt_start++; |
2869 | if ((avail - count) < MXGEFW_MAX_SEND_DESC) { | 2871 | if ((avail - count) < MXGEFW_MAX_SEND_DESC) { |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index ebc812702903..9acb5d70a3ae 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -8667,7 +8667,6 @@ static void __devinit niu_device_announce(struct niu *np) | |||
8667 | static int __devinit niu_pci_init_one(struct pci_dev *pdev, | 8667 | static int __devinit niu_pci_init_one(struct pci_dev *pdev, |
8668 | const struct pci_device_id *ent) | 8668 | const struct pci_device_id *ent) |
8669 | { | 8669 | { |
8670 | unsigned long niureg_base, niureg_len; | ||
8671 | union niu_parent_id parent_id; | 8670 | union niu_parent_id parent_id; |
8672 | struct net_device *dev; | 8671 | struct net_device *dev; |
8673 | struct niu *np; | 8672 | struct niu *np; |
@@ -8758,10 +8757,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
8758 | 8757 | ||
8759 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); | 8758 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); |
8760 | 8759 | ||
8761 | niureg_base = pci_resource_start(pdev, 0); | 8760 | np->regs = pci_ioremap_bar(pdev, 0); |
8762 | niureg_len = pci_resource_len(pdev, 0); | ||
8763 | |||
8764 | np->regs = ioremap_nocache(niureg_base, niureg_len); | ||
8765 | if (!np->regs) { | 8761 | if (!np->regs) { |
8766 | dev_err(&pdev->dev, PFX "Cannot map device registers, " | 8762 | dev_err(&pdev->dev, PFX "Cannot map device registers, " |
8767 | "aborting.\n"); | 8763 | "aborting.\n"); |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index fc6f4b8c64b3..b646e92134dc 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -399,11 +399,11 @@ static int pppoe_rcv(struct sk_buff *skb, | |||
399 | if (skb->len < len) | 399 | if (skb->len < len) |
400 | goto drop; | 400 | goto drop; |
401 | 401 | ||
402 | po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex); | 402 | if (pskb_trim_rcsum(skb, len)) |
403 | if (!po) | ||
404 | goto drop; | 403 | goto drop; |
405 | 404 | ||
406 | if (pskb_trim_rcsum(skb, len)) | 405 | po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex); |
406 | if (!po) | ||
407 | goto drop; | 407 | goto drop; |
408 | 408 | ||
409 | return sk_receive_skb(sk_pppox(po), skb, 0); | 409 | return sk_receive_skb(sk_pppox(po), skb, 0); |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index fa98af58223e..cd0d0873d978 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -174,8 +174,8 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = { | |||
174 | 174 | ||
175 | /* EEPROM range with gPXE configuration */ | 175 | /* EEPROM range with gPXE configuration */ |
176 | #define EFX_ETHTOOL_EEPROM_MAGIC 0xEFAB | 176 | #define EFX_ETHTOOL_EEPROM_MAGIC 0xEFAB |
177 | #define EFX_ETHTOOL_EEPROM_MIN 0x100U | 177 | #define EFX_ETHTOOL_EEPROM_MIN 0x800U |
178 | #define EFX_ETHTOOL_EEPROM_MAX 0x400U | 178 | #define EFX_ETHTOOL_EEPROM_MAX 0x1800U |
179 | 179 | ||
180 | /************************************************************************** | 180 | /************************************************************************** |
181 | * | 181 | * |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index f59c7772f344..5051554ff05b 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -499,7 +499,7 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) | |||
499 | #else | 499 | #else |
500 | SMC_PUSH_DATA(lp, buf, len); | 500 | SMC_PUSH_DATA(lp, buf, len); |
501 | dev->trans_start = jiffies; | 501 | dev->trans_start = jiffies; |
502 | dev_kfree_skb(skb); | 502 | dev_kfree_skb_irq(skb); |
503 | #endif | 503 | #endif |
504 | if (!lp->tx_throttle) { | 504 | if (!lp->tx_throttle) { |
505 | netif_wake_queue(dev); | 505 | netif_wake_queue(dev); |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index c70870e0fd61..fc80f250da31 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -2060,7 +2060,7 @@ static int smc_request_attrib(struct platform_device *pdev, | |||
2060 | struct net_device *ndev) | 2060 | struct net_device *ndev) |
2061 | { | 2061 | { |
2062 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); | 2062 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); |
2063 | struct smc_local *lp = netdev_priv(ndev); | 2063 | struct smc_local *lp __maybe_unused = netdev_priv(ndev); |
2064 | 2064 | ||
2065 | if (!res) | 2065 | if (!res) |
2066 | return 0; | 2066 | return 0; |
@@ -2075,7 +2075,7 @@ static void smc_release_attrib(struct platform_device *pdev, | |||
2075 | struct net_device *ndev) | 2075 | struct net_device *ndev) |
2076 | { | 2076 | { |
2077 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); | 2077 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); |
2078 | struct smc_local *lp = netdev_priv(ndev); | 2078 | struct smc_local *lp __maybe_unused = netdev_priv(ndev); |
2079 | 2079 | ||
2080 | if (res) | 2080 | if (res) |
2081 | release_mem_region(res->start, ATTRIB_SIZE); | 2081 | release_mem_region(res->start, ATTRIB_SIZE); |
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 | ||
490 | err_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); | ||
493 | err_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); | ||
486 | err_out_res: | 496 | err_out_res: |
487 | pci_release_regions(pdev); | 497 | pci_release_regions(pdev); |
488 | err_out_disable: | 498 | err_out_disable: |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 6daea0c91862..33b6d1b122fb 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1070,8 +1070,6 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
1070 | 1070 | ||
1071 | DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); | 1071 | DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); |
1072 | 1072 | ||
1073 | tun_chr_fasync(-1, file, 0); | ||
1074 | |||
1075 | rtnl_lock(); | 1073 | rtnl_lock(); |
1076 | 1074 | ||
1077 | /* Detach from net device */ | 1075 | /* Detach from net device */ |
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c index cfbbfee55836..85f38a6b6a49 100644 --- a/drivers/net/ucc_geth_ethtool.c +++ b/drivers/net/ucc_geth_ethtool.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
39 | #include <asm/types.h> | 39 | #include <asm/types.h> |
40 | #include <asm/uaccess.h> | ||
41 | 40 | ||
42 | #include "ucc_geth.h" | 41 | #include "ucc_geth.h" |
43 | #include "ucc_geth_mii.h" | 42 | #include "ucc_geth_mii.h" |
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 | ||
399 | static 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 | |||
399 | static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) | 413 | static 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/usb/hso.c b/drivers/net/usb/hso.c index 1164c52e2c0a..8e90891f0e42 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -2184,19 +2184,20 @@ static void hso_create_rfkill(struct hso_device *hso_dev, | |||
2184 | struct usb_interface *interface) | 2184 | struct usb_interface *interface) |
2185 | { | 2185 | { |
2186 | struct hso_net *hso_net = dev2net(hso_dev); | 2186 | struct hso_net *hso_net = dev2net(hso_dev); |
2187 | struct device *dev = hso_dev->dev; | 2187 | struct device *dev = &hso_net->net->dev; |
2188 | char *rfkn; | 2188 | char *rfkn; |
2189 | 2189 | ||
2190 | hso_net->rfkill = rfkill_allocate(&interface_to_usbdev(interface)->dev, | 2190 | hso_net->rfkill = rfkill_allocate(&interface_to_usbdev(interface)->dev, |
2191 | RFKILL_TYPE_WLAN); | 2191 | RFKILL_TYPE_WWAN); |
2192 | if (!hso_net->rfkill) { | 2192 | if (!hso_net->rfkill) { |
2193 | dev_err(dev, "%s - Out of memory", __func__); | 2193 | dev_err(dev, "%s - Out of memory\n", __func__); |
2194 | return; | 2194 | return; |
2195 | } | 2195 | } |
2196 | rfkn = kzalloc(20, GFP_KERNEL); | 2196 | rfkn = kzalloc(20, GFP_KERNEL); |
2197 | if (!rfkn) { | 2197 | if (!rfkn) { |
2198 | rfkill_free(hso_net->rfkill); | 2198 | rfkill_free(hso_net->rfkill); |
2199 | dev_err(dev, "%s - Out of memory", __func__); | 2199 | hso_net->rfkill = NULL; |
2200 | dev_err(dev, "%s - Out of memory\n", __func__); | ||
2200 | return; | 2201 | return; |
2201 | } | 2202 | } |
2202 | snprintf(rfkn, 20, "hso-%d", | 2203 | snprintf(rfkn, 20, "hso-%d", |
@@ -2209,7 +2210,8 @@ static void hso_create_rfkill(struct hso_device *hso_dev, | |||
2209 | kfree(rfkn); | 2210 | kfree(rfkn); |
2210 | hso_net->rfkill->name = NULL; | 2211 | hso_net->rfkill->name = NULL; |
2211 | rfkill_free(hso_net->rfkill); | 2212 | rfkill_free(hso_net->rfkill); |
2212 | dev_err(dev, "%s - Failed to register rfkill", __func__); | 2213 | hso_net->rfkill = NULL; |
2214 | dev_err(dev, "%s - Failed to register rfkill\n", __func__); | ||
2213 | return; | 2215 | return; |
2214 | } | 2216 | } |
2215 | } | 2217 | } |
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 | ||
524 | static void __devinit velocity_set_int_opt(int *opt, int val, int min, int max, int def, char *name, char *devname) | 524 | static 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 | ||
553 | static void __devinit velocity_set_bool_opt(u32 * opt, int val, int def, u32 flag, char *name, char *devname) | 553 | static 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 | ||
579 | static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname) | 579 | static 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(®s->PAR[i]); | 936 | dev->dev_addr[i] = readb(®s->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/wan/z85230.c b/drivers/net/wan/z85230.c index ccd9cd35ecbe..5bf7e01ef0e9 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -695,7 +695,6 @@ EXPORT_SYMBOL(z8530_nop); | |||
695 | * z8530_interrupt - Handle an interrupt from a Z8530 | 695 | * z8530_interrupt - Handle an interrupt from a Z8530 |
696 | * @irq: Interrupt number | 696 | * @irq: Interrupt number |
697 | * @dev_id: The Z8530 device that is interrupting. | 697 | * @dev_id: The Z8530 device that is interrupting. |
698 | * @regs: unused | ||
699 | * | 698 | * |
700 | * A Z85[2]30 device has stuck its hand in the air for attention. | 699 | * A Z85[2]30 device has stuck its hand in the air for attention. |
701 | * We scan both the channels on the chip for events and then call | 700 | * We scan both the channels on the chip for events and then call |
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; |
702 | err_irq: | 691 | err_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) | |||
2202 | static int | 2183 | static int |
2203 | ath5k_init(struct ath5k_softc *sc, bool is_resume) | 2184 | ath5k_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/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c index 8f92d670f614..19980cbd5d5f 100644 --- a/drivers/net/wireless/ath5k/debug.c +++ b/drivers/net/wireless/ath5k/debug.c | |||
@@ -339,7 +339,7 @@ static struct { | |||
339 | { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" }, | 339 | { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" }, |
340 | { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" }, | 340 | { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" }, |
341 | { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" }, | 341 | { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" }, |
342 | { ATH5K_DEBUG_LED, "led", "LED mamagement" }, | 342 | { ATH5K_DEBUG_LED, "led", "LED management" }, |
343 | { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, | 343 | { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, |
344 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, | 344 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, |
345 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, | 345 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, |
diff --git a/drivers/net/wireless/ath5k/desc.c b/drivers/net/wireless/ath5k/desc.c index dd1374052ba9..5e362a7a3620 100644 --- a/drivers/net/wireless/ath5k/desc.c +++ b/drivers/net/wireless/ath5k/desc.c | |||
@@ -531,10 +531,10 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah, | |||
531 | AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL); | 531 | AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL); |
532 | rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, | 532 | rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, |
533 | AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE); | 533 | AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE); |
534 | rs->rs_antenna = rx_status->rx_status_0 & | 534 | rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0, |
535 | AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA; | 535 | AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANTENNA); |
536 | rs->rs_more = rx_status->rx_status_0 & | 536 | rs->rs_more = !!(rx_status->rx_status_0 & |
537 | AR5K_5210_RX_DESC_STATUS0_MORE; | 537 | AR5K_5210_RX_DESC_STATUS0_MORE); |
538 | /* TODO: this timestamp is 13 bit, later on we assume 15 bit */ | 538 | /* TODO: this timestamp is 13 bit, later on we assume 15 bit */ |
539 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, | 539 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, |
540 | AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); | 540 | AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); |
@@ -607,10 +607,10 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah, | |||
607 | AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL); | 607 | AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL); |
608 | rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, | 608 | rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, |
609 | AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE); | 609 | AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE); |
610 | rs->rs_antenna = rx_status->rx_status_0 & | 610 | rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0, |
611 | AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA; | 611 | AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA); |
612 | rs->rs_more = rx_status->rx_status_0 & | 612 | rs->rs_more = !!(rx_status->rx_status_0 & |
613 | AR5K_5212_RX_DESC_STATUS0_MORE; | 613 | AR5K_5212_RX_DESC_STATUS0_MORE); |
614 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, | 614 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, |
615 | AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); | 615 | AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); |
616 | rs->rs_status = 0; | 616 | rs->rs_status = 0; |
diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c index ea2e1a20b499..ceaa6c475c06 100644 --- a/drivers/net/wireless/ath5k/initvals.c +++ b/drivers/net/wireless/ath5k/initvals.c | |||
@@ -806,6 +806,8 @@ static const struct ath5k_ini_mode ar5212_rf5111_ini_mode_end[] = { | |||
806 | { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, | 806 | { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, |
807 | { AR5K_PHY(642), | 807 | { AR5K_PHY(642), |
808 | { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, | 808 | { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, |
809 | { 0xa228, | ||
810 | { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } }, | ||
809 | { 0xa23c, | 811 | { 0xa23c, |
810 | { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } }, | 812 | { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } }, |
811 | }; | 813 | }; |
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c index 8f1886834e61..1b6d45b6772d 100644 --- a/drivers/net/wireless/ath5k/reset.c +++ b/drivers/net/wireless/ath5k/reset.c | |||
@@ -537,9 +537,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
537 | mdelay(1); | 537 | mdelay(1); |
538 | 538 | ||
539 | /* | 539 | /* |
540 | * Write some more initial register settings | 540 | * Write some more initial register settings for revised chips |
541 | */ | 541 | */ |
542 | if (ah->ah_version == AR5K_AR5212) { | 542 | if (ah->ah_version == AR5K_AR5212 && |
543 | ah->ah_phy_revision > 0x41) { | ||
543 | ath5k_hw_reg_write(ah, 0x0002a002, 0x982c); | 544 | ath5k_hw_reg_write(ah, 0x0002a002, 0x982c); |
544 | 545 | ||
545 | if (channel->hw_value == CHANNEL_G) | 546 | if (channel->hw_value == CHANNEL_G) |
@@ -558,19 +559,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
558 | else | 559 | else |
559 | ath5k_hw_reg_write(ah, 0x00000000, 0x994c); | 560 | ath5k_hw_reg_write(ah, 0x00000000, 0x994c); |
560 | 561 | ||
561 | /* Some bits are disabled here, we know nothing about | 562 | /* Got this from legacy-hal */ |
562 | * register 0xa228 yet, most of the times this ends up | 563 | AR5K_REG_DISABLE_BITS(ah, 0xa228, 0x200); |
563 | * with a value 0x9b5 -haven't seen any dump with | 564 | |
564 | * a different value- */ | 565 | AR5K_REG_MASKED_BITS(ah, 0xa228, 0x800, 0xfffe03ff); |
565 | /* Got this from decompiling binary HAL */ | ||
566 | data = ath5k_hw_reg_read(ah, 0xa228); | ||
567 | data &= 0xfffffdff; | ||
568 | ath5k_hw_reg_write(ah, data, 0xa228); | ||
569 | |||
570 | data = ath5k_hw_reg_read(ah, 0xa228); | ||
571 | data &= 0xfffe03ff; | ||
572 | ath5k_hw_reg_write(ah, data, 0xa228); | ||
573 | data = 0; | ||
574 | 566 | ||
575 | /* Just write 0x9b5 ? */ | 567 | /* Just write 0x9b5 ? */ |
576 | /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */ | 568 | /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 24a1aeb6448f..8d690a0eb1a9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2090,7 +2090,6 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2090 | iwl4965_error_recovery(priv); | 2090 | iwl4965_error_recovery(priv); |
2091 | 2091 | ||
2092 | iwl_power_update_mode(priv, 1); | 2092 | iwl_power_update_mode(priv, 1); |
2093 | ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); | ||
2094 | 2093 | ||
2095 | if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) | 2094 | if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) |
2096 | iwl4965_set_mode(priv, priv->iw_mode); | 2095 | iwl4965_set_mode(priv, priv->iw_mode); |
@@ -2342,6 +2341,7 @@ static void iwl_bg_alive_start(struct work_struct *data) | |||
2342 | mutex_lock(&priv->mutex); | 2341 | mutex_lock(&priv->mutex); |
2343 | iwl_alive_start(priv); | 2342 | iwl_alive_start(priv); |
2344 | mutex_unlock(&priv->mutex); | 2343 | mutex_unlock(&priv->mutex); |
2344 | ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); | ||
2345 | } | 2345 | } |
2346 | 2346 | ||
2347 | static void iwl4965_bg_rf_kill(struct work_struct *work) | 2347 | static void iwl4965_bg_rf_kill(struct work_struct *work) |
@@ -3252,7 +3252,11 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
3252 | return; | 3252 | return; |
3253 | } | 3253 | } |
3254 | 3254 | ||
3255 | iwl_scan_cancel_timeout(priv, 100); | 3255 | if (iwl_scan_cancel(priv)) { |
3256 | /* cancel scan failed, just live w/ bad key and rely | ||
3257 | briefly on SW decryption */ | ||
3258 | return; | ||
3259 | } | ||
3256 | 3260 | ||
3257 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | 3261 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); |
3258 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 3262 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 3b0bee331a33..c89365e2ca58 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -896,6 +896,13 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
896 | return; | 896 | return; |
897 | 897 | ||
898 | done: | 898 | done: |
899 | /* Cannot perform scan. Make sure we clear scanning | ||
900 | * bits from status so next scan request can be performed. | ||
901 | * If we don't clear scanning status bit here all next scan | ||
902 | * will fail | ||
903 | */ | ||
904 | clear_bit(STATUS_SCAN_HW, &priv->status); | ||
905 | clear_bit(STATUS_SCANNING, &priv->status); | ||
899 | /* inform mac80211 scan aborted */ | 906 | /* inform mac80211 scan aborted */ |
900 | queue_work(priv->workqueue, &priv->scan_completed); | 907 | queue_work(priv->workqueue, &priv->scan_completed); |
901 | mutex_unlock(&priv->mutex); | 908 | mutex_unlock(&priv->mutex); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index d15a2c997954..285b53e7e261 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -5768,7 +5768,6 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) | |||
5768 | if (priv->error_recovering) | 5768 | if (priv->error_recovering) |
5769 | iwl3945_error_recovery(priv); | 5769 | iwl3945_error_recovery(priv); |
5770 | 5770 | ||
5771 | ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); | ||
5772 | return; | 5771 | return; |
5773 | 5772 | ||
5774 | restart: | 5773 | restart: |
@@ -6013,6 +6012,7 @@ static void iwl3945_bg_alive_start(struct work_struct *data) | |||
6013 | mutex_lock(&priv->mutex); | 6012 | mutex_lock(&priv->mutex); |
6014 | iwl3945_alive_start(priv); | 6013 | iwl3945_alive_start(priv); |
6015 | mutex_unlock(&priv->mutex); | 6014 | mutex_unlock(&priv->mutex); |
6015 | ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); | ||
6016 | } | 6016 | } |
6017 | 6017 | ||
6018 | static void iwl3945_bg_rf_kill(struct work_struct *work) | 6018 | static void iwl3945_bg_rf_kill(struct work_struct *work) |
@@ -6256,6 +6256,11 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6256 | n_probes, | 6256 | n_probes, |
6257 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 6257 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
6258 | 6258 | ||
6259 | if (scan->channel_count == 0) { | ||
6260 | IWL_DEBUG_SCAN("channel count %d\n", scan->channel_count); | ||
6261 | goto done; | ||
6262 | } | ||
6263 | |||
6259 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + | 6264 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + |
6260 | scan->channel_count * sizeof(struct iwl3945_scan_channel); | 6265 | scan->channel_count * sizeof(struct iwl3945_scan_channel); |
6261 | cmd.data = scan; | 6266 | cmd.data = scan; |
@@ -6273,6 +6278,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6273 | return; | 6278 | return; |
6274 | 6279 | ||
6275 | done: | 6280 | done: |
6281 | /* can not perform scan make sure we clear scanning | ||
6282 | * bits from status so next scan request can be performed. | ||
6283 | * if we dont clear scanning status bit here all next scan | ||
6284 | * will fail | ||
6285 | */ | ||
6286 | clear_bit(STATUS_SCAN_HW, &priv->status); | ||
6287 | clear_bit(STATUS_SCANNING, &priv->status); | ||
6288 | |||
6276 | /* inform mac80211 scan aborted */ | 6289 | /* inform mac80211 scan aborted */ |
6277 | queue_work(priv->workqueue, &priv->scan_completed); | 6290 | queue_work(priv->workqueue, &priv->scan_completed); |
6278 | mutex_unlock(&priv->mutex); | 6291 | mutex_unlock(&priv->mutex); |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 297696de2da0..8265c7d25edc 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -605,9 +605,9 @@ int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, | |||
605 | if (ret == 0) { | 605 | if (ret == 0) { |
606 | *curlevel = le16_to_cpu(cmd.curlevel); | 606 | *curlevel = le16_to_cpu(cmd.curlevel); |
607 | if (minlevel) | 607 | if (minlevel) |
608 | *minlevel = le16_to_cpu(cmd.minlevel); | 608 | *minlevel = cmd.minlevel; |
609 | if (maxlevel) | 609 | if (maxlevel) |
610 | *maxlevel = le16_to_cpu(cmd.maxlevel); | 610 | *maxlevel = cmd.maxlevel; |
611 | } | 611 | } |
612 | 612 | ||
613 | lbs_deb_leave(LBS_DEB_CMD); | 613 | lbs_deb_leave(LBS_DEB_CMD); |
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 5749f22b296f..079e6aa874dc 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c | |||
@@ -328,7 +328,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv, | |||
328 | lbs_deb_rx("rx err: frame received with bad length\n"); | 328 | lbs_deb_rx("rx err: frame received with bad length\n"); |
329 | priv->stats.rx_length_errors++; | 329 | priv->stats.rx_length_errors++; |
330 | ret = -EINVAL; | 330 | ret = -EINVAL; |
331 | kfree(skb); | 331 | kfree_skb(skb); |
332 | goto done; | 332 | goto done; |
333 | } | 333 | } |
334 | 334 | ||
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 8f66903641b9..22c4c6110521 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -598,8 +598,8 @@ static int lbs_process_bss(struct bss_descriptor *bss, | |||
598 | 598 | ||
599 | switch (elem->id) { | 599 | switch (elem->id) { |
600 | case MFIE_TYPE_SSID: | 600 | case MFIE_TYPE_SSID: |
601 | bss->ssid_len = elem->len; | 601 | bss->ssid_len = min_t(int, 32, elem->len); |
602 | memcpy(bss->ssid, elem->data, elem->len); | 602 | memcpy(bss->ssid, elem->data, bss->ssid_len); |
603 | lbs_deb_scan("got SSID IE: '%s', len %u\n", | 603 | lbs_deb_scan("got SSID IE: '%s', len %u\n", |
604 | escape_essid(bss->ssid, bss->ssid_len), | 604 | escape_essid(bss->ssid, bss->ssid_len), |
605 | bss->ssid_len); | 605 | bss->ssid_len); |
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 | ||
349 | static 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 | |||
411 | static void p54p_stop(struct ieee80211_hw *dev) | 349 | static 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 | ||
415 | static 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 | |||
477 | static int __devinit p54p_probe(struct pci_dev *pdev, | 477 | static 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/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index f839ce044afd..95511ac22470 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | menuconfig RT2X00 | 1 | menuconfig RT2X00 |
2 | bool "Ralink driver support" | 2 | tristate "Ralink driver support" |
3 | depends on MAC80211 && WLAN_80211 && EXPERIMENTAL | 3 | depends on MAC80211 && WLAN_80211 && EXPERIMENTAL |
4 | ---help--- | 4 | ---help--- |
5 | This will enable the experimental support for the Ralink drivers, | 5 | This will enable the experimental support for the Ralink drivers, |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index a60ae86bd5c9..a3ccd8c1c716 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -61,6 +61,7 @@ static struct usb_device_id usb_ids[] = { | |||
61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, | 61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, |
62 | /* ZD1211B */ | 62 | /* ZD1211B */ |
63 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 63 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
64 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, | ||
64 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 65 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B }, | 66 | { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B }, |
66 | { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B }, | 67 | { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B }, |
@@ -82,6 +83,7 @@ static struct usb_device_id usb_ids[] = { | |||
82 | { USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B }, | 83 | { USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B }, |
83 | { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B }, | 84 | { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B }, |
84 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, | 85 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, |
86 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, | ||
85 | /* "Driverless" devices that need ejecting */ | 87 | /* "Driverless" devices that need ejecting */ |
86 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 88 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
87 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, | 89 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, |
diff --git a/drivers/of/device.c b/drivers/of/device.c index 51e5214071da..224ae6bc67b6 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -105,7 +105,16 @@ EXPORT_SYMBOL(of_release_dev); | |||
105 | int of_device_register(struct of_device *ofdev) | 105 | int of_device_register(struct of_device *ofdev) |
106 | { | 106 | { |
107 | BUG_ON(ofdev->node == NULL); | 107 | BUG_ON(ofdev->node == NULL); |
108 | return device_register(&ofdev->dev); | 108 | |
109 | device_initialize(&ofdev->dev); | ||
110 | |||
111 | /* device_add will assume that this device is on the same node as | ||
112 | * the parent. If there is no parent defined, set the node | ||
113 | * explicitly */ | ||
114 | if (!ofdev->dev.parent) | ||
115 | set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->node)); | ||
116 | |||
117 | return device_add(&ofdev->dev); | ||
109 | } | 118 | } |
110 | EXPORT_SYMBOL(of_device_register); | 119 | EXPORT_SYMBOL(of_device_register); |
111 | 120 | ||
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index d962ba0dd87a..191a3202cecc 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) | |||
105 | if (!capable(CAP_SYS_ADMIN)) | 105 | if (!capable(CAP_SYS_ADMIN)) |
106 | return -EPERM; | 106 | return -EPERM; |
107 | 107 | ||
108 | if (test_and_set_bit(0, &buffer_opened)) | 108 | if (test_and_set_bit_lock(0, &buffer_opened)) |
109 | return -EBUSY; | 109 | return -EBUSY; |
110 | 110 | ||
111 | /* Register as a user of dcookies | 111 | /* Register as a user of dcookies |
@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) | |||
129 | fail: | 129 | fail: |
130 | dcookie_unregister(file->private_data); | 130 | dcookie_unregister(file->private_data); |
131 | out: | 131 | out: |
132 | clear_bit(0, &buffer_opened); | 132 | __clear_bit_unlock(0, &buffer_opened); |
133 | return err; | 133 | return err; |
134 | } | 134 | } |
135 | 135 | ||
@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file) | |||
141 | dcookie_unregister(file->private_data); | 141 | dcookie_unregister(file->private_data); |
142 | buffer_pos = 0; | 142 | buffer_pos = 0; |
143 | atomic_set(&buffer_ready, 0); | 143 | atomic_set(&buffer_ready, 0); |
144 | clear_bit(0, &buffer_opened); | 144 | __clear_bit_unlock(0, &buffer_opened); |
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
147 | 147 | ||
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/pci-acpi.c b/drivers/pci/pci-acpi.c index dfe7c8e1b185..b3a63edb6901 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -83,6 +83,9 @@ static acpi_status acpi_run_osc(acpi_handle handle, | |||
83 | if (ACPI_FAILURE(status)) | 83 | if (ACPI_FAILURE(status)) |
84 | return status; | 84 | return status; |
85 | 85 | ||
86 | if (!output.length) | ||
87 | return AE_NULL_OBJECT; | ||
88 | |||
86 | out_obj = output.pointer; | 89 | out_obj = output.pointer; |
87 | if (out_obj->type != ACPI_TYPE_BUFFER) { | 90 | if (out_obj->type != ACPI_TYPE_BUFFER) { |
88 | printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n"); | 91 | printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n"); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 110022d78689..5d72866897a8 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -575,7 +575,7 @@ static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct | |||
575 | 575 | ||
576 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 576 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
577 | start = vma->vm_pgoff; | 577 | start = vma->vm_pgoff; |
578 | size = pci_resource_len(pdev, resno) >> PAGE_SHIFT; | 578 | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; |
579 | if (start < size && size - start >= nr) | 579 | if (start < size && size - start >= nr) |
580 | return 1; | 580 | return 1; |
581 | WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", | 581 | WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 96cf8ecd04ce..5049a47030ac 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) | |||
43 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor); | 43 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR,quirk_mellanox_tavor); |
44 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE,quirk_mellanox_tavor); | 44 | DECLARE_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 */ | ||
47 | int forbid_dac __read_mostly; | ||
48 | EXPORT_SYMBOL(forbid_dac); | ||
49 | |||
50 | static __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 | } | ||
58 | DECLARE_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 */ |
62 | static void quirk_passive_release(struct pci_dev *dev) | 48 | static void quirk_passive_release(struct pci_dev *dev) |
@@ -1706,24 +1692,24 @@ static void __devinit quirk_brcm_570x_limit_vpd(struct pci_dev *dev) | |||
1706 | } | 1692 | } |
1707 | } | 1693 | } |
1708 | 1694 | ||
1709 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | 1695 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, |
1710 | PCI_DEVICE_ID_NX2_5706, | 1696 | PCI_DEVICE_ID_NX2_5706, |
1711 | quirk_brcm_570x_limit_vpd); | 1697 | quirk_brcm_570x_limit_vpd); |
1712 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | 1698 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, |
1713 | PCI_DEVICE_ID_NX2_5706S, | 1699 | PCI_DEVICE_ID_NX2_5706S, |
1714 | quirk_brcm_570x_limit_vpd); | 1700 | quirk_brcm_570x_limit_vpd); |
1715 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | 1701 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, |
1716 | PCI_DEVICE_ID_NX2_5708, | 1702 | PCI_DEVICE_ID_NX2_5708, |
1717 | quirk_brcm_570x_limit_vpd); | 1703 | quirk_brcm_570x_limit_vpd); |
1718 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | 1704 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, |
1719 | PCI_DEVICE_ID_NX2_5708S, | 1705 | PCI_DEVICE_ID_NX2_5708S, |
1720 | quirk_brcm_570x_limit_vpd); | 1706 | quirk_brcm_570x_limit_vpd); |
1721 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | 1707 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, |
1722 | PCI_DEVICE_ID_NX2_5709, | 1708 | PCI_DEVICE_ID_NX2_5709, |
1723 | quirk_brcm_570x_limit_vpd); | 1709 | quirk_brcm_570x_limit_vpd); |
1724 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, | 1710 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, |
1725 | PCI_DEVICE_ID_NX2_5709S, | 1711 | PCI_DEVICE_ID_NX2_5709S, |
1726 | quirk_brcm_570x_limit_vpd); | 1712 | quirk_brcm_570x_limit_vpd); |
1727 | 1713 | ||
1728 | #ifdef CONFIG_PCI_MSI | 1714 | #ifdef CONFIG_PCI_MSI |
1729 | /* Some chipsets do not support MSI. We cannot easily rely on setting | 1715 | /* Some chipsets do not support MSI. We cannot easily rely on setting |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 1f5f6143f35c..132a78159b60 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -100,7 +100,8 @@ size_t pci_get_rom_size(void __iomem *rom, size_t size) | |||
100 | * pci_map_rom - map a PCI ROM to kernel space | 100 | * pci_map_rom - map a PCI ROM to kernel space |
101 | * @pdev: pointer to pci device struct | 101 | * @pdev: pointer to pci device struct |
102 | * @size: pointer to receive size of pci window over ROM | 102 | * @size: pointer to receive size of pci window over ROM |
103 | * @return: kernel virtual pointer to image of ROM | 103 | * |
104 | * Return: kernel virtual pointer to image of ROM | ||
104 | * | 105 | * |
105 | * Map a PCI ROM into kernel space. If ROM is boot video ROM, | 106 | * Map a PCI ROM into kernel space. If ROM is boot video ROM, |
106 | * the shadow BIOS copy will be returned instead of the | 107 | * the shadow BIOS copy will be returned instead of the |
@@ -167,7 +168,8 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
167 | * pci_map_rom_copy - map a PCI ROM to kernel space, create a copy | 168 | * pci_map_rom_copy - map a PCI ROM to kernel space, create a copy |
168 | * @pdev: pointer to pci device struct | 169 | * @pdev: pointer to pci device struct |
169 | * @size: pointer to receive size of pci window over ROM | 170 | * @size: pointer to receive size of pci window over ROM |
170 | * @return: kernel virtual pointer to image of ROM | 171 | * |
172 | * Return: kernel virtual pointer to image of ROM | ||
171 | * | 173 | * |
172 | * Map a PCI ROM into kernel space. If ROM is boot video ROM, | 174 | * Map a PCI ROM into kernel space. If ROM is boot video ROM, |
173 | * the shadow BIOS copy will be returned instead of the | 175 | * the shadow BIOS copy will be returned instead of the |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index f57eeae3830a..222904411a13 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -188,10 +188,6 @@ config PCMCIA_M8XX | |||
188 | 188 | ||
189 | This driver is also available as a module called m8xx_pcmcia. | 189 | This driver is also available as a module called m8xx_pcmcia. |
190 | 190 | ||
191 | config HD64465_PCMCIA | ||
192 | tristate "HD64465 host bridge support" | ||
193 | depends on HD64465 && PCMCIA | ||
194 | |||
195 | config PCMCIA_AU1X00 | 191 | config PCMCIA_AU1X00 |
196 | tristate "Au1x00 pcmcia support" | 192 | tristate "Au1x00 pcmcia support" |
197 | depends on SOC_AU1X00 && PCMCIA | 193 | depends on SOC_AU1X00 && PCMCIA |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 23e492bf75cf..238629ad7f7c 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -22,7 +22,6 @@ obj-$(CONFIG_I82365) += i82365.o | |||
22 | obj-$(CONFIG_I82092) += i82092.o | 22 | obj-$(CONFIG_I82092) += i82092.o |
23 | obj-$(CONFIG_TCIC) += tcic.o | 23 | obj-$(CONFIG_TCIC) += tcic.o |
24 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o | 24 | obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o |
25 | obj-$(CONFIG_HD64465_PCMCIA) += hd64465_ss.o | ||
26 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o | 25 | obj-$(CONFIG_PCMCIA_SA1100) += sa11xx_core.o sa1100_cs.o |
27 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o | 26 | obj-$(CONFIG_PCMCIA_SA1111) += sa11xx_core.o sa1111_cs.o |
28 | obj-$(CONFIG_M32R_PCC) += m32r_pcc.o | 27 | obj-$(CONFIG_M32R_PCC) += m32r_pcc.o |
diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c deleted file mode 100644 index 9ef69cdb3183..000000000000 --- a/drivers/pcmcia/hd64465_ss.c +++ /dev/null | |||
@@ -1,939 +0,0 @@ | |||
1 | /* | ||
2 | * Device driver for the PCMCIA controller module of the | ||
3 | * Hitachi HD64465 handheld companion chip. | ||
4 | * | ||
5 | * Note that the HD64465 provides a very thin PCMCIA host bridge | ||
6 | * layer, requiring a lot of the work of supporting cards to be | ||
7 | * performed by the processor. For example: mapping of card | ||
8 | * interrupts to processor IRQs is done by IRQ demuxing software; | ||
9 | * IO and memory mappings are fixed; setting voltages according | ||
10 | * to card Voltage Select pins etc is done in software. | ||
11 | * | ||
12 | * Note also that this driver uses only the simple, fixed, | ||
13 | * 16MB, 16-bit wide mappings to PCMCIA spaces defined by the | ||
14 | * HD64465. Larger mappings, smaller mappings, or mappings of | ||
15 | * different width to the same socket, are all possible only by | ||
16 | * involving the SH7750's MMU, which is considered unnecessary here. | ||
17 | * The downside is that it may be possible for some drivers to | ||
18 | * break because they need or expect 8-bit mappings. | ||
19 | * | ||
20 | * This driver currently supports only the following configuration: | ||
21 | * SH7750 CPU, HD64465, TPS2206 voltage control chip. | ||
22 | * | ||
23 | * by Greg Banks <gbanks@pocketpenguins.com> | ||
24 | * (c) 2000 PocketPenguins Inc | ||
25 | */ | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/string.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/ioport.h> | ||
33 | #include <linux/mm.h> | ||
34 | #include <linux/vmalloc.h> | ||
35 | #include <asm/errno.h> | ||
36 | #include <linux/irq.h> | ||
37 | #include <linux/interrupt.h> | ||
38 | #include <linux/platform_device.h> | ||
39 | |||
40 | #include <asm/io.h> | ||
41 | #include <asm/hd64465/hd64465.h> | ||
42 | #include <asm/hd64465/io.h> | ||
43 | |||
44 | #include <pcmcia/cs_types.h> | ||
45 | #include <pcmcia/cs.h> | ||
46 | #include <pcmcia/cistpl.h> | ||
47 | #include <pcmcia/ds.h> | ||
48 | #include <pcmcia/ss.h> | ||
49 | |||
50 | #define MODNAME "hd64465_ss" | ||
51 | |||
52 | /* #define HD64465_DEBUG 1 */ | ||
53 | |||
54 | #if HD64465_DEBUG | ||
55 | #define DPRINTK(args...) printk(MODNAME ": " args) | ||
56 | #else | ||
57 | #define DPRINTK(args...) | ||
58 | #endif | ||
59 | |||
60 | extern int hd64465_io_debug; | ||
61 | extern void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags); | ||
62 | extern void p3_iounmap(void *addr); | ||
63 | |||
64 | /*============================================================*/ | ||
65 | |||
66 | #define HS_IO_MAP_SIZE (64*1024) | ||
67 | |||
68 | typedef struct hs_socket_t | ||
69 | { | ||
70 | unsigned int number; | ||
71 | u_int irq; | ||
72 | u_long mem_base; | ||
73 | void *io_base; | ||
74 | u_long mem_length; | ||
75 | u_int ctrl_base; | ||
76 | socket_state_t state; | ||
77 | pccard_io_map io_maps[MAX_IO_WIN]; | ||
78 | pccard_mem_map mem_maps[MAX_WIN]; | ||
79 | struct pcmcia_socket socket; | ||
80 | } hs_socket_t; | ||
81 | |||
82 | |||
83 | |||
84 | #define HS_MAX_SOCKETS 2 | ||
85 | static hs_socket_t hs_sockets[HS_MAX_SOCKETS]; | ||
86 | |||
87 | #define hs_in(sp, r) inb((sp)->ctrl_base + (r)) | ||
88 | #define hs_out(sp, v, r) outb(v, (sp)->ctrl_base + (r)) | ||
89 | |||
90 | |||
91 | /* translate a boolean value to a bit in a register */ | ||
92 | #define bool_to_regbit(sp, r, bi, bo) \ | ||
93 | do { \ | ||
94 | unsigned short v = hs_in(sp, r); \ | ||
95 | if (bo) \ | ||
96 | v |= (bi); \ | ||
97 | else \ | ||
98 | v &= ~(bi); \ | ||
99 | hs_out(sp, v, r); \ | ||
100 | } while(0) | ||
101 | |||
102 | /* register offsets from HD64465_REG_PCC[01]ISR */ | ||
103 | #define ISR 0x0 | ||
104 | #define GCR 0x2 | ||
105 | #define CSCR 0x4 | ||
106 | #define CSCIER 0x6 | ||
107 | #define SCR 0x8 | ||
108 | |||
109 | |||
110 | /* Mask and values for CSCIER register */ | ||
111 | #define IER_MASK 0x80 | ||
112 | #define IER_ON 0x3f /* interrupts on */ | ||
113 | #define IER_OFF 0x00 /* interrupts off */ | ||
114 | |||
115 | /*============================================================*/ | ||
116 | |||
117 | #if HD64465_DEBUG > 10 | ||
118 | |||
119 | static void cis_hex_dump(const unsigned char *x, int len) | ||
120 | { | ||
121 | int i; | ||
122 | |||
123 | for (i=0 ; i<len ; i++) | ||
124 | { | ||
125 | if (!(i & 0xf)) | ||
126 | printk("\n%08x", (unsigned)(x + i)); | ||
127 | printk(" %02x", *(volatile unsigned short*)x); | ||
128 | x += 2; | ||
129 | } | ||
130 | printk("\n"); | ||
131 | } | ||
132 | |||
133 | #endif | ||
134 | /*============================================================*/ | ||
135 | |||
136 | /* | ||
137 | * This code helps create the illusion that the IREQ line from | ||
138 | * the PC card is mapped to one of the CPU's IRQ lines by the | ||
139 | * host bridge hardware (which is how every host bridge *except* | ||
140 | * the HD64465 works). In particular, it supports enabling | ||
141 | * and disabling the IREQ line by code which knows nothing | ||
142 | * about the host bridge (e.g. device drivers, IDE code) using | ||
143 | * the request_irq(), free_irq(), probe_irq_on() and probe_irq_off() | ||
144 | * functions. Also, it supports sharing the mapped IRQ with | ||
145 | * real hardware IRQs from the -IRL0-3 lines. | ||
146 | */ | ||
147 | |||
148 | #define HS_NUM_MAPPED_IRQS 16 /* Limitation of the PCMCIA code */ | ||
149 | static struct | ||
150 | { | ||
151 | /* index is mapped irq number */ | ||
152 | hs_socket_t *sock; | ||
153 | hw_irq_controller *old_handler; | ||
154 | } hs_mapped_irq[HS_NUM_MAPPED_IRQS]; | ||
155 | |||
156 | static void hs_socket_enable_ireq(hs_socket_t *sp) | ||
157 | { | ||
158 | unsigned short cscier; | ||
159 | |||
160 | DPRINTK("hs_socket_enable_ireq(sock=%d)\n", sp->number); | ||
161 | |||
162 | cscier = hs_in(sp, CSCIER); | ||
163 | cscier &= ~HD64465_PCCCSCIER_PIREQE_MASK; | ||
164 | cscier |= HD64465_PCCCSCIER_PIREQE_LEVEL; | ||
165 | hs_out(sp, cscier, CSCIER); | ||
166 | } | ||
167 | |||
168 | static void hs_socket_disable_ireq(hs_socket_t *sp) | ||
169 | { | ||
170 | unsigned short cscier; | ||
171 | |||
172 | DPRINTK("hs_socket_disable_ireq(sock=%d)\n", sp->number); | ||
173 | |||
174 | cscier = hs_in(sp, CSCIER); | ||
175 | cscier &= ~HD64465_PCCCSCIER_PIREQE_MASK; | ||
176 | hs_out(sp, cscier, CSCIER); | ||
177 | } | ||
178 | |||
179 | static unsigned int hs_startup_irq(unsigned int irq) | ||
180 | { | ||
181 | hs_socket_enable_ireq(hs_mapped_irq[irq].sock); | ||
182 | hs_mapped_irq[irq].old_handler->startup(irq); | ||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | static void hs_shutdown_irq(unsigned int irq) | ||
187 | { | ||
188 | hs_socket_disable_ireq(hs_mapped_irq[irq].sock); | ||
189 | hs_mapped_irq[irq].old_handler->shutdown(irq); | ||
190 | } | ||
191 | |||
192 | static void hs_enable_irq(unsigned int irq) | ||
193 | { | ||
194 | hs_socket_enable_ireq(hs_mapped_irq[irq].sock); | ||
195 | hs_mapped_irq[irq].old_handler->enable(irq); | ||
196 | } | ||
197 | |||
198 | static void hs_disable_irq(unsigned int irq) | ||
199 | { | ||
200 | hs_socket_disable_ireq(hs_mapped_irq[irq].sock); | ||
201 | hs_mapped_irq[irq].old_handler->disable(irq); | ||
202 | } | ||
203 | |||
204 | extern struct hw_interrupt_type no_irq_type; | ||
205 | |||
206 | static void hs_mask_and_ack_irq(unsigned int irq) | ||
207 | { | ||
208 | hs_socket_disable_ireq(hs_mapped_irq[irq].sock); | ||
209 | /* ack_none() spuriously complains about an unexpected IRQ */ | ||
210 | if (hs_mapped_irq[irq].old_handler != &no_irq_type) | ||
211 | hs_mapped_irq[irq].old_handler->ack(irq); | ||
212 | } | ||
213 | |||
214 | static void hs_end_irq(unsigned int irq) | ||
215 | { | ||
216 | hs_socket_enable_ireq(hs_mapped_irq[irq].sock); | ||
217 | hs_mapped_irq[irq].old_handler->end(irq); | ||
218 | } | ||
219 | |||
220 | |||
221 | static struct hw_interrupt_type hd64465_ss_irq_type = { | ||
222 | .typename = "PCMCIA-IRQ", | ||
223 | .startup = hs_startup_irq, | ||
224 | .shutdown = hs_shutdown_irq, | ||
225 | .enable = hs_enable_irq, | ||
226 | .disable = hs_disable_irq, | ||
227 | .ack = hs_mask_and_ack_irq, | ||
228 | .end = hs_end_irq | ||
229 | }; | ||
230 | |||
231 | /* | ||
232 | * This function should only ever be called with interrupts disabled. | ||
233 | */ | ||
234 | static void hs_map_irq(hs_socket_t *sp, unsigned int irq) | ||
235 | { | ||
236 | struct irq_desc *desc; | ||
237 | |||
238 | DPRINTK("hs_map_irq(sock=%d irq=%d)\n", sp->number, irq); | ||
239 | |||
240 | if (irq >= HS_NUM_MAPPED_IRQS) | ||
241 | return; | ||
242 | |||
243 | desc = irq_to_desc(irq); | ||
244 | hs_mapped_irq[irq].sock = sp; | ||
245 | /* insert ourselves as the irq controller */ | ||
246 | hs_mapped_irq[irq].old_handler = desc->chip; | ||
247 | desc->chip = &hd64465_ss_irq_type; | ||
248 | } | ||
249 | |||
250 | |||
251 | /* | ||
252 | * This function should only ever be called with interrupts disabled. | ||
253 | */ | ||
254 | static void hs_unmap_irq(hs_socket_t *sp, unsigned int irq) | ||
255 | { | ||
256 | struct irq_desc *desc; | ||
257 | |||
258 | DPRINTK("hs_unmap_irq(sock=%d irq=%d)\n", sp->number, irq); | ||
259 | |||
260 | if (irq >= HS_NUM_MAPPED_IRQS) | ||
261 | return; | ||
262 | |||
263 | desc = irq_to_desc(irq); | ||
264 | /* restore the original irq controller */ | ||
265 | desc->chip = hs_mapped_irq[irq].old_handler; | ||
266 | } | ||
267 | |||
268 | /*============================================================*/ | ||
269 | |||
270 | |||
271 | /* | ||
272 | * Set Vpp and Vcc (in tenths of a Volt). Does not | ||
273 | * support the hi-Z state. | ||
274 | * | ||
275 | * Note, this assumes the board uses a TPS2206 chip to control | ||
276 | * the Vcc and Vpp voltages to the hs_sockets. If your board | ||
277 | * uses the MIC2563 (also supported by the HD64465) then you | ||
278 | * will have to modify this function. | ||
279 | */ | ||
280 | /* 0V 3.3V 5.5V */ | ||
281 | static const u_char hs_tps2206_avcc[3] = { 0x00, 0x04, 0x08 }; | ||
282 | static const u_char hs_tps2206_bvcc[3] = { 0x00, 0x80, 0x40 }; | ||
283 | |||
284 | static int hs_set_voltages(hs_socket_t *sp, int Vcc, int Vpp) | ||
285 | { | ||
286 | u_int psr; | ||
287 | u_int vcci = 0; | ||
288 | u_int sock = sp->number; | ||
289 | |||
290 | DPRINTK("hs_set_voltage(%d, %d, %d)\n", sock, Vcc, Vpp); | ||
291 | |||
292 | switch (Vcc) | ||
293 | { | ||
294 | case 0: vcci = 0; break; | ||
295 | case 33: vcci = 1; break; | ||
296 | case 50: vcci = 2; break; | ||
297 | default: return 0; | ||
298 | } | ||
299 | |||
300 | /* Note: Vpp = 120 not supported -- Greg Banks */ | ||
301 | if (Vpp != 0 && Vpp != Vcc) | ||
302 | return 0; | ||
303 | |||
304 | /* The PSR register holds 8 of the 9 bits which control | ||
305 | * the TPS2206 via its serial interface. | ||
306 | */ | ||
307 | psr = inw(HD64465_REG_PCCPSR); | ||
308 | switch (sock) | ||
309 | { | ||
310 | case 0: | ||
311 | psr &= 0x0f; | ||
312 | psr |= hs_tps2206_avcc[vcci]; | ||
313 | psr |= (Vpp == 0 ? 0x00 : 0x02); | ||
314 | break; | ||
315 | case 1: | ||
316 | psr &= 0xf0; | ||
317 | psr |= hs_tps2206_bvcc[vcci]; | ||
318 | psr |= (Vpp == 0 ? 0x00 : 0x20); | ||
319 | break; | ||
320 | }; | ||
321 | outw(psr, HD64465_REG_PCCPSR); | ||
322 | |||
323 | return 1; | ||
324 | } | ||
325 | |||
326 | |||
327 | /*============================================================*/ | ||
328 | |||
329 | /* | ||
330 | * Drive the RESET line to the card. | ||
331 | */ | ||
332 | static void hs_reset_socket(hs_socket_t *sp, int on) | ||
333 | { | ||
334 | unsigned short v; | ||
335 | |||
336 | v = hs_in(sp, GCR); | ||
337 | if (on) | ||
338 | v |= HD64465_PCCGCR_PCCR; | ||
339 | else | ||
340 | v &= ~HD64465_PCCGCR_PCCR; | ||
341 | hs_out(sp, v, GCR); | ||
342 | } | ||
343 | |||
344 | /*============================================================*/ | ||
345 | |||
346 | static int hs_init(struct pcmcia_socket *s) | ||
347 | { | ||
348 | hs_socket_t *sp = container_of(s, struct hs_socket_t, socket); | ||
349 | |||
350 | DPRINTK("hs_init(%d)\n", sp->number); | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | /*============================================================*/ | ||
356 | |||
357 | |||
358 | static int hs_get_status(struct pcmcia_socket *s, u_int *value) | ||
359 | { | ||
360 | hs_socket_t *sp = container_of(s, struct hs_socket_t, socket); | ||
361 | unsigned int isr; | ||
362 | u_int status = 0; | ||
363 | |||
364 | |||
365 | isr = hs_in(sp, ISR); | ||
366 | |||
367 | /* Card is seated and powered when *both* CD pins are low */ | ||
368 | if ((isr & HD64465_PCCISR_PCD_MASK) == 0) | ||
369 | { | ||
370 | status |= SS_DETECT; /* card present */ | ||
371 | |||
372 | switch (isr & HD64465_PCCISR_PBVD_MASK) | ||
373 | { | ||
374 | case HD64465_PCCISR_PBVD_BATGOOD: | ||
375 | break; | ||
376 | case HD64465_PCCISR_PBVD_BATWARN: | ||
377 | status |= SS_BATWARN; | ||
378 | break; | ||
379 | default: | ||
380 | status |= SS_BATDEAD; | ||
381 | break; | ||
382 | } | ||
383 | |||
384 | if (isr & HD64465_PCCISR_PREADY) | ||
385 | status |= SS_READY; | ||
386 | |||
387 | if (isr & HD64465_PCCISR_PMWP) | ||
388 | status |= SS_WRPROT; | ||
389 | |||
390 | /* Voltage Select pins interpreted as per Table 4-5 of the std. | ||
391 | * Assuming we have the TPS2206, the socket is a "Low Voltage | ||
392 | * key, 3.3V and 5V available, no X.XV available". | ||
393 | */ | ||
394 | switch (isr & (HD64465_PCCISR_PVS2|HD64465_PCCISR_PVS1)) | ||
395 | { | ||
396 | case HD64465_PCCISR_PVS1: | ||
397 | printk(KERN_NOTICE MODNAME ": cannot handle X.XV card, ignored\n"); | ||
398 | status = 0; | ||
399 | break; | ||
400 | case 0: | ||
401 | case HD64465_PCCISR_PVS2: | ||
402 | /* 3.3V */ | ||
403 | status |= SS_3VCARD; | ||
404 | break; | ||
405 | case HD64465_PCCISR_PVS2|HD64465_PCCISR_PVS1: | ||
406 | /* 5V */ | ||
407 | break; | ||
408 | } | ||
409 | |||
410 | /* TODO: SS_POWERON */ | ||
411 | /* TODO: SS_STSCHG */ | ||
412 | } | ||
413 | |||
414 | DPRINTK("hs_get_status(%d) = %x\n", sock, status); | ||
415 | |||
416 | *value = status; | ||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | /*============================================================*/ | ||
421 | |||
422 | static int hs_set_socket(struct pcmcia_socket *s, socket_state_t *state) | ||
423 | { | ||
424 | hs_socket_t *sp = container_of(s, struct hs_socket_t, socket); | ||
425 | u_long flags; | ||
426 | u_int changed; | ||
427 | unsigned short cscier; | ||
428 | |||
429 | DPRINTK("hs_set_socket(sock=%d, flags=%x, csc_mask=%x, Vcc=%d, Vpp=%d, io_irq=%d)\n", | ||
430 | sock, state->flags, state->csc_mask, state->Vcc, state->Vpp, state->io_irq); | ||
431 | |||
432 | local_irq_save(flags); /* Don't want interrupts happening here */ | ||
433 | |||
434 | if (state->Vpp != sp->state.Vpp || | ||
435 | state->Vcc != sp->state.Vcc) { | ||
436 | if (!hs_set_voltages(sp, state->Vcc, state->Vpp)) { | ||
437 | local_irq_restore(flags); | ||
438 | return -EINVAL; | ||
439 | } | ||
440 | } | ||
441 | |||
442 | /* hd64465_io_debug = 1; */ | ||
443 | /* | ||
444 | * Handle changes in the Card Status Change mask, | ||
445 | * by propagating to the CSCR register | ||
446 | */ | ||
447 | changed = sp->state.csc_mask ^ state->csc_mask; | ||
448 | cscier = hs_in(sp, CSCIER); | ||
449 | |||
450 | if (changed & SS_DETECT) { | ||
451 | if (state->csc_mask & SS_DETECT) | ||
452 | cscier |= HD64465_PCCCSCIER_PCDE; | ||
453 | else | ||
454 | cscier &= ~HD64465_PCCCSCIER_PCDE; | ||
455 | } | ||
456 | |||
457 | if (changed & SS_READY) { | ||
458 | if (state->csc_mask & SS_READY) | ||
459 | cscier |= HD64465_PCCCSCIER_PRE; | ||
460 | else | ||
461 | cscier &= ~HD64465_PCCCSCIER_PRE; | ||
462 | } | ||
463 | |||
464 | if (changed & SS_BATDEAD) { | ||
465 | if (state->csc_mask & SS_BATDEAD) | ||
466 | cscier |= HD64465_PCCCSCIER_PBDE; | ||
467 | else | ||
468 | cscier &= ~HD64465_PCCCSCIER_PBDE; | ||
469 | } | ||
470 | |||
471 | if (changed & SS_BATWARN) { | ||
472 | if (state->csc_mask & SS_BATWARN) | ||
473 | cscier |= HD64465_PCCCSCIER_PBWE; | ||
474 | else | ||
475 | cscier &= ~HD64465_PCCCSCIER_PBWE; | ||
476 | } | ||
477 | |||
478 | if (changed & SS_STSCHG) { | ||
479 | if (state->csc_mask & SS_STSCHG) | ||
480 | cscier |= HD64465_PCCCSCIER_PSCE; | ||
481 | else | ||
482 | cscier &= ~HD64465_PCCCSCIER_PSCE; | ||
483 | } | ||
484 | |||
485 | hs_out(sp, cscier, CSCIER); | ||
486 | |||
487 | if (sp->state.io_irq && !state->io_irq) | ||
488 | hs_unmap_irq(sp, sp->state.io_irq); | ||
489 | else if (!sp->state.io_irq && state->io_irq) | ||
490 | hs_map_irq(sp, state->io_irq); | ||
491 | |||
492 | |||
493 | /* | ||
494 | * Handle changes in the flags field, | ||
495 | * by propagating to config registers. | ||
496 | */ | ||
497 | changed = sp->state.flags ^ state->flags; | ||
498 | |||
499 | if (changed & SS_IOCARD) { | ||
500 | DPRINTK("card type: %s\n", | ||
501 | (state->flags & SS_IOCARD ? "i/o" : "memory" )); | ||
502 | bool_to_regbit(sp, GCR, HD64465_PCCGCR_PCCT, | ||
503 | state->flags & SS_IOCARD); | ||
504 | } | ||
505 | |||
506 | if (changed & SS_RESET) { | ||
507 | DPRINTK("%s reset card\n", | ||
508 | (state->flags & SS_RESET ? "start" : "stop")); | ||
509 | bool_to_regbit(sp, GCR, HD64465_PCCGCR_PCCR, | ||
510 | state->flags & SS_RESET); | ||
511 | } | ||
512 | |||
513 | if (changed & SS_OUTPUT_ENA) { | ||
514 | DPRINTK("%sabling card output\n", | ||
515 | (state->flags & SS_OUTPUT_ENA ? "en" : "dis")); | ||
516 | bool_to_regbit(sp, GCR, HD64465_PCCGCR_PDRV, | ||
517 | state->flags & SS_OUTPUT_ENA); | ||
518 | } | ||
519 | |||
520 | /* TODO: SS_SPKR_ENA */ | ||
521 | |||
522 | /* hd64465_io_debug = 0; */ | ||
523 | sp->state = *state; | ||
524 | |||
525 | local_irq_restore(flags); | ||
526 | |||
527 | #if HD64465_DEBUG > 10 | ||
528 | if (state->flags & SS_OUTPUT_ENA) | ||
529 | cis_hex_dump((const unsigned char*)sp->mem_base, 0x100); | ||
530 | #endif | ||
531 | return 0; | ||
532 | } | ||
533 | |||
534 | /*============================================================*/ | ||
535 | |||
536 | static int hs_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | ||
537 | { | ||
538 | hs_socket_t *sp = container_of(s, struct hs_socket_t, socket); | ||
539 | int map = io->map; | ||
540 | int sock = sp->number; | ||
541 | struct pccard_io_map *sio; | ||
542 | pgprot_t prot; | ||
543 | |||
544 | DPRINTK("hs_set_io_map(sock=%d, map=%d, flags=0x%x, speed=%dns, start=%#lx, stop=%#lx)\n", | ||
545 | sock, map, io->flags, io->speed, io->start, io->stop); | ||
546 | if (map >= MAX_IO_WIN) | ||
547 | return -EINVAL; | ||
548 | sio = &sp->io_maps[map]; | ||
549 | |||
550 | /* check for null changes */ | ||
551 | if (io->flags == sio->flags && | ||
552 | io->start == sio->start && | ||
553 | io->stop == sio->stop) | ||
554 | return 0; | ||
555 | |||
556 | if (io->flags & MAP_AUTOSZ) | ||
557 | prot = PAGE_KERNEL_PCC(sock, _PAGE_PCC_IODYN); | ||
558 | else if (io->flags & MAP_16BIT) | ||
559 | prot = PAGE_KERNEL_PCC(sock, _PAGE_PCC_IO16); | ||
560 | else | ||
561 | prot = PAGE_KERNEL_PCC(sock, _PAGE_PCC_IO8); | ||
562 | |||
563 | /* TODO: handle MAP_USE_WAIT */ | ||
564 | if (io->flags & MAP_USE_WAIT) | ||
565 | printk(KERN_INFO MODNAME ": MAP_USE_WAIT unimplemented\n"); | ||
566 | /* TODO: handle MAP_PREFETCH */ | ||
567 | if (io->flags & MAP_PREFETCH) | ||
568 | printk(KERN_INFO MODNAME ": MAP_PREFETCH unimplemented\n"); | ||
569 | /* TODO: handle MAP_WRPROT */ | ||
570 | if (io->flags & MAP_WRPROT) | ||
571 | printk(KERN_INFO MODNAME ": MAP_WRPROT unimplemented\n"); | ||
572 | /* TODO: handle MAP_0WS */ | ||
573 | if (io->flags & MAP_0WS) | ||
574 | printk(KERN_INFO MODNAME ": MAP_0WS unimplemented\n"); | ||
575 | |||
576 | if (io->flags & MAP_ACTIVE) { | ||
577 | unsigned long pstart, psize, paddrbase; | ||
578 | |||
579 | paddrbase = virt_to_phys((void*)(sp->mem_base + 2 * HD64465_PCC_WINDOW)); | ||
580 | pstart = io->start & PAGE_MASK; | ||
581 | psize = ((io->stop + PAGE_SIZE) & PAGE_MASK) - pstart; | ||
582 | |||
583 | /* | ||
584 | * Change PTEs in only that portion of the mapping requested | ||
585 | * by the caller. This means that most of the time, most of | ||
586 | * the PTEs in the io_vma will be unmapped and only the bottom | ||
587 | * page will be mapped. But the code allows for weird cards | ||
588 | * that might want IO ports > 4K. | ||
589 | */ | ||
590 | sp->io_base = p3_ioremap(paddrbase + pstart, psize, pgprot_val(prot)); | ||
591 | |||
592 | /* | ||
593 | * Change the mapping used by inb() outb() etc | ||
594 | */ | ||
595 | hd64465_port_map(io->start, | ||
596 | io->stop - io->start + 1, | ||
597 | (unsigned long)sp->io_base + io->start, 0); | ||
598 | } else { | ||
599 | hd64465_port_unmap(sio->start, sio->stop - sio->start + 1); | ||
600 | p3_iounmap(sp->io_base); | ||
601 | } | ||
602 | |||
603 | *sio = *io; | ||
604 | return 0; | ||
605 | } | ||
606 | |||
607 | /*============================================================*/ | ||
608 | |||
609 | static int hs_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem) | ||
610 | { | ||
611 | hs_socket_t *sp = container_of(s, struct hs_socket_t, socket); | ||
612 | struct pccard_mem_map *smem; | ||
613 | int map = mem->map; | ||
614 | unsigned long paddr; | ||
615 | |||
616 | #if 0 | ||
617 | DPRINTK("hs_set_mem_map(sock=%d, map=%d, flags=0x%x, card_start=0x%08x)\n", | ||
618 | sock, map, mem->flags, mem->card_start); | ||
619 | #endif | ||
620 | |||
621 | if (map >= MAX_WIN) | ||
622 | return -EINVAL; | ||
623 | smem = &sp->mem_maps[map]; | ||
624 | |||
625 | paddr = sp->mem_base; /* base of Attribute mapping */ | ||
626 | if (!(mem->flags & MAP_ATTRIB)) | ||
627 | paddr += HD64465_PCC_WINDOW; /* base of Common mapping */ | ||
628 | paddr += mem->card_start; | ||
629 | |||
630 | /* Because we specified SS_CAP_STATIC_MAP, we are obliged | ||
631 | * at this time to report the system address corresponding | ||
632 | * to the card address requested. This is how Socket Services | ||
633 | * queries our fixed mapping. I wish this fact had been | ||
634 | * documented - Greg Banks. | ||
635 | */ | ||
636 | mem->static_start = paddr; | ||
637 | |||
638 | *smem = *mem; | ||
639 | |||
640 | return 0; | ||
641 | } | ||
642 | |||
643 | /* TODO: do we need to use the MMU to access Common memory ??? */ | ||
644 | |||
645 | /*============================================================*/ | ||
646 | |||
647 | /* | ||
648 | * This function is registered with the HD64465 glue code to do a | ||
649 | * secondary demux step on the PCMCIA interrupts. It handles | ||
650 | * mapping the IREQ request from the card to a standard Linux | ||
651 | * IRQ, as requested by SocketServices. | ||
652 | */ | ||
653 | static int hs_irq_demux(int irq, void *dev) | ||
654 | { | ||
655 | hs_socket_t *sp = dev; | ||
656 | u_int cscr; | ||
657 | |||
658 | DPRINTK("hs_irq_demux(irq=%d)\n", irq); | ||
659 | |||
660 | if (sp->state.io_irq && | ||
661 | (cscr = hs_in(sp, CSCR)) & HD64465_PCCCSCR_PIREQ) { | ||
662 | cscr &= ~HD64465_PCCCSCR_PIREQ; | ||
663 | hs_out(sp, cscr, CSCR); | ||
664 | return sp->state.io_irq; | ||
665 | } | ||
666 | |||
667 | return irq; | ||
668 | } | ||
669 | |||
670 | /*============================================================*/ | ||
671 | |||
672 | /* | ||
673 | * Interrupt handling routine. | ||
674 | */ | ||
675 | |||
676 | static irqreturn_t hs_interrupt(int irq, void *dev) | ||
677 | { | ||
678 | hs_socket_t *sp = dev; | ||
679 | u_int events = 0; | ||
680 | u_int cscr; | ||
681 | |||
682 | cscr = hs_in(sp, CSCR); | ||
683 | |||
684 | DPRINTK("hs_interrupt, cscr=%04x\n", cscr); | ||
685 | |||
686 | /* check for bus-related changes to be reported to Socket Services */ | ||
687 | if (cscr & HD64465_PCCCSCR_PCDC) { | ||
688 | /* double-check for a 16-bit card, as we don't support CardBus */ | ||
689 | if ((hs_in(sp, ISR) & HD64465_PCCISR_PCD_MASK) != 0) { | ||
690 | printk(KERN_NOTICE MODNAME | ||
691 | ": socket %d, card not a supported card type or not inserted correctly\n", | ||
692 | sp->number); | ||
693 | /* Don't do the rest unless a card is present */ | ||
694 | cscr &= ~(HD64465_PCCCSCR_PCDC| | ||
695 | HD64465_PCCCSCR_PRC| | ||
696 | HD64465_PCCCSCR_PBW| | ||
697 | HD64465_PCCCSCR_PBD| | ||
698 | HD64465_PCCCSCR_PSC); | ||
699 | } else { | ||
700 | cscr &= ~HD64465_PCCCSCR_PCDC; | ||
701 | events |= SS_DETECT; /* card insertion or removal */ | ||
702 | } | ||
703 | } | ||
704 | if (cscr & HD64465_PCCCSCR_PRC) { | ||
705 | cscr &= ~HD64465_PCCCSCR_PRC; | ||
706 | events |= SS_READY; /* ready signal changed */ | ||
707 | } | ||
708 | if (cscr & HD64465_PCCCSCR_PBW) { | ||
709 | cscr &= ~HD64465_PCCCSCR_PSC; | ||
710 | events |= SS_BATWARN; /* battery warning */ | ||
711 | } | ||
712 | if (cscr & HD64465_PCCCSCR_PBD) { | ||
713 | cscr &= ~HD64465_PCCCSCR_PSC; | ||
714 | events |= SS_BATDEAD; /* battery dead */ | ||
715 | } | ||
716 | if (cscr & HD64465_PCCCSCR_PSC) { | ||
717 | cscr &= ~HD64465_PCCCSCR_PSC; | ||
718 | events |= SS_STSCHG; /* STSCHG (status changed) signal */ | ||
719 | } | ||
720 | |||
721 | if (cscr & HD64465_PCCCSCR_PIREQ) { | ||
722 | cscr &= ~HD64465_PCCCSCR_PIREQ; | ||
723 | |||
724 | /* This should have been dealt with during irq demux */ | ||
725 | printk(KERN_NOTICE MODNAME ": unexpected IREQ from card\n"); | ||
726 | } | ||
727 | |||
728 | hs_out(sp, cscr, CSCR); | ||
729 | |||
730 | if (events) | ||
731 | pcmcia_parse_events(&sp->socket, events); | ||
732 | |||
733 | return IRQ_HANDLED; | ||
734 | } | ||
735 | |||
736 | /*============================================================*/ | ||
737 | |||
738 | static struct pccard_operations hs_operations = { | ||
739 | .init = hs_init, | ||
740 | .get_status = hs_get_status, | ||
741 | .set_socket = hs_set_socket, | ||
742 | .set_io_map = hs_set_io_map, | ||
743 | .set_mem_map = hs_set_mem_map, | ||
744 | }; | ||
745 | |||
746 | static int hs_init_socket(hs_socket_t *sp, int irq, unsigned long mem_base, | ||
747 | unsigned int ctrl_base) | ||
748 | { | ||
749 | unsigned short v; | ||
750 | int i, err; | ||
751 | |||
752 | memset(sp, 0, sizeof(*sp)); | ||
753 | sp->irq = irq; | ||
754 | sp->mem_base = mem_base; | ||
755 | sp->mem_length = 4*HD64465_PCC_WINDOW; /* 16MB */ | ||
756 | sp->ctrl_base = ctrl_base; | ||
757 | |||
758 | for (i=0 ; i<MAX_IO_WIN ; i++) | ||
759 | sp->io_maps[i].map = i; | ||
760 | for (i=0 ; i<MAX_WIN ; i++) | ||
761 | sp->mem_maps[i].map = i; | ||
762 | |||
763 | hd64465_register_irq_demux(sp->irq, hs_irq_demux, sp); | ||
764 | |||
765 | if ((err = request_irq(sp->irq, hs_interrupt, IRQF_DISABLED, MODNAME, sp)) < 0) | ||
766 | return err; | ||
767 | if (request_mem_region(sp->mem_base, sp->mem_length, MODNAME) == 0) { | ||
768 | sp->mem_base = 0; | ||
769 | return -ENOMEM; | ||
770 | } | ||
771 | |||
772 | |||
773 | /* According to section 3.2 of the PCMCIA standard, low-voltage | ||
774 | * capable cards must implement cold insertion, i.e. Vpp and | ||
775 | * Vcc set to 0 before card is inserted. | ||
776 | */ | ||
777 | /*hs_set_voltages(sp, 0, 0);*/ | ||
778 | |||
779 | /* hi-Z the outputs to the card and set 16MB map mode */ | ||
780 | v = hs_in(sp, GCR); | ||
781 | v &= ~HD64465_PCCGCR_PCCT; /* memory-only card */ | ||
782 | hs_out(sp, v, GCR); | ||
783 | |||
784 | v = hs_in(sp, GCR); | ||
785 | v |= HD64465_PCCGCR_PDRV; /* enable outputs to card */ | ||
786 | hs_out(sp, v, GCR); | ||
787 | |||
788 | v = hs_in(sp, GCR); | ||
789 | v |= HD64465_PCCGCR_PMMOD; /* 16MB mapping mode */ | ||
790 | hs_out(sp, v, GCR); | ||
791 | |||
792 | v = hs_in(sp, GCR); | ||
793 | /* lowest 16MB of Common */ | ||
794 | v &= ~(HD64465_PCCGCR_PPA25|HD64465_PCCGCR_PPA24); | ||
795 | hs_out(sp, v, GCR); | ||
796 | |||
797 | hs_reset_socket(sp, 1); | ||
798 | |||
799 | printk(KERN_INFO "HD64465 PCMCIA bridge socket %d at 0x%08lx irq %d\n", | ||
800 | i, sp->mem_base, sp->irq); | ||
801 | |||
802 | return 0; | ||
803 | } | ||
804 | |||
805 | static void hs_exit_socket(hs_socket_t *sp) | ||
806 | { | ||
807 | unsigned short cscier, gcr; | ||
808 | unsigned long flags; | ||
809 | |||
810 | local_irq_save(flags); | ||
811 | |||
812 | /* turn off interrupts in hardware */ | ||
813 | cscier = hs_in(sp, CSCIER); | ||
814 | cscier = (cscier & IER_MASK) | IER_OFF; | ||
815 | hs_out(sp, cscier, CSCIER); | ||
816 | |||
817 | /* hi-Z the outputs to the card */ | ||
818 | gcr = hs_in(sp, GCR); | ||
819 | gcr &= HD64465_PCCGCR_PDRV; | ||
820 | hs_out(sp, gcr, GCR); | ||
821 | |||
822 | /* power the card down */ | ||
823 | hs_set_voltages(sp, 0, 0); | ||
824 | |||
825 | if (sp->mem_base != 0) | ||
826 | release_mem_region(sp->mem_base, sp->mem_length); | ||
827 | if (sp->irq != 0) { | ||
828 | free_irq(sp->irq, hs_interrupt); | ||
829 | hd64465_unregister_irq_demux(sp->irq); | ||
830 | } | ||
831 | |||
832 | local_irq_restore(flags); | ||
833 | } | ||
834 | |||
835 | static struct device_driver hd64465_driver = { | ||
836 | .name = "hd64465-pcmcia", | ||
837 | .bus = &platform_bus_type, | ||
838 | .suspend = pcmcia_socket_dev_suspend, | ||
839 | .resume = pcmcia_socket_dev_resume, | ||
840 | }; | ||
841 | |||
842 | static struct platform_device hd64465_device = { | ||
843 | .name = "hd64465-pcmcia", | ||
844 | .id = 0, | ||
845 | }; | ||
846 | |||
847 | static int __init init_hs(void) | ||
848 | { | ||
849 | int i; | ||
850 | unsigned short v; | ||
851 | |||
852 | /* hd64465_io_debug = 1; */ | ||
853 | if (driver_register(&hd64465_driver)) | ||
854 | return -EINVAL; | ||
855 | |||
856 | /* Wake both sockets out of STANDBY mode */ | ||
857 | /* TODO: wait 15ms */ | ||
858 | v = inw(HD64465_REG_SMSCR); | ||
859 | v &= ~(HD64465_SMSCR_PC0ST|HD64465_SMSCR_PC1ST); | ||
860 | outw(v, HD64465_REG_SMSCR); | ||
861 | |||
862 | /* keep power controller out of shutdown mode */ | ||
863 | v = inb(HD64465_REG_PCC0SCR); | ||
864 | v |= HD64465_PCCSCR_SHDN; | ||
865 | outb(v, HD64465_REG_PCC0SCR); | ||
866 | |||
867 | /* use serial (TPS2206) power controller */ | ||
868 | v = inb(HD64465_REG_PCC0CSCR); | ||
869 | v |= HD64465_PCCCSCR_PSWSEL; | ||
870 | outb(v, HD64465_REG_PCC0CSCR); | ||
871 | |||
872 | /* | ||
873 | * Setup hs_sockets[] structures and request system resources. | ||
874 | * TODO: on memory allocation failure, power down the socket | ||
875 | * before quitting. | ||
876 | */ | ||
877 | for (i=0; i<HS_MAX_SOCKETS; i++) { | ||
878 | hs_set_voltages(&hs_sockets[i], 0, 0); | ||
879 | |||
880 | hs_sockets[i].socket.features |= SS_CAP_PCCARD | SS_CAP_STATIC_MAP; /* mappings are fixed in host memory */ | ||
881 | hs_sockets[i].socket.resource_ops = &pccard_static_ops; | ||
882 | hs_sockets[i].socket.irq_mask = 0xffde;/*0xffff*/ /* IRQs mapped in s/w so can do any, really */ | ||
883 | hs_sockets[i].socket.map_size = HD64465_PCC_WINDOW; /* 16MB fixed window size */ | ||
884 | |||
885 | hs_sockets[i].socket.owner = THIS_MODULE; | ||
886 | hs_sockets[i].socket.ss_entry = &hs_operations; | ||
887 | } | ||
888 | |||
889 | i = hs_init_socket(&hs_sockets[0], | ||
890 | HD64465_IRQ_PCMCIA0, | ||
891 | HD64465_PCC0_BASE, | ||
892 | HD64465_REG_PCC0ISR); | ||
893 | if (i < 0) { | ||
894 | unregister_driver(&hd64465_driver); | ||
895 | return i; | ||
896 | } | ||
897 | i = hs_init_socket(&hs_sockets[1], | ||
898 | HD64465_IRQ_PCMCIA1, | ||
899 | HD64465_PCC1_BASE, | ||
900 | HD64465_REG_PCC1ISR); | ||
901 | if (i < 0) { | ||
902 | unregister_driver(&hd64465_driver); | ||
903 | return i; | ||
904 | } | ||
905 | |||
906 | /* hd64465_io_debug = 0; */ | ||
907 | |||
908 | platform_device_register(&hd64465_device); | ||
909 | |||
910 | for (i=0; i<HS_MAX_SOCKETS; i++) { | ||
911 | unsigned int ret; | ||
912 | hs_sockets[i].socket.dev.parent = &hd64465_device.dev; | ||
913 | hs_sockets[i].number = i; | ||
914 | ret = pcmcia_register_socket(&hs_sockets[i].socket); | ||
915 | if (ret && i) | ||
916 | pcmcia_unregister_socket(&hs_sockets[0].socket); | ||
917 | } | ||
918 | |||
919 | return 0; | ||
920 | } | ||
921 | |||
922 | static void __exit exit_hs(void) | ||
923 | { | ||
924 | int i; | ||
925 | |||
926 | for (i=0 ; i<HS_MAX_SOCKETS ; i++) { | ||
927 | pcmcia_unregister_socket(&hs_sockets[i].socket); | ||
928 | hs_exit_socket(&hs_sockets[i]); | ||
929 | } | ||
930 | |||
931 | platform_device_unregister(&hd64465_device); | ||
932 | unregister_driver(&hd64465_driver); | ||
933 | } | ||
934 | |||
935 | module_init(init_hs); | ||
936 | module_exit(exit_hs); | ||
937 | |||
938 | /*============================================================*/ | ||
939 | /*END*/ | ||
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/pnp/interface.c b/drivers/pnp/interface.c index 478a4a739c00..c3f1c8e9d254 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/pnp.h> | ||
16 | #include <linux/stat.h> | 15 | #include <linux/stat.h> |
17 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c index 85edf945ab86..204158cf7a55 100644 --- a/drivers/ps3/ps3-lpm.c +++ b/drivers/ps3/ps3-lpm.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
25 | #include <asm/smp.h> | ||
25 | #include <asm/time.h> | 26 | #include <asm/time.h> |
26 | #include <asm/ps3.h> | 27 | #include <asm/ps3.h> |
27 | #include <asm/lv1call.h> | 28 | #include <asm/lv1call.h> |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 4dada6ee1119..39360e2a4540 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -1,6 +1,4 @@ | |||
1 | menu "Voltage and Current regulators" | 1 | menuconfig REGULATOR |
2 | |||
3 | config REGULATOR | ||
4 | bool "Voltage and Current Regulator Support" | 2 | bool "Voltage and Current Regulator Support" |
5 | default n | 3 | default n |
6 | help | 4 | help |
@@ -23,21 +21,20 @@ config REGULATOR | |||
23 | 21 | ||
24 | If unsure, say no. | 22 | If unsure, say no. |
25 | 23 | ||
24 | if REGULATOR | ||
25 | |||
26 | config REGULATOR_DEBUG | 26 | config REGULATOR_DEBUG |
27 | bool "Regulator debug support" | 27 | bool "Regulator debug support" |
28 | depends on REGULATOR | ||
29 | help | 28 | help |
30 | Say yes here to enable debugging support. | 29 | Say yes here to enable debugging support. |
31 | 30 | ||
32 | config REGULATOR_FIXED_VOLTAGE | 31 | config REGULATOR_FIXED_VOLTAGE |
33 | tristate | 32 | tristate |
34 | default n | 33 | default n |
35 | select REGULATOR | ||
36 | 34 | ||
37 | config REGULATOR_VIRTUAL_CONSUMER | 35 | config REGULATOR_VIRTUAL_CONSUMER |
38 | tristate "Virtual regulator consumer support" | 36 | tristate "Virtual regulator consumer support" |
39 | default n | 37 | default n |
40 | select REGULATOR | ||
41 | help | 38 | help |
42 | This driver provides a virtual consumer for the voltage and | 39 | This driver provides a virtual consumer for the voltage and |
43 | current regulator API which provides sysfs controls for | 40 | current regulator API which provides sysfs controls for |
@@ -49,7 +46,6 @@ config REGULATOR_VIRTUAL_CONSUMER | |||
49 | config REGULATOR_BQ24022 | 46 | config REGULATOR_BQ24022 |
50 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" | 47 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" |
51 | default n | 48 | default n |
52 | select REGULATOR | ||
53 | help | 49 | help |
54 | This driver controls a TI bq24022 Charger attached via | 50 | This driver controls a TI bq24022 Charger attached via |
55 | GPIOs. The provided current regulator can enable/disable | 51 | GPIOs. The provided current regulator can enable/disable |
@@ -59,7 +55,6 @@ config REGULATOR_BQ24022 | |||
59 | config REGULATOR_WM8350 | 55 | config REGULATOR_WM8350 |
60 | tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" | 56 | tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" |
61 | depends on MFD_WM8350 | 57 | depends on MFD_WM8350 |
62 | select REGULATOR | ||
63 | help | 58 | help |
64 | This driver provides support for the voltage and current regulators | 59 | This driver provides support for the voltage and current regulators |
65 | of the WM8350 AudioPlus PMIC. | 60 | of the WM8350 AudioPlus PMIC. |
@@ -67,7 +62,6 @@ config REGULATOR_WM8350 | |||
67 | config REGULATOR_WM8400 | 62 | config REGULATOR_WM8400 |
68 | tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC" | 63 | tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC" |
69 | depends on MFD_WM8400 | 64 | depends on MFD_WM8400 |
70 | select REGULATOR | ||
71 | help | 65 | help |
72 | This driver provides support for the voltage regulators of the | 66 | This driver provides support for the voltage regulators of the |
73 | WM8400 AudioPlus PMIC. | 67 | WM8400 AudioPlus PMIC. |
@@ -75,9 +69,8 @@ config REGULATOR_WM8400 | |||
75 | config REGULATOR_DA903X | 69 | config REGULATOR_DA903X |
76 | tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC" | 70 | tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC" |
77 | depends on PMIC_DA903X | 71 | depends on PMIC_DA903X |
78 | select REGULATOR | ||
79 | help | 72 | help |
80 | Say y here to support the BUCKs and LDOs regulators found on | 73 | Say y here to support the BUCKs and LDOs regulators found on |
81 | Dialog Semiconductor DA9030/DA9034 PMIC. | 74 | Dialog Semiconductor DA9030/DA9034 PMIC. |
82 | 75 | ||
83 | endmenu | 76 | endif |
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 | ||
82 | static inline struct device *to_da903x_dev(struct regulator_dev *rdev) | ||
83 | { | ||
84 | return rdev_get_dev(rdev)->parent->parent; | ||
85 | } | ||
86 | |||
82 | static inline int check_range(struct da903x_regulator_info *info, | 87 | static 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, | |||
111 | static int da903x_get_voltage(struct regulator_dev *rdev) | 116 | static 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) | |||
128 | static int da903x_enable(struct regulator_dev *rdev) | 133 | static 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) | |||
137 | static int da903x_disable(struct regulator_dev *rdev) | 142 | static 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) | |||
146 | static int da903x_is_enabled(struct regulator_dev *rdev) | 151 | static 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, | |||
215 | static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) | 220 | static 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, | |||
283 | static int da9034_get_ldo12_voltage(struct regulator_dev *rdev) | 288 | static 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/interface.c b/drivers/rtc/interface.c index 7af60b98d8a4..a04c1b6b1575 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -271,7 +271,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
271 | dev_dbg(&rtc->dev, "alarm rollover: %s\n", "year"); | 271 | dev_dbg(&rtc->dev, "alarm rollover: %s\n", "year"); |
272 | do { | 272 | do { |
273 | alarm->time.tm_year++; | 273 | alarm->time.tm_year++; |
274 | } while (!rtc_valid_tm(&alarm->time)); | 274 | } while (rtc_valid_tm(&alarm->time) != 0); |
275 | break; | 275 | break; |
276 | 276 | ||
277 | default: | 277 | default: |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 5549231179a2..6cf8e282338f 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -794,7 +794,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
794 | goto cleanup2; | 794 | goto cleanup2; |
795 | } | 795 | } |
796 | 796 | ||
797 | pr_info("%s: alarms up to one %s%s, %zd bytes nvram, %s irqs\n", | 797 | pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n", |
798 | cmos_rtc.rtc->dev.bus_id, | 798 | cmos_rtc.rtc->dev.bus_id, |
799 | is_valid_irq(rtc_irq) | 799 | is_valid_irq(rtc_irq) |
800 | ? (cmos_rtc.mon_alrm | 800 | ? (cmos_rtc.mon_alrm |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 079e9ed907e0..ecdea44ae4e5 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -446,9 +446,6 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
446 | if (rtc->ops->release) | 446 | if (rtc->ops->release) |
447 | rtc->ops->release(rtc->dev.parent); | 447 | rtc->ops->release(rtc->dev.parent); |
448 | 448 | ||
449 | if (file->f_flags & FASYNC) | ||
450 | rtc_dev_fasync(-1, file, 0); | ||
451 | |||
452 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); | 449 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
453 | return 0; | 450 | return 0; |
454 | } | 451 | } |
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 | ||
192 | static int ds3234_probe(struct spi_device *spi) | 192 | static 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 | ||
252 | static int __exit ds3234_remove(struct spi_device *spi) | 252 | static 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-m48t59.c b/drivers/rtc/rtc-m48t59.c index 04b63dab6932..43afb7ab5289 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -87,6 +87,10 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
87 | dev_dbg(dev, "Century bit is enabled\n"); | 87 | dev_dbg(dev, "Century bit is enabled\n"); |
88 | tm->tm_year += 100; /* one century */ | 88 | tm->tm_year += 100; /* one century */ |
89 | } | 89 | } |
90 | #ifdef CONFIG_SPARC | ||
91 | /* Sun SPARC machines count years since 1968 */ | ||
92 | tm->tm_year += 68; | ||
93 | #endif | ||
90 | 94 | ||
91 | tm->tm_wday = bcd2bin(val & 0x07); | 95 | tm->tm_wday = bcd2bin(val & 0x07); |
92 | tm->tm_hour = bcd2bin(M48T59_READ(M48T59_HOUR) & 0x3F); | 96 | tm->tm_hour = bcd2bin(M48T59_READ(M48T59_HOUR) & 0x3F); |
@@ -110,11 +114,20 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
110 | struct m48t59_private *m48t59 = platform_get_drvdata(pdev); | 114 | struct m48t59_private *m48t59 = platform_get_drvdata(pdev); |
111 | unsigned long flags; | 115 | unsigned long flags; |
112 | u8 val = 0; | 116 | u8 val = 0; |
117 | int year = tm->tm_year; | ||
118 | |||
119 | #ifdef CONFIG_SPARC | ||
120 | /* Sun SPARC machines count years since 1968 */ | ||
121 | year -= 68; | ||
122 | #endif | ||
113 | 123 | ||
114 | dev_dbg(dev, "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n", | 124 | dev_dbg(dev, "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n", |
115 | tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, | 125 | year + 1900, tm->tm_mon, tm->tm_mday, |
116 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 126 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
117 | 127 | ||
128 | if (year < 0) | ||
129 | return -EINVAL; | ||
130 | |||
118 | spin_lock_irqsave(&m48t59->lock, flags); | 131 | spin_lock_irqsave(&m48t59->lock, flags); |
119 | /* Issue the WRITE command */ | 132 | /* Issue the WRITE command */ |
120 | M48T59_SET_BITS(M48T59_CNTL_WRITE, M48T59_CNTL); | 133 | M48T59_SET_BITS(M48T59_CNTL_WRITE, M48T59_CNTL); |
@@ -125,9 +138,9 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
125 | M48T59_WRITE((bin2bcd(tm->tm_mday) & 0x3F), M48T59_MDAY); | 138 | M48T59_WRITE((bin2bcd(tm->tm_mday) & 0x3F), M48T59_MDAY); |
126 | /* tm_mon is 0-11 */ | 139 | /* tm_mon is 0-11 */ |
127 | M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH); | 140 | M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH); |
128 | M48T59_WRITE(bin2bcd(tm->tm_year % 100), M48T59_YEAR); | 141 | M48T59_WRITE(bin2bcd(year % 100), M48T59_YEAR); |
129 | 142 | ||
130 | if (pdata->type == M48T59RTC_TYPE_M48T59 && (tm->tm_year / 100)) | 143 | if (pdata->type == M48T59RTC_TYPE_M48T59 && (year / 100)) |
131 | val = (M48T59_WDAY_CEB | M48T59_WDAY_CB); | 144 | val = (M48T59_WDAY_CEB | M48T59_WDAY_CB); |
132 | val |= (bin2bcd(tm->tm_wday) & 0x07); | 145 | val |= (bin2bcd(tm->tm_wday) & 0x07); |
133 | M48T59_WRITE(val, M48T59_WDAY); | 146 | M48T59_WRITE(val, M48T59_WDAY); |
@@ -159,6 +172,10 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
159 | M48T59_SET_BITS(M48T59_CNTL_READ, M48T59_CNTL); | 172 | M48T59_SET_BITS(M48T59_CNTL_READ, M48T59_CNTL); |
160 | 173 | ||
161 | tm->tm_year = bcd2bin(M48T59_READ(M48T59_YEAR)); | 174 | tm->tm_year = bcd2bin(M48T59_READ(M48T59_YEAR)); |
175 | #ifdef CONFIG_SPARC | ||
176 | /* Sun SPARC machines count years since 1968 */ | ||
177 | tm->tm_year += 68; | ||
178 | #endif | ||
162 | /* tm_mon is 0-11 */ | 179 | /* tm_mon is 0-11 */ |
163 | tm->tm_mon = bcd2bin(M48T59_READ(M48T59_MONTH)) - 1; | 180 | tm->tm_mon = bcd2bin(M48T59_READ(M48T59_MONTH)) - 1; |
164 | 181 | ||
@@ -192,11 +209,20 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
192 | struct rtc_time *tm = &alrm->time; | 209 | struct rtc_time *tm = &alrm->time; |
193 | u8 mday, hour, min, sec; | 210 | u8 mday, hour, min, sec; |
194 | unsigned long flags; | 211 | unsigned long flags; |
212 | int year = tm->tm_year; | ||
213 | |||
214 | #ifdef CONFIG_SPARC | ||
215 | /* Sun SPARC machines count years since 1968 */ | ||
216 | year -= 68; | ||
217 | #endif | ||
195 | 218 | ||
196 | /* If no irq, we don't support ALARM */ | 219 | /* If no irq, we don't support ALARM */ |
197 | if (m48t59->irq == NO_IRQ) | 220 | if (m48t59->irq == NO_IRQ) |
198 | return -EIO; | 221 | return -EIO; |
199 | 222 | ||
223 | if (year < 0) | ||
224 | return -EINVAL; | ||
225 | |||
200 | /* | 226 | /* |
201 | * 0xff means "always match" | 227 | * 0xff means "always match" |
202 | */ | 228 | */ |
@@ -228,7 +254,7 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
228 | spin_unlock_irqrestore(&m48t59->lock, flags); | 254 | spin_unlock_irqrestore(&m48t59->lock, flags); |
229 | 255 | ||
230 | dev_dbg(dev, "RTC set alarm time %04d-%02d-%02d %02d/%02d/%02d\n", | 256 | dev_dbg(dev, "RTC set alarm time %04d-%02d-%02d %02d/%02d/%02d\n", |
231 | tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, | 257 | year + 1900, tm->tm_mon, tm->tm_mday, |
232 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 258 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
233 | return 0; | 259 | return 0; |
234 | } | 260 | } |
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 | ||
510 | static struct platform_driver s3c2410_rtcdrv = { | 512 | static 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 | |||
523 | static int __init s3c_rtc_init(void) | 525 | static 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 | ||
529 | static void __exit s3c_rtc_exit(void) | 531 | static 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 | ||
534 | module_init(s3c_rtc_init); | 536 | module_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) | |||
76 | static void | 76 | static void |
77 | tapeblock_end_request(struct request *req, int error) | 77 | tapeblock_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) | |||
1228 | int | 1228 | int |
1229 | tape_release(struct tape_device *device) | 1229 | tape_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 |
21 | static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL }; | 21 | static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL }; |
22 | static DEFINE_MUTEX(debugfs_mutex); | 22 | static DEFINE_MUTEX(debugfs_mutex); |
23 | #define QDIO_DEBUGFS_NAME_LEN 40 | ||
23 | 24 | ||
24 | void qdio_allocate_do_dbf(struct qdio_initialize *init_data) | 25 | void 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 | ||
155 | static 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 | |||
166 | static void remove_debugfs_entry(struct qdio_q *q) | 156 | static 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 = { | |||
189 | static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) | 179 | static 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/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index 2bec9ccc0293..a9a9893a5f95 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/poll.h> | 36 | #include <linux/poll.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/string.h> | 38 | #include <linux/string.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/genhd.h> | 39 | #include <linux/genhd.h> |
41 | #include <linux/blkdev.h> | 40 | #include <linux/blkdev.h> |
42 | 41 | ||
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 | ||
293 | MODULE_AUTHOR("Rickard E. Faith"); | 294 | MODULE_AUTHOR("Rickard E. Faith"); |
294 | MODULE_DESCRIPTION("Future domain SCSI driver"); | 295 | MODULE_DESCRIPTION("Future domain SCSI driver"); |
295 | MODULE_LICENSE("GPL"); | 296 | MODULE_LICENSE("GPL"); |
297 | #endif | ||
296 | 298 | ||
297 | 299 | ||
298 | #define VERSION "$Revision: 5.51 $" | 300 | #define VERSION "$Revision: 5.51 $" |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index afe1de998763..a454f94623d7 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -2988,17 +2988,6 @@ static int megasas_mgmt_open(struct inode *inode, struct file *filep) | |||
2988 | } | 2988 | } |
2989 | 2989 | ||
2990 | /** | 2990 | /** |
2991 | * megasas_mgmt_release - char node "release" entry point | ||
2992 | */ | ||
2993 | static int megasas_mgmt_release(struct inode *inode, struct file *filep) | ||
2994 | { | ||
2995 | filep->private_data = NULL; | ||
2996 | fasync_helper(-1, filep, 0, &megasas_async_queue); | ||
2997 | |||
2998 | return 0; | ||
2999 | } | ||
3000 | |||
3001 | /** | ||
3002 | * megasas_mgmt_fasync - Async notifier registration from applications | 2991 | * megasas_mgmt_fasync - Async notifier registration from applications |
3003 | * | 2992 | * |
3004 | * This function adds the calling process to a driver global queue. When an | 2993 | * This function adds the calling process to a driver global queue. When an |
@@ -3345,7 +3334,6 @@ megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd, | |||
3345 | static const struct file_operations megasas_mgmt_fops = { | 3334 | static const struct file_operations megasas_mgmt_fops = { |
3346 | .owner = THIS_MODULE, | 3335 | .owner = THIS_MODULE, |
3347 | .open = megasas_mgmt_open, | 3336 | .open = megasas_mgmt_open, |
3348 | .release = megasas_mgmt_release, | ||
3349 | .fasync = megasas_mgmt_fasync, | 3337 | .fasync = megasas_mgmt_fasync, |
3350 | .unlocked_ioctl = megasas_mgmt_ioctl, | 3338 | .unlocked_ioctl = megasas_mgmt_ioctl, |
3351 | #ifdef CONFIG_COMPAT | 3339 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 9adf35bd8b56..5103855242ae 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -327,7 +327,6 @@ sg_release(struct inode *inode, struct file *filp) | |||
327 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) | 327 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) |
328 | return -ENXIO; | 328 | return -ENXIO; |
329 | SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name)); | 329 | SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name)); |
330 | sg_fasync(-1, filp, 0); /* remove filp from async notification list */ | ||
331 | if (0 == sg_remove_sfp(sdp, sfp)) { /* Returns 1 when sdp gone */ | 330 | if (0 == sg_remove_sfp(sdp, sfp)) { /* Returns 1 when sdp gone */ |
332 | if (!sdp->detached) { | 331 | if (!sdp->detached) { |
333 | scsi_device_put(sdp->device); | 332 | scsi_device_put(sdp->device); |
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 | ||
1278 | config SERIAL_NETX | 1278 | config 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 | ||
1289 | config SERIAL_NETX_CONSOLE | 1289 | config 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/atmel_serial.c b/drivers/serial/atmel_serial.c index 61fb8b6d19af..d5efd6c77904 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -1258,6 +1258,8 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, | |||
1258 | atmel_port->clk = clk_get(&pdev->dev, "usart"); | 1258 | atmel_port->clk = clk_get(&pdev->dev, "usart"); |
1259 | clk_enable(atmel_port->clk); | 1259 | clk_enable(atmel_port->clk); |
1260 | port->uartclk = clk_get_rate(atmel_port->clk); | 1260 | port->uartclk = clk_get_rate(atmel_port->clk); |
1261 | clk_disable(atmel_port->clk); | ||
1262 | /* only enable clock when USART is in use */ | ||
1261 | } | 1263 | } |
1262 | 1264 | ||
1263 | atmel_port->use_dma_rx = data->use_dma_rx; | 1265 | atmel_port->use_dma_rx = data->use_dma_rx; |
@@ -1379,6 +1381,8 @@ static int __init atmel_console_setup(struct console *co, char *options) | |||
1379 | return -ENODEV; | 1381 | return -ENODEV; |
1380 | } | 1382 | } |
1381 | 1383 | ||
1384 | clk_enable(atmel_ports[co->index].clk); | ||
1385 | |||
1382 | UART_PUT_IDR(port, -1); | 1386 | UART_PUT_IDR(port, -1); |
1383 | UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); | 1387 | UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
1384 | UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); | 1388 | UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); |
@@ -1403,7 +1407,7 @@ static struct console atmel_console = { | |||
1403 | .data = &atmel_uart, | 1407 | .data = &atmel_uart, |
1404 | }; | 1408 | }; |
1405 | 1409 | ||
1406 | #define ATMEL_CONSOLE_DEVICE &atmel_console | 1410 | #define ATMEL_CONSOLE_DEVICE (&atmel_console) |
1407 | 1411 | ||
1408 | /* | 1412 | /* |
1409 | * Early console initialization (before VM subsystem initialized). | 1413 | * Early console initialization (before VM subsystem initialized). |
@@ -1534,6 +1538,15 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) | |||
1534 | if (ret) | 1538 | if (ret) |
1535 | goto err_add_port; | 1539 | goto err_add_port; |
1536 | 1540 | ||
1541 | if (atmel_is_console_port(&port->uart) | ||
1542 | && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) { | ||
1543 | /* | ||
1544 | * The serial core enabled the clock for us, so undo | ||
1545 | * the clk_enable() in atmel_console_setup() | ||
1546 | */ | ||
1547 | clk_disable(port->clk); | ||
1548 | } | ||
1549 | |||
1537 | device_init_wakeup(&pdev->dev, 1); | 1550 | device_init_wakeup(&pdev->dev, 1); |
1538 | platform_set_drvdata(pdev, port); | 1551 | platform_set_drvdata(pdev, port); |
1539 | 1552 | ||
@@ -1544,7 +1557,6 @@ err_add_port: | |||
1544 | port->rx_ring.buf = NULL; | 1557 | port->rx_ring.buf = NULL; |
1545 | err_alloc_ring: | 1558 | err_alloc_ring: |
1546 | if (!atmel_is_console_port(&port->uart)) { | 1559 | if (!atmel_is_console_port(&port->uart)) { |
1547 | clk_disable(port->clk); | ||
1548 | clk_put(port->clk); | 1560 | clk_put(port->clk); |
1549 | port->clk = NULL; | 1561 | port->clk = NULL; |
1550 | } | 1562 | } |
@@ -1568,7 +1580,6 @@ static int __devexit atmel_serial_remove(struct platform_device *pdev) | |||
1568 | 1580 | ||
1569 | /* "port" is allocated statically, so we shouldn't free it */ | 1581 | /* "port" is allocated statically, so we shouldn't free it */ |
1570 | 1582 | ||
1571 | clk_disable(atmel_port->clk); | ||
1572 | clk_put(atmel_port->clk); | 1583 | clk_put(atmel_port->clk); |
1573 | 1584 | ||
1574 | return ret; | 1585 | return ret; |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 211c21797ce0..8b2c619a09f2 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -34,14 +34,14 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | 36 | ||
37 | #include <asm/arch/svinto.h> | 37 | #include <arch/svinto.h> |
38 | 38 | ||
39 | /* non-arch dependent serial structures are in linux/serial.h */ | 39 | /* non-arch dependent serial structures are in linux/serial.h */ |
40 | #include <linux/serial.h> | 40 | #include <linux/serial.h> |
41 | /* while we keep our own stuff (struct e100_serial) in a local .h file */ | 41 | /* while we keep our own stuff (struct e100_serial) in a local .h file */ |
42 | #include "crisv10.h" | 42 | #include "crisv10.h" |
43 | #include <asm/fasttimer.h> | 43 | #include <asm/fasttimer.h> |
44 | #include <asm/arch/io_interface_mux.h> | 44 | #include <arch/io_interface_mux.h> |
45 | 45 | ||
46 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER | 46 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER |
47 | #ifndef CONFIG_ETRAX_FAST_TIMER | 47 | #ifndef CONFIG_ETRAX_FAST_TIMER |
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h index e3c5c8c3c09b..f36a729280bc 100644 --- a/drivers/serial/crisv10.h +++ b/drivers/serial/crisv10.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/circ_buf.h> | 10 | #include <linux/circ_buf.h> |
11 | #include <asm/termios.h> | 11 | #include <asm/termios.h> |
12 | #include <asm/dma.h> | 12 | #include <asm/dma.h> |
13 | #include <asm/arch/io_interface_mux.h> | 13 | #include <arch/io_interface_mux.h> |
14 | 14 | ||
15 | /* Software state per channel */ | 15 | /* Software state per channel */ |
16 | 16 | ||
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 | |||
47 | enum uart_regs { | 45 | enum 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 | |||
531 | static void netx_console_putchar(struct uart_port *port, int ch) | 531 | static 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/serial/sh-sci.c b/drivers/serial/sh-sci.c index f0658d2c45b2..5c0f32c7fbf6 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -250,8 +250,7 @@ static inline void h8300_sci_disable(struct uart_port *port) | |||
250 | } | 250 | } |
251 | #endif | 251 | #endif |
252 | 252 | ||
253 | #if defined(SCI_ONLY) || defined(SCI_AND_SCIF) && \ | 253 | #if defined(__H8300H__) || defined(__H8300S__) |
254 | defined(__H8300H__) || defined(__H8300S__) | ||
255 | static void sci_init_pins_sci(struct uart_port* port, unsigned int cflag) | 254 | static void sci_init_pins_sci(struct uart_port* port, unsigned int cflag) |
256 | { | 255 | { |
257 | int ch = (port->mapbase - SMR0) >> 3; | 256 | int ch = (port->mapbase - SMR0) >> 3; |
@@ -285,11 +284,6 @@ static void sci_init_pins_irda(struct uart_port *port, unsigned int cflag) | |||
285 | #define sci_init_pins_irda NULL | 284 | #define sci_init_pins_irda NULL |
286 | #endif | 285 | #endif |
287 | 286 | ||
288 | #ifdef SCI_ONLY | ||
289 | #define sci_init_pins_scif NULL | ||
290 | #endif | ||
291 | |||
292 | #if defined(SCIF_ONLY) || defined(SCI_AND_SCIF) | ||
293 | #if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) | 287 | #if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) |
294 | static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag) | 288 | static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag) |
295 | { | 289 | { |
@@ -449,7 +443,6 @@ static inline int scif_rxroom(struct uart_port *port) | |||
449 | return sci_in(port, SCFDR) & SCIF_RFDC_MASK; | 443 | return sci_in(port, SCFDR) & SCIF_RFDC_MASK; |
450 | } | 444 | } |
451 | #endif | 445 | #endif |
452 | #endif /* SCIF_ONLY || SCI_AND_SCIF */ | ||
453 | 446 | ||
454 | static inline int sci_txroom(struct uart_port *port) | 447 | static inline int sci_txroom(struct uart_port *port) |
455 | { | 448 | { |
@@ -485,11 +478,9 @@ static void sci_transmit_chars(struct uart_port *port) | |||
485 | return; | 478 | return; |
486 | } | 479 | } |
487 | 480 | ||
488 | #ifndef SCI_ONLY | ||
489 | if (port->type == PORT_SCIF) | 481 | if (port->type == PORT_SCIF) |
490 | count = scif_txroom(port); | 482 | count = scif_txroom(port); |
491 | else | 483 | else |
492 | #endif | ||
493 | count = sci_txroom(port); | 484 | count = sci_txroom(port); |
494 | 485 | ||
495 | do { | 486 | do { |
@@ -519,12 +510,10 @@ static void sci_transmit_chars(struct uart_port *port) | |||
519 | } else { | 510 | } else { |
520 | ctrl = sci_in(port, SCSCR); | 511 | ctrl = sci_in(port, SCSCR); |
521 | 512 | ||
522 | #if !defined(SCI_ONLY) | ||
523 | if (port->type == PORT_SCIF) { | 513 | if (port->type == PORT_SCIF) { |
524 | sci_in(port, SCxSR); /* Dummy read */ | 514 | sci_in(port, SCxSR); /* Dummy read */ |
525 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); | 515 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); |
526 | } | 516 | } |
527 | #endif | ||
528 | 517 | ||
529 | ctrl |= SCI_CTRL_FLAGS_TIE; | 518 | ctrl |= SCI_CTRL_FLAGS_TIE; |
530 | sci_out(port, SCSCR, ctrl); | 519 | sci_out(port, SCSCR, ctrl); |
@@ -547,11 +536,9 @@ static inline void sci_receive_chars(struct uart_port *port) | |||
547 | return; | 536 | return; |
548 | 537 | ||
549 | while (1) { | 538 | while (1) { |
550 | #if !defined(SCI_ONLY) | ||
551 | if (port->type == PORT_SCIF) | 539 | if (port->type == PORT_SCIF) |
552 | count = scif_rxroom(port); | 540 | count = scif_rxroom(port); |
553 | else | 541 | else |
554 | #endif | ||
555 | count = sci_rxroom(port); | 542 | count = sci_rxroom(port); |
556 | 543 | ||
557 | /* Don't copy more bytes than there is room for in the buffer */ | 544 | /* Don't copy more bytes than there is room for in the buffer */ |
@@ -810,26 +797,27 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) | |||
810 | 797 | ||
811 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | 798 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) |
812 | { | 799 | { |
813 | unsigned short ssr_status, scr_status; | 800 | unsigned short ssr_status, scr_status; |
814 | struct uart_port *port = ptr; | 801 | struct uart_port *port = ptr; |
802 | irqreturn_t ret = IRQ_NONE; | ||
815 | 803 | ||
816 | ssr_status = sci_in(port,SCxSR); | 804 | ssr_status = sci_in(port,SCxSR); |
817 | scr_status = sci_in(port,SCSCR); | 805 | scr_status = sci_in(port,SCSCR); |
818 | 806 | ||
819 | /* Tx Interrupt */ | 807 | /* Tx Interrupt */ |
820 | if ((ssr_status & 0x0020) && (scr_status & 0x0080)) | 808 | if ((ssr_status & 0x0020) && (scr_status & SCI_CTRL_FLAGS_TIE)) |
821 | sci_tx_interrupt(irq, ptr); | 809 | ret = sci_tx_interrupt(irq, ptr); |
822 | /* Rx Interrupt */ | 810 | /* Rx Interrupt */ |
823 | if ((ssr_status & 0x0002) && (scr_status & 0x0040)) | 811 | if ((ssr_status & 0x0002) && (scr_status & SCI_CTRL_FLAGS_RIE)) |
824 | sci_rx_interrupt(irq, ptr); | 812 | ret = sci_rx_interrupt(irq, ptr); |
825 | /* Error Interrupt */ | 813 | /* Error Interrupt */ |
826 | if ((ssr_status & 0x0080) && (scr_status & 0x0400)) | 814 | if ((ssr_status & 0x0080) && (scr_status & SCI_CTRL_FLAGS_REIE)) |
827 | sci_er_interrupt(irq, ptr); | 815 | ret = sci_er_interrupt(irq, ptr); |
828 | /* Break Interrupt */ | 816 | /* Break Interrupt */ |
829 | if ((ssr_status & 0x0010) && (scr_status & 0x0200)) | 817 | if ((ssr_status & 0x0010) && (scr_status & SCI_CTRL_FLAGS_REIE)) |
830 | sci_br_interrupt(irq, ptr); | 818 | ret = sci_br_interrupt(irq, ptr); |
831 | 819 | ||
832 | return IRQ_HANDLED; | 820 | return ret; |
833 | } | 821 | } |
834 | 822 | ||
835 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) | 823 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) |
@@ -1054,10 +1042,8 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1054 | 1042 | ||
1055 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ | 1043 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ |
1056 | 1044 | ||
1057 | #if !defined(SCI_ONLY) | ||
1058 | if (port->type == PORT_SCIF) | 1045 | if (port->type == PORT_SCIF) |
1059 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); | 1046 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); |
1060 | #endif | ||
1061 | 1047 | ||
1062 | smr_val = sci_in(port, SCSMR) & 3; | 1048 | smr_val = sci_in(port, SCSMR) & 3; |
1063 | if ((termios->c_cflag & CSIZE) == CS7) | 1049 | if ((termios->c_cflag & CSIZE) == CS7) |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 7cd28b226800..6163a45f968f 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -16,7 +16,6 @@ | |||
16 | # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */ | 16 | # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */ |
17 | # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */ | 17 | # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */ |
18 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | 18 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ |
19 | # define SCI_AND_SCIF | ||
20 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | 19 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) |
21 | # define SCIF0 0xA4400000 | 20 | # define SCIF0 0xA4400000 |
22 | # define SCIF2 0xA4410000 | 21 | # define SCIF2 0xA4410000 |
@@ -30,17 +29,15 @@ | |||
30 | * SCIF0 (0xA4400000) -> Internal clock, SCK pin as serial clock output | 29 | * SCIF0 (0xA4400000) -> Internal clock, SCK pin as serial clock output |
31 | */ | 30 | */ |
32 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 | 31 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 |
33 | # define SCIF_ONLY | ||
34 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 32 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
35 | defined(CONFIG_CPU_SUBTYPE_SH7721) | 33 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
36 | # define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ | 34 | # define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ |
37 | # define SCIF_ONLY | ||
38 | #define SCIF_ORER 0x0200 /* overrun error bit */ | 35 | #define SCIF_ORER 0x0200 /* overrun error bit */ |
39 | #elif defined(CONFIG_SH_RTS7751R2D) | 36 | #elif defined(CONFIG_SH_RTS7751R2D) |
37 | # define SCSPTR1 0xFFE0001C /* 8 bit SCIF */ | ||
40 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ | 38 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ |
41 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 39 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
42 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 40 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
43 | # define SCIF_ONLY | ||
44 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ | 41 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ |
45 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ | 42 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ |
46 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ | 43 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ |
@@ -53,28 +50,24 @@ | |||
53 | # define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \ | 50 | # define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \ |
54 | 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \ | 51 | 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \ |
55 | 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ ) | 52 | 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ ) |
56 | # define SCI_AND_SCIF | ||
57 | #elif defined(CONFIG_CPU_SUBTYPE_SH7760) | 53 | #elif defined(CONFIG_CPU_SUBTYPE_SH7760) |
58 | # define SCSPTR0 0xfe600024 /* 16 bit SCIF */ | 54 | # define SCSPTR0 0xfe600024 /* 16 bit SCIF */ |
59 | # define SCSPTR1 0xfe610024 /* 16 bit SCIF */ | 55 | # define SCSPTR1 0xfe610024 /* 16 bit SCIF */ |
60 | # define SCSPTR2 0xfe620024 /* 16 bit SCIF */ | 56 | # define SCSPTR2 0xfe620024 /* 16 bit SCIF */ |
61 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 57 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
62 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 58 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
63 | # define SCIF_ONLY | ||
64 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) | 59 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) |
65 | # define SCSPTR0 0xA4400000 /* 16 bit SCIF */ | 60 | # define SCSPTR0 0xA4400000 /* 16 bit SCIF */ |
66 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 61 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
67 | # define PACR 0xa4050100 | 62 | # define PACR 0xa4050100 |
68 | # define PBCR 0xa4050102 | 63 | # define PBCR 0xa4050102 |
69 | # define SCSCR_INIT(port) 0x3B | 64 | # define SCSCR_INIT(port) 0x3B |
70 | # define SCIF_ONLY | ||
71 | #elif defined(CONFIG_CPU_SUBTYPE_SH7343) | 65 | #elif defined(CONFIG_CPU_SUBTYPE_SH7343) |
72 | # define SCSPTR0 0xffe00010 /* 16 bit SCIF */ | 66 | # define SCSPTR0 0xffe00010 /* 16 bit SCIF */ |
73 | # define SCSPTR1 0xffe10010 /* 16 bit SCIF */ | 67 | # define SCSPTR1 0xffe10010 /* 16 bit SCIF */ |
74 | # define SCSPTR2 0xffe20010 /* 16 bit SCIF */ | 68 | # define SCSPTR2 0xffe20010 /* 16 bit SCIF */ |
75 | # define SCSPTR3 0xffe30010 /* 16 bit SCIF */ | 69 | # define SCSPTR3 0xffe30010 /* 16 bit SCIF */ |
76 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ | 70 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ |
77 | # define SCIF_ONLY | ||
78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | 71 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) |
79 | # define PADR 0xA4050120 | 72 | # define PADR 0xA4050120 |
80 | # define PSDR 0xA405013e | 73 | # define PSDR 0xA405013e |
@@ -82,7 +75,6 @@ | |||
82 | # define PSCR 0xA405011E | 75 | # define PSCR 0xA405011E |
83 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 76 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
84 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 77 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
85 | # define SCIF_ONLY | ||
86 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) | 78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) |
87 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ | 79 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ |
88 | # define SCSPTR0 SCPDR0 | 80 | # define SCSPTR0 SCPDR0 |
@@ -97,12 +89,10 @@ | |||
97 | # define SCSPTR5 0xa4050128 | 89 | # define SCSPTR5 0xa4050128 |
98 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 90 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
99 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 91 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
100 | # define SCIF_ONLY | ||
101 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) | 92 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) |
102 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ | 93 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ |
103 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 94 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
104 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 95 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
105 | # define SCIF_ONLY | ||
106 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 96 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
107 | # define SCIF_BASE_ADDR 0x01030000 | 97 | # define SCIF_BASE_ADDR 0x01030000 |
108 | # define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR | 98 | # define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR |
@@ -111,14 +101,11 @@ | |||
111 | # define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ | 101 | # define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ |
112 | # define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */ | 102 | # define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */ |
113 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */ | 103 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */ |
114 | # define SCIF_ONLY | ||
115 | #elif defined(CONFIG_H83007) || defined(CONFIG_H83068) | 104 | #elif defined(CONFIG_H83007) || defined(CONFIG_H83068) |
116 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | 105 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ |
117 | # define SCI_ONLY | ||
118 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) | 106 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) |
119 | #elif defined(CONFIG_H8S2678) | 107 | #elif defined(CONFIG_H8S2678) |
120 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | 108 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ |
121 | # define SCI_ONLY | ||
122 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) | 109 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) |
123 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 110 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) |
124 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ | 111 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ |
@@ -126,20 +113,17 @@ | |||
126 | # define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */ | 113 | # define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */ |
127 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 114 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
128 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 115 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
129 | # define SCIF_ONLY | ||
130 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) | 116 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) |
131 | # define SCSPTR0 0xff923020 /* 16 bit SCIF */ | 117 | # define SCSPTR0 0xff923020 /* 16 bit SCIF */ |
132 | # define SCSPTR1 0xff924020 /* 16 bit SCIF */ | 118 | # define SCSPTR1 0xff924020 /* 16 bit SCIF */ |
133 | # define SCSPTR2 0xff925020 /* 16 bit SCIF */ | 119 | # define SCSPTR2 0xff925020 /* 16 bit SCIF */ |
134 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 120 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
135 | # define SCSCR_INIT(port) 0x3c /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,cke=2 */ | 121 | # define SCSCR_INIT(port) 0x3c /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,cke=2 */ |
136 | # define SCIF_ONLY | ||
137 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 122 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
138 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ | 123 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ |
139 | # define SCSPTR1 0xffe10024 /* 16 bit SCIF */ | 124 | # define SCSPTR1 0xffe10024 /* 16 bit SCIF */ |
140 | # define SCIF_ORER 0x0001 /* Overrun error bit */ | 125 | # define SCIF_ORER 0x0001 /* Overrun error bit */ |
141 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 126 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
142 | # define SCIF_ONLY | ||
143 | #elif defined(CONFIG_CPU_SUBTYPE_SH7785) | 127 | #elif defined(CONFIG_CPU_SUBTYPE_SH7785) |
144 | # define SCSPTR0 0xffea0024 /* 16 bit SCIF */ | 128 | # define SCSPTR0 0xffea0024 /* 16 bit SCIF */ |
145 | # define SCSPTR1 0xffeb0024 /* 16 bit SCIF */ | 129 | # define SCSPTR1 0xffeb0024 /* 16 bit SCIF */ |
@@ -149,7 +133,6 @@ | |||
149 | # define SCSPTR5 0xffef0024 /* 16 bit SCIF */ | 133 | # define SCSPTR5 0xffef0024 /* 16 bit SCIF */ |
150 | # define SCIF_OPER 0x0001 /* Overrun error bit */ | 134 | # define SCIF_OPER 0x0001 /* Overrun error bit */ |
151 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 135 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
152 | # define SCIF_ONLY | ||
153 | #elif defined(CONFIG_CPU_SUBTYPE_SH7203) || \ | 136 | #elif defined(CONFIG_CPU_SUBTYPE_SH7203) || \ |
154 | defined(CONFIG_CPU_SUBTYPE_SH7206) || \ | 137 | defined(CONFIG_CPU_SUBTYPE_SH7206) || \ |
155 | defined(CONFIG_CPU_SUBTYPE_SH7263) | 138 | defined(CONFIG_CPU_SUBTYPE_SH7263) |
@@ -158,14 +141,12 @@ | |||
158 | # define SCSPTR2 0xfffe9020 /* 16 bit SCIF */ | 141 | # define SCSPTR2 0xfffe9020 /* 16 bit SCIF */ |
159 | # define SCSPTR3 0xfffe9820 /* 16 bit SCIF */ | 142 | # define SCSPTR3 0xfffe9820 /* 16 bit SCIF */ |
160 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 143 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
161 | # define SCIF_ONLY | ||
162 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | 144 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) |
163 | # define SCSPTR0 0xf8400020 /* 16 bit SCIF */ | 145 | # define SCSPTR0 0xf8400020 /* 16 bit SCIF */ |
164 | # define SCSPTR1 0xf8410020 /* 16 bit SCIF */ | 146 | # define SCSPTR1 0xf8410020 /* 16 bit SCIF */ |
165 | # define SCSPTR2 0xf8420020 /* 16 bit SCIF */ | 147 | # define SCSPTR2 0xf8420020 /* 16 bit SCIF */ |
166 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 148 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
167 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 149 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
168 | # define SCIF_ONLY | ||
169 | #elif defined(CONFIG_CPU_SUBTYPE_SHX3) | 150 | #elif defined(CONFIG_CPU_SUBTYPE_SHX3) |
170 | # define SCSPTR0 0xffc30020 /* 16 bit SCIF */ | 151 | # define SCSPTR0 0xffc30020 /* 16 bit SCIF */ |
171 | # define SCSPTR1 0xffc40020 /* 16 bit SCIF */ | 152 | # define SCSPTR1 0xffc40020 /* 16 bit SCIF */ |
@@ -173,7 +154,6 @@ | |||
173 | # define SCSPTR3 0xffc60020 /* 16 bit SCIF */ | 154 | # define SCSPTR3 0xffc60020 /* 16 bit SCIF */ |
174 | # define SCIF_ORER 0x0001 /* Overrun error bit */ | 155 | # define SCIF_ORER 0x0001 /* Overrun error bit */ |
175 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 156 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
176 | # define SCIF_ONLY | ||
177 | #else | 157 | #else |
178 | # error CPU subtype not defined | 158 | # error CPU subtype not defined |
179 | #endif | 159 | #endif |
@@ -186,6 +166,7 @@ | |||
186 | #if defined(CONFIG_CPU_SUBTYPE_SH7750) || \ | 166 | #if defined(CONFIG_CPU_SUBTYPE_SH7750) || \ |
187 | defined(CONFIG_CPU_SUBTYPE_SH7091) || \ | 167 | defined(CONFIG_CPU_SUBTYPE_SH7091) || \ |
188 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ | 168 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ |
169 | defined(CONFIG_CPU_SUBTYPE_SH7722) || \ | ||
189 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ | 170 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ |
190 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ | 171 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ |
191 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ | 172 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ |
@@ -244,55 +225,28 @@ | |||
244 | # define SCIF_TXROOM_MAX 16 | 225 | # define SCIF_TXROOM_MAX 16 |
245 | #endif | 226 | #endif |
246 | 227 | ||
247 | #if defined(SCI_ONLY) | 228 | #define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND) |
248 | # define SCxSR_TEND(port) SCI_TEND | 229 | #define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS) |
249 | # define SCxSR_ERRORS(port) SCI_ERRORS | 230 | #define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF) |
250 | # define SCxSR_RDxF(port) SCI_RDRF | 231 | #define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE) |
251 | # define SCxSR_TDxE(port) SCI_TDRE | 232 | #define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER) |
252 | # define SCxSR_ORER(port) SCI_ORER | 233 | #define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER) |
253 | # define SCxSR_FER(port) SCI_FER | 234 | #define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK) |
254 | # define SCxSR_PER(port) SCI_PER | 235 | |
255 | # define SCxSR_BRK(port) 0x00 | ||
256 | # define SCxSR_RDxF_CLEAR(port) 0xbc | ||
257 | # define SCxSR_ERROR_CLEAR(port) 0xc4 | ||
258 | # define SCxSR_TDxE_CLEAR(port) 0x78 | ||
259 | # define SCxSR_BREAK_CLEAR(port) 0xc4 | ||
260 | #elif defined(SCIF_ONLY) | ||
261 | # define SCxSR_TEND(port) SCIF_TEND | ||
262 | # define SCxSR_ERRORS(port) SCIF_ERRORS | ||
263 | # define SCxSR_RDxF(port) SCIF_RDF | ||
264 | # define SCxSR_TDxE(port) SCIF_TDFE | ||
265 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | 236 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) |
266 | # define SCxSR_ORER(port) SCIF_ORER | 237 | # define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : SCIF_ORER) |
267 | #else | 238 | #else |
268 | # define SCxSR_ORER(port) 0x0000 | 239 | # define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : 0x0000) |
269 | #endif | 240 | #endif |
270 | # define SCxSR_FER(port) SCIF_FER | 241 | |
271 | # define SCxSR_PER(port) SCIF_PER | ||
272 | # define SCxSR_BRK(port) SCIF_BRK | ||
273 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 242 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
274 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 243 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
275 | defined(CONFIG_CPU_SUBTYPE_SH7721) | 244 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
276 | # define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc) | 245 | # define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc) |
277 | # define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73) | 246 | # define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73) |
278 | # define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf) | 247 | # define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf) |
279 | # define SCxSR_BREAK_CLEAR(port) (sci_in(port,SCxSR)&0xffe3) | 248 | # define SCxSR_BREAK_CLEAR(port) (sci_in(port, SCxSR) & 0xffe3) |
280 | #else | ||
281 | /* SH7705 can also use this, clearing is same between 7705 and 7709 */ | ||
282 | # define SCxSR_RDxF_CLEAR(port) 0x00fc | ||
283 | # define SCxSR_ERROR_CLEAR(port) 0x0073 | ||
284 | # define SCxSR_TDxE_CLEAR(port) 0x00df | ||
285 | # define SCxSR_BREAK_CLEAR(port) 0x00e3 | ||
286 | #endif | ||
287 | #else | 249 | #else |
288 | # define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND) | ||
289 | # define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS) | ||
290 | # define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF) | ||
291 | # define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE) | ||
292 | # define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : 0x0000) | ||
293 | # define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER) | ||
294 | # define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER) | ||
295 | # define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK) | ||
296 | # define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc) | 250 | # define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc) |
297 | # define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073) | 251 | # define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073) |
298 | # define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df) | 252 | # define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df) |
@@ -574,18 +528,20 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
574 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ | 528 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ |
575 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ | 529 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ |
576 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ | 530 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ |
577 | defined(CONFIG_CPU_SUBTYPE_SH7091) || \ | 531 | defined(CONFIG_CPU_SUBTYPE_SH7091) |
578 | defined(CONFIG_CPU_SUBTYPE_SH4_202) | ||
579 | static inline int sci_rxd_in(struct uart_port *port) | 532 | static inline int sci_rxd_in(struct uart_port *port) |
580 | { | 533 | { |
581 | #ifndef SCIF_ONLY | ||
582 | if (port->mapbase == 0xffe00000) | 534 | if (port->mapbase == 0xffe00000) |
583 | return ctrl_inb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */ | 535 | return ctrl_inb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */ |
584 | #endif | ||
585 | #ifndef SCI_ONLY | ||
586 | if (port->mapbase == 0xffe80000) | 536 | if (port->mapbase == 0xffe80000) |
587 | return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ | 537 | return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ |
588 | #endif | 538 | return 1; |
539 | } | ||
540 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) | ||
541 | static inline int sci_rxd_in(struct uart_port *port) | ||
542 | { | ||
543 | if (port->mapbase == 0xffe80000) | ||
544 | return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ | ||
589 | return 1; | 545 | return 1; |
590 | } | 546 | } |
591 | #elif defined(CONFIG_CPU_SUBTYPE_SH7760) | 547 | #elif defined(CONFIG_CPU_SUBTYPE_SH7760) |
@@ -651,7 +607,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
651 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 607 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
652 | static inline int sci_rxd_in(struct uart_port *port) | 608 | static inline int sci_rxd_in(struct uart_port *port) |
653 | { | 609 | { |
654 | return sci_in(port, SCSPTR)&0x0001 ? 1 : 0; /* SCIF */ | 610 | return sci_in(port, SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ |
655 | } | 611 | } |
656 | #elif defined(__H8300H__) || defined(__H8300S__) | 612 | #elif defined(__H8300H__) || defined(__H8300S__) |
657 | static inline int sci_rxd_in(struct uart_port *port) | 613 | static inline int sci_rxd_in(struct uart_port *port) |
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig index 307b1f62d949..b1b947edcf01 100644 --- a/drivers/ssb/Kconfig +++ b/drivers/ssb/Kconfig | |||
@@ -1,10 +1,11 @@ | |||
1 | menu "Sonics Silicon Backplane" | ||
2 | |||
3 | config SSB_POSSIBLE | 1 | config SSB_POSSIBLE |
4 | bool | 2 | bool |
5 | depends on HAS_IOMEM && HAS_DMA | 3 | depends on HAS_IOMEM && HAS_DMA |
6 | default y | 4 | default y |
7 | 5 | ||
6 | menu "Sonics Silicon Backplane" | ||
7 | depends on SSB_POSSIBLE | ||
8 | |||
8 | config SSB | 9 | config SSB |
9 | tristate "Sonics Silicon Backplane support" | 10 | tristate "Sonics Silicon Backplane support" |
10 | depends on SSB_POSSIBLE | 11 | depends on SSB_POSSIBLE |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index e1654f59eb70..c95b286a1239 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -21,7 +21,23 @@ menuconfig STAGING | |||
21 | 21 | ||
22 | If in doubt, say N here. | 22 | If in doubt, say N here. |
23 | 23 | ||
24 | if STAGING | 24 | |
25 | config STAGING_EXCLUDE_BUILD | ||
26 | bool "Exclude Staging drivers from being built" if STAGING | ||
27 | default y | ||
28 | ---help--- | ||
29 | Are you sure you really want to build the staging drivers? | ||
30 | They taint your kernel, don't live up to the normal Linux | ||
31 | kernel quality standards, are a bit crufty around the edges, | ||
32 | and might go off and kick your dog when you aren't paying | ||
33 | attention. | ||
34 | |||
35 | Say N here to be able to select and build the Staging drivers. | ||
36 | This option is primarily here to prevent them from being built | ||
37 | when selecting 'make allyesconfg' and 'make allmodconfig' so | ||
38 | don't be all that put off, your dog will be just fine. | ||
39 | |||
40 | if !STAGING_EXCLUDE_BUILD | ||
25 | 41 | ||
26 | source "drivers/staging/et131x/Kconfig" | 42 | source "drivers/staging/et131x/Kconfig" |
27 | 43 | ||
@@ -45,4 +61,4 @@ source "drivers/staging/at76_usb/Kconfig" | |||
45 | 61 | ||
46 | source "drivers/staging/poch/Kconfig" | 62 | source "drivers/staging/poch/Kconfig" |
47 | 63 | ||
48 | endif # STAGING | 64 | endif # !STAGING_EXCLUDE_BUILD |
diff --git a/drivers/staging/echo/echo.c b/drivers/staging/echo/echo.c index b8f2c5e9dee5..fd4007e329e7 100644 --- a/drivers/staging/echo/echo.c +++ b/drivers/staging/echo/echo.c | |||
@@ -106,7 +106,6 @@ | |||
106 | 106 | ||
107 | #include <linux/kernel.h> /* We're doing kernel work */ | 107 | #include <linux/kernel.h> /* We're doing kernel work */ |
108 | #include <linux/module.h> | 108 | #include <linux/module.h> |
109 | #include <linux/kernel.h> | ||
110 | #include <linux/slab.h> | 109 | #include <linux/slab.h> |
111 | 110 | ||
112 | #include "bit_operations.h" | 111 | #include "bit_operations.h" |
diff --git a/drivers/staging/me4000/me4000.c b/drivers/staging/me4000/me4000.c index 0b33773bb4f6..0394e2709278 100644 --- a/drivers/staging/me4000/me4000.c +++ b/drivers/staging/me4000/me4000.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <asm/system.h> | 41 | #include <asm/system.h> |
42 | #include <asm/uaccess.h> | ||
43 | 42 | ||
44 | /* Include-File for the Meilhaus ME-4000 I/O board */ | 43 | /* Include-File for the Meilhaus ME-4000 I/O board */ |
45 | #include "me4000.h" | 44 | #include "me4000.h" |
@@ -1633,9 +1632,6 @@ static int me4000_release(struct inode *inode_p, struct file *file_p) | |||
1633 | 1632 | ||
1634 | free_irq(ext_int_context->irq, ext_int_context); | 1633 | free_irq(ext_int_context->irq, ext_int_context); |
1635 | 1634 | ||
1636 | /* Delete the fasync structure and free memory */ | ||
1637 | me4000_ext_int_fasync(0, file_p, 0); | ||
1638 | |||
1639 | /* Mark as unused */ | 1635 | /* Mark as unused */ |
1640 | ext_int_context->in_use = 0; | 1636 | ext_int_context->in_use = 0; |
1641 | } else { | 1637 | } else { |
diff --git a/drivers/staging/usbip/Kconfig b/drivers/staging/usbip/Kconfig index 7426235ccc44..217fb7e62c2f 100644 --- a/drivers/staging/usbip/Kconfig +++ b/drivers/staging/usbip/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_IP_COMMON | 1 | config USB_IP_COMMON |
2 | tristate "USB IP support (EXPERIMENTAL)" | 2 | tristate "USB IP support (EXPERIMENTAL)" |
3 | depends on USB && EXPERIMENTAL | 3 | depends on USB && NET && EXPERIMENTAL |
4 | default N | 4 | default N |
5 | ---help--- | 5 | ---help--- |
6 | This enables pushing USB packets over IP to allow remote | 6 | This enables pushing USB packets over IP to allow remote |
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index 41b6530b8f25..a913efc69669 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c | |||
@@ -2328,7 +2328,6 @@ static int ixj_release(struct inode *inode, struct file *file_p) | |||
2328 | j->rec_codec = j->play_codec = 0; | 2328 | j->rec_codec = j->play_codec = 0; |
2329 | j->rec_frame_size = j->play_frame_size = 0; | 2329 | j->rec_frame_size = j->play_frame_size = 0; |
2330 | j->flags.cidsent = j->flags.cidring = 0; | 2330 | j->flags.cidsent = j->flags.cidring = 0; |
2331 | ixj_fasync(-1, file_p, 0); /* remove from list of async notification */ | ||
2332 | 2331 | ||
2333 | if(j->cardtype == QTI_LINEJACK && !j->readers && !j->writers) { | 2332 | if(j->cardtype == QTI_LINEJACK && !j->readers && !j->writers) { |
2334 | ixj_set_port(j, PORT_PSTN); | 2333 | ixj_set_port(j, PORT_PSTN); |
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index 37caf4d69037..b52cc830c0b4 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * as published by the Free Software Foundation; either version | 8 | * as published by the Free Software Foundation; either version |
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | * | 10 | * |
11 | * Author: Alan Cox, <alan@redhat.com> | 11 | * Author: Alan Cox, <alan@lxorguk.ukuu.org.uk> |
12 | * | 12 | * |
13 | * Fixes: Mar 01 2000 Thomas Sparr, <thomas.l.sparr@telia.com> | 13 | * Fixes: Mar 01 2000 Thomas Sparr, <thomas.l.sparr@telia.com> |
14 | * phone_register_device now works with unit!=PHONE_UNIT_ANY | 14 | * phone_register_device now works with unit!=PHONE_UNIT_ANY |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index f9b4647255aa..2d2440cd57a9 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -367,9 +367,6 @@ static int uio_release(struct inode *inode, struct file *filep) | |||
367 | ret = idev->info->release(idev->info, inode); | 367 | ret = idev->info->release(idev->info, inode); |
368 | 368 | ||
369 | module_put(idev->owner); | 369 | module_put(idev->owner); |
370 | |||
371 | if (filep->f_flags & FASYNC) | ||
372 | ret = uio_fasync(-1, filep, 0); | ||
373 | kfree(listener); | 370 | kfree(listener); |
374 | return ret; | 371 | return ret; |
375 | } | 372 | } |
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 | ||
134 | static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data) | 134 | static 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 */ |
107 | static DEFINE_SPINLOCK(hcd_urb_list_lock); | 107 | static DEFINE_SPINLOCK(hcd_urb_list_lock); |
108 | 108 | ||
109 | /* used to protect against unlinking URBs after the device is gone */ | ||
110 | static DEFINE_SPINLOCK(hcd_urb_unlink_lock); | ||
111 | |||
109 | /* wait queue for synchronous unlinks */ | 112 | /* wait queue for synchronous unlinks */ |
110 | DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue); | 113 | DECLARE_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) | |||
1376 | int usb_hcd_unlink_urb (struct urb *urb, int status) | 1379 | int 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 | */ | ||
1554 | void 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); |
233 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, | 233 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, |
234 | struct usb_host_endpoint *ep); | 234 | struct usb_host_endpoint *ep); |
235 | extern void usb_hcd_synchronize_unlinks(struct usb_device *udev); | ||
235 | extern int usb_hcd_get_frame_number(struct usb_device *udev); | 236 | extern int usb_hcd_get_frame_number(struct usb_device *udev); |
236 | 237 | ||
237 | extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, | 238 | extern 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 | */ |
554 | void usb_kill_urb(struct urb *urb) | 563 | void 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 | */ |
592 | void usb_poison_urb(struct urb *urb) | 604 | void 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 | */ |
626 | void usb_kill_anchored_urbs(struct usb_anchor *anchor) | 641 | void 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 | */ |
655 | void usb_poison_anchored_urbs(struct usb_anchor *anchor) | 673 | void 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 | } |
674 | EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); | 692 | EXPORT_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 | */ |
684 | void usb_unlink_anchored_urbs(struct usb_anchor *anchor) | 706 | void usb_unlink_anchored_urbs(struct usb_anchor *anchor) |
685 | { | 707 | { |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index f4585d3e90d7..eeb26c0f88e5 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1251,7 +1251,6 @@ dev_release (struct inode *inode, struct file *fd) | |||
1251 | * alternatively, all host requests will time out. | 1251 | * alternatively, all host requests will time out. |
1252 | */ | 1252 | */ |
1253 | 1253 | ||
1254 | fasync_helper (-1, fd, 0, &dev->fasync); | ||
1255 | kfree (dev->buf); | 1254 | kfree (dev->buf); |
1256 | dev->buf = NULL; | 1255 | dev->buf = NULL; |
1257 | put_dev (dev); | 1256 | put_dev (dev); |
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index b679a556b98d..4e2cda93da59 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * Introduced common header to be used also in USB Gadget Framework. | 26 | * Introduced common header to be used also in USB Gadget Framework. |
27 | * Still needs some other style fixes. | 27 | * Still needs some other style fixes. |
28 | * | 28 | * |
29 | * 2007_Jun_21 Alan Cox <alan@redhat.com> | 29 | * 2007_Jun_21 Alan Cox <alan@lxorguk.ukuu.org.uk> |
30 | * Minimal cleanups for some of the driver problens and tty layer abuse. | 30 | * Minimal cleanups for some of the driver problens and tty layer abuse. |
31 | * Still needs fixing to allow multiple dongles. | 31 | * Still needs fixing to allow multiple dongles. |
32 | * | 32 | * |
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> */ | ||
337 | UNUSUAL_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 */ |
338 | UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, | 345 | UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 0f13448c6f79..3f3ce13fef43 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -2083,6 +2083,38 @@ config FB_METRONOME | |||
2083 | controller. The pre-release name for this device was 8track | 2083 | controller. The pre-release name for this device was 8track |
2084 | and could also have been called by some vendors as PVI-nnnn. | 2084 | and could also have been called by some vendors as PVI-nnnn. |
2085 | 2085 | ||
2086 | config FB_MB862XX | ||
2087 | tristate "Fujitsu MB862xx GDC support" | ||
2088 | depends on FB | ||
2089 | select FB_CFB_FILLRECT | ||
2090 | select FB_CFB_COPYAREA | ||
2091 | select FB_CFB_IMAGEBLIT | ||
2092 | ---help--- | ||
2093 | Frame buffer driver for Fujitsu Carmine/Coral-P(A)/Lime controllers. | ||
2094 | |||
2095 | config FB_MB862XX_PCI_GDC | ||
2096 | bool "Carmine/Coral-P(A) GDC" | ||
2097 | depends on PCI && FB_MB862XX | ||
2098 | ---help--- | ||
2099 | This enables framebuffer support for Fujitsu Carmine/Coral-P(A) | ||
2100 | PCI graphics controller devices. | ||
2101 | |||
2102 | config FB_MB862XX_LIME | ||
2103 | bool "Lime GDC" | ||
2104 | depends on FB_MB862XX | ||
2105 | depends on OF && !FB_MB862XX_PCI_GDC | ||
2106 | select FB_FOREIGN_ENDIAN | ||
2107 | select FB_LITTLE_ENDIAN | ||
2108 | ---help--- | ||
2109 | Framebuffer support for Fujitsu Lime GDC on host CPU bus. | ||
2110 | |||
2111 | config FB_PRE_INIT_FB | ||
2112 | bool "Don't reinitialize, use bootloader's GDC/Display configuration" | ||
2113 | depends on FB_MB862XX_LIME | ||
2114 | ---help--- | ||
2115 | Select this option if display contents should be inherited as set by | ||
2116 | the bootloader. | ||
2117 | |||
2086 | source "drivers/video/omap/Kconfig" | 2118 | source "drivers/video/omap/Kconfig" |
2087 | 2119 | ||
2088 | source "drivers/video/backlight/Kconfig" | 2120 | source "drivers/video/backlight/Kconfig" |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 248bddc8d0b0..e39e33e797da 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -122,6 +122,7 @@ obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o | |||
122 | obj-$(CONFIG_FB_OMAP) += omap/ | 122 | obj-$(CONFIG_FB_OMAP) += omap/ |
123 | obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o | 123 | obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o |
124 | obj-$(CONFIG_FB_CARMINE) += carminefb.o | 124 | obj-$(CONFIG_FB_CARMINE) += carminefb.o |
125 | obj-$(CONFIG_FB_MB862XX) += mb862xx/ | ||
125 | 126 | ||
126 | # Platform or fallback drivers go here | 127 | # Platform or fallback drivers go here |
127 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | 128 | obj-$(CONFIG_FB_UVESA) += uvesafb.o |
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 | ||
442 | void corgibl_limit_intensity(int limit) | 442 | void 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 | } |
451 | EXPORT_SYMBOL(corgibl_limit_intensity); | 451 | EXPORT_SYMBOL(corgi_lcd_limit_intensity); |
452 | 452 | ||
453 | static struct backlight_ops corgi_bl_ops = { | 453 | static 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/cirrusfb.c b/drivers/video/cirrusfb.c index 048b139f0e50..8a8760230bc7 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -2049,7 +2049,7 @@ static void cirrusfb_pci_unmap(struct fb_info *info) | |||
2049 | #endif /* CONFIG_PCI */ | 2049 | #endif /* CONFIG_PCI */ |
2050 | 2050 | ||
2051 | #ifdef CONFIG_ZORRO | 2051 | #ifdef CONFIG_ZORRO |
2052 | static void __devexit cirrusfb_zorro_unmap(struct fb_info *info) | 2052 | static void cirrusfb_zorro_unmap(struct fb_info *info) |
2053 | { | 2053 | { |
2054 | struct cirrusfb_info *cinfo = info->par; | 2054 | struct cirrusfb_info *cinfo = info->par; |
2055 | struct zorro_dev *zdev = to_zorro_dev(info->device); | 2055 | struct zorro_dev *zdev = to_zorro_dev(info->device); |
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 | ||
2121 | static __inline__ void updatescrollmode(struct display *p, | 2121 | static 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..1d5ae39cb271 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1002,13 +1002,9 @@ fb_blank(struct fb_info *info, int blank) | |||
1002 | return ret; | 1002 | return ret; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | static long | 1005 | static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, |
1006 | fb_ioctl(struct file *file, unsigned int cmd, | 1006 | unsigned long arg) |
1007 | unsigned long arg) | ||
1008 | { | 1007 | { |
1009 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1010 | int fbidx = iminor(inode); | ||
1011 | struct fb_info *info; | ||
1012 | struct fb_ops *fb; | 1008 | struct fb_ops *fb; |
1013 | struct fb_var_screeninfo var; | 1009 | struct fb_var_screeninfo var; |
1014 | struct fb_fix_screeninfo fix; | 1010 | struct fb_fix_screeninfo fix; |
@@ -1018,14 +1014,10 @@ fb_ioctl(struct file *file, unsigned int cmd, | |||
1018 | void __user *argp = (void __user *)arg; | 1014 | void __user *argp = (void __user *)arg; |
1019 | long ret = 0; | 1015 | long ret = 0; |
1020 | 1016 | ||
1021 | info = registered_fb[fbidx]; | ||
1022 | mutex_lock(&info->lock); | ||
1023 | fb = info->fbops; | 1017 | fb = info->fbops; |
1024 | 1018 | if (!fb) | |
1025 | if (!fb) { | ||
1026 | mutex_unlock(&info->lock); | ||
1027 | return -ENODEV; | 1019 | return -ENODEV; |
1028 | } | 1020 | |
1029 | switch (cmd) { | 1021 | switch (cmd) { |
1030 | case FBIOGET_VSCREENINFO: | 1022 | case FBIOGET_VSCREENINFO: |
1031 | ret = copy_to_user(argp, &info->var, | 1023 | ret = copy_to_user(argp, &info->var, |
@@ -1126,6 +1118,21 @@ fb_ioctl(struct file *file, unsigned int cmd, | |||
1126 | else | 1118 | else |
1127 | ret = fb->fb_ioctl(info, cmd, arg); | 1119 | ret = fb->fb_ioctl(info, cmd, arg); |
1128 | } | 1120 | } |
1121 | return ret; | ||
1122 | } | ||
1123 | |||
1124 | static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1125 | __acquires(&info->lock) | ||
1126 | __releases(&info->lock) | ||
1127 | { | ||
1128 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1129 | int fbidx = iminor(inode); | ||
1130 | struct fb_info *info; | ||
1131 | long ret; | ||
1132 | |||
1133 | info = registered_fb[fbidx]; | ||
1134 | mutex_lock(&info->lock); | ||
1135 | ret = do_fb_ioctl(info, cmd, arg); | ||
1129 | mutex_unlock(&info->lock); | 1136 | mutex_unlock(&info->lock); |
1130 | return ret; | 1137 | return ret; |
1131 | } | 1138 | } |
@@ -1157,8 +1164,8 @@ struct fb_cmap32 { | |||
1157 | compat_caddr_t transp; | 1164 | compat_caddr_t transp; |
1158 | }; | 1165 | }; |
1159 | 1166 | ||
1160 | static int fb_getput_cmap(struct inode *inode, struct file *file, | 1167 | static int fb_getput_cmap(struct fb_info *info, unsigned int cmd, |
1161 | unsigned int cmd, unsigned long arg) | 1168 | unsigned long arg) |
1162 | { | 1169 | { |
1163 | struct fb_cmap_user __user *cmap; | 1170 | struct fb_cmap_user __user *cmap; |
1164 | struct fb_cmap32 __user *cmap32; | 1171 | struct fb_cmap32 __user *cmap32; |
@@ -1181,7 +1188,7 @@ static int fb_getput_cmap(struct inode *inode, struct file *file, | |||
1181 | put_user(compat_ptr(data), &cmap->transp)) | 1188 | put_user(compat_ptr(data), &cmap->transp)) |
1182 | return -EFAULT; | 1189 | return -EFAULT; |
1183 | 1190 | ||
1184 | err = fb_ioctl(file, cmd, (unsigned long) cmap); | 1191 | err = do_fb_ioctl(info, cmd, (unsigned long) cmap); |
1185 | 1192 | ||
1186 | if (!err) { | 1193 | if (!err) { |
1187 | if (copy_in_user(&cmap32->start, | 1194 | if (copy_in_user(&cmap32->start, |
@@ -1223,8 +1230,8 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix, | |||
1223 | return err; | 1230 | return err; |
1224 | } | 1231 | } |
1225 | 1232 | ||
1226 | static int fb_get_fscreeninfo(struct inode *inode, struct file *file, | 1233 | static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, |
1227 | unsigned int cmd, unsigned long arg) | 1234 | unsigned long arg) |
1228 | { | 1235 | { |
1229 | mm_segment_t old_fs; | 1236 | mm_segment_t old_fs; |
1230 | struct fb_fix_screeninfo fix; | 1237 | struct fb_fix_screeninfo fix; |
@@ -1235,7 +1242,7 @@ static int fb_get_fscreeninfo(struct inode *inode, struct file *file, | |||
1235 | 1242 | ||
1236 | old_fs = get_fs(); | 1243 | old_fs = get_fs(); |
1237 | set_fs(KERNEL_DS); | 1244 | set_fs(KERNEL_DS); |
1238 | err = fb_ioctl(file, cmd, (unsigned long) &fix); | 1245 | err = do_fb_ioctl(info, cmd, (unsigned long) &fix); |
1239 | set_fs(old_fs); | 1246 | set_fs(old_fs); |
1240 | 1247 | ||
1241 | if (!err) | 1248 | if (!err) |
@@ -1244,8 +1251,10 @@ static int fb_get_fscreeninfo(struct inode *inode, struct file *file, | |||
1244 | return err; | 1251 | return err; |
1245 | } | 1252 | } |
1246 | 1253 | ||
1247 | static long | 1254 | static long fb_compat_ioctl(struct file *file, unsigned int cmd, |
1248 | fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 1255 | unsigned long arg) |
1256 | __acquires(&info->lock) | ||
1257 | __releases(&info->lock) | ||
1249 | { | 1258 | { |
1250 | struct inode *inode = file->f_path.dentry->d_inode; | 1259 | struct inode *inode = file->f_path.dentry->d_inode; |
1251 | int fbidx = iminor(inode); | 1260 | int fbidx = iminor(inode); |
@@ -1262,16 +1271,16 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1262 | case FBIOPUT_CON2FBMAP: | 1271 | case FBIOPUT_CON2FBMAP: |
1263 | arg = (unsigned long) compat_ptr(arg); | 1272 | arg = (unsigned long) compat_ptr(arg); |
1264 | case FBIOBLANK: | 1273 | case FBIOBLANK: |
1265 | ret = fb_ioctl(file, cmd, arg); | 1274 | ret = do_fb_ioctl(info, cmd, arg); |
1266 | break; | 1275 | break; |
1267 | 1276 | ||
1268 | case FBIOGET_FSCREENINFO: | 1277 | case FBIOGET_FSCREENINFO: |
1269 | ret = fb_get_fscreeninfo(inode, file, cmd, arg); | 1278 | ret = fb_get_fscreeninfo(info, cmd, arg); |
1270 | break; | 1279 | break; |
1271 | 1280 | ||
1272 | case FBIOGETCMAP: | 1281 | case FBIOGETCMAP: |
1273 | case FBIOPUTCMAP: | 1282 | case FBIOPUTCMAP: |
1274 | ret = fb_getput_cmap(inode, file, cmd, arg); | 1283 | ret = fb_getput_cmap(info, cmd, arg); |
1275 | break; | 1284 | break; |
1276 | 1285 | ||
1277 | default: | 1286 | default: |
@@ -1286,6 +1295,8 @@ fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1286 | 1295 | ||
1287 | static int | 1296 | static int |
1288 | fb_mmap(struct file *file, struct vm_area_struct * vma) | 1297 | fb_mmap(struct file *file, struct vm_area_struct * vma) |
1298 | __acquires(&info->lock) | ||
1299 | __releases(&info->lock) | ||
1289 | { | 1300 | { |
1290 | int fbidx = iminor(file->f_path.dentry->d_inode); | 1301 | int fbidx = iminor(file->f_path.dentry->d_inode); |
1291 | struct fb_info *info = registered_fb[fbidx]; | 1302 | struct fb_info *info = registered_fb[fbidx]; |
@@ -1339,6 +1350,8 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) | |||
1339 | 1350 | ||
1340 | static int | 1351 | static int |
1341 | fb_open(struct inode *inode, struct file *file) | 1352 | fb_open(struct inode *inode, struct file *file) |
1353 | __acquires(&info->lock) | ||
1354 | __releases(&info->lock) | ||
1342 | { | 1355 | { |
1343 | int fbidx = iminor(inode); | 1356 | int fbidx = iminor(inode); |
1344 | struct fb_info *info; | 1357 | struct fb_info *info; |
@@ -1374,6 +1387,8 @@ out: | |||
1374 | 1387 | ||
1375 | static int | 1388 | static int |
1376 | fb_release(struct inode *inode, struct file *file) | 1389 | fb_release(struct inode *inode, struct file *file) |
1390 | __acquires(&info->lock) | ||
1391 | __releases(&info->lock) | ||
1377 | { | 1392 | { |
1378 | struct fb_info * const info = file->private_data; | 1393 | struct fb_info * const info = file->private_data; |
1379 | 1394 | ||
diff --git a/drivers/video/mb862xx/Makefile b/drivers/video/mb862xx/Makefile new file mode 100644 index 000000000000..07664814bb1d --- /dev/null +++ b/drivers/video/mb862xx/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the MB862xx framebuffer driver | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_FB_MB862XX) := mb862xxfb.o | ||
diff --git a/drivers/video/mb862xx/mb862xx_reg.h b/drivers/video/mb862xx/mb862xx_reg.h new file mode 100644 index 000000000000..2ba65e118500 --- /dev/null +++ b/drivers/video/mb862xx/mb862xx_reg.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Fujitsu MB862xx Graphics Controller Registers/Bits | ||
3 | */ | ||
4 | |||
5 | #ifndef _MB862XX_REG_H | ||
6 | #define _MB862XX_REG_H | ||
7 | |||
8 | #ifdef MB862XX_MMIO_BOTTOM | ||
9 | #define MB862XX_MMIO_BASE 0x03fc0000 | ||
10 | #else | ||
11 | #define MB862XX_MMIO_BASE 0x01fc0000 | ||
12 | #endif | ||
13 | #define MB862XX_I2C_BASE 0x0000c000 | ||
14 | #define MB862XX_DISP_BASE 0x00010000 | ||
15 | #define MB862XX_CAP_BASE 0x00018000 | ||
16 | #define MB862XX_DRAW_BASE 0x00030000 | ||
17 | #define MB862XX_GEO_BASE 0x00038000 | ||
18 | #define MB862XX_PIO_BASE 0x00038000 | ||
19 | #define MB862XX_MMIO_SIZE 0x40000 | ||
20 | |||
21 | /* Host interface/pio registers */ | ||
22 | #define GC_IST 0x00000020 | ||
23 | #define GC_IMASK 0x00000024 | ||
24 | #define GC_SRST 0x0000002c | ||
25 | #define GC_CCF 0x00000038 | ||
26 | #define GC_CID 0x000000f0 | ||
27 | #define GC_REVISION 0x00000084 | ||
28 | |||
29 | #define GC_CCF_CGE_100 0x00000000 | ||
30 | #define GC_CCF_CGE_133 0x00040000 | ||
31 | #define GC_CCF_CGE_166 0x00080000 | ||
32 | #define GC_CCF_COT_100 0x00000000 | ||
33 | #define GC_CCF_COT_133 0x00010000 | ||
34 | #define GC_CID_CNAME_MSK 0x0000ff00 | ||
35 | #define GC_CID_VERSION_MSK 0x000000ff | ||
36 | |||
37 | /* define enabled interrupts hereby */ | ||
38 | #define GC_INT_EN 0x00000000 | ||
39 | |||
40 | /* Memory interface mode register */ | ||
41 | #define GC_MMR 0x0000fffc | ||
42 | |||
43 | /* Display Controller registers */ | ||
44 | #define GC_DCM0 0x00000000 | ||
45 | #define GC_HTP 0x00000004 | ||
46 | #define GC_HDB_HDP 0x00000008 | ||
47 | #define GC_VSW_HSW_HSP 0x0000000c | ||
48 | #define GC_VTR 0x00000010 | ||
49 | #define GC_VDP_VSP 0x00000014 | ||
50 | #define GC_WY_WX 0x00000018 | ||
51 | #define GC_WH_WW 0x0000001c | ||
52 | #define GC_L0M 0x00000020 | ||
53 | #define GC_L0OA0 0x00000024 | ||
54 | #define GC_L0DA0 0x00000028 | ||
55 | #define GC_L0DY_L0DX 0x0000002c | ||
56 | #define GC_DCM1 0x00000100 | ||
57 | #define GC_L0EM 0x00000110 | ||
58 | #define GC_L0WY_L0WX 0x00000114 | ||
59 | #define GC_L0WH_L0WW 0x00000118 | ||
60 | #define GC_DCM2 0x00000104 | ||
61 | #define GC_DCM3 0x00000108 | ||
62 | #define GC_CPM_CUTC 0x000000a0 | ||
63 | #define GC_CUOA0 0x000000a4 | ||
64 | #define GC_CUY0_CUX0 0x000000a8 | ||
65 | #define GC_CUOA1 0x000000ac | ||
66 | #define GC_CUY1_CUX1 0x000000b0 | ||
67 | #define GC_L0PAL0 0x00000400 | ||
68 | |||
69 | #define GC_CPM_CEN0 0x00100000 | ||
70 | #define GC_CPM_CEN1 0x00200000 | ||
71 | |||
72 | #define GC_DCM01_ESY 0x00000004 | ||
73 | #define GC_DCM01_SC 0x00003f00 | ||
74 | #define GC_DCM01_RESV 0x00004000 | ||
75 | #define GC_DCM01_CKS 0x00008000 | ||
76 | #define GC_DCM01_L0E 0x00010000 | ||
77 | #define GC_DCM01_DEN 0x80000000 | ||
78 | #define GC_L0M_L0C_8 0x00000000 | ||
79 | #define GC_L0M_L0C_16 0x80000000 | ||
80 | #define GC_L0EM_L0EC_24 0x40000000 | ||
81 | #define GC_L0M_L0W_UNIT 64 | ||
82 | |||
83 | #define GC_DISP_REFCLK_400 400 | ||
84 | |||
85 | /* Carmine specific */ | ||
86 | #define MB86297_DRAW_BASE 0x00020000 | ||
87 | #define MB86297_DISP0_BASE 0x00100000 | ||
88 | #define MB86297_DISP1_BASE 0x00140000 | ||
89 | #define MB86297_WRBACK_BASE 0x00180000 | ||
90 | #define MB86297_CAP0_BASE 0x00200000 | ||
91 | #define MB86297_CAP1_BASE 0x00280000 | ||
92 | #define MB86297_DRAMCTRL_BASE 0x00300000 | ||
93 | #define MB86297_CTRL_BASE 0x00400000 | ||
94 | #define MB86297_I2C_BASE 0x00500000 | ||
95 | |||
96 | #define GC_CTRL_STATUS 0x00000000 | ||
97 | #define GC_CTRL_INT_MASK 0x00000004 | ||
98 | #define GC_CTRL_CLK_ENABLE 0x0000000c | ||
99 | #define GC_CTRL_SOFT_RST 0x00000010 | ||
100 | |||
101 | #define GC_CTRL_CLK_EN_DRAM 0x00000001 | ||
102 | #define GC_CTRL_CLK_EN_2D3D 0x00000002 | ||
103 | #define GC_CTRL_CLK_EN_DISP0 0x00000020 | ||
104 | #define GC_CTRL_CLK_EN_DISP1 0x00000040 | ||
105 | |||
106 | #define GC_2D3D_REV 0x000004b4 | ||
107 | #define GC_RE_REVISION 0x24240200 | ||
108 | |||
109 | /* define enabled interrupts hereby */ | ||
110 | #define GC_CARMINE_INT_EN 0x00000004 | ||
111 | |||
112 | /* DRAM controller */ | ||
113 | #define GC_DCTL_MODE_ADD 0x00000000 | ||
114 | #define GC_DCTL_SETTIME1_EMODE 0x00000004 | ||
115 | #define GC_DCTL_REFRESH_SETTIME2 0x00000008 | ||
116 | #define GC_DCTL_RSV0_STATES 0x0000000C | ||
117 | #define GC_DCTL_RSV2_RSV1 0x00000010 | ||
118 | #define GC_DCTL_DDRIF2_DDRIF1 0x00000014 | ||
119 | #define GC_DCTL_IOCONT1_IOCONT0 0x00000024 | ||
120 | |||
121 | #define GC_DCTL_STATES_MSK 0x0000000f | ||
122 | #define GC_DCTL_INIT_WAIT_CNT 3000 | ||
123 | #define GC_DCTL_INIT_WAIT_INTERVAL 1 | ||
124 | |||
125 | /* DRAM ctrl values for Carmine PCI Eval. board */ | ||
126 | #define GC_EVB_DCTL_MODE_ADD 0x012105c3 | ||
127 | #define GC_EVB_DCTL_MODE_ADD_AFT_RST 0x002105c3 | ||
128 | #define GC_EVB_DCTL_SETTIME1_EMODE 0x47498000 | ||
129 | #define GC_EVB_DCTL_REFRESH_SETTIME2 0x00422a22 | ||
130 | #define GC_EVB_DCTL_RSV0_STATES 0x00200003 | ||
131 | #define GC_EVB_DCTL_RSV0_STATES_AFT_RST 0x00200002 | ||
132 | #define GC_EVB_DCTL_RSV2_RSV1 0x0000000f | ||
133 | #define GC_EVB_DCTL_DDRIF2_DDRIF1 0x00556646 | ||
134 | #define GC_EVB_DCTL_IOCONT1_IOCONT0 0x05550555 | ||
135 | |||
136 | #define GC_DISP_REFCLK_533 533 | ||
137 | |||
138 | #endif | ||
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c new file mode 100644 index 000000000000..38718d95fbb9 --- /dev/null +++ b/drivers/video/mb862xx/mb862xxfb.c | |||
@@ -0,0 +1,1061 @@ | |||
1 | /* | ||
2 | * drivers/mb862xx/mb862xxfb.c | ||
3 | * | ||
4 | * Fujitsu Carmine/Coral-P(A)/Lime framebuffer driver | ||
5 | * | ||
6 | * (C) 2008 Anatolij Gustschin <agust@denx.de> | ||
7 | * DENX Software Engineering | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #undef DEBUG | ||
16 | |||
17 | #include <linux/fb.h> | ||
18 | #include <linux/delay.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/pci.h> | ||
22 | #if defined(CONFIG_PPC_OF) | ||
23 | #include <linux/of_platform.h> | ||
24 | #endif | ||
25 | #include "mb862xxfb.h" | ||
26 | #include "mb862xx_reg.h" | ||
27 | |||
28 | #define NR_PALETTE 256 | ||
29 | #define MB862XX_MEM_SIZE 0x1000000 | ||
30 | #define CORALP_MEM_SIZE 0x4000000 | ||
31 | #define CARMINE_MEM_SIZE 0x8000000 | ||
32 | #define DRV_NAME "mb862xxfb" | ||
33 | |||
34 | #if defined(CONFIG_LWMON5) | ||
35 | static struct mb862xx_gc_mode lwmon5_gc_mode = { | ||
36 | /* Mode for Sharp LQ104V1DG61 TFT LCD Panel */ | ||
37 | { "640x480", 60, 640, 480, 40000, 48, 16, 32, 11, 96, 2, 0, 0, 0 }, | ||
38 | /* 16 bits/pixel, 32MB, 100MHz, SDRAM memory mode value */ | ||
39 | 16, 0x2000000, GC_CCF_COT_100, 0x414fb7f2 | ||
40 | }; | ||
41 | #endif | ||
42 | |||
43 | #if defined(CONFIG_SOCRATES) | ||
44 | static struct mb862xx_gc_mode socrates_gc_mode = { | ||
45 | /* Mode for Prime View PM070WL4 TFT LCD Panel */ | ||
46 | { "800x480", 45, 800, 480, 40000, 86, 42, 33, 10, 128, 2, 0, 0, 0 }, | ||
47 | /* 16 bits/pixel, 16MB, 133MHz, SDRAM memory mode value */ | ||
48 | 16, 0x1000000, GC_CCF_COT_133, 0x4157ba63 | ||
49 | }; | ||
50 | #endif | ||
51 | |||
52 | /* Helpers */ | ||
53 | static inline int h_total(struct fb_var_screeninfo *var) | ||
54 | { | ||
55 | return var->xres + var->left_margin + | ||
56 | var->right_margin + var->hsync_len; | ||
57 | } | ||
58 | |||
59 | static inline int v_total(struct fb_var_screeninfo *var) | ||
60 | { | ||
61 | return var->yres + var->upper_margin + | ||
62 | var->lower_margin + var->vsync_len; | ||
63 | } | ||
64 | |||
65 | static inline int hsp(struct fb_var_screeninfo *var) | ||
66 | { | ||
67 | return var->xres + var->right_margin - 1; | ||
68 | } | ||
69 | |||
70 | static inline int vsp(struct fb_var_screeninfo *var) | ||
71 | { | ||
72 | return var->yres + var->lower_margin - 1; | ||
73 | } | ||
74 | |||
75 | static inline int d_pitch(struct fb_var_screeninfo *var) | ||
76 | { | ||
77 | return var->xres * var->bits_per_pixel / 8; | ||
78 | } | ||
79 | |||
80 | static inline unsigned int chan_to_field(unsigned int chan, | ||
81 | struct fb_bitfield *bf) | ||
82 | { | ||
83 | chan &= 0xffff; | ||
84 | chan >>= 16 - bf->length; | ||
85 | return chan << bf->offset; | ||
86 | } | ||
87 | |||
88 | static int mb862xxfb_setcolreg(unsigned regno, | ||
89 | unsigned red, unsigned green, unsigned blue, | ||
90 | unsigned transp, struct fb_info *info) | ||
91 | { | ||
92 | struct mb862xxfb_par *par = info->par; | ||
93 | unsigned int val; | ||
94 | |||
95 | switch (info->fix.visual) { | ||
96 | case FB_VISUAL_TRUECOLOR: | ||
97 | if (regno < 16) { | ||
98 | val = chan_to_field(red, &info->var.red); | ||
99 | val |= chan_to_field(green, &info->var.green); | ||
100 | val |= chan_to_field(blue, &info->var.blue); | ||
101 | par->pseudo_palette[regno] = val; | ||
102 | } | ||
103 | break; | ||
104 | case FB_VISUAL_PSEUDOCOLOR: | ||
105 | if (regno < 256) { | ||
106 | val = (red >> 8) << 16; | ||
107 | val |= (green >> 8) << 8; | ||
108 | val |= blue >> 8; | ||
109 | outreg(disp, GC_L0PAL0 + (regno * 4), val); | ||
110 | } | ||
111 | break; | ||
112 | default: | ||
113 | return 1; /* unsupported type */ | ||
114 | } | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static int mb862xxfb_check_var(struct fb_var_screeninfo *var, | ||
119 | struct fb_info *fbi) | ||
120 | { | ||
121 | unsigned long tmp; | ||
122 | |||
123 | if (fbi->dev) | ||
124 | dev_dbg(fbi->dev, "%s\n", __func__); | ||
125 | |||
126 | /* check if these values fit into the registers */ | ||
127 | if (var->hsync_len > 255 || var->vsync_len > 255) | ||
128 | return -EINVAL; | ||
129 | |||
130 | if ((var->xres + var->right_margin) >= 4096) | ||
131 | return -EINVAL; | ||
132 | |||
133 | if ((var->yres + var->lower_margin) > 4096) | ||
134 | return -EINVAL; | ||
135 | |||
136 | if (h_total(var) > 4096 || v_total(var) > 4096) | ||
137 | return -EINVAL; | ||
138 | |||
139 | if (var->xres_virtual > 4096 || var->yres_virtual > 4096) | ||
140 | return -EINVAL; | ||
141 | |||
142 | if (var->bits_per_pixel <= 8) | ||
143 | var->bits_per_pixel = 8; | ||
144 | else if (var->bits_per_pixel <= 16) | ||
145 | var->bits_per_pixel = 16; | ||
146 | else if (var->bits_per_pixel <= 32) | ||
147 | var->bits_per_pixel = 32; | ||
148 | |||
149 | /* | ||
150 | * can cope with 8,16 or 24/32bpp if resulting | ||
151 | * pitch is divisible by 64 without remainder | ||
152 | */ | ||
153 | if (d_pitch(&fbi->var) % GC_L0M_L0W_UNIT) { | ||
154 | int r; | ||
155 | |||
156 | var->bits_per_pixel = 0; | ||
157 | do { | ||
158 | var->bits_per_pixel += 8; | ||
159 | r = d_pitch(&fbi->var) % GC_L0M_L0W_UNIT; | ||
160 | } while (r && var->bits_per_pixel <= 32); | ||
161 | |||
162 | if (d_pitch(&fbi->var) % GC_L0M_L0W_UNIT) | ||
163 | return -EINVAL; | ||
164 | } | ||
165 | |||
166 | /* line length is going to be 128 bit aligned */ | ||
167 | tmp = (var->xres * var->bits_per_pixel) / 8; | ||
168 | if ((tmp & 15) != 0) | ||
169 | return -EINVAL; | ||
170 | |||
171 | /* set r/g/b positions and validate bpp */ | ||
172 | switch (var->bits_per_pixel) { | ||
173 | case 8: | ||
174 | var->red.length = var->bits_per_pixel; | ||
175 | var->green.length = var->bits_per_pixel; | ||
176 | var->blue.length = var->bits_per_pixel; | ||
177 | var->red.offset = 0; | ||
178 | var->green.offset = 0; | ||
179 | var->blue.offset = 0; | ||
180 | var->transp.length = 0; | ||
181 | break; | ||
182 | case 16: | ||
183 | var->red.length = 5; | ||
184 | var->green.length = 5; | ||
185 | var->blue.length = 5; | ||
186 | var->red.offset = 10; | ||
187 | var->green.offset = 5; | ||
188 | var->blue.offset = 0; | ||
189 | var->transp.length = 0; | ||
190 | break; | ||
191 | case 24: | ||
192 | case 32: | ||
193 | var->transp.length = 8; | ||
194 | var->red.length = 8; | ||
195 | var->green.length = 8; | ||
196 | var->blue.length = 8; | ||
197 | var->transp.offset = 24; | ||
198 | var->red.offset = 16; | ||
199 | var->green.offset = 8; | ||
200 | var->blue.offset = 0; | ||
201 | break; | ||
202 | default: | ||
203 | return -EINVAL; | ||
204 | } | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | /* | ||
209 | * set display parameters | ||
210 | */ | ||
211 | static int mb862xxfb_set_par(struct fb_info *fbi) | ||
212 | { | ||
213 | struct mb862xxfb_par *par = fbi->par; | ||
214 | unsigned long reg, sc; | ||
215 | |||
216 | dev_dbg(par->dev, "%s\n", __func__); | ||
217 | |||
218 | if (par->pre_init) | ||
219 | return 0; | ||
220 | |||
221 | /* disp off */ | ||
222 | reg = inreg(disp, GC_DCM1); | ||
223 | reg &= ~GC_DCM01_DEN; | ||
224 | outreg(disp, GC_DCM1, reg); | ||
225 | |||
226 | /* set display reference clock div. */ | ||
227 | sc = par->refclk / (1000000 / fbi->var.pixclock) - 1; | ||
228 | reg = inreg(disp, GC_DCM1); | ||
229 | reg &= ~(GC_DCM01_CKS | GC_DCM01_RESV | GC_DCM01_SC); | ||
230 | reg |= sc << 8; | ||
231 | outreg(disp, GC_DCM1, reg); | ||
232 | dev_dbg(par->dev, "SC 0x%lx\n", sc); | ||
233 | |||
234 | /* disp dimension, format */ | ||
235 | reg = pack(d_pitch(&fbi->var) / GC_L0M_L0W_UNIT, | ||
236 | (fbi->var.yres - 1)); | ||
237 | if (fbi->var.bits_per_pixel == 16) | ||
238 | reg |= GC_L0M_L0C_16; | ||
239 | outreg(disp, GC_L0M, reg); | ||
240 | |||
241 | if (fbi->var.bits_per_pixel == 32) { | ||
242 | reg = inreg(disp, GC_L0EM); | ||
243 | outreg(disp, GC_L0EM, reg | GC_L0EM_L0EC_24); | ||
244 | } | ||
245 | outreg(disp, GC_WY_WX, 0); | ||
246 | reg = pack(fbi->var.yres - 1, fbi->var.xres); | ||
247 | outreg(disp, GC_WH_WW, reg); | ||
248 | outreg(disp, GC_L0OA0, 0); | ||
249 | outreg(disp, GC_L0DA0, 0); | ||
250 | outreg(disp, GC_L0DY_L0DX, 0); | ||
251 | outreg(disp, GC_L0WY_L0WX, 0); | ||
252 | outreg(disp, GC_L0WH_L0WW, reg); | ||
253 | |||
254 | /* both HW-cursors off */ | ||
255 | reg = inreg(disp, GC_CPM_CUTC); | ||
256 | reg &= ~(GC_CPM_CEN0 | GC_CPM_CEN1); | ||
257 | outreg(disp, GC_CPM_CUTC, reg); | ||
258 | |||
259 | /* timings */ | ||
260 | reg = pack(fbi->var.xres - 1, fbi->var.xres - 1); | ||
261 | outreg(disp, GC_HDB_HDP, reg); | ||
262 | reg = pack((fbi->var.yres - 1), vsp(&fbi->var)); | ||
263 | outreg(disp, GC_VDP_VSP, reg); | ||
264 | reg = ((fbi->var.vsync_len - 1) << 24) | | ||
265 | pack((fbi->var.hsync_len - 1), hsp(&fbi->var)); | ||
266 | outreg(disp, GC_VSW_HSW_HSP, reg); | ||
267 | outreg(disp, GC_HTP, pack(h_total(&fbi->var) - 1, 0)); | ||
268 | outreg(disp, GC_VTR, pack(v_total(&fbi->var) - 1, 0)); | ||
269 | |||
270 | /* display on */ | ||
271 | reg = inreg(disp, GC_DCM1); | ||
272 | reg |= GC_DCM01_DEN | GC_DCM01_L0E; | ||
273 | reg &= ~GC_DCM01_ESY; | ||
274 | outreg(disp, GC_DCM1, reg); | ||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static int mb862xxfb_pan(struct fb_var_screeninfo *var, | ||
279 | struct fb_info *info) | ||
280 | { | ||
281 | struct mb862xxfb_par *par = info->par; | ||
282 | unsigned long reg; | ||
283 | |||
284 | reg = pack(var->yoffset, var->xoffset); | ||
285 | outreg(disp, GC_L0WY_L0WX, reg); | ||
286 | |||
287 | reg = pack(var->yres_virtual, var->xres_virtual); | ||
288 | outreg(disp, GC_L0WH_L0WW, reg); | ||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | static int mb862xxfb_blank(int mode, struct fb_info *fbi) | ||
293 | { | ||
294 | struct mb862xxfb_par *par = fbi->par; | ||
295 | unsigned long reg; | ||
296 | |||
297 | dev_dbg(fbi->dev, "blank mode=%d\n", mode); | ||
298 | |||
299 | switch (mode) { | ||
300 | case FB_BLANK_POWERDOWN: | ||
301 | reg = inreg(disp, GC_DCM1); | ||
302 | reg &= ~GC_DCM01_DEN; | ||
303 | outreg(disp, GC_DCM1, reg); | ||
304 | break; | ||
305 | case FB_BLANK_UNBLANK: | ||
306 | reg = inreg(disp, GC_DCM1); | ||
307 | reg |= GC_DCM01_DEN; | ||
308 | outreg(disp, GC_DCM1, reg); | ||
309 | break; | ||
310 | case FB_BLANK_NORMAL: | ||
311 | case FB_BLANK_VSYNC_SUSPEND: | ||
312 | case FB_BLANK_HSYNC_SUSPEND: | ||
313 | default: | ||
314 | return 1; | ||
315 | } | ||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | /* framebuffer ops */ | ||
320 | static struct fb_ops mb862xxfb_ops = { | ||
321 | .owner = THIS_MODULE, | ||
322 | .fb_check_var = mb862xxfb_check_var, | ||
323 | .fb_set_par = mb862xxfb_set_par, | ||
324 | .fb_setcolreg = mb862xxfb_setcolreg, | ||
325 | .fb_blank = mb862xxfb_blank, | ||
326 | .fb_pan_display = mb862xxfb_pan, | ||
327 | .fb_fillrect = cfb_fillrect, | ||
328 | .fb_copyarea = cfb_copyarea, | ||
329 | .fb_imageblit = cfb_imageblit, | ||
330 | }; | ||
331 | |||
332 | /* initialize fb_info data */ | ||
333 | static int mb862xxfb_init_fbinfo(struct fb_info *fbi) | ||
334 | { | ||
335 | struct mb862xxfb_par *par = fbi->par; | ||
336 | struct mb862xx_gc_mode *mode = par->gc_mode; | ||
337 | unsigned long reg; | ||
338 | |||
339 | fbi->fbops = &mb862xxfb_ops; | ||
340 | fbi->pseudo_palette = par->pseudo_palette; | ||
341 | fbi->screen_base = par->fb_base; | ||
342 | fbi->screen_size = par->mapped_vram; | ||
343 | |||
344 | strcpy(fbi->fix.id, DRV_NAME); | ||
345 | fbi->fix.smem_start = (unsigned long)par->fb_base_phys; | ||
346 | fbi->fix.smem_len = par->mapped_vram; | ||
347 | fbi->fix.mmio_start = (unsigned long)par->mmio_base_phys; | ||
348 | fbi->fix.mmio_len = par->mmio_len; | ||
349 | fbi->fix.accel = FB_ACCEL_NONE; | ||
350 | fbi->fix.type = FB_TYPE_PACKED_PIXELS; | ||
351 | fbi->fix.type_aux = 0; | ||
352 | fbi->fix.xpanstep = 1; | ||
353 | fbi->fix.ypanstep = 1; | ||
354 | fbi->fix.ywrapstep = 0; | ||
355 | |||
356 | reg = inreg(disp, GC_DCM1); | ||
357 | if (reg & GC_DCM01_DEN && reg & GC_DCM01_L0E) { | ||
358 | /* get the disp mode from active display cfg */ | ||
359 | unsigned long sc = ((reg & GC_DCM01_SC) >> 8) + 1; | ||
360 | unsigned long hsp, vsp, ht, vt; | ||
361 | |||
362 | dev_dbg(par->dev, "using bootloader's disp. mode\n"); | ||
363 | fbi->var.pixclock = (sc * 1000000) / par->refclk; | ||
364 | fbi->var.xres = (inreg(disp, GC_HDB_HDP) & 0x0fff) + 1; | ||
365 | reg = inreg(disp, GC_VDP_VSP); | ||
366 | fbi->var.yres = ((reg >> 16) & 0x0fff) + 1; | ||
367 | vsp = (reg & 0x0fff) + 1; | ||
368 | fbi->var.xres_virtual = fbi->var.xres; | ||
369 | fbi->var.yres_virtual = fbi->var.yres; | ||
370 | reg = inreg(disp, GC_L0EM); | ||
371 | if (reg & GC_L0EM_L0EC_24) { | ||
372 | fbi->var.bits_per_pixel = 32; | ||
373 | } else { | ||
374 | reg = inreg(disp, GC_L0M); | ||
375 | if (reg & GC_L0M_L0C_16) | ||
376 | fbi->var.bits_per_pixel = 16; | ||
377 | else | ||
378 | fbi->var.bits_per_pixel = 8; | ||
379 | } | ||
380 | reg = inreg(disp, GC_VSW_HSW_HSP); | ||
381 | fbi->var.hsync_len = ((reg & 0xff0000) >> 16) + 1; | ||
382 | fbi->var.vsync_len = ((reg & 0x3f000000) >> 24) + 1; | ||
383 | hsp = (reg & 0xffff) + 1; | ||
384 | ht = ((inreg(disp, GC_HTP) & 0xfff0000) >> 16) + 1; | ||
385 | fbi->var.right_margin = hsp - fbi->var.xres; | ||
386 | fbi->var.left_margin = ht - hsp - fbi->var.hsync_len; | ||
387 | vt = ((inreg(disp, GC_VTR) & 0xfff0000) >> 16) + 1; | ||
388 | fbi->var.lower_margin = vsp - fbi->var.yres; | ||
389 | fbi->var.upper_margin = vt - vsp - fbi->var.vsync_len; | ||
390 | } else if (mode) { | ||
391 | dev_dbg(par->dev, "using supplied mode\n"); | ||
392 | fb_videomode_to_var(&fbi->var, (struct fb_videomode *)mode); | ||
393 | fbi->var.bits_per_pixel = mode->def_bpp ? mode->def_bpp : 8; | ||
394 | } else { | ||
395 | int ret; | ||
396 | |||
397 | ret = fb_find_mode(&fbi->var, fbi, "640x480-16@60", | ||
398 | NULL, 0, NULL, 16); | ||
399 | if (ret == 0 || ret == 4) { | ||
400 | dev_err(par->dev, | ||
401 | "failed to get initial mode\n"); | ||
402 | return -EINVAL; | ||
403 | } | ||
404 | } | ||
405 | |||
406 | fbi->var.xoffset = 0; | ||
407 | fbi->var.yoffset = 0; | ||
408 | fbi->var.grayscale = 0; | ||
409 | fbi->var.nonstd = 0; | ||
410 | fbi->var.height = -1; | ||
411 | fbi->var.width = -1; | ||
412 | fbi->var.accel_flags = 0; | ||
413 | fbi->var.vmode = FB_VMODE_NONINTERLACED; | ||
414 | fbi->var.activate = FB_ACTIVATE_NOW; | ||
415 | fbi->flags = FBINFO_DEFAULT | | ||
416 | #ifdef __BIG_ENDIAN | ||
417 | FBINFO_FOREIGN_ENDIAN | | ||
418 | #endif | ||
419 | FBINFO_HWACCEL_XPAN | | ||
420 | FBINFO_HWACCEL_YPAN; | ||
421 | |||
422 | /* check and possibly fix bpp */ | ||
423 | if ((fbi->fbops->fb_check_var)(&fbi->var, fbi)) | ||
424 | dev_err(par->dev, "check_var() failed on initial setup?\n"); | ||
425 | |||
426 | fbi->fix.visual = fbi->var.bits_per_pixel == 8 ? | ||
427 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | ||
428 | fbi->fix.line_length = (fbi->var.xres_virtual * | ||
429 | fbi->var.bits_per_pixel) / 8; | ||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | /* | ||
434 | * show some display controller and cursor registers | ||
435 | */ | ||
436 | static ssize_t mb862xxfb_show_dispregs(struct device *dev, | ||
437 | struct device_attribute *attr, char *buf) | ||
438 | { | ||
439 | struct fb_info *fbi = dev_get_drvdata(dev); | ||
440 | struct mb862xxfb_par *par = fbi->par; | ||
441 | char *ptr = buf; | ||
442 | unsigned int reg; | ||
443 | |||
444 | for (reg = GC_DCM0; reg <= GC_L0DY_L0DX; reg += 4) | ||
445 | ptr += sprintf(ptr, "%08x = %08x\n", | ||
446 | reg, inreg(disp, reg)); | ||
447 | |||
448 | for (reg = GC_CPM_CUTC; reg <= GC_CUY1_CUX1; reg += 4) | ||
449 | ptr += sprintf(ptr, "%08x = %08x\n", | ||
450 | reg, inreg(disp, reg)); | ||
451 | |||
452 | for (reg = GC_DCM1; reg <= GC_L0WH_L0WW; reg += 4) | ||
453 | ptr += sprintf(ptr, "%08x = %08x\n", | ||
454 | reg, inreg(disp, reg)); | ||
455 | |||
456 | return ptr - buf; | ||
457 | } | ||
458 | |||
459 | static DEVICE_ATTR(dispregs, 0444, mb862xxfb_show_dispregs, NULL); | ||
460 | |||
461 | irqreturn_t mb862xx_intr(int irq, void *dev_id) | ||
462 | { | ||
463 | struct mb862xxfb_par *par = (struct mb862xxfb_par *) dev_id; | ||
464 | unsigned long reg_ist, mask; | ||
465 | |||
466 | if (!par) | ||
467 | return IRQ_NONE; | ||
468 | |||
469 | if (par->type == BT_CARMINE) { | ||
470 | /* Get Interrupt Status */ | ||
471 | reg_ist = inreg(ctrl, GC_CTRL_STATUS); | ||
472 | mask = inreg(ctrl, GC_CTRL_INT_MASK); | ||
473 | if (reg_ist == 0) | ||
474 | return IRQ_HANDLED; | ||
475 | |||
476 | reg_ist &= mask; | ||
477 | if (reg_ist == 0) | ||
478 | return IRQ_HANDLED; | ||
479 | |||
480 | /* Clear interrupt status */ | ||
481 | outreg(ctrl, 0x0, reg_ist); | ||
482 | } else { | ||
483 | /* Get status */ | ||
484 | reg_ist = inreg(host, GC_IST); | ||
485 | mask = inreg(host, GC_IMASK); | ||
486 | |||
487 | reg_ist &= mask; | ||
488 | if (reg_ist == 0) | ||
489 | return IRQ_HANDLED; | ||
490 | |||
491 | /* Clear status */ | ||
492 | outreg(host, GC_IST, ~reg_ist); | ||
493 | } | ||
494 | return IRQ_HANDLED; | ||
495 | } | ||
496 | |||
497 | #if defined(CONFIG_FB_MB862XX_LIME) | ||
498 | /* | ||
499 | * GDC (Lime, Coral(B/Q), Mint, ...) on host bus | ||
500 | */ | ||
501 | static int mb862xx_gdc_init(struct mb862xxfb_par *par) | ||
502 | { | ||
503 | unsigned long ccf, mmr; | ||
504 | unsigned long ver, rev; | ||
505 | |||
506 | if (!par) | ||
507 | return -ENODEV; | ||
508 | |||
509 | #if defined(CONFIG_FB_PRE_INIT_FB) | ||
510 | par->pre_init = 1; | ||
511 | #endif | ||
512 | par->host = par->mmio_base; | ||
513 | par->i2c = par->mmio_base + MB862XX_I2C_BASE; | ||
514 | par->disp = par->mmio_base + MB862XX_DISP_BASE; | ||
515 | par->cap = par->mmio_base + MB862XX_CAP_BASE; | ||
516 | par->draw = par->mmio_base + MB862XX_DRAW_BASE; | ||
517 | par->geo = par->mmio_base + MB862XX_GEO_BASE; | ||
518 | par->pio = par->mmio_base + MB862XX_PIO_BASE; | ||
519 | |||
520 | par->refclk = GC_DISP_REFCLK_400; | ||
521 | |||
522 | ver = inreg(host, GC_CID); | ||
523 | rev = inreg(pio, GC_REVISION); | ||
524 | if ((ver == 0x303) && (rev & 0xffffff00) == 0x20050100) { | ||
525 | dev_info(par->dev, "Fujitsu Lime v1.%d found\n", | ||
526 | (int)rev & 0xff); | ||
527 | par->type = BT_LIME; | ||
528 | ccf = par->gc_mode ? par->gc_mode->ccf : GC_CCF_COT_100; | ||
529 | mmr = par->gc_mode ? par->gc_mode->mmr : 0x414fb7f2; | ||
530 | } else { | ||
531 | dev_info(par->dev, "? GDC, CID/Rev.: 0x%lx/0x%lx \n", ver, rev); | ||
532 | return -ENODEV; | ||
533 | } | ||
534 | |||
535 | if (!par->pre_init) { | ||
536 | outreg(host, GC_CCF, ccf); | ||
537 | udelay(200); | ||
538 | outreg(host, GC_MMR, mmr); | ||
539 | udelay(10); | ||
540 | } | ||
541 | |||
542 | /* interrupt status */ | ||
543 | outreg(host, GC_IST, 0); | ||
544 | outreg(host, GC_IMASK, GC_INT_EN); | ||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | static int __devinit of_platform_mb862xx_probe(struct of_device *ofdev, | ||
549 | const struct of_device_id *id) | ||
550 | { | ||
551 | struct device_node *np = ofdev->node; | ||
552 | struct device *dev = &ofdev->dev; | ||
553 | struct mb862xxfb_par *par; | ||
554 | struct fb_info *info; | ||
555 | struct resource res; | ||
556 | resource_size_t res_size; | ||
557 | unsigned long ret = -ENODEV; | ||
558 | |||
559 | if (of_address_to_resource(np, 0, &res)) { | ||
560 | dev_err(dev, "Invalid address\n"); | ||
561 | return -ENXIO; | ||
562 | } | ||
563 | |||
564 | info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev); | ||
565 | if (info == NULL) { | ||
566 | dev_err(dev, "cannot allocate framebuffer\n"); | ||
567 | return -ENOMEM; | ||
568 | } | ||
569 | |||
570 | par = info->par; | ||
571 | par->info = info; | ||
572 | par->dev = dev; | ||
573 | |||
574 | par->irq = irq_of_parse_and_map(np, 0); | ||
575 | if (par->irq == NO_IRQ) { | ||
576 | dev_err(dev, "failed to map irq\n"); | ||
577 | ret = -ENODEV; | ||
578 | goto fbrel; | ||
579 | } | ||
580 | |||
581 | res_size = 1 + res.end - res.start; | ||
582 | par->res = request_mem_region(res.start, res_size, DRV_NAME); | ||
583 | if (par->res == NULL) { | ||
584 | dev_err(dev, "Cannot claim framebuffer/mmio\n"); | ||
585 | ret = -ENXIO; | ||
586 | goto irqdisp; | ||
587 | } | ||
588 | |||
589 | #if defined(CONFIG_LWMON5) | ||
590 | par->gc_mode = &lwmon5_gc_mode; | ||
591 | #endif | ||
592 | |||
593 | #if defined(CONFIG_SOCRATES) | ||
594 | par->gc_mode = &socrates_gc_mode; | ||
595 | #endif | ||
596 | |||
597 | par->fb_base_phys = res.start; | ||
598 | par->mmio_base_phys = res.start + MB862XX_MMIO_BASE; | ||
599 | par->mmio_len = MB862XX_MMIO_SIZE; | ||
600 | if (par->gc_mode) | ||
601 | par->mapped_vram = par->gc_mode->max_vram; | ||
602 | else | ||
603 | par->mapped_vram = MB862XX_MEM_SIZE; | ||
604 | |||
605 | par->fb_base = ioremap(par->fb_base_phys, par->mapped_vram); | ||
606 | if (par->fb_base == NULL) { | ||
607 | dev_err(dev, "Cannot map framebuffer\n"); | ||
608 | goto rel_reg; | ||
609 | } | ||
610 | |||
611 | par->mmio_base = ioremap(par->mmio_base_phys, par->mmio_len); | ||
612 | if (par->mmio_base == NULL) { | ||
613 | dev_err(dev, "Cannot map registers\n"); | ||
614 | goto fb_unmap; | ||
615 | } | ||
616 | |||
617 | dev_dbg(dev, "fb phys 0x%llx 0x%lx\n", | ||
618 | (u64)par->fb_base_phys, (ulong)par->mapped_vram); | ||
619 | dev_dbg(dev, "mmio phys 0x%llx 0x%lx, (irq = %d)\n", | ||
620 | (u64)par->mmio_base_phys, (ulong)par->mmio_len, par->irq); | ||
621 | |||
622 | if (mb862xx_gdc_init(par)) | ||
623 | goto io_unmap; | ||
624 | |||
625 | if (request_irq(par->irq, mb862xx_intr, IRQF_DISABLED, | ||
626 | DRV_NAME, (void *)par)) { | ||
627 | dev_err(dev, "Cannot request irq\n"); | ||
628 | goto io_unmap; | ||
629 | } | ||
630 | |||
631 | mb862xxfb_init_fbinfo(info); | ||
632 | |||
633 | if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0) < 0) { | ||
634 | dev_err(dev, "Could not allocate cmap for fb_info.\n"); | ||
635 | goto free_irq; | ||
636 | } | ||
637 | |||
638 | if ((info->fbops->fb_set_par)(info)) | ||
639 | dev_err(dev, "set_var() failed on initial setup?\n"); | ||
640 | |||
641 | if (register_framebuffer(info)) { | ||
642 | dev_err(dev, "failed to register framebuffer\n"); | ||
643 | goto rel_cmap; | ||
644 | } | ||
645 | |||
646 | dev_set_drvdata(dev, info); | ||
647 | |||
648 | if (device_create_file(dev, &dev_attr_dispregs)) | ||
649 | dev_err(dev, "Can't create sysfs regdump file\n"); | ||
650 | return 0; | ||
651 | |||
652 | rel_cmap: | ||
653 | fb_dealloc_cmap(&info->cmap); | ||
654 | free_irq: | ||
655 | outreg(host, GC_IMASK, 0); | ||
656 | free_irq(par->irq, (void *)par); | ||
657 | io_unmap: | ||
658 | iounmap(par->mmio_base); | ||
659 | fb_unmap: | ||
660 | iounmap(par->fb_base); | ||
661 | rel_reg: | ||
662 | release_mem_region(res.start, res_size); | ||
663 | irqdisp: | ||
664 | irq_dispose_mapping(par->irq); | ||
665 | fbrel: | ||
666 | dev_set_drvdata(dev, NULL); | ||
667 | framebuffer_release(info); | ||
668 | return ret; | ||
669 | } | ||
670 | |||
671 | static int __devexit of_platform_mb862xx_remove(struct of_device *ofdev) | ||
672 | { | ||
673 | struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); | ||
674 | struct mb862xxfb_par *par = fbi->par; | ||
675 | resource_size_t res_size = 1 + par->res->end - par->res->start; | ||
676 | unsigned long reg; | ||
677 | |||
678 | dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); | ||
679 | |||
680 | /* display off */ | ||
681 | reg = inreg(disp, GC_DCM1); | ||
682 | reg &= ~(GC_DCM01_DEN | GC_DCM01_L0E); | ||
683 | outreg(disp, GC_DCM1, reg); | ||
684 | |||
685 | /* disable interrupts */ | ||
686 | outreg(host, GC_IMASK, 0); | ||
687 | |||
688 | free_irq(par->irq, (void *)par); | ||
689 | irq_dispose_mapping(par->irq); | ||
690 | |||
691 | device_remove_file(&ofdev->dev, &dev_attr_dispregs); | ||
692 | |||
693 | unregister_framebuffer(fbi); | ||
694 | fb_dealloc_cmap(&fbi->cmap); | ||
695 | |||
696 | iounmap(par->mmio_base); | ||
697 | iounmap(par->fb_base); | ||
698 | |||
699 | dev_set_drvdata(&ofdev->dev, NULL); | ||
700 | release_mem_region(par->res->start, res_size); | ||
701 | framebuffer_release(fbi); | ||
702 | return 0; | ||
703 | } | ||
704 | |||
705 | /* | ||
706 | * common types | ||
707 | */ | ||
708 | static struct of_device_id __devinitdata of_platform_mb862xx_tbl[] = { | ||
709 | { .compatible = "fujitsu,MB86276", }, | ||
710 | { .compatible = "fujitsu,lime", }, | ||
711 | { .compatible = "fujitsu,MB86277", }, | ||
712 | { .compatible = "fujitsu,mint", }, | ||
713 | { .compatible = "fujitsu,MB86293", }, | ||
714 | { .compatible = "fujitsu,MB86294", }, | ||
715 | { .compatible = "fujitsu,coral", }, | ||
716 | { /* end */ } | ||
717 | }; | ||
718 | |||
719 | static struct of_platform_driver of_platform_mb862xxfb_driver = { | ||
720 | .owner = THIS_MODULE, | ||
721 | .name = DRV_NAME, | ||
722 | .match_table = of_platform_mb862xx_tbl, | ||
723 | .probe = of_platform_mb862xx_probe, | ||
724 | .remove = __devexit_p(of_platform_mb862xx_remove), | ||
725 | }; | ||
726 | #endif | ||
727 | |||
728 | #if defined(CONFIG_FB_MB862XX_PCI_GDC) | ||
729 | static int coralp_init(struct mb862xxfb_par *par) | ||
730 | { | ||
731 | int cn, ver; | ||
732 | |||
733 | par->host = par->mmio_base; | ||
734 | par->i2c = par->mmio_base + MB862XX_I2C_BASE; | ||
735 | par->disp = par->mmio_base + MB862XX_DISP_BASE; | ||
736 | par->cap = par->mmio_base + MB862XX_CAP_BASE; | ||
737 | par->draw = par->mmio_base + MB862XX_DRAW_BASE; | ||
738 | par->geo = par->mmio_base + MB862XX_GEO_BASE; | ||
739 | par->pio = par->mmio_base + MB862XX_PIO_BASE; | ||
740 | |||
741 | par->refclk = GC_DISP_REFCLK_400; | ||
742 | |||
743 | ver = inreg(host, GC_CID); | ||
744 | cn = (ver & GC_CID_CNAME_MSK) >> 8; | ||
745 | ver = ver & GC_CID_VERSION_MSK; | ||
746 | if (cn == 3) { | ||
747 | dev_info(par->dev, "Fujitsu Coral-%s GDC Rev.%d found\n",\ | ||
748 | (ver == 6) ? "P" : (ver == 8) ? "PA" : "?", | ||
749 | par->pdev->revision); | ||
750 | outreg(host, GC_CCF, GC_CCF_CGE_166 | GC_CCF_COT_133); | ||
751 | udelay(200); | ||
752 | outreg(host, GC_MMR, GC_MMR_CORALP_EVB_VAL); | ||
753 | udelay(10); | ||
754 | /* Clear interrupt status */ | ||
755 | outreg(host, GC_IST, 0); | ||
756 | } else { | ||
757 | return -ENODEV; | ||
758 | } | ||
759 | return 0; | ||
760 | } | ||
761 | |||
762 | static int init_dram_ctrl(struct mb862xxfb_par *par) | ||
763 | { | ||
764 | unsigned long i = 0; | ||
765 | |||
766 | /* | ||
767 | * Set io mode first! Spec. says IC may be destroyed | ||
768 | * if not set to SSTL2/LVCMOS before init. | ||
769 | */ | ||
770 | outreg(dram_ctrl, GC_DCTL_IOCONT1_IOCONT0, GC_EVB_DCTL_IOCONT1_IOCONT0); | ||
771 | |||
772 | /* DRAM init */ | ||
773 | outreg(dram_ctrl, GC_DCTL_MODE_ADD, GC_EVB_DCTL_MODE_ADD); | ||
774 | outreg(dram_ctrl, GC_DCTL_SETTIME1_EMODE, GC_EVB_DCTL_SETTIME1_EMODE); | ||
775 | outreg(dram_ctrl, GC_DCTL_REFRESH_SETTIME2, | ||
776 | GC_EVB_DCTL_REFRESH_SETTIME2); | ||
777 | outreg(dram_ctrl, GC_DCTL_RSV2_RSV1, GC_EVB_DCTL_RSV2_RSV1); | ||
778 | outreg(dram_ctrl, GC_DCTL_DDRIF2_DDRIF1, GC_EVB_DCTL_DDRIF2_DDRIF1); | ||
779 | outreg(dram_ctrl, GC_DCTL_RSV0_STATES, GC_EVB_DCTL_RSV0_STATES); | ||
780 | |||
781 | /* DLL reset done? */ | ||
782 | while ((inreg(dram_ctrl, GC_DCTL_RSV0_STATES) & GC_DCTL_STATES_MSK)) { | ||
783 | udelay(GC_DCTL_INIT_WAIT_INTERVAL); | ||
784 | if (i++ > GC_DCTL_INIT_WAIT_CNT) { | ||
785 | dev_err(par->dev, "VRAM init failed.\n"); | ||
786 | return -EINVAL; | ||
787 | } | ||
788 | } | ||
789 | outreg(dram_ctrl, GC_DCTL_MODE_ADD, GC_EVB_DCTL_MODE_ADD_AFT_RST); | ||
790 | outreg(dram_ctrl, GC_DCTL_RSV0_STATES, GC_EVB_DCTL_RSV0_STATES_AFT_RST); | ||
791 | return 0; | ||
792 | } | ||
793 | |||
794 | static int carmine_init(struct mb862xxfb_par *par) | ||
795 | { | ||
796 | unsigned long reg; | ||
797 | |||
798 | par->ctrl = par->mmio_base + MB86297_CTRL_BASE; | ||
799 | par->i2c = par->mmio_base + MB86297_I2C_BASE; | ||
800 | par->disp = par->mmio_base + MB86297_DISP0_BASE; | ||
801 | par->disp1 = par->mmio_base + MB86297_DISP1_BASE; | ||
802 | par->cap = par->mmio_base + MB86297_CAP0_BASE; | ||
803 | par->cap1 = par->mmio_base + MB86297_CAP1_BASE; | ||
804 | par->draw = par->mmio_base + MB86297_DRAW_BASE; | ||
805 | par->dram_ctrl = par->mmio_base + MB86297_DRAMCTRL_BASE; | ||
806 | par->wrback = par->mmio_base + MB86297_WRBACK_BASE; | ||
807 | |||
808 | par->refclk = GC_DISP_REFCLK_533; | ||
809 | |||
810 | /* warm up */ | ||
811 | reg = GC_CTRL_CLK_EN_DRAM | GC_CTRL_CLK_EN_2D3D | GC_CTRL_CLK_EN_DISP0; | ||
812 | outreg(ctrl, GC_CTRL_CLK_ENABLE, reg); | ||
813 | |||
814 | /* check for engine module revision */ | ||
815 | if (inreg(draw, GC_2D3D_REV) == GC_RE_REVISION) | ||
816 | dev_info(par->dev, "Fujitsu Carmine GDC Rev.%d found\n", | ||
817 | par->pdev->revision); | ||
818 | else | ||
819 | goto err_init; | ||
820 | |||
821 | reg &= ~GC_CTRL_CLK_EN_2D3D; | ||
822 | outreg(ctrl, GC_CTRL_CLK_ENABLE, reg); | ||
823 | |||
824 | /* set up vram */ | ||
825 | if (init_dram_ctrl(par) < 0) | ||
826 | goto err_init; | ||
827 | |||
828 | outreg(ctrl, GC_CTRL_INT_MASK, 0); | ||
829 | return 0; | ||
830 | |||
831 | err_init: | ||
832 | outreg(ctrl, GC_CTRL_CLK_ENABLE, 0); | ||
833 | return -EINVAL; | ||
834 | } | ||
835 | |||
836 | static inline int mb862xx_pci_gdc_init(struct mb862xxfb_par *par) | ||
837 | { | ||
838 | switch (par->type) { | ||
839 | case BT_CORALP: | ||
840 | return coralp_init(par); | ||
841 | case BT_CARMINE: | ||
842 | return carmine_init(par); | ||
843 | default: | ||
844 | return -ENODEV; | ||
845 | } | ||
846 | } | ||
847 | |||
848 | #define CHIP_ID(id) \ | ||
849 | { PCI_DEVICE(PCI_VENDOR_ID_FUJITSU_LIMITED, id) } | ||
850 | |||
851 | static struct pci_device_id mb862xx_pci_tbl[] __devinitdata = { | ||
852 | /* MB86295/MB86296 */ | ||
853 | CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALP), | ||
854 | CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALPA), | ||
855 | /* MB86297 */ | ||
856 | CHIP_ID(PCI_DEVICE_ID_FUJITSU_CARMINE), | ||
857 | { 0, } | ||
858 | }; | ||
859 | |||
860 | MODULE_DEVICE_TABLE(pci, mb862xx_pci_tbl); | ||
861 | |||
862 | static int __devinit mb862xx_pci_probe(struct pci_dev *pdev, | ||
863 | const struct pci_device_id *ent) | ||
864 | { | ||
865 | struct mb862xxfb_par *par; | ||
866 | struct fb_info *info; | ||
867 | struct device *dev = &pdev->dev; | ||
868 | int ret; | ||
869 | |||
870 | ret = pci_enable_device(pdev); | ||
871 | if (ret < 0) { | ||
872 | dev_err(dev, "Cannot enable PCI device\n"); | ||
873 | goto out; | ||
874 | } | ||
875 | |||
876 | info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev); | ||
877 | if (!info) { | ||
878 | dev_err(dev, "framebuffer alloc failed\n"); | ||
879 | ret = -ENOMEM; | ||
880 | goto dis_dev; | ||
881 | } | ||
882 | |||
883 | par = info->par; | ||
884 | par->info = info; | ||
885 | par->dev = dev; | ||
886 | par->pdev = pdev; | ||
887 | par->irq = pdev->irq; | ||
888 | |||
889 | ret = pci_request_regions(pdev, DRV_NAME); | ||
890 | if (ret < 0) { | ||
891 | dev_err(dev, "Cannot reserve region(s) for PCI device\n"); | ||
892 | goto rel_fb; | ||
893 | } | ||
894 | |||
895 | switch (pdev->device) { | ||
896 | case PCI_DEVICE_ID_FUJITSU_CORALP: | ||
897 | case PCI_DEVICE_ID_FUJITSU_CORALPA: | ||
898 | par->fb_base_phys = pci_resource_start(par->pdev, 0); | ||
899 | par->mapped_vram = CORALP_MEM_SIZE; | ||
900 | par->mmio_base_phys = par->fb_base_phys + MB862XX_MMIO_BASE; | ||
901 | par->mmio_len = MB862XX_MMIO_SIZE; | ||
902 | par->type = BT_CORALP; | ||
903 | break; | ||
904 | case PCI_DEVICE_ID_FUJITSU_CARMINE: | ||
905 | par->fb_base_phys = pci_resource_start(par->pdev, 2); | ||
906 | par->mmio_base_phys = pci_resource_start(par->pdev, 3); | ||
907 | par->mmio_len = pci_resource_len(par->pdev, 3); | ||
908 | par->mapped_vram = CARMINE_MEM_SIZE; | ||
909 | par->type = BT_CARMINE; | ||
910 | break; | ||
911 | default: | ||
912 | /* should never occur */ | ||
913 | goto rel_reg; | ||
914 | } | ||
915 | |||
916 | par->fb_base = ioremap(par->fb_base_phys, par->mapped_vram); | ||
917 | if (par->fb_base == NULL) { | ||
918 | dev_err(dev, "Cannot map framebuffer\n"); | ||
919 | goto rel_reg; | ||
920 | } | ||
921 | |||
922 | par->mmio_base = ioremap(par->mmio_base_phys, par->mmio_len); | ||
923 | if (par->mmio_base == NULL) { | ||
924 | dev_err(dev, "Cannot map registers\n"); | ||
925 | ret = -EIO; | ||
926 | goto fb_unmap; | ||
927 | } | ||
928 | |||
929 | dev_dbg(dev, "fb phys 0x%llx 0x%lx\n", | ||
930 | (u64)par->fb_base_phys, (ulong)par->mapped_vram); | ||
931 | dev_dbg(dev, "mmio phys 0x%llx 0x%lx\n", | ||
932 | (u64)par->mmio_base_phys, (ulong)par->mmio_len); | ||
933 | |||
934 | if (mb862xx_pci_gdc_init(par)) | ||
935 | goto io_unmap; | ||
936 | |||
937 | if (request_irq(par->irq, mb862xx_intr, IRQF_DISABLED | IRQF_SHARED, | ||
938 | DRV_NAME, (void *)par)) { | ||
939 | dev_err(dev, "Cannot request irq\n"); | ||
940 | goto io_unmap; | ||
941 | } | ||
942 | |||
943 | mb862xxfb_init_fbinfo(info); | ||
944 | |||
945 | if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0) < 0) { | ||
946 | dev_err(dev, "Could not allocate cmap for fb_info.\n"); | ||
947 | ret = -ENOMEM; | ||
948 | goto free_irq; | ||
949 | } | ||
950 | |||
951 | if ((info->fbops->fb_set_par)(info)) | ||
952 | dev_err(dev, "set_var() failed on initial setup?\n"); | ||
953 | |||
954 | ret = register_framebuffer(info); | ||
955 | if (ret < 0) { | ||
956 | dev_err(dev, "failed to register framebuffer\n"); | ||
957 | goto rel_cmap; | ||
958 | } | ||
959 | |||
960 | pci_set_drvdata(pdev, info); | ||
961 | |||
962 | if (device_create_file(dev, &dev_attr_dispregs)) | ||
963 | dev_err(dev, "Can't create sysfs regdump file\n"); | ||
964 | |||
965 | if (par->type == BT_CARMINE) | ||
966 | outreg(ctrl, GC_CTRL_INT_MASK, GC_CARMINE_INT_EN); | ||
967 | else | ||
968 | outreg(host, GC_IMASK, GC_INT_EN); | ||
969 | |||
970 | return 0; | ||
971 | |||
972 | rel_cmap: | ||
973 | fb_dealloc_cmap(&info->cmap); | ||
974 | free_irq: | ||
975 | free_irq(par->irq, (void *)par); | ||
976 | io_unmap: | ||
977 | iounmap(par->mmio_base); | ||
978 | fb_unmap: | ||
979 | iounmap(par->fb_base); | ||
980 | rel_reg: | ||
981 | pci_release_regions(pdev); | ||
982 | rel_fb: | ||
983 | framebuffer_release(info); | ||
984 | dis_dev: | ||
985 | pci_disable_device(pdev); | ||
986 | out: | ||
987 | return ret; | ||
988 | } | ||
989 | |||
990 | static void __devexit mb862xx_pci_remove(struct pci_dev *pdev) | ||
991 | { | ||
992 | struct fb_info *fbi = pci_get_drvdata(pdev); | ||
993 | struct mb862xxfb_par *par = fbi->par; | ||
994 | unsigned long reg; | ||
995 | |||
996 | dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); | ||
997 | |||
998 | /* display off */ | ||
999 | reg = inreg(disp, GC_DCM1); | ||
1000 | reg &= ~(GC_DCM01_DEN | GC_DCM01_L0E); | ||
1001 | outreg(disp, GC_DCM1, reg); | ||
1002 | |||
1003 | if (par->type == BT_CARMINE) { | ||
1004 | outreg(ctrl, GC_CTRL_INT_MASK, 0); | ||
1005 | outreg(ctrl, GC_CTRL_CLK_ENABLE, 0); | ||
1006 | } else { | ||
1007 | outreg(host, GC_IMASK, 0); | ||
1008 | } | ||
1009 | |||
1010 | device_remove_file(&pdev->dev, &dev_attr_dispregs); | ||
1011 | |||
1012 | pci_set_drvdata(pdev, NULL); | ||
1013 | unregister_framebuffer(fbi); | ||
1014 | fb_dealloc_cmap(&fbi->cmap); | ||
1015 | |||
1016 | free_irq(par->irq, (void *)par); | ||
1017 | iounmap(par->mmio_base); | ||
1018 | iounmap(par->fb_base); | ||
1019 | |||
1020 | pci_release_regions(pdev); | ||
1021 | framebuffer_release(fbi); | ||
1022 | pci_disable_device(pdev); | ||
1023 | } | ||
1024 | |||
1025 | static struct pci_driver mb862xxfb_pci_driver = { | ||
1026 | .name = DRV_NAME, | ||
1027 | .id_table = mb862xx_pci_tbl, | ||
1028 | .probe = mb862xx_pci_probe, | ||
1029 | .remove = __devexit_p(mb862xx_pci_remove), | ||
1030 | }; | ||
1031 | #endif | ||
1032 | |||
1033 | static int __devinit mb862xxfb_init(void) | ||
1034 | { | ||
1035 | int ret = -ENODEV; | ||
1036 | |||
1037 | #if defined(CONFIG_FB_MB862XX_LIME) | ||
1038 | ret = of_register_platform_driver(&of_platform_mb862xxfb_driver); | ||
1039 | #endif | ||
1040 | #if defined(CONFIG_FB_MB862XX_PCI_GDC) | ||
1041 | ret = pci_register_driver(&mb862xxfb_pci_driver); | ||
1042 | #endif | ||
1043 | return ret; | ||
1044 | } | ||
1045 | |||
1046 | static void __exit mb862xxfb_exit(void) | ||
1047 | { | ||
1048 | #if defined(CONFIG_FB_MB862XX_LIME) | ||
1049 | of_unregister_platform_driver(&of_platform_mb862xxfb_driver); | ||
1050 | #endif | ||
1051 | #if defined(CONFIG_FB_MB862XX_PCI_GDC) | ||
1052 | pci_unregister_driver(&mb862xxfb_pci_driver); | ||
1053 | #endif | ||
1054 | } | ||
1055 | |||
1056 | module_init(mb862xxfb_init); | ||
1057 | module_exit(mb862xxfb_exit); | ||
1058 | |||
1059 | MODULE_DESCRIPTION("Fujitsu MB862xx Framebuffer driver"); | ||
1060 | MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>"); | ||
1061 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/video/mb862xx/mb862xxfb.h b/drivers/video/mb862xx/mb862xxfb.h new file mode 100644 index 000000000000..c4c8f4dd2217 --- /dev/null +++ b/drivers/video/mb862xx/mb862xxfb.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef __MB862XX_H__ | ||
2 | #define __MB862XX_H__ | ||
3 | |||
4 | #define PCI_VENDOR_ID_FUJITSU_LIMITED 0x10cf | ||
5 | #define PCI_DEVICE_ID_FUJITSU_CORALP 0x2019 | ||
6 | #define PCI_DEVICE_ID_FUJITSU_CORALPA 0x201e | ||
7 | #define PCI_DEVICE_ID_FUJITSU_CARMINE 0x202b | ||
8 | |||
9 | #define GC_MMR_CORALP_EVB_VAL 0x11d7fa13 | ||
10 | |||
11 | enum gdctype { | ||
12 | BT_NONE, | ||
13 | BT_LIME, | ||
14 | BT_MINT, | ||
15 | BT_CORAL, | ||
16 | BT_CORALP, | ||
17 | BT_CARMINE, | ||
18 | }; | ||
19 | |||
20 | struct mb862xx_gc_mode { | ||
21 | struct fb_videomode def_mode; /* mode of connected display */ | ||
22 | unsigned int def_bpp; /* default depth */ | ||
23 | unsigned long max_vram; /* connected SDRAM size */ | ||
24 | unsigned long ccf; /* gdc clk */ | ||
25 | unsigned long mmr; /* memory mode for SDRAM */ | ||
26 | }; | ||
27 | |||
28 | /* private data */ | ||
29 | struct mb862xxfb_par { | ||
30 | struct fb_info *info; /* fb info head */ | ||
31 | struct device *dev; | ||
32 | struct pci_dev *pdev; | ||
33 | struct resource *res; /* framebuffer/mmio resource */ | ||
34 | |||
35 | resource_size_t fb_base_phys; /* fb base, 36-bit PPC440EPx */ | ||
36 | resource_size_t mmio_base_phys; /* io base addr */ | ||
37 | void __iomem *fb_base; /* remapped framebuffer */ | ||
38 | void __iomem *mmio_base; /* remapped registers */ | ||
39 | size_t mapped_vram; /* length of remapped vram */ | ||
40 | size_t mmio_len; /* length of register region */ | ||
41 | |||
42 | void __iomem *host; /* relocatable reg. bases */ | ||
43 | void __iomem *i2c; | ||
44 | void __iomem *disp; | ||
45 | void __iomem *disp1; | ||
46 | void __iomem *cap; | ||
47 | void __iomem *cap1; | ||
48 | void __iomem *draw; | ||
49 | void __iomem *geo; | ||
50 | void __iomem *pio; | ||
51 | void __iomem *ctrl; | ||
52 | void __iomem *dram_ctrl; | ||
53 | void __iomem *wrback; | ||
54 | |||
55 | unsigned int irq; | ||
56 | unsigned int type; /* GDC type */ | ||
57 | unsigned int refclk; /* disp. reference clock */ | ||
58 | struct mb862xx_gc_mode *gc_mode; /* GDC mode init data */ | ||
59 | int pre_init; /* don't init display if 1 */ | ||
60 | |||
61 | u32 pseudo_palette[16]; | ||
62 | }; | ||
63 | |||
64 | #if defined(CONFIG_FB_MB862XX_LIME) && defined(CONFIG_FB_MB862XX_PCI_GDC) | ||
65 | #error "Select Lime GDC or CoralP/Carmine support, but not both together" | ||
66 | #endif | ||
67 | #if defined(CONFIG_FB_MB862XX_LIME) | ||
68 | #define gdc_read __raw_readl | ||
69 | #define gdc_write __raw_writel | ||
70 | #else | ||
71 | #define gdc_read readl | ||
72 | #define gdc_write writel | ||
73 | #endif | ||
74 | |||
75 | #define inreg(type, off) \ | ||
76 | gdc_read((par->type + (off))) | ||
77 | |||
78 | #define outreg(type, off, val) \ | ||
79 | gdc_write((val), (par->type + (off))) | ||
80 | |||
81 | #define pack(a, b) (((a) << 16) | (b)) | ||
82 | |||
83 | #endif | ||
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/Kconfig b/drivers/watchdog/Kconfig index 1a22fe782a27..4fd3fa5546b1 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -67,11 +67,11 @@ config AT91RM9200_WATCHDOG | |||
67 | system when the timeout is reached. | 67 | system when the timeout is reached. |
68 | 68 | ||
69 | config AT91SAM9X_WATCHDOG | 69 | config AT91SAM9X_WATCHDOG |
70 | tristate "AT91SAM9X watchdog" | 70 | tristate "AT91SAM9X / AT91CAP9 watchdog" |
71 | depends on WATCHDOG && (ARCH_AT91SAM9260 || ARCH_AT91SAM9261) | 71 | depends on ARCH_AT91 && !ARCH_AT91RM9200 |
72 | help | 72 | help |
73 | Watchdog timer embedded into AT91SAM9X chips. This will reboot your | 73 | Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will |
74 | system when the timeout is reached. | 74 | reboot your system when the timeout is reached. |
75 | 75 | ||
76 | config 21285_WATCHDOG | 76 | config 21285_WATCHDOG |
77 | tristate "DC21285 watchdog" | 77 | tristate "DC21285 watchdog" |
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/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index b4babfc31586..b1da287f90ec 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
32 | 32 | ||
33 | #include <asm/arch/at91_wdt.h> | 33 | #include <mach/at91_wdt.h> |
34 | 34 | ||
35 | #define DRV_NAME "AT91SAM9 Watchdog" | 35 | #define DRV_NAME "AT91SAM9 Watchdog" |
36 | 36 | ||
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/booke_wdt.c b/drivers/watchdog/booke_wdt.c index c3b78a76f173..225398fd5049 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -42,8 +42,10 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | |||
42 | 42 | ||
43 | #ifdef CONFIG_FSL_BOOKE | 43 | #ifdef CONFIG_FSL_BOOKE |
44 | #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) | 44 | #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) |
45 | #define WDTP_MASK (WDTP(0)) | ||
45 | #else | 46 | #else |
46 | #define WDTP(x) (TCR_WP(x)) | 47 | #define WDTP(x) (TCR_WP(x)) |
48 | #define WDTP_MASK (TCR_WP_MASK) | ||
47 | #endif | 49 | #endif |
48 | 50 | ||
49 | static DEFINE_SPINLOCK(booke_wdt_lock); | 51 | static DEFINE_SPINLOCK(booke_wdt_lock); |
@@ -65,6 +67,7 @@ static void __booke_wdt_enable(void *data) | |||
65 | /* clear status before enabling watchdog */ | 67 | /* clear status before enabling watchdog */ |
66 | __booke_wdt_ping(NULL); | 68 | __booke_wdt_ping(NULL); |
67 | val = mfspr(SPRN_TCR); | 69 | val = mfspr(SPRN_TCR); |
70 | val &= ~WDTP_MASK; | ||
68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); | 71 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); |
69 | 72 | ||
70 | mtspr(SPRN_TCR, val); | 73 | mtspr(SPRN_TCR, val); |
@@ -114,7 +117,7 @@ static long booke_wdt_ioctl(struct file *file, | |||
114 | case WDIOC_SETTIMEOUT: | 117 | case WDIOC_SETTIMEOUT: |
115 | if (get_user(booke_wdt_period, p)) | 118 | if (get_user(booke_wdt_period, p)) |
116 | return -EFAULT; | 119 | return -EFAULT; |
117 | mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) | | 120 | mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP_MASK) | |
118 | WDTP(booke_wdt_period)); | 121 | WDTP(booke_wdt_period)); |
119 | return 0; | 122 | return 0; |
120 | case WDIOC_GETTIMEOUT: | 123 | case WDIOC_GETTIMEOUT: |
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/balloon.c b/drivers/xen/balloon.c index 8c83abc73400..a0fb5eac407c 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/pagemap.h> | 41 | #include <linux/pagemap.h> |
42 | #include <linux/highmem.h> | 42 | #include <linux/highmem.h> |
43 | #include <linux/mutex.h> | 43 | #include <linux/mutex.h> |
44 | #include <linux/highmem.h> | ||
45 | #include <linux/list.h> | 44 | #include <linux/list.h> |
46 | #include <linux/sysdev.h> | 45 | #include <linux/sysdev.h> |
47 | 46 | ||
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 | ||
34 | static int xencomm_init(struct xencomm_desc *desc, | 28 | static 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 */ | ||
161 | static 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 | |||
169 | static struct xencomm_handle *xencomm_create_inline(void *ptr) | 154 | static 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, |