diff options
Diffstat (limited to 'drivers')
37 files changed, 368 insertions, 245 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 31122214e0ec..1af808171d46 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -389,6 +389,17 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle) | |||
389 | 389 | ||
390 | pbus = pdev->subordinate; | 390 | pbus = pdev->subordinate; |
391 | pci_dev_put(pdev); | 391 | pci_dev_put(pdev); |
392 | |||
393 | /* | ||
394 | * This function may be called for a non-PCI device that has a | ||
395 | * PCI parent (eg. a disk under a PCI SATA controller). In that | ||
396 | * case pdev->subordinate will be NULL for the parent. | ||
397 | */ | ||
398 | if (!pbus) { | ||
399 | dev_dbg(&pdev->dev, "Not a PCI-to-PCI bridge\n"); | ||
400 | pdev = NULL; | ||
401 | break; | ||
402 | } | ||
392 | } | 403 | } |
393 | out: | 404 | out: |
394 | list_for_each_entry_safe(node, tmp, &device_list, node) | 405 | list_for_each_entry_safe(node, tmp, &device_list, node) |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index fb5be2d95d52..6399e5090df4 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -68,6 +68,12 @@ MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" | |||
68 | MODULE_VERSION("3.6.20"); | 68 | MODULE_VERSION("3.6.20"); |
69 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
70 | 70 | ||
71 | static int cciss_allow_hpsa; | ||
72 | module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR); | ||
73 | MODULE_PARM_DESC(cciss_allow_hpsa, | ||
74 | "Prevent cciss driver from accessing hardware known to be " | ||
75 | " supported by the hpsa driver"); | ||
76 | |||
71 | #include "cciss_cmd.h" | 77 | #include "cciss_cmd.h" |
72 | #include "cciss.h" | 78 | #include "cciss.h" |
73 | #include <linux/cciss_ioctl.h> | 79 | #include <linux/cciss_ioctl.h> |
@@ -101,8 +107,6 @@ static const struct pci_device_id cciss_pci_device_id[] = { | |||
101 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, | 107 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, |
102 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, | 108 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, |
103 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, | 109 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, |
104 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
105 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | ||
106 | {0,} | 110 | {0,} |
107 | }; | 111 | }; |
108 | 112 | ||
@@ -123,8 +127,6 @@ static struct board_type products[] = { | |||
123 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, | 127 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, |
124 | {0x40910E11, "Smart Array 6i", &SA5_access}, | 128 | {0x40910E11, "Smart Array 6i", &SA5_access}, |
125 | {0x3225103C, "Smart Array P600", &SA5_access}, | 129 | {0x3225103C, "Smart Array P600", &SA5_access}, |
126 | {0x3223103C, "Smart Array P800", &SA5_access}, | ||
127 | {0x3234103C, "Smart Array P400", &SA5_access}, | ||
128 | {0x3235103C, "Smart Array P400i", &SA5_access}, | 130 | {0x3235103C, "Smart Array P400i", &SA5_access}, |
129 | {0x3211103C, "Smart Array E200i", &SA5_access}, | 131 | {0x3211103C, "Smart Array E200i", &SA5_access}, |
130 | {0x3212103C, "Smart Array E200", &SA5_access}, | 132 | {0x3212103C, "Smart Array E200", &SA5_access}, |
@@ -132,6 +134,10 @@ static struct board_type products[] = { | |||
132 | {0x3214103C, "Smart Array E200i", &SA5_access}, | 134 | {0x3214103C, "Smart Array E200i", &SA5_access}, |
133 | {0x3215103C, "Smart Array E200i", &SA5_access}, | 135 | {0x3215103C, "Smart Array E200i", &SA5_access}, |
134 | {0x3237103C, "Smart Array E500", &SA5_access}, | 136 | {0x3237103C, "Smart Array E500", &SA5_access}, |
137 | /* controllers below this line are also supported by the hpsa driver. */ | ||
138 | #define HPSA_BOUNDARY 0x3223103C | ||
139 | {0x3223103C, "Smart Array P800", &SA5_access}, | ||
140 | {0x3234103C, "Smart Array P400", &SA5_access}, | ||
135 | {0x323D103C, "Smart Array P700m", &SA5_access}, | 141 | {0x323D103C, "Smart Array P700m", &SA5_access}, |
136 | {0x3241103C, "Smart Array P212", &SA5_access}, | 142 | {0x3241103C, "Smart Array P212", &SA5_access}, |
137 | {0x3243103C, "Smart Array P410", &SA5_access}, | 143 | {0x3243103C, "Smart Array P410", &SA5_access}, |
@@ -140,7 +146,6 @@ static struct board_type products[] = { | |||
140 | {0x3249103C, "Smart Array P812", &SA5_access}, | 146 | {0x3249103C, "Smart Array P812", &SA5_access}, |
141 | {0x324A103C, "Smart Array P712m", &SA5_access}, | 147 | {0x324A103C, "Smart Array P712m", &SA5_access}, |
142 | {0x324B103C, "Smart Array P711m", &SA5_access}, | 148 | {0x324B103C, "Smart Array P711m", &SA5_access}, |
143 | {0xFFFF103C, "Unknown Smart Array", &SA5_access}, | ||
144 | }; | 149 | }; |
145 | 150 | ||
146 | /* How long to wait (in milliseconds) for board to go into simple mode */ | 151 | /* How long to wait (in milliseconds) for board to go into simple mode */ |
@@ -3754,7 +3759,27 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
3754 | __u64 cfg_offset; | 3759 | __u64 cfg_offset; |
3755 | __u32 cfg_base_addr; | 3760 | __u32 cfg_base_addr; |
3756 | __u64 cfg_base_addr_index; | 3761 | __u64 cfg_base_addr_index; |
3757 | int i, err; | 3762 | int i, prod_index, err; |
3763 | |||
3764 | subsystem_vendor_id = pdev->subsystem_vendor; | ||
3765 | subsystem_device_id = pdev->subsystem_device; | ||
3766 | board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | | ||
3767 | subsystem_vendor_id); | ||
3768 | |||
3769 | for (i = 0; i < ARRAY_SIZE(products); i++) { | ||
3770 | /* Stand aside for hpsa driver on request */ | ||
3771 | if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY) | ||
3772 | return -ENODEV; | ||
3773 | if (board_id == products[i].board_id) | ||
3774 | break; | ||
3775 | } | ||
3776 | prod_index = i; | ||
3777 | if (prod_index == ARRAY_SIZE(products)) { | ||
3778 | dev_warn(&pdev->dev, | ||
3779 | "unrecognized board ID: 0x%08lx, ignoring.\n", | ||
3780 | (unsigned long) board_id); | ||
3781 | return -ENODEV; | ||
3782 | } | ||
3758 | 3783 | ||
3759 | /* check to see if controller has been disabled */ | 3784 | /* check to see if controller has been disabled */ |
3760 | /* BEFORE trying to enable it */ | 3785 | /* BEFORE trying to enable it */ |
@@ -3778,11 +3803,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
3778 | return err; | 3803 | return err; |
3779 | } | 3804 | } |
3780 | 3805 | ||
3781 | subsystem_vendor_id = pdev->subsystem_vendor; | ||
3782 | subsystem_device_id = pdev->subsystem_device; | ||
3783 | board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | | ||
3784 | subsystem_vendor_id); | ||
3785 | |||
3786 | #ifdef CCISS_DEBUG | 3806 | #ifdef CCISS_DEBUG |
3787 | printk("command = %x\n", command); | 3807 | printk("command = %x\n", command); |
3788 | printk("irq = %x\n", pdev->irq); | 3808 | printk("irq = %x\n", pdev->irq); |
@@ -3868,14 +3888,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
3868 | * leave a little room for ioctl calls. | 3888 | * leave a little room for ioctl calls. |
3869 | */ | 3889 | */ |
3870 | c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); | 3890 | c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); |
3871 | for (i = 0; i < ARRAY_SIZE(products); i++) { | 3891 | c->product_name = products[prod_index].product_name; |
3872 | if (board_id == products[i].board_id) { | 3892 | c->access = *(products[prod_index].access); |
3873 | c->product_name = products[i].product_name; | 3893 | c->nr_cmds = c->max_commands - 4; |
3874 | c->access = *(products[i].access); | ||
3875 | c->nr_cmds = c->max_commands - 4; | ||
3876 | break; | ||
3877 | } | ||
3878 | } | ||
3879 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || | 3894 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || |
3880 | (readb(&c->cfgtable->Signature[1]) != 'I') || | 3895 | (readb(&c->cfgtable->Signature[1]) != 'I') || |
3881 | (readb(&c->cfgtable->Signature[2]) != 'S') || | 3896 | (readb(&c->cfgtable->Signature[2]) != 'S') || |
@@ -3884,27 +3899,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
3884 | err = -ENODEV; | 3899 | err = -ENODEV; |
3885 | goto err_out_free_res; | 3900 | goto err_out_free_res; |
3886 | } | 3901 | } |
3887 | /* We didn't find the controller in our list. We know the | ||
3888 | * signature is valid. If it's an HP device let's try to | ||
3889 | * bind to the device and fire it up. Otherwise we bail. | ||
3890 | */ | ||
3891 | if (i == ARRAY_SIZE(products)) { | ||
3892 | if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { | ||
3893 | c->product_name = products[i-1].product_name; | ||
3894 | c->access = *(products[i-1].access); | ||
3895 | c->nr_cmds = c->max_commands - 4; | ||
3896 | printk(KERN_WARNING "cciss: This is an unknown " | ||
3897 | "Smart Array controller.\n" | ||
3898 | "cciss: Please update to the latest driver " | ||
3899 | "available from www.hp.com.\n"); | ||
3900 | } else { | ||
3901 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | ||
3902 | " to access the Smart Array controller %08lx\n" | ||
3903 | , (unsigned long)board_id); | ||
3904 | err = -ENODEV; | ||
3905 | goto err_out_free_res; | ||
3906 | } | ||
3907 | } | ||
3908 | #ifdef CONFIG_X86 | 3902 | #ifdef CONFIG_X86 |
3909 | { | 3903 | { |
3910 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ | 3904 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ |
@@ -4254,7 +4248,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4254 | mutex_init(&hba[i]->busy_shutting_down); | 4248 | mutex_init(&hba[i]->busy_shutting_down); |
4255 | 4249 | ||
4256 | if (cciss_pci_init(hba[i], pdev) != 0) | 4250 | if (cciss_pci_init(hba[i], pdev) != 0) |
4257 | goto clean0; | 4251 | goto clean_no_release_regions; |
4258 | 4252 | ||
4259 | sprintf(hba[i]->devname, "cciss%d", i); | 4253 | sprintf(hba[i]->devname, "cciss%d", i); |
4260 | hba[i]->ctlr = i; | 4254 | hba[i]->ctlr = i; |
@@ -4391,13 +4385,14 @@ clean2: | |||
4391 | clean1: | 4385 | clean1: |
4392 | cciss_destroy_hba_sysfs_entry(hba[i]); | 4386 | cciss_destroy_hba_sysfs_entry(hba[i]); |
4393 | clean0: | 4387 | clean0: |
4388 | pci_release_regions(pdev); | ||
4389 | clean_no_release_regions: | ||
4394 | hba[i]->busy_initializing = 0; | 4390 | hba[i]->busy_initializing = 0; |
4395 | 4391 | ||
4396 | /* | 4392 | /* |
4397 | * Deliberately omit pci_disable_device(): it does something nasty to | 4393 | * Deliberately omit pci_disable_device(): it does something nasty to |
4398 | * Smart Array controllers that pci_enable_device does not undo | 4394 | * Smart Array controllers that pci_enable_device does not undo |
4399 | */ | 4395 | */ |
4400 | pci_release_regions(pdev); | ||
4401 | pci_set_drvdata(pdev, NULL); | 4396 | pci_set_drvdata(pdev, NULL); |
4402 | free_hba(i); | 4397 | free_hba(i); |
4403 | return -1; | 4398 | return -1; |
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index aac0985a572b..31e7c91c2d9d 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #define RTC_VERSION "1.07" | 43 | #define RTC_VERSION "1.07" |
44 | 44 | ||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/sched.h> | ||
46 | #include <linux/errno.h> | 47 | #include <linux/errno.h> |
47 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
48 | #include <linux/fcntl.h> | 49 | #include <linux/fcntl.h> |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index e0d0f8b2696b..bc4ab3e54550 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/proc_fs.h> | 74 | #include <linux/proc_fs.h> |
75 | #include <linux/seq_file.h> | 75 | #include <linux/seq_file.h> |
76 | #include <linux/spinlock.h> | 76 | #include <linux/spinlock.h> |
77 | #include <linux/sched.h> | ||
77 | #include <linux/sysctl.h> | 78 | #include <linux/sysctl.h> |
78 | #include <linux/wait.h> | 79 | #include <linux/wait.h> |
79 | #include <linux/bcd.h> | 80 | #include <linux/bcd.h> |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index fd3dced97776..8c262aaf7c26 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/sched.h> | ||
39 | #include <linux/input.h> | 40 | #include <linux/input.h> |
40 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
41 | #include <linux/init.h> | 42 | #include <linux/init.h> |
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c index 3108991c5c8b..66fa4e10d76b 100644 --- a/drivers/char/tty_buffer.c +++ b/drivers/char/tty_buffer.c | |||
@@ -402,28 +402,26 @@ static void flush_to_ldisc(struct work_struct *work) | |||
402 | container_of(work, struct tty_struct, buf.work.work); | 402 | container_of(work, struct tty_struct, buf.work.work); |
403 | unsigned long flags; | 403 | unsigned long flags; |
404 | struct tty_ldisc *disc; | 404 | struct tty_ldisc *disc; |
405 | struct tty_buffer *tbuf, *head; | ||
406 | char *char_buf; | ||
407 | unsigned char *flag_buf; | ||
408 | 405 | ||
409 | disc = tty_ldisc_ref(tty); | 406 | disc = tty_ldisc_ref(tty); |
410 | if (disc == NULL) /* !TTY_LDISC */ | 407 | if (disc == NULL) /* !TTY_LDISC */ |
411 | return; | 408 | return; |
412 | 409 | ||
413 | spin_lock_irqsave(&tty->buf.lock, flags); | 410 | spin_lock_irqsave(&tty->buf.lock, flags); |
414 | /* So we know a flush is running */ | 411 | |
415 | set_bit(TTY_FLUSHING, &tty->flags); | 412 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { |
416 | head = tty->buf.head; | 413 | struct tty_buffer *head; |
417 | if (head != NULL) { | 414 | while ((head = tty->buf.head) != NULL) { |
418 | tty->buf.head = NULL; | 415 | int count; |
419 | for (;;) { | 416 | char *char_buf; |
420 | int count = head->commit - head->read; | 417 | unsigned char *flag_buf; |
418 | |||
419 | count = head->commit - head->read; | ||
421 | if (!count) { | 420 | if (!count) { |
422 | if (head->next == NULL) | 421 | if (head->next == NULL) |
423 | break; | 422 | break; |
424 | tbuf = head; | 423 | tty->buf.head = head->next; |
425 | head = head->next; | 424 | tty_buffer_free(tty, head); |
426 | tty_buffer_free(tty, tbuf); | ||
427 | continue; | 425 | continue; |
428 | } | 426 | } |
429 | /* Ldisc or user is trying to flush the buffers | 427 | /* Ldisc or user is trying to flush the buffers |
@@ -445,9 +443,9 @@ static void flush_to_ldisc(struct work_struct *work) | |||
445 | flag_buf, count); | 443 | flag_buf, count); |
446 | spin_lock_irqsave(&tty->buf.lock, flags); | 444 | spin_lock_irqsave(&tty->buf.lock, flags); |
447 | } | 445 | } |
448 | /* Restore the queue head */ | 446 | clear_bit(TTY_FLUSHING, &tty->flags); |
449 | tty->buf.head = head; | ||
450 | } | 447 | } |
448 | |||
451 | /* We may have a deferred request to flush the input buffer, | 449 | /* We may have a deferred request to flush the input buffer, |
452 | if so pull the chain under the lock and empty the queue */ | 450 | if so pull the chain under the lock and empty the queue */ |
453 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { | 451 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { |
@@ -455,7 +453,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
455 | clear_bit(TTY_FLUSHPENDING, &tty->flags); | 453 | clear_bit(TTY_FLUSHPENDING, &tty->flags); |
456 | wake_up(&tty->read_wait); | 454 | wake_up(&tty->read_wait); |
457 | } | 455 | } |
458 | clear_bit(TTY_FLUSHING, &tty->flags); | ||
459 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 456 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
460 | 457 | ||
461 | tty_ldisc_deref(disc); | 458 | tty_ldisc_deref(disc); |
@@ -471,7 +468,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
471 | */ | 468 | */ |
472 | void tty_flush_to_ldisc(struct tty_struct *tty) | 469 | void tty_flush_to_ldisc(struct tty_struct *tty) |
473 | { | 470 | { |
474 | flush_to_ldisc(&tty->buf.work.work); | 471 | flush_delayed_work(&tty->buf.work); |
475 | } | 472 | } |
476 | 473 | ||
477 | /** | 474 | /** |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 50f0176de615..98dbbda3ad41 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -188,14 +188,7 @@ static struct fw_device *target_device(struct sbp2_target *tgt) | |||
188 | /* Impossible login_id, to detect logout attempt before successful login */ | 188 | /* Impossible login_id, to detect logout attempt before successful login */ |
189 | #define INVALID_LOGIN_ID 0x10000 | 189 | #define INVALID_LOGIN_ID 0x10000 |
190 | 190 | ||
191 | /* | 191 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ |
192 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
193 | * provided in the config rom. Most devices do provide a value, which | ||
194 | * we'll use for login management orbs, but with some sane limits. | ||
195 | */ | ||
196 | #define SBP2_MIN_LOGIN_ORB_TIMEOUT 5000U /* Timeout in ms */ | ||
197 | #define SBP2_MAX_LOGIN_ORB_TIMEOUT 40000U /* Timeout in ms */ | ||
198 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ | ||
199 | #define SBP2_ORB_NULL 0x80000000 | 192 | #define SBP2_ORB_NULL 0x80000000 |
200 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ | 193 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ |
201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ | 194 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ |
@@ -1034,7 +1027,6 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
1034 | { | 1027 | { |
1035 | struct fw_csr_iterator ci; | 1028 | struct fw_csr_iterator ci; |
1036 | int key, value; | 1029 | int key, value; |
1037 | unsigned int timeout; | ||
1038 | 1030 | ||
1039 | fw_csr_iterator_init(&ci, directory); | 1031 | fw_csr_iterator_init(&ci, directory); |
1040 | while (fw_csr_iterator_next(&ci, &key, &value)) { | 1032 | while (fw_csr_iterator_next(&ci, &key, &value)) { |
@@ -1059,17 +1051,7 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
1059 | 1051 | ||
1060 | case SBP2_CSR_UNIT_CHARACTERISTICS: | 1052 | case SBP2_CSR_UNIT_CHARACTERISTICS: |
1061 | /* the timeout value is stored in 500ms units */ | 1053 | /* the timeout value is stored in 500ms units */ |
1062 | timeout = ((unsigned int) value >> 8 & 0xff) * 500; | 1054 | tgt->mgt_orb_timeout = (value >> 8 & 0xff) * 500; |
1063 | timeout = max(timeout, SBP2_MIN_LOGIN_ORB_TIMEOUT); | ||
1064 | tgt->mgt_orb_timeout = | ||
1065 | min(timeout, SBP2_MAX_LOGIN_ORB_TIMEOUT); | ||
1066 | |||
1067 | if (timeout > tgt->mgt_orb_timeout) | ||
1068 | fw_notify("%s: config rom contains %ds " | ||
1069 | "management ORB timeout, limiting " | ||
1070 | "to %ds\n", tgt->bus_id, | ||
1071 | timeout / 1000, | ||
1072 | tgt->mgt_orb_timeout / 1000); | ||
1073 | break; | 1055 | break; |
1074 | 1056 | ||
1075 | case SBP2_CSR_LOGICAL_UNIT_NUMBER: | 1057 | case SBP2_CSR_LOGICAL_UNIT_NUMBER: |
@@ -1087,6 +1069,22 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
1087 | return 0; | 1069 | return 0; |
1088 | } | 1070 | } |
1089 | 1071 | ||
1072 | /* | ||
1073 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
1074 | * provided in the config rom. Most devices do provide a value, which | ||
1075 | * we'll use for login management orbs, but with some sane limits. | ||
1076 | */ | ||
1077 | static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt) | ||
1078 | { | ||
1079 | unsigned int timeout = tgt->mgt_orb_timeout; | ||
1080 | |||
1081 | if (timeout > 40000) | ||
1082 | fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n", | ||
1083 | tgt->bus_id, timeout / 1000); | ||
1084 | |||
1085 | tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000); | ||
1086 | } | ||
1087 | |||
1090 | static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, | 1088 | static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, |
1091 | u32 firmware_revision) | 1089 | u32 firmware_revision) |
1092 | { | 1090 | { |
@@ -1171,6 +1169,7 @@ static int sbp2_probe(struct device *dev) | |||
1171 | &firmware_revision) < 0) | 1169 | &firmware_revision) < 0) |
1172 | goto fail_tgt_put; | 1170 | goto fail_tgt_put; |
1173 | 1171 | ||
1172 | sbp2_clamp_management_orb_timeout(tgt); | ||
1174 | sbp2_init_workarounds(tgt, model, firmware_revision); | 1173 | sbp2_init_workarounds(tgt, model, firmware_revision); |
1175 | 1174 | ||
1176 | /* | 1175 | /* |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index be34d32906bd..7d05c4bb201e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1066,7 +1066,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event); | |||
1066 | * @type: HID report type (HID_*_REPORT) | 1066 | * @type: HID report type (HID_*_REPORT) |
1067 | * @data: report contents | 1067 | * @data: report contents |
1068 | * @size: size of data parameter | 1068 | * @size: size of data parameter |
1069 | * @interrupt: called from atomic? | 1069 | * @interrupt: distinguish between interrupt and control transfers |
1070 | * | 1070 | * |
1071 | * This is data entry for lower layers. | 1071 | * This is data entry for lower layers. |
1072 | */ | 1072 | */ |
diff --git a/drivers/hid/hid-twinhan.c b/drivers/hid/hid-twinhan.c index b05f602c051e..c40afc57fc8f 100644 --- a/drivers/hid/hid-twinhan.c +++ b/drivers/hid/hid-twinhan.c | |||
@@ -132,12 +132,12 @@ static struct hid_driver twinhan_driver = { | |||
132 | .input_mapping = twinhan_input_mapping, | 132 | .input_mapping = twinhan_input_mapping, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static int twinhan_init(void) | 135 | static int __init twinhan_init(void) |
136 | { | 136 | { |
137 | return hid_register_driver(&twinhan_driver); | 137 | return hid_register_driver(&twinhan_driver); |
138 | } | 138 | } |
139 | 139 | ||
140 | static void twinhan_exit(void) | 140 | static void __exit twinhan_exit(void) |
141 | { | 141 | { |
142 | hid_unregister_driver(&twinhan_driver); | 142 | hid_unregister_driver(&twinhan_driver); |
143 | } | 143 | } |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index ba05275e5104..cdd136942bca 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -48,10 +48,9 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, | |||
48 | char *report; | 48 | char *report; |
49 | DECLARE_WAITQUEUE(wait, current); | 49 | DECLARE_WAITQUEUE(wait, current); |
50 | 50 | ||
51 | while (ret == 0) { | 51 | mutex_lock(&list->read_mutex); |
52 | |||
53 | mutex_lock(&list->read_mutex); | ||
54 | 52 | ||
53 | while (ret == 0) { | ||
55 | if (list->head == list->tail) { | 54 | if (list->head == list->tail) { |
56 | add_wait_queue(&list->hidraw->wait, &wait); | 55 | add_wait_queue(&list->hidraw->wait, &wait); |
57 | set_current_state(TASK_INTERRUPTIBLE); | 56 | set_current_state(TASK_INTERRUPTIBLE); |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 23e76fe0d359..376f1ab48a24 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -130,7 +130,7 @@ struct mapped_device { | |||
130 | /* | 130 | /* |
131 | * A list of ios that arrived while we were suspended. | 131 | * A list of ios that arrived while we were suspended. |
132 | */ | 132 | */ |
133 | atomic_t pending; | 133 | atomic_t pending[2]; |
134 | wait_queue_head_t wait; | 134 | wait_queue_head_t wait; |
135 | struct work_struct work; | 135 | struct work_struct work; |
136 | struct bio_list deferred; | 136 | struct bio_list deferred; |
@@ -453,13 +453,14 @@ static void start_io_acct(struct dm_io *io) | |||
453 | { | 453 | { |
454 | struct mapped_device *md = io->md; | 454 | struct mapped_device *md = io->md; |
455 | int cpu; | 455 | int cpu; |
456 | int rw = bio_data_dir(io->bio); | ||
456 | 457 | ||
457 | io->start_time = jiffies; | 458 | io->start_time = jiffies; |
458 | 459 | ||
459 | cpu = part_stat_lock(); | 460 | cpu = part_stat_lock(); |
460 | part_round_stats(cpu, &dm_disk(md)->part0); | 461 | part_round_stats(cpu, &dm_disk(md)->part0); |
461 | part_stat_unlock(); | 462 | part_stat_unlock(); |
462 | dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); | 463 | dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]); |
463 | } | 464 | } |
464 | 465 | ||
465 | static void end_io_acct(struct dm_io *io) | 466 | static void end_io_acct(struct dm_io *io) |
@@ -479,8 +480,9 @@ static void end_io_acct(struct dm_io *io) | |||
479 | * After this is decremented the bio must not be touched if it is | 480 | * After this is decremented the bio must not be touched if it is |
480 | * a barrier. | 481 | * a barrier. |
481 | */ | 482 | */ |
482 | dm_disk(md)->part0.in_flight = pending = | 483 | dm_disk(md)->part0.in_flight[rw] = pending = |
483 | atomic_dec_return(&md->pending); | 484 | atomic_dec_return(&md->pending[rw]); |
485 | pending += atomic_read(&md->pending[rw^0x1]); | ||
484 | 486 | ||
485 | /* nudge anyone waiting on suspend queue */ | 487 | /* nudge anyone waiting on suspend queue */ |
486 | if (!pending) | 488 | if (!pending) |
@@ -1785,7 +1787,8 @@ static struct mapped_device *alloc_dev(int minor) | |||
1785 | if (!md->disk) | 1787 | if (!md->disk) |
1786 | goto bad_disk; | 1788 | goto bad_disk; |
1787 | 1789 | ||
1788 | atomic_set(&md->pending, 0); | 1790 | atomic_set(&md->pending[0], 0); |
1791 | atomic_set(&md->pending[1], 0); | ||
1789 | init_waitqueue_head(&md->wait); | 1792 | init_waitqueue_head(&md->wait); |
1790 | INIT_WORK(&md->work, dm_wq_work); | 1793 | INIT_WORK(&md->work, dm_wq_work); |
1791 | init_waitqueue_head(&md->eventq); | 1794 | init_waitqueue_head(&md->eventq); |
@@ -2088,7 +2091,8 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible) | |||
2088 | break; | 2091 | break; |
2089 | } | 2092 | } |
2090 | spin_unlock_irqrestore(q->queue_lock, flags); | 2093 | spin_unlock_irqrestore(q->queue_lock, flags); |
2091 | } else if (!atomic_read(&md->pending)) | 2094 | } else if (!atomic_read(&md->pending[0]) && |
2095 | !atomic_read(&md->pending[1])) | ||
2092 | break; | 2096 | break; |
2093 | 2097 | ||
2094 | if (interruptible == TASK_INTERRUPTIBLE && | 2098 | if (interruptible == TASK_INTERRUPTIBLE && |
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index e424cf6d8e9e..e832e975da60 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
@@ -480,7 +480,6 @@ static int | |||
480 | add_children(struct twl4030_platform_data *pdata, unsigned long features) | 480 | add_children(struct twl4030_platform_data *pdata, unsigned long features) |
481 | { | 481 | { |
482 | struct device *child; | 482 | struct device *child; |
483 | struct device *usb_transceiver = NULL; | ||
484 | 483 | ||
485 | if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { | 484 | if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { |
486 | child = add_child(3, "twl4030_bci", | 485 | child = add_child(3, "twl4030_bci", |
@@ -532,16 +531,61 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) | |||
532 | } | 531 | } |
533 | 532 | ||
534 | if (twl_has_usb() && pdata->usb) { | 533 | if (twl_has_usb() && pdata->usb) { |
534 | |||
535 | static struct regulator_consumer_supply usb1v5 = { | ||
536 | .supply = "usb1v5", | ||
537 | }; | ||
538 | static struct regulator_consumer_supply usb1v8 = { | ||
539 | .supply = "usb1v8", | ||
540 | }; | ||
541 | static struct regulator_consumer_supply usb3v1 = { | ||
542 | .supply = "usb3v1", | ||
543 | }; | ||
544 | |||
545 | /* First add the regulators so that they can be used by transceiver */ | ||
546 | if (twl_has_regulator()) { | ||
547 | /* this is a template that gets copied */ | ||
548 | struct regulator_init_data usb_fixed = { | ||
549 | .constraints.valid_modes_mask = | ||
550 | REGULATOR_MODE_NORMAL | ||
551 | | REGULATOR_MODE_STANDBY, | ||
552 | .constraints.valid_ops_mask = | ||
553 | REGULATOR_CHANGE_MODE | ||
554 | | REGULATOR_CHANGE_STATUS, | ||
555 | }; | ||
556 | |||
557 | child = add_regulator_linked(TWL4030_REG_VUSB1V5, | ||
558 | &usb_fixed, &usb1v5, 1); | ||
559 | if (IS_ERR(child)) | ||
560 | return PTR_ERR(child); | ||
561 | |||
562 | child = add_regulator_linked(TWL4030_REG_VUSB1V8, | ||
563 | &usb_fixed, &usb1v8, 1); | ||
564 | if (IS_ERR(child)) | ||
565 | return PTR_ERR(child); | ||
566 | |||
567 | child = add_regulator_linked(TWL4030_REG_VUSB3V1, | ||
568 | &usb_fixed, &usb3v1, 1); | ||
569 | if (IS_ERR(child)) | ||
570 | return PTR_ERR(child); | ||
571 | |||
572 | } | ||
573 | |||
535 | child = add_child(0, "twl4030_usb", | 574 | child = add_child(0, "twl4030_usb", |
536 | pdata->usb, sizeof(*pdata->usb), | 575 | pdata->usb, sizeof(*pdata->usb), |
537 | true, | 576 | true, |
538 | /* irq0 = USB_PRES, irq1 = USB */ | 577 | /* irq0 = USB_PRES, irq1 = USB */ |
539 | pdata->irq_base + 8 + 2, pdata->irq_base + 4); | 578 | pdata->irq_base + 8 + 2, pdata->irq_base + 4); |
579 | |||
540 | if (IS_ERR(child)) | 580 | if (IS_ERR(child)) |
541 | return PTR_ERR(child); | 581 | return PTR_ERR(child); |
542 | 582 | ||
543 | /* we need to connect regulators to this transceiver */ | 583 | /* we need to connect regulators to this transceiver */ |
544 | usb_transceiver = child; | 584 | if (twl_has_regulator() && child) { |
585 | usb1v5.dev = child; | ||
586 | usb1v8.dev = child; | ||
587 | usb3v1.dev = child; | ||
588 | } | ||
545 | } | 589 | } |
546 | 590 | ||
547 | if (twl_has_watchdog()) { | 591 | if (twl_has_watchdog()) { |
@@ -580,47 +624,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) | |||
580 | return PTR_ERR(child); | 624 | return PTR_ERR(child); |
581 | } | 625 | } |
582 | 626 | ||
583 | if (twl_has_regulator() && usb_transceiver) { | ||
584 | static struct regulator_consumer_supply usb1v5 = { | ||
585 | .supply = "usb1v5", | ||
586 | }; | ||
587 | static struct regulator_consumer_supply usb1v8 = { | ||
588 | .supply = "usb1v8", | ||
589 | }; | ||
590 | static struct regulator_consumer_supply usb3v1 = { | ||
591 | .supply = "usb3v1", | ||
592 | }; | ||
593 | |||
594 | /* this is a template that gets copied */ | ||
595 | struct regulator_init_data usb_fixed = { | ||
596 | .constraints.valid_modes_mask = | ||
597 | REGULATOR_MODE_NORMAL | ||
598 | | REGULATOR_MODE_STANDBY, | ||
599 | .constraints.valid_ops_mask = | ||
600 | REGULATOR_CHANGE_MODE | ||
601 | | REGULATOR_CHANGE_STATUS, | ||
602 | }; | ||
603 | |||
604 | usb1v5.dev = usb_transceiver; | ||
605 | usb1v8.dev = usb_transceiver; | ||
606 | usb3v1.dev = usb_transceiver; | ||
607 | |||
608 | child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed, | ||
609 | &usb1v5, 1); | ||
610 | if (IS_ERR(child)) | ||
611 | return PTR_ERR(child); | ||
612 | |||
613 | child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed, | ||
614 | &usb1v8, 1); | ||
615 | if (IS_ERR(child)) | ||
616 | return PTR_ERR(child); | ||
617 | |||
618 | child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed, | ||
619 | &usb3v1, 1); | ||
620 | if (IS_ERR(child)) | ||
621 | return PTR_ERR(child); | ||
622 | } | ||
623 | |||
624 | /* maybe add LDOs that are omitted on cost-reduced parts */ | 627 | /* maybe add LDOs that are omitted on cost-reduced parts */ |
625 | if (twl_has_regulator() && !(features & TPS_SUBSET)) { | 628 | if (twl_has_regulator() && !(features & TPS_SUBSET)) { |
626 | child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); | 629 | child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 5e0b1529964d..b00d67319058 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -693,7 +693,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
693 | if (gpio_is_valid(gpio_ro)) { | 693 | if (gpio_is_valid(gpio_ro)) { |
694 | ret = gpio_request(gpio_ro, "mmc card read only"); | 694 | ret = gpio_request(gpio_ro, "mmc card read only"); |
695 | if (ret) { | 695 | if (ret) { |
696 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_power); | 696 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); |
697 | goto err_gpio_ro; | 697 | goto err_gpio_ro; |
698 | } | 698 | } |
699 | gpio_direction_input(gpio_ro); | 699 | gpio_direction_input(gpio_ro); |
@@ -701,7 +701,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
701 | if (gpio_is_valid(gpio_cd)) { | 701 | if (gpio_is_valid(gpio_cd)) { |
702 | ret = gpio_request(gpio_cd, "mmc card detect"); | 702 | ret = gpio_request(gpio_cd, "mmc card detect"); |
703 | if (ret) { | 703 | if (ret) { |
704 | dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_power); | 704 | dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd); |
705 | goto err_gpio_cd; | 705 | goto err_gpio_cd; |
706 | } | 706 | } |
707 | gpio_direction_input(gpio_cd); | 707 | gpio_direction_input(gpio_cd); |
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 9693b0fd323d..0bd898c94759 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
21 | #include <linux/string.h> | 22 | #include <linux/string.h> |
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index 83da596e2052..58c66819f39b 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/capability.h> | ||
21 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
22 | #include <linux/types.h> | 23 | #include <linux/types.h> |
23 | #include <linux/fcntl.h> | 24 | #include <linux/fcntl.h> |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index a52f29c72c33..f1340faaf022 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
21 | #include <linux/fcntl.h> | 22 | #include <linux/fcntl.h> |
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 2b7ae366ceb1..5df60a6b6776 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
@@ -35,12 +35,23 @@ static size_t buffer_pos; | |||
35 | /* atomic_t because wait_event checks it outside of buffer_mutex */ | 35 | /* atomic_t because wait_event checks it outside of buffer_mutex */ |
36 | static atomic_t buffer_ready = ATOMIC_INIT(0); | 36 | static atomic_t buffer_ready = ATOMIC_INIT(0); |
37 | 37 | ||
38 | /* Add an entry to the event buffer. When we | 38 | /* |
39 | * get near to the end we wake up the process | 39 | * Add an entry to the event buffer. When we get near to the end we |
40 | * sleeping on the read() of the file. | 40 | * wake up the process sleeping on the read() of the file. To protect |
41 | * the event_buffer this function may only be called when buffer_mutex | ||
42 | * is set. | ||
41 | */ | 43 | */ |
42 | void add_event_entry(unsigned long value) | 44 | void add_event_entry(unsigned long value) |
43 | { | 45 | { |
46 | /* | ||
47 | * This shouldn't happen since all workqueues or handlers are | ||
48 | * canceled or flushed before the event buffer is freed. | ||
49 | */ | ||
50 | if (!event_buffer) { | ||
51 | WARN_ON_ONCE(1); | ||
52 | return; | ||
53 | } | ||
54 | |||
44 | if (buffer_pos == buffer_size) { | 55 | if (buffer_pos == buffer_size) { |
45 | atomic_inc(&oprofile_stats.event_lost_overflow); | 56 | atomic_inc(&oprofile_stats.event_lost_overflow); |
46 | return; | 57 | return; |
@@ -69,7 +80,6 @@ void wake_up_buffer_waiter(void) | |||
69 | 80 | ||
70 | int alloc_event_buffer(void) | 81 | int alloc_event_buffer(void) |
71 | { | 82 | { |
72 | int err = -ENOMEM; | ||
73 | unsigned long flags; | 83 | unsigned long flags; |
74 | 84 | ||
75 | spin_lock_irqsave(&oprofilefs_lock, flags); | 85 | spin_lock_irqsave(&oprofilefs_lock, flags); |
@@ -80,21 +90,22 @@ int alloc_event_buffer(void) | |||
80 | if (buffer_watershed >= buffer_size) | 90 | if (buffer_watershed >= buffer_size) |
81 | return -EINVAL; | 91 | return -EINVAL; |
82 | 92 | ||
93 | buffer_pos = 0; | ||
83 | event_buffer = vmalloc(sizeof(unsigned long) * buffer_size); | 94 | event_buffer = vmalloc(sizeof(unsigned long) * buffer_size); |
84 | if (!event_buffer) | 95 | if (!event_buffer) |
85 | goto out; | 96 | return -ENOMEM; |
86 | 97 | ||
87 | err = 0; | 98 | return 0; |
88 | out: | ||
89 | return err; | ||
90 | } | 99 | } |
91 | 100 | ||
92 | 101 | ||
93 | void free_event_buffer(void) | 102 | void free_event_buffer(void) |
94 | { | 103 | { |
104 | mutex_lock(&buffer_mutex); | ||
95 | vfree(event_buffer); | 105 | vfree(event_buffer); |
96 | 106 | buffer_pos = 0; | |
97 | event_buffer = NULL; | 107 | event_buffer = NULL; |
108 | mutex_unlock(&buffer_mutex); | ||
98 | } | 109 | } |
99 | 110 | ||
100 | 111 | ||
@@ -167,6 +178,12 @@ static ssize_t event_buffer_read(struct file *file, char __user *buf, | |||
167 | 178 | ||
168 | mutex_lock(&buffer_mutex); | 179 | mutex_lock(&buffer_mutex); |
169 | 180 | ||
181 | /* May happen if the buffer is freed during pending reads. */ | ||
182 | if (!event_buffer) { | ||
183 | retval = -EINTR; | ||
184 | goto out; | ||
185 | } | ||
186 | |||
170 | atomic_set(&buffer_ready, 0); | 187 | atomic_set(&buffer_ready, 0); |
171 | 188 | ||
172 | retval = -EFAULT; | 189 | retval = -EFAULT; |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 14bbaa17e2ca..22b02c6df854 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -354,6 +354,7 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header) | |||
354 | struct acpi_dmar_hardware_unit *drhd; | 354 | struct acpi_dmar_hardware_unit *drhd; |
355 | struct acpi_dmar_reserved_memory *rmrr; | 355 | struct acpi_dmar_reserved_memory *rmrr; |
356 | struct acpi_dmar_atsr *atsr; | 356 | struct acpi_dmar_atsr *atsr; |
357 | struct acpi_dmar_rhsa *rhsa; | ||
357 | 358 | ||
358 | switch (header->type) { | 359 | switch (header->type) { |
359 | case ACPI_DMAR_TYPE_HARDWARE_UNIT: | 360 | case ACPI_DMAR_TYPE_HARDWARE_UNIT: |
@@ -375,6 +376,12 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header) | |||
375 | atsr = container_of(header, struct acpi_dmar_atsr, header); | 376 | atsr = container_of(header, struct acpi_dmar_atsr, header); |
376 | printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags); | 377 | printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags); |
377 | break; | 378 | break; |
379 | case ACPI_DMAR_HARDWARE_AFFINITY: | ||
380 | rhsa = container_of(header, struct acpi_dmar_rhsa, header); | ||
381 | printk(KERN_INFO PREFIX "RHSA base: %#016Lx proximity domain: %#x\n", | ||
382 | (unsigned long long)rhsa->base_address, | ||
383 | rhsa->proximity_domain); | ||
384 | break; | ||
378 | } | 385 | } |
379 | } | 386 | } |
380 | 387 | ||
@@ -459,9 +466,13 @@ parse_dmar_table(void) | |||
459 | ret = dmar_parse_one_atsr(entry_header); | 466 | ret = dmar_parse_one_atsr(entry_header); |
460 | #endif | 467 | #endif |
461 | break; | 468 | break; |
469 | case ACPI_DMAR_HARDWARE_AFFINITY: | ||
470 | /* We don't do anything with RHSA (yet?) */ | ||
471 | break; | ||
462 | default: | 472 | default: |
463 | printk(KERN_WARNING PREFIX | 473 | printk(KERN_WARNING PREFIX |
464 | "Unknown DMAR structure type\n"); | 474 | "Unknown DMAR structure type %d\n", |
475 | entry_header->type); | ||
465 | ret = 0; /* for forward compatibility */ | 476 | ret = 0; /* for forward compatibility */ |
466 | break; | 477 | break; |
467 | } | 478 | } |
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index 53836001d511..9c6a9fd26812 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/io.h> /* for read? and write? functions */ | 32 | #include <asm/io.h> /* for read? and write? functions */ |
33 | #include <linux/delay.h> /* for delays */ | 33 | #include <linux/delay.h> /* for delays */ |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/sched.h> /* for signal_pending() */ | ||
35 | 36 | ||
36 | #define MY_NAME "cpqphp" | 37 | #define MY_NAME "cpqphp" |
37 | 38 | ||
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 855dd7ca47f3..b1e97e682500 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -48,6 +48,7 @@ | |||
48 | 48 | ||
49 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | 49 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) |
50 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) | 50 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) |
51 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) | ||
51 | 52 | ||
52 | #define IOAPIC_RANGE_START (0xfee00000) | 53 | #define IOAPIC_RANGE_START (0xfee00000) |
53 | #define IOAPIC_RANGE_END (0xfeefffff) | 54 | #define IOAPIC_RANGE_END (0xfeefffff) |
@@ -94,6 +95,7 @@ static inline unsigned long virt_to_dma_pfn(void *p) | |||
94 | /* global iommu list, set NULL for ignored DMAR units */ | 95 | /* global iommu list, set NULL for ignored DMAR units */ |
95 | static struct intel_iommu **g_iommus; | 96 | static struct intel_iommu **g_iommus; |
96 | 97 | ||
98 | static void __init check_tylersburg_isoch(void); | ||
97 | static int rwbf_quirk; | 99 | static int rwbf_quirk; |
98 | 100 | ||
99 | /* | 101 | /* |
@@ -1934,6 +1936,9 @@ error: | |||
1934 | } | 1936 | } |
1935 | 1937 | ||
1936 | static int iommu_identity_mapping; | 1938 | static int iommu_identity_mapping; |
1939 | #define IDENTMAP_ALL 1 | ||
1940 | #define IDENTMAP_GFX 2 | ||
1941 | #define IDENTMAP_AZALIA 4 | ||
1937 | 1942 | ||
1938 | static int iommu_domain_identity_map(struct dmar_domain *domain, | 1943 | static int iommu_domain_identity_map(struct dmar_domain *domain, |
1939 | unsigned long long start, | 1944 | unsigned long long start, |
@@ -2151,8 +2156,14 @@ static int domain_add_dev_info(struct dmar_domain *domain, | |||
2151 | 2156 | ||
2152 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | 2157 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) |
2153 | { | 2158 | { |
2154 | if (iommu_identity_mapping == 2) | 2159 | if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) |
2155 | return IS_GFX_DEVICE(pdev); | 2160 | return 1; |
2161 | |||
2162 | if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) | ||
2163 | return 1; | ||
2164 | |||
2165 | if (!(iommu_identity_mapping & IDENTMAP_ALL)) | ||
2166 | return 0; | ||
2156 | 2167 | ||
2157 | /* | 2168 | /* |
2158 | * We want to start off with all devices in the 1:1 domain, and | 2169 | * We want to start off with all devices in the 1:1 domain, and |
@@ -2332,11 +2343,14 @@ int __init init_dmars(void) | |||
2332 | } | 2343 | } |
2333 | 2344 | ||
2334 | if (iommu_pass_through) | 2345 | if (iommu_pass_through) |
2335 | iommu_identity_mapping = 1; | 2346 | iommu_identity_mapping |= IDENTMAP_ALL; |
2347 | |||
2336 | #ifdef CONFIG_DMAR_BROKEN_GFX_WA | 2348 | #ifdef CONFIG_DMAR_BROKEN_GFX_WA |
2337 | else | 2349 | iommu_identity_mapping |= IDENTMAP_GFX; |
2338 | iommu_identity_mapping = 2; | ||
2339 | #endif | 2350 | #endif |
2351 | |||
2352 | check_tylersburg_isoch(); | ||
2353 | |||
2340 | /* | 2354 | /* |
2341 | * If pass through is not set or not enabled, setup context entries for | 2355 | * If pass through is not set or not enabled, setup context entries for |
2342 | * identity mappings for rmrr, gfx, and isa and may fall back to static | 2356 | * identity mappings for rmrr, gfx, and isa and may fall back to static |
@@ -3670,3 +3684,61 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) | |||
3670 | } | 3684 | } |
3671 | 3685 | ||
3672 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); | 3686 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); |
3687 | |||
3688 | /* On Tylersburg chipsets, some BIOSes have been known to enable the | ||
3689 | ISOCH DMAR unit for the Azalia sound device, but not give it any | ||
3690 | TLB entries, which causes it to deadlock. Check for that. We do | ||
3691 | this in a function called from init_dmars(), instead of in a PCI | ||
3692 | quirk, because we don't want to print the obnoxious "BIOS broken" | ||
3693 | message if VT-d is actually disabled. | ||
3694 | */ | ||
3695 | static void __init check_tylersburg_isoch(void) | ||
3696 | { | ||
3697 | struct pci_dev *pdev; | ||
3698 | uint32_t vtisochctrl; | ||
3699 | |||
3700 | /* If there's no Azalia in the system anyway, forget it. */ | ||
3701 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x3a3e, NULL); | ||
3702 | if (!pdev) | ||
3703 | return; | ||
3704 | pci_dev_put(pdev); | ||
3705 | |||
3706 | /* System Management Registers. Might be hidden, in which case | ||
3707 | we can't do the sanity check. But that's OK, because the | ||
3708 | known-broken BIOSes _don't_ actually hide it, so far. */ | ||
3709 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x342e, NULL); | ||
3710 | if (!pdev) | ||
3711 | return; | ||
3712 | |||
3713 | if (pci_read_config_dword(pdev, 0x188, &vtisochctrl)) { | ||
3714 | pci_dev_put(pdev); | ||
3715 | return; | ||
3716 | } | ||
3717 | |||
3718 | pci_dev_put(pdev); | ||
3719 | |||
3720 | /* If Azalia DMA is routed to the non-isoch DMAR unit, fine. */ | ||
3721 | if (vtisochctrl & 1) | ||
3722 | return; | ||
3723 | |||
3724 | /* Drop all bits other than the number of TLB entries */ | ||
3725 | vtisochctrl &= 0x1c; | ||
3726 | |||
3727 | /* If we have the recommended number of TLB entries (16), fine. */ | ||
3728 | if (vtisochctrl == 0x10) | ||
3729 | return; | ||
3730 | |||
3731 | /* Zero TLB entries? You get to ride the short bus to school. */ | ||
3732 | if (!vtisochctrl) { | ||
3733 | WARN(1, "Your BIOS is broken; DMA routed to ISOCH DMAR unit but no TLB space.\n" | ||
3734 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
3735 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
3736 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
3737 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
3738 | iommu_identity_mapping |= IDENTMAP_AZALIA; | ||
3739 | return; | ||
3740 | } | ||
3741 | |||
3742 | printk(KERN_WARNING "DMAR: Recommended TLB entries for ISOCH unit is 16; your BIOS set %d\n", | ||
3743 | vtisochctrl); | ||
3744 | } | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6edecff0b419..4e4c295a049f 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -513,7 +513,11 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
513 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 513 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
514 | udelay(PCI_PM_D2_DELAY); | 514 | udelay(PCI_PM_D2_DELAY); |
515 | 515 | ||
516 | dev->current_state = state; | 516 | pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); |
517 | dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); | ||
518 | if (dev->current_state != state && printk_ratelimit()) | ||
519 | dev_info(&dev->dev, "Refused to change power state, " | ||
520 | "currently in D%d\n", dev->current_state); | ||
517 | 521 | ||
518 | /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT | 522 | /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT |
519 | * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning | 523 | * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning |
@@ -2542,10 +2546,10 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) | |||
2542 | 2546 | ||
2543 | /** | 2547 | /** |
2544 | * pci_set_vga_state - set VGA decode state on device and parents if requested | 2548 | * pci_set_vga_state - set VGA decode state on device and parents if requested |
2545 | * @dev the PCI device | 2549 | * @dev: the PCI device |
2546 | * @decode - true = enable decoding, false = disable decoding | 2550 | * @decode: true = enable decoding, false = disable decoding |
2547 | * @command_bits PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY | 2551 | * @command_bits: PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY |
2548 | * @change_bridge - traverse ancestors and change bridges | 2552 | * @change_bridge: traverse ancestors and change bridges |
2549 | */ | 2553 | */ |
2550 | int pci_set_vga_state(struct pci_dev *dev, bool decode, | 2554 | int pci_set_vga_state(struct pci_dev *dev, bool decode, |
2551 | unsigned int command_bits, bool change_bridge) | 2555 | unsigned int command_bits, bool change_bridge) |
@@ -2719,17 +2723,6 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev) | |||
2719 | return 1; | 2723 | return 1; |
2720 | } | 2724 | } |
2721 | 2725 | ||
2722 | static int __devinit pci_init(void) | ||
2723 | { | ||
2724 | struct pci_dev *dev = NULL; | ||
2725 | |||
2726 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | ||
2727 | pci_fixup_device(pci_fixup_final, dev); | ||
2728 | } | ||
2729 | |||
2730 | return 0; | ||
2731 | } | ||
2732 | |||
2733 | static int __init pci_setup(char *str) | 2726 | static int __init pci_setup(char *str) |
2734 | { | 2727 | { |
2735 | while (str) { | 2728 | while (str) { |
@@ -2767,8 +2760,6 @@ static int __init pci_setup(char *str) | |||
2767 | } | 2760 | } |
2768 | early_param("pci", pci_setup); | 2761 | early_param("pci", pci_setup); |
2769 | 2762 | ||
2770 | device_initcall(pci_init); | ||
2771 | |||
2772 | EXPORT_SYMBOL(pci_reenable_device); | 2763 | EXPORT_SYMBOL(pci_reenable_device); |
2773 | EXPORT_SYMBOL(pci_enable_device_io); | 2764 | EXPORT_SYMBOL(pci_enable_device_io); |
2774 | EXPORT_SYMBOL(pci_enable_device_mem); | 2765 | EXPORT_SYMBOL(pci_enable_device_mem); |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index d49ecc94bd49..40c3cc5d1caf 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -53,7 +53,7 @@ static struct pci_error_handlers aer_error_handlers = { | |||
53 | 53 | ||
54 | static struct pcie_port_service_driver aerdriver = { | 54 | static struct pcie_port_service_driver aerdriver = { |
55 | .name = "aer", | 55 | .name = "aer", |
56 | .port_type = PCIE_ANY_PORT, | 56 | .port_type = PCIE_RC_PORT, |
57 | .service = PCIE_PORT_SERVICE_AER, | 57 | .service = PCIE_PORT_SERVICE_AER, |
58 | 58 | ||
59 | .probe = aer_probe, | 59 | .probe = aer_probe, |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 6df5c984a791..f635e476d632 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -30,7 +30,6 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
31 | 31 | ||
32 | /* global data */ | 32 | /* global data */ |
33 | static const char device_name[] = "pcieport-driver"; | ||
34 | 33 | ||
35 | static int pcie_portdrv_restore_config(struct pci_dev *dev) | 34 | static int pcie_portdrv_restore_config(struct pci_dev *dev) |
36 | { | 35 | { |
@@ -262,7 +261,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = { | |||
262 | }; | 261 | }; |
263 | 262 | ||
264 | static struct pci_driver pcie_portdriver = { | 263 | static struct pci_driver pcie_portdriver = { |
265 | .name = (char *)device_name, | 264 | .name = "pcieport", |
266 | .id_table = &port_pci_ids[0], | 265 | .id_table = &port_pci_ids[0], |
267 | 266 | ||
268 | .probe = pcie_portdrv_probe, | 267 | .probe = pcie_portdrv_probe, |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 6099facecd79..a790b1771f9f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -670,6 +670,25 @@ static void __devinit quirk_vt8235_acpi(struct pci_dev *dev) | |||
670 | } | 670 | } |
671 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); | 671 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); |
672 | 672 | ||
673 | /* | ||
674 | * TI XIO2000a PCIe-PCI Bridge erroneously reports it supports fast back-to-back: | ||
675 | * Disable fast back-to-back on the secondary bus segment | ||
676 | */ | ||
677 | static void __devinit quirk_xio2000a(struct pci_dev *dev) | ||
678 | { | ||
679 | struct pci_dev *pdev; | ||
680 | u16 command; | ||
681 | |||
682 | dev_warn(&dev->dev, "TI XIO2000a quirk detected; " | ||
683 | "secondary bus fast back-to-back transfers disabled\n"); | ||
684 | list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) { | ||
685 | pci_read_config_word(pdev, PCI_COMMAND, &command); | ||
686 | if (command & PCI_COMMAND_FAST_BACK) | ||
687 | pci_write_config_word(pdev, PCI_COMMAND, command & ~PCI_COMMAND_FAST_BACK); | ||
688 | } | ||
689 | } | ||
690 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XIO2000A, | ||
691 | quirk_xio2000a); | ||
673 | 692 | ||
674 | #ifdef CONFIG_X86_IO_APIC | 693 | #ifdef CONFIG_X86_IO_APIC |
675 | 694 | ||
@@ -2572,6 +2591,19 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | |||
2572 | } | 2591 | } |
2573 | pci_do_fixups(dev, start, end); | 2592 | pci_do_fixups(dev, start, end); |
2574 | } | 2593 | } |
2594 | |||
2595 | static int __init pci_apply_final_quirks(void) | ||
2596 | { | ||
2597 | struct pci_dev *dev = NULL; | ||
2598 | |||
2599 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | ||
2600 | pci_fixup_device(pci_fixup_final, dev); | ||
2601 | } | ||
2602 | |||
2603 | return 0; | ||
2604 | } | ||
2605 | |||
2606 | fs_initcall_sync(pci_apply_final_quirks); | ||
2575 | #else | 2607 | #else |
2576 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} | 2608 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} |
2577 | #endif | 2609 | #endif |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index cb1a027eb552..0959430534b2 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -299,8 +299,17 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon | |||
299 | r = bus->resource[i]; | 299 | r = bus->resource[i]; |
300 | if (r == &ioport_resource || r == &iomem_resource) | 300 | if (r == &ioport_resource || r == &iomem_resource) |
301 | continue; | 301 | continue; |
302 | if (r && (r->flags & type_mask) == type && !r->parent) | 302 | if (r && (r->flags & type_mask) == type) { |
303 | return r; | 303 | if (!r->parent) |
304 | return r; | ||
305 | /* | ||
306 | * if there is no child under that, we should release | ||
307 | * and use it. don't need to reset it, pbus_size_* will | ||
308 | * set it again | ||
309 | */ | ||
310 | if (!r->child && !release_resource(r)) | ||
311 | return r; | ||
312 | } | ||
304 | } | 313 | } |
305 | return NULL; | 314 | return NULL; |
306 | } | 315 | } |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 706f82d8111f..c54526b206b5 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -205,43 +205,6 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
205 | return ret; | 205 | return ret; |
206 | } | 206 | } |
207 | 207 | ||
208 | #if 0 | ||
209 | int pci_assign_resource_fixed(struct pci_dev *dev, int resno) | ||
210 | { | ||
211 | struct pci_bus *bus = dev->bus; | ||
212 | struct resource *res = dev->resource + resno; | ||
213 | unsigned int type_mask; | ||
214 | int i, ret = -EBUSY; | ||
215 | |||
216 | type_mask = IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH; | ||
217 | |||
218 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { | ||
219 | struct resource *r = bus->resource[i]; | ||
220 | if (!r) | ||
221 | continue; | ||
222 | |||
223 | /* type_mask must match */ | ||
224 | if ((res->flags ^ r->flags) & type_mask) | ||
225 | continue; | ||
226 | |||
227 | ret = request_resource(r, res); | ||
228 | |||
229 | if (ret == 0) | ||
230 | break; | ||
231 | } | ||
232 | |||
233 | if (ret) { | ||
234 | dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", | ||
235 | resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); | ||
236 | } else if (resno < PCI_BRIDGE_RESOURCES) { | ||
237 | pci_update_resource(dev, resno); | ||
238 | } | ||
239 | |||
240 | return ret; | ||
241 | } | ||
242 | EXPORT_SYMBOL_GPL(pci_assign_resource_fixed); | ||
243 | #endif | ||
244 | |||
245 | /* Sort resources by alignment */ | 208 | /* Sort resources by alignment */ |
246 | void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | 209 | void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) |
247 | { | 210 | { |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 53b8c255360a..aaccc8ecfa8f 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2533,6 +2533,7 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, | |||
2533 | { | 2533 | { |
2534 | struct dasd_ccw_req *cqr; | 2534 | struct dasd_ccw_req *cqr; |
2535 | struct ccw1 *ccw; | 2535 | struct ccw1 *ccw; |
2536 | unsigned long *idaw; | ||
2536 | 2537 | ||
2537 | cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device); | 2538 | cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device); |
2538 | 2539 | ||
@@ -2546,9 +2547,17 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, | |||
2546 | 2547 | ||
2547 | ccw = cqr->cpaddr; | 2548 | ccw = cqr->cpaddr; |
2548 | ccw->cmd_code = CCW_CMD_RDC; | 2549 | ccw->cmd_code = CCW_CMD_RDC; |
2549 | ccw->cda = (__u32)(addr_t)rdc_buffer; | 2550 | if (idal_is_needed(rdc_buffer, rdc_buffer_size)) { |
2550 | ccw->count = rdc_buffer_size; | 2551 | idaw = (unsigned long *) (cqr->data); |
2552 | ccw->cda = (__u32)(addr_t) idaw; | ||
2553 | ccw->flags = CCW_FLAG_IDA; | ||
2554 | idaw = idal_create_words(idaw, rdc_buffer, rdc_buffer_size); | ||
2555 | } else { | ||
2556 | ccw->cda = (__u32)(addr_t) rdc_buffer; | ||
2557 | ccw->flags = 0; | ||
2558 | } | ||
2551 | 2559 | ||
2560 | ccw->count = rdc_buffer_size; | ||
2552 | cqr->startdev = device; | 2561 | cqr->startdev = device; |
2553 | cqr->memdev = device; | 2562 | cqr->memdev = device; |
2554 | cqr->expires = 10*HZ; | 2563 | cqr->expires = 10*HZ; |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 0be7c15f45c5..417b97cd3f94 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -3216,6 +3216,7 @@ int dasd_eckd_restore_device(struct dasd_device *device) | |||
3216 | struct dasd_eckd_characteristics temp_rdc_data; | 3216 | struct dasd_eckd_characteristics temp_rdc_data; |
3217 | int is_known, rc; | 3217 | int is_known, rc; |
3218 | struct dasd_uid temp_uid; | 3218 | struct dasd_uid temp_uid; |
3219 | unsigned long flags; | ||
3219 | 3220 | ||
3220 | private = (struct dasd_eckd_private *) device->private; | 3221 | private = (struct dasd_eckd_private *) device->private; |
3221 | 3222 | ||
@@ -3228,7 +3229,8 @@ int dasd_eckd_restore_device(struct dasd_device *device) | |||
3228 | rc = dasd_eckd_generate_uid(device, &private->uid); | 3229 | rc = dasd_eckd_generate_uid(device, &private->uid); |
3229 | dasd_get_uid(device->cdev, &temp_uid); | 3230 | dasd_get_uid(device->cdev, &temp_uid); |
3230 | if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0) | 3231 | if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0) |
3231 | dev_err(&device->cdev->dev, "The UID of the DASD has changed\n"); | 3232 | dev_err(&device->cdev->dev, "The UID of the DASD has " |
3233 | "changed\n"); | ||
3232 | if (rc) | 3234 | if (rc) |
3233 | goto out_err; | 3235 | goto out_err; |
3234 | dasd_set_uid(device->cdev, &private->uid); | 3236 | dasd_set_uid(device->cdev, &private->uid); |
@@ -3256,9 +3258,9 @@ int dasd_eckd_restore_device(struct dasd_device *device) | |||
3256 | "device: %s", rc, dev_name(&device->cdev->dev)); | 3258 | "device: %s", rc, dev_name(&device->cdev->dev)); |
3257 | goto out_err; | 3259 | goto out_err; |
3258 | } | 3260 | } |
3259 | spin_lock(get_ccwdev_lock(device->cdev)); | 3261 | spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); |
3260 | memcpy(&private->rdc_data, &temp_rdc_data, sizeof(temp_rdc_data)); | 3262 | memcpy(&private->rdc_data, &temp_rdc_data, sizeof(temp_rdc_data)); |
3261 | spin_unlock(get_ccwdev_lock(device->cdev)); | 3263 | spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); |
3262 | 3264 | ||
3263 | /* add device to alias management */ | 3265 | /* add device to alias management */ |
3264 | dasd_alias_add_device(device); | 3266 | dasd_alias_add_device(device); |
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c index daaec185ed36..a4f68e5b9c96 100644 --- a/drivers/s390/char/sclp_async.c +++ b/drivers/s390/char/sclp_async.c | |||
@@ -62,7 +62,7 @@ static struct notifier_block call_home_panic_nb = { | |||
62 | .priority = INT_MAX, | 62 | .priority = INT_MAX, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int proc_handler_callhome(ctl_table *ctl, int write, struct file *filp, | 65 | static int proc_handler_callhome(struct ctl_table *ctl, int write, |
66 | void __user *buffer, size_t *count, | 66 | void __user *buffer, size_t *count, |
67 | loff_t *ppos) | 67 | loff_t *ppos) |
68 | { | 68 | { |
@@ -100,7 +100,7 @@ static struct ctl_table callhome_table[] = { | |||
100 | { | 100 | { |
101 | .procname = "callhome", | 101 | .procname = "callhome", |
102 | .mode = 0644, | 102 | .mode = 0644, |
103 | .proc_handler = &proc_handler_callhome, | 103 | .proc_handler = proc_handler_callhome, |
104 | }, | 104 | }, |
105 | { .ctl_name = 0 } | 105 | { .ctl_name = 0 } |
106 | }; | 106 | }; |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 178724f2a4c3..b9d2a007e93b 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -705,21 +705,6 @@ out_driver: | |||
705 | } | 705 | } |
706 | __initcall(sclp_vt220_tty_init); | 706 | __initcall(sclp_vt220_tty_init); |
707 | 707 | ||
708 | #ifdef CONFIG_SCLP_VT220_CONSOLE | ||
709 | |||
710 | static void | ||
711 | sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count) | ||
712 | { | ||
713 | __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0); | ||
714 | } | ||
715 | |||
716 | static struct tty_driver * | ||
717 | sclp_vt220_con_device(struct console *c, int *index) | ||
718 | { | ||
719 | *index = 0; | ||
720 | return sclp_vt220_driver; | ||
721 | } | ||
722 | |||
723 | static void __sclp_vt220_flush_buffer(void) | 708 | static void __sclp_vt220_flush_buffer(void) |
724 | { | 709 | { |
725 | unsigned long flags; | 710 | unsigned long flags; |
@@ -776,6 +761,21 @@ static void sclp_vt220_pm_event_fn(struct sclp_register *reg, | |||
776 | } | 761 | } |
777 | } | 762 | } |
778 | 763 | ||
764 | #ifdef CONFIG_SCLP_VT220_CONSOLE | ||
765 | |||
766 | static void | ||
767 | sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count) | ||
768 | { | ||
769 | __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0); | ||
770 | } | ||
771 | |||
772 | static struct tty_driver * | ||
773 | sclp_vt220_con_device(struct console *c, int *index) | ||
774 | { | ||
775 | *index = 0; | ||
776 | return sclp_vt220_driver; | ||
777 | } | ||
778 | |||
779 | static int | 779 | static int |
780 | sclp_vt220_notify(struct notifier_block *self, | 780 | sclp_vt220_notify(struct notifier_block *self, |
781 | unsigned long event, void *data) | 781 | unsigned long event, void *data) |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 64f57ef2763c..0c0705b91c28 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -162,9 +162,10 @@ tapeblock_requeue(struct work_struct *work) { | |||
162 | spin_lock_irq(&device->blk_data.request_queue_lock); | 162 | spin_lock_irq(&device->blk_data.request_queue_lock); |
163 | while ( | 163 | while ( |
164 | !blk_queue_plugged(queue) && | 164 | !blk_queue_plugged(queue) && |
165 | (req = blk_fetch_request(queue)) && | 165 | blk_peek_request(queue) && |
166 | nr_queued < TAPEBLOCK_MIN_REQUEUE | 166 | nr_queued < TAPEBLOCK_MIN_REQUEUE |
167 | ) { | 167 | ) { |
168 | req = blk_fetch_request(queue); | ||
168 | if (rq_data_dir(req) == WRITE) { | 169 | if (rq_data_dir(req) == WRITE) { |
169 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); | 170 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); |
170 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 171 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 2ee093ec86e4..2490b741e16a 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1250,8 +1250,7 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
1250 | unsigned long flags; | 1250 | unsigned long flags; |
1251 | struct ccw_dev_id dev_id; | 1251 | struct ccw_dev_id dev_id; |
1252 | 1252 | ||
1253 | cdev = sch_get_cdev(sch); | 1253 | if (cio_is_console(sch->schid)) { |
1254 | if (cdev) { | ||
1255 | rc = sysfs_create_group(&sch->dev.kobj, | 1254 | rc = sysfs_create_group(&sch->dev.kobj, |
1256 | &io_subchannel_attr_group); | 1255 | &io_subchannel_attr_group); |
1257 | if (rc) | 1256 | if (rc) |
@@ -1260,13 +1259,13 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
1260 | "0.%x.%04x (rc=%d)\n", | 1259 | "0.%x.%04x (rc=%d)\n", |
1261 | sch->schid.ssid, sch->schid.sch_no, rc); | 1260 | sch->schid.ssid, sch->schid.sch_no, rc); |
1262 | /* | 1261 | /* |
1263 | * This subchannel already has an associated ccw_device. | 1262 | * The console subchannel already has an associated ccw_device. |
1264 | * Throw the delayed uevent for the subchannel, register | 1263 | * Throw the delayed uevent for the subchannel, register |
1265 | * the ccw_device and exit. This happens for all early | 1264 | * the ccw_device and exit. |
1266 | * devices, e.g. the console. | ||
1267 | */ | 1265 | */ |
1268 | dev_set_uevent_suppress(&sch->dev, 0); | 1266 | dev_set_uevent_suppress(&sch->dev, 0); |
1269 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 1267 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
1268 | cdev = sch_get_cdev(sch); | ||
1270 | cdev->dev.groups = ccwdev_attr_groups; | 1269 | cdev->dev.groups = ccwdev_attr_groups; |
1271 | device_initialize(&cdev->dev); | 1270 | device_initialize(&cdev->dev); |
1272 | ccw_device_register(cdev); | 1271 | ccw_device_register(cdev); |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 1689bda1d13b..dcc72444e8e7 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1270,6 +1270,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1270 | 1270 | ||
1271 | BUG_ON(!kernel_locked()); | 1271 | BUG_ON(!kernel_locked()); |
1272 | 1272 | ||
1273 | if (!state) | ||
1274 | return; | ||
1275 | |||
1273 | uport = state->uart_port; | 1276 | uport = state->uart_port; |
1274 | port = &state->port; | 1277 | port = &state->port; |
1275 | 1278 | ||
@@ -1316,9 +1319,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1316 | */ | 1319 | */ |
1317 | if (port->flags & ASYNC_INITIALIZED) { | 1320 | if (port->flags & ASYNC_INITIALIZED) { |
1318 | unsigned long flags; | 1321 | unsigned long flags; |
1319 | spin_lock_irqsave(&port->lock, flags); | 1322 | spin_lock_irqsave(&uport->lock, flags); |
1320 | uport->ops->stop_rx(uport); | 1323 | uport->ops->stop_rx(uport); |
1321 | spin_unlock_irqrestore(&port->lock, flags); | 1324 | spin_unlock_irqrestore(&uport->lock, flags); |
1322 | /* | 1325 | /* |
1323 | * Before we drop DTR, make sure the UART transmitter | 1326 | * Before we drop DTR, make sure the UART transmitter |
1324 | * has completely drained; this is especially | 1327 | * has completely drained; this is especially |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 958a3ffc8987..ff5bbb9c43c9 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -1826,7 +1826,7 @@ static struct amba_id pl022_ids[] = { | |||
1826 | * ST Micro derivative, this has 32bit wide | 1826 | * ST Micro derivative, this has 32bit wide |
1827 | * and 32 locations deep TX/RX FIFO | 1827 | * and 32 locations deep TX/RX FIFO |
1828 | */ | 1828 | */ |
1829 | .id = 0x00108022, | 1829 | .id = 0x01080022, |
1830 | .mask = 0xffffffff, | 1830 | .mask = 0xffffffff, |
1831 | .data = &vendor_st, | 1831 | .data = &vendor_st, |
1832 | }, | 1832 | }, |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 23cf3bde4762..83b5f9cea85a 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -475,4 +475,4 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev) | |||
475 | else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI) | 475 | else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI) |
476 | quirk_usb_handoff_xhci(pdev); | 476 | quirk_usb_handoff_xhci(pdev); |
477 | } | 477 | } |
478 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff); | 478 | DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff); |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 760e7271d17b..b84abd8ee8a5 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -9,7 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options" | |||
9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller | 9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller |
10 | config USB_MUSB_HDRC | 10 | config USB_MUSB_HDRC |
11 | depends on (USB || USB_GADGET) | 11 | depends on (USB || USB_GADGET) |
12 | depends on !SUPERH | 12 | depends on (ARM || BLACKFIN) |
13 | select NOP_USB_XCEIV if ARCH_DAVINCI | 13 | select NOP_USB_XCEIV if ARCH_DAVINCI |
14 | select TWL4030_USB if MACH_OMAP_3430SDP | 14 | select TWL4030_USB if MACH_OMAP_3430SDP |
15 | select NOP_USB_XCEIV if MACH_OMAP3EVM | 15 | select NOP_USB_XCEIV if MACH_OMAP3EVM |
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index 1e8f02f440e6..d3c824dc2358 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
@@ -206,7 +206,7 @@ static int __devinit riowd_probe(struct of_device *op, | |||
206 | 206 | ||
207 | dev_set_drvdata(&op->dev, p); | 207 | dev_set_drvdata(&op->dev, p); |
208 | riowd_device = p; | 208 | riowd_device = p; |
209 | err = 0; | 209 | return 0; |
210 | 210 | ||
211 | out_iounmap: | 211 | out_iounmap: |
212 | of_iounmap(&op->resource[0], p->regs, 2); | 212 | of_iounmap(&op->resource[0], p->regs, 2); |