diff options
Diffstat (limited to 'drivers')
322 files changed, 2365 insertions, 1158 deletions
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c index 6355b575ee5a..5df67f1d6c61 100644 --- a/drivers/acpi/debugfs.c +++ b/drivers/acpi/debugfs.c | |||
@@ -80,7 +80,7 @@ int __init acpi_debugfs_init(void) | |||
80 | if (!acpi_dir) | 80 | if (!acpi_dir) |
81 | goto err; | 81 | goto err; |
82 | 82 | ||
83 | cm_dentry = debugfs_create_file("custom_method", S_IWUGO, | 83 | cm_dentry = debugfs_create_file("custom_method", S_IWUSR, |
84 | acpi_dir, NULL, &cm_fops); | 84 | acpi_dir, NULL, &cm_fops); |
85 | if (!cm_dentry) | 85 | if (!cm_dentry) |
86 | goto err; | 86 | goto err; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3f91c01c217f..66aa4bee80a6 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3166,8 +3166,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
3166 | 3166 | ||
3167 | /** | 3167 | /** |
3168 | * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device | 3168 | * ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device |
3169 | * @shost: SCSI host of command to be sent | ||
3169 | * @cmd: SCSI command to be sent | 3170 | * @cmd: SCSI command to be sent |
3170 | * @done: Completion function, called when command is complete | ||
3171 | * | 3171 | * |
3172 | * In some cases, this function translates SCSI commands into | 3172 | * In some cases, this function translates SCSI commands into |
3173 | * ATA taskfiles, and queues the taskfiles to be sent to | 3173 | * ATA taskfiles, and queues the taskfiles to be sent to |
@@ -3177,37 +3177,36 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
3177 | * ATA and ATAPI devices appearing as SCSI devices. | 3177 | * ATA and ATAPI devices appearing as SCSI devices. |
3178 | * | 3178 | * |
3179 | * LOCKING: | 3179 | * LOCKING: |
3180 | * Releases scsi-layer-held lock, and obtains host lock. | 3180 | * ATA host lock |
3181 | * | 3181 | * |
3182 | * RETURNS: | 3182 | * RETURNS: |
3183 | * Return value from __ata_scsi_queuecmd() if @cmd can be queued, | 3183 | * Return value from __ata_scsi_queuecmd() if @cmd can be queued, |
3184 | * 0 otherwise. | 3184 | * 0 otherwise. |
3185 | */ | 3185 | */ |
3186 | int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 3186 | int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd) |
3187 | { | 3187 | { |
3188 | struct ata_port *ap; | 3188 | struct ata_port *ap; |
3189 | struct ata_device *dev; | 3189 | struct ata_device *dev; |
3190 | struct scsi_device *scsidev = cmd->device; | 3190 | struct scsi_device *scsidev = cmd->device; |
3191 | struct Scsi_Host *shost = scsidev->host; | ||
3192 | int rc = 0; | 3191 | int rc = 0; |
3192 | unsigned long irq_flags; | ||
3193 | 3193 | ||
3194 | ap = ata_shost_to_port(shost); | 3194 | ap = ata_shost_to_port(shost); |
3195 | 3195 | ||
3196 | spin_unlock(shost->host_lock); | 3196 | spin_lock_irqsave(ap->lock, irq_flags); |
3197 | spin_lock(ap->lock); | ||
3198 | 3197 | ||
3199 | ata_scsi_dump_cdb(ap, cmd); | 3198 | ata_scsi_dump_cdb(ap, cmd); |
3200 | 3199 | ||
3201 | dev = ata_scsi_find_dev(ap, scsidev); | 3200 | dev = ata_scsi_find_dev(ap, scsidev); |
3202 | if (likely(dev)) | 3201 | if (likely(dev)) |
3203 | rc = __ata_scsi_queuecmd(cmd, done, dev); | 3202 | rc = __ata_scsi_queuecmd(cmd, cmd->scsi_done, dev); |
3204 | else { | 3203 | else { |
3205 | cmd->result = (DID_BAD_TARGET << 16); | 3204 | cmd->result = (DID_BAD_TARGET << 16); |
3206 | done(cmd); | 3205 | cmd->scsi_done(cmd); |
3207 | } | 3206 | } |
3208 | 3207 | ||
3209 | spin_unlock(ap->lock); | 3208 | spin_unlock_irqrestore(ap->lock, irq_flags); |
3210 | spin_lock(shost->host_lock); | 3209 | |
3211 | return rc; | 3210 | return rc; |
3212 | } | 3211 | } |
3213 | 3212 | ||
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index c21589986c69..8b677bbf2d37 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -538,7 +538,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
540 | 540 | ||
541 | static void svia_configure(struct pci_dev *pdev) | 541 | static void svia_configure(struct pci_dev *pdev, int board_id) |
542 | { | 542 | { |
543 | u8 tmp8; | 543 | u8 tmp8; |
544 | 544 | ||
@@ -577,7 +577,7 @@ static void svia_configure(struct pci_dev *pdev) | |||
577 | } | 577 | } |
578 | 578 | ||
579 | /* | 579 | /* |
580 | * vt6421 has problems talking to some drives. The following | 580 | * vt6420/1 has problems talking to some drives. The following |
581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. | 581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. |
582 | * | 582 | * |
583 | * When host issues HOLD, device may send up to 20DW of data | 583 | * When host issues HOLD, device may send up to 20DW of data |
@@ -596,8 +596,9 @@ static void svia_configure(struct pci_dev *pdev) | |||
596 | * | 596 | * |
597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 | 597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 |
598 | * http://article.gmane.org/gmane.linux.ide/46352 | 598 | * http://article.gmane.org/gmane.linux.ide/46352 |
599 | * http://thread.gmane.org/gmane.linux.kernel/1062139 | ||
599 | */ | 600 | */ |
600 | if (pdev->device == 0x3249) { | 601 | if (board_id == vt6420 || board_id == vt6421) { |
601 | pci_read_config_byte(pdev, 0x52, &tmp8); | 602 | pci_read_config_byte(pdev, 0x52, &tmp8); |
602 | tmp8 |= 1 << 2; | 603 | tmp8 |= 1 << 2; |
603 | pci_write_config_byte(pdev, 0x52, tmp8); | 604 | pci_write_config_byte(pdev, 0x52, tmp8); |
@@ -652,7 +653,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
652 | if (rc) | 653 | if (rc) |
653 | return rc; | 654 | return rc; |
654 | 655 | ||
655 | svia_configure(pdev); | 656 | svia_configure(pdev, board_id); |
656 | 657 | ||
657 | pci_set_master(pdev); | 658 | pci_set_master(pdev); |
658 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, | 659 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 31b526661ec4..ead3e79d6fcf 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -475,20 +475,33 @@ End: | |||
475 | */ | 475 | */ |
476 | void dpm_resume_noirq(pm_message_t state) | 476 | void dpm_resume_noirq(pm_message_t state) |
477 | { | 477 | { |
478 | struct device *dev; | 478 | struct list_head list; |
479 | ktime_t starttime = ktime_get(); | 479 | ktime_t starttime = ktime_get(); |
480 | 480 | ||
481 | INIT_LIST_HEAD(&list); | ||
481 | mutex_lock(&dpm_list_mtx); | 482 | mutex_lock(&dpm_list_mtx); |
482 | transition_started = false; | 483 | transition_started = false; |
483 | list_for_each_entry(dev, &dpm_list, power.entry) | 484 | while (!list_empty(&dpm_list)) { |
485 | struct device *dev = to_device(dpm_list.next); | ||
486 | |||
487 | get_device(dev); | ||
484 | if (dev->power.status > DPM_OFF) { | 488 | if (dev->power.status > DPM_OFF) { |
485 | int error; | 489 | int error; |
486 | 490 | ||
487 | dev->power.status = DPM_OFF; | 491 | dev->power.status = DPM_OFF; |
492 | mutex_unlock(&dpm_list_mtx); | ||
493 | |||
488 | error = device_resume_noirq(dev, state); | 494 | error = device_resume_noirq(dev, state); |
495 | |||
496 | mutex_lock(&dpm_list_mtx); | ||
489 | if (error) | 497 | if (error) |
490 | pm_dev_err(dev, state, " early", error); | 498 | pm_dev_err(dev, state, " early", error); |
491 | } | 499 | } |
500 | if (!list_empty(&dev->power.entry)) | ||
501 | list_move_tail(&dev->power.entry, &list); | ||
502 | put_device(dev); | ||
503 | } | ||
504 | list_splice(&list, &dpm_list); | ||
492 | mutex_unlock(&dpm_list_mtx); | 505 | mutex_unlock(&dpm_list_mtx); |
493 | dpm_show_time(starttime, state, "early"); | 506 | dpm_show_time(starttime, state, "early"); |
494 | resume_device_irqs(); | 507 | resume_device_irqs(); |
@@ -789,20 +802,33 @@ End: | |||
789 | */ | 802 | */ |
790 | int dpm_suspend_noirq(pm_message_t state) | 803 | int dpm_suspend_noirq(pm_message_t state) |
791 | { | 804 | { |
792 | struct device *dev; | 805 | struct list_head list; |
793 | ktime_t starttime = ktime_get(); | 806 | ktime_t starttime = ktime_get(); |
794 | int error = 0; | 807 | int error = 0; |
795 | 808 | ||
809 | INIT_LIST_HEAD(&list); | ||
796 | suspend_device_irqs(); | 810 | suspend_device_irqs(); |
797 | mutex_lock(&dpm_list_mtx); | 811 | mutex_lock(&dpm_list_mtx); |
798 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { | 812 | while (!list_empty(&dpm_list)) { |
813 | struct device *dev = to_device(dpm_list.prev); | ||
814 | |||
815 | get_device(dev); | ||
816 | mutex_unlock(&dpm_list_mtx); | ||
817 | |||
799 | error = device_suspend_noirq(dev, state); | 818 | error = device_suspend_noirq(dev, state); |
819 | |||
820 | mutex_lock(&dpm_list_mtx); | ||
800 | if (error) { | 821 | if (error) { |
801 | pm_dev_err(dev, state, " late", error); | 822 | pm_dev_err(dev, state, " late", error); |
823 | put_device(dev); | ||
802 | break; | 824 | break; |
803 | } | 825 | } |
804 | dev->power.status = DPM_OFF_IRQ; | 826 | dev->power.status = DPM_OFF_IRQ; |
827 | if (!list_empty(&dev->power.entry)) | ||
828 | list_move(&dev->power.entry, &list); | ||
829 | put_device(dev); | ||
805 | } | 830 | } |
831 | list_splice_tail(&list, &dpm_list); | ||
806 | mutex_unlock(&dpm_list_mtx); | 832 | mutex_unlock(&dpm_list_mtx); |
807 | if (error) | 833 | if (error) |
808 | dpm_resume_noirq(resume_event(state)); | 834 | dpm_resume_noirq(resume_event(state)); |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 575495f3c4b8..727d0225b7d0 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -62,8 +62,8 @@ static int cciss_scsi_proc_info( | |||
62 | int length, /* length of data in buffer */ | 62 | int length, /* length of data in buffer */ |
63 | int func); /* 0 == read, 1 == write */ | 63 | int func); /* 0 == read, 1 == write */ |
64 | 64 | ||
65 | static int cciss_scsi_queue_command (struct scsi_cmnd *cmd, | 65 | static int cciss_scsi_queue_command (struct Scsi_Host *h, |
66 | void (* done)(struct scsi_cmnd *)); | 66 | struct scsi_cmnd *cmd); |
67 | static int cciss_eh_device_reset_handler(struct scsi_cmnd *); | 67 | static int cciss_eh_device_reset_handler(struct scsi_cmnd *); |
68 | static int cciss_eh_abort_handler(struct scsi_cmnd *); | 68 | static int cciss_eh_abort_handler(struct scsi_cmnd *); |
69 | 69 | ||
@@ -1406,7 +1406,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c, | |||
1406 | 1406 | ||
1407 | 1407 | ||
1408 | static int | 1408 | static int |
1409 | cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | 1409 | cciss_scsi_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
1410 | { | 1410 | { |
1411 | ctlr_info_t *h; | 1411 | ctlr_info_t *h; |
1412 | int rc; | 1412 | int rc; |
@@ -1504,6 +1504,8 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd | |||
1504 | return 0; | 1504 | return 0; |
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | static DEF_SCSI_QCMD(cciss_scsi_queue_command) | ||
1508 | |||
1507 | static void cciss_unregister_scsi(ctlr_info_t *h) | 1509 | static void cciss_unregister_scsi(ctlr_info_t *h) |
1508 | { | 1510 | { |
1509 | struct cciss_scsi_adapter_data_t *sa; | 1511 | struct cciss_scsi_adapter_data_t *sa; |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index d299fe9e78c8..89d8a7cc4054 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/memcontrol.h> | 36 | #include <linux/memcontrol.h> |
37 | #include <linux/mm_inline.h> | 37 | #include <linux/mm_inline.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/pkt_sched.h> | 39 | #include <linux/pkt_sched.h> |
41 | #define __KERNEL_SYSCALLS__ | 40 | #define __KERNEL_SYSCALLS__ |
42 | #include <linux/unistd.h> | 41 | #include <linux/unistd.h> |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index b0551ba7ad0c..47d223c2409c 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/drbd.h> | 27 | #include <linux/drbd.h> |
28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
31 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
32 | #include <linux/memcontrol.h> | 31 | #include <linux/memcontrol.h> |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 43412c03969e..3cb4539a98b2 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/fs.h> | 40 | #include <linux/fs.h> |
41 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
42 | #include <linux/smp_lock.h> | ||
43 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
44 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
45 | #include "agp.h" | 44 | #include "agp.h" |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index c0bd6f472c52..6ee3348bc3e4 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -81,7 +81,6 @@ static char *serial_version = "4.30"; | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
85 | #include <linux/init.h> | 84 | #include <linux/init.h> |
86 | #include <linux/bitops.h> | 85 | #include <linux/bitops.h> |
87 | #include <linux/platform_device.h> | 86 | #include <linux/platform_device.h> |
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c index f6718f05dad4..095ab90535ce 100644 --- a/drivers/char/briq_panel.c +++ b/drivers/char/briq_panel.c | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
10 | #include <linux/types.h> | 9 | #include <linux/types.h> |
11 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
12 | #include <linux/tty.h> | 11 | #include <linux/tty.h> |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 55b8667f739f..7066e801b9d3 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/smp_lock.h> | ||
18 | #include <linux/types.h> | 17 | #include <linux/types.h> |
19 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
20 | #include <linux/major.h> | 19 | #include <linux/major.h> |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 788da05190cc..2016aad85203 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
38 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/init.h> | 40 | #include <linux/init.h> |
42 | #include <linux/miscdevice.h> | 41 | #include <linux/miscdevice.h> |
43 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 3bc0eef88717..d72433f2d310 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -120,7 +120,7 @@ static int i8k_smm(struct smm_regs *regs) | |||
120 | int eax = regs->eax; | 120 | int eax = regs->eax; |
121 | 121 | ||
122 | #if defined(CONFIG_X86_64) | 122 | #if defined(CONFIG_X86_64) |
123 | asm("pushq %%rax\n\t" | 123 | asm volatile("pushq %%rax\n\t" |
124 | "movl 0(%%rax),%%edx\n\t" | 124 | "movl 0(%%rax),%%edx\n\t" |
125 | "pushq %%rdx\n\t" | 125 | "pushq %%rdx\n\t" |
126 | "movl 4(%%rax),%%ebx\n\t" | 126 | "movl 4(%%rax),%%ebx\n\t" |
@@ -146,7 +146,7 @@ static int i8k_smm(struct smm_regs *regs) | |||
146 | : "a"(regs) | 146 | : "a"(regs) |
147 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | 147 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); |
148 | #else | 148 | #else |
149 | asm("pushl %%eax\n\t" | 149 | asm volatile("pushl %%eax\n\t" |
150 | "movl 0(%%eax),%%edx\n\t" | 150 | "movl 0(%%eax),%%edx\n\t" |
151 | "push %%edx\n\t" | 151 | "push %%edx\n\t" |
152 | "movl 4(%%eax),%%ebx\n\t" | 152 | "movl 4(%%eax),%%ebx\n\t" |
@@ -167,7 +167,8 @@ static int i8k_smm(struct smm_regs *regs) | |||
167 | "movl %%edx,0(%%eax)\n\t" | 167 | "movl %%edx,0(%%eax)\n\t" |
168 | "lahf\n\t" | 168 | "lahf\n\t" |
169 | "shrl $8,%%eax\n\t" | 169 | "shrl $8,%%eax\n\t" |
170 | "andl $1,%%eax\n":"=a"(rc) | 170 | "andl $1,%%eax\n" |
171 | :"=a"(rc) | ||
171 | : "a"(regs) | 172 | : "a"(regs) |
172 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); | 173 | : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); |
173 | #endif | 174 | #endif |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 667abd23ad6a..7c6de4c92458 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
26 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
27 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index d962f25dcc2a..777181a2e603 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -979,8 +979,9 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count, | |||
979 | if (dev->flags0 & 1) { | 979 | if (dev->flags0 & 1) { |
980 | set_bit(IS_CMM_ABSENT, &dev->flags); | 980 | set_bit(IS_CMM_ABSENT, &dev->flags); |
981 | rc = -ENODEV; | 981 | rc = -ENODEV; |
982 | } else { | ||
983 | rc = -EIO; | ||
982 | } | 984 | } |
983 | rc = -EIO; | ||
984 | goto release_io; | 985 | goto release_io; |
985 | } | 986 | } |
986 | 987 | ||
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index f646725bd567..748c3b0ecd89 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/serial.h> | 53 | #include <linux/serial.h> |
54 | #include <linux/serialP.h> | 54 | #include <linux/serialP.h> |
55 | #include <linux/smp_lock.h> | ||
56 | #include <linux/string.h> | 55 | #include <linux/string.h> |
57 | #include <linux/fcntl.h> | 56 | #include <linux/fcntl.h> |
58 | #include <linux/ptrace.h> | 57 | #include <linux/ptrace.h> |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 9f8495b4fc8f..a7616d226a49 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -87,7 +87,6 @@ | |||
87 | #include <linux/tty_flip.h> | 87 | #include <linux/tty_flip.h> |
88 | #include <linux/mm.h> | 88 | #include <linux/mm.h> |
89 | #include <linux/serial.h> | 89 | #include <linux/serial.h> |
90 | #include <linux/smp_lock.h> | ||
91 | #include <linux/fcntl.h> | 90 | #include <linux/fcntl.h> |
92 | #include <linux/major.h> | 91 | #include <linux/major.h> |
93 | #include <linux/delay.h> | 92 | #include <linux/delay.h> |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 4bef6ab83622..461a5a045517 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/stallion.h> | 40 | #include <linux/stallion.h> |
41 | #include <linux/ioport.h> | 41 | #include <linux/ioport.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/smp_lock.h> | ||
44 | #include <linux/device.h> | 43 | #include <linux/device.h> |
45 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
46 | #include <linux/ctype.h> | 45 | #include <linux/ctype.h> |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index e53f16865397..a786326cea2f 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -216,7 +216,6 @@ | |||
216 | #include <linux/eisa.h> | 216 | #include <linux/eisa.h> |
217 | #include <linux/pci.h> | 217 | #include <linux/pci.h> |
218 | #include <linux/slab.h> | 218 | #include <linux/slab.h> |
219 | #include <linux/smp_lock.h> | ||
220 | #include <linux/init.h> | 219 | #include <linux/init.h> |
221 | #include <linux/miscdevice.h> | 220 | #include <linux/miscdevice.h> |
222 | #include <linux/bitops.h> | 221 | #include <linux/bitops.h> |
diff --git a/drivers/char/uv_mmtimer.c b/drivers/char/uv_mmtimer.c index 493b47a0d511..956ebe2080a5 100644 --- a/drivers/char/uv_mmtimer.c +++ b/drivers/char/uv_mmtimer.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/time.h> | 24 | #include <linux/time.h> |
25 | #include <linux/math64.h> | 25 | #include <linux/math64.h> |
26 | #include <linux/smp_lock.h> | ||
27 | 26 | ||
28 | #include <asm/genapic.h> | 27 | #include <asm/genapic.h> |
29 | #include <asm/uv/uv_hub.h> | 28 | #include <asm/uv/uv_hub.h> |
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c index 88ee01510ec0..76141262ea1d 100644 --- a/drivers/crypto/n2_core.c +++ b/drivers/crypto/n2_core.c | |||
@@ -1832,7 +1832,7 @@ static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node, | |||
1832 | return -ENODEV; | 1832 | return -ENODEV; |
1833 | 1833 | ||
1834 | ino = mdesc_get_property(mdesc, node, "ino", &ino_len); | 1834 | ino = mdesc_get_property(mdesc, node, "ino", &ino_len); |
1835 | if (!intr) | 1835 | if (!ino) |
1836 | return -ENODEV; | 1836 | return -ENODEV; |
1837 | 1837 | ||
1838 | if (intr_len != ino_len) | 1838 | if (intr_len != ino_len) |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 2e992bc8015b..8a515baa38f7 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -286,7 +286,7 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, | |||
286 | if (initial) | 286 | if (initial) |
287 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ | 287 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ |
288 | : "+S" (input), "+D" (output), "+a" (iv) | 288 | : "+S" (input), "+D" (output), "+a" (iv) |
289 | : "d" (control_word), "b" (key), "c" (count)); | 289 | : "d" (control_word), "b" (key), "c" (initial)); |
290 | 290 | ||
291 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ | 291 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ |
292 | : "+S" (input), "+D" (output), "+a" (iv) | 292 | : "+S" (input), "+D" (output), "+a" (iv) |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index bfae4b309791..afa576a75a8e 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -1468,7 +1468,7 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb, | |||
1468 | 1468 | ||
1469 | /* SCSI stack integration */ | 1469 | /* SCSI stack integration */ |
1470 | 1470 | ||
1471 | static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | 1471 | static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done) |
1472 | { | 1472 | { |
1473 | struct sbp2_logical_unit *lu = cmd->device->hostdata; | 1473 | struct sbp2_logical_unit *lu = cmd->device->hostdata; |
1474 | struct fw_device *device = target_device(lu->tgt); | 1474 | struct fw_device *device = target_device(lu->tgt); |
@@ -1534,6 +1534,8 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1534 | return retval; | 1534 | return retval; |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | static DEF_SCSI_QCMD(sbp2_scsi_queuecommand) | ||
1538 | |||
1537 | static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) | 1539 | static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) |
1538 | { | 1540 | { |
1539 | struct sbp2_logical_unit *lu = sdev->hostdata; | 1541 | struct sbp2_logical_unit *lu = sdev->hostdata; |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index b744dad5c237..a39794bac04b 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include "drmP.h" | 37 | #include "drmP.h" |
38 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/smp_lock.h> | ||
41 | 40 | ||
42 | /* from BKL pushdown: note that nothing else serializes idr_find() */ | 41 | /* from BKL pushdown: note that nothing else serializes idr_find() */ |
43 | DEFINE_MUTEX(drm_global_mutex); | 42 | DEFINE_MUTEX(drm_global_mutex); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 80745f85902c..f737960712e6 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -150,7 +150,8 @@ static const struct intel_device_info intel_ironlake_d_info = { | |||
150 | 150 | ||
151 | static const struct intel_device_info intel_ironlake_m_info = { | 151 | static const struct intel_device_info intel_ironlake_m_info = { |
152 | .gen = 5, .is_mobile = 1, | 152 | .gen = 5, .is_mobile = 1, |
153 | .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1, | 153 | .need_gfx_hws = 1, .has_rc6 = 1, .has_hotplug = 1, |
154 | .has_fbc = 0, /* disabled due to buggy hardware */ | ||
154 | .has_bsd_ring = 1, | 155 | .has_bsd_ring = 1, |
155 | }; | 156 | }; |
156 | 157 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 90414ae86afc..409826da3099 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1045,6 +1045,8 @@ void i915_gem_clflush_object(struct drm_gem_object *obj); | |||
1045 | int i915_gem_object_set_domain(struct drm_gem_object *obj, | 1045 | int i915_gem_object_set_domain(struct drm_gem_object *obj, |
1046 | uint32_t read_domains, | 1046 | uint32_t read_domains, |
1047 | uint32_t write_domain); | 1047 | uint32_t write_domain); |
1048 | int i915_gem_object_flush_gpu(struct drm_i915_gem_object *obj, | ||
1049 | bool interruptible); | ||
1048 | int i915_gem_init_ringbuffer(struct drm_device *dev); | 1050 | int i915_gem_init_ringbuffer(struct drm_device *dev); |
1049 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); | 1051 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); |
1050 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, | 1052 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ef188e391406..17b1cba3b5f1 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -547,6 +547,19 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
547 | struct drm_i915_gem_object *obj_priv; | 547 | struct drm_i915_gem_object *obj_priv; |
548 | int ret = 0; | 548 | int ret = 0; |
549 | 549 | ||
550 | if (args->size == 0) | ||
551 | return 0; | ||
552 | |||
553 | if (!access_ok(VERIFY_WRITE, | ||
554 | (char __user *)(uintptr_t)args->data_ptr, | ||
555 | args->size)) | ||
556 | return -EFAULT; | ||
557 | |||
558 | ret = fault_in_pages_writeable((char __user *)(uintptr_t)args->data_ptr, | ||
559 | args->size); | ||
560 | if (ret) | ||
561 | return -EFAULT; | ||
562 | |||
550 | ret = i915_mutex_lock_interruptible(dev); | 563 | ret = i915_mutex_lock_interruptible(dev); |
551 | if (ret) | 564 | if (ret) |
552 | return ret; | 565 | return ret; |
@@ -564,23 +577,6 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
564 | goto out; | 577 | goto out; |
565 | } | 578 | } |
566 | 579 | ||
567 | if (args->size == 0) | ||
568 | goto out; | ||
569 | |||
570 | if (!access_ok(VERIFY_WRITE, | ||
571 | (char __user *)(uintptr_t)args->data_ptr, | ||
572 | args->size)) { | ||
573 | ret = -EFAULT; | ||
574 | goto out; | ||
575 | } | ||
576 | |||
577 | ret = fault_in_pages_writeable((char __user *)(uintptr_t)args->data_ptr, | ||
578 | args->size); | ||
579 | if (ret) { | ||
580 | ret = -EFAULT; | ||
581 | goto out; | ||
582 | } | ||
583 | |||
584 | ret = i915_gem_object_get_pages_or_evict(obj); | 580 | ret = i915_gem_object_get_pages_or_evict(obj); |
585 | if (ret) | 581 | if (ret) |
586 | goto out; | 582 | goto out; |
@@ -981,7 +977,20 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
981 | struct drm_i915_gem_pwrite *args = data; | 977 | struct drm_i915_gem_pwrite *args = data; |
982 | struct drm_gem_object *obj; | 978 | struct drm_gem_object *obj; |
983 | struct drm_i915_gem_object *obj_priv; | 979 | struct drm_i915_gem_object *obj_priv; |
984 | int ret = 0; | 980 | int ret; |
981 | |||
982 | if (args->size == 0) | ||
983 | return 0; | ||
984 | |||
985 | if (!access_ok(VERIFY_READ, | ||
986 | (char __user *)(uintptr_t)args->data_ptr, | ||
987 | args->size)) | ||
988 | return -EFAULT; | ||
989 | |||
990 | ret = fault_in_pages_readable((char __user *)(uintptr_t)args->data_ptr, | ||
991 | args->size); | ||
992 | if (ret) | ||
993 | return -EFAULT; | ||
985 | 994 | ||
986 | ret = i915_mutex_lock_interruptible(dev); | 995 | ret = i915_mutex_lock_interruptible(dev); |
987 | if (ret) | 996 | if (ret) |
@@ -994,30 +1003,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
994 | } | 1003 | } |
995 | obj_priv = to_intel_bo(obj); | 1004 | obj_priv = to_intel_bo(obj); |
996 | 1005 | ||
997 | |||
998 | /* Bounds check destination. */ | 1006 | /* Bounds check destination. */ |
999 | if (args->offset > obj->size || args->size > obj->size - args->offset) { | 1007 | if (args->offset > obj->size || args->size > obj->size - args->offset) { |
1000 | ret = -EINVAL; | 1008 | ret = -EINVAL; |
1001 | goto out; | 1009 | goto out; |
1002 | } | 1010 | } |
1003 | 1011 | ||
1004 | if (args->size == 0) | ||
1005 | goto out; | ||
1006 | |||
1007 | if (!access_ok(VERIFY_READ, | ||
1008 | (char __user *)(uintptr_t)args->data_ptr, | ||
1009 | args->size)) { | ||
1010 | ret = -EFAULT; | ||
1011 | goto out; | ||
1012 | } | ||
1013 | |||
1014 | ret = fault_in_pages_readable((char __user *)(uintptr_t)args->data_ptr, | ||
1015 | args->size); | ||
1016 | if (ret) { | ||
1017 | ret = -EFAULT; | ||
1018 | goto out; | ||
1019 | } | ||
1020 | |||
1021 | /* We can only do the GTT pwrite on untiled buffers, as otherwise | 1012 | /* We can only do the GTT pwrite on untiled buffers, as otherwise |
1022 | * it would end up going through the fenced access, and we'll get | 1013 | * it would end up going through the fenced access, and we'll get |
1023 | * different detiling behavior between reading and writing. | 1014 | * different detiling behavior between reading and writing. |
@@ -2907,6 +2898,20 @@ i915_gem_object_set_to_display_plane(struct drm_gem_object *obj, | |||
2907 | return 0; | 2898 | return 0; |
2908 | } | 2899 | } |
2909 | 2900 | ||
2901 | int | ||
2902 | i915_gem_object_flush_gpu(struct drm_i915_gem_object *obj, | ||
2903 | bool interruptible) | ||
2904 | { | ||
2905 | if (!obj->active) | ||
2906 | return 0; | ||
2907 | |||
2908 | if (obj->base.write_domain & I915_GEM_GPU_DOMAINS) | ||
2909 | i915_gem_flush_ring(obj->base.dev, NULL, obj->ring, | ||
2910 | 0, obj->base.write_domain); | ||
2911 | |||
2912 | return i915_gem_object_wait_rendering(&obj->base, interruptible); | ||
2913 | } | ||
2914 | |||
2910 | /** | 2915 | /** |
2911 | * Moves a single object to the CPU read, and possibly write domain. | 2916 | * Moves a single object to the CPU read, and possibly write domain. |
2912 | * | 2917 | * |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index c55c77043357..8df574316063 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -34,6 +34,25 @@ | |||
34 | #include "i915_drm.h" | 34 | #include "i915_drm.h" |
35 | #include "i915_drv.h" | 35 | #include "i915_drv.h" |
36 | 36 | ||
37 | /* Here's the desired hotplug mode */ | ||
38 | #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 | \ | ||
39 | ADPA_CRT_HOTPLUG_WARMUP_10MS | \ | ||
40 | ADPA_CRT_HOTPLUG_SAMPLE_4S | \ | ||
41 | ADPA_CRT_HOTPLUG_VOLTAGE_50 | \ | ||
42 | ADPA_CRT_HOTPLUG_VOLREF_325MV | \ | ||
43 | ADPA_CRT_HOTPLUG_ENABLE) | ||
44 | |||
45 | struct intel_crt { | ||
46 | struct intel_encoder base; | ||
47 | bool force_hotplug_required; | ||
48 | }; | ||
49 | |||
50 | static struct intel_crt *intel_attached_crt(struct drm_connector *connector) | ||
51 | { | ||
52 | return container_of(intel_attached_encoder(connector), | ||
53 | struct intel_crt, base); | ||
54 | } | ||
55 | |||
37 | static void intel_crt_dpms(struct drm_encoder *encoder, int mode) | 56 | static void intel_crt_dpms(struct drm_encoder *encoder, int mode) |
38 | { | 57 | { |
39 | struct drm_device *dev = encoder->dev; | 58 | struct drm_device *dev = encoder->dev; |
@@ -129,7 +148,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, | |||
129 | dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); | 148 | dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); |
130 | } | 149 | } |
131 | 150 | ||
132 | adpa = 0; | 151 | adpa = ADPA_HOTPLUG_BITS; |
133 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 152 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
134 | adpa |= ADPA_HSYNC_ACTIVE_HIGH; | 153 | adpa |= ADPA_HSYNC_ACTIVE_HIGH; |
135 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 154 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
@@ -157,53 +176,44 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, | |||
157 | static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) | 176 | static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) |
158 | { | 177 | { |
159 | struct drm_device *dev = connector->dev; | 178 | struct drm_device *dev = connector->dev; |
179 | struct intel_crt *crt = intel_attached_crt(connector); | ||
160 | struct drm_i915_private *dev_priv = dev->dev_private; | 180 | struct drm_i915_private *dev_priv = dev->dev_private; |
161 | u32 adpa, temp; | 181 | u32 adpa; |
162 | bool ret; | 182 | bool ret; |
163 | bool turn_off_dac = false; | ||
164 | 183 | ||
165 | temp = adpa = I915_READ(PCH_ADPA); | 184 | /* The first time through, trigger an explicit detection cycle */ |
185 | if (crt->force_hotplug_required) { | ||
186 | bool turn_off_dac = HAS_PCH_SPLIT(dev); | ||
187 | u32 save_adpa; | ||
166 | 188 | ||
167 | if (HAS_PCH_SPLIT(dev)) | 189 | crt->force_hotplug_required = 0; |
168 | turn_off_dac = true; | 190 | |
169 | 191 | save_adpa = adpa = I915_READ(PCH_ADPA); | |
170 | adpa &= ~ADPA_CRT_HOTPLUG_MASK; | 192 | DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa); |
171 | if (turn_off_dac) | 193 | |
172 | adpa &= ~ADPA_DAC_ENABLE; | 194 | adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER; |
173 | 195 | if (turn_off_dac) | |
174 | /* disable HPD first */ | 196 | adpa &= ~ADPA_DAC_ENABLE; |
175 | I915_WRITE(PCH_ADPA, adpa); | 197 | |
176 | (void)I915_READ(PCH_ADPA); | 198 | I915_WRITE(PCH_ADPA, adpa); |
177 | 199 | ||
178 | adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 | | 200 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, |
179 | ADPA_CRT_HOTPLUG_WARMUP_10MS | | 201 | 1000)) |
180 | ADPA_CRT_HOTPLUG_SAMPLE_4S | | 202 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); |
181 | ADPA_CRT_HOTPLUG_VOLTAGE_50 | /* default */ | 203 | |
182 | ADPA_CRT_HOTPLUG_VOLREF_325MV | | 204 | if (turn_off_dac) { |
183 | ADPA_CRT_HOTPLUG_ENABLE | | 205 | I915_WRITE(PCH_ADPA, save_adpa); |
184 | ADPA_CRT_HOTPLUG_FORCE_TRIGGER); | 206 | POSTING_READ(PCH_ADPA); |
185 | 207 | } | |
186 | DRM_DEBUG_KMS("pch crt adpa 0x%x", adpa); | ||
187 | I915_WRITE(PCH_ADPA, adpa); | ||
188 | |||
189 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, | ||
190 | 1000)) | ||
191 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); | ||
192 | |||
193 | if (turn_off_dac) { | ||
194 | /* Make sure hotplug is enabled */ | ||
195 | I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE); | ||
196 | (void)I915_READ(PCH_ADPA); | ||
197 | } | 208 | } |
198 | 209 | ||
199 | /* Check the status to see if both blue and green are on now */ | 210 | /* Check the status to see if both blue and green are on now */ |
200 | adpa = I915_READ(PCH_ADPA); | 211 | adpa = I915_READ(PCH_ADPA); |
201 | adpa &= ADPA_CRT_HOTPLUG_MONITOR_MASK; | 212 | if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0) |
202 | if ((adpa == ADPA_CRT_HOTPLUG_MONITOR_COLOR) || | ||
203 | (adpa == ADPA_CRT_HOTPLUG_MONITOR_MONO)) | ||
204 | ret = true; | 213 | ret = true; |
205 | else | 214 | else |
206 | ret = false; | 215 | ret = false; |
216 | DRM_DEBUG_KMS("ironlake hotplug adpa=0x%x, result %d\n", adpa, ret); | ||
207 | 217 | ||
208 | return ret; | 218 | return ret; |
209 | } | 219 | } |
@@ -277,13 +287,12 @@ static bool intel_crt_ddc_probe(struct drm_i915_private *dev_priv, int ddc_bus) | |||
277 | return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1; | 287 | return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1; |
278 | } | 288 | } |
279 | 289 | ||
280 | static bool intel_crt_detect_ddc(struct drm_encoder *encoder) | 290 | static bool intel_crt_detect_ddc(struct intel_crt *crt) |
281 | { | 291 | { |
282 | struct intel_encoder *intel_encoder = to_intel_encoder(encoder); | 292 | struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private; |
283 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; | ||
284 | 293 | ||
285 | /* CRT should always be at 0, but check anyway */ | 294 | /* CRT should always be at 0, but check anyway */ |
286 | if (intel_encoder->type != INTEL_OUTPUT_ANALOG) | 295 | if (crt->base.type != INTEL_OUTPUT_ANALOG) |
287 | return false; | 296 | return false; |
288 | 297 | ||
289 | if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) { | 298 | if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) { |
@@ -291,7 +300,7 @@ static bool intel_crt_detect_ddc(struct drm_encoder *encoder) | |||
291 | return true; | 300 | return true; |
292 | } | 301 | } |
293 | 302 | ||
294 | if (intel_ddc_probe(intel_encoder, dev_priv->crt_ddc_pin)) { | 303 | if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) { |
295 | DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); | 304 | DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); |
296 | return true; | 305 | return true; |
297 | } | 306 | } |
@@ -300,9 +309,9 @@ static bool intel_crt_detect_ddc(struct drm_encoder *encoder) | |||
300 | } | 309 | } |
301 | 310 | ||
302 | static enum drm_connector_status | 311 | static enum drm_connector_status |
303 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder) | 312 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_crt *crt) |
304 | { | 313 | { |
305 | struct drm_encoder *encoder = &intel_encoder->base; | 314 | struct drm_encoder *encoder = &crt->base.base; |
306 | struct drm_device *dev = encoder->dev; | 315 | struct drm_device *dev = encoder->dev; |
307 | struct drm_i915_private *dev_priv = dev->dev_private; | 316 | struct drm_i915_private *dev_priv = dev->dev_private; |
308 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 317 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -434,7 +443,7 @@ static enum drm_connector_status | |||
434 | intel_crt_detect(struct drm_connector *connector, bool force) | 443 | intel_crt_detect(struct drm_connector *connector, bool force) |
435 | { | 444 | { |
436 | struct drm_device *dev = connector->dev; | 445 | struct drm_device *dev = connector->dev; |
437 | struct intel_encoder *encoder = intel_attached_encoder(connector); | 446 | struct intel_crt *crt = intel_attached_crt(connector); |
438 | struct drm_crtc *crtc; | 447 | struct drm_crtc *crtc; |
439 | int dpms_mode; | 448 | int dpms_mode; |
440 | enum drm_connector_status status; | 449 | enum drm_connector_status status; |
@@ -443,28 +452,31 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
443 | if (intel_crt_detect_hotplug(connector)) { | 452 | if (intel_crt_detect_hotplug(connector)) { |
444 | DRM_DEBUG_KMS("CRT detected via hotplug\n"); | 453 | DRM_DEBUG_KMS("CRT detected via hotplug\n"); |
445 | return connector_status_connected; | 454 | return connector_status_connected; |
446 | } else | 455 | } else { |
456 | DRM_DEBUG_KMS("CRT not detected via hotplug\n"); | ||
447 | return connector_status_disconnected; | 457 | return connector_status_disconnected; |
458 | } | ||
448 | } | 459 | } |
449 | 460 | ||
450 | if (intel_crt_detect_ddc(&encoder->base)) | 461 | if (intel_crt_detect_ddc(crt)) |
451 | return connector_status_connected; | 462 | return connector_status_connected; |
452 | 463 | ||
453 | if (!force) | 464 | if (!force) |
454 | return connector->status; | 465 | return connector->status; |
455 | 466 | ||
456 | /* for pre-945g platforms use load detect */ | 467 | /* for pre-945g platforms use load detect */ |
457 | if (encoder->base.crtc && encoder->base.crtc->enabled) { | 468 | crtc = crt->base.base.crtc; |
458 | status = intel_crt_load_detect(encoder->base.crtc, encoder); | 469 | if (crtc && crtc->enabled) { |
470 | status = intel_crt_load_detect(crtc, crt); | ||
459 | } else { | 471 | } else { |
460 | crtc = intel_get_load_detect_pipe(encoder, connector, | 472 | crtc = intel_get_load_detect_pipe(&crt->base, connector, |
461 | NULL, &dpms_mode); | 473 | NULL, &dpms_mode); |
462 | if (crtc) { | 474 | if (crtc) { |
463 | if (intel_crt_detect_ddc(&encoder->base)) | 475 | if (intel_crt_detect_ddc(crt)) |
464 | status = connector_status_connected; | 476 | status = connector_status_connected; |
465 | else | 477 | else |
466 | status = intel_crt_load_detect(crtc, encoder); | 478 | status = intel_crt_load_detect(crtc, crt); |
467 | intel_release_load_detect_pipe(encoder, | 479 | intel_release_load_detect_pipe(&crt->base, |
468 | connector, dpms_mode); | 480 | connector, dpms_mode); |
469 | } else | 481 | } else |
470 | status = connector_status_unknown; | 482 | status = connector_status_unknown; |
@@ -536,17 +548,17 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { | |||
536 | void intel_crt_init(struct drm_device *dev) | 548 | void intel_crt_init(struct drm_device *dev) |
537 | { | 549 | { |
538 | struct drm_connector *connector; | 550 | struct drm_connector *connector; |
539 | struct intel_encoder *intel_encoder; | 551 | struct intel_crt *crt; |
540 | struct intel_connector *intel_connector; | 552 | struct intel_connector *intel_connector; |
541 | struct drm_i915_private *dev_priv = dev->dev_private; | 553 | struct drm_i915_private *dev_priv = dev->dev_private; |
542 | 554 | ||
543 | intel_encoder = kzalloc(sizeof(struct intel_encoder), GFP_KERNEL); | 555 | crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL); |
544 | if (!intel_encoder) | 556 | if (!crt) |
545 | return; | 557 | return; |
546 | 558 | ||
547 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); | 559 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); |
548 | if (!intel_connector) { | 560 | if (!intel_connector) { |
549 | kfree(intel_encoder); | 561 | kfree(crt); |
550 | return; | 562 | return; |
551 | } | 563 | } |
552 | 564 | ||
@@ -554,20 +566,20 @@ void intel_crt_init(struct drm_device *dev) | |||
554 | drm_connector_init(dev, &intel_connector->base, | 566 | drm_connector_init(dev, &intel_connector->base, |
555 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | 567 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); |
556 | 568 | ||
557 | drm_encoder_init(dev, &intel_encoder->base, &intel_crt_enc_funcs, | 569 | drm_encoder_init(dev, &crt->base.base, &intel_crt_enc_funcs, |
558 | DRM_MODE_ENCODER_DAC); | 570 | DRM_MODE_ENCODER_DAC); |
559 | 571 | ||
560 | intel_connector_attach_encoder(intel_connector, intel_encoder); | 572 | intel_connector_attach_encoder(intel_connector, &crt->base); |
561 | 573 | ||
562 | intel_encoder->type = INTEL_OUTPUT_ANALOG; | 574 | crt->base.type = INTEL_OUTPUT_ANALOG; |
563 | intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | 575 | crt->base.clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT | |
564 | (1 << INTEL_ANALOG_CLONE_BIT) | | 576 | 1 << INTEL_ANALOG_CLONE_BIT | |
565 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); | 577 | 1 << INTEL_SDVO_LVDS_CLONE_BIT); |
566 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); | 578 | crt->base.crtc_mask = (1 << 0) | (1 << 1); |
567 | connector->interlace_allowed = 1; | 579 | connector->interlace_allowed = 1; |
568 | connector->doublescan_allowed = 0; | 580 | connector->doublescan_allowed = 0; |
569 | 581 | ||
570 | drm_encoder_helper_add(&intel_encoder->base, &intel_crt_helper_funcs); | 582 | drm_encoder_helper_add(&crt->base.base, &intel_crt_helper_funcs); |
571 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | 583 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |
572 | 584 | ||
573 | drm_sysfs_connector_add(connector); | 585 | drm_sysfs_connector_add(connector); |
@@ -577,5 +589,22 @@ void intel_crt_init(struct drm_device *dev) | |||
577 | else | 589 | else |
578 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | 590 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
579 | 591 | ||
592 | /* | ||
593 | * Configure the automatic hotplug detection stuff | ||
594 | */ | ||
595 | crt->force_hotplug_required = 0; | ||
596 | if (HAS_PCH_SPLIT(dev)) { | ||
597 | u32 adpa; | ||
598 | |||
599 | adpa = I915_READ(PCH_ADPA); | ||
600 | adpa &= ~ADPA_CRT_HOTPLUG_MASK; | ||
601 | adpa |= ADPA_HOTPLUG_BITS; | ||
602 | I915_WRITE(PCH_ADPA, adpa); | ||
603 | POSTING_READ(PCH_ADPA); | ||
604 | |||
605 | DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa); | ||
606 | crt->force_hotplug_required = 1; | ||
607 | } | ||
608 | |||
580 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; | 609 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; |
581 | } | 610 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 48d8fd686ea9..bee24b1a58e8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1611,6 +1611,18 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
1611 | 1611 | ||
1612 | wait_event(dev_priv->pending_flip_queue, | 1612 | wait_event(dev_priv->pending_flip_queue, |
1613 | atomic_read(&obj_priv->pending_flip) == 0); | 1613 | atomic_read(&obj_priv->pending_flip) == 0); |
1614 | |||
1615 | /* Big Hammer, we also need to ensure that any pending | ||
1616 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
1617 | * current scanout is retired before unpinning the old | ||
1618 | * framebuffer. | ||
1619 | */ | ||
1620 | ret = i915_gem_object_flush_gpu(obj_priv, false); | ||
1621 | if (ret) { | ||
1622 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | ||
1623 | mutex_unlock(&dev->struct_mutex); | ||
1624 | return ret; | ||
1625 | } | ||
1614 | } | 1626 | } |
1615 | 1627 | ||
1616 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 1628 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 2be4f728ed0c..3dba086e7eea 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -160,7 +160,7 @@ intel_gpio_create(struct drm_i915_private *dev_priv, u32 pin) | |||
160 | }; | 160 | }; |
161 | struct intel_gpio *gpio; | 161 | struct intel_gpio *gpio; |
162 | 162 | ||
163 | if (pin < 1 || pin > 7) | 163 | if (pin >= ARRAY_SIZE(map_pin_to_reg) || !map_pin_to_reg[pin]) |
164 | return NULL; | 164 | return NULL; |
165 | 165 | ||
166 | gpio = kzalloc(sizeof(struct intel_gpio), GFP_KERNEL); | 166 | gpio = kzalloc(sizeof(struct intel_gpio), GFP_KERNEL); |
@@ -172,7 +172,8 @@ intel_gpio_create(struct drm_i915_private *dev_priv, u32 pin) | |||
172 | gpio->reg += PCH_GPIOA - GPIOA; | 172 | gpio->reg += PCH_GPIOA - GPIOA; |
173 | gpio->dev_priv = dev_priv; | 173 | gpio->dev_priv = dev_priv; |
174 | 174 | ||
175 | snprintf(gpio->adapter.name, I2C_NAME_SIZE, "GPIO%c", "?BACDEF?"[pin]); | 175 | snprintf(gpio->adapter.name, sizeof(gpio->adapter.name), |
176 | "i915 GPIO%c", "?BACDE?F"[pin]); | ||
176 | gpio->adapter.owner = THIS_MODULE; | 177 | gpio->adapter.owner = THIS_MODULE; |
177 | gpio->adapter.algo_data = &gpio->algo; | 178 | gpio->adapter.algo_data = &gpio->algo; |
178 | gpio->adapter.dev.parent = &dev_priv->dev->pdev->dev; | 179 | gpio->adapter.dev.parent = &dev_priv->dev->pdev->dev; |
@@ -349,7 +350,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
349 | "panel", | 350 | "panel", |
350 | "dpc", | 351 | "dpc", |
351 | "dpb", | 352 | "dpb", |
352 | "reserved" | 353 | "reserved", |
353 | "dpd", | 354 | "dpd", |
354 | }; | 355 | }; |
355 | struct drm_i915_private *dev_priv = dev->dev_private; | 356 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -366,8 +367,8 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
366 | bus->adapter.owner = THIS_MODULE; | 367 | bus->adapter.owner = THIS_MODULE; |
367 | bus->adapter.class = I2C_CLASS_DDC; | 368 | bus->adapter.class = I2C_CLASS_DDC; |
368 | snprintf(bus->adapter.name, | 369 | snprintf(bus->adapter.name, |
369 | I2C_NAME_SIZE, | 370 | sizeof(bus->adapter.name), |
370 | "gmbus %s", | 371 | "i915 gmbus %s", |
371 | names[i]); | 372 | names[i]); |
372 | 373 | ||
373 | bus->adapter.dev.parent = &dev->pdev->dev; | 374 | bus->adapter.dev.parent = &dev->pdev->dev; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index 406228f4a2a0..b14c81110575 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c | |||
@@ -31,6 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/backlight.h> | 33 | #include <linux/backlight.h> |
34 | #include <linux/acpi.h> | ||
34 | 35 | ||
35 | #include "drmP.h" | 36 | #include "drmP.h" |
36 | #include "nouveau_drv.h" | 37 | #include "nouveau_drv.h" |
@@ -136,6 +137,14 @@ int nouveau_backlight_init(struct drm_device *dev) | |||
136 | { | 137 | { |
137 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 138 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
138 | 139 | ||
140 | #ifdef CONFIG_ACPI | ||
141 | if (acpi_video_backlight_support()) { | ||
142 | NV_INFO(dev, "ACPI backlight interface available, " | ||
143 | "not registering our own\n"); | ||
144 | return 0; | ||
145 | } | ||
146 | #endif | ||
147 | |||
139 | switch (dev_priv->card_type) { | 148 | switch (dev_priv->card_type) { |
140 | case NV_40: | 149 | case NV_40: |
141 | return nouveau_nv40_backlight_init(dev); | 150 | return nouveau_nv40_backlight_init(dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 5f21030a293b..b2293576f278 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -6829,7 +6829,7 @@ nouveau_bios_posted(struct drm_device *dev) | |||
6829 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 6829 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
6830 | unsigned htotal; | 6830 | unsigned htotal; |
6831 | 6831 | ||
6832 | if (dev_priv->chipset >= NV_50) { | 6832 | if (dev_priv->card_type >= NV_50) { |
6833 | if (NVReadVgaCrtc(dev, 0, 0x00) == 0 && | 6833 | if (NVReadVgaCrtc(dev, 0, 0x00) == 0 && |
6834 | NVReadVgaCrtc(dev, 0, 0x1a) == 0) | 6834 | NVReadVgaCrtc(dev, 0, 0x1a) == 0) |
6835 | return false; | 6835 | return false; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 80353e2b8409..c41e1c200ef5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -143,8 +143,10 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
143 | nvbo->no_vm = no_vm; | 143 | nvbo->no_vm = no_vm; |
144 | nvbo->tile_mode = tile_mode; | 144 | nvbo->tile_mode = tile_mode; |
145 | nvbo->tile_flags = tile_flags; | 145 | nvbo->tile_flags = tile_flags; |
146 | nvbo->bo.bdev = &dev_priv->ttm.bdev; | ||
146 | 147 | ||
147 | nouveau_bo_fixup_align(dev, tile_mode, tile_flags, &align, &size); | 148 | nouveau_bo_fixup_align(dev, tile_mode, nouveau_bo_tile_layout(nvbo), |
149 | &align, &size); | ||
148 | align >>= PAGE_SHIFT; | 150 | align >>= PAGE_SHIFT; |
149 | 151 | ||
150 | nouveau_bo_placement_set(nvbo, flags, 0); | 152 | nouveau_bo_placement_set(nvbo, flags, 0); |
@@ -176,6 +178,31 @@ set_placement_list(uint32_t *pl, unsigned *n, uint32_t type, uint32_t flags) | |||
176 | pl[(*n)++] = TTM_PL_FLAG_SYSTEM | flags; | 178 | pl[(*n)++] = TTM_PL_FLAG_SYSTEM | flags; |
177 | } | 179 | } |
178 | 180 | ||
181 | static void | ||
182 | set_placement_range(struct nouveau_bo *nvbo, uint32_t type) | ||
183 | { | ||
184 | struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); | ||
185 | |||
186 | if (dev_priv->card_type == NV_10 && | ||
187 | nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM)) { | ||
188 | /* | ||
189 | * Make sure that the color and depth buffers are handled | ||
190 | * by independent memory controller units. Up to a 9x | ||
191 | * speed up when alpha-blending and depth-test are enabled | ||
192 | * at the same time. | ||
193 | */ | ||
194 | int vram_pages = dev_priv->vram_size >> PAGE_SHIFT; | ||
195 | |||
196 | if (nvbo->tile_flags & NOUVEAU_GEM_TILE_ZETA) { | ||
197 | nvbo->placement.fpfn = vram_pages / 2; | ||
198 | nvbo->placement.lpfn = ~0; | ||
199 | } else { | ||
200 | nvbo->placement.fpfn = 0; | ||
201 | nvbo->placement.lpfn = vram_pages / 2; | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | |||
179 | void | 206 | void |
180 | nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) | 207 | nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) |
181 | { | 208 | { |
@@ -190,6 +217,8 @@ nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) | |||
190 | pl->busy_placement = nvbo->busy_placements; | 217 | pl->busy_placement = nvbo->busy_placements; |
191 | set_placement_list(nvbo->busy_placements, &pl->num_busy_placement, | 218 | set_placement_list(nvbo->busy_placements, &pl->num_busy_placement, |
192 | type | busy, flags); | 219 | type | busy, flags); |
220 | |||
221 | set_placement_range(nvbo, type); | ||
193 | } | 222 | } |
194 | 223 | ||
195 | int | 224 | int |
@@ -525,7 +554,8 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
525 | stride = 16 * 4; | 554 | stride = 16 * 4; |
526 | height = amount / stride; | 555 | height = amount / stride; |
527 | 556 | ||
528 | if (new_mem->mem_type == TTM_PL_VRAM && nvbo->tile_flags) { | 557 | if (new_mem->mem_type == TTM_PL_VRAM && |
558 | nouveau_bo_tile_layout(nvbo)) { | ||
529 | ret = RING_SPACE(chan, 8); | 559 | ret = RING_SPACE(chan, 8); |
530 | if (ret) | 560 | if (ret) |
531 | return ret; | 561 | return ret; |
@@ -546,7 +576,8 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
546 | BEGIN_RING(chan, NvSubM2MF, 0x0200, 1); | 576 | BEGIN_RING(chan, NvSubM2MF, 0x0200, 1); |
547 | OUT_RING (chan, 1); | 577 | OUT_RING (chan, 1); |
548 | } | 578 | } |
549 | if (old_mem->mem_type == TTM_PL_VRAM && nvbo->tile_flags) { | 579 | if (old_mem->mem_type == TTM_PL_VRAM && |
580 | nouveau_bo_tile_layout(nvbo)) { | ||
550 | ret = RING_SPACE(chan, 8); | 581 | ret = RING_SPACE(chan, 8); |
551 | if (ret) | 582 | if (ret) |
552 | return ret; | 583 | return ret; |
@@ -753,7 +784,8 @@ nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem, | |||
753 | if (dev_priv->card_type == NV_50) { | 784 | if (dev_priv->card_type == NV_50) { |
754 | ret = nv50_mem_vm_bind_linear(dev, | 785 | ret = nv50_mem_vm_bind_linear(dev, |
755 | offset + dev_priv->vm_vram_base, | 786 | offset + dev_priv->vm_vram_base, |
756 | new_mem->size, nvbo->tile_flags, | 787 | new_mem->size, |
788 | nouveau_bo_tile_layout(nvbo), | ||
757 | offset); | 789 | offset); |
758 | if (ret) | 790 | if (ret) |
759 | return ret; | 791 | return ret; |
@@ -894,7 +926,8 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo) | |||
894 | * nothing to do here. | 926 | * nothing to do here. |
895 | */ | 927 | */ |
896 | if (bo->mem.mem_type != TTM_PL_VRAM) { | 928 | if (bo->mem.mem_type != TTM_PL_VRAM) { |
897 | if (dev_priv->card_type < NV_50 || !nvbo->tile_flags) | 929 | if (dev_priv->card_type < NV_50 || |
930 | !nouveau_bo_tile_layout(nvbo)) | ||
898 | return 0; | 931 | return 0; |
899 | } | 932 | } |
900 | 933 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 0871495096fa..52c356e9a3d1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -281,7 +281,7 @@ detect_analog: | |||
281 | nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG); | 281 | nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG); |
282 | if (!nv_encoder && !nouveau_tv_disable) | 282 | if (!nv_encoder && !nouveau_tv_disable) |
283 | nv_encoder = find_encoder_by_type(connector, OUTPUT_TV); | 283 | nv_encoder = find_encoder_by_type(connector, OUTPUT_TV); |
284 | if (nv_encoder) { | 284 | if (nv_encoder && force) { |
285 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | 285 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); |
286 | struct drm_encoder_helper_funcs *helper = | 286 | struct drm_encoder_helper_funcs *helper = |
287 | encoder->helper_private; | 287 | encoder->helper_private; |
@@ -641,11 +641,28 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
641 | return ret; | 641 | return ret; |
642 | } | 642 | } |
643 | 643 | ||
644 | static unsigned | ||
645 | get_tmds_link_bandwidth(struct drm_connector *connector) | ||
646 | { | ||
647 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | ||
648 | struct drm_nouveau_private *dev_priv = connector->dev->dev_private; | ||
649 | struct dcb_entry *dcb = nv_connector->detected_encoder->dcb; | ||
650 | |||
651 | if (dcb->location != DCB_LOC_ON_CHIP || | ||
652 | dev_priv->chipset >= 0x46) | ||
653 | return 165000; | ||
654 | else if (dev_priv->chipset >= 0x40) | ||
655 | return 155000; | ||
656 | else if (dev_priv->chipset >= 0x18) | ||
657 | return 135000; | ||
658 | else | ||
659 | return 112000; | ||
660 | } | ||
661 | |||
644 | static int | 662 | static int |
645 | nouveau_connector_mode_valid(struct drm_connector *connector, | 663 | nouveau_connector_mode_valid(struct drm_connector *connector, |
646 | struct drm_display_mode *mode) | 664 | struct drm_display_mode *mode) |
647 | { | 665 | { |
648 | struct drm_nouveau_private *dev_priv = connector->dev->dev_private; | ||
649 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 666 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
650 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; | 667 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; |
651 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | 668 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); |
@@ -663,11 +680,9 @@ nouveau_connector_mode_valid(struct drm_connector *connector, | |||
663 | max_clock = 400000; | 680 | max_clock = 400000; |
664 | break; | 681 | break; |
665 | case OUTPUT_TMDS: | 682 | case OUTPUT_TMDS: |
666 | if ((dev_priv->card_type >= NV_50 && !nouveau_duallink) || | 683 | max_clock = get_tmds_link_bandwidth(connector); |
667 | !nv_encoder->dcb->duallink_possible) | 684 | if (nouveau_duallink && nv_encoder->dcb->duallink_possible) |
668 | max_clock = 165000; | 685 | max_clock *= 2; |
669 | else | ||
670 | max_clock = 330000; | ||
671 | break; | 686 | break; |
672 | case OUTPUT_ANALOG: | 687 | case OUTPUT_ANALOG: |
673 | max_clock = nv_encoder->dcb->crtconf.maxfreq; | 688 | max_clock = nv_encoder->dcb->crtconf.maxfreq; |
@@ -709,44 +724,6 @@ nouveau_connector_best_encoder(struct drm_connector *connector) | |||
709 | return NULL; | 724 | return NULL; |
710 | } | 725 | } |
711 | 726 | ||
712 | void | ||
713 | nouveau_connector_set_polling(struct drm_connector *connector) | ||
714 | { | ||
715 | struct drm_device *dev = connector->dev; | ||
716 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
717 | struct drm_crtc *crtc; | ||
718 | bool spare_crtc = false; | ||
719 | |||
720 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
721 | spare_crtc |= !crtc->enabled; | ||
722 | |||
723 | connector->polled = 0; | ||
724 | |||
725 | switch (connector->connector_type) { | ||
726 | case DRM_MODE_CONNECTOR_VGA: | ||
727 | case DRM_MODE_CONNECTOR_TV: | ||
728 | if (dev_priv->card_type >= NV_50 || | ||
729 | (nv_gf4_disp_arch(dev) && spare_crtc)) | ||
730 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
731 | break; | ||
732 | |||
733 | case DRM_MODE_CONNECTOR_DVII: | ||
734 | case DRM_MODE_CONNECTOR_DVID: | ||
735 | case DRM_MODE_CONNECTOR_HDMIA: | ||
736 | case DRM_MODE_CONNECTOR_DisplayPort: | ||
737 | case DRM_MODE_CONNECTOR_eDP: | ||
738 | if (dev_priv->card_type >= NV_50) | ||
739 | connector->polled = DRM_CONNECTOR_POLL_HPD; | ||
740 | else if (connector->connector_type == DRM_MODE_CONNECTOR_DVID || | ||
741 | spare_crtc) | ||
742 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
743 | break; | ||
744 | |||
745 | default: | ||
746 | break; | ||
747 | } | ||
748 | } | ||
749 | |||
750 | static const struct drm_connector_helper_funcs | 727 | static const struct drm_connector_helper_funcs |
751 | nouveau_connector_helper_funcs = { | 728 | nouveau_connector_helper_funcs = { |
752 | .get_modes = nouveau_connector_get_modes, | 729 | .get_modes = nouveau_connector_get_modes, |
@@ -872,6 +849,7 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
872 | dev->mode_config.scaling_mode_property, | 849 | dev->mode_config.scaling_mode_property, |
873 | nv_connector->scaling_mode); | 850 | nv_connector->scaling_mode); |
874 | } | 851 | } |
852 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
875 | /* fall-through */ | 853 | /* fall-through */ |
876 | case DCB_CONNECTOR_TV_0: | 854 | case DCB_CONNECTOR_TV_0: |
877 | case DCB_CONNECTOR_TV_1: | 855 | case DCB_CONNECTOR_TV_1: |
@@ -888,11 +866,16 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
888 | dev->mode_config.dithering_mode_property, | 866 | dev->mode_config.dithering_mode_property, |
889 | nv_connector->use_dithering ? | 867 | nv_connector->use_dithering ? |
890 | DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF); | 868 | DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF); |
869 | |||
870 | if (dcb->type != DCB_CONNECTOR_LVDS) { | ||
871 | if (dev_priv->card_type >= NV_50) | ||
872 | connector->polled = DRM_CONNECTOR_POLL_HPD; | ||
873 | else | ||
874 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
875 | } | ||
891 | break; | 876 | break; |
892 | } | 877 | } |
893 | 878 | ||
894 | nouveau_connector_set_polling(connector); | ||
895 | |||
896 | drm_sysfs_connector_add(connector); | 879 | drm_sysfs_connector_add(connector); |
897 | dcb->drm = connector; | 880 | dcb->drm = connector; |
898 | return dcb->drm; | 881 | return dcb->drm; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h index c21ed6b16f88..711b1e9203af 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h | |||
@@ -52,9 +52,6 @@ static inline struct nouveau_connector *nouveau_connector( | |||
52 | struct drm_connector * | 52 | struct drm_connector * |
53 | nouveau_connector_create(struct drm_device *, int index); | 53 | nouveau_connector_create(struct drm_device *, int index); |
54 | 54 | ||
55 | void | ||
56 | nouveau_connector_set_polling(struct drm_connector *); | ||
57 | |||
58 | int | 55 | int |
59 | nouveau_connector_bpp(struct drm_connector *); | 56 | nouveau_connector_bpp(struct drm_connector *); |
60 | 57 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 3a07e580d27a..1c7db64c03bf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -100,6 +100,9 @@ struct nouveau_bo { | |||
100 | int pin_refcnt; | 100 | int pin_refcnt; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #define nouveau_bo_tile_layout(nvbo) \ | ||
104 | ((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) | ||
105 | |||
103 | static inline struct nouveau_bo * | 106 | static inline struct nouveau_bo * |
104 | nouveau_bo(struct ttm_buffer_object *bo) | 107 | nouveau_bo(struct ttm_buffer_object *bo) |
105 | { | 108 | { |
@@ -304,6 +307,7 @@ struct nouveau_fifo_engine { | |||
304 | void (*destroy_context)(struct nouveau_channel *); | 307 | void (*destroy_context)(struct nouveau_channel *); |
305 | int (*load_context)(struct nouveau_channel *); | 308 | int (*load_context)(struct nouveau_channel *); |
306 | int (*unload_context)(struct drm_device *); | 309 | int (*unload_context)(struct drm_device *); |
310 | void (*tlb_flush)(struct drm_device *dev); | ||
307 | }; | 311 | }; |
308 | 312 | ||
309 | struct nouveau_pgraph_object_method { | 313 | struct nouveau_pgraph_object_method { |
@@ -336,6 +340,7 @@ struct nouveau_pgraph_engine { | |||
336 | void (*destroy_context)(struct nouveau_channel *); | 340 | void (*destroy_context)(struct nouveau_channel *); |
337 | int (*load_context)(struct nouveau_channel *); | 341 | int (*load_context)(struct nouveau_channel *); |
338 | int (*unload_context)(struct drm_device *); | 342 | int (*unload_context)(struct drm_device *); |
343 | void (*tlb_flush)(struct drm_device *dev); | ||
339 | 344 | ||
340 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | 345 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, |
341 | uint32_t size, uint32_t pitch); | 346 | uint32_t size, uint32_t pitch); |
@@ -485,13 +490,13 @@ enum nv04_fp_display_regs { | |||
485 | }; | 490 | }; |
486 | 491 | ||
487 | struct nv04_crtc_reg { | 492 | struct nv04_crtc_reg { |
488 | unsigned char MiscOutReg; /* */ | 493 | unsigned char MiscOutReg; |
489 | uint8_t CRTC[0xa0]; | 494 | uint8_t CRTC[0xa0]; |
490 | uint8_t CR58[0x10]; | 495 | uint8_t CR58[0x10]; |
491 | uint8_t Sequencer[5]; | 496 | uint8_t Sequencer[5]; |
492 | uint8_t Graphics[9]; | 497 | uint8_t Graphics[9]; |
493 | uint8_t Attribute[21]; | 498 | uint8_t Attribute[21]; |
494 | unsigned char DAC[768]; /* Internal Colorlookuptable */ | 499 | unsigned char DAC[768]; |
495 | 500 | ||
496 | /* PCRTC regs */ | 501 | /* PCRTC regs */ |
497 | uint32_t fb_start; | 502 | uint32_t fb_start; |
@@ -539,43 +544,9 @@ struct nv04_output_reg { | |||
539 | }; | 544 | }; |
540 | 545 | ||
541 | struct nv04_mode_state { | 546 | struct nv04_mode_state { |
542 | uint32_t bpp; | 547 | struct nv04_crtc_reg crtc_reg[2]; |
543 | uint32_t width; | ||
544 | uint32_t height; | ||
545 | uint32_t interlace; | ||
546 | uint32_t repaint0; | ||
547 | uint32_t repaint1; | ||
548 | uint32_t screen; | ||
549 | uint32_t scale; | ||
550 | uint32_t dither; | ||
551 | uint32_t extra; | ||
552 | uint32_t fifo; | ||
553 | uint32_t pixel; | ||
554 | uint32_t horiz; | ||
555 | int arbitration0; | ||
556 | int arbitration1; | ||
557 | uint32_t pll; | ||
558 | uint32_t pllB; | ||
559 | uint32_t vpll; | ||
560 | uint32_t vpll2; | ||
561 | uint32_t vpllB; | ||
562 | uint32_t vpll2B; | ||
563 | uint32_t pllsel; | 548 | uint32_t pllsel; |
564 | uint32_t sel_clk; | 549 | uint32_t sel_clk; |
565 | uint32_t general; | ||
566 | uint32_t crtcOwner; | ||
567 | uint32_t head; | ||
568 | uint32_t head2; | ||
569 | uint32_t cursorConfig; | ||
570 | uint32_t cursor0; | ||
571 | uint32_t cursor1; | ||
572 | uint32_t cursor2; | ||
573 | uint32_t timingH; | ||
574 | uint32_t timingV; | ||
575 | uint32_t displayV; | ||
576 | uint32_t crtcSync; | ||
577 | |||
578 | struct nv04_crtc_reg crtc_reg[2]; | ||
579 | }; | 550 | }; |
580 | 551 | ||
581 | enum nouveau_card_type { | 552 | enum nouveau_card_type { |
@@ -613,6 +584,12 @@ struct drm_nouveau_private { | |||
613 | struct work_struct irq_work; | 584 | struct work_struct irq_work; |
614 | struct work_struct hpd_work; | 585 | struct work_struct hpd_work; |
615 | 586 | ||
587 | struct { | ||
588 | spinlock_t lock; | ||
589 | uint32_t hpd0_bits; | ||
590 | uint32_t hpd1_bits; | ||
591 | } hpd_state; | ||
592 | |||
616 | struct list_head vbl_waiting; | 593 | struct list_head vbl_waiting; |
617 | 594 | ||
618 | struct { | 595 | struct { |
@@ -1045,6 +1022,7 @@ extern int nv50_fifo_create_context(struct nouveau_channel *); | |||
1045 | extern void nv50_fifo_destroy_context(struct nouveau_channel *); | 1022 | extern void nv50_fifo_destroy_context(struct nouveau_channel *); |
1046 | extern int nv50_fifo_load_context(struct nouveau_channel *); | 1023 | extern int nv50_fifo_load_context(struct nouveau_channel *); |
1047 | extern int nv50_fifo_unload_context(struct drm_device *); | 1024 | extern int nv50_fifo_unload_context(struct drm_device *); |
1025 | extern void nv50_fifo_tlb_flush(struct drm_device *dev); | ||
1048 | 1026 | ||
1049 | /* nvc0_fifo.c */ | 1027 | /* nvc0_fifo.c */ |
1050 | extern int nvc0_fifo_init(struct drm_device *); | 1028 | extern int nvc0_fifo_init(struct drm_device *); |
@@ -1122,6 +1100,8 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
1122 | extern int nv50_graph_unload_context(struct drm_device *); | 1100 | extern int nv50_graph_unload_context(struct drm_device *); |
1123 | extern void nv50_graph_context_switch(struct drm_device *); | 1101 | extern void nv50_graph_context_switch(struct drm_device *); |
1124 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1102 | extern int nv50_grctx_init(struct nouveau_grctx *); |
1103 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | ||
1104 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | ||
1125 | 1105 | ||
1126 | /* nvc0_graph.c */ | 1106 | /* nvc0_graph.c */ |
1127 | extern int nvc0_graph_init(struct drm_device *); | 1107 | extern int nvc0_graph_init(struct drm_device *); |
@@ -1239,7 +1219,6 @@ extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index); | |||
1239 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); | 1219 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); |
1240 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); | 1220 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); |
1241 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); | 1221 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); |
1242 | extern int nouveau_bo_sync_gpu(struct nouveau_bo *, struct nouveau_channel *); | ||
1243 | 1222 | ||
1244 | /* nouveau_fence.c */ | 1223 | /* nouveau_fence.c */ |
1245 | struct nouveau_fence; | 1224 | struct nouveau_fence; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 441b12420bb1..ab1bbfbf266e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -249,6 +249,7 @@ alloc_semaphore(struct drm_device *dev) | |||
249 | { | 249 | { |
250 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 250 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
251 | struct nouveau_semaphore *sema; | 251 | struct nouveau_semaphore *sema; |
252 | int ret; | ||
252 | 253 | ||
253 | if (!USE_SEMA(dev)) | 254 | if (!USE_SEMA(dev)) |
254 | return NULL; | 255 | return NULL; |
@@ -257,10 +258,14 @@ alloc_semaphore(struct drm_device *dev) | |||
257 | if (!sema) | 258 | if (!sema) |
258 | goto fail; | 259 | goto fail; |
259 | 260 | ||
261 | ret = drm_mm_pre_get(&dev_priv->fence.heap); | ||
262 | if (ret) | ||
263 | goto fail; | ||
264 | |||
260 | spin_lock(&dev_priv->fence.lock); | 265 | spin_lock(&dev_priv->fence.lock); |
261 | sema->mem = drm_mm_search_free(&dev_priv->fence.heap, 4, 0, 0); | 266 | sema->mem = drm_mm_search_free(&dev_priv->fence.heap, 4, 0, 0); |
262 | if (sema->mem) | 267 | if (sema->mem) |
263 | sema->mem = drm_mm_get_block(sema->mem, 4, 0); | 268 | sema->mem = drm_mm_get_block_atomic(sema->mem, 4, 0); |
264 | spin_unlock(&dev_priv->fence.lock); | 269 | spin_unlock(&dev_priv->fence.lock); |
265 | 270 | ||
266 | if (!sema->mem) | 271 | if (!sema->mem) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 5c4c929d7f74..9a1fdcf400c2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -107,23 +107,29 @@ nouveau_gem_info(struct drm_gem_object *gem, struct drm_nouveau_gem_info *rep) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | static bool | 109 | static bool |
110 | nouveau_gem_tile_flags_valid(struct drm_device *dev, uint32_t tile_flags) { | 110 | nouveau_gem_tile_flags_valid(struct drm_device *dev, uint32_t tile_flags) |
111 | switch (tile_flags) { | 111 | { |
112 | case 0x0000: | 112 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
113 | case 0x1800: | 113 | |
114 | case 0x2800: | 114 | if (dev_priv->card_type >= NV_50) { |
115 | case 0x4800: | 115 | switch (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) { |
116 | case 0x7000: | 116 | case 0x0000: |
117 | case 0x7400: | 117 | case 0x1800: |
118 | case 0x7a00: | 118 | case 0x2800: |
119 | case 0xe000: | 119 | case 0x4800: |
120 | break; | 120 | case 0x7000: |
121 | default: | 121 | case 0x7400: |
122 | NV_ERROR(dev, "bad page flags: 0x%08x\n", tile_flags); | 122 | case 0x7a00: |
123 | return false; | 123 | case 0xe000: |
124 | return true; | ||
125 | } | ||
126 | } else { | ||
127 | if (!(tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK)) | ||
128 | return true; | ||
124 | } | 129 | } |
125 | 130 | ||
126 | return true; | 131 | NV_ERROR(dev, "bad page flags: 0x%08x\n", tile_flags); |
132 | return false; | ||
127 | } | 133 | } |
128 | 134 | ||
129 | int | 135 | int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.c b/drivers/gpu/drm/nouveau/nouveau_hw.c index bed669a54a2d..b9672a05c411 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hw.c +++ b/drivers/gpu/drm/nouveau/nouveau_hw.c | |||
@@ -519,11 +519,11 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head) | |||
519 | 519 | ||
520 | struct pll_lims pll_lim; | 520 | struct pll_lims pll_lim; |
521 | struct nouveau_pll_vals pv; | 521 | struct nouveau_pll_vals pv; |
522 | uint32_t pllreg = head ? NV_RAMDAC_VPLL2 : NV_PRAMDAC_VPLL_COEFF; | 522 | enum pll_types pll = head ? PLL_VPLL1 : PLL_VPLL0; |
523 | 523 | ||
524 | if (get_pll_limits(dev, pllreg, &pll_lim)) | 524 | if (get_pll_limits(dev, pll, &pll_lim)) |
525 | return; | 525 | return; |
526 | nouveau_hw_get_pllvals(dev, pllreg, &pv); | 526 | nouveau_hw_get_pllvals(dev, pll, &pv); |
527 | 527 | ||
528 | if (pv.M1 >= pll_lim.vco1.min_m && pv.M1 <= pll_lim.vco1.max_m && | 528 | if (pv.M1 >= pll_lim.vco1.min_m && pv.M1 <= pll_lim.vco1.max_m && |
529 | pv.N1 >= pll_lim.vco1.min_n && pv.N1 <= pll_lim.vco1.max_n && | 529 | pv.N1 >= pll_lim.vco1.min_n && pv.N1 <= pll_lim.vco1.max_n && |
@@ -536,7 +536,7 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head) | |||
536 | pv.M1 = pll_lim.vco1.max_m; | 536 | pv.M1 = pll_lim.vco1.max_m; |
537 | pv.N1 = pll_lim.vco1.min_n; | 537 | pv.N1 = pll_lim.vco1.min_n; |
538 | pv.log2P = pll_lim.max_usable_log2p; | 538 | pv.log2P = pll_lim.max_usable_log2p; |
539 | nouveau_hw_setpll(dev, pllreg, &pv); | 539 | nouveau_hw_setpll(dev, pll_lim.reg, &pv); |
540 | } | 540 | } |
541 | 541 | ||
542 | /* | 542 | /* |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.h b/drivers/gpu/drm/nouveau/nouveau_hw.h index 869130f83602..2989090b9434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hw.h +++ b/drivers/gpu/drm/nouveau/nouveau_hw.h | |||
@@ -416,6 +416,25 @@ nv_fix_nv40_hw_cursor(struct drm_device *dev, int head) | |||
416 | } | 416 | } |
417 | 417 | ||
418 | static inline void | 418 | static inline void |
419 | nv_set_crtc_base(struct drm_device *dev, int head, uint32_t offset) | ||
420 | { | ||
421 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
422 | |||
423 | NVWriteCRTC(dev, head, NV_PCRTC_START, offset); | ||
424 | |||
425 | if (dev_priv->card_type == NV_04) { | ||
426 | /* | ||
427 | * Hilarious, the 24th bit doesn't want to stick to | ||
428 | * PCRTC_START... | ||
429 | */ | ||
430 | int cre_heb = NVReadVgaCrtc(dev, head, NV_CIO_CRE_HEB__INDEX); | ||
431 | |||
432 | NVWriteVgaCrtc(dev, head, NV_CIO_CRE_HEB__INDEX, | ||
433 | (cre_heb & ~0x40) | ((offset >> 18) & 0x40)); | ||
434 | } | ||
435 | } | ||
436 | |||
437 | static inline void | ||
419 | nv_show_cursor(struct drm_device *dev, int head, bool show) | 438 | nv_show_cursor(struct drm_device *dev, int head, bool show) |
420 | { | 439 | { |
421 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 440 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.c b/drivers/gpu/drm/nouveau/nouveau_i2c.c index fdd7e3de79c8..cb389d014326 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.c +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.c | |||
@@ -256,7 +256,7 @@ nouveau_i2c_find(struct drm_device *dev, int index) | |||
256 | if (index >= DCB_MAX_NUM_I2C_ENTRIES) | 256 | if (index >= DCB_MAX_NUM_I2C_ENTRIES) |
257 | return NULL; | 257 | return NULL; |
258 | 258 | ||
259 | if (dev_priv->chipset >= NV_50 && (i2c->entry & 0x00000100)) { | 259 | if (dev_priv->card_type >= NV_50 && (i2c->entry & 0x00000100)) { |
260 | uint32_t reg = 0xe500, val; | 260 | uint32_t reg = 0xe500, val; |
261 | 261 | ||
262 | if (i2c->port_type == 6) { | 262 | if (i2c->port_type == 6) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 6fd51a51c608..7bfd9e6c9d67 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -42,6 +42,13 @@ | |||
42 | #include "nouveau_connector.h" | 42 | #include "nouveau_connector.h" |
43 | #include "nv50_display.h" | 43 | #include "nv50_display.h" |
44 | 44 | ||
45 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | ||
46 | |||
47 | static int nouveau_ratelimit(void) | ||
48 | { | ||
49 | return __ratelimit(&nouveau_ratelimit_state); | ||
50 | } | ||
51 | |||
45 | void | 52 | void |
46 | nouveau_irq_preinstall(struct drm_device *dev) | 53 | nouveau_irq_preinstall(struct drm_device *dev) |
47 | { | 54 | { |
@@ -53,6 +60,7 @@ nouveau_irq_preinstall(struct drm_device *dev) | |||
53 | if (dev_priv->card_type >= NV_50) { | 60 | if (dev_priv->card_type >= NV_50) { |
54 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); | 61 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); |
55 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); | 62 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); |
63 | spin_lock_init(&dev_priv->hpd_state.lock); | ||
56 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); | 64 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); |
57 | } | 65 | } |
58 | } | 66 | } |
@@ -202,8 +210,8 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
202 | } | 210 | } |
203 | 211 | ||
204 | if (status & NV_PFIFO_INTR_DMA_PUSHER) { | 212 | if (status & NV_PFIFO_INTR_DMA_PUSHER) { |
205 | u32 get = nv_rd32(dev, 0x003244); | 213 | u32 dma_get = nv_rd32(dev, 0x003244); |
206 | u32 put = nv_rd32(dev, 0x003240); | 214 | u32 dma_put = nv_rd32(dev, 0x003240); |
207 | u32 push = nv_rd32(dev, 0x003220); | 215 | u32 push = nv_rd32(dev, 0x003220); |
208 | u32 state = nv_rd32(dev, 0x003228); | 216 | u32 state = nv_rd32(dev, 0x003228); |
209 | 217 | ||
@@ -213,16 +221,18 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
213 | u32 ib_get = nv_rd32(dev, 0x003334); | 221 | u32 ib_get = nv_rd32(dev, 0x003334); |
214 | u32 ib_put = nv_rd32(dev, 0x003330); | 222 | u32 ib_put = nv_rd32(dev, 0x003330); |
215 | 223 | ||
216 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%02x%08x " | 224 | if (nouveau_ratelimit()) |
225 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%02x%08x " | ||
217 | "Put 0x%02x%08x IbGet 0x%08x IbPut 0x%08x " | 226 | "Put 0x%02x%08x IbGet 0x%08x IbPut 0x%08x " |
218 | "State 0x%08x Push 0x%08x\n", | 227 | "State 0x%08x Push 0x%08x\n", |
219 | chid, ho_get, get, ho_put, put, ib_get, ib_put, | 228 | chid, ho_get, dma_get, ho_put, |
220 | state, push); | 229 | dma_put, ib_get, ib_put, state, |
230 | push); | ||
221 | 231 | ||
222 | /* METHOD_COUNT, in DMA_STATE on earlier chipsets */ | 232 | /* METHOD_COUNT, in DMA_STATE on earlier chipsets */ |
223 | nv_wr32(dev, 0x003364, 0x00000000); | 233 | nv_wr32(dev, 0x003364, 0x00000000); |
224 | if (get != put || ho_get != ho_put) { | 234 | if (dma_get != dma_put || ho_get != ho_put) { |
225 | nv_wr32(dev, 0x003244, put); | 235 | nv_wr32(dev, 0x003244, dma_put); |
226 | nv_wr32(dev, 0x003328, ho_put); | 236 | nv_wr32(dev, 0x003328, ho_put); |
227 | } else | 237 | } else |
228 | if (ib_get != ib_put) { | 238 | if (ib_get != ib_put) { |
@@ -231,10 +241,10 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
231 | } else { | 241 | } else { |
232 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%08x " | 242 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%08x " |
233 | "Put 0x%08x State 0x%08x Push 0x%08x\n", | 243 | "Put 0x%08x State 0x%08x Push 0x%08x\n", |
234 | chid, get, put, state, push); | 244 | chid, dma_get, dma_put, state, push); |
235 | 245 | ||
236 | if (get != put) | 246 | if (dma_get != dma_put) |
237 | nv_wr32(dev, 0x003244, put); | 247 | nv_wr32(dev, 0x003244, dma_put); |
238 | } | 248 | } |
239 | 249 | ||
240 | nv_wr32(dev, 0x003228, 0x00000000); | 250 | nv_wr32(dev, 0x003228, 0x00000000); |
@@ -266,8 +276,9 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
266 | } | 276 | } |
267 | 277 | ||
268 | if (status) { | 278 | if (status) { |
269 | NV_INFO(dev, "PFIFO_INTR 0x%08x - Ch %d\n", | 279 | if (nouveau_ratelimit()) |
270 | status, chid); | 280 | NV_INFO(dev, "PFIFO_INTR 0x%08x - Ch %d\n", |
281 | status, chid); | ||
271 | nv_wr32(dev, NV03_PFIFO_INTR_0, status); | 282 | nv_wr32(dev, NV03_PFIFO_INTR_0, status); |
272 | status = 0; | 283 | status = 0; |
273 | } | 284 | } |
@@ -544,13 +555,6 @@ nouveau_pgraph_intr_notify(struct drm_device *dev, uint32_t nsource) | |||
544 | nouveau_graph_dump_trap_info(dev, "PGRAPH_NOTIFY", &trap); | 555 | nouveau_graph_dump_trap_info(dev, "PGRAPH_NOTIFY", &trap); |
545 | } | 556 | } |
546 | 557 | ||
547 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | ||
548 | |||
549 | static int nouveau_ratelimit(void) | ||
550 | { | ||
551 | return __ratelimit(&nouveau_ratelimit_state); | ||
552 | } | ||
553 | |||
554 | 558 | ||
555 | static inline void | 559 | static inline void |
556 | nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource) | 560 | nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index a163c7c612e7..fe4a30dc4b42 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -33,9 +33,9 @@ | |||
33 | #include "drmP.h" | 33 | #include "drmP.h" |
34 | #include "drm.h" | 34 | #include "drm.h" |
35 | #include "drm_sarea.h" | 35 | #include "drm_sarea.h" |
36 | #include "nouveau_drv.h" | ||
37 | 36 | ||
38 | #define MIN(a,b) a < b ? a : b | 37 | #include "nouveau_drv.h" |
38 | #include "nouveau_pm.h" | ||
39 | 39 | ||
40 | /* | 40 | /* |
41 | * NV10-NV40 tiling helpers | 41 | * NV10-NV40 tiling helpers |
@@ -175,11 +175,10 @@ nv50_mem_vm_bind_linear(struct drm_device *dev, uint64_t virt, uint32_t size, | |||
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
178 | dev_priv->engine.instmem.flush(dev); | ||
179 | 178 | ||
180 | nv50_vm_flush(dev, 5); | 179 | dev_priv->engine.instmem.flush(dev); |
181 | nv50_vm_flush(dev, 0); | 180 | dev_priv->engine.fifo.tlb_flush(dev); |
182 | nv50_vm_flush(dev, 4); | 181 | dev_priv->engine.graph.tlb_flush(dev); |
183 | nv50_vm_flush(dev, 6); | 182 | nv50_vm_flush(dev, 6); |
184 | return 0; | 183 | return 0; |
185 | } | 184 | } |
@@ -209,11 +208,10 @@ nv50_mem_vm_unbind(struct drm_device *dev, uint64_t virt, uint32_t size) | |||
209 | pte++; | 208 | pte++; |
210 | } | 209 | } |
211 | } | 210 | } |
212 | dev_priv->engine.instmem.flush(dev); | ||
213 | 211 | ||
214 | nv50_vm_flush(dev, 5); | 212 | dev_priv->engine.instmem.flush(dev); |
215 | nv50_vm_flush(dev, 0); | 213 | dev_priv->engine.fifo.tlb_flush(dev); |
216 | nv50_vm_flush(dev, 4); | 214 | dev_priv->engine.graph.tlb_flush(dev); |
217 | nv50_vm_flush(dev, 6); | 215 | nv50_vm_flush(dev, 6); |
218 | } | 216 | } |
219 | 217 | ||
@@ -653,6 +651,7 @@ nouveau_mem_gart_init(struct drm_device *dev) | |||
653 | void | 651 | void |
654 | nouveau_mem_timing_init(struct drm_device *dev) | 652 | nouveau_mem_timing_init(struct drm_device *dev) |
655 | { | 653 | { |
654 | /* cards < NVC0 only */ | ||
656 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 655 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
657 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 656 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
658 | struct nouveau_pm_memtimings *memtimings = &pm->memtimings; | 657 | struct nouveau_pm_memtimings *memtimings = &pm->memtimings; |
@@ -719,14 +718,14 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
719 | tUNK_19 = 1; | 718 | tUNK_19 = 1; |
720 | tUNK_20 = 0; | 719 | tUNK_20 = 0; |
721 | tUNK_21 = 0; | 720 | tUNK_21 = 0; |
722 | switch (MIN(recordlen,21)) { | 721 | switch (min(recordlen, 22)) { |
723 | case 21: | 722 | case 22: |
724 | tUNK_21 = entry[21]; | 723 | tUNK_21 = entry[21]; |
725 | case 20: | 724 | case 21: |
726 | tUNK_20 = entry[20]; | 725 | tUNK_20 = entry[20]; |
727 | case 19: | 726 | case 20: |
728 | tUNK_19 = entry[19]; | 727 | tUNK_19 = entry[19]; |
729 | case 18: | 728 | case 19: |
730 | tUNK_18 = entry[18]; | 729 | tUNK_18 = entry[18]; |
731 | default: | 730 | default: |
732 | tUNK_0 = entry[0]; | 731 | tUNK_0 = entry[0]; |
@@ -756,24 +755,30 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
756 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 755 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
757 | if(recordlen > 19) { | 756 | if(recordlen > 19) { |
758 | timing->reg_100228 += (tUNK_19 - 1) << 24; | 757 | timing->reg_100228 += (tUNK_19 - 1) << 24; |
759 | } else { | 758 | }/* I cannot back-up this else-statement right now |
759 | else { | ||
760 | timing->reg_100228 += tUNK_12 << 24; | 760 | timing->reg_100228 += tUNK_12 << 24; |
761 | } | 761 | }*/ |
762 | 762 | ||
763 | /* XXX: reg_10022c */ | 763 | /* XXX: reg_10022c */ |
764 | timing->reg_10022c = tUNK_2 - 1; | ||
764 | 765 | ||
765 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 766 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | |
766 | tUNK_13 << 8 | tUNK_13); | 767 | tUNK_13 << 8 | tUNK_13); |
767 | 768 | ||
768 | /* XXX: +6? */ | 769 | /* XXX: +6? */ |
769 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); | 770 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); |
770 | if(tUNK_10 > tUNK_11) { | 771 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; |
771 | timing->reg_100234 += tUNK_10 << 16; | 772 | |
772 | } else { | 773 | /* XXX; reg_100238, reg_10023c |
773 | timing->reg_100234 += tUNK_11 << 16; | 774 | * reg: 0x00?????? |
775 | * reg_10023c: | ||
776 | * 0 for pre-NV50 cards | ||
777 | * 0x????0202 for NV50+ cards (empirical evidence) */ | ||
778 | if(dev_priv->card_type >= NV_50) { | ||
779 | timing->reg_10023c = 0x202; | ||
774 | } | 780 | } |
775 | 781 | ||
776 | /* XXX; reg_100238, reg_10023c */ | ||
777 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 782 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
778 | timing->reg_100220, timing->reg_100224, | 783 | timing->reg_100220, timing->reg_100224, |
779 | timing->reg_100228, timing->reg_10022c); | 784 | timing->reg_100228, timing->reg_10022c); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 896cf8634144..dd572adca02a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -129,7 +129,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
129 | if (ramin == NULL) { | 129 | if (ramin == NULL) { |
130 | spin_unlock(&dev_priv->ramin_lock); | 130 | spin_unlock(&dev_priv->ramin_lock); |
131 | nouveau_gpuobj_ref(NULL, &gpuobj); | 131 | nouveau_gpuobj_ref(NULL, &gpuobj); |
132 | return ret; | 132 | return -ENOMEM; |
133 | } | 133 | } |
134 | 134 | ||
135 | ramin = drm_mm_get_block_atomic(ramin, size, align); | 135 | ramin = drm_mm_get_block_atomic(ramin, size, align); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 1c99c55d6d46..9f7b158f5825 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -284,6 +284,7 @@ nouveau_sysfs_fini(struct drm_device *dev) | |||
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | #ifdef CONFIG_HWMON | ||
287 | static ssize_t | 288 | static ssize_t |
288 | nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) | 289 | nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) |
289 | { | 290 | { |
@@ -395,10 +396,12 @@ static struct attribute *hwmon_attributes[] = { | |||
395 | static const struct attribute_group hwmon_attrgroup = { | 396 | static const struct attribute_group hwmon_attrgroup = { |
396 | .attrs = hwmon_attributes, | 397 | .attrs = hwmon_attributes, |
397 | }; | 398 | }; |
399 | #endif | ||
398 | 400 | ||
399 | static int | 401 | static int |
400 | nouveau_hwmon_init(struct drm_device *dev) | 402 | nouveau_hwmon_init(struct drm_device *dev) |
401 | { | 403 | { |
404 | #ifdef CONFIG_HWMON | ||
402 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 405 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
403 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 406 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
404 | struct device *hwmon_dev; | 407 | struct device *hwmon_dev; |
@@ -425,13 +428,14 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
425 | } | 428 | } |
426 | 429 | ||
427 | pm->hwmon = hwmon_dev; | 430 | pm->hwmon = hwmon_dev; |
428 | 431 | #endif | |
429 | return 0; | 432 | return 0; |
430 | } | 433 | } |
431 | 434 | ||
432 | static void | 435 | static void |
433 | nouveau_hwmon_fini(struct drm_device *dev) | 436 | nouveau_hwmon_fini(struct drm_device *dev) |
434 | { | 437 | { |
438 | #ifdef CONFIG_HWMON | ||
435 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 439 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
436 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 440 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
437 | 441 | ||
@@ -439,6 +443,7 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
439 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 443 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); |
440 | hwmon_device_unregister(pm->hwmon); | 444 | hwmon_device_unregister(pm->hwmon); |
441 | } | 445 | } |
446 | #endif | ||
442 | } | 447 | } |
443 | 448 | ||
444 | int | 449 | int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_ramht.c b/drivers/gpu/drm/nouveau/nouveau_ramht.c index 7f16697cc96c..2d8580927ca4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ramht.c +++ b/drivers/gpu/drm/nouveau/nouveau_ramht.c | |||
@@ -153,26 +153,42 @@ nouveau_ramht_insert(struct nouveau_channel *chan, u32 handle, | |||
153 | return -ENOMEM; | 153 | return -ENOMEM; |
154 | } | 154 | } |
155 | 155 | ||
156 | static struct nouveau_ramht_entry * | ||
157 | nouveau_ramht_remove_entry(struct nouveau_channel *chan, u32 handle) | ||
158 | { | ||
159 | struct nouveau_ramht *ramht = chan ? chan->ramht : NULL; | ||
160 | struct nouveau_ramht_entry *entry; | ||
161 | unsigned long flags; | ||
162 | |||
163 | if (!ramht) | ||
164 | return NULL; | ||
165 | |||
166 | spin_lock_irqsave(&ramht->lock, flags); | ||
167 | list_for_each_entry(entry, &ramht->entries, head) { | ||
168 | if (entry->channel == chan && | ||
169 | (!handle || entry->handle == handle)) { | ||
170 | list_del(&entry->head); | ||
171 | spin_unlock_irqrestore(&ramht->lock, flags); | ||
172 | |||
173 | return entry; | ||
174 | } | ||
175 | } | ||
176 | spin_unlock_irqrestore(&ramht->lock, flags); | ||
177 | |||
178 | return NULL; | ||
179 | } | ||
180 | |||
156 | static void | 181 | static void |
157 | nouveau_ramht_remove_locked(struct nouveau_channel *chan, u32 handle) | 182 | nouveau_ramht_remove_hash(struct nouveau_channel *chan, u32 handle) |
158 | { | 183 | { |
159 | struct drm_device *dev = chan->dev; | 184 | struct drm_device *dev = chan->dev; |
160 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 185 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
161 | struct nouveau_instmem_engine *instmem = &dev_priv->engine.instmem; | 186 | struct nouveau_instmem_engine *instmem = &dev_priv->engine.instmem; |
162 | struct nouveau_gpuobj *ramht = chan->ramht->gpuobj; | 187 | struct nouveau_gpuobj *ramht = chan->ramht->gpuobj; |
163 | struct nouveau_ramht_entry *entry, *tmp; | 188 | unsigned long flags; |
164 | u32 co, ho; | 189 | u32 co, ho; |
165 | 190 | ||
166 | list_for_each_entry_safe(entry, tmp, &chan->ramht->entries, head) { | 191 | spin_lock_irqsave(&chan->ramht->lock, flags); |
167 | if (entry->channel != chan || entry->handle != handle) | ||
168 | continue; | ||
169 | |||
170 | nouveau_gpuobj_ref(NULL, &entry->gpuobj); | ||
171 | list_del(&entry->head); | ||
172 | kfree(entry); | ||
173 | break; | ||
174 | } | ||
175 | |||
176 | co = ho = nouveau_ramht_hash_handle(chan, handle); | 192 | co = ho = nouveau_ramht_hash_handle(chan, handle); |
177 | do { | 193 | do { |
178 | if (nouveau_ramht_entry_valid(dev, ramht, co) && | 194 | if (nouveau_ramht_entry_valid(dev, ramht, co) && |
@@ -184,7 +200,7 @@ nouveau_ramht_remove_locked(struct nouveau_channel *chan, u32 handle) | |||
184 | nv_wo32(ramht, co + 0, 0x00000000); | 200 | nv_wo32(ramht, co + 0, 0x00000000); |
185 | nv_wo32(ramht, co + 4, 0x00000000); | 201 | nv_wo32(ramht, co + 4, 0x00000000); |
186 | instmem->flush(dev); | 202 | instmem->flush(dev); |
187 | return; | 203 | goto out; |
188 | } | 204 | } |
189 | 205 | ||
190 | co += 8; | 206 | co += 8; |
@@ -194,17 +210,22 @@ nouveau_ramht_remove_locked(struct nouveau_channel *chan, u32 handle) | |||
194 | 210 | ||
195 | NV_ERROR(dev, "RAMHT entry not found. ch=%d, handle=0x%08x\n", | 211 | NV_ERROR(dev, "RAMHT entry not found. ch=%d, handle=0x%08x\n", |
196 | chan->id, handle); | 212 | chan->id, handle); |
213 | out: | ||
214 | spin_unlock_irqrestore(&chan->ramht->lock, flags); | ||
197 | } | 215 | } |
198 | 216 | ||
199 | void | 217 | void |
200 | nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle) | 218 | nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle) |
201 | { | 219 | { |
202 | struct nouveau_ramht *ramht = chan->ramht; | 220 | struct nouveau_ramht_entry *entry; |
203 | unsigned long flags; | ||
204 | 221 | ||
205 | spin_lock_irqsave(&ramht->lock, flags); | 222 | entry = nouveau_ramht_remove_entry(chan, handle); |
206 | nouveau_ramht_remove_locked(chan, handle); | 223 | if (!entry) |
207 | spin_unlock_irqrestore(&ramht->lock, flags); | 224 | return; |
225 | |||
226 | nouveau_ramht_remove_hash(chan, entry->handle); | ||
227 | nouveau_gpuobj_ref(NULL, &entry->gpuobj); | ||
228 | kfree(entry); | ||
208 | } | 229 | } |
209 | 230 | ||
210 | struct nouveau_gpuobj * | 231 | struct nouveau_gpuobj * |
@@ -265,23 +286,19 @@ void | |||
265 | nouveau_ramht_ref(struct nouveau_ramht *ref, struct nouveau_ramht **ptr, | 286 | nouveau_ramht_ref(struct nouveau_ramht *ref, struct nouveau_ramht **ptr, |
266 | struct nouveau_channel *chan) | 287 | struct nouveau_channel *chan) |
267 | { | 288 | { |
268 | struct nouveau_ramht_entry *entry, *tmp; | 289 | struct nouveau_ramht_entry *entry; |
269 | struct nouveau_ramht *ramht; | 290 | struct nouveau_ramht *ramht; |
270 | unsigned long flags; | ||
271 | 291 | ||
272 | if (ref) | 292 | if (ref) |
273 | kref_get(&ref->refcount); | 293 | kref_get(&ref->refcount); |
274 | 294 | ||
275 | ramht = *ptr; | 295 | ramht = *ptr; |
276 | if (ramht) { | 296 | if (ramht) { |
277 | spin_lock_irqsave(&ramht->lock, flags); | 297 | while ((entry = nouveau_ramht_remove_entry(chan, 0))) { |
278 | list_for_each_entry_safe(entry, tmp, &ramht->entries, head) { | 298 | nouveau_ramht_remove_hash(chan, entry->handle); |
279 | if (entry->channel != chan) | 299 | nouveau_gpuobj_ref(NULL, &entry->gpuobj); |
280 | continue; | 300 | kfree(entry); |
281 | |||
282 | nouveau_ramht_remove_locked(chan, entry->handle); | ||
283 | } | 301 | } |
284 | spin_unlock_irqrestore(&ramht->lock, flags); | ||
285 | 302 | ||
286 | kref_put(&ramht->refcount, nouveau_ramht_del); | 303 | kref_put(&ramht->refcount, nouveau_ramht_del); |
287 | } | 304 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 288bacac7e5a..d4ac97007038 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
@@ -120,8 +120,8 @@ nouveau_sgdma_bind(struct ttm_backend *be, struct ttm_mem_reg *mem) | |||
120 | dev_priv->engine.instmem.flush(nvbe->dev); | 120 | dev_priv->engine.instmem.flush(nvbe->dev); |
121 | 121 | ||
122 | if (dev_priv->card_type == NV_50) { | 122 | if (dev_priv->card_type == NV_50) { |
123 | nv50_vm_flush(dev, 5); /* PGRAPH */ | 123 | dev_priv->engine.fifo.tlb_flush(dev); |
124 | nv50_vm_flush(dev, 0); /* PFIFO */ | 124 | dev_priv->engine.graph.tlb_flush(dev); |
125 | } | 125 | } |
126 | 126 | ||
127 | nvbe->bound = true; | 127 | nvbe->bound = true; |
@@ -162,8 +162,8 @@ nouveau_sgdma_unbind(struct ttm_backend *be) | |||
162 | dev_priv->engine.instmem.flush(nvbe->dev); | 162 | dev_priv->engine.instmem.flush(nvbe->dev); |
163 | 163 | ||
164 | if (dev_priv->card_type == NV_50) { | 164 | if (dev_priv->card_type == NV_50) { |
165 | nv50_vm_flush(dev, 5); | 165 | dev_priv->engine.fifo.tlb_flush(dev); |
166 | nv50_vm_flush(dev, 0); | 166 | dev_priv->engine.graph.tlb_flush(dev); |
167 | } | 167 | } |
168 | 168 | ||
169 | nvbe->bound = false; | 169 | nvbe->bound = false; |
@@ -224,7 +224,11 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
224 | int i, ret; | 224 | int i, ret; |
225 | 225 | ||
226 | if (dev_priv->card_type < NV_50) { | 226 | if (dev_priv->card_type < NV_50) { |
227 | aper_size = (64 * 1024 * 1024); | 227 | if(dev_priv->ramin_rsvd_vram < 2 * 1024 * 1024) |
228 | aper_size = 64 * 1024 * 1024; | ||
229 | else | ||
230 | aper_size = 512 * 1024 * 1024; | ||
231 | |||
228 | obj_size = (aper_size >> NV_CTXDMA_PAGE_SHIFT) * 4; | 232 | obj_size = (aper_size >> NV_CTXDMA_PAGE_SHIFT) * 4; |
229 | obj_size += 8; /* ctxdma header */ | 233 | obj_size += 8; /* ctxdma header */ |
230 | } else { | 234 | } else { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index ed7757f14083..049f755567e5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -354,6 +354,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
354 | engine->graph.destroy_context = nv50_graph_destroy_context; | 354 | engine->graph.destroy_context = nv50_graph_destroy_context; |
355 | engine->graph.load_context = nv50_graph_load_context; | 355 | engine->graph.load_context = nv50_graph_load_context; |
356 | engine->graph.unload_context = nv50_graph_unload_context; | 356 | engine->graph.unload_context = nv50_graph_unload_context; |
357 | if (dev_priv->chipset != 0x86) | ||
358 | engine->graph.tlb_flush = nv50_graph_tlb_flush; | ||
359 | else { | ||
360 | /* from what i can see nvidia do this on every | ||
361 | * pre-NVA3 board except NVAC, but, we've only | ||
362 | * ever seen problems on NV86 | ||
363 | */ | ||
364 | engine->graph.tlb_flush = nv86_graph_tlb_flush; | ||
365 | } | ||
357 | engine->fifo.channels = 128; | 366 | engine->fifo.channels = 128; |
358 | engine->fifo.init = nv50_fifo_init; | 367 | engine->fifo.init = nv50_fifo_init; |
359 | engine->fifo.takedown = nv50_fifo_takedown; | 368 | engine->fifo.takedown = nv50_fifo_takedown; |
@@ -365,6 +374,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
365 | engine->fifo.destroy_context = nv50_fifo_destroy_context; | 374 | engine->fifo.destroy_context = nv50_fifo_destroy_context; |
366 | engine->fifo.load_context = nv50_fifo_load_context; | 375 | engine->fifo.load_context = nv50_fifo_load_context; |
367 | engine->fifo.unload_context = nv50_fifo_unload_context; | 376 | engine->fifo.unload_context = nv50_fifo_unload_context; |
377 | engine->fifo.tlb_flush = nv50_fifo_tlb_flush; | ||
368 | engine->display.early_init = nv50_display_early_init; | 378 | engine->display.early_init = nv50_display_early_init; |
369 | engine->display.late_takedown = nv50_display_late_takedown; | 379 | engine->display.late_takedown = nv50_display_late_takedown; |
370 | engine->display.create = nv50_display_create; | 380 | engine->display.create = nv50_display_create; |
@@ -1041,6 +1051,9 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, | |||
1041 | case NOUVEAU_GETPARAM_PTIMER_TIME: | 1051 | case NOUVEAU_GETPARAM_PTIMER_TIME: |
1042 | getparam->value = dev_priv->engine.timer.read(dev); | 1052 | getparam->value = dev_priv->engine.timer.read(dev); |
1043 | break; | 1053 | break; |
1054 | case NOUVEAU_GETPARAM_HAS_BO_USAGE: | ||
1055 | getparam->value = 1; | ||
1056 | break; | ||
1044 | case NOUVEAU_GETPARAM_GRAPH_UNITS: | 1057 | case NOUVEAU_GETPARAM_GRAPH_UNITS: |
1045 | /* NV40 and NV50 versions are quite different, but register | 1058 | /* NV40 and NV50 versions are quite different, but register |
1046 | * address is the same. User is supposed to know the card | 1059 | * address is the same. User is supposed to know the card |
@@ -1051,7 +1064,7 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, | |||
1051 | } | 1064 | } |
1052 | /* FALLTHRU */ | 1065 | /* FALLTHRU */ |
1053 | default: | 1066 | default: |
1054 | NV_ERROR(dev, "unknown parameter %lld\n", getparam->param); | 1067 | NV_DEBUG(dev, "unknown parameter %lld\n", getparam->param); |
1055 | return -EINVAL; | 1068 | return -EINVAL; |
1056 | } | 1069 | } |
1057 | 1070 | ||
@@ -1066,7 +1079,7 @@ nouveau_ioctl_setparam(struct drm_device *dev, void *data, | |||
1066 | 1079 | ||
1067 | switch (setparam->param) { | 1080 | switch (setparam->param) { |
1068 | default: | 1081 | default: |
1069 | NV_ERROR(dev, "unknown parameter %lld\n", setparam->param); | 1082 | NV_DEBUG(dev, "unknown parameter %lld\n", setparam->param); |
1070 | return -EINVAL; | 1083 | return -EINVAL; |
1071 | } | 1084 | } |
1072 | 1085 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c index 16bbbf1eff63..7ecc4adc1e45 100644 --- a/drivers/gpu/drm/nouveau/nouveau_temp.c +++ b/drivers/gpu/drm/nouveau/nouveau_temp.c | |||
@@ -191,7 +191,7 @@ nv40_temp_get(struct drm_device *dev) | |||
191 | int offset = sensor->offset_mult / sensor->offset_div; | 191 | int offset = sensor->offset_mult / sensor->offset_div; |
192 | int core_temp; | 192 | int core_temp; |
193 | 193 | ||
194 | if (dev_priv->chipset >= 0x50) { | 194 | if (dev_priv->card_type >= NV_50) { |
195 | core_temp = nv_rd32(dev, 0x20008); | 195 | core_temp = nv_rd32(dev, 0x20008); |
196 | } else { | 196 | } else { |
197 | core_temp = nv_rd32(dev, 0x0015b4) & 0x1fff; | 197 | core_temp = nv_rd32(dev, 0x0015b4) & 0x1fff; |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index c71abc2a34d5..40e180741629 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
@@ -158,7 +158,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
158 | { | 158 | { |
159 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 159 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
160 | struct drm_device *dev = crtc->dev; | 160 | struct drm_device *dev = crtc->dev; |
161 | struct drm_connector *connector; | ||
162 | unsigned char seq1 = 0, crtc17 = 0; | 161 | unsigned char seq1 = 0, crtc17 = 0; |
163 | unsigned char crtc1A; | 162 | unsigned char crtc1A; |
164 | 163 | ||
@@ -213,10 +212,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
213 | NVVgaSeqReset(dev, nv_crtc->index, false); | 212 | NVVgaSeqReset(dev, nv_crtc->index, false); |
214 | 213 | ||
215 | NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A); | 214 | NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A); |
216 | |||
217 | /* Update connector polling modes */ | ||
218 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) | ||
219 | nouveau_connector_set_polling(connector); | ||
220 | } | 215 | } |
221 | 216 | ||
222 | static bool | 217 | static bool |
@@ -831,7 +826,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
831 | /* Update the framebuffer location. */ | 826 | /* Update the framebuffer location. */ |
832 | regp->fb_start = nv_crtc->fb.offset & ~3; | 827 | regp->fb_start = nv_crtc->fb.offset & ~3; |
833 | regp->fb_start += (y * drm_fb->pitch) + (x * drm_fb->bits_per_pixel / 8); | 828 | regp->fb_start += (y * drm_fb->pitch) + (x * drm_fb->bits_per_pixel / 8); |
834 | NVWriteCRTC(dev, nv_crtc->index, NV_PCRTC_START, regp->fb_start); | 829 | nv_set_crtc_base(dev, nv_crtc->index, regp->fb_start); |
835 | 830 | ||
836 | /* Update the arbitration parameters. */ | 831 | /* Update the arbitration parameters. */ |
837 | nouveau_calc_arb(dev, crtc->mode.clock, drm_fb->bits_per_pixel, | 832 | nouveau_calc_arb(dev, crtc->mode.clock, drm_fb->bits_per_pixel, |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index c936403b26e2..ef23550407b5 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -185,14 +185,15 @@ static bool nv04_dfp_mode_fixup(struct drm_encoder *encoder, | |||
185 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | 185 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
186 | struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder); | 186 | struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder); |
187 | 187 | ||
188 | /* For internal panels and gpu scaling on DVI we need the native mode */ | 188 | if (!nv_connector->native_mode || |
189 | if (nv_connector->scaling_mode != DRM_MODE_SCALE_NONE) { | 189 | nv_connector->scaling_mode == DRM_MODE_SCALE_NONE || |
190 | if (!nv_connector->native_mode) | 190 | mode->hdisplay > nv_connector->native_mode->hdisplay || |
191 | return false; | 191 | mode->vdisplay > nv_connector->native_mode->vdisplay) { |
192 | nv_encoder->mode = *adjusted_mode; | ||
193 | |||
194 | } else { | ||
192 | nv_encoder->mode = *nv_connector->native_mode; | 195 | nv_encoder->mode = *nv_connector->native_mode; |
193 | adjusted_mode->clock = nv_connector->native_mode->clock; | 196 | adjusted_mode->clock = nv_connector->native_mode->clock; |
194 | } else { | ||
195 | nv_encoder->mode = *adjusted_mode; | ||
196 | } | 197 | } |
197 | 198 | ||
198 | return true; | 199 | return true; |
diff --git a/drivers/gpu/drm/nouveau/nv04_pm.c b/drivers/gpu/drm/nouveau/nv04_pm.c index 6a6eb697d38e..eb1c70dd82ed 100644 --- a/drivers/gpu/drm/nouveau/nv04_pm.c +++ b/drivers/gpu/drm/nouveau/nv04_pm.c | |||
@@ -76,6 +76,15 @@ nv04_pm_clock_set(struct drm_device *dev, void *pre_state) | |||
76 | reg += 4; | 76 | reg += 4; |
77 | 77 | ||
78 | nouveau_hw_setpll(dev, reg, &state->calc); | 78 | nouveau_hw_setpll(dev, reg, &state->calc); |
79 | |||
80 | if (dev_priv->card_type < NV_30 && reg == NV_PRAMDAC_MPLL_COEFF) { | ||
81 | if (dev_priv->card_type == NV_20) | ||
82 | nv_mask(dev, 0x1002c4, 0, 1 << 20); | ||
83 | |||
84 | /* Reset the DLLs */ | ||
85 | nv_mask(dev, 0x1002c0, 0, 1 << 8); | ||
86 | } | ||
87 | |||
79 | kfree(state); | 88 | kfree(state); |
80 | } | 89 | } |
81 | 90 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_calc.c b/drivers/gpu/drm/nouveau/nv50_calc.c index 2cdc2bfe7179..de81151648f8 100644 --- a/drivers/gpu/drm/nouveau/nv50_calc.c +++ b/drivers/gpu/drm/nouveau/nv50_calc.c | |||
@@ -51,24 +51,28 @@ nv50_calc_pll2(struct drm_device *dev, struct pll_lims *pll, int clk, | |||
51 | int *N, int *fN, int *M, int *P) | 51 | int *N, int *fN, int *M, int *P) |
52 | { | 52 | { |
53 | fixed20_12 fb_div, a, b; | 53 | fixed20_12 fb_div, a, b; |
54 | u32 refclk = pll->refclk / 10; | ||
55 | u32 max_vco_freq = pll->vco1.maxfreq / 10; | ||
56 | u32 max_vco_inputfreq = pll->vco1.max_inputfreq / 10; | ||
57 | clk /= 10; | ||
54 | 58 | ||
55 | *P = pll->vco1.maxfreq / clk; | 59 | *P = max_vco_freq / clk; |
56 | if (*P > pll->max_p) | 60 | if (*P > pll->max_p) |
57 | *P = pll->max_p; | 61 | *P = pll->max_p; |
58 | if (*P < pll->min_p) | 62 | if (*P < pll->min_p) |
59 | *P = pll->min_p; | 63 | *P = pll->min_p; |
60 | 64 | ||
61 | /* *M = ceil(refclk / pll->vco.max_inputfreq); */ | 65 | /* *M = floor((refclk + max_vco_inputfreq) / max_vco_inputfreq); */ |
62 | a.full = dfixed_const(pll->refclk); | 66 | a.full = dfixed_const(refclk + max_vco_inputfreq); |
63 | b.full = dfixed_const(pll->vco1.max_inputfreq); | 67 | b.full = dfixed_const(max_vco_inputfreq); |
64 | a.full = dfixed_div(a, b); | 68 | a.full = dfixed_div(a, b); |
65 | a.full = dfixed_ceil(a); | 69 | a.full = dfixed_floor(a); |
66 | *M = dfixed_trunc(a); | 70 | *M = dfixed_trunc(a); |
67 | 71 | ||
68 | /* fb_div = (vco * *M) / refclk; */ | 72 | /* fb_div = (vco * *M) / refclk; */ |
69 | fb_div.full = dfixed_const(clk * *P); | 73 | fb_div.full = dfixed_const(clk * *P); |
70 | fb_div.full = dfixed_mul(fb_div, a); | 74 | fb_div.full = dfixed_mul(fb_div, a); |
71 | a.full = dfixed_const(pll->refclk); | 75 | a.full = dfixed_const(refclk); |
72 | fb_div.full = dfixed_div(fb_div, a); | 76 | fb_div.full = dfixed_div(fb_div, a); |
73 | 77 | ||
74 | /* *N = floor(fb_div); */ | 78 | /* *N = floor(fb_div); */ |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 16380d52cd88..56476d0c6de8 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -546,7 +546,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base; | 548 | nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base; |
549 | nv_crtc->fb.tile_flags = fb->nvbo->tile_flags; | 549 | nv_crtc->fb.tile_flags = nouveau_bo_tile_layout(fb->nvbo); |
550 | nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8; | 550 | nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8; |
551 | if (!nv_crtc->fb.blanked && dev_priv->chipset != 0x50) { | 551 | if (!nv_crtc->fb.blanked && dev_priv->chipset != 0x50) { |
552 | ret = RING_SPACE(evo, 2); | 552 | ret = RING_SPACE(evo, 2); |
@@ -578,7 +578,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
578 | fb->nvbo->tile_mode); | 578 | fb->nvbo->tile_mode); |
579 | } | 579 | } |
580 | if (dev_priv->chipset == 0x50) | 580 | if (dev_priv->chipset == 0x50) |
581 | OUT_RING(evo, (fb->nvbo->tile_flags << 8) | format); | 581 | OUT_RING(evo, (nv_crtc->fb.tile_flags << 8) | format); |
582 | else | 582 | else |
583 | OUT_RING(evo, format); | 583 | OUT_RING(evo, format); |
584 | 584 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 55c9663ef2bf..f624c611ddea 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1032,11 +1032,18 @@ nv50_display_irq_hotplug_bh(struct work_struct *work) | |||
1032 | struct drm_connector *connector; | 1032 | struct drm_connector *connector; |
1033 | const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; | 1033 | const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; |
1034 | uint32_t unplug_mask, plug_mask, change_mask; | 1034 | uint32_t unplug_mask, plug_mask, change_mask; |
1035 | uint32_t hpd0, hpd1 = 0; | 1035 | uint32_t hpd0, hpd1; |
1036 | 1036 | ||
1037 | hpd0 = nv_rd32(dev, 0xe054) & nv_rd32(dev, 0xe050); | 1037 | spin_lock_irq(&dev_priv->hpd_state.lock); |
1038 | hpd0 = dev_priv->hpd_state.hpd0_bits; | ||
1039 | dev_priv->hpd_state.hpd0_bits = 0; | ||
1040 | hpd1 = dev_priv->hpd_state.hpd1_bits; | ||
1041 | dev_priv->hpd_state.hpd1_bits = 0; | ||
1042 | spin_unlock_irq(&dev_priv->hpd_state.lock); | ||
1043 | |||
1044 | hpd0 &= nv_rd32(dev, 0xe050); | ||
1038 | if (dev_priv->chipset >= 0x90) | 1045 | if (dev_priv->chipset >= 0x90) |
1039 | hpd1 = nv_rd32(dev, 0xe074) & nv_rd32(dev, 0xe070); | 1046 | hpd1 &= nv_rd32(dev, 0xe070); |
1040 | 1047 | ||
1041 | plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); | 1048 | plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); |
1042 | unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); | 1049 | unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); |
@@ -1078,10 +1085,6 @@ nv50_display_irq_hotplug_bh(struct work_struct *work) | |||
1078 | helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); | 1085 | helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); |
1079 | } | 1086 | } |
1080 | 1087 | ||
1081 | nv_wr32(dev, 0xe054, nv_rd32(dev, 0xe054)); | ||
1082 | if (dev_priv->chipset >= 0x90) | ||
1083 | nv_wr32(dev, 0xe074, nv_rd32(dev, 0xe074)); | ||
1084 | |||
1085 | drm_helper_hpd_irq_event(dev); | 1088 | drm_helper_hpd_irq_event(dev); |
1086 | } | 1089 | } |
1087 | 1090 | ||
@@ -1092,8 +1095,22 @@ nv50_display_irq_handler(struct drm_device *dev) | |||
1092 | uint32_t delayed = 0; | 1095 | uint32_t delayed = 0; |
1093 | 1096 | ||
1094 | if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { | 1097 | if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { |
1095 | if (!work_pending(&dev_priv->hpd_work)) | 1098 | uint32_t hpd0_bits, hpd1_bits = 0; |
1096 | queue_work(dev_priv->wq, &dev_priv->hpd_work); | 1099 | |
1100 | hpd0_bits = nv_rd32(dev, 0xe054); | ||
1101 | nv_wr32(dev, 0xe054, hpd0_bits); | ||
1102 | |||
1103 | if (dev_priv->chipset >= 0x90) { | ||
1104 | hpd1_bits = nv_rd32(dev, 0xe074); | ||
1105 | nv_wr32(dev, 0xe074, hpd1_bits); | ||
1106 | } | ||
1107 | |||
1108 | spin_lock(&dev_priv->hpd_state.lock); | ||
1109 | dev_priv->hpd_state.hpd0_bits |= hpd0_bits; | ||
1110 | dev_priv->hpd_state.hpd1_bits |= hpd1_bits; | ||
1111 | spin_unlock(&dev_priv->hpd_state.lock); | ||
1112 | |||
1113 | queue_work(dev_priv->wq, &dev_priv->hpd_work); | ||
1097 | } | 1114 | } |
1098 | 1115 | ||
1099 | while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { | 1116 | while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c index a46a961102f3..1da65bd60c10 100644 --- a/drivers/gpu/drm/nouveau/nv50_fifo.c +++ b/drivers/gpu/drm/nouveau/nv50_fifo.c | |||
@@ -464,3 +464,8 @@ nv50_fifo_unload_context(struct drm_device *dev) | |||
464 | return 0; | 464 | return 0; |
465 | } | 465 | } |
466 | 466 | ||
467 | void | ||
468 | nv50_fifo_tlb_flush(struct drm_device *dev) | ||
469 | { | ||
470 | nv50_vm_flush(dev, 5); | ||
471 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index cbf5ae2f67d4..8b669d0af610 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -402,3 +402,55 @@ struct nouveau_pgraph_object_class nv50_graph_grclass[] = { | |||
402 | { 0x8597, false, NULL }, /* tesla (nva3, nva5, nva8) */ | 402 | { 0x8597, false, NULL }, /* tesla (nva3, nva5, nva8) */ |
403 | {} | 403 | {} |
404 | }; | 404 | }; |
405 | |||
406 | void | ||
407 | nv50_graph_tlb_flush(struct drm_device *dev) | ||
408 | { | ||
409 | nv50_vm_flush(dev, 0); | ||
410 | } | ||
411 | |||
412 | void | ||
413 | nv86_graph_tlb_flush(struct drm_device *dev) | ||
414 | { | ||
415 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
416 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | ||
417 | bool idle, timeout = false; | ||
418 | unsigned long flags; | ||
419 | u64 start; | ||
420 | u32 tmp; | ||
421 | |||
422 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
423 | nv_mask(dev, 0x400500, 0x00000001, 0x00000000); | ||
424 | |||
425 | start = ptimer->read(dev); | ||
426 | do { | ||
427 | idle = true; | ||
428 | |||
429 | for (tmp = nv_rd32(dev, 0x400380); tmp && idle; tmp >>= 3) { | ||
430 | if ((tmp & 7) == 1) | ||
431 | idle = false; | ||
432 | } | ||
433 | |||
434 | for (tmp = nv_rd32(dev, 0x400384); tmp && idle; tmp >>= 3) { | ||
435 | if ((tmp & 7) == 1) | ||
436 | idle = false; | ||
437 | } | ||
438 | |||
439 | for (tmp = nv_rd32(dev, 0x400388); tmp && idle; tmp >>= 3) { | ||
440 | if ((tmp & 7) == 1) | ||
441 | idle = false; | ||
442 | } | ||
443 | } while (!idle && !(timeout = ptimer->read(dev) - start > 2000000000)); | ||
444 | |||
445 | if (timeout) { | ||
446 | NV_ERROR(dev, "PGRAPH TLB flush idle timeout fail: " | ||
447 | "0x%08x 0x%08x 0x%08x 0x%08x\n", | ||
448 | nv_rd32(dev, 0x400700), nv_rd32(dev, 0x400380), | ||
449 | nv_rd32(dev, 0x400384), nv_rd32(dev, 0x400388)); | ||
450 | } | ||
451 | |||
452 | nv50_vm_flush(dev, 0); | ||
453 | |||
454 | nv_mask(dev, 0x400500, 0x00000001, 0x00000001); | ||
455 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
456 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c index a53fc974332b..b773229b7647 100644 --- a/drivers/gpu/drm/nouveau/nv50_instmem.c +++ b/drivers/gpu/drm/nouveau/nv50_instmem.c | |||
@@ -402,7 +402,6 @@ nv50_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj) | |||
402 | } | 402 | } |
403 | dev_priv->engine.instmem.flush(dev); | 403 | dev_priv->engine.instmem.flush(dev); |
404 | 404 | ||
405 | nv50_vm_flush(dev, 4); | ||
406 | nv50_vm_flush(dev, 6); | 405 | nv50_vm_flush(dev, 6); |
407 | 406 | ||
408 | gpuobj->im_bound = 1; | 407 | gpuobj->im_bound = 1; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 488c36c8f5e6..4dc5b4714c5a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1650,7 +1650,36 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1650 | } | 1650 | } |
1651 | } | 1651 | } |
1652 | 1652 | ||
1653 | rdev->config.evergreen.tile_config = gb_addr_config; | 1653 | /* setup tiling info dword. gb_addr_config is not adequate since it does |
1654 | * not have bank info, so create a custom tiling dword. | ||
1655 | * bits 3:0 num_pipes | ||
1656 | * bits 7:4 num_banks | ||
1657 | * bits 11:8 group_size | ||
1658 | * bits 15:12 row_size | ||
1659 | */ | ||
1660 | rdev->config.evergreen.tile_config = 0; | ||
1661 | switch (rdev->config.evergreen.max_tile_pipes) { | ||
1662 | case 1: | ||
1663 | default: | ||
1664 | rdev->config.evergreen.tile_config |= (0 << 0); | ||
1665 | break; | ||
1666 | case 2: | ||
1667 | rdev->config.evergreen.tile_config |= (1 << 0); | ||
1668 | break; | ||
1669 | case 4: | ||
1670 | rdev->config.evergreen.tile_config |= (2 << 0); | ||
1671 | break; | ||
1672 | case 8: | ||
1673 | rdev->config.evergreen.tile_config |= (3 << 0); | ||
1674 | break; | ||
1675 | } | ||
1676 | rdev->config.evergreen.tile_config |= | ||
1677 | ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 4; | ||
1678 | rdev->config.evergreen.tile_config |= | ||
1679 | ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) << 8; | ||
1680 | rdev->config.evergreen.tile_config |= | ||
1681 | ((gb_addr_config & 0x30000000) >> 28) << 12; | ||
1682 | |||
1654 | WREG32(GB_BACKEND_MAP, gb_backend_map); | 1683 | WREG32(GB_BACKEND_MAP, gb_backend_map); |
1655 | WREG32(GB_ADDR_CONFIG, gb_addr_config); | 1684 | WREG32(GB_ADDR_CONFIG, gb_addr_config); |
1656 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); | 1685 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index ac3b6dde23db..e0e590110dd4 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
@@ -459,7 +459,7 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
459 | obj_size += evergreen_ps_size * 4; | 459 | obj_size += evergreen_ps_size * 4; |
460 | obj_size = ALIGN(obj_size, 256); | 460 | obj_size = ALIGN(obj_size, 256); |
461 | 461 | ||
462 | r = radeon_bo_create(rdev, NULL, obj_size, true, RADEON_GEM_DOMAIN_VRAM, | 462 | r = radeon_bo_create(rdev, NULL, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
463 | &rdev->r600_blit.shader_obj); | 463 | &rdev->r600_blit.shader_obj); |
464 | if (r) { | 464 | if (r) { |
465 | DRM_ERROR("evergreen failed to allocate shader\n"); | 465 | DRM_ERROR("evergreen failed to allocate shader\n"); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 0f806cc7dc75..a3552594ccc4 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2718,7 +2718,7 @@ static int r600_ih_ring_alloc(struct radeon_device *rdev) | |||
2718 | /* Allocate ring buffer */ | 2718 | /* Allocate ring buffer */ |
2719 | if (rdev->ih.ring_obj == NULL) { | 2719 | if (rdev->ih.ring_obj == NULL) { |
2720 | r = radeon_bo_create(rdev, NULL, rdev->ih.ring_size, | 2720 | r = radeon_bo_create(rdev, NULL, rdev->ih.ring_size, |
2721 | true, | 2721 | PAGE_SIZE, true, |
2722 | RADEON_GEM_DOMAIN_GTT, | 2722 | RADEON_GEM_DOMAIN_GTT, |
2723 | &rdev->ih.ring_obj); | 2723 | &rdev->ih.ring_obj); |
2724 | if (r) { | 2724 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 8362974ef41a..86e5aa07f0db 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -501,7 +501,7 @@ int r600_blit_init(struct radeon_device *rdev) | |||
501 | obj_size += r6xx_ps_size * 4; | 501 | obj_size += r6xx_ps_size * 4; |
502 | obj_size = ALIGN(obj_size, 256); | 502 | obj_size = ALIGN(obj_size, 256); |
503 | 503 | ||
504 | r = radeon_bo_create(rdev, NULL, obj_size, true, RADEON_GEM_DOMAIN_VRAM, | 504 | r = radeon_bo_create(rdev, NULL, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
505 | &rdev->r600_blit.shader_obj); | 505 | &rdev->r600_blit.shader_obj); |
506 | if (r) { | 506 | if (r) { |
507 | DRM_ERROR("r600 failed to allocate shader\n"); | 507 | DRM_ERROR("r600 failed to allocate shader\n"); |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 37cc2aa9f923..9bebac1ec006 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -50,6 +50,7 @@ struct r600_cs_track { | |||
50 | u32 nsamples; | 50 | u32 nsamples; |
51 | u32 cb_color_base_last[8]; | 51 | u32 cb_color_base_last[8]; |
52 | struct radeon_bo *cb_color_bo[8]; | 52 | struct radeon_bo *cb_color_bo[8]; |
53 | u64 cb_color_bo_mc[8]; | ||
53 | u32 cb_color_bo_offset[8]; | 54 | u32 cb_color_bo_offset[8]; |
54 | struct radeon_bo *cb_color_frag_bo[8]; | 55 | struct radeon_bo *cb_color_frag_bo[8]; |
55 | struct radeon_bo *cb_color_tile_bo[8]; | 56 | struct radeon_bo *cb_color_tile_bo[8]; |
@@ -67,6 +68,7 @@ struct r600_cs_track { | |||
67 | u32 db_depth_size; | 68 | u32 db_depth_size; |
68 | u32 db_offset; | 69 | u32 db_offset; |
69 | struct radeon_bo *db_bo; | 70 | struct radeon_bo *db_bo; |
71 | u64 db_bo_mc; | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | static inline int r600_bpe_from_format(u32 *bpe, u32 format) | 74 | static inline int r600_bpe_from_format(u32 *bpe, u32 format) |
@@ -140,6 +142,68 @@ static inline int r600_bpe_from_format(u32 *bpe, u32 format) | |||
140 | return 0; | 142 | return 0; |
141 | } | 143 | } |
142 | 144 | ||
145 | struct array_mode_checker { | ||
146 | int array_mode; | ||
147 | u32 group_size; | ||
148 | u32 nbanks; | ||
149 | u32 npipes; | ||
150 | u32 nsamples; | ||
151 | u32 bpe; | ||
152 | }; | ||
153 | |||
154 | /* returns alignment in pixels for pitch/height/depth and bytes for base */ | ||
155 | static inline int r600_get_array_mode_alignment(struct array_mode_checker *values, | ||
156 | u32 *pitch_align, | ||
157 | u32 *height_align, | ||
158 | u32 *depth_align, | ||
159 | u64 *base_align) | ||
160 | { | ||
161 | u32 tile_width = 8; | ||
162 | u32 tile_height = 8; | ||
163 | u32 macro_tile_width = values->nbanks; | ||
164 | u32 macro_tile_height = values->npipes; | ||
165 | u32 tile_bytes = tile_width * tile_height * values->bpe * values->nsamples; | ||
166 | u32 macro_tile_bytes = macro_tile_width * macro_tile_height * tile_bytes; | ||
167 | |||
168 | switch (values->array_mode) { | ||
169 | case ARRAY_LINEAR_GENERAL: | ||
170 | /* technically tile_width/_height for pitch/height */ | ||
171 | *pitch_align = 1; /* tile_width */ | ||
172 | *height_align = 1; /* tile_height */ | ||
173 | *depth_align = 1; | ||
174 | *base_align = 1; | ||
175 | break; | ||
176 | case ARRAY_LINEAR_ALIGNED: | ||
177 | *pitch_align = max((u32)64, (u32)(values->group_size / values->bpe)); | ||
178 | *height_align = tile_height; | ||
179 | *depth_align = 1; | ||
180 | *base_align = values->group_size; | ||
181 | break; | ||
182 | case ARRAY_1D_TILED_THIN1: | ||
183 | *pitch_align = max((u32)tile_width, | ||
184 | (u32)(values->group_size / | ||
185 | (tile_height * values->bpe * values->nsamples))); | ||
186 | *height_align = tile_height; | ||
187 | *depth_align = 1; | ||
188 | *base_align = values->group_size; | ||
189 | break; | ||
190 | case ARRAY_2D_TILED_THIN1: | ||
191 | *pitch_align = max((u32)macro_tile_width, | ||
192 | (u32)(((values->group_size / tile_height) / | ||
193 | (values->bpe * values->nsamples)) * | ||
194 | values->nbanks)) * tile_width; | ||
195 | *height_align = macro_tile_height * tile_height; | ||
196 | *depth_align = 1; | ||
197 | *base_align = max(macro_tile_bytes, | ||
198 | (*pitch_align) * values->bpe * (*height_align) * values->nsamples); | ||
199 | break; | ||
200 | default: | ||
201 | return -EINVAL; | ||
202 | } | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
143 | static void r600_cs_track_init(struct r600_cs_track *track) | 207 | static void r600_cs_track_init(struct r600_cs_track *track) |
144 | { | 208 | { |
145 | int i; | 209 | int i; |
@@ -153,10 +217,12 @@ static void r600_cs_track_init(struct r600_cs_track *track) | |||
153 | track->cb_color_info[i] = 0; | 217 | track->cb_color_info[i] = 0; |
154 | track->cb_color_bo[i] = NULL; | 218 | track->cb_color_bo[i] = NULL; |
155 | track->cb_color_bo_offset[i] = 0xFFFFFFFF; | 219 | track->cb_color_bo_offset[i] = 0xFFFFFFFF; |
220 | track->cb_color_bo_mc[i] = 0xFFFFFFFF; | ||
156 | } | 221 | } |
157 | track->cb_target_mask = 0xFFFFFFFF; | 222 | track->cb_target_mask = 0xFFFFFFFF; |
158 | track->cb_shader_mask = 0xFFFFFFFF; | 223 | track->cb_shader_mask = 0xFFFFFFFF; |
159 | track->db_bo = NULL; | 224 | track->db_bo = NULL; |
225 | track->db_bo_mc = 0xFFFFFFFF; | ||
160 | /* assume the biggest format and that htile is enabled */ | 226 | /* assume the biggest format and that htile is enabled */ |
161 | track->db_depth_info = 7 | (1 << 25); | 227 | track->db_depth_info = 7 | (1 << 25); |
162 | track->db_depth_view = 0xFFFFC000; | 228 | track->db_depth_view = 0xFFFFC000; |
@@ -168,7 +234,10 @@ static void r600_cs_track_init(struct r600_cs_track *track) | |||
168 | static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | 234 | static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) |
169 | { | 235 | { |
170 | struct r600_cs_track *track = p->track; | 236 | struct r600_cs_track *track = p->track; |
171 | u32 bpe = 0, pitch, slice_tile_max, size, tmp, height, pitch_align; | 237 | u32 bpe = 0, slice_tile_max, size, tmp; |
238 | u32 height, height_align, pitch, pitch_align, depth_align; | ||
239 | u64 base_offset, base_align; | ||
240 | struct array_mode_checker array_check; | ||
172 | volatile u32 *ib = p->ib->ptr; | 241 | volatile u32 *ib = p->ib->ptr; |
173 | unsigned array_mode; | 242 | unsigned array_mode; |
174 | 243 | ||
@@ -183,60 +252,40 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
183 | i, track->cb_color_info[i]); | 252 | i, track->cb_color_info[i]); |
184 | return -EINVAL; | 253 | return -EINVAL; |
185 | } | 254 | } |
186 | /* pitch is the number of 8x8 tiles per row */ | 255 | /* pitch in pixels */ |
187 | pitch = G_028060_PITCH_TILE_MAX(track->cb_color_size[i]) + 1; | 256 | pitch = (G_028060_PITCH_TILE_MAX(track->cb_color_size[i]) + 1) * 8; |
188 | slice_tile_max = G_028060_SLICE_TILE_MAX(track->cb_color_size[i]) + 1; | 257 | slice_tile_max = G_028060_SLICE_TILE_MAX(track->cb_color_size[i]) + 1; |
189 | slice_tile_max *= 64; | 258 | slice_tile_max *= 64; |
190 | height = slice_tile_max / (pitch * 8); | 259 | height = slice_tile_max / pitch; |
191 | if (height > 8192) | 260 | if (height > 8192) |
192 | height = 8192; | 261 | height = 8192; |
193 | array_mode = G_0280A0_ARRAY_MODE(track->cb_color_info[i]); | 262 | array_mode = G_0280A0_ARRAY_MODE(track->cb_color_info[i]); |
263 | |||
264 | base_offset = track->cb_color_bo_mc[i] + track->cb_color_bo_offset[i]; | ||
265 | array_check.array_mode = array_mode; | ||
266 | array_check.group_size = track->group_size; | ||
267 | array_check.nbanks = track->nbanks; | ||
268 | array_check.npipes = track->npipes; | ||
269 | array_check.nsamples = track->nsamples; | ||
270 | array_check.bpe = bpe; | ||
271 | if (r600_get_array_mode_alignment(&array_check, | ||
272 | &pitch_align, &height_align, &depth_align, &base_align)) { | ||
273 | dev_warn(p->dev, "%s invalid tiling %d for %d (0x%08X)\n", __func__, | ||
274 | G_0280A0_ARRAY_MODE(track->cb_color_info[i]), i, | ||
275 | track->cb_color_info[i]); | ||
276 | return -EINVAL; | ||
277 | } | ||
194 | switch (array_mode) { | 278 | switch (array_mode) { |
195 | case V_0280A0_ARRAY_LINEAR_GENERAL: | 279 | case V_0280A0_ARRAY_LINEAR_GENERAL: |
196 | /* technically height & 0x7 */ | ||
197 | break; | 280 | break; |
198 | case V_0280A0_ARRAY_LINEAR_ALIGNED: | 281 | case V_0280A0_ARRAY_LINEAR_ALIGNED: |
199 | pitch_align = max((u32)64, (u32)(track->group_size / bpe)) / 8; | ||
200 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
201 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
202 | __func__, __LINE__, pitch); | ||
203 | return -EINVAL; | ||
204 | } | ||
205 | if (!IS_ALIGNED(height, 8)) { | ||
206 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
207 | __func__, __LINE__, height); | ||
208 | return -EINVAL; | ||
209 | } | ||
210 | break; | 282 | break; |
211 | case V_0280A0_ARRAY_1D_TILED_THIN1: | 283 | case V_0280A0_ARRAY_1D_TILED_THIN1: |
212 | pitch_align = max((u32)8, (u32)(track->group_size / (8 * bpe * track->nsamples))) / 8; | ||
213 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
214 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
215 | __func__, __LINE__, pitch); | ||
216 | return -EINVAL; | ||
217 | } | ||
218 | /* avoid breaking userspace */ | 284 | /* avoid breaking userspace */ |
219 | if (height > 7) | 285 | if (height > 7) |
220 | height &= ~0x7; | 286 | height &= ~0x7; |
221 | if (!IS_ALIGNED(height, 8)) { | ||
222 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
223 | __func__, __LINE__, height); | ||
224 | return -EINVAL; | ||
225 | } | ||
226 | break; | 287 | break; |
227 | case V_0280A0_ARRAY_2D_TILED_THIN1: | 288 | case V_0280A0_ARRAY_2D_TILED_THIN1: |
228 | pitch_align = max((u32)track->nbanks, | ||
229 | (u32)(((track->group_size / 8) / (bpe * track->nsamples)) * track->nbanks)) / 8; | ||
230 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
231 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
232 | __func__, __LINE__, pitch); | ||
233 | return -EINVAL; | ||
234 | } | ||
235 | if (!IS_ALIGNED((height / 8), track->npipes)) { | ||
236 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
237 | __func__, __LINE__, height); | ||
238 | return -EINVAL; | ||
239 | } | ||
240 | break; | 289 | break; |
241 | default: | 290 | default: |
242 | dev_warn(p->dev, "%s invalid tiling %d for %d (0x%08X)\n", __func__, | 291 | dev_warn(p->dev, "%s invalid tiling %d for %d (0x%08X)\n", __func__, |
@@ -244,13 +293,29 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
244 | track->cb_color_info[i]); | 293 | track->cb_color_info[i]); |
245 | return -EINVAL; | 294 | return -EINVAL; |
246 | } | 295 | } |
296 | |||
297 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
298 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
299 | __func__, __LINE__, pitch); | ||
300 | return -EINVAL; | ||
301 | } | ||
302 | if (!IS_ALIGNED(height, height_align)) { | ||
303 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
304 | __func__, __LINE__, height); | ||
305 | return -EINVAL; | ||
306 | } | ||
307 | if (!IS_ALIGNED(base_offset, base_align)) { | ||
308 | dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset); | ||
309 | return -EINVAL; | ||
310 | } | ||
311 | |||
247 | /* check offset */ | 312 | /* check offset */ |
248 | tmp = height * pitch * 8 * bpe; | 313 | tmp = height * pitch * bpe; |
249 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { | 314 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { |
250 | if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { | 315 | if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { |
251 | /* the initial DDX does bad things with the CB size occasionally */ | 316 | /* the initial DDX does bad things with the CB size occasionally */ |
252 | /* it rounds up height too far for slice tile max but the BO is smaller */ | 317 | /* it rounds up height too far for slice tile max but the BO is smaller */ |
253 | tmp = (height - 7) * 8 * bpe; | 318 | tmp = (height - 7) * pitch * bpe; |
254 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { | 319 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { |
255 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); | 320 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); |
256 | return -EINVAL; | 321 | return -EINVAL; |
@@ -260,15 +325,11 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
260 | return -EINVAL; | 325 | return -EINVAL; |
261 | } | 326 | } |
262 | } | 327 | } |
263 | if (!IS_ALIGNED(track->cb_color_bo_offset[i], track->group_size)) { | ||
264 | dev_warn(p->dev, "%s offset[%d] %d not aligned\n", __func__, i, track->cb_color_bo_offset[i]); | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | /* limit max tile */ | 328 | /* limit max tile */ |
268 | tmp = (height * pitch * 8) >> 6; | 329 | tmp = (height * pitch) >> 6; |
269 | if (tmp < slice_tile_max) | 330 | if (tmp < slice_tile_max) |
270 | slice_tile_max = tmp; | 331 | slice_tile_max = tmp; |
271 | tmp = S_028060_PITCH_TILE_MAX(pitch - 1) | | 332 | tmp = S_028060_PITCH_TILE_MAX((pitch / 8) - 1) | |
272 | S_028060_SLICE_TILE_MAX(slice_tile_max - 1); | 333 | S_028060_SLICE_TILE_MAX(slice_tile_max - 1); |
273 | ib[track->cb_color_size_idx[i]] = tmp; | 334 | ib[track->cb_color_size_idx[i]] = tmp; |
274 | return 0; | 335 | return 0; |
@@ -310,7 +371,12 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
310 | /* Check depth buffer */ | 371 | /* Check depth buffer */ |
311 | if (G_028800_STENCIL_ENABLE(track->db_depth_control) || | 372 | if (G_028800_STENCIL_ENABLE(track->db_depth_control) || |
312 | G_028800_Z_ENABLE(track->db_depth_control)) { | 373 | G_028800_Z_ENABLE(track->db_depth_control)) { |
313 | u32 nviews, bpe, ntiles, pitch, pitch_align, height, size, slice_tile_max; | 374 | u32 nviews, bpe, ntiles, size, slice_tile_max; |
375 | u32 height, height_align, pitch, pitch_align, depth_align; | ||
376 | u64 base_offset, base_align; | ||
377 | struct array_mode_checker array_check; | ||
378 | int array_mode; | ||
379 | |||
314 | if (track->db_bo == NULL) { | 380 | if (track->db_bo == NULL) { |
315 | dev_warn(p->dev, "z/stencil with no depth buffer\n"); | 381 | dev_warn(p->dev, "z/stencil with no depth buffer\n"); |
316 | return -EINVAL; | 382 | return -EINVAL; |
@@ -353,41 +419,34 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
353 | ib[track->db_depth_size_idx] = S_028000_SLICE_TILE_MAX(tmp - 1) | (track->db_depth_size & 0x3FF); | 419 | ib[track->db_depth_size_idx] = S_028000_SLICE_TILE_MAX(tmp - 1) | (track->db_depth_size & 0x3FF); |
354 | } else { | 420 | } else { |
355 | size = radeon_bo_size(track->db_bo); | 421 | size = radeon_bo_size(track->db_bo); |
356 | pitch = G_028000_PITCH_TILE_MAX(track->db_depth_size) + 1; | 422 | /* pitch in pixels */ |
423 | pitch = (G_028000_PITCH_TILE_MAX(track->db_depth_size) + 1) * 8; | ||
357 | slice_tile_max = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; | 424 | slice_tile_max = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; |
358 | slice_tile_max *= 64; | 425 | slice_tile_max *= 64; |
359 | height = slice_tile_max / (pitch * 8); | 426 | height = slice_tile_max / pitch; |
360 | if (height > 8192) | 427 | if (height > 8192) |
361 | height = 8192; | 428 | height = 8192; |
362 | switch (G_028010_ARRAY_MODE(track->db_depth_info)) { | 429 | base_offset = track->db_bo_mc + track->db_offset; |
430 | array_mode = G_028010_ARRAY_MODE(track->db_depth_info); | ||
431 | array_check.array_mode = array_mode; | ||
432 | array_check.group_size = track->group_size; | ||
433 | array_check.nbanks = track->nbanks; | ||
434 | array_check.npipes = track->npipes; | ||
435 | array_check.nsamples = track->nsamples; | ||
436 | array_check.bpe = bpe; | ||
437 | if (r600_get_array_mode_alignment(&array_check, | ||
438 | &pitch_align, &height_align, &depth_align, &base_align)) { | ||
439 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, | ||
440 | G_028010_ARRAY_MODE(track->db_depth_info), | ||
441 | track->db_depth_info); | ||
442 | return -EINVAL; | ||
443 | } | ||
444 | switch (array_mode) { | ||
363 | case V_028010_ARRAY_1D_TILED_THIN1: | 445 | case V_028010_ARRAY_1D_TILED_THIN1: |
364 | pitch_align = (max((u32)8, (u32)(track->group_size / (8 * bpe))) / 8); | ||
365 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
366 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | ||
367 | __func__, __LINE__, pitch); | ||
368 | return -EINVAL; | ||
369 | } | ||
370 | /* don't break userspace */ | 446 | /* don't break userspace */ |
371 | height &= ~0x7; | 447 | height &= ~0x7; |
372 | if (!IS_ALIGNED(height, 8)) { | ||
373 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | ||
374 | __func__, __LINE__, height); | ||
375 | return -EINVAL; | ||
376 | } | ||
377 | break; | 448 | break; |
378 | case V_028010_ARRAY_2D_TILED_THIN1: | 449 | case V_028010_ARRAY_2D_TILED_THIN1: |
379 | pitch_align = max((u32)track->nbanks, | ||
380 | (u32)(((track->group_size / 8) / bpe) * track->nbanks)) / 8; | ||
381 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
382 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | ||
383 | __func__, __LINE__, pitch); | ||
384 | return -EINVAL; | ||
385 | } | ||
386 | if (!IS_ALIGNED((height / 8), track->npipes)) { | ||
387 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | ||
388 | __func__, __LINE__, height); | ||
389 | return -EINVAL; | ||
390 | } | ||
391 | break; | 450 | break; |
392 | default: | 451 | default: |
393 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, | 452 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, |
@@ -395,15 +454,27 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
395 | track->db_depth_info); | 454 | track->db_depth_info); |
396 | return -EINVAL; | 455 | return -EINVAL; |
397 | } | 456 | } |
398 | if (!IS_ALIGNED(track->db_offset, track->group_size)) { | 457 | |
399 | dev_warn(p->dev, "%s offset[%d] %d not aligned\n", __func__, i, track->db_offset); | 458 | if (!IS_ALIGNED(pitch, pitch_align)) { |
459 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | ||
460 | __func__, __LINE__, pitch); | ||
461 | return -EINVAL; | ||
462 | } | ||
463 | if (!IS_ALIGNED(height, height_align)) { | ||
464 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | ||
465 | __func__, __LINE__, height); | ||
400 | return -EINVAL; | 466 | return -EINVAL; |
401 | } | 467 | } |
468 | if (!IS_ALIGNED(base_offset, base_align)) { | ||
469 | dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset); | ||
470 | return -EINVAL; | ||
471 | } | ||
472 | |||
402 | ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; | 473 | ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; |
403 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; | 474 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; |
404 | tmp = ntiles * bpe * 64 * nviews; | 475 | tmp = ntiles * bpe * 64 * nviews; |
405 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { | 476 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { |
406 | dev_warn(p->dev, "z/stencil buffer too small (0x%08X %d %d %d -> %d have %ld)\n", | 477 | dev_warn(p->dev, "z/stencil buffer too small (0x%08X %d %d %d -> %u have %lu)\n", |
407 | track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset, | 478 | track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset, |
408 | radeon_bo_size(track->db_bo)); | 479 | radeon_bo_size(track->db_bo)); |
409 | return -EINVAL; | 480 | return -EINVAL; |
@@ -954,6 +1025,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
954 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1025 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
955 | track->cb_color_base_last[tmp] = ib[idx]; | 1026 | track->cb_color_base_last[tmp] = ib[idx]; |
956 | track->cb_color_bo[tmp] = reloc->robj; | 1027 | track->cb_color_bo[tmp] = reloc->robj; |
1028 | track->cb_color_bo_mc[tmp] = reloc->lobj.gpu_offset; | ||
957 | break; | 1029 | break; |
958 | case DB_DEPTH_BASE: | 1030 | case DB_DEPTH_BASE: |
959 | r = r600_cs_packet_next_reloc(p, &reloc); | 1031 | r = r600_cs_packet_next_reloc(p, &reloc); |
@@ -965,6 +1037,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
965 | track->db_offset = radeon_get_ib_value(p, idx) << 8; | 1037 | track->db_offset = radeon_get_ib_value(p, idx) << 8; |
966 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1038 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
967 | track->db_bo = reloc->robj; | 1039 | track->db_bo = reloc->robj; |
1040 | track->db_bo_mc = reloc->lobj.gpu_offset; | ||
968 | break; | 1041 | break; |
969 | case DB_HTILE_DATA_BASE: | 1042 | case DB_HTILE_DATA_BASE: |
970 | case SQ_PGM_START_FS: | 1043 | case SQ_PGM_START_FS: |
@@ -1086,16 +1159,25 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned nlevels | |||
1086 | static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, | 1159 | static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, |
1087 | struct radeon_bo *texture, | 1160 | struct radeon_bo *texture, |
1088 | struct radeon_bo *mipmap, | 1161 | struct radeon_bo *mipmap, |
1162 | u64 base_offset, | ||
1163 | u64 mip_offset, | ||
1089 | u32 tiling_flags) | 1164 | u32 tiling_flags) |
1090 | { | 1165 | { |
1091 | struct r600_cs_track *track = p->track; | 1166 | struct r600_cs_track *track = p->track; |
1092 | u32 nfaces, nlevels, blevel, w0, h0, d0, bpe = 0; | 1167 | u32 nfaces, nlevels, blevel, w0, h0, d0, bpe = 0; |
1093 | u32 word0, word1, l0_size, mipmap_size, pitch, pitch_align; | 1168 | u32 word0, word1, l0_size, mipmap_size; |
1169 | u32 height_align, pitch, pitch_align, depth_align; | ||
1170 | u64 base_align; | ||
1171 | struct array_mode_checker array_check; | ||
1094 | 1172 | ||
1095 | /* on legacy kernel we don't perform advanced check */ | 1173 | /* on legacy kernel we don't perform advanced check */ |
1096 | if (p->rdev == NULL) | 1174 | if (p->rdev == NULL) |
1097 | return 0; | 1175 | return 0; |
1098 | 1176 | ||
1177 | /* convert to bytes */ | ||
1178 | base_offset <<= 8; | ||
1179 | mip_offset <<= 8; | ||
1180 | |||
1099 | word0 = radeon_get_ib_value(p, idx + 0); | 1181 | word0 = radeon_get_ib_value(p, idx + 0); |
1100 | if (tiling_flags & RADEON_TILING_MACRO) | 1182 | if (tiling_flags & RADEON_TILING_MACRO) |
1101 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); | 1183 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); |
@@ -1128,46 +1210,38 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i | |||
1128 | return -EINVAL; | 1210 | return -EINVAL; |
1129 | } | 1211 | } |
1130 | 1212 | ||
1131 | pitch = G_038000_PITCH(word0) + 1; | 1213 | /* pitch in texels */ |
1132 | switch (G_038000_TILE_MODE(word0)) { | 1214 | pitch = (G_038000_PITCH(word0) + 1) * 8; |
1133 | case V_038000_ARRAY_LINEAR_GENERAL: | 1215 | array_check.array_mode = G_038000_TILE_MODE(word0); |
1134 | pitch_align = 1; | 1216 | array_check.group_size = track->group_size; |
1135 | /* XXX check height align */ | 1217 | array_check.nbanks = track->nbanks; |
1136 | break; | 1218 | array_check.npipes = track->npipes; |
1137 | case V_038000_ARRAY_LINEAR_ALIGNED: | 1219 | array_check.nsamples = 1; |
1138 | pitch_align = max((u32)64, (u32)(track->group_size / bpe)) / 8; | 1220 | array_check.bpe = bpe; |
1139 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1221 | if (r600_get_array_mode_alignment(&array_check, |
1140 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1222 | &pitch_align, &height_align, &depth_align, &base_align)) { |
1141 | __func__, __LINE__, pitch); | 1223 | dev_warn(p->dev, "%s:%d tex array mode (%d) invalid\n", |
1142 | return -EINVAL; | 1224 | __func__, __LINE__, G_038000_TILE_MODE(word0)); |
1143 | } | 1225 | return -EINVAL; |
1144 | /* XXX check height align */ | 1226 | } |
1145 | break; | 1227 | |
1146 | case V_038000_ARRAY_1D_TILED_THIN1: | 1228 | /* XXX check height as well... */ |
1147 | pitch_align = max((u32)8, (u32)(track->group_size / (8 * bpe))) / 8; | 1229 | |
1148 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1230 | if (!IS_ALIGNED(pitch, pitch_align)) { |
1149 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1231 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", |
1150 | __func__, __LINE__, pitch); | 1232 | __func__, __LINE__, pitch); |
1151 | return -EINVAL; | 1233 | return -EINVAL; |
1152 | } | 1234 | } |
1153 | /* XXX check height align */ | 1235 | if (!IS_ALIGNED(base_offset, base_align)) { |
1154 | break; | 1236 | dev_warn(p->dev, "%s:%d tex base offset (0x%llx) invalid\n", |
1155 | case V_038000_ARRAY_2D_TILED_THIN1: | 1237 | __func__, __LINE__, base_offset); |
1156 | pitch_align = max((u32)track->nbanks, | 1238 | return -EINVAL; |
1157 | (u32)(((track->group_size / 8) / bpe) * track->nbanks)) / 8; | 1239 | } |
1158 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1240 | if (!IS_ALIGNED(mip_offset, base_align)) { |
1159 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1241 | dev_warn(p->dev, "%s:%d tex mip offset (0x%llx) invalid\n", |
1160 | __func__, __LINE__, pitch); | 1242 | __func__, __LINE__, mip_offset); |
1161 | return -EINVAL; | ||
1162 | } | ||
1163 | /* XXX check height align */ | ||
1164 | break; | ||
1165 | default: | ||
1166 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, | ||
1167 | G_038000_TILE_MODE(word0), word0); | ||
1168 | return -EINVAL; | 1243 | return -EINVAL; |
1169 | } | 1244 | } |
1170 | /* XXX check offset align */ | ||
1171 | 1245 | ||
1172 | word0 = radeon_get_ib_value(p, idx + 4); | 1246 | word0 = radeon_get_ib_value(p, idx + 4); |
1173 | word1 = radeon_get_ib_value(p, idx + 5); | 1247 | word1 = radeon_get_ib_value(p, idx + 5); |
@@ -1402,7 +1476,10 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1402 | mip_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1476 | mip_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
1403 | mipmap = reloc->robj; | 1477 | mipmap = reloc->robj; |
1404 | r = r600_check_texture_resource(p, idx+(i*7)+1, | 1478 | r = r600_check_texture_resource(p, idx+(i*7)+1, |
1405 | texture, mipmap, reloc->lobj.tiling_flags); | 1479 | texture, mipmap, |
1480 | base_offset + radeon_get_ib_value(p, idx+1+(i*7)+2), | ||
1481 | mip_offset + radeon_get_ib_value(p, idx+1+(i*7)+3), | ||
1482 | reloc->lobj.tiling_flags); | ||
1406 | if (r) | 1483 | if (r) |
1407 | return r; | 1484 | return r; |
1408 | ib[idx+1+(i*7)+2] += base_offset; | 1485 | ib[idx+1+(i*7)+2] += base_offset; |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 966a793e225b..bff4dc4f410f 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -51,6 +51,12 @@ | |||
51 | #define PTE_READABLE (1 << 5) | 51 | #define PTE_READABLE (1 << 5) |
52 | #define PTE_WRITEABLE (1 << 6) | 52 | #define PTE_WRITEABLE (1 << 6) |
53 | 53 | ||
54 | /* tiling bits */ | ||
55 | #define ARRAY_LINEAR_GENERAL 0x00000000 | ||
56 | #define ARRAY_LINEAR_ALIGNED 0x00000001 | ||
57 | #define ARRAY_1D_TILED_THIN1 0x00000002 | ||
58 | #define ARRAY_2D_TILED_THIN1 0x00000004 | ||
59 | |||
54 | /* Registers */ | 60 | /* Registers */ |
55 | #define ARB_POP 0x2418 | 61 | #define ARB_POP 0x2418 |
56 | #define ENABLE_TC128 (1 << 30) | 62 | #define ENABLE_TC128 (1 << 30) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 73f600d39ad4..3a7095743d44 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1262,6 +1262,10 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); | |||
1262 | (rdev->family == CHIP_RS400) || \ | 1262 | (rdev->family == CHIP_RS400) || \ |
1263 | (rdev->family == CHIP_RS480)) | 1263 | (rdev->family == CHIP_RS480)) |
1264 | #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) | 1264 | #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) |
1265 | #define ASIC_IS_DCE2(rdev) ((rdev->family == CHIP_RS600) || \ | ||
1266 | (rdev->family == CHIP_RS690) || \ | ||
1267 | (rdev->family == CHIP_RS740) || \ | ||
1268 | (rdev->family >= CHIP_R600)) | ||
1265 | #define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620)) | 1269 | #define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620)) |
1266 | #define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730)) | 1270 | #define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730)) |
1267 | #define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR)) | 1271 | #define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR)) |
diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index 7932dc4d6b90..c558685cc637 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c | |||
@@ -41,7 +41,7 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize, | |||
41 | 41 | ||
42 | size = bsize; | 42 | size = bsize; |
43 | n = 1024; | 43 | n = 1024; |
44 | r = radeon_bo_create(rdev, NULL, size, true, sdomain, &sobj); | 44 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, sdomain, &sobj); |
45 | if (r) { | 45 | if (r) { |
46 | goto out_cleanup; | 46 | goto out_cleanup; |
47 | } | 47 | } |
@@ -53,7 +53,7 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize, | |||
53 | if (r) { | 53 | if (r) { |
54 | goto out_cleanup; | 54 | goto out_cleanup; |
55 | } | 55 | } |
56 | r = radeon_bo_create(rdev, NULL, size, true, ddomain, &dobj); | 56 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, ddomain, &dobj); |
57 | if (r) { | 57 | if (r) { |
58 | goto out_cleanup; | 58 | goto out_cleanup; |
59 | } | 59 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 7b7ea269549c..3bddea5b5295 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
571 | } | 571 | } |
572 | 572 | ||
573 | if (clk_mask && data_mask) { | 573 | if (clk_mask && data_mask) { |
574 | /* system specific masks */ | ||
574 | i2c.mask_clk_mask = clk_mask; | 575 | i2c.mask_clk_mask = clk_mask; |
575 | i2c.mask_data_mask = data_mask; | 576 | i2c.mask_data_mask = data_mask; |
576 | i2c.a_clk_mask = clk_mask; | 577 | i2c.a_clk_mask = clk_mask; |
@@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
579 | i2c.en_data_mask = data_mask; | 580 | i2c.en_data_mask = data_mask; |
580 | i2c.y_clk_mask = clk_mask; | 581 | i2c.y_clk_mask = clk_mask; |
581 | i2c.y_data_mask = data_mask; | 582 | i2c.y_data_mask = data_mask; |
583 | } else if ((ddc_line == RADEON_GPIOPAD_MASK) || | ||
584 | (ddc_line == RADEON_MDGPIO_MASK)) { | ||
585 | /* default gpiopad masks */ | ||
586 | i2c.mask_clk_mask = (0x20 << 8); | ||
587 | i2c.mask_data_mask = 0x80; | ||
588 | i2c.a_clk_mask = (0x20 << 8); | ||
589 | i2c.a_data_mask = 0x80; | ||
590 | i2c.en_clk_mask = (0x20 << 8); | ||
591 | i2c.en_data_mask = 0x80; | ||
592 | i2c.y_clk_mask = (0x20 << 8); | ||
593 | i2c.y_data_mask = 0x80; | ||
582 | } else { | 594 | } else { |
595 | /* default masks for ddc pads */ | ||
583 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | 596 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; |
584 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | 597 | i2c.mask_data_mask = RADEON_GPIO_EN_0; |
585 | i2c.a_clk_mask = RADEON_GPIO_A_1; | 598 | i2c.a_clk_mask = RADEON_GPIO_A_1; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index fe6c74780f18..3bef9f6d66fd 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1008,9 +1008,21 @@ static void radeon_dp_connector_destroy(struct drm_connector *connector) | |||
1008 | static int radeon_dp_get_modes(struct drm_connector *connector) | 1008 | static int radeon_dp_get_modes(struct drm_connector *connector) |
1009 | { | 1009 | { |
1010 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1010 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1011 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | ||
1011 | int ret; | 1012 | int ret; |
1012 | 1013 | ||
1014 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
1015 | if (!radeon_dig_connector->edp_on) | ||
1016 | atombios_set_edp_panel_power(connector, | ||
1017 | ATOM_TRANSMITTER_ACTION_POWER_ON); | ||
1018 | } | ||
1013 | ret = radeon_ddc_get_modes(radeon_connector); | 1019 | ret = radeon_ddc_get_modes(radeon_connector); |
1020 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
1021 | if (!radeon_dig_connector->edp_on) | ||
1022 | atombios_set_edp_panel_power(connector, | ||
1023 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
1024 | } | ||
1025 | |||
1014 | return ret; | 1026 | return ret; |
1015 | } | 1027 | } |
1016 | 1028 | ||
@@ -1029,8 +1041,14 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1029 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1041 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
1030 | /* eDP is always DP */ | 1042 | /* eDP is always DP */ |
1031 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; | 1043 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; |
1044 | if (!radeon_dig_connector->edp_on) | ||
1045 | atombios_set_edp_panel_power(connector, | ||
1046 | ATOM_TRANSMITTER_ACTION_POWER_ON); | ||
1032 | if (radeon_dp_getdpcd(radeon_connector)) | 1047 | if (radeon_dp_getdpcd(radeon_connector)) |
1033 | ret = connector_status_connected; | 1048 | ret = connector_status_connected; |
1049 | if (!radeon_dig_connector->edp_on) | ||
1050 | atombios_set_edp_panel_power(connector, | ||
1051 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
1034 | } else { | 1052 | } else { |
1035 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); | 1053 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); |
1036 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { | 1054 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 8adfedfe547f..d8ac1849180d 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -180,7 +180,7 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
180 | int r; | 180 | int r; |
181 | 181 | ||
182 | if (rdev->wb.wb_obj == NULL) { | 182 | if (rdev->wb.wb_obj == NULL) { |
183 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, true, | 183 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true, |
184 | RADEON_GEM_DOMAIN_GTT, &rdev->wb.wb_obj); | 184 | RADEON_GEM_DOMAIN_GTT, &rdev->wb.wb_obj); |
185 | if (r) { | 185 | if (r) { |
186 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); | 186 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index f678257c42e6..041943df966b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -176,6 +176,7 @@ static inline bool radeon_encoder_is_digital(struct drm_encoder *encoder) | |||
176 | return false; | 176 | return false; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | |||
179 | void | 180 | void |
180 | radeon_link_encoder_connector(struct drm_device *dev) | 181 | radeon_link_encoder_connector(struct drm_device *dev) |
181 | { | 182 | { |
@@ -228,6 +229,27 @@ radeon_get_connector_for_encoder(struct drm_encoder *encoder) | |||
228 | return NULL; | 229 | return NULL; |
229 | } | 230 | } |
230 | 231 | ||
232 | struct drm_encoder *radeon_atom_get_external_encoder(struct drm_encoder *encoder) | ||
233 | { | ||
234 | struct drm_device *dev = encoder->dev; | ||
235 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
236 | struct drm_encoder *other_encoder; | ||
237 | struct radeon_encoder *other_radeon_encoder; | ||
238 | |||
239 | if (radeon_encoder->is_ext_encoder) | ||
240 | return NULL; | ||
241 | |||
242 | list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) { | ||
243 | if (other_encoder == encoder) | ||
244 | continue; | ||
245 | other_radeon_encoder = to_radeon_encoder(other_encoder); | ||
246 | if (other_radeon_encoder->is_ext_encoder && | ||
247 | (radeon_encoder->devices & other_radeon_encoder->devices)) | ||
248 | return other_encoder; | ||
249 | } | ||
250 | return NULL; | ||
251 | } | ||
252 | |||
231 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, | 253 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, |
232 | struct drm_display_mode *adjusted_mode) | 254 | struct drm_display_mode *adjusted_mode) |
233 | { | 255 | { |
@@ -426,52 +448,49 @@ atombios_tv_setup(struct drm_encoder *encoder, int action) | |||
426 | 448 | ||
427 | } | 449 | } |
428 | 450 | ||
429 | void | 451 | union dvo_encoder_control { |
430 | atombios_external_tmds_setup(struct drm_encoder *encoder, int action) | 452 | ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION ext_tmds; |
431 | { | 453 | DVO_ENCODER_CONTROL_PS_ALLOCATION dvo; |
432 | struct drm_device *dev = encoder->dev; | 454 | DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 dvo_v3; |
433 | struct radeon_device *rdev = dev->dev_private; | 455 | }; |
434 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
435 | ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION args; | ||
436 | int index = 0; | ||
437 | |||
438 | memset(&args, 0, sizeof(args)); | ||
439 | |||
440 | index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl); | ||
441 | |||
442 | args.sXTmdsEncoder.ucEnable = action; | ||
443 | |||
444 | if (radeon_encoder->pixel_clock > 165000) | ||
445 | args.sXTmdsEncoder.ucMisc = PANEL_ENCODER_MISC_DUAL; | ||
446 | |||
447 | /*if (pScrn->rgbBits == 8)*/ | ||
448 | args.sXTmdsEncoder.ucMisc |= (1 << 1); | ||
449 | |||
450 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
451 | |||
452 | } | ||
453 | 456 | ||
454 | static void | 457 | void |
455 | atombios_ddia_setup(struct drm_encoder *encoder, int action) | 458 | atombios_dvo_setup(struct drm_encoder *encoder, int action) |
456 | { | 459 | { |
457 | struct drm_device *dev = encoder->dev; | 460 | struct drm_device *dev = encoder->dev; |
458 | struct radeon_device *rdev = dev->dev_private; | 461 | struct radeon_device *rdev = dev->dev_private; |
459 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 462 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
460 | DVO_ENCODER_CONTROL_PS_ALLOCATION args; | 463 | union dvo_encoder_control args; |
461 | int index = 0; | 464 | int index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl); |
462 | 465 | ||
463 | memset(&args, 0, sizeof(args)); | 466 | memset(&args, 0, sizeof(args)); |
464 | 467 | ||
465 | index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl); | 468 | if (ASIC_IS_DCE3(rdev)) { |
469 | /* DCE3+ */ | ||
470 | args.dvo_v3.ucAction = action; | ||
471 | args.dvo_v3.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
472 | args.dvo_v3.ucDVOConfig = 0; /* XXX */ | ||
473 | } else if (ASIC_IS_DCE2(rdev)) { | ||
474 | /* DCE2 (pre-DCE3 R6xx, RS600/690/740 */ | ||
475 | args.dvo.sDVOEncoder.ucAction = action; | ||
476 | args.dvo.sDVOEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
477 | /* DFP1, CRT1, TV1 depending on the type of port */ | ||
478 | args.dvo.sDVOEncoder.ucDeviceType = ATOM_DEVICE_DFP1_INDEX; | ||
479 | |||
480 | if (radeon_encoder->pixel_clock > 165000) | ||
481 | args.dvo.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute |= PANEL_ENCODER_MISC_DUAL; | ||
482 | } else { | ||
483 | /* R4xx, R5xx */ | ||
484 | args.ext_tmds.sXTmdsEncoder.ucEnable = action; | ||
466 | 485 | ||
467 | args.sDVOEncoder.ucAction = action; | 486 | if (radeon_encoder->pixel_clock > 165000) |
468 | args.sDVOEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | 487 | args.ext_tmds.sXTmdsEncoder.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
469 | 488 | ||
470 | if (radeon_encoder->pixel_clock > 165000) | 489 | /*if (pScrn->rgbBits == 8)*/ |
471 | args.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute = PANEL_ENCODER_MISC_DUAL; | 490 | args.ext_tmds.sXTmdsEncoder.ucMisc |= ATOM_PANEL_MISC_888RGB; |
491 | } | ||
472 | 492 | ||
473 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 493 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
474 | |||
475 | } | 494 | } |
476 | 495 | ||
477 | union lvds_encoder_control { | 496 | union lvds_encoder_control { |
@@ -532,14 +551,14 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
532 | if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) | 551 | if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) |
533 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; | 552 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
534 | if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) | 553 | if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) |
535 | args.v1.ucMisc |= (1 << 1); | 554 | args.v1.ucMisc |= ATOM_PANEL_MISC_888RGB; |
536 | } else { | 555 | } else { |
537 | if (dig->linkb) | 556 | if (dig->linkb) |
538 | args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; | 557 | args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; |
539 | if (radeon_encoder->pixel_clock > 165000) | 558 | if (radeon_encoder->pixel_clock > 165000) |
540 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; | 559 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
541 | /*if (pScrn->rgbBits == 8) */ | 560 | /*if (pScrn->rgbBits == 8) */ |
542 | args.v1.ucMisc |= (1 << 1); | 561 | args.v1.ucMisc |= ATOM_PANEL_MISC_888RGB; |
543 | } | 562 | } |
544 | break; | 563 | break; |
545 | case 2: | 564 | case 2: |
@@ -595,6 +614,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
595 | int | 614 | int |
596 | atombios_get_encoder_mode(struct drm_encoder *encoder) | 615 | atombios_get_encoder_mode(struct drm_encoder *encoder) |
597 | { | 616 | { |
617 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
598 | struct drm_device *dev = encoder->dev; | 618 | struct drm_device *dev = encoder->dev; |
599 | struct radeon_device *rdev = dev->dev_private; | 619 | struct radeon_device *rdev = dev->dev_private; |
600 | struct drm_connector *connector; | 620 | struct drm_connector *connector; |
@@ -602,9 +622,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
602 | struct radeon_connector_atom_dig *dig_connector; | 622 | struct radeon_connector_atom_dig *dig_connector; |
603 | 623 | ||
604 | connector = radeon_get_connector_for_encoder(encoder); | 624 | connector = radeon_get_connector_for_encoder(encoder); |
605 | if (!connector) | 625 | if (!connector) { |
606 | return 0; | 626 | switch (radeon_encoder->encoder_id) { |
607 | 627 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | |
628 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | ||
629 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | ||
630 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | ||
631 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
632 | return ATOM_ENCODER_MODE_DVI; | ||
633 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | ||
634 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | ||
635 | default: | ||
636 | return ATOM_ENCODER_MODE_CRT; | ||
637 | } | ||
638 | } | ||
608 | radeon_connector = to_radeon_connector(connector); | 639 | radeon_connector = to_radeon_connector(connector); |
609 | 640 | ||
610 | switch (connector->connector_type) { | 641 | switch (connector->connector_type) { |
@@ -834,6 +865,9 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
834 | memset(&args, 0, sizeof(args)); | 865 | memset(&args, 0, sizeof(args)); |
835 | 866 | ||
836 | switch (radeon_encoder->encoder_id) { | 867 | switch (radeon_encoder->encoder_id) { |
868 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
869 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); | ||
870 | break; | ||
837 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | 871 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: |
838 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | 872 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: |
839 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | 873 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: |
@@ -978,6 +1012,105 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
978 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 1012 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
979 | } | 1013 | } |
980 | 1014 | ||
1015 | void | ||
1016 | atombios_set_edp_panel_power(struct drm_connector *connector, int action) | ||
1017 | { | ||
1018 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
1019 | struct drm_device *dev = radeon_connector->base.dev; | ||
1020 | struct radeon_device *rdev = dev->dev_private; | ||
1021 | union dig_transmitter_control args; | ||
1022 | int index = GetIndexIntoMasterTable(COMMAND, UNIPHYTransmitterControl); | ||
1023 | uint8_t frev, crev; | ||
1024 | |||
1025 | if (connector->connector_type != DRM_MODE_CONNECTOR_eDP) | ||
1026 | return; | ||
1027 | |||
1028 | if (!ASIC_IS_DCE4(rdev)) | ||
1029 | return; | ||
1030 | |||
1031 | if ((action != ATOM_TRANSMITTER_ACTION_POWER_ON) || | ||
1032 | (action != ATOM_TRANSMITTER_ACTION_POWER_OFF)) | ||
1033 | return; | ||
1034 | |||
1035 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | ||
1036 | return; | ||
1037 | |||
1038 | memset(&args, 0, sizeof(args)); | ||
1039 | |||
1040 | args.v1.ucAction = action; | ||
1041 | |||
1042 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1043 | } | ||
1044 | |||
1045 | union external_encoder_control { | ||
1046 | EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION v1; | ||
1047 | }; | ||
1048 | |||
1049 | static void | ||
1050 | atombios_external_encoder_setup(struct drm_encoder *encoder, | ||
1051 | struct drm_encoder *ext_encoder, | ||
1052 | int action) | ||
1053 | { | ||
1054 | struct drm_device *dev = encoder->dev; | ||
1055 | struct radeon_device *rdev = dev->dev_private; | ||
1056 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
1057 | union external_encoder_control args; | ||
1058 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
1059 | int index = GetIndexIntoMasterTable(COMMAND, ExternalEncoderControl); | ||
1060 | u8 frev, crev; | ||
1061 | int dp_clock = 0; | ||
1062 | int dp_lane_count = 0; | ||
1063 | int connector_object_id = 0; | ||
1064 | |||
1065 | if (connector) { | ||
1066 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
1067 | struct radeon_connector_atom_dig *dig_connector = | ||
1068 | radeon_connector->con_priv; | ||
1069 | |||
1070 | dp_clock = dig_connector->dp_clock; | ||
1071 | dp_lane_count = dig_connector->dp_lane_count; | ||
1072 | connector_object_id = | ||
1073 | (radeon_connector->connector_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; | ||
1074 | } | ||
1075 | |||
1076 | memset(&args, 0, sizeof(args)); | ||
1077 | |||
1078 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | ||
1079 | return; | ||
1080 | |||
1081 | switch (frev) { | ||
1082 | case 1: | ||
1083 | /* no params on frev 1 */ | ||
1084 | break; | ||
1085 | case 2: | ||
1086 | switch (crev) { | ||
1087 | case 1: | ||
1088 | case 2: | ||
1089 | args.v1.sDigEncoder.ucAction = action; | ||
1090 | args.v1.sDigEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
1091 | args.v1.sDigEncoder.ucEncoderMode = atombios_get_encoder_mode(encoder); | ||
1092 | |||
1093 | if (args.v1.sDigEncoder.ucEncoderMode == ATOM_ENCODER_MODE_DP) { | ||
1094 | if (dp_clock == 270000) | ||
1095 | args.v1.sDigEncoder.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ; | ||
1096 | args.v1.sDigEncoder.ucLaneNum = dp_lane_count; | ||
1097 | } else if (radeon_encoder->pixel_clock > 165000) | ||
1098 | args.v1.sDigEncoder.ucLaneNum = 8; | ||
1099 | else | ||
1100 | args.v1.sDigEncoder.ucLaneNum = 4; | ||
1101 | break; | ||
1102 | default: | ||
1103 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); | ||
1104 | return; | ||
1105 | } | ||
1106 | break; | ||
1107 | default: | ||
1108 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); | ||
1109 | return; | ||
1110 | } | ||
1111 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1112 | } | ||
1113 | |||
981 | static void | 1114 | static void |
982 | atombios_yuv_setup(struct drm_encoder *encoder, bool enable) | 1115 | atombios_yuv_setup(struct drm_encoder *encoder, bool enable) |
983 | { | 1116 | { |
@@ -1021,6 +1154,7 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1021 | struct drm_device *dev = encoder->dev; | 1154 | struct drm_device *dev = encoder->dev; |
1022 | struct radeon_device *rdev = dev->dev_private; | 1155 | struct radeon_device *rdev = dev->dev_private; |
1023 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1156 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1157 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
1024 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; | 1158 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; |
1025 | int index = 0; | 1159 | int index = 0; |
1026 | bool is_dig = false; | 1160 | bool is_dig = false; |
@@ -1043,9 +1177,14 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1043 | break; | 1177 | break; |
1044 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1178 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
1045 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1179 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
1046 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
1047 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); | 1180 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); |
1048 | break; | 1181 | break; |
1182 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
1183 | if (ASIC_IS_DCE3(rdev)) | ||
1184 | is_dig = true; | ||
1185 | else | ||
1186 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); | ||
1187 | break; | ||
1049 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: | 1188 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: |
1050 | index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); | 1189 | index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); |
1051 | break; | 1190 | break; |
@@ -1082,34 +1221,85 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1082 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { | 1221 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { |
1083 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 1222 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1084 | 1223 | ||
1224 | if (connector && | ||
1225 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
1226 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
1227 | struct radeon_connector_atom_dig *radeon_dig_connector = | ||
1228 | radeon_connector->con_priv; | ||
1229 | atombios_set_edp_panel_power(connector, | ||
1230 | ATOM_TRANSMITTER_ACTION_POWER_ON); | ||
1231 | radeon_dig_connector->edp_on = true; | ||
1232 | } | ||
1085 | dp_link_train(encoder, connector); | 1233 | dp_link_train(encoder, connector); |
1086 | if (ASIC_IS_DCE4(rdev)) | 1234 | if (ASIC_IS_DCE4(rdev)) |
1087 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON); | 1235 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON); |
1088 | } | 1236 | } |
1237 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
1238 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0); | ||
1089 | break; | 1239 | break; |
1090 | case DRM_MODE_DPMS_STANDBY: | 1240 | case DRM_MODE_DPMS_STANDBY: |
1091 | case DRM_MODE_DPMS_SUSPEND: | 1241 | case DRM_MODE_DPMS_SUSPEND: |
1092 | case DRM_MODE_DPMS_OFF: | 1242 | case DRM_MODE_DPMS_OFF: |
1093 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); | 1243 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); |
1094 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { | 1244 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { |
1245 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
1246 | |||
1095 | if (ASIC_IS_DCE4(rdev)) | 1247 | if (ASIC_IS_DCE4(rdev)) |
1096 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF); | 1248 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF); |
1249 | if (connector && | ||
1250 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
1251 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
1252 | struct radeon_connector_atom_dig *radeon_dig_connector = | ||
1253 | radeon_connector->con_priv; | ||
1254 | atombios_set_edp_panel_power(connector, | ||
1255 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
1256 | radeon_dig_connector->edp_on = false; | ||
1257 | } | ||
1097 | } | 1258 | } |
1259 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
1260 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLOFF, 0, 0); | ||
1098 | break; | 1261 | break; |
1099 | } | 1262 | } |
1100 | } else { | 1263 | } else { |
1101 | switch (mode) { | 1264 | switch (mode) { |
1102 | case DRM_MODE_DPMS_ON: | 1265 | case DRM_MODE_DPMS_ON: |
1103 | args.ucAction = ATOM_ENABLE; | 1266 | args.ucAction = ATOM_ENABLE; |
1267 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1268 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | ||
1269 | args.ucAction = ATOM_LCD_BLON; | ||
1270 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1271 | } | ||
1104 | break; | 1272 | break; |
1105 | case DRM_MODE_DPMS_STANDBY: | 1273 | case DRM_MODE_DPMS_STANDBY: |
1106 | case DRM_MODE_DPMS_SUSPEND: | 1274 | case DRM_MODE_DPMS_SUSPEND: |
1107 | case DRM_MODE_DPMS_OFF: | 1275 | case DRM_MODE_DPMS_OFF: |
1108 | args.ucAction = ATOM_DISABLE; | 1276 | args.ucAction = ATOM_DISABLE; |
1277 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1278 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | ||
1279 | args.ucAction = ATOM_LCD_BLOFF; | ||
1280 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1281 | } | ||
1109 | break; | 1282 | break; |
1110 | } | 1283 | } |
1111 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
1112 | } | 1284 | } |
1285 | |||
1286 | if (ext_encoder) { | ||
1287 | int action; | ||
1288 | |||
1289 | switch (mode) { | ||
1290 | case DRM_MODE_DPMS_ON: | ||
1291 | default: | ||
1292 | action = ATOM_ENABLE; | ||
1293 | break; | ||
1294 | case DRM_MODE_DPMS_STANDBY: | ||
1295 | case DRM_MODE_DPMS_SUSPEND: | ||
1296 | case DRM_MODE_DPMS_OFF: | ||
1297 | action = ATOM_DISABLE; | ||
1298 | break; | ||
1299 | } | ||
1300 | atombios_external_encoder_setup(encoder, ext_encoder, action); | ||
1301 | } | ||
1302 | |||
1113 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); | 1303 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); |
1114 | 1304 | ||
1115 | } | 1305 | } |
@@ -1242,7 +1432,7 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder) | |||
1242 | break; | 1432 | break; |
1243 | default: | 1433 | default: |
1244 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); | 1434 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); |
1245 | break; | 1435 | return; |
1246 | } | 1436 | } |
1247 | 1437 | ||
1248 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 1438 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
@@ -1357,6 +1547,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1357 | struct drm_device *dev = encoder->dev; | 1547 | struct drm_device *dev = encoder->dev; |
1358 | struct radeon_device *rdev = dev->dev_private; | 1548 | struct radeon_device *rdev = dev->dev_private; |
1359 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1549 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1550 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
1360 | 1551 | ||
1361 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 1552 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
1362 | 1553 | ||
@@ -1400,11 +1591,9 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1400 | } | 1591 | } |
1401 | break; | 1592 | break; |
1402 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1593 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
1403 | atombios_ddia_setup(encoder, ATOM_ENABLE); | ||
1404 | break; | ||
1405 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1594 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
1406 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | 1595 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
1407 | atombios_external_tmds_setup(encoder, ATOM_ENABLE); | 1596 | atombios_dvo_setup(encoder, ATOM_ENABLE); |
1408 | break; | 1597 | break; |
1409 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 1598 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
1410 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | 1599 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
@@ -1419,6 +1608,11 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1419 | } | 1608 | } |
1420 | break; | 1609 | break; |
1421 | } | 1610 | } |
1611 | |||
1612 | if (ext_encoder) { | ||
1613 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); | ||
1614 | } | ||
1615 | |||
1422 | atombios_apply_encoder_quirks(encoder, adjusted_mode); | 1616 | atombios_apply_encoder_quirks(encoder, adjusted_mode); |
1423 | 1617 | ||
1424 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { | 1618 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { |
@@ -1595,11 +1789,9 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) | |||
1595 | } | 1789 | } |
1596 | break; | 1790 | break; |
1597 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1791 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
1598 | atombios_ddia_setup(encoder, ATOM_DISABLE); | ||
1599 | break; | ||
1600 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1792 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
1601 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | 1793 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
1602 | atombios_external_tmds_setup(encoder, ATOM_DISABLE); | 1794 | atombios_dvo_setup(encoder, ATOM_DISABLE); |
1603 | break; | 1795 | break; |
1604 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 1796 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
1605 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | 1797 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
@@ -1621,6 +1813,53 @@ disable_done: | |||
1621 | radeon_encoder->active_device = 0; | 1813 | radeon_encoder->active_device = 0; |
1622 | } | 1814 | } |
1623 | 1815 | ||
1816 | /* these are handled by the primary encoders */ | ||
1817 | static void radeon_atom_ext_prepare(struct drm_encoder *encoder) | ||
1818 | { | ||
1819 | |||
1820 | } | ||
1821 | |||
1822 | static void radeon_atom_ext_commit(struct drm_encoder *encoder) | ||
1823 | { | ||
1824 | |||
1825 | } | ||
1826 | |||
1827 | static void | ||
1828 | radeon_atom_ext_mode_set(struct drm_encoder *encoder, | ||
1829 | struct drm_display_mode *mode, | ||
1830 | struct drm_display_mode *adjusted_mode) | ||
1831 | { | ||
1832 | |||
1833 | } | ||
1834 | |||
1835 | static void radeon_atom_ext_disable(struct drm_encoder *encoder) | ||
1836 | { | ||
1837 | |||
1838 | } | ||
1839 | |||
1840 | static void | ||
1841 | radeon_atom_ext_dpms(struct drm_encoder *encoder, int mode) | ||
1842 | { | ||
1843 | |||
1844 | } | ||
1845 | |||
1846 | static bool radeon_atom_ext_mode_fixup(struct drm_encoder *encoder, | ||
1847 | struct drm_display_mode *mode, | ||
1848 | struct drm_display_mode *adjusted_mode) | ||
1849 | { | ||
1850 | return true; | ||
1851 | } | ||
1852 | |||
1853 | static const struct drm_encoder_helper_funcs radeon_atom_ext_helper_funcs = { | ||
1854 | .dpms = radeon_atom_ext_dpms, | ||
1855 | .mode_fixup = radeon_atom_ext_mode_fixup, | ||
1856 | .prepare = radeon_atom_ext_prepare, | ||
1857 | .mode_set = radeon_atom_ext_mode_set, | ||
1858 | .commit = radeon_atom_ext_commit, | ||
1859 | .disable = radeon_atom_ext_disable, | ||
1860 | /* no detect for TMDS/LVDS yet */ | ||
1861 | }; | ||
1862 | |||
1624 | static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { | 1863 | static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { |
1625 | .dpms = radeon_atom_encoder_dpms, | 1864 | .dpms = radeon_atom_encoder_dpms, |
1626 | .mode_fixup = radeon_atom_mode_fixup, | 1865 | .mode_fixup = radeon_atom_mode_fixup, |
@@ -1730,6 +1969,7 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t | |||
1730 | radeon_encoder->devices = supported_device; | 1969 | radeon_encoder->devices = supported_device; |
1731 | radeon_encoder->rmx_type = RMX_OFF; | 1970 | radeon_encoder->rmx_type = RMX_OFF; |
1732 | radeon_encoder->underscan_type = UNDERSCAN_OFF; | 1971 | radeon_encoder->underscan_type = UNDERSCAN_OFF; |
1972 | radeon_encoder->is_ext_encoder = false; | ||
1733 | 1973 | ||
1734 | switch (radeon_encoder->encoder_id) { | 1974 | switch (radeon_encoder->encoder_id) { |
1735 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: | 1975 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: |
@@ -1771,6 +2011,9 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t | |||
1771 | radeon_encoder->rmx_type = RMX_FULL; | 2011 | radeon_encoder->rmx_type = RMX_FULL; |
1772 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_LVDS); | 2012 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_LVDS); |
1773 | radeon_encoder->enc_priv = radeon_atombios_get_lvds_info(radeon_encoder); | 2013 | radeon_encoder->enc_priv = radeon_atombios_get_lvds_info(radeon_encoder); |
2014 | } else if (radeon_encoder->devices & (ATOM_DEVICE_CRT_SUPPORT)) { | ||
2015 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_DAC); | ||
2016 | radeon_encoder->enc_priv = radeon_atombios_set_dig_info(radeon_encoder); | ||
1774 | } else { | 2017 | } else { |
1775 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TMDS); | 2018 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TMDS); |
1776 | radeon_encoder->enc_priv = radeon_atombios_set_dig_info(radeon_encoder); | 2019 | radeon_encoder->enc_priv = radeon_atombios_set_dig_info(radeon_encoder); |
@@ -1779,5 +2022,22 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t | |||
1779 | } | 2022 | } |
1780 | drm_encoder_helper_add(encoder, &radeon_atom_dig_helper_funcs); | 2023 | drm_encoder_helper_add(encoder, &radeon_atom_dig_helper_funcs); |
1781 | break; | 2024 | break; |
2025 | case ENCODER_OBJECT_ID_SI170B: | ||
2026 | case ENCODER_OBJECT_ID_CH7303: | ||
2027 | case ENCODER_OBJECT_ID_EXTERNAL_SDVOA: | ||
2028 | case ENCODER_OBJECT_ID_EXTERNAL_SDVOB: | ||
2029 | case ENCODER_OBJECT_ID_TITFP513: | ||
2030 | case ENCODER_OBJECT_ID_VT1623: | ||
2031 | case ENCODER_OBJECT_ID_HDMI_SI1930: | ||
2032 | /* these are handled by the primary encoders */ | ||
2033 | radeon_encoder->is_ext_encoder = true; | ||
2034 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
2035 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_LVDS); | ||
2036 | else if (radeon_encoder->devices & (ATOM_DEVICE_CRT_SUPPORT)) | ||
2037 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_DAC); | ||
2038 | else | ||
2039 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TMDS); | ||
2040 | drm_encoder_helper_add(encoder, &radeon_atom_ext_helper_funcs); | ||
2041 | break; | ||
1782 | } | 2042 | } |
1783 | } | 2043 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index e65b90317fab..65016117d95f 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -79,8 +79,8 @@ int radeon_gart_table_vram_alloc(struct radeon_device *rdev) | |||
79 | 79 | ||
80 | if (rdev->gart.table.vram.robj == NULL) { | 80 | if (rdev->gart.table.vram.robj == NULL) { |
81 | r = radeon_bo_create(rdev, NULL, rdev->gart.table_size, | 81 | r = radeon_bo_create(rdev, NULL, rdev->gart.table_size, |
82 | true, RADEON_GEM_DOMAIN_VRAM, | 82 | PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
83 | &rdev->gart.table.vram.robj); | 83 | &rdev->gart.table.vram.robj); |
84 | if (r) { | 84 | if (r) { |
85 | return r; | 85 | return r; |
86 | } | 86 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index d1e595d91723..df95eb83dac6 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -67,7 +67,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
67 | if (alignment < PAGE_SIZE) { | 67 | if (alignment < PAGE_SIZE) { |
68 | alignment = PAGE_SIZE; | 68 | alignment = PAGE_SIZE; |
69 | } | 69 | } |
70 | r = radeon_bo_create(rdev, gobj, size, kernel, initial_domain, &robj); | 70 | r = radeon_bo_create(rdev, gobj, size, alignment, kernel, initial_domain, &robj); |
71 | if (r) { | 71 | if (r) { |
72 | if (r != -ERESTARTSYS) | 72 | if (r != -ERESTARTSYS) |
73 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", | 73 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 0cfbba02c4d0..ded2a45bc95c 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -896,7 +896,8 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
896 | ((rdev->family <= CHIP_RS480) || | 896 | ((rdev->family <= CHIP_RS480) || |
897 | ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) { | 897 | ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) { |
898 | /* set the radeon hw i2c adapter */ | 898 | /* set the radeon hw i2c adapter */ |
899 | sprintf(i2c->adapter.name, "Radeon i2c hw bus %s", name); | 899 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
900 | "Radeon i2c hw bus %s", name); | ||
900 | i2c->adapter.algo = &radeon_i2c_algo; | 901 | i2c->adapter.algo = &radeon_i2c_algo; |
901 | ret = i2c_add_adapter(&i2c->adapter); | 902 | ret = i2c_add_adapter(&i2c->adapter); |
902 | if (ret) { | 903 | if (ret) { |
@@ -905,7 +906,8 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
905 | } | 906 | } |
906 | } else { | 907 | } else { |
907 | /* set the radeon bit adapter */ | 908 | /* set the radeon bit adapter */ |
908 | sprintf(i2c->adapter.name, "Radeon i2c bit bus %s", name); | 909 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
910 | "Radeon i2c bit bus %s", name); | ||
909 | i2c->adapter.algo_data = &i2c->algo.bit; | 911 | i2c->adapter.algo_data = &i2c->algo.bit; |
910 | i2c->algo.bit.pre_xfer = pre_xfer; | 912 | i2c->algo.bit.pre_xfer = pre_xfer; |
911 | i2c->algo.bit.post_xfer = post_xfer; | 913 | i2c->algo.bit.post_xfer = post_xfer; |
@@ -946,6 +948,8 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | |||
946 | i2c->rec = *rec; | 948 | i2c->rec = *rec; |
947 | i2c->adapter.owner = THIS_MODULE; | 949 | i2c->adapter.owner = THIS_MODULE; |
948 | i2c->dev = dev; | 950 | i2c->dev = dev; |
951 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), | ||
952 | "Radeon aux bus %s", name); | ||
949 | i2c_set_adapdata(&i2c->adapter, i2c); | 953 | i2c_set_adapdata(&i2c->adapter, i2c); |
950 | i2c->adapter.algo_data = &i2c->algo.dp; | 954 | i2c->adapter.algo_data = &i2c->algo.dp; |
951 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; | 955 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; |
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c index 2f349a300195..465746bd51b7 100644 --- a/drivers/gpu/drm/radeon/radeon_irq.c +++ b/drivers/gpu/drm/radeon/radeon_irq.c | |||
@@ -76,7 +76,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc) | |||
76 | default: | 76 | default: |
77 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | 77 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", |
78 | crtc); | 78 | crtc); |
79 | return EINVAL; | 79 | return -EINVAL; |
80 | } | 80 | } |
81 | } else { | 81 | } else { |
82 | switch (crtc) { | 82 | switch (crtc) { |
@@ -89,7 +89,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc) | |||
89 | default: | 89 | default: |
90 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | 90 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", |
91 | crtc); | 91 | crtc); |
92 | return EINVAL; | 92 | return -EINVAL; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 0b8397000f4c..59f834ba283d 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -670,7 +670,7 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, | |||
670 | 670 | ||
671 | if (rdev->is_atom_bios) { | 671 | if (rdev->is_atom_bios) { |
672 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 672 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
673 | atombios_external_tmds_setup(encoder, ATOM_ENABLE); | 673 | atombios_dvo_setup(encoder, ATOM_ENABLE); |
674 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | 674 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); |
675 | } else { | 675 | } else { |
676 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | 676 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 680f57644e86..e301c6f9e059 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -375,6 +375,7 @@ struct radeon_encoder { | |||
375 | int hdmi_config_offset; | 375 | int hdmi_config_offset; |
376 | int hdmi_audio_workaround; | 376 | int hdmi_audio_workaround; |
377 | int hdmi_buffer_status; | 377 | int hdmi_buffer_status; |
378 | bool is_ext_encoder; | ||
378 | }; | 379 | }; |
379 | 380 | ||
380 | struct radeon_connector_atom_dig { | 381 | struct radeon_connector_atom_dig { |
@@ -385,6 +386,7 @@ struct radeon_connector_atom_dig { | |||
385 | u8 dp_sink_type; | 386 | u8 dp_sink_type; |
386 | int dp_clock; | 387 | int dp_clock; |
387 | int dp_lane_count; | 388 | int dp_lane_count; |
389 | bool edp_on; | ||
388 | }; | 390 | }; |
389 | 391 | ||
390 | struct radeon_gpio_rec { | 392 | struct radeon_gpio_rec { |
@@ -523,9 +525,10 @@ struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev | |||
523 | struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); | 525 | struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); |
524 | struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); | 526 | struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); |
525 | struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); | 527 | struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); |
526 | extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action); | 528 | extern void atombios_dvo_setup(struct drm_encoder *encoder, int action); |
527 | extern void atombios_digital_setup(struct drm_encoder *encoder, int action); | 529 | extern void atombios_digital_setup(struct drm_encoder *encoder, int action); |
528 | extern int atombios_get_encoder_mode(struct drm_encoder *encoder); | 530 | extern int atombios_get_encoder_mode(struct drm_encoder *encoder); |
531 | extern void atombios_set_edp_panel_power(struct drm_connector *connector, int action); | ||
529 | extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); | 532 | extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); |
530 | 533 | ||
531 | extern void radeon_crtc_load_lut(struct drm_crtc *crtc); | 534 | extern void radeon_crtc_load_lut(struct drm_crtc *crtc); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 8eb183466015..1d067743fee0 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -86,11 +86,12 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) | |||
86 | } | 86 | } |
87 | 87 | ||
88 | int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, | 88 | int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, |
89 | unsigned long size, bool kernel, u32 domain, | 89 | unsigned long size, int byte_align, bool kernel, u32 domain, |
90 | struct radeon_bo **bo_ptr) | 90 | struct radeon_bo **bo_ptr) |
91 | { | 91 | { |
92 | struct radeon_bo *bo; | 92 | struct radeon_bo *bo; |
93 | enum ttm_bo_type type; | 93 | enum ttm_bo_type type; |
94 | int page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; | ||
94 | int r; | 95 | int r; |
95 | 96 | ||
96 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { | 97 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { |
@@ -115,7 +116,7 @@ retry: | |||
115 | /* Kernel allocation are uninterruptible */ | 116 | /* Kernel allocation are uninterruptible */ |
116 | mutex_lock(&rdev->vram_mutex); | 117 | mutex_lock(&rdev->vram_mutex); |
117 | r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, | 118 | r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, |
118 | &bo->placement, 0, 0, !kernel, NULL, size, | 119 | &bo->placement, page_align, 0, !kernel, NULL, size, |
119 | &radeon_ttm_bo_destroy); | 120 | &radeon_ttm_bo_destroy); |
120 | mutex_unlock(&rdev->vram_mutex); | 121 | mutex_unlock(&rdev->vram_mutex); |
121 | if (unlikely(r != 0)) { | 122 | if (unlikely(r != 0)) { |
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 3481bc7f6f58..d143702b244a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h | |||
@@ -137,9 +137,10 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | extern int radeon_bo_create(struct radeon_device *rdev, | 139 | extern int radeon_bo_create(struct radeon_device *rdev, |
140 | struct drm_gem_object *gobj, unsigned long size, | 140 | struct drm_gem_object *gobj, unsigned long size, |
141 | bool kernel, u32 domain, | 141 | int byte_align, |
142 | struct radeon_bo **bo_ptr); | 142 | bool kernel, u32 domain, |
143 | struct radeon_bo **bo_ptr); | ||
143 | extern int radeon_bo_kmap(struct radeon_bo *bo, void **ptr); | 144 | extern int radeon_bo_kmap(struct radeon_bo *bo, void **ptr); |
144 | extern void radeon_bo_kunmap(struct radeon_bo *bo); | 145 | extern void radeon_bo_kunmap(struct radeon_bo *bo); |
145 | extern void radeon_bo_unref(struct radeon_bo **bo); | 146 | extern void radeon_bo_unref(struct radeon_bo **bo); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 6ea798ce8218..06e79822a2bf 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -176,8 +176,8 @@ int radeon_ib_pool_init(struct radeon_device *rdev) | |||
176 | INIT_LIST_HEAD(&rdev->ib_pool.bogus_ib); | 176 | INIT_LIST_HEAD(&rdev->ib_pool.bogus_ib); |
177 | /* Allocate 1M object buffer */ | 177 | /* Allocate 1M object buffer */ |
178 | r = radeon_bo_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024, | 178 | r = radeon_bo_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024, |
179 | true, RADEON_GEM_DOMAIN_GTT, | 179 | PAGE_SIZE, true, RADEON_GEM_DOMAIN_GTT, |
180 | &rdev->ib_pool.robj); | 180 | &rdev->ib_pool.robj); |
181 | if (r) { | 181 | if (r) { |
182 | DRM_ERROR("radeon: failed to ib pool (%d).\n", r); | 182 | DRM_ERROR("radeon: failed to ib pool (%d).\n", r); |
183 | return r; | 183 | return r; |
@@ -332,7 +332,7 @@ int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size) | |||
332 | rdev->cp.ring_size = ring_size; | 332 | rdev->cp.ring_size = ring_size; |
333 | /* Allocate ring buffer */ | 333 | /* Allocate ring buffer */ |
334 | if (rdev->cp.ring_obj == NULL) { | 334 | if (rdev->cp.ring_obj == NULL) { |
335 | r = radeon_bo_create(rdev, NULL, rdev->cp.ring_size, true, | 335 | r = radeon_bo_create(rdev, NULL, rdev->cp.ring_size, PAGE_SIZE, true, |
336 | RADEON_GEM_DOMAIN_GTT, | 336 | RADEON_GEM_DOMAIN_GTT, |
337 | &rdev->cp.ring_obj); | 337 | &rdev->cp.ring_obj); |
338 | if (r) { | 338 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index 313c96bc09da..5b44f652145c 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c | |||
@@ -52,7 +52,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
52 | goto out_cleanup; | 52 | goto out_cleanup; |
53 | } | 53 | } |
54 | 54 | ||
55 | r = radeon_bo_create(rdev, NULL, size, true, RADEON_GEM_DOMAIN_VRAM, | 55 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
56 | &vram_obj); | 56 | &vram_obj); |
57 | if (r) { | 57 | if (r) { |
58 | DRM_ERROR("Failed to create VRAM object\n"); | 58 | DRM_ERROR("Failed to create VRAM object\n"); |
@@ -71,7 +71,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
71 | void **gtt_start, **gtt_end; | 71 | void **gtt_start, **gtt_end; |
72 | void **vram_start, **vram_end; | 72 | void **vram_start, **vram_end; |
73 | 73 | ||
74 | r = radeon_bo_create(rdev, NULL, size, true, | 74 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, |
75 | RADEON_GEM_DOMAIN_GTT, gtt_obj + i); | 75 | RADEON_GEM_DOMAIN_GTT, gtt_obj + i); |
76 | if (r) { | 76 | if (r) { |
77 | DRM_ERROR("Failed to create GTT object %d\n", i); | 77 | DRM_ERROR("Failed to create GTT object %d\n", i); |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 01c2c736a1da..1272e4b6a1d4 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -529,7 +529,7 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
529 | DRM_ERROR("Failed initializing VRAM heap.\n"); | 529 | DRM_ERROR("Failed initializing VRAM heap.\n"); |
530 | return r; | 530 | return r; |
531 | } | 531 | } |
532 | r = radeon_bo_create(rdev, NULL, 256 * 1024, true, | 532 | r = radeon_bo_create(rdev, NULL, 256 * 1024, PAGE_SIZE, true, |
533 | RADEON_GEM_DOMAIN_VRAM, | 533 | RADEON_GEM_DOMAIN_VRAM, |
534 | &rdev->stollen_vga_memory); | 534 | &rdev->stollen_vga_memory); |
535 | if (r) { | 535 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 245374e2b778..4dfead8cee33 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -915,8 +915,8 @@ static int rv770_vram_scratch_init(struct radeon_device *rdev) | |||
915 | 915 | ||
916 | if (rdev->vram_scratch.robj == NULL) { | 916 | if (rdev->vram_scratch.robj == NULL) { |
917 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, | 917 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, |
918 | true, RADEON_GEM_DOMAIN_VRAM, | 918 | PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
919 | &rdev->vram_scratch.robj); | 919 | &rdev->vram_scratch.robj); |
920 | if (r) { | 920 | if (r) { |
921 | return r; | 921 | return r; |
922 | } | 922 | } |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 3ca77dc03915..148a322d8f5d 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -224,6 +224,9 @@ int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | |||
224 | int ret; | 224 | int ret; |
225 | 225 | ||
226 | while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) { | 226 | while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) { |
227 | /** | ||
228 | * Deadlock avoidance for multi-bo reserving. | ||
229 | */ | ||
227 | if (use_sequence && bo->seq_valid && | 230 | if (use_sequence && bo->seq_valid && |
228 | (sequence - bo->val_seq < (1 << 31))) { | 231 | (sequence - bo->val_seq < (1 << 31))) { |
229 | return -EAGAIN; | 232 | return -EAGAIN; |
@@ -241,6 +244,14 @@ int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | |||
241 | } | 244 | } |
242 | 245 | ||
243 | if (use_sequence) { | 246 | if (use_sequence) { |
247 | /** | ||
248 | * Wake up waiters that may need to recheck for deadlock, | ||
249 | * if we decreased the sequence number. | ||
250 | */ | ||
251 | if (unlikely((bo->val_seq - sequence < (1 << 31)) | ||
252 | || !bo->seq_valid)) | ||
253 | wake_up_all(&bo->event_queue); | ||
254 | |||
244 | bo->val_seq = sequence; | 255 | bo->val_seq = sequence; |
245 | bo->seq_valid = true; | 256 | bo->seq_valid = true; |
246 | } else { | 257 | } else { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 36e129f0023f..5408b1b7996f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -862,7 +862,7 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, | |||
862 | &vmw_vram_sys_placement, true, | 862 | &vmw_vram_sys_placement, true, |
863 | &vmw_user_dmabuf_destroy); | 863 | &vmw_user_dmabuf_destroy); |
864 | if (unlikely(ret != 0)) | 864 | if (unlikely(ret != 0)) |
865 | return ret; | 865 | goto out_no_dmabuf; |
866 | 866 | ||
867 | tmp = ttm_bo_reference(&vmw_user_bo->dma.base); | 867 | tmp = ttm_bo_reference(&vmw_user_bo->dma.base); |
868 | ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile, | 868 | ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile, |
@@ -870,19 +870,21 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, | |||
870 | false, | 870 | false, |
871 | ttm_buffer_type, | 871 | ttm_buffer_type, |
872 | &vmw_user_dmabuf_release, NULL); | 872 | &vmw_user_dmabuf_release, NULL); |
873 | if (unlikely(ret != 0)) { | 873 | if (unlikely(ret != 0)) |
874 | ttm_bo_unref(&tmp); | 874 | goto out_no_base_object; |
875 | } else { | 875 | else { |
876 | rep->handle = vmw_user_bo->base.hash.key; | 876 | rep->handle = vmw_user_bo->base.hash.key; |
877 | rep->map_handle = vmw_user_bo->dma.base.addr_space_offset; | 877 | rep->map_handle = vmw_user_bo->dma.base.addr_space_offset; |
878 | rep->cur_gmr_id = vmw_user_bo->base.hash.key; | 878 | rep->cur_gmr_id = vmw_user_bo->base.hash.key; |
879 | rep->cur_gmr_offset = 0; | 879 | rep->cur_gmr_offset = 0; |
880 | } | 880 | } |
881 | ttm_bo_unref(&tmp); | ||
882 | 881 | ||
882 | out_no_base_object: | ||
883 | ttm_bo_unref(&tmp); | ||
884 | out_no_dmabuf: | ||
883 | ttm_read_unlock(&vmaster->lock); | 885 | ttm_read_unlock(&vmaster->lock); |
884 | 886 | ||
885 | return 0; | 887 | return ret; |
886 | } | 888 | } |
887 | 889 | ||
888 | int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data, | 890 | int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data, |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 8a4b32dca9f7..e1f07483691f 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/hid.h> | 32 | #include <linux/hid.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
35 | #include <linux/smp_lock.h> | ||
36 | 35 | ||
37 | #include <linux/hidraw.h> | 36 | #include <linux/hidraw.h> |
38 | 37 | ||
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index fedd88df9a18..984feb351a5a 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/input.h> | 32 | #include <linux/input.h> |
34 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
35 | #include <linux/hid.h> | 34 | #include <linux/hid.h> |
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index fa9708c2d723..4033974d1bb3 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c | |||
@@ -4,7 +4,7 @@ | |||
4 | Copyright (C) 2009 T. Mertelj <tomaz.mertelj@guest.arnes.si> | 4 | Copyright (C) 2009 T. Mertelj <tomaz.mertelj@guest.arnes.si> |
5 | 5 | ||
6 | Based on max6650.c: | 6 | Based on max6650.c: |
7 | Copyright (C) 2007 Hans J. Koch <hjk@linutronix.de> | 7 | Copyright (C) 2007 Hans J. Koch <hjk@hansjkoch.de> |
8 | 8 | ||
9 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c index 6669255aadcf..c9ed14eba5a6 100644 --- a/drivers/hwmon/lm93.c +++ b/drivers/hwmon/lm93.c | |||
@@ -20,7 +20,7 @@ | |||
20 | Adapted to 2.6.20 by Carsten Emde <cbe@osadl.org> | 20 | Adapted to 2.6.20 by Carsten Emde <cbe@osadl.org> |
21 | Copyright (c) 2006 Carsten Emde, Open Source Automation Development Lab | 21 | Copyright (c) 2006 Carsten Emde, Open Source Automation Development Lab |
22 | 22 | ||
23 | Modified for mainline integration by Hans J. Koch <hjk@linutronix.de> | 23 | Modified for mainline integration by Hans J. Koch <hjk@hansjkoch.de> |
24 | Copyright (c) 2007 Hans J. Koch, Linutronix GmbH | 24 | Copyright (c) 2007 Hans J. Koch, Linutronix GmbH |
25 | 25 | ||
26 | This program is free software; you can redistribute it and/or modify | 26 | This program is free software; you can redistribute it and/or modify |
@@ -2629,7 +2629,7 @@ static void __exit lm93_exit(void) | |||
2629 | } | 2629 | } |
2630 | 2630 | ||
2631 | MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>, " | 2631 | MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>, " |
2632 | "Hans J. Koch <hjk@linutronix.de"); | 2632 | "Hans J. Koch <hjk@hansjkoch.de>"); |
2633 | MODULE_DESCRIPTION("LM93 driver"); | 2633 | MODULE_DESCRIPTION("LM93 driver"); |
2634 | MODULE_LICENSE("GPL"); | 2634 | MODULE_LICENSE("GPL"); |
2635 | 2635 | ||
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c index 464340f25496..4546d82f024a 100644 --- a/drivers/hwmon/lm95241.c +++ b/drivers/hwmon/lm95241.c | |||
@@ -128,9 +128,12 @@ static ssize_t set_interval(struct device *dev, struct device_attribute *attr, | |||
128 | { | 128 | { |
129 | struct i2c_client *client = to_i2c_client(dev); | 129 | struct i2c_client *client = to_i2c_client(dev); |
130 | struct lm95241_data *data = i2c_get_clientdata(client); | 130 | struct lm95241_data *data = i2c_get_clientdata(client); |
131 | unsigned long val; | ||
131 | 132 | ||
132 | strict_strtol(buf, 10, &data->interval); | 133 | if (strict_strtoul(buf, 10, &val) < 0) |
133 | data->interval = data->interval * HZ / 1000; | 134 | return -EINVAL; |
135 | |||
136 | data->interval = val * HZ / 1000; | ||
134 | 137 | ||
135 | return count; | 138 | return count; |
136 | } | 139 | } |
@@ -188,7 +191,9 @@ static ssize_t set_type##flag(struct device *dev, \ | |||
188 | struct lm95241_data *data = i2c_get_clientdata(client); \ | 191 | struct lm95241_data *data = i2c_get_clientdata(client); \ |
189 | \ | 192 | \ |
190 | long val; \ | 193 | long val; \ |
191 | strict_strtol(buf, 10, &val); \ | 194 | \ |
195 | if (strict_strtol(buf, 10, &val) < 0) \ | ||
196 | return -EINVAL; \ | ||
192 | \ | 197 | \ |
193 | if ((val == 1) || (val == 2)) { \ | 198 | if ((val == 1) || (val == 2)) { \ |
194 | \ | 199 | \ |
@@ -227,7 +232,9 @@ static ssize_t set_min##flag(struct device *dev, \ | |||
227 | struct lm95241_data *data = i2c_get_clientdata(client); \ | 232 | struct lm95241_data *data = i2c_get_clientdata(client); \ |
228 | \ | 233 | \ |
229 | long val; \ | 234 | long val; \ |
230 | strict_strtol(buf, 10, &val); \ | 235 | \ |
236 | if (strict_strtol(buf, 10, &val) < 0) \ | ||
237 | return -EINVAL;\ | ||
231 | \ | 238 | \ |
232 | mutex_lock(&data->update_lock); \ | 239 | mutex_lock(&data->update_lock); \ |
233 | \ | 240 | \ |
@@ -256,7 +263,9 @@ static ssize_t set_max##flag(struct device *dev, \ | |||
256 | struct lm95241_data *data = i2c_get_clientdata(client); \ | 263 | struct lm95241_data *data = i2c_get_clientdata(client); \ |
257 | \ | 264 | \ |
258 | long val; \ | 265 | long val; \ |
259 | strict_strtol(buf, 10, &val); \ | 266 | \ |
267 | if (strict_strtol(buf, 10, &val) < 0) \ | ||
268 | return -EINVAL; \ | ||
260 | \ | 269 | \ |
261 | mutex_lock(&data->update_lock); \ | 270 | mutex_lock(&data->update_lock); \ |
262 | \ | 271 | \ |
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index a0160ee5caef..9a11532ecae8 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * max6650.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | * max6650.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | * monitoring. | 3 | * monitoring. |
4 | * | 4 | * |
5 | * (C) 2007 by Hans J. Koch <hjk@linutronix.de> | 5 | * (C) 2007 by Hans J. Koch <hjk@hansjkoch.de> |
6 | * | 6 | * |
7 | * based on code written by John Morris <john.morris@spirentcom.com> | 7 | * based on code written by John Morris <john.morris@spirentcom.com> |
8 | * Copyright (c) 2003 Spirent Communications | 8 | * Copyright (c) 2003 Spirent Communications |
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c index 1d840aa83782..cdbc7448491e 100644 --- a/drivers/hwmon/w83795.c +++ b/drivers/hwmon/w83795.c | |||
@@ -165,10 +165,14 @@ static const u8 IN_LSB_SHIFT_IDX[][2] = { | |||
165 | 165 | ||
166 | #define W83795_REG_VID_CTRL 0x6A | 166 | #define W83795_REG_VID_CTRL 0x6A |
167 | 167 | ||
168 | #define W83795_REG_ALARM_CTRL 0x40 | ||
169 | #define ALARM_CTRL_RTSACS (1 << 7) | ||
168 | #define W83795_REG_ALARM(index) (0x41 + (index)) | 170 | #define W83795_REG_ALARM(index) (0x41 + (index)) |
171 | #define W83795_REG_CLR_CHASSIS 0x4D | ||
169 | #define W83795_REG_BEEP(index) (0x50 + (index)) | 172 | #define W83795_REG_BEEP(index) (0x50 + (index)) |
170 | 173 | ||
171 | #define W83795_REG_CLR_CHASSIS 0x4D | 174 | #define W83795_REG_OVT_CFG 0x58 |
175 | #define OVT_CFG_SEL (1 << 7) | ||
172 | 176 | ||
173 | 177 | ||
174 | #define W83795_REG_FCMS1 0x201 | 178 | #define W83795_REG_FCMS1 0x201 |
@@ -178,6 +182,14 @@ static const u8 IN_LSB_SHIFT_IDX[][2] = { | |||
178 | 182 | ||
179 | #define W83795_REG_TSS(index) (0x209 + (index)) | 183 | #define W83795_REG_TSS(index) (0x209 + (index)) |
180 | 184 | ||
185 | #define TSS_MAP_RESERVED 0xff | ||
186 | static const u8 tss_map[4][6] = { | ||
187 | { 0, 1, 2, 3, 4, 5}, | ||
188 | { 6, 7, 8, 9, 0, 1}, | ||
189 | {10, 11, 12, 13, 2, 3}, | ||
190 | { 4, 5, 4, 5, TSS_MAP_RESERVED, TSS_MAP_RESERVED}, | ||
191 | }; | ||
192 | |||
181 | #define PWM_OUTPUT 0 | 193 | #define PWM_OUTPUT 0 |
182 | #define PWM_FREQ 1 | 194 | #define PWM_FREQ 1 |
183 | #define PWM_START 2 | 195 | #define PWM_START 2 |
@@ -369,6 +381,7 @@ struct w83795_data { | |||
369 | u8 setup_pwm[3]; /* Register value */ | 381 | u8 setup_pwm[3]; /* Register value */ |
370 | 382 | ||
371 | u8 alarms[6]; /* Register value */ | 383 | u8 alarms[6]; /* Register value */ |
384 | u8 enable_beep; | ||
372 | u8 beeps[6]; /* Register value */ | 385 | u8 beeps[6]; /* Register value */ |
373 | 386 | ||
374 | char valid; | 387 | char valid; |
@@ -499,8 +512,11 @@ static void w83795_update_limits(struct i2c_client *client) | |||
499 | } | 512 | } |
500 | 513 | ||
501 | /* Read beep settings */ | 514 | /* Read beep settings */ |
502 | for (i = 0; i < ARRAY_SIZE(data->beeps); i++) | 515 | if (data->enable_beep) { |
503 | data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i)); | 516 | for (i = 0; i < ARRAY_SIZE(data->beeps); i++) |
517 | data->beeps[i] = | ||
518 | w83795_read(client, W83795_REG_BEEP(i)); | ||
519 | } | ||
504 | 520 | ||
505 | data->valid_limits = 1; | 521 | data->valid_limits = 1; |
506 | } | 522 | } |
@@ -577,6 +593,7 @@ static struct w83795_data *w83795_update_device(struct device *dev) | |||
577 | struct i2c_client *client = to_i2c_client(dev); | 593 | struct i2c_client *client = to_i2c_client(dev); |
578 | struct w83795_data *data = i2c_get_clientdata(client); | 594 | struct w83795_data *data = i2c_get_clientdata(client); |
579 | u16 tmp; | 595 | u16 tmp; |
596 | u8 intrusion; | ||
580 | int i; | 597 | int i; |
581 | 598 | ||
582 | mutex_lock(&data->update_lock); | 599 | mutex_lock(&data->update_lock); |
@@ -648,9 +665,24 @@ static struct w83795_data *w83795_update_device(struct device *dev) | |||
648 | w83795_read(client, W83795_REG_PWM(i, PWM_OUTPUT)); | 665 | w83795_read(client, W83795_REG_PWM(i, PWM_OUTPUT)); |
649 | } | 666 | } |
650 | 667 | ||
651 | /* update alarm */ | 668 | /* Update intrusion and alarms |
669 | * It is important to read intrusion first, because reading from | ||
670 | * register SMI STS6 clears the interrupt status temporarily. */ | ||
671 | tmp = w83795_read(client, W83795_REG_ALARM_CTRL); | ||
672 | /* Switch to interrupt status for intrusion if needed */ | ||
673 | if (tmp & ALARM_CTRL_RTSACS) | ||
674 | w83795_write(client, W83795_REG_ALARM_CTRL, | ||
675 | tmp & ~ALARM_CTRL_RTSACS); | ||
676 | intrusion = w83795_read(client, W83795_REG_ALARM(5)) & (1 << 6); | ||
677 | /* Switch to real-time alarms */ | ||
678 | w83795_write(client, W83795_REG_ALARM_CTRL, tmp | ALARM_CTRL_RTSACS); | ||
652 | for (i = 0; i < ARRAY_SIZE(data->alarms); i++) | 679 | for (i = 0; i < ARRAY_SIZE(data->alarms); i++) |
653 | data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); | 680 | data->alarms[i] = w83795_read(client, W83795_REG_ALARM(i)); |
681 | data->alarms[5] |= intrusion; | ||
682 | /* Restore original configuration if needed */ | ||
683 | if (!(tmp & ALARM_CTRL_RTSACS)) | ||
684 | w83795_write(client, W83795_REG_ALARM_CTRL, | ||
685 | tmp & ~ALARM_CTRL_RTSACS); | ||
654 | 686 | ||
655 | data->last_updated = jiffies; | 687 | data->last_updated = jiffies; |
656 | data->valid = 1; | 688 | data->valid = 1; |
@@ -730,6 +762,10 @@ store_chassis_clear(struct device *dev, | |||
730 | val = w83795_read(client, W83795_REG_CLR_CHASSIS); | 762 | val = w83795_read(client, W83795_REG_CLR_CHASSIS); |
731 | val |= 0x80; | 763 | val |= 0x80; |
732 | w83795_write(client, W83795_REG_CLR_CHASSIS, val); | 764 | w83795_write(client, W83795_REG_CLR_CHASSIS, val); |
765 | |||
766 | /* Clear status and force cache refresh */ | ||
767 | w83795_read(client, W83795_REG_ALARM(5)); | ||
768 | data->valid = 0; | ||
733 | mutex_unlock(&data->update_lock); | 769 | mutex_unlock(&data->update_lock); |
734 | return count; | 770 | return count; |
735 | } | 771 | } |
@@ -857,20 +893,20 @@ show_pwm_enable(struct device *dev, struct device_attribute *attr, char *buf) | |||
857 | int index = sensor_attr->index; | 893 | int index = sensor_attr->index; |
858 | u8 tmp; | 894 | u8 tmp; |
859 | 895 | ||
860 | if (1 == (data->pwm_fcms[0] & (1 << index))) { | 896 | /* Speed cruise mode */ |
897 | if (data->pwm_fcms[0] & (1 << index)) { | ||
861 | tmp = 2; | 898 | tmp = 2; |
862 | goto out; | 899 | goto out; |
863 | } | 900 | } |
901 | /* Thermal cruise or SmartFan IV mode */ | ||
864 | for (tmp = 0; tmp < 6; tmp++) { | 902 | for (tmp = 0; tmp < 6; tmp++) { |
865 | if (data->pwm_tfmr[tmp] & (1 << index)) { | 903 | if (data->pwm_tfmr[tmp] & (1 << index)) { |
866 | tmp = 3; | 904 | tmp = 3; |
867 | goto out; | 905 | goto out; |
868 | } | 906 | } |
869 | } | 907 | } |
870 | if (data->pwm_fomc & (1 << index)) | 908 | /* Manual mode */ |
871 | tmp = 0; | 909 | tmp = 1; |
872 | else | ||
873 | tmp = 1; | ||
874 | 910 | ||
875 | out: | 911 | out: |
876 | return sprintf(buf, "%u\n", tmp); | 912 | return sprintf(buf, "%u\n", tmp); |
@@ -890,23 +926,21 @@ store_pwm_enable(struct device *dev, struct device_attribute *attr, | |||
890 | 926 | ||
891 | if (strict_strtoul(buf, 10, &val) < 0) | 927 | if (strict_strtoul(buf, 10, &val) < 0) |
892 | return -EINVAL; | 928 | return -EINVAL; |
893 | if (val > 2) | 929 | if (val < 1 || val > 2) |
894 | return -EINVAL; | 930 | return -EINVAL; |
895 | 931 | ||
896 | mutex_lock(&data->update_lock); | 932 | mutex_lock(&data->update_lock); |
897 | switch (val) { | 933 | switch (val) { |
898 | case 0: | ||
899 | case 1: | 934 | case 1: |
935 | /* Clear speed cruise mode bits */ | ||
900 | data->pwm_fcms[0] &= ~(1 << index); | 936 | data->pwm_fcms[0] &= ~(1 << index); |
901 | w83795_write(client, W83795_REG_FCMS1, data->pwm_fcms[0]); | 937 | w83795_write(client, W83795_REG_FCMS1, data->pwm_fcms[0]); |
938 | /* Clear thermal cruise mode bits */ | ||
902 | for (i = 0; i < 6; i++) { | 939 | for (i = 0; i < 6; i++) { |
903 | data->pwm_tfmr[i] &= ~(1 << index); | 940 | data->pwm_tfmr[i] &= ~(1 << index); |
904 | w83795_write(client, W83795_REG_TFMR(i), | 941 | w83795_write(client, W83795_REG_TFMR(i), |
905 | data->pwm_tfmr[i]); | 942 | data->pwm_tfmr[i]); |
906 | } | 943 | } |
907 | data->pwm_fomc |= 1 << index; | ||
908 | data->pwm_fomc ^= val << index; | ||
909 | w83795_write(client, W83795_REG_FOMC, data->pwm_fomc); | ||
910 | break; | 944 | break; |
911 | case 2: | 945 | case 2: |
912 | data->pwm_fcms[0] |= (1 << index); | 946 | data->pwm_fcms[0] |= (1 << index); |
@@ -918,23 +952,60 @@ store_pwm_enable(struct device *dev, struct device_attribute *attr, | |||
918 | } | 952 | } |
919 | 953 | ||
920 | static ssize_t | 954 | static ssize_t |
955 | show_pwm_mode(struct device *dev, struct device_attribute *attr, char *buf) | ||
956 | { | ||
957 | struct w83795_data *data = w83795_update_pwm_config(dev); | ||
958 | int index = to_sensor_dev_attr_2(attr)->index; | ||
959 | unsigned int mode; | ||
960 | |||
961 | if (data->pwm_fomc & (1 << index)) | ||
962 | mode = 0; /* DC */ | ||
963 | else | ||
964 | mode = 1; /* PWM */ | ||
965 | |||
966 | return sprintf(buf, "%u\n", mode); | ||
967 | } | ||
968 | |||
969 | /* | ||
970 | * Check whether a given temperature source can ever be useful. | ||
971 | * Returns the number of selectable temperature channels which are | ||
972 | * enabled. | ||
973 | */ | ||
974 | static int w83795_tss_useful(const struct w83795_data *data, int tsrc) | ||
975 | { | ||
976 | int useful = 0, i; | ||
977 | |||
978 | for (i = 0; i < 4; i++) { | ||
979 | if (tss_map[i][tsrc] == TSS_MAP_RESERVED) | ||
980 | continue; | ||
981 | if (tss_map[i][tsrc] < 6) /* Analog */ | ||
982 | useful += (data->has_temp >> tss_map[i][tsrc]) & 1; | ||
983 | else /* Digital */ | ||
984 | useful += (data->has_dts >> (tss_map[i][tsrc] - 6)) & 1; | ||
985 | } | ||
986 | |||
987 | return useful; | ||
988 | } | ||
989 | |||
990 | static ssize_t | ||
921 | show_temp_src(struct device *dev, struct device_attribute *attr, char *buf) | 991 | show_temp_src(struct device *dev, struct device_attribute *attr, char *buf) |
922 | { | 992 | { |
923 | struct sensor_device_attribute_2 *sensor_attr = | 993 | struct sensor_device_attribute_2 *sensor_attr = |
924 | to_sensor_dev_attr_2(attr); | 994 | to_sensor_dev_attr_2(attr); |
925 | struct w83795_data *data = w83795_update_pwm_config(dev); | 995 | struct w83795_data *data = w83795_update_pwm_config(dev); |
926 | int index = sensor_attr->index; | 996 | int index = sensor_attr->index; |
927 | u8 val = index / 2; | 997 | u8 tmp = data->temp_src[index / 2]; |
928 | u8 tmp = data->temp_src[val]; | ||
929 | 998 | ||
930 | if (index & 1) | 999 | if (index & 1) |
931 | val = 4; | 1000 | tmp >>= 4; /* Pick high nibble */ |
932 | else | 1001 | else |
933 | val = 0; | 1002 | tmp &= 0x0f; /* Pick low nibble */ |
934 | tmp >>= val; | ||
935 | tmp &= 0x0f; | ||
936 | 1003 | ||
937 | return sprintf(buf, "%u\n", tmp); | 1004 | /* Look-up the actual temperature channel number */ |
1005 | if (tmp >= 4 || tss_map[tmp][index] == TSS_MAP_RESERVED) | ||
1006 | return -EINVAL; /* Shouldn't happen */ | ||
1007 | |||
1008 | return sprintf(buf, "%u\n", (unsigned int)tss_map[tmp][index] + 1); | ||
938 | } | 1009 | } |
939 | 1010 | ||
940 | static ssize_t | 1011 | static ssize_t |
@@ -946,12 +1017,21 @@ store_temp_src(struct device *dev, struct device_attribute *attr, | |||
946 | struct sensor_device_attribute_2 *sensor_attr = | 1017 | struct sensor_device_attribute_2 *sensor_attr = |
947 | to_sensor_dev_attr_2(attr); | 1018 | to_sensor_dev_attr_2(attr); |
948 | int index = sensor_attr->index; | 1019 | int index = sensor_attr->index; |
949 | unsigned long tmp; | 1020 | int tmp; |
1021 | unsigned long channel; | ||
950 | u8 val = index / 2; | 1022 | u8 val = index / 2; |
951 | 1023 | ||
952 | if (strict_strtoul(buf, 10, &tmp) < 0) | 1024 | if (strict_strtoul(buf, 10, &channel) < 0 || |
1025 | channel < 1 || channel > 14) | ||
1026 | return -EINVAL; | ||
1027 | |||
1028 | /* Check if request can be fulfilled */ | ||
1029 | for (tmp = 0; tmp < 4; tmp++) { | ||
1030 | if (tss_map[tmp][index] == channel - 1) | ||
1031 | break; | ||
1032 | } | ||
1033 | if (tmp == 4) /* No match */ | ||
953 | return -EINVAL; | 1034 | return -EINVAL; |
954 | tmp = SENSORS_LIMIT(tmp, 0, 15); | ||
955 | 1035 | ||
956 | mutex_lock(&data->update_lock); | 1036 | mutex_lock(&data->update_lock); |
957 | if (index & 1) { | 1037 | if (index & 1) { |
@@ -1515,7 +1595,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, | |||
1515 | 1595 | ||
1516 | #define NOT_USED -1 | 1596 | #define NOT_USED -1 |
1517 | 1597 | ||
1518 | /* Don't change the attribute order, _max and _min are accessed by index | 1598 | /* Don't change the attribute order, _max, _min and _beep are accessed by index |
1519 | * somewhere else in the code */ | 1599 | * somewhere else in the code */ |
1520 | #define SENSOR_ATTR_IN(index) { \ | 1600 | #define SENSOR_ATTR_IN(index) { \ |
1521 | SENSOR_ATTR_2(in##index##_input, S_IRUGO, show_in, NULL, \ | 1601 | SENSOR_ATTR_2(in##index##_input, S_IRUGO, show_in, NULL, \ |
@@ -1530,6 +1610,8 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, | |||
1530 | show_alarm_beep, store_beep, BEEP_ENABLE, \ | 1610 | show_alarm_beep, store_beep, BEEP_ENABLE, \ |
1531 | index + ((index > 14) ? 1 : 0)) } | 1611 | index + ((index > 14) ? 1 : 0)) } |
1532 | 1612 | ||
1613 | /* Don't change the attribute order, _beep is accessed by index | ||
1614 | * somewhere else in the code */ | ||
1533 | #define SENSOR_ATTR_FAN(index) { \ | 1615 | #define SENSOR_ATTR_FAN(index) { \ |
1534 | SENSOR_ATTR_2(fan##index##_input, S_IRUGO, show_fan, \ | 1616 | SENSOR_ATTR_2(fan##index##_input, S_IRUGO, show_fan, \ |
1535 | NULL, FAN_INPUT, index - 1), \ | 1617 | NULL, FAN_INPUT, index - 1), \ |
@@ -1553,9 +1635,13 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, | |||
1553 | show_pwm, store_pwm, PWM_FREQ, index - 1), \ | 1635 | show_pwm, store_pwm, PWM_FREQ, index - 1), \ |
1554 | SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \ | 1636 | SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \ |
1555 | show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \ | 1637 | show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \ |
1638 | SENSOR_ATTR_2(pwm##index##_mode, S_IRUGO, \ | ||
1639 | show_pwm_mode, NULL, NOT_USED, index - 1), \ | ||
1556 | SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \ | 1640 | SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \ |
1557 | show_fanin, store_fanin, FANIN_TARGET, index - 1) } | 1641 | show_fanin, store_fanin, FANIN_TARGET, index - 1) } |
1558 | 1642 | ||
1643 | /* Don't change the attribute order, _beep is accessed by index | ||
1644 | * somewhere else in the code */ | ||
1559 | #define SENSOR_ATTR_DTS(index) { \ | 1645 | #define SENSOR_ATTR_DTS(index) { \ |
1560 | SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \ | 1646 | SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \ |
1561 | show_dts_mode, NULL, NOT_USED, index - 7), \ | 1647 | show_dts_mode, NULL, NOT_USED, index - 7), \ |
@@ -1574,6 +1660,8 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, | |||
1574 | SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \ | 1660 | SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \ |
1575 | show_alarm_beep, store_beep, BEEP_ENABLE, index + 17) } | 1661 | show_alarm_beep, store_beep, BEEP_ENABLE, index + 17) } |
1576 | 1662 | ||
1663 | /* Don't change the attribute order, _beep is accessed by index | ||
1664 | * somewhere else in the code */ | ||
1577 | #define SENSOR_ATTR_TEMP(index) { \ | 1665 | #define SENSOR_ATTR_TEMP(index) { \ |
1578 | SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \ | 1666 | SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \ |
1579 | show_temp_mode, store_temp_mode, NOT_USED, index - 1), \ | 1667 | show_temp_mode, store_temp_mode, NOT_USED, index - 1), \ |
@@ -1593,8 +1681,6 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, | |||
1593 | SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \ | 1681 | SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \ |
1594 | show_alarm_beep, store_beep, BEEP_ENABLE, \ | 1682 | show_alarm_beep, store_beep, BEEP_ENABLE, \ |
1595 | index + (index > 4 ? 11 : 17)), \ | 1683 | index + (index > 4 ? 11 : 17)), \ |
1596 | SENSOR_ATTR_2(temp##index##_source_sel, S_IWUSR | S_IRUGO, \ | ||
1597 | show_temp_src, store_temp_src, NOT_USED, index - 1), \ | ||
1598 | SENSOR_ATTR_2(temp##index##_pwm_enable, S_IWUSR | S_IRUGO, \ | 1684 | SENSOR_ATTR_2(temp##index##_pwm_enable, S_IWUSR | S_IRUGO, \ |
1599 | show_temp_pwm_enable, store_temp_pwm_enable, \ | 1685 | show_temp_pwm_enable, store_temp_pwm_enable, \ |
1600 | TEMP_PWM_ENABLE, index - 1), \ | 1686 | TEMP_PWM_ENABLE, index - 1), \ |
@@ -1680,7 +1766,7 @@ static const struct sensor_device_attribute_2 w83795_fan[][4] = { | |||
1680 | SENSOR_ATTR_FAN(14), | 1766 | SENSOR_ATTR_FAN(14), |
1681 | }; | 1767 | }; |
1682 | 1768 | ||
1683 | static const struct sensor_device_attribute_2 w83795_temp[][29] = { | 1769 | static const struct sensor_device_attribute_2 w83795_temp[][28] = { |
1684 | SENSOR_ATTR_TEMP(1), | 1770 | SENSOR_ATTR_TEMP(1), |
1685 | SENSOR_ATTR_TEMP(2), | 1771 | SENSOR_ATTR_TEMP(2), |
1686 | SENSOR_ATTR_TEMP(3), | 1772 | SENSOR_ATTR_TEMP(3), |
@@ -1700,7 +1786,7 @@ static const struct sensor_device_attribute_2 w83795_dts[][8] = { | |||
1700 | SENSOR_ATTR_DTS(14), | 1786 | SENSOR_ATTR_DTS(14), |
1701 | }; | 1787 | }; |
1702 | 1788 | ||
1703 | static const struct sensor_device_attribute_2 w83795_pwm[][7] = { | 1789 | static const struct sensor_device_attribute_2 w83795_pwm[][8] = { |
1704 | SENSOR_ATTR_PWM(1), | 1790 | SENSOR_ATTR_PWM(1), |
1705 | SENSOR_ATTR_PWM(2), | 1791 | SENSOR_ATTR_PWM(2), |
1706 | SENSOR_ATTR_PWM(3), | 1792 | SENSOR_ATTR_PWM(3), |
@@ -1711,13 +1797,24 @@ static const struct sensor_device_attribute_2 w83795_pwm[][7] = { | |||
1711 | SENSOR_ATTR_PWM(8), | 1797 | SENSOR_ATTR_PWM(8), |
1712 | }; | 1798 | }; |
1713 | 1799 | ||
1800 | static const struct sensor_device_attribute_2 w83795_tss[6] = { | ||
1801 | SENSOR_ATTR_2(temp1_source_sel, S_IWUSR | S_IRUGO, | ||
1802 | show_temp_src, store_temp_src, NOT_USED, 0), | ||
1803 | SENSOR_ATTR_2(temp2_source_sel, S_IWUSR | S_IRUGO, | ||
1804 | show_temp_src, store_temp_src, NOT_USED, 1), | ||
1805 | SENSOR_ATTR_2(temp3_source_sel, S_IWUSR | S_IRUGO, | ||
1806 | show_temp_src, store_temp_src, NOT_USED, 2), | ||
1807 | SENSOR_ATTR_2(temp4_source_sel, S_IWUSR | S_IRUGO, | ||
1808 | show_temp_src, store_temp_src, NOT_USED, 3), | ||
1809 | SENSOR_ATTR_2(temp5_source_sel, S_IWUSR | S_IRUGO, | ||
1810 | show_temp_src, store_temp_src, NOT_USED, 4), | ||
1811 | SENSOR_ATTR_2(temp6_source_sel, S_IWUSR | S_IRUGO, | ||
1812 | show_temp_src, store_temp_src, NOT_USED, 5), | ||
1813 | }; | ||
1814 | |||
1714 | static const struct sensor_device_attribute_2 sda_single_files[] = { | 1815 | static const struct sensor_device_attribute_2 sda_single_files[] = { |
1715 | SENSOR_ATTR_2(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm_beep, | 1816 | SENSOR_ATTR_2(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm_beep, |
1716 | store_chassis_clear, ALARM_STATUS, 46), | 1817 | store_chassis_clear, ALARM_STATUS, 46), |
1717 | SENSOR_ATTR_2(intrusion0_beep, S_IWUSR | S_IRUGO, show_alarm_beep, | ||
1718 | store_beep, BEEP_ENABLE, 46), | ||
1719 | SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_alarm_beep, | ||
1720 | store_beep, BEEP_ENABLE, 47), | ||
1721 | #ifdef CONFIG_SENSORS_W83795_FANCTRL | 1818 | #ifdef CONFIG_SENSORS_W83795_FANCTRL |
1722 | SENSOR_ATTR_2(speed_cruise_tolerance, S_IWUSR | S_IRUGO, show_fanin, | 1819 | SENSOR_ATTR_2(speed_cruise_tolerance, S_IWUSR | S_IRUGO, show_fanin, |
1723 | store_fanin, FANIN_TOL, NOT_USED), | 1820 | store_fanin, FANIN_TOL, NOT_USED), |
@@ -1730,6 +1827,13 @@ static const struct sensor_device_attribute_2 sda_single_files[] = { | |||
1730 | #endif | 1827 | #endif |
1731 | }; | 1828 | }; |
1732 | 1829 | ||
1830 | static const struct sensor_device_attribute_2 sda_beep_files[] = { | ||
1831 | SENSOR_ATTR_2(intrusion0_beep, S_IWUSR | S_IRUGO, show_alarm_beep, | ||
1832 | store_beep, BEEP_ENABLE, 46), | ||
1833 | SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_alarm_beep, | ||
1834 | store_beep, BEEP_ENABLE, 47), | ||
1835 | }; | ||
1836 | |||
1733 | /* | 1837 | /* |
1734 | * Driver interface | 1838 | * Driver interface |
1735 | */ | 1839 | */ |
@@ -1859,6 +1963,8 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *, | |||
1859 | if (!(data->has_in & (1 << i))) | 1963 | if (!(data->has_in & (1 << i))) |
1860 | continue; | 1964 | continue; |
1861 | for (j = 0; j < ARRAY_SIZE(w83795_in[0]); j++) { | 1965 | for (j = 0; j < ARRAY_SIZE(w83795_in[0]); j++) { |
1966 | if (j == 4 && !data->enable_beep) | ||
1967 | continue; | ||
1862 | err = fn(dev, &w83795_in[i][j].dev_attr); | 1968 | err = fn(dev, &w83795_in[i][j].dev_attr); |
1863 | if (err) | 1969 | if (err) |
1864 | return err; | 1970 | return err; |
@@ -1869,18 +1975,37 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *, | |||
1869 | if (!(data->has_fan & (1 << i))) | 1975 | if (!(data->has_fan & (1 << i))) |
1870 | continue; | 1976 | continue; |
1871 | for (j = 0; j < ARRAY_SIZE(w83795_fan[0]); j++) { | 1977 | for (j = 0; j < ARRAY_SIZE(w83795_fan[0]); j++) { |
1978 | if (j == 3 && !data->enable_beep) | ||
1979 | continue; | ||
1872 | err = fn(dev, &w83795_fan[i][j].dev_attr); | 1980 | err = fn(dev, &w83795_fan[i][j].dev_attr); |
1873 | if (err) | 1981 | if (err) |
1874 | return err; | 1982 | return err; |
1875 | } | 1983 | } |
1876 | } | 1984 | } |
1877 | 1985 | ||
1986 | for (i = 0; i < ARRAY_SIZE(w83795_tss); i++) { | ||
1987 | j = w83795_tss_useful(data, i); | ||
1988 | if (!j) | ||
1989 | continue; | ||
1990 | err = fn(dev, &w83795_tss[i].dev_attr); | ||
1991 | if (err) | ||
1992 | return err; | ||
1993 | } | ||
1994 | |||
1878 | for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { | 1995 | for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { |
1879 | err = fn(dev, &sda_single_files[i].dev_attr); | 1996 | err = fn(dev, &sda_single_files[i].dev_attr); |
1880 | if (err) | 1997 | if (err) |
1881 | return err; | 1998 | return err; |
1882 | } | 1999 | } |
1883 | 2000 | ||
2001 | if (data->enable_beep) { | ||
2002 | for (i = 0; i < ARRAY_SIZE(sda_beep_files); i++) { | ||
2003 | err = fn(dev, &sda_beep_files[i].dev_attr); | ||
2004 | if (err) | ||
2005 | return err; | ||
2006 | } | ||
2007 | } | ||
2008 | |||
1884 | #ifdef CONFIG_SENSORS_W83795_FANCTRL | 2009 | #ifdef CONFIG_SENSORS_W83795_FANCTRL |
1885 | for (i = 0; i < data->has_pwm; i++) { | 2010 | for (i = 0; i < data->has_pwm; i++) { |
1886 | for (j = 0; j < ARRAY_SIZE(w83795_pwm[0]); j++) { | 2011 | for (j = 0; j < ARRAY_SIZE(w83795_pwm[0]); j++) { |
@@ -1899,6 +2024,8 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *, | |||
1899 | #else | 2024 | #else |
1900 | for (j = 0; j < 8; j++) { | 2025 | for (j = 0; j < 8; j++) { |
1901 | #endif | 2026 | #endif |
2027 | if (j == 7 && !data->enable_beep) | ||
2028 | continue; | ||
1902 | err = fn(dev, &w83795_temp[i][j].dev_attr); | 2029 | err = fn(dev, &w83795_temp[i][j].dev_attr); |
1903 | if (err) | 2030 | if (err) |
1904 | return err; | 2031 | return err; |
@@ -1910,6 +2037,8 @@ static int w83795_handle_files(struct device *dev, int (*fn)(struct device *, | |||
1910 | if (!(data->has_dts & (1 << i))) | 2037 | if (!(data->has_dts & (1 << i))) |
1911 | continue; | 2038 | continue; |
1912 | for (j = 0; j < ARRAY_SIZE(w83795_dts[0]); j++) { | 2039 | for (j = 0; j < ARRAY_SIZE(w83795_dts[0]); j++) { |
2040 | if (j == 7 && !data->enable_beep) | ||
2041 | continue; | ||
1913 | err = fn(dev, &w83795_dts[i][j].dev_attr); | 2042 | err = fn(dev, &w83795_dts[i][j].dev_attr); |
1914 | if (err) | 2043 | if (err) |
1915 | return err; | 2044 | return err; |
@@ -2049,6 +2178,18 @@ static int w83795_probe(struct i2c_client *client, | |||
2049 | else | 2178 | else |
2050 | data->has_pwm = 2; | 2179 | data->has_pwm = 2; |
2051 | 2180 | ||
2181 | /* Check if BEEP pin is available */ | ||
2182 | if (data->chip_type == w83795g) { | ||
2183 | /* The W83795G has a dedicated BEEP pin */ | ||
2184 | data->enable_beep = 1; | ||
2185 | } else { | ||
2186 | /* The W83795ADG has a shared pin for OVT# and BEEP, so you | ||
2187 | * can't have both */ | ||
2188 | tmp = w83795_read(client, W83795_REG_OVT_CFG); | ||
2189 | if ((tmp & OVT_CFG_SEL) == 0) | ||
2190 | data->enable_beep = 1; | ||
2191 | } | ||
2192 | |||
2052 | err = w83795_handle_files(dev, device_create_file); | 2193 | err = w83795_handle_files(dev, device_create_file); |
2053 | if (err) | 2194 | if (err) |
2054 | goto exit_remove; | 2195 | goto exit_remove; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index d231f683f576..6b4cc567645b 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -848,6 +848,18 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
848 | goto out_list; | 848 | goto out_list; |
849 | } | 849 | } |
850 | 850 | ||
851 | /* Sanity checks */ | ||
852 | if (unlikely(adap->name[0] == '\0')) { | ||
853 | pr_err("i2c-core: Attempt to register an adapter with " | ||
854 | "no name!\n"); | ||
855 | return -EINVAL; | ||
856 | } | ||
857 | if (unlikely(!adap->algo)) { | ||
858 | pr_err("i2c-core: Attempt to register adapter '%s' with " | ||
859 | "no algo!\n", adap->name); | ||
860 | return -EINVAL; | ||
861 | } | ||
862 | |||
851 | rt_mutex_init(&adap->bus_lock); | 863 | rt_mutex_init(&adap->bus_lock); |
852 | mutex_init(&adap->userspace_clients_lock); | 864 | mutex_init(&adap->userspace_clients_lock); |
853 | INIT_LIST_HEAD(&adap->userspace_clients); | 865 | INIT_LIST_HEAD(&adap->userspace_clients); |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index d32a4843fc3a..d7a4833be416 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
@@ -120,7 +120,6 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, | |||
120 | snprintf(priv->adap.name, sizeof(priv->adap.name), | 120 | snprintf(priv->adap.name, sizeof(priv->adap.name), |
121 | "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id); | 121 | "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id); |
122 | priv->adap.owner = THIS_MODULE; | 122 | priv->adap.owner = THIS_MODULE; |
123 | priv->adap.id = parent->id; | ||
124 | priv->adap.algo = &priv->algo; | 123 | priv->adap.algo = &priv->algo; |
125 | priv->adap.algo_data = priv; | 124 | priv->adap.algo_data = priv; |
126 | priv->adap.dev.parent = &parent->dev; | 125 | priv->adap.dev.parent = &parent->dev; |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 6078992da3f0..9292a15ad7c4 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/highmem.h> | 40 | #include <linux/highmem.h> |
41 | #include <linux/io.h> | 41 | #include <linux/io.h> |
42 | #include <linux/jiffies.h> | 42 | #include <linux/jiffies.h> |
43 | #include <linux/smp_lock.h> | ||
44 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
45 | 44 | ||
46 | #include "ipath_kernel.h" | 45 | #include "ipath_kernel.h" |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index cfc1d65c4577..1e1e347a7715 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -1123,7 +1123,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr) | |||
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | static int srp_queuecommand(struct scsi_cmnd *scmnd, | 1126 | static int srp_queuecommand_lck(struct scsi_cmnd *scmnd, |
1127 | void (*done)(struct scsi_cmnd *)) | 1127 | void (*done)(struct scsi_cmnd *)) |
1128 | { | 1128 | { |
1129 | struct srp_target_port *target = host_to_target(scmnd->device->host); | 1129 | struct srp_target_port *target = host_to_target(scmnd->device->host); |
@@ -1196,6 +1196,8 @@ err: | |||
1196 | return SCSI_MLQUEUE_HOST_BUSY; | 1196 | return SCSI_MLQUEUE_HOST_BUSY; |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | static DEF_SCSI_QCMD(srp_queuecommand) | ||
1200 | |||
1199 | static int srp_alloc_iu_bufs(struct srp_target_port *target) | 1201 | static int srp_alloc_iu_bufs(struct srp_target_port *target) |
1200 | { | 1202 | { |
1201 | int i; | 1203 | int i; |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7f26ca6ecf75..db409d6bd5d2 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/rcupdate.h> | 26 | #include <linux/rcupdate.h> |
27 | #include <linux/smp_lock.h> | ||
28 | #include "input-compat.h" | 27 | #include "input-compat.h" |
29 | 28 | ||
30 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); | 29 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); |
@@ -753,7 +752,7 @@ static int input_default_setkeycode(struct input_dev *dev, | |||
753 | if (index >= dev->keycodemax) | 752 | if (index >= dev->keycodemax) |
754 | return -EINVAL; | 753 | return -EINVAL; |
755 | 754 | ||
756 | if (dev->keycodesize < sizeof(dev->keycode) && | 755 | if (dev->keycodesize < sizeof(ke->keycode) && |
757 | (ke->keycode >> (dev->keycodesize * 8))) | 756 | (ke->keycode >> (dev->keycodesize * 8))) |
758 | return -EINVAL; | 757 | return -EINVAL; |
759 | 758 | ||
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index cd82bb125915..b7ba4597f7f0 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include <linux/poll.h> | 14 | #include <linux/poll.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/serio.h> | 16 | #include <linux/serio.h> |
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 57b25b84d1fc..0a619c558bfb 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
@@ -1097,7 +1097,7 @@ store_tabletPointerMode(struct device *dev, struct device_attribute *attr, const | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | static DEVICE_ATTR(pointer_mode, | 1099 | static DEVICE_ATTR(pointer_mode, |
1100 | S_IRUGO | S_IWUGO, | 1100 | S_IRUGO | S_IWUSR, |
1101 | show_tabletPointerMode, store_tabletPointerMode); | 1101 | show_tabletPointerMode, store_tabletPointerMode); |
1102 | 1102 | ||
1103 | /*********************************************************************** | 1103 | /*********************************************************************** |
@@ -1134,7 +1134,7 @@ store_tabletCoordinateMode(struct device *dev, struct device_attribute *attr, co | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | static DEVICE_ATTR(coordinate_mode, | 1136 | static DEVICE_ATTR(coordinate_mode, |
1137 | S_IRUGO | S_IWUGO, | 1137 | S_IRUGO | S_IWUSR, |
1138 | show_tabletCoordinateMode, store_tabletCoordinateMode); | 1138 | show_tabletCoordinateMode, store_tabletCoordinateMode); |
1139 | 1139 | ||
1140 | /*********************************************************************** | 1140 | /*********************************************************************** |
@@ -1176,7 +1176,7 @@ store_tabletToolMode(struct device *dev, struct device_attribute *attr, const ch | |||
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | static DEVICE_ATTR(tool_mode, | 1178 | static DEVICE_ATTR(tool_mode, |
1179 | S_IRUGO | S_IWUGO, | 1179 | S_IRUGO | S_IWUSR, |
1180 | show_tabletToolMode, store_tabletToolMode); | 1180 | show_tabletToolMode, store_tabletToolMode); |
1181 | 1181 | ||
1182 | /*********************************************************************** | 1182 | /*********************************************************************** |
@@ -1219,7 +1219,7 @@ store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char | |||
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | static DEVICE_ATTR(xtilt, | 1221 | static DEVICE_ATTR(xtilt, |
1222 | S_IRUGO | S_IWUGO, show_tabletXtilt, store_tabletXtilt); | 1222 | S_IRUGO | S_IWUSR, show_tabletXtilt, store_tabletXtilt); |
1223 | 1223 | ||
1224 | /*********************************************************************** | 1224 | /*********************************************************************** |
1225 | * support routines for the 'ytilt' file. Note that this file | 1225 | * support routines for the 'ytilt' file. Note that this file |
@@ -1261,7 +1261,7 @@ store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char | |||
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | static DEVICE_ATTR(ytilt, | 1263 | static DEVICE_ATTR(ytilt, |
1264 | S_IRUGO | S_IWUGO, show_tabletYtilt, store_tabletYtilt); | 1264 | S_IRUGO | S_IWUSR, show_tabletYtilt, store_tabletYtilt); |
1265 | 1265 | ||
1266 | /*********************************************************************** | 1266 | /*********************************************************************** |
1267 | * support routines for the 'jitter' file. Note that this file | 1267 | * support routines for the 'jitter' file. Note that this file |
@@ -1288,7 +1288,7 @@ store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const | |||
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | static DEVICE_ATTR(jitter, | 1290 | static DEVICE_ATTR(jitter, |
1291 | S_IRUGO | S_IWUGO, | 1291 | S_IRUGO | S_IWUSR, |
1292 | show_tabletJitterDelay, store_tabletJitterDelay); | 1292 | show_tabletJitterDelay, store_tabletJitterDelay); |
1293 | 1293 | ||
1294 | /*********************************************************************** | 1294 | /*********************************************************************** |
@@ -1317,7 +1317,7 @@ store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, | |||
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | static DEVICE_ATTR(delay, | 1319 | static DEVICE_ATTR(delay, |
1320 | S_IRUGO | S_IWUGO, | 1320 | S_IRUGO | S_IWUSR, |
1321 | show_tabletProgrammableDelay, store_tabletProgrammableDelay); | 1321 | show_tabletProgrammableDelay, store_tabletProgrammableDelay); |
1322 | 1322 | ||
1323 | /*********************************************************************** | 1323 | /*********************************************************************** |
@@ -1406,7 +1406,7 @@ store_tabletStylusUpper(struct device *dev, struct device_attribute *attr, const | |||
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | static DEVICE_ATTR(stylus_upper, | 1408 | static DEVICE_ATTR(stylus_upper, |
1409 | S_IRUGO | S_IWUGO, | 1409 | S_IRUGO | S_IWUSR, |
1410 | show_tabletStylusUpper, store_tabletStylusUpper); | 1410 | show_tabletStylusUpper, store_tabletStylusUpper); |
1411 | 1411 | ||
1412 | /*********************************************************************** | 1412 | /*********************************************************************** |
@@ -1437,7 +1437,7 @@ store_tabletStylusLower(struct device *dev, struct device_attribute *attr, const | |||
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | static DEVICE_ATTR(stylus_lower, | 1439 | static DEVICE_ATTR(stylus_lower, |
1440 | S_IRUGO | S_IWUGO, | 1440 | S_IRUGO | S_IWUSR, |
1441 | show_tabletStylusLower, store_tabletStylusLower); | 1441 | show_tabletStylusLower, store_tabletStylusLower); |
1442 | 1442 | ||
1443 | /*********************************************************************** | 1443 | /*********************************************************************** |
@@ -1475,7 +1475,7 @@ store_tabletMouseLeft(struct device *dev, struct device_attribute *attr, const c | |||
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | static DEVICE_ATTR(mouse_left, | 1477 | static DEVICE_ATTR(mouse_left, |
1478 | S_IRUGO | S_IWUGO, | 1478 | S_IRUGO | S_IWUSR, |
1479 | show_tabletMouseLeft, store_tabletMouseLeft); | 1479 | show_tabletMouseLeft, store_tabletMouseLeft); |
1480 | 1480 | ||
1481 | /*********************************************************************** | 1481 | /*********************************************************************** |
@@ -1505,7 +1505,7 @@ store_tabletMouseMiddle(struct device *dev, struct device_attribute *attr, const | |||
1505 | } | 1505 | } |
1506 | 1506 | ||
1507 | static DEVICE_ATTR(mouse_middle, | 1507 | static DEVICE_ATTR(mouse_middle, |
1508 | S_IRUGO | S_IWUGO, | 1508 | S_IRUGO | S_IWUSR, |
1509 | show_tabletMouseMiddle, store_tabletMouseMiddle); | 1509 | show_tabletMouseMiddle, store_tabletMouseMiddle); |
1510 | 1510 | ||
1511 | /*********************************************************************** | 1511 | /*********************************************************************** |
@@ -1535,7 +1535,7 @@ store_tabletMouseRight(struct device *dev, struct device_attribute *attr, const | |||
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | static DEVICE_ATTR(mouse_right, | 1537 | static DEVICE_ATTR(mouse_right, |
1538 | S_IRUGO | S_IWUGO, | 1538 | S_IRUGO | S_IWUSR, |
1539 | show_tabletMouseRight, store_tabletMouseRight); | 1539 | show_tabletMouseRight, store_tabletMouseRight); |
1540 | 1540 | ||
1541 | /*********************************************************************** | 1541 | /*********************************************************************** |
@@ -1567,7 +1567,7 @@ store_tabletWheel(struct device *dev, struct device_attribute *attr, const char | |||
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | static DEVICE_ATTR(wheel, | 1569 | static DEVICE_ATTR(wheel, |
1570 | S_IRUGO | S_IWUGO, show_tabletWheel, store_tabletWheel); | 1570 | S_IRUGO | S_IWUSR, show_tabletWheel, store_tabletWheel); |
1571 | 1571 | ||
1572 | /*********************************************************************** | 1572 | /*********************************************************************** |
1573 | * support routines for the 'execute' file. Note that this file | 1573 | * support routines for the 'execute' file. Note that this file |
@@ -1600,7 +1600,7 @@ store_tabletExecute(struct device *dev, struct device_attribute *attr, const cha | |||
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | static DEVICE_ATTR(execute, | 1602 | static DEVICE_ATTR(execute, |
1603 | S_IRUGO | S_IWUGO, show_tabletExecute, store_tabletExecute); | 1603 | S_IRUGO | S_IWUSR, show_tabletExecute, store_tabletExecute); |
1604 | 1604 | ||
1605 | /*********************************************************************** | 1605 | /*********************************************************************** |
1606 | * support routines for the 'odm_code' file. Note that this file | 1606 | * support routines for the 'odm_code' file. Note that this file |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index bad2cedb8d96..a28541b2b1a2 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -19,7 +19,6 @@ comment "Multimedia core support" | |||
19 | 19 | ||
20 | config VIDEO_DEV | 20 | config VIDEO_DEV |
21 | tristate "Video For Linux" | 21 | tristate "Video For Linux" |
22 | depends on BKL # used in many drivers for ioctl handling, need to kill | ||
23 | ---help--- | 22 | ---help--- |
24 | V4L core support for video capture and overlay devices, webcams and | 23 | V4L core support for video capture and overlay devices, webcams and |
25 | AM/FM radio cards. | 24 | AM/FM radio cards. |
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c index 3d88542612ea..74ee172b5bc9 100644 --- a/drivers/media/common/saa7146_i2c.c +++ b/drivers/media/common/saa7146_i2c.c | |||
@@ -391,7 +391,6 @@ static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, in | |||
391 | 391 | ||
392 | /*****************************************************************************/ | 392 | /*****************************************************************************/ |
393 | /* i2c-adapter helper functions */ | 393 | /* i2c-adapter helper functions */ |
394 | #include <linux/i2c-id.h> | ||
395 | 394 | ||
396 | /* exported algorithm data */ | 395 | /* exported algorithm data */ |
397 | static struct i2c_algorithm saa7146_algo = { | 396 | static struct i2c_algorithm saa7146_algo = { |
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 4d0646da6087..7ea517b7e186 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
41 | 40 | ||
42 | #include "dvb_ca_en50221.h" | 41 | #include "dvb_ca_en50221.h" |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 1589d5a5cb46..cad6634610ea 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/list.h> | 36 | #include <linux/list.h> |
37 | #include <linux/freezer.h> | 37 | #include <linux/freezer.h> |
38 | #include <linux/jiffies.h> | 38 | #include <linux/jiffies.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
41 | #include <asm/processor.h> | 40 | #include <asm/processor.h> |
42 | 41 | ||
diff --git a/drivers/media/dvb/frontends/dibx000_common.c b/drivers/media/dvb/frontends/dibx000_common.c index a4991026254d..2311c0a3406c 100644 --- a/drivers/media/dvb/frontends/dibx000_common.c +++ b/drivers/media/dvb/frontends/dibx000_common.c | |||
@@ -130,6 +130,7 @@ static int i2c_adapter_init(struct i2c_adapter *i2c_adap, | |||
130 | struct dibx000_i2c_master *mst) | 130 | struct dibx000_i2c_master *mst) |
131 | { | 131 | { |
132 | strncpy(i2c_adap->name, name, sizeof(i2c_adap->name)); | 132 | strncpy(i2c_adap->name, name, sizeof(i2c_adap->name)); |
133 | i2c_adap->algo = algo; | ||
133 | i2c_adap->algo_data = NULL; | 134 | i2c_adap->algo_data = NULL; |
134 | i2c_set_adapdata(i2c_adap, mst); | 135 | i2c_set_adapdata(i2c_adap, mst); |
135 | if (i2c_add_adapter(i2c_adap) < 0) | 136 | if (i2c_add_adapter(i2c_adap) < 0) |
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 4caeb163a666..3a7ef71087be 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/io.h> | 34 | #include <linux/io.h> |
35 | #include <asm/div64.h> | 35 | #include <asm/div64.h> |
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/timer.h> | 37 | #include <linux/timer.h> |
39 | #include <linux/byteorder/generic.h> | 38 | #include <linux/byteorder/generic.h> |
40 | #include <linux/firmware.h> | 39 | #include <linux/firmware.h> |
diff --git a/drivers/media/dvb/ngene/ngene-dvb.c b/drivers/media/dvb/ngene/ngene-dvb.c index 48f980b21d66..3832e5983c19 100644 --- a/drivers/media/dvb/ngene/ngene-dvb.c +++ b/drivers/media/dvb/ngene/ngene-dvb.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
36 | #include <asm/div64.h> | 36 | #include <asm/div64.h> |
37 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
38 | #include <linux/smp_lock.h> | ||
39 | #include <linux/timer.h> | 38 | #include <linux/timer.h> |
40 | #include <linux/byteorder/generic.h> | 39 | #include <linux/byteorder/generic.h> |
41 | #include <linux/firmware.h> | 40 | #include <linux/firmware.h> |
diff --git a/drivers/media/dvb/ngene/ngene-i2c.c b/drivers/media/dvb/ngene/ngene-i2c.c index c3ae956714e7..d28554f8ce99 100644 --- a/drivers/media/dvb/ngene/ngene-i2c.c +++ b/drivers/media/dvb/ngene/ngene-i2c.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/div64.h> | 37 | #include <asm/div64.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/pci_ids.h> | 39 | #include <linux/pci_ids.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/timer.h> | 40 | #include <linux/timer.h> |
42 | #include <linux/byteorder/generic.h> | 41 | #include <linux/byteorder/generic.h> |
43 | #include <linux/firmware.h> | 42 | #include <linux/firmware.h> |
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index b540e8072e92..e6b2d085a449 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <linux/module.h> | 58 | #include <linux/module.h> |
59 | #include <linux/init.h> | 59 | #include <linux/init.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
62 | #include <linux/input.h> | 61 | #include <linux/input.h> |
63 | #include <linux/videodev2.h> | 62 | #include <linux/videodev2.h> |
64 | #include <media/v4l2-device.h> | 63 | #include <media/v4l2-device.h> |
diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h index ea12782359a0..b9914d7a0c9f 100644 --- a/drivers/media/radio/si470x/radio-si470x.h +++ b/drivers/media/radio/si470x/radio-si470x.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/input.h> | 34 | #include <linux/input.h> |
36 | #include <linux/version.h> | 35 | #include <linux/version.h> |
37 | #include <linux/videodev2.h> | 36 | #include <linux/videodev2.h> |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 3da6e80e1041..a529619e51f6 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/fs.h> | 42 | #include <linux/fs.h> |
43 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
44 | #include <linux/sched.h> | 44 | #include <linux/sched.h> |
45 | #include <linux/smp_lock.h> | ||
46 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
47 | #include <linux/kdev_t.h> | 46 | #include <linux/kdev_t.h> |
48 | #include "bttvp.h" | 47 | #include "bttvp.h" |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 2934770dacc3..7bc36670071a 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -2065,8 +2065,9 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2065 | sensor_cfg.clock_speed = 45; | 2065 | sensor_cfg.clock_speed = 45; |
2066 | 2066 | ||
2067 | cam->sensor_addr = 0x42; | 2067 | cam->sensor_addr = 0x42; |
2068 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &cam->i2c_adapter, | 2068 | cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, |
2069 | NULL, "ov7670", cam->sensor_addr, NULL); | 2069 | "ov7670", "ov7670", 0, &sensor_cfg, cam->sensor_addr, |
2070 | NULL); | ||
2070 | if (cam->sensor == NULL) { | 2071 | if (cam->sensor == NULL) { |
2071 | ret = -ENODEV; | 2072 | ret = -ENODEV; |
2072 | goto out_smbus; | 2073 | goto out_smbus; |
diff --git a/drivers/media/video/cx231xx/cx231xx-417.c b/drivers/media/video/cx231xx/cx231xx-417.c index aab21f3ce472..4c7cac3b6254 100644 --- a/drivers/media/video/cx231xx/cx231xx-417.c +++ b/drivers/media/video/cx231xx/cx231xx-417.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
36 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
37 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
@@ -1927,10 +1926,9 @@ static int mpeg_open(struct file *file) | |||
1927 | dev = h; | 1926 | dev = h; |
1928 | } | 1927 | } |
1929 | 1928 | ||
1930 | if (dev == NULL) { | 1929 | if (dev == NULL) |
1931 | unlock_kernel(); | ||
1932 | return -ENODEV; | 1930 | return -ENODEV; |
1933 | } | 1931 | |
1934 | mutex_lock(&dev->lock); | 1932 | mutex_lock(&dev->lock); |
1935 | 1933 | ||
1936 | /* allocate + initialize per filehandle data */ | 1934 | /* allocate + initialize per filehandle data */ |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index a6cc12f8736c..9a98dc55f657 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
36 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
37 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
@@ -1576,12 +1575,8 @@ static int mpeg_open(struct file *file) | |||
1576 | 1575 | ||
1577 | /* allocate + initialize per filehandle data */ | 1576 | /* allocate + initialize per filehandle data */ |
1578 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1577 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
1579 | if (NULL == fh) { | 1578 | if (!fh) |
1580 | unlock_kernel(); | ||
1581 | return -ENOMEM; | 1579 | return -ENOMEM; |
1582 | } | ||
1583 | |||
1584 | lock_kernel(); | ||
1585 | 1580 | ||
1586 | file->private_data = fh; | 1581 | file->private_data = fh; |
1587 | fh->dev = dev; | 1582 | fh->dev = dev; |
@@ -1592,8 +1587,6 @@ static int mpeg_open(struct file *file) | |||
1592 | V4L2_FIELD_INTERLACED, | 1587 | V4L2_FIELD_INTERLACED, |
1593 | sizeof(struct cx23885_buffer), | 1588 | sizeof(struct cx23885_buffer), |
1594 | fh, NULL); | 1589 | fh, NULL); |
1595 | unlock_kernel(); | ||
1596 | |||
1597 | return 0; | 1590 | return 0; |
1598 | } | 1591 | } |
1599 | 1592 | ||
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 93af9c65b484..3cc9f462d08d 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
31 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
32 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
@@ -743,8 +742,6 @@ static int video_open(struct file *file) | |||
743 | if (NULL == fh) | 742 | if (NULL == fh) |
744 | return -ENOMEM; | 743 | return -ENOMEM; |
745 | 744 | ||
746 | lock_kernel(); | ||
747 | |||
748 | file->private_data = fh; | 745 | file->private_data = fh; |
749 | fh->dev = dev; | 746 | fh->dev = dev; |
750 | fh->radio = radio; | 747 | fh->radio = radio; |
@@ -762,8 +759,6 @@ static int video_open(struct file *file) | |||
762 | 759 | ||
763 | dprintk(1, "post videobuf_queue_init()\n"); | 760 | dprintk(1, "post videobuf_queue_init()\n"); |
764 | 761 | ||
765 | unlock_kernel(); | ||
766 | |||
767 | return 0; | 762 | return 0; |
768 | } | 763 | } |
769 | 764 | ||
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 417d1d5c73c4..d7c94848249e 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
35 | #include <linux/firmware.h> | 35 | #include <linux/firmware.h> |
36 | #include <linux/smp_lock.h> | ||
37 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
38 | #include <media/v4l2-ioctl.h> | 37 | #include <media/v4l2-ioctl.h> |
39 | #include <media/cx2341x.h> | 38 | #include <media/cx2341x.h> |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index d2f159daa8b5..88b51194f917 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/kmod.h> | 31 | #include <linux/kmod.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
36 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
37 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
diff --git a/drivers/media/video/imx074.c b/drivers/media/video/imx074.c index 380e459f899d..27b5dfdfbb93 100644 --- a/drivers/media/video/imx074.c +++ b/drivers/media/video/imx074.c | |||
@@ -451,7 +451,6 @@ static int imx074_probe(struct i2c_client *client, | |||
451 | ret = imx074_video_probe(icd, client); | 451 | ret = imx074_video_probe(icd, client); |
452 | if (ret < 0) { | 452 | if (ret < 0) { |
453 | icd->ops = NULL; | 453 | icd->ops = NULL; |
454 | i2c_set_clientdata(client, NULL); | ||
455 | kfree(priv); | 454 | kfree(priv); |
456 | return ret; | 455 | return ret; |
457 | } | 456 | } |
@@ -468,7 +467,6 @@ static int imx074_remove(struct i2c_client *client) | |||
468 | icd->ops = NULL; | 467 | icd->ops = NULL; |
469 | if (icl->free_bus) | 468 | if (icl->free_bus) |
470 | icl->free_bus(icl); | 469 | icl->free_bus(icl); |
471 | i2c_set_clientdata(client, NULL); | ||
472 | client->driver = NULL; | 470 | client->driver = NULL; |
473 | kfree(priv); | 471 | kfree(priv); |
474 | 472 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 5a000c65ae98..ce4a75375909 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/errno.h> | 44 | #include <linux/errno.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/i2c.h> | 46 | #include <linux/i2c.h> |
47 | #include <linux/i2c-id.h> | ||
48 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
49 | 48 | ||
50 | #include <media/ir-core.h> | 49 | #include <media/ir-core.h> |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 4a27862da30d..072bd2d1cfad 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <media/v4l2-common.h> | 32 | #include <media/v4l2-common.h> |
33 | #include <media/v4l2-dev.h> | 33 | #include <media/v4l2-dev.h> |
34 | #include <media/videobuf-core.h> | ||
34 | #include <media/videobuf-dma-contig.h> | 35 | #include <media/videobuf-dma-contig.h> |
35 | #include <media/soc_camera.h> | 36 | #include <media/soc_camera.h> |
36 | #include <media/soc_mediabus.h> | 37 | #include <media/soc_mediabus.h> |
@@ -903,8 +904,6 @@ static int mx2_camera_set_crop(struct soc_camera_device *icd, | |||
903 | static int mx2_camera_set_fmt(struct soc_camera_device *icd, | 904 | static int mx2_camera_set_fmt(struct soc_camera_device *icd, |
904 | struct v4l2_format *f) | 905 | struct v4l2_format *f) |
905 | { | 906 | { |
906 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
907 | struct mx2_camera_dev *pcdev = ici->priv; | ||
908 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 907 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
909 | const struct soc_camera_format_xlate *xlate; | 908 | const struct soc_camera_format_xlate *xlate; |
910 | struct v4l2_pix_format *pix = &f->fmt.pix; | 909 | struct v4l2_pix_format *pix = &f->fmt.pix; |
@@ -943,8 +942,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd, | |||
943 | static int mx2_camera_try_fmt(struct soc_camera_device *icd, | 942 | static int mx2_camera_try_fmt(struct soc_camera_device *icd, |
944 | struct v4l2_format *f) | 943 | struct v4l2_format *f) |
945 | { | 944 | { |
946 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
947 | struct mx2_camera_dev *pcdev = ici->priv; | ||
948 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 945 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
949 | const struct soc_camera_format_xlate *xlate; | 946 | const struct soc_camera_format_xlate *xlate; |
950 | struct v4l2_pix_format *pix = &f->fmt.pix; | 947 | struct v4l2_pix_format *pix = &f->fmt.pix; |
@@ -1024,13 +1021,13 @@ static int mx2_camera_querycap(struct soc_camera_host *ici, | |||
1024 | return 0; | 1021 | return 0; |
1025 | } | 1022 | } |
1026 | 1023 | ||
1027 | static int mx2_camera_reqbufs(struct soc_camera_file *icf, | 1024 | static int mx2_camera_reqbufs(struct soc_camera_device *icd, |
1028 | struct v4l2_requestbuffers *p) | 1025 | struct v4l2_requestbuffers *p) |
1029 | { | 1026 | { |
1030 | int i; | 1027 | int i; |
1031 | 1028 | ||
1032 | for (i = 0; i < p->count; i++) { | 1029 | for (i = 0; i < p->count; i++) { |
1033 | struct mx2_buffer *buf = container_of(icf->vb_vidq.bufs[i], | 1030 | struct mx2_buffer *buf = container_of(icd->vb_vidq.bufs[i], |
1034 | struct mx2_buffer, vb); | 1031 | struct mx2_buffer, vb); |
1035 | INIT_LIST_HEAD(&buf->vb.queue); | 1032 | INIT_LIST_HEAD(&buf->vb.queue); |
1036 | } | 1033 | } |
@@ -1151,9 +1148,9 @@ err_out: | |||
1151 | 1148 | ||
1152 | static unsigned int mx2_camera_poll(struct file *file, poll_table *pt) | 1149 | static unsigned int mx2_camera_poll(struct file *file, poll_table *pt) |
1153 | { | 1150 | { |
1154 | struct soc_camera_file *icf = file->private_data; | 1151 | struct soc_camera_device *icd = file->private_data; |
1155 | 1152 | ||
1156 | return videobuf_poll_stream(file, &icf->vb_vidq, pt); | 1153 | return videobuf_poll_stream(file, &icd->vb_vidq, pt); |
1157 | } | 1154 | } |
1158 | 1155 | ||
1159 | static struct soc_camera_host_ops mx2_soc_camera_host_ops = { | 1156 | static struct soc_camera_host_ops mx2_soc_camera_host_ops = { |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 29c5fc348133..aa871c2936b3 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <mach/ipu.h> | 28 | #include <mach/ipu.h> |
29 | #include <mach/mx3_camera.h> | 29 | #include <mach/mx3_camera.h> |
30 | #include <mach/dma.h> | ||
30 | 31 | ||
31 | #define MX3_CAM_DRV_NAME "mx3-camera" | 32 | #define MX3_CAM_DRV_NAME "mx3-camera" |
32 | 33 | ||
@@ -638,6 +639,9 @@ static bool chan_filter(struct dma_chan *chan, void *arg) | |||
638 | struct dma_chan_request *rq = arg; | 639 | struct dma_chan_request *rq = arg; |
639 | struct mx3_camera_pdata *pdata; | 640 | struct mx3_camera_pdata *pdata; |
640 | 641 | ||
642 | if (!imx_dma_is_ipu(chan)) | ||
643 | return false; | ||
644 | |||
641 | if (!rq) | 645 | if (!rq) |
642 | return false; | 646 | return false; |
643 | 647 | ||
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index 7c30e62b50db..cbfd07f2d9da 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c | |||
@@ -235,7 +235,7 @@ static void free_buffer(struct videobuf_queue *vq, struct omap1_cam_buf *buf, | |||
235 | 235 | ||
236 | BUG_ON(in_interrupt()); | 236 | BUG_ON(in_interrupt()); |
237 | 237 | ||
238 | videobuf_waiton(vb, 0, 0); | 238 | videobuf_waiton(vq, vb, 0, 0); |
239 | 239 | ||
240 | if (vb_mode == OMAP1_CAM_DMA_CONTIG) { | 240 | if (vb_mode == OMAP1_CAM_DMA_CONTIG) { |
241 | videobuf_dma_contig_free(vq, vb); | 241 | videobuf_dma_contig_free(vq, vb); |
@@ -504,7 +504,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq, | |||
504 | * empty. Since the transfer of the DMA programming register set | 504 | * empty. Since the transfer of the DMA programming register set |
505 | * content to the DMA working register set is done automatically | 505 | * content to the DMA working register set is done automatically |
506 | * by the DMA hardware, this can pretty well happen while we | 506 | * by the DMA hardware, this can pretty well happen while we |
507 | * are keeping the lock here. Levae fetching it from the queue | 507 | * are keeping the lock here. Leave fetching it from the queue |
508 | * to be done when a next DMA interrupt occures instead. | 508 | * to be done when a next DMA interrupt occures instead. |
509 | */ | 509 | */ |
510 | return; | 510 | return; |
@@ -1365,12 +1365,12 @@ static void omap1_cam_init_videobuf(struct videobuf_queue *q, | |||
1365 | videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, | 1365 | videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, |
1366 | icd->dev.parent, &pcdev->lock, | 1366 | icd->dev.parent, &pcdev->lock, |
1367 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 1367 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
1368 | sizeof(struct omap1_cam_buf), icd); | 1368 | sizeof(struct omap1_cam_buf), icd, NULL); |
1369 | else | 1369 | else |
1370 | videobuf_queue_sg_init(q, &omap1_videobuf_ops, | 1370 | videobuf_queue_sg_init(q, &omap1_videobuf_ops, |
1371 | icd->dev.parent, &pcdev->lock, | 1371 | icd->dev.parent, &pcdev->lock, |
1372 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 1372 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
1373 | sizeof(struct omap1_cam_buf), icd); | 1373 | sizeof(struct omap1_cam_buf), icd, NULL); |
1374 | 1374 | ||
1375 | /* use videobuf mode (auto)selected with the module parameter */ | 1375 | /* use videobuf mode (auto)selected with the module parameter */ |
1376 | pcdev->vb_mode = sg_mode ? OMAP1_CAM_DMA_SG : OMAP1_CAM_DMA_CONTIG; | 1376 | pcdev->vb_mode = sg_mode ? OMAP1_CAM_DMA_SG : OMAP1_CAM_DMA_CONTIG; |
@@ -1386,7 +1386,7 @@ static void omap1_cam_init_videobuf(struct videobuf_queue *q, | |||
1386 | } | 1386 | } |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | static int omap1_cam_reqbufs(struct soc_camera_file *icf, | 1389 | static int omap1_cam_reqbufs(struct soc_camera_device *icd, |
1390 | struct v4l2_requestbuffers *p) | 1390 | struct v4l2_requestbuffers *p) |
1391 | { | 1391 | { |
1392 | int i; | 1392 | int i; |
@@ -1398,7 +1398,7 @@ static int omap1_cam_reqbufs(struct soc_camera_file *icf, | |||
1398 | * it hadn't triggered | 1398 | * it hadn't triggered |
1399 | */ | 1399 | */ |
1400 | for (i = 0; i < p->count; i++) { | 1400 | for (i = 0; i < p->count; i++) { |
1401 | struct omap1_cam_buf *buf = container_of(icf->vb_vidq.bufs[i], | 1401 | struct omap1_cam_buf *buf = container_of(icd->vb_vidq.bufs[i], |
1402 | struct omap1_cam_buf, vb); | 1402 | struct omap1_cam_buf, vb); |
1403 | buf->inwork = 0; | 1403 | buf->inwork = 0; |
1404 | INIT_LIST_HEAD(&buf->vb.queue); | 1404 | INIT_LIST_HEAD(&buf->vb.queue); |
@@ -1485,10 +1485,10 @@ static int omap1_cam_set_bus_param(struct soc_camera_device *icd, | |||
1485 | 1485 | ||
1486 | static unsigned int omap1_cam_poll(struct file *file, poll_table *pt) | 1486 | static unsigned int omap1_cam_poll(struct file *file, poll_table *pt) |
1487 | { | 1487 | { |
1488 | struct soc_camera_file *icf = file->private_data; | 1488 | struct soc_camera_device *icd = file->private_data; |
1489 | struct omap1_cam_buf *buf; | 1489 | struct omap1_cam_buf *buf; |
1490 | 1490 | ||
1491 | buf = list_entry(icf->vb_vidq.stream.next, struct omap1_cam_buf, | 1491 | buf = list_entry(icd->vb_vidq.stream.next, struct omap1_cam_buf, |
1492 | vb.stream); | 1492 | vb.stream); |
1493 | 1493 | ||
1494 | poll_wait(file, &buf->vb.done, pt); | 1494 | poll_wait(file, &buf->vb.done, pt); |
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index b7cfeab0948c..cf93de988068 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
@@ -754,7 +754,7 @@ static int ov6650_g_fmt(struct v4l2_subdev *sd, | |||
754 | 754 | ||
755 | static bool is_unscaled_ok(int width, int height, struct v4l2_rect *rect) | 755 | static bool is_unscaled_ok(int width, int height, struct v4l2_rect *rect) |
756 | { | 756 | { |
757 | return (width > rect->width >> 1 || height > rect->height >> 1); | 757 | return width > rect->width >> 1 || height > rect->height >> 1; |
758 | } | 758 | } |
759 | 759 | ||
760 | static u8 to_clkrc(struct v4l2_fract *timeperframe, | 760 | static u8 to_clkrc(struct v4l2_fract *timeperframe, |
@@ -840,8 +840,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) | |||
840 | coma_mask |= COMA_BW | COMA_BYTE_SWAP | COMA_WORD_SWAP; | 840 | coma_mask |= COMA_BW | COMA_BYTE_SWAP | COMA_WORD_SWAP; |
841 | coma_set |= COMA_RAW_RGB | COMA_RGB; | 841 | coma_set |= COMA_RAW_RGB | COMA_RGB; |
842 | break; | 842 | break; |
843 | case 0: | ||
844 | break; | ||
845 | default: | 843 | default: |
846 | dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); | 844 | dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); |
847 | return -EINVAL; | 845 | return -EINVAL; |
@@ -1176,7 +1174,6 @@ static int ov6650_probe(struct i2c_client *client, | |||
1176 | 1174 | ||
1177 | if (ret) { | 1175 | if (ret) { |
1178 | icd->ops = NULL; | 1176 | icd->ops = NULL; |
1179 | i2c_set_clientdata(client, NULL); | ||
1180 | kfree(priv); | 1177 | kfree(priv); |
1181 | } | 1178 | } |
1182 | 1179 | ||
@@ -1187,7 +1184,6 @@ static int ov6650_remove(struct i2c_client *client) | |||
1187 | { | 1184 | { |
1188 | struct ov6650 *priv = to_ov6650(client); | 1185 | struct ov6650 *priv = to_ov6650(client); |
1189 | 1186 | ||
1190 | i2c_set_clientdata(client, NULL); | ||
1191 | kfree(priv); | 1187 | kfree(priv); |
1192 | return 0; | 1188 | return 0; |
1193 | } | 1189 | } |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index e62beb4efdb4..f3dc89da4c4e 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #include <linux/module.h> | 62 | #include <linux/module.h> |
63 | #include <linux/poll.h> | 63 | #include <linux/poll.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
66 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 65 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
67 | #include <linux/usb/input.h> | 66 | #include <linux/usb/input.h> |
68 | #endif | 67 | #endif |
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index f5a46c458717..a845753665c1 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/videodev2.h> | 49 | #include <linux/videodev2.h> |
50 | #include <linux/version.h> | 50 | #include <linux/version.h> |
51 | #include <linux/mm.h> | 51 | #include <linux/mm.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <media/videobuf-vmalloc.h> | 52 | #include <media/videobuf-vmalloc.h> |
54 | #include <media/v4l2-common.h> | 53 | #include <media/v4l2-common.h> |
55 | #include <media/v4l2-device.h> | 54 | #include <media/v4l2-device.h> |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 10a6cbf6a790..0911cb580e18 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -6661,6 +6661,18 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
6661 | .subdevice = 0x2804, | 6661 | .subdevice = 0x2804, |
6662 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, | 6662 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, |
6663 | }, { | 6663 | }, { |
6664 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6665 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6666 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6667 | .subdevice = 0x7190, | ||
6668 | .driver_data = SAA7134_BOARD_BEHOLD_H7, | ||
6669 | }, { | ||
6670 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6671 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6672 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6673 | .subdevice = 0x7090, | ||
6674 | .driver_data = SAA7134_BOARD_BEHOLD_A7, | ||
6675 | }, { | ||
6664 | /* --- boards without eeprom + subsystem ID --- */ | 6676 | /* --- boards without eeprom + subsystem ID --- */ |
6665 | .vendor = PCI_VENDOR_ID_PHILIPS, | 6677 | .vendor = PCI_VENDOR_ID_PHILIPS, |
6666 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 6678 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
@@ -6698,18 +6710,6 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
6698 | .subvendor = PCI_ANY_ID, | 6710 | .subvendor = PCI_ANY_ID, |
6699 | .subdevice = PCI_ANY_ID, | 6711 | .subdevice = PCI_ANY_ID, |
6700 | .driver_data = SAA7134_BOARD_UNKNOWN, | 6712 | .driver_data = SAA7134_BOARD_UNKNOWN, |
6701 | }, { | ||
6702 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6703 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6704 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6705 | .subdevice = 0x7190, | ||
6706 | .driver_data = SAA7134_BOARD_BEHOLD_H7, | ||
6707 | }, { | ||
6708 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6709 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6710 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6711 | .subdevice = 0x7090, | ||
6712 | .driver_data = SAA7134_BOARD_BEHOLD_A7, | ||
6713 | },{ | 6713 | },{ |
6714 | /* --- end of list --- */ | 6714 | /* --- end of list --- */ |
6715 | } | 6715 | } |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 1467a30a434f..b890aafe7d64 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
26 | 25 | ||
27 | #include "saa7134-reg.h" | 26 | #include "saa7134-reg.h" |
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h index 1d9c5cbbbc52..041ae8e20f68 100644 --- a/drivers/media/video/saa7164/saa7164.h +++ b/drivers/media/video/saa7164/saa7164.h | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <media/tveeprom.h> | 58 | #include <media/tveeprom.h> |
59 | #include <media/videobuf-dma-sg.h> | 59 | #include <media/videobuf-dma-sg.h> |
60 | #include <media/videobuf-dvb.h> | 60 | #include <media/videobuf-dvb.h> |
61 | #include <linux/smp_lock.h> | ||
62 | #include <dvb_demux.h> | 61 | #include <dvb_demux.h> |
63 | #include <dvb_frontend.h> | 62 | #include <dvb_frontend.h> |
64 | #include <dvb_net.h> | 63 | #include <dvb_net.h> |
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index 41d0166c0f95..41360d7c3e96 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -31,7 +31,6 @@ static const char version[] = "0.24"; | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/pagemap.h> | 34 | #include <linux/pagemap.h> |
36 | #include <linux/usb.h> | 35 | #include <linux/usb.h> |
37 | #include "se401.h" | 36 | #include "se401.h" |
@@ -951,9 +950,9 @@ static int se401_open(struct file *file) | |||
951 | struct usb_se401 *se401 = (struct usb_se401 *)dev; | 950 | struct usb_se401 *se401 = (struct usb_se401 *)dev; |
952 | int err = 0; | 951 | int err = 0; |
953 | 952 | ||
954 | lock_kernel(); | 953 | mutex_lock(&se401->lock); |
955 | if (se401->user) { | 954 | if (se401->user) { |
956 | unlock_kernel(); | 955 | mutex_unlock(&se401->lock); |
957 | return -EBUSY; | 956 | return -EBUSY; |
958 | } | 957 | } |
959 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); | 958 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); |
@@ -962,7 +961,7 @@ static int se401_open(struct file *file) | |||
962 | else | 961 | else |
963 | err = -ENOMEM; | 962 | err = -ENOMEM; |
964 | se401->user = !err; | 963 | se401->user = !err; |
965 | unlock_kernel(); | 964 | mutex_unlock(&se401->lock); |
966 | 965 | ||
967 | return err; | 966 | return err; |
968 | } | 967 | } |
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index f07a0f6b71c4..b5afe5f841ce 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/smp_lock.h> | ||
31 | 30 | ||
32 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
33 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
@@ -673,14 +672,11 @@ static int v4l_stk_open(struct file *fp) | |||
673 | vdev = video_devdata(fp); | 672 | vdev = video_devdata(fp); |
674 | dev = vdev_to_camera(vdev); | 673 | dev = vdev_to_camera(vdev); |
675 | 674 | ||
676 | lock_kernel(); | ||
677 | if (dev == NULL || !is_present(dev)) { | 675 | if (dev == NULL || !is_present(dev)) { |
678 | unlock_kernel(); | ||
679 | return -ENXIO; | 676 | return -ENXIO; |
680 | } | 677 | } |
681 | fp->private_data = dev; | 678 | fp->private_data = dev; |
682 | usb_autopm_get_interface(dev->interface); | 679 | usb_autopm_get_interface(dev->interface); |
683 | unlock_kernel(); | ||
684 | 680 | ||
685 | return 0; | 681 | return 0; |
686 | } | 682 | } |
diff --git a/drivers/media/video/tlg2300/pd-main.c b/drivers/media/video/tlg2300/pd-main.c index 4555f4a5f4c8..c91424c0c135 100644 --- a/drivers/media/video/tlg2300/pd-main.c +++ b/drivers/media/video/tlg2300/pd-main.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/string.h> | 36 | #include <linux/string.h> |
37 | #include <linux/types.h> | 37 | #include <linux/types.h> |
38 | #include <linux/firmware.h> | 38 | #include <linux/firmware.h> |
39 | #include <linux/smp_lock.h> | ||
40 | 39 | ||
41 | #include "vendorcmds.h" | 40 | #include "vendorcmds.h" |
42 | #include "pd-common.h" | 41 | #include "pd-common.h" |
@@ -485,15 +484,11 @@ static void poseidon_disconnect(struct usb_interface *interface) | |||
485 | /*unregister v4l2 device */ | 484 | /*unregister v4l2 device */ |
486 | v4l2_device_unregister(&pd->v4l2_dev); | 485 | v4l2_device_unregister(&pd->v4l2_dev); |
487 | 486 | ||
488 | lock_kernel(); | 487 | pd_dvb_usb_device_exit(pd); |
489 | { | 488 | poseidon_fm_exit(pd); |
490 | pd_dvb_usb_device_exit(pd); | ||
491 | poseidon_fm_exit(pd); | ||
492 | 489 | ||
493 | poseidon_audio_free(pd); | 490 | poseidon_audio_free(pd); |
494 | pd_video_exit(pd); | 491 | pd_video_exit(pd); |
495 | } | ||
496 | unlock_kernel(); | ||
497 | 492 | ||
498 | usb_set_intfdata(interface, NULL); | 493 | usb_set_intfdata(interface, NULL); |
499 | kref_put(&pd->kref, poseidon_delete); | 494 | kref_put(&pd->kref, poseidon_delete); |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 5d6fd01f918a..dc17cce2fbb6 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/mm.h> | 44 | #include <linux/mm.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
48 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
49 | #include <linux/ihex.h> | 48 | #include <linux/ihex.h> |
@@ -483,29 +482,28 @@ vicam_open(struct file *file) | |||
483 | return -EINVAL; | 482 | return -EINVAL; |
484 | } | 483 | } |
485 | 484 | ||
486 | /* the videodev_lock held above us protects us from | 485 | /* cam_lock/open_count protects us from simultaneous opens |
487 | * simultaneous opens...for now. we probably shouldn't | 486 | * ... for now. we probably shouldn't rely on this fact forever. |
488 | * rely on this fact forever. | ||
489 | */ | 487 | */ |
490 | 488 | ||
491 | lock_kernel(); | 489 | mutex_lock(&cam->cam_lock); |
492 | if (cam->open_count > 0) { | 490 | if (cam->open_count > 0) { |
493 | printk(KERN_INFO | 491 | printk(KERN_INFO |
494 | "vicam_open called on already opened camera"); | 492 | "vicam_open called on already opened camera"); |
495 | unlock_kernel(); | 493 | mutex_unlock(&cam->cam_lock); |
496 | return -EBUSY; | 494 | return -EBUSY; |
497 | } | 495 | } |
498 | 496 | ||
499 | cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); | 497 | cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); |
500 | if (!cam->raw_image) { | 498 | if (!cam->raw_image) { |
501 | unlock_kernel(); | 499 | mutex_unlock(&cam->cam_lock); |
502 | return -ENOMEM; | 500 | return -ENOMEM; |
503 | } | 501 | } |
504 | 502 | ||
505 | cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); | 503 | cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); |
506 | if (!cam->framebuf) { | 504 | if (!cam->framebuf) { |
507 | kfree(cam->raw_image); | 505 | kfree(cam->raw_image); |
508 | unlock_kernel(); | 506 | mutex_unlock(&cam->cam_lock); |
509 | return -ENOMEM; | 507 | return -ENOMEM; |
510 | } | 508 | } |
511 | 509 | ||
@@ -513,10 +511,17 @@ vicam_open(struct file *file) | |||
513 | if (!cam->cntrlbuf) { | 511 | if (!cam->cntrlbuf) { |
514 | kfree(cam->raw_image); | 512 | kfree(cam->raw_image); |
515 | rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); | 513 | rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); |
516 | unlock_kernel(); | 514 | mutex_unlock(&cam->cam_lock); |
517 | return -ENOMEM; | 515 | return -ENOMEM; |
518 | } | 516 | } |
519 | 517 | ||
518 | cam->needsDummyRead = 1; | ||
519 | cam->open_count++; | ||
520 | |||
521 | file->private_data = cam; | ||
522 | mutex_unlock(&cam->cam_lock); | ||
523 | |||
524 | |||
520 | // First upload firmware, then turn the camera on | 525 | // First upload firmware, then turn the camera on |
521 | 526 | ||
522 | if (!cam->is_initialized) { | 527 | if (!cam->is_initialized) { |
@@ -527,12 +532,6 @@ vicam_open(struct file *file) | |||
527 | 532 | ||
528 | set_camera_power(cam, 1); | 533 | set_camera_power(cam, 1); |
529 | 534 | ||
530 | cam->needsDummyRead = 1; | ||
531 | cam->open_count++; | ||
532 | |||
533 | file->private_data = cam; | ||
534 | unlock_kernel(); | ||
535 | |||
536 | return 0; | 535 | return 0; |
537 | } | 536 | } |
538 | 537 | ||
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index db6b828594f5..011c0c386995 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/list.h> | 50 | #include <linux/list.h> |
51 | #include <linux/timer.h> | 51 | #include <linux/timer.h> |
52 | #include <linux/slab.h> | 52 | #include <linux/slab.h> |
53 | #include <linux/smp_lock.h> | ||
54 | #include <linux/mm.h> | 53 | #include <linux/mm.h> |
55 | #include <linux/highmem.h> | 54 | #include <linux/highmem.h> |
56 | #include <linux/vmalloc.h> | 55 | #include <linux/vmalloc.h> |
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 86294ed35c9b..e30e8dfb6205 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/videodev.h> | 18 | #include <linux/videodev.h> |
19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <media/v4l2-ioctl.h> | 21 | #include <media/v4l2-ioctl.h> |
23 | 22 | ||
24 | #ifdef CONFIG_COMPAT | 23 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 0ca7978654b5..03f7f4670e9b 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
31 | 30 | ||
@@ -247,10 +246,12 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
247 | mutex_unlock(vdev->lock); | 246 | mutex_unlock(vdev->lock); |
248 | } else if (vdev->fops->ioctl) { | 247 | } else if (vdev->fops->ioctl) { |
249 | /* TODO: convert all drivers to unlocked_ioctl */ | 248 | /* TODO: convert all drivers to unlocked_ioctl */ |
250 | lock_kernel(); | 249 | static DEFINE_MUTEX(v4l2_ioctl_mutex); |
250 | |||
251 | mutex_lock(&v4l2_ioctl_mutex); | ||
251 | if (video_is_registered(vdev)) | 252 | if (video_is_registered(vdev)) |
252 | ret = vdev->fops->ioctl(filp, cmd, arg); | 253 | ret = vdev->fops->ioctl(filp, cmd, arg); |
253 | unlock_kernel(); | 254 | mutex_unlock(&v4l2_ioctl_mutex); |
254 | } else | 255 | } else |
255 | ret = -ENOTTY; | 256 | ret = -ENOTTY; |
256 | 257 | ||
diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h index 37fe16181e3c..27f05551183f 100644 --- a/drivers/media/video/zoran/zoran.h +++ b/drivers/media/video/zoran/zoran.h | |||
@@ -388,6 +388,7 @@ struct zoran { | |||
388 | struct videocodec *vfe; /* video front end */ | 388 | struct videocodec *vfe; /* video front end */ |
389 | 389 | ||
390 | struct mutex resource_lock; /* prevent evil stuff */ | 390 | struct mutex resource_lock; /* prevent evil stuff */ |
391 | struct mutex other_lock; /* please merge with above */ | ||
391 | 392 | ||
392 | u8 initialized; /* flag if zoran has been correctly initialized */ | 393 | u8 initialized; /* flag if zoran has been correctly initialized */ |
393 | int user; /* number of current users */ | 394 | int user; /* number of current users */ |
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 0aac376c3f7a..7e6d62467eaa 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -1227,6 +1227,7 @@ static int __devinit zoran_probe(struct pci_dev *pdev, | |||
1227 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id); | 1227 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id); |
1228 | spin_lock_init(&zr->spinlock); | 1228 | spin_lock_init(&zr->spinlock); |
1229 | mutex_init(&zr->resource_lock); | 1229 | mutex_init(&zr->resource_lock); |
1230 | mutex_init(&zr->other_lock); | ||
1230 | if (pci_enable_device(pdev)) | 1231 | if (pci_enable_device(pdev)) |
1231 | goto zr_unreg; | 1232 | goto zr_unreg; |
1232 | pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, &zr->revision); | 1233 | pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, &zr->revision); |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 401082b853f0..67a52e844ae6 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
54 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
55 | #include <linux/wait.h> | 54 | #include <linux/wait.h> |
@@ -913,7 +912,7 @@ static int zoran_open(struct file *file) | |||
913 | dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", | 912 | dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", |
914 | ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); | 913 | ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); |
915 | 914 | ||
916 | lock_kernel(); | 915 | mutex_lock(&zr->other_lock); |
917 | 916 | ||
918 | if (zr->user >= 2048) { | 917 | if (zr->user >= 2048) { |
919 | dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", | 918 | dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", |
@@ -963,14 +962,14 @@ static int zoran_open(struct file *file) | |||
963 | file->private_data = fh; | 962 | file->private_data = fh; |
964 | fh->zr = zr; | 963 | fh->zr = zr; |
965 | zoran_open_init_session(fh); | 964 | zoran_open_init_session(fh); |
966 | unlock_kernel(); | 965 | mutex_unlock(&zr->other_lock); |
967 | 966 | ||
968 | return 0; | 967 | return 0; |
969 | 968 | ||
970 | fail_fh: | 969 | fail_fh: |
971 | kfree(fh); | 970 | kfree(fh); |
972 | fail_unlock: | 971 | fail_unlock: |
973 | unlock_kernel(); | 972 | mutex_unlock(&zr->other_lock); |
974 | 973 | ||
975 | dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", | 974 | dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", |
976 | ZR_DEVNAME(zr), res, zr->user); | 975 | ZR_DEVNAME(zr), res, zr->user); |
@@ -989,7 +988,7 @@ zoran_close(struct file *file) | |||
989 | 988 | ||
990 | /* kernel locks (fs/device.c), so don't do that ourselves | 989 | /* kernel locks (fs/device.c), so don't do that ourselves |
991 | * (prevents deadlocks) */ | 990 | * (prevents deadlocks) */ |
992 | /*mutex_lock(&zr->resource_lock);*/ | 991 | mutex_lock(&zr->other_lock); |
993 | 992 | ||
994 | zoran_close_end_session(fh); | 993 | zoran_close_end_session(fh); |
995 | 994 | ||
@@ -1023,6 +1022,7 @@ zoran_close(struct file *file) | |||
1023 | encoder_call(zr, video, s_routing, 2, 0, 0); | 1022 | encoder_call(zr, video, s_routing, 2, 0, 0); |
1024 | } | 1023 | } |
1025 | } | 1024 | } |
1025 | mutex_unlock(&zr->other_lock); | ||
1026 | 1026 | ||
1027 | file->private_data = NULL; | 1027 | file->private_data = NULL; |
1028 | kfree(fh->overlay_mask); | 1028 | kfree(fh->overlay_mask); |
@@ -3370,11 +3370,26 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { | |||
3370 | #endif | 3370 | #endif |
3371 | }; | 3371 | }; |
3372 | 3372 | ||
3373 | /* please use zr->resource_lock consistently and kill this wrapper */ | ||
3374 | static long zoran_ioctl(struct file *file, unsigned int cmd, | ||
3375 | unsigned long arg) | ||
3376 | { | ||
3377 | struct zoran_fh *fh = file->private_data; | ||
3378 | struct zoran *zr = fh->zr; | ||
3379 | int ret; | ||
3380 | |||
3381 | mutex_lock(&zr->other_lock); | ||
3382 | ret = video_ioctl2(file, cmd, arg); | ||
3383 | mutex_unlock(&zr->other_lock); | ||
3384 | |||
3385 | return ret; | ||
3386 | } | ||
3387 | |||
3373 | static const struct v4l2_file_operations zoran_fops = { | 3388 | static const struct v4l2_file_operations zoran_fops = { |
3374 | .owner = THIS_MODULE, | 3389 | .owner = THIS_MODULE, |
3375 | .open = zoran_open, | 3390 | .open = zoran_open, |
3376 | .release = zoran_close, | 3391 | .release = zoran_close, |
3377 | .ioctl = video_ioctl2, | 3392 | .unlocked_ioctl = zoran_ioctl, |
3378 | .read = zoran_read, | 3393 | .read = zoran_read, |
3379 | .write = zoran_write, | 3394 | .write = zoran_write, |
3380 | .mmap = zoran_mmap, | 3395 | .mmap = zoran_mmap, |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index e15220ff52fc..d784c36707c0 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -97,8 +97,7 @@ static u8 mptfcInternalCtx = MPT_MAX_PROTOCOL_DRIVERS; | |||
97 | 97 | ||
98 | static int mptfc_target_alloc(struct scsi_target *starget); | 98 | static int mptfc_target_alloc(struct scsi_target *starget); |
99 | static int mptfc_slave_alloc(struct scsi_device *sdev); | 99 | static int mptfc_slave_alloc(struct scsi_device *sdev); |
100 | static int mptfc_qcmd(struct scsi_cmnd *SCpnt, | 100 | static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt); |
101 | void (*done)(struct scsi_cmnd *)); | ||
102 | static void mptfc_target_destroy(struct scsi_target *starget); | 101 | static void mptfc_target_destroy(struct scsi_target *starget); |
103 | static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); | 102 | static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); |
104 | static void __devexit mptfc_remove(struct pci_dev *pdev); | 103 | static void __devexit mptfc_remove(struct pci_dev *pdev); |
@@ -650,7 +649,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
650 | } | 649 | } |
651 | 650 | ||
652 | static int | 651 | static int |
653 | mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 652 | mptfc_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
654 | { | 653 | { |
655 | struct mptfc_rport_info *ri; | 654 | struct mptfc_rport_info *ri; |
656 | struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); | 655 | struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); |
@@ -681,6 +680,8 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
681 | return mptscsih_qcmd(SCpnt,done); | 680 | return mptscsih_qcmd(SCpnt,done); |
682 | } | 681 | } |
683 | 682 | ||
683 | static DEF_SCSI_QCMD(mptfc_qcmd) | ||
684 | |||
684 | /* | 685 | /* |
685 | * mptfc_display_port_link_speed - displaying link speed | 686 | * mptfc_display_port_link_speed - displaying link speed |
686 | * @ioc: Pointer to MPT_ADAPTER structure | 687 | * @ioc: Pointer to MPT_ADAPTER structure |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 83a5115f0251..d48c2c6058e1 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -1889,7 +1889,7 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | static int | 1891 | static int |
1892 | mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 1892 | mptsas_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
1893 | { | 1893 | { |
1894 | MPT_SCSI_HOST *hd; | 1894 | MPT_SCSI_HOST *hd; |
1895 | MPT_ADAPTER *ioc; | 1895 | MPT_ADAPTER *ioc; |
@@ -1913,6 +1913,8 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1913 | return mptscsih_qcmd(SCpnt,done); | 1913 | return mptscsih_qcmd(SCpnt,done); |
1914 | } | 1914 | } |
1915 | 1915 | ||
1916 | static DEF_SCSI_QCMD(mptsas_qcmd) | ||
1917 | |||
1916 | /** | 1918 | /** |
1917 | * mptsas_mptsas_eh_timed_out - resets the scsi_cmnd timeout | 1919 | * mptsas_mptsas_eh_timed_out - resets the scsi_cmnd timeout |
1918 | * if the device under question is currently in the | 1920 | * if the device under question is currently in the |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 0e2803155ae2..6d9568d2ec59 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -780,7 +780,7 @@ static int mptspi_slave_configure(struct scsi_device *sdev) | |||
780 | } | 780 | } |
781 | 781 | ||
782 | static int | 782 | static int |
783 | mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 783 | mptspi_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
784 | { | 784 | { |
785 | struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host); | 785 | struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host); |
786 | VirtDevice *vdevice = SCpnt->device->hostdata; | 786 | VirtDevice *vdevice = SCpnt->device->hostdata; |
@@ -805,6 +805,8 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
805 | return mptscsih_qcmd(SCpnt,done); | 805 | return mptscsih_qcmd(SCpnt,done); |
806 | } | 806 | } |
807 | 807 | ||
808 | static DEF_SCSI_QCMD(mptspi_qcmd) | ||
809 | |||
808 | static void mptspi_slave_destroy(struct scsi_device *sdev) | 810 | static void mptspi_slave_destroy(struct scsi_device *sdev) |
809 | { | 811 | { |
810 | struct scsi_target *starget = scsi_target(sdev); | 812 | struct scsi_target *starget = scsi_target(sdev); |
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index ea6b2197da8a..97bdf82ec905 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c | |||
@@ -506,7 +506,7 @@ static struct i2o_driver i2o_scsi_driver = { | |||
506 | * Locks: takes the controller lock on error path only | 506 | * Locks: takes the controller lock on error path only |
507 | */ | 507 | */ |
508 | 508 | ||
509 | static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | 509 | static int i2o_scsi_queuecommand_lck(struct scsi_cmnd *SCpnt, |
510 | void (*done) (struct scsi_cmnd *)) | 510 | void (*done) (struct scsi_cmnd *)) |
511 | { | 511 | { |
512 | struct i2o_controller *c; | 512 | struct i2o_controller *c; |
@@ -688,7 +688,9 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
688 | 688 | ||
689 | exit: | 689 | exit: |
690 | return rc; | 690 | return rc; |
691 | }; | 691 | } |
692 | |||
693 | static DEF_SCSI_QCMD(i2o_scsi_queuecommand) | ||
692 | 694 | ||
693 | /** | 695 | /** |
694 | * i2o_scsi_abort - abort a running command | 696 | * i2o_scsi_abort - abort a running command |
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c index 0ed09358027e..644d4cd071cc 100644 --- a/drivers/misc/apds9802als.c +++ b/drivers/misc/apds9802als.c | |||
@@ -251,7 +251,6 @@ static int apds9802als_probe(struct i2c_client *client, | |||
251 | 251 | ||
252 | return res; | 252 | return res; |
253 | als_error1: | 253 | als_error1: |
254 | i2c_set_clientdata(client, NULL); | ||
255 | kfree(data); | 254 | kfree(data); |
256 | return res; | 255 | return res; |
257 | } | 256 | } |
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c index a38a7bd25f19..b9aedf18a046 100644 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/orinoco/orinoco_usb.c | |||
@@ -57,7 +57,6 @@ | |||
57 | #include <linux/fcntl.h> | 57 | #include <linux/fcntl.h> |
58 | #include <linux/spinlock.h> | 58 | #include <linux/spinlock.h> |
59 | #include <linux/list.h> | 59 | #include <linux/list.h> |
60 | #include <linux/smp_lock.h> | ||
61 | #include <linux/usb.h> | 60 | #include <linux/usb.h> |
62 | #include <linux/timer.h> | 61 | #include <linux/timer.h> |
63 | 62 | ||
diff --git a/drivers/parisc/eisa_eeprom.c b/drivers/parisc/eisa_eeprom.c index cce00ed81f37..af212c6a6158 100644 --- a/drivers/parisc/eisa_eeprom.c +++ b/drivers/parisc/eisa_eeprom.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/smp_lock.h> | ||
28 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
29 | #include <asm/io.h> | 28 | #include <asm/io.h> |
30 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 5624db8c9ad0..003170ea2e39 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -64,17 +64,57 @@ void pci_bus_remove_resources(struct pci_bus *bus) | |||
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | static bool pci_bus_resource_better(struct resource *res1, bool pos1, | ||
68 | struct resource *res2, bool pos2) | ||
69 | { | ||
70 | /* If exactly one is positive decode, always prefer that one */ | ||
71 | if (pos1 != pos2) | ||
72 | return pos1 ? true : false; | ||
73 | |||
74 | /* Prefer the one that contains the highest address */ | ||
75 | if (res1->end != res2->end) | ||
76 | return (res1->end > res2->end) ? true : false; | ||
77 | |||
78 | /* Otherwise, prefer the one with highest "center of gravity" */ | ||
79 | if (res1->start != res2->start) | ||
80 | return (res1->start > res2->start) ? true : false; | ||
81 | |||
82 | /* Otherwise, choose one arbitrarily (but consistently) */ | ||
83 | return (res1 > res2) ? true : false; | ||
84 | } | ||
85 | |||
86 | static bool pci_bus_resource_positive(struct pci_bus *bus, struct resource *res) | ||
87 | { | ||
88 | struct pci_bus_resource *bus_res; | ||
89 | |||
90 | /* | ||
91 | * This relies on the fact that pci_bus.resource[] refers to P2P or | ||
92 | * CardBus bridge base/limit registers, which are always positively | ||
93 | * decoded. The pci_bus.resources list contains host bridge or | ||
94 | * subtractively decoded resources. | ||
95 | */ | ||
96 | list_for_each_entry(bus_res, &bus->resources, list) { | ||
97 | if (bus_res->res == res) | ||
98 | return (bus_res->flags & PCI_SUBTRACTIVE_DECODE) ? | ||
99 | false : true; | ||
100 | } | ||
101 | return true; | ||
102 | } | ||
103 | |||
67 | /* | 104 | /* |
68 | * Find the highest-address bus resource below the cursor "res". If the | 105 | * Find the next-best bus resource after the cursor "res". If the cursor is |
69 | * cursor is NULL, return the highest resource. | 106 | * NULL, return the best resource. "Best" means that we prefer positive |
107 | * decode regions over subtractive decode, then those at higher addresses. | ||
70 | */ | 108 | */ |
71 | static struct resource *pci_bus_find_resource_prev(struct pci_bus *bus, | 109 | static struct resource *pci_bus_find_resource_prev(struct pci_bus *bus, |
72 | unsigned int type, | 110 | unsigned int type, |
73 | struct resource *res) | 111 | struct resource *res) |
74 | { | 112 | { |
113 | bool res_pos, r_pos, prev_pos = false; | ||
75 | struct resource *r, *prev = NULL; | 114 | struct resource *r, *prev = NULL; |
76 | int i; | 115 | int i; |
77 | 116 | ||
117 | res_pos = pci_bus_resource_positive(bus, res); | ||
78 | pci_bus_for_each_resource(bus, r, i) { | 118 | pci_bus_for_each_resource(bus, r, i) { |
79 | if (!r) | 119 | if (!r) |
80 | continue; | 120 | continue; |
@@ -82,26 +122,14 @@ static struct resource *pci_bus_find_resource_prev(struct pci_bus *bus, | |||
82 | if ((r->flags & IORESOURCE_TYPE_BITS) != type) | 122 | if ((r->flags & IORESOURCE_TYPE_BITS) != type) |
83 | continue; | 123 | continue; |
84 | 124 | ||
85 | /* If this resource is at or past the cursor, skip it */ | 125 | r_pos = pci_bus_resource_positive(bus, r); |
86 | if (res) { | 126 | if (!res || pci_bus_resource_better(res, res_pos, r, r_pos)) { |
87 | if (r == res) | 127 | if (!prev || pci_bus_resource_better(r, r_pos, |
88 | continue; | 128 | prev, prev_pos)) { |
89 | if (r->end > res->end) | 129 | prev = r; |
90 | continue; | 130 | prev_pos = r_pos; |
91 | if (r->end == res->end && r->start > res->start) | 131 | } |
92 | continue; | ||
93 | } | 132 | } |
94 | |||
95 | if (!prev) | ||
96 | prev = r; | ||
97 | |||
98 | /* | ||
99 | * A small resource is higher than a large one that ends at | ||
100 | * the same address. | ||
101 | */ | ||
102 | if (r->end > prev->end || | ||
103 | (r->end == prev->end && r->start > prev->start)) | ||
104 | prev = r; | ||
105 | } | 133 | } |
106 | 134 | ||
107 | return prev; | 135 | return prev; |
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index 5becbdee4027..2850e64dedae 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
@@ -276,6 +276,12 @@ int __init ibmphp_access_ebda (void) | |||
276 | 276 | ||
277 | for (;;) { | 277 | for (;;) { |
278 | offset = next_offset; | 278 | offset = next_offset; |
279 | |||
280 | /* Make sure what we read is still in the mapped section */ | ||
281 | if (WARN(offset > (ebda_sz * 1024 - 4), | ||
282 | "ibmphp_ebda: next read is beyond ebda_sz\n")) | ||
283 | break; | ||
284 | |||
279 | next_offset = readw (io_mem + offset); /* offset of next blk */ | 285 | next_offset = readw (io_mem + offset); /* offset of next blk */ |
280 | 286 | ||
281 | offset += 2; | 287 | offset += 2; |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index b5a7d9bfcb24..63d5042f2079 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -705,17 +705,21 @@ void pci_remove_legacy_files(struct pci_bus *b) | |||
705 | 705 | ||
706 | #ifdef HAVE_PCI_MMAP | 706 | #ifdef HAVE_PCI_MMAP |
707 | 707 | ||
708 | int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma) | 708 | int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma, |
709 | enum pci_mmap_api mmap_api) | ||
709 | { | 710 | { |
710 | unsigned long nr, start, size; | 711 | unsigned long nr, start, size, pci_start; |
711 | 712 | ||
713 | if (pci_resource_len(pdev, resno) == 0) | ||
714 | return 0; | ||
712 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 715 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
713 | start = vma->vm_pgoff; | 716 | start = vma->vm_pgoff; |
714 | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; | 717 | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; |
715 | if (start < size && size - start >= nr) | 718 | pci_start = (mmap_api == PCI_MMAP_PROCFS) ? |
719 | pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0; | ||
720 | if (start >= pci_start && start < pci_start + size && | ||
721 | start + nr <= pci_start + size) | ||
716 | return 1; | 722 | return 1; |
717 | WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", | ||
718 | current->comm, start, start+nr, pci_name(pdev), resno, size); | ||
719 | return 0; | 723 | return 0; |
720 | } | 724 | } |
721 | 725 | ||
@@ -745,8 +749,15 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
745 | if (i >= PCI_ROM_RESOURCE) | 749 | if (i >= PCI_ROM_RESOURCE) |
746 | return -ENODEV; | 750 | return -ENODEV; |
747 | 751 | ||
748 | if (!pci_mmap_fits(pdev, i, vma)) | 752 | if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { |
753 | WARN(1, "process \"%s\" tried to map 0x%08lx bytes " | ||
754 | "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", | ||
755 | current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, | ||
756 | pci_name(pdev), i, | ||
757 | (u64)pci_resource_start(pdev, i), | ||
758 | (u64)pci_resource_len(pdev, i)); | ||
749 | return -EINVAL; | 759 | return -EINVAL; |
760 | } | ||
750 | 761 | ||
751 | /* pci_mmap_page_range() expects the same kind of entry as coming | 762 | /* pci_mmap_page_range() expects the same kind of entry as coming |
752 | * from /proc/bus/pci/ which is a "user visible" value. If this is | 763 | * from /proc/bus/pci/ which is a "user visible" value. If this is |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e98c8104297b..710c8a29be0d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1007,6 +1007,18 @@ static int __pci_enable_device_flags(struct pci_dev *dev, | |||
1007 | int err; | 1007 | int err; |
1008 | int i, bars = 0; | 1008 | int i, bars = 0; |
1009 | 1009 | ||
1010 | /* | ||
1011 | * Power state could be unknown at this point, either due to a fresh | ||
1012 | * boot or a device removal call. So get the current power state | ||
1013 | * so that things like MSI message writing will behave as expected | ||
1014 | * (e.g. if the device really is in D0 at enable time). | ||
1015 | */ | ||
1016 | if (dev->pm_cap) { | ||
1017 | u16 pmcsr; | ||
1018 | pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); | ||
1019 | dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); | ||
1020 | } | ||
1021 | |||
1010 | if (atomic_add_return(1, &dev->enable_cnt) > 1) | 1022 | if (atomic_add_return(1, &dev->enable_cnt) > 1) |
1011 | return 0; /* already enabled */ | 1023 | return 0; /* already enabled */ |
1012 | 1024 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index f5c7c382765f..7d33f6673868 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -22,8 +22,13 @@ extern void pci_remove_firmware_label_files(struct pci_dev *pdev); | |||
22 | #endif | 22 | #endif |
23 | extern void pci_cleanup_rom(struct pci_dev *dev); | 23 | extern void pci_cleanup_rom(struct pci_dev *dev); |
24 | #ifdef HAVE_PCI_MMAP | 24 | #ifdef HAVE_PCI_MMAP |
25 | enum pci_mmap_api { | ||
26 | PCI_MMAP_SYSFS, /* mmap on /sys/bus/pci/devices/<BDF>/resource<N> */ | ||
27 | PCI_MMAP_PROCFS /* mmap on /proc/bus/pci/<BDF> */ | ||
28 | }; | ||
25 | extern int pci_mmap_fits(struct pci_dev *pdev, int resno, | 29 | extern int pci_mmap_fits(struct pci_dev *pdev, int resno, |
26 | struct vm_area_struct *vma); | 30 | struct vm_area_struct *vmai, |
31 | enum pci_mmap_api mmap_api); | ||
27 | #endif | 32 | #endif |
28 | int pci_probe_reset_function(struct pci_dev *dev); | 33 | int pci_probe_reset_function(struct pci_dev *dev); |
29 | 34 | ||
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 297b72c880a1..27911b55c2a5 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/proc_fs.h> | 11 | #include <linux/proc_fs.h> |
12 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
13 | #include <linux/smp_lock.h> | ||
14 | #include <linux/capability.h> | 13 | #include <linux/capability.h> |
15 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
16 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
@@ -257,7 +256,7 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) | |||
257 | 256 | ||
258 | /* Make sure the caller is mapping a real resource for this device */ | 257 | /* Make sure the caller is mapping a real resource for this device */ |
259 | for (i = 0; i < PCI_ROM_RESOURCE; i++) { | 258 | for (i = 0; i < PCI_ROM_RESOURCE; i++) { |
260 | if (pci_mmap_fits(dev, i, vma)) | 259 | if (pci_mmap_fits(dev, i, vma, PCI_MMAP_PROCFS)) |
261 | break; | 260 | break; |
262 | } | 261 | } |
263 | 262 | ||
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 8cbfa067171f..96c72e90b79c 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -725,17 +725,17 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
725 | 725 | ||
726 | return 0; | 726 | return 0; |
727 | 727 | ||
728 | err_out_free_res2: | 728 | err_out_free_res2: |
729 | if (irq_mode == 1) | 729 | if (irq_mode == 1) |
730 | free_irq(dev->irq, socket); | 730 | free_irq(dev->irq, socket); |
731 | else | 731 | else |
732 | del_timer_sync(&socket->poll_timer); | 732 | del_timer_sync(&socket->poll_timer); |
733 | err_out_free_res: | 733 | err_out_free_res: |
734 | pci_release_regions(dev); | 734 | pci_release_regions(dev); |
735 | err_out_disable: | 735 | err_out_disable: |
736 | pci_disable_device(dev); | 736 | pci_disable_device(dev); |
737 | 737 | ||
738 | err_out_free_mem: | 738 | err_out_free_mem: |
739 | kfree(socket); | 739 | kfree(socket); |
740 | return ret; | 740 | return ret; |
741 | } | 741 | } |
diff --git a/drivers/pcmcia/pd6729.h b/drivers/pcmcia/pd6729.h index 41418d394c55..c8e84bdece38 100644 --- a/drivers/pcmcia/pd6729.h +++ b/drivers/pcmcia/pd6729.h | |||
@@ -15,7 +15,7 @@ | |||
15 | struct pd6729_socket { | 15 | struct pd6729_socket { |
16 | int number; | 16 | int number; |
17 | int card_irq; | 17 | int card_irq; |
18 | unsigned long io_base; /* base io address of the socket */ | 18 | unsigned long io_base; /* base io address of the socket */ |
19 | struct pcmcia_socket socket; | 19 | struct pcmcia_socket socket; |
20 | struct timer_list poll_timer; | 20 | struct timer_list poll_timer; |
21 | }; | 21 | }; |
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index 0ea3b29440e6..81af2b3bcc00 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c | |||
@@ -237,7 +237,7 @@ static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = { | |||
237 | #ifdef CONFIG_SA1100_COLLIE | 237 | #ifdef CONFIG_SA1100_COLLIE |
238 | #include "sa11xx_base.h" | 238 | #include "sa11xx_base.h" |
239 | 239 | ||
240 | int __init pcmcia_collie_init(struct device *dev) | 240 | int __devinit pcmcia_collie_init(struct device *dev) |
241 | { | 241 | { |
242 | int ret = -ENODEV; | 242 | int ret = -ENODEV; |
243 | 243 | ||
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c index fd013a1ef47a..f1e882272ab0 100644 --- a/drivers/pcmcia/sa1100_assabet.c +++ b/drivers/pcmcia/sa1100_assabet.c | |||
@@ -130,7 +130,7 @@ static struct pcmcia_low_level assabet_pcmcia_ops = { | |||
130 | .socket_suspend = assabet_pcmcia_socket_suspend, | 130 | .socket_suspend = assabet_pcmcia_socket_suspend, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | int pcmcia_assabet_init(struct device *dev) | 133 | int __devinit pcmcia_assabet_init(struct device *dev) |
134 | { | 134 | { |
135 | int ret = -ENODEV; | 135 | int ret = -ENODEV; |
136 | 136 | ||
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c index 9bf088b17275..30560df8c76b 100644 --- a/drivers/pcmcia/sa1100_cerf.c +++ b/drivers/pcmcia/sa1100_cerf.c | |||
@@ -97,7 +97,7 @@ static struct pcmcia_low_level cerf_pcmcia_ops = { | |||
97 | .socket_suspend = cerf_pcmcia_socket_suspend, | 97 | .socket_suspend = cerf_pcmcia_socket_suspend, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | int __init pcmcia_cerf_init(struct device *dev) | 100 | int __devinit pcmcia_cerf_init(struct device *dev) |
101 | { | 101 | { |
102 | int ret = -ENODEV; | 102 | int ret = -ENODEV; |
103 | 103 | ||
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 945857f8c284..6b228590b3fd 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -64,7 +64,7 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { | |||
64 | #endif | 64 | #endif |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static int sa11x0_drv_pcmcia_probe(struct platform_device *dev) | 67 | static int __devinit sa11x0_drv_pcmcia_probe(struct platform_device *dev) |
68 | { | 68 | { |
69 | int i, ret = -ENODEV; | 69 | int i, ret = -ENODEV; |
70 | 70 | ||
diff --git a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c index 56329ad575a9..edf8f0028898 100644 --- a/drivers/pcmcia/sa1100_h3600.c +++ b/drivers/pcmcia/sa1100_h3600.c | |||
@@ -219,7 +219,7 @@ struct pcmcia_low_level h3600_pcmcia_ops = { | |||
219 | .socket_suspend = h3600_pcmcia_socket_suspend, | 219 | .socket_suspend = h3600_pcmcia_socket_suspend, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | int __init pcmcia_h3600_init(struct device *dev) | 222 | int __devinit pcmcia_h3600_init(struct device *dev) |
223 | { | 223 | { |
224 | int ret = -ENODEV; | 224 | int ret = -ENODEV; |
225 | 225 | ||
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c index c4d51867a050..7ff1b43540b8 100644 --- a/drivers/pcmcia/sa1100_shannon.c +++ b/drivers/pcmcia/sa1100_shannon.c | |||
@@ -113,7 +113,7 @@ static struct pcmcia_low_level shannon_pcmcia_ops = { | |||
113 | .socket_suspend = shannon_pcmcia_socket_suspend, | 113 | .socket_suspend = shannon_pcmcia_socket_suspend, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | int __init pcmcia_shannon_init(struct device *dev) | 116 | int __devinit pcmcia_shannon_init(struct device *dev) |
117 | { | 117 | { |
118 | int ret = -ENODEV; | 118 | int ret = -ENODEV; |
119 | 119 | ||
diff --git a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c index 05bd504e6f18..c998f7aaadbc 100644 --- a/drivers/pcmcia/sa1100_simpad.c +++ b/drivers/pcmcia/sa1100_simpad.c | |||
@@ -123,7 +123,7 @@ static struct pcmcia_low_level simpad_pcmcia_ops = { | |||
123 | .socket_suspend = simpad_pcmcia_socket_suspend, | 123 | .socket_suspend = simpad_pcmcia_socket_suspend, |
124 | }; | 124 | }; |
125 | 125 | ||
126 | int __init pcmcia_simpad_init(struct device *dev) | 126 | int __devinit pcmcia_simpad_init(struct device *dev) |
127 | { | 127 | { |
128 | int ret = -ENODEV; | 128 | int ret = -ENODEV; |
129 | 129 | ||
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 689e3c02edb8..3753fd0722e7 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -57,11 +57,16 @@ module_param(pc_debug, int, 0644); | |||
57 | void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, | 57 | void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, |
58 | int lvl, const char *fmt, ...) | 58 | int lvl, const char *fmt, ...) |
59 | { | 59 | { |
60 | struct va_format vaf; | ||
60 | va_list args; | 61 | va_list args; |
61 | if (pc_debug > lvl) { | 62 | if (pc_debug > lvl) { |
62 | printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func); | ||
63 | va_start(args, fmt); | 63 | va_start(args, fmt); |
64 | vprintk(fmt, args); | 64 | |
65 | vaf.fmt = fmt; | ||
66 | vaf.va = &args; | ||
67 | |||
68 | printk(KERN_DEBUG "skt%u: %s: %pV", skt->nr, func, &vaf); | ||
69 | |||
65 | va_end(args); | 70 | va_end(args); |
66 | } | 71 | } |
67 | } | 72 | } |
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index e73ebefdf3e0..315b3112aca8 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/isapnp.h> | 21 | #include <linux/isapnp.h> |
22 | #include <linux/proc_fs.h> | 22 | #include <linux/proc_fs.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
26 | 25 | ||
27 | extern struct pnp_protocol isapnp_protocol; | 26 | extern struct pnp_protocol isapnp_protocol; |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 5efbd5990ff8..06e41ed93230 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -761,7 +761,7 @@ err_unmap: | |||
761 | clk_put(rtc->clk); | 761 | clk_put(rtc->clk); |
762 | iounmap(rtc->regbase); | 762 | iounmap(rtc->regbase); |
763 | err_badmap: | 763 | err_badmap: |
764 | release_resource(rtc->res); | 764 | release_mem_region(rtc->res->start, rtc->regsize); |
765 | err_badres: | 765 | err_badres: |
766 | kfree(rtc); | 766 | kfree(rtc); |
767 | 767 | ||
@@ -786,7 +786,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev) | |||
786 | } | 786 | } |
787 | 787 | ||
788 | iounmap(rtc->regbase); | 788 | iounmap(rtc->regbase); |
789 | release_resource(rtc->res); | 789 | release_mem_region(rtc->res->start, rtc->regsize); |
790 | 790 | ||
791 | clk_disable(rtc->clk); | 791 | clk_disable(rtc->clk); |
792 | clk_put(rtc->clk); | 792 | clk_put(rtc->clk); |
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index c71d89dba302..83b4615a3b62 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/poll.h> | 18 | #include <linux/poll.h> |
19 | #include <linux/mutex.h> | 19 | #include <linux/mutex.h> |
20 | #include <linux/smp_lock.h> | ||
21 | #include <linux/err.h> | 20 | #include <linux/err.h> |
22 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
23 | 22 | ||
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index eb28fb01a38a..f6489eb7e976 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/smp_lock.h> | ||
18 | 17 | ||
19 | #include <asm/compat.h> | 18 | #include <asm/compat.h> |
20 | #include <asm/ccwdev.h> | 19 | #include <asm/ccwdev.h> |
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 883e2db02bd3..e090a307fdee 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
19 | #include <linux/mtio.h> | 19 | #include <linux/mtio.h> |
20 | #include <linux/smp_lock.h> | ||
21 | #include <linux/compat.h> | 20 | #include <linux/compat.h> |
22 | 21 | ||
23 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index 6c408670e08d..b3a3e8e8656e 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -209,29 +209,79 @@ tape_state_set(struct tape_device *device, enum tape_state newstate) | |||
209 | wake_up(&device->state_change_wq); | 209 | wake_up(&device->state_change_wq); |
210 | } | 210 | } |
211 | 211 | ||
212 | struct tape_med_state_work_data { | ||
213 | struct tape_device *device; | ||
214 | enum tape_medium_state state; | ||
215 | struct work_struct work; | ||
216 | }; | ||
217 | |||
218 | static void | ||
219 | tape_med_state_work_handler(struct work_struct *work) | ||
220 | { | ||
221 | static char env_state_loaded[] = "MEDIUM_STATE=LOADED"; | ||
222 | static char env_state_unloaded[] = "MEDIUM_STATE=UNLOADED"; | ||
223 | struct tape_med_state_work_data *p = | ||
224 | container_of(work, struct tape_med_state_work_data, work); | ||
225 | struct tape_device *device = p->device; | ||
226 | char *envp[] = { NULL, NULL }; | ||
227 | |||
228 | switch (p->state) { | ||
229 | case MS_UNLOADED: | ||
230 | pr_info("%s: The tape cartridge has been successfully " | ||
231 | "unloaded\n", dev_name(&device->cdev->dev)); | ||
232 | envp[0] = env_state_unloaded; | ||
233 | kobject_uevent_env(&device->cdev->dev.kobj, KOBJ_CHANGE, envp); | ||
234 | break; | ||
235 | case MS_LOADED: | ||
236 | pr_info("%s: A tape cartridge has been mounted\n", | ||
237 | dev_name(&device->cdev->dev)); | ||
238 | envp[0] = env_state_loaded; | ||
239 | kobject_uevent_env(&device->cdev->dev.kobj, KOBJ_CHANGE, envp); | ||
240 | break; | ||
241 | default: | ||
242 | break; | ||
243 | } | ||
244 | tape_put_device(device); | ||
245 | kfree(p); | ||
246 | } | ||
247 | |||
248 | static void | ||
249 | tape_med_state_work(struct tape_device *device, enum tape_medium_state state) | ||
250 | { | ||
251 | struct tape_med_state_work_data *p; | ||
252 | |||
253 | p = kzalloc(sizeof(*p), GFP_ATOMIC); | ||
254 | if (p) { | ||
255 | INIT_WORK(&p->work, tape_med_state_work_handler); | ||
256 | p->device = tape_get_device(device); | ||
257 | p->state = state; | ||
258 | schedule_work(&p->work); | ||
259 | } | ||
260 | } | ||
261 | |||
212 | void | 262 | void |
213 | tape_med_state_set(struct tape_device *device, enum tape_medium_state newstate) | 263 | tape_med_state_set(struct tape_device *device, enum tape_medium_state newstate) |
214 | { | 264 | { |
215 | if (device->medium_state == newstate) | 265 | enum tape_medium_state oldstate; |
266 | |||
267 | oldstate = device->medium_state; | ||
268 | if (oldstate == newstate) | ||
216 | return; | 269 | return; |
270 | device->medium_state = newstate; | ||
217 | switch(newstate){ | 271 | switch(newstate){ |
218 | case MS_UNLOADED: | 272 | case MS_UNLOADED: |
219 | device->tape_generic_status |= GMT_DR_OPEN(~0); | 273 | device->tape_generic_status |= GMT_DR_OPEN(~0); |
220 | if (device->medium_state == MS_LOADED) | 274 | if (oldstate == MS_LOADED) |
221 | pr_info("%s: The tape cartridge has been successfully " | 275 | tape_med_state_work(device, MS_UNLOADED); |
222 | "unloaded\n", dev_name(&device->cdev->dev)); | ||
223 | break; | 276 | break; |
224 | case MS_LOADED: | 277 | case MS_LOADED: |
225 | device->tape_generic_status &= ~GMT_DR_OPEN(~0); | 278 | device->tape_generic_status &= ~GMT_DR_OPEN(~0); |
226 | if (device->medium_state == MS_UNLOADED) | 279 | if (oldstate == MS_UNLOADED) |
227 | pr_info("%s: A tape cartridge has been mounted\n", | 280 | tape_med_state_work(device, MS_LOADED); |
228 | dev_name(&device->cdev->dev)); | ||
229 | break; | 281 | break; |
230 | default: | 282 | default: |
231 | // print nothing | ||
232 | break; | 283 | break; |
233 | } | 284 | } |
234 | device->medium_state = newstate; | ||
235 | wake_up(&device->state_change_wq); | 285 | wake_up(&device->state_change_wq); |
236 | } | 286 | } |
237 | 287 | ||
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index 9f661426e4a1..c837d7419a6a 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/kmod.h> | 30 | #include <linux/kmod.h> |
31 | #include <linux/cdev.h> | 31 | #include <linux/cdev.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/smp_lock.h> | ||
34 | #include <linux/string.h> | 33 | #include <linux/string.h> |
35 | 34 | ||
36 | MODULE_AUTHOR | 35 | MODULE_AUTHOR |
@@ -249,27 +248,25 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr, | |||
249 | char cp_command[80]; | 248 | char cp_command[80]; |
250 | char cp_response[160]; | 249 | char cp_response[160]; |
251 | char *onoff, *qid_string; | 250 | char *onoff, *qid_string; |
251 | int rc; | ||
252 | 252 | ||
253 | memset(cp_command, 0x00, sizeof(cp_command)); | 253 | onoff = ((action == 1) ? "ON" : "OFF"); |
254 | memset(cp_response, 0x00, sizeof(cp_response)); | ||
255 | |||
256 | onoff = ((action == 1) ? "ON" : "OFF"); | ||
257 | qid_string = ((recording_class_AB == 1) ? " QID * " : ""); | 254 | qid_string = ((recording_class_AB == 1) ? " QID * " : ""); |
258 | 255 | ||
259 | /* | 256 | /* |
260 | * The recording commands needs to be called with option QID | 257 | * The recording commands needs to be called with option QID |
261 | * for guests that have previlege classes A or B. | 258 | * for guests that have previlege classes A or B. |
262 | * Purging has to be done as separate step, because recording | 259 | * Purging has to be done as separate step, because recording |
263 | * can't be switched on as long as records are on the queue. | 260 | * can't be switched on as long as records are on the queue. |
264 | * Doing both at the same time doesn't work. | 261 | * Doing both at the same time doesn't work. |
265 | */ | 262 | */ |
266 | 263 | if (purge && (action == 1)) { | |
267 | if (purge) { | 264 | memset(cp_command, 0x00, sizeof(cp_command)); |
265 | memset(cp_response, 0x00, sizeof(cp_response)); | ||
268 | snprintf(cp_command, sizeof(cp_command), | 266 | snprintf(cp_command, sizeof(cp_command), |
269 | "RECORDING %s PURGE %s", | 267 | "RECORDING %s PURGE %s", |
270 | logptr->recording_name, | 268 | logptr->recording_name, |
271 | qid_string); | 269 | qid_string); |
272 | |||
273 | cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); | 270 | cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); |
274 | } | 271 | } |
275 | 272 | ||
@@ -279,19 +276,33 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr, | |||
279 | logptr->recording_name, | 276 | logptr->recording_name, |
280 | onoff, | 277 | onoff, |
281 | qid_string); | 278 | qid_string); |
282 | |||
283 | cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); | 279 | cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); |
284 | /* The recording command will usually answer with 'Command complete' | 280 | /* The recording command will usually answer with 'Command complete' |
285 | * on success, but when the specific service was never connected | 281 | * on success, but when the specific service was never connected |
286 | * before then there might be an additional informational message | 282 | * before then there might be an additional informational message |
287 | * 'HCPCRC8072I Recording entry not found' before the | 283 | * 'HCPCRC8072I Recording entry not found' before the |
288 | * 'Command complete'. So I use strstr rather then the strncmp. | 284 | * 'Command complete'. So I use strstr rather then the strncmp. |
289 | */ | 285 | */ |
290 | if (strstr(cp_response,"Command complete")) | 286 | if (strstr(cp_response,"Command complete")) |
291 | return 0; | 287 | rc = 0; |
292 | else | 288 | else |
293 | return -EIO; | 289 | rc = -EIO; |
290 | /* | ||
291 | * If we turn recording off, we have to purge any remaining records | ||
292 | * afterwards, as a large number of queued records may impact z/VM | ||
293 | * performance. | ||
294 | */ | ||
295 | if (purge && (action == 0)) { | ||
296 | memset(cp_command, 0x00, sizeof(cp_command)); | ||
297 | memset(cp_response, 0x00, sizeof(cp_response)); | ||
298 | snprintf(cp_command, sizeof(cp_command), | ||
299 | "RECORDING %s PURGE %s", | ||
300 | logptr->recording_name, | ||
301 | qid_string); | ||
302 | cpcmd(cp_command, cp_response, sizeof(cp_response), NULL); | ||
303 | } | ||
294 | 304 | ||
305 | return rc; | ||
295 | } | 306 | } |
296 | 307 | ||
297 | 308 | ||
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 1de672f21037..f7e4ae6bf15a 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/cdev.h> | 14 | #include <linux/cdev.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/smp_lock.h> | ||
17 | 16 | ||
18 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
19 | #include <asm/cio.h> | 18 | #include <asm/cio.h> |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 2ff8a22d4257..e8391b89eff4 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1455,7 +1455,16 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process) | |||
1455 | break; | 1455 | break; |
1456 | case IO_SCH_UNREG_ATTACH: | 1456 | case IO_SCH_UNREG_ATTACH: |
1457 | case IO_SCH_UNREG: | 1457 | case IO_SCH_UNREG: |
1458 | if (cdev) | 1458 | if (!cdev) |
1459 | break; | ||
1460 | if (cdev->private->state == DEV_STATE_SENSE_ID) { | ||
1461 | /* | ||
1462 | * Note: delayed work triggered by this event | ||
1463 | * and repeated calls to sch_event are synchronized | ||
1464 | * by the above check for work_pending(cdev). | ||
1465 | */ | ||
1466 | dev_fsm_event(cdev, DEV_EVENT_NOTOPER); | ||
1467 | } else | ||
1459 | ccw_device_set_notoper(cdev); | 1468 | ccw_device_set_notoper(cdev); |
1460 | break; | 1469 | break; |
1461 | case IO_SCH_NOP: | 1470 | case IO_SCH_NOP: |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index f5221749d180..7fca9c10ffcf 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <linux/compat.h> | 37 | #include <linux/compat.h> |
38 | #include <linux/smp_lock.h> | ||
39 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
40 | #include <asm/atomic.h> | 39 | #include <asm/atomic.h> |
41 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 50286d8707f3..6bd2dbc4c316 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -76,7 +76,7 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) | |||
76 | scpnt->scsi_done(scpnt); | 76 | scpnt->scsi_done(scpnt); |
77 | } | 77 | } |
78 | 78 | ||
79 | static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt, | 79 | static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, |
80 | void (*done) (struct scsi_cmnd *)) | 80 | void (*done) (struct scsi_cmnd *)) |
81 | { | 81 | { |
82 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); | 82 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); |
@@ -127,6 +127,8 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt, | |||
127 | return ret; | 127 | return ret; |
128 | } | 128 | } |
129 | 129 | ||
130 | static DEF_SCSI_QCMD(zfcp_scsi_queuecommand) | ||
131 | |||
130 | static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) | 132 | static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) |
131 | { | 133 | { |
132 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); | 134 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index fcf08b3f52c1..b7bd5b0cc7aa 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1765,7 +1765,7 @@ out: | |||
1765 | } /* End twa_scsi_eh_reset() */ | 1765 | } /* End twa_scsi_eh_reset() */ |
1766 | 1766 | ||
1767 | /* This is the main scsi queue function to handle scsi opcodes */ | 1767 | /* This is the main scsi queue function to handle scsi opcodes */ |
1768 | static int twa_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 1768 | static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
1769 | { | 1769 | { |
1770 | int request_id, retval; | 1770 | int request_id, retval; |
1771 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; | 1771 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; |
@@ -1812,6 +1812,8 @@ out: | |||
1812 | return retval; | 1812 | return retval; |
1813 | } /* End twa_scsi_queue() */ | 1813 | } /* End twa_scsi_queue() */ |
1814 | 1814 | ||
1815 | static DEF_SCSI_QCMD(twa_scsi_queue) | ||
1816 | |||
1815 | /* This function hands scsi cdb's to the firmware */ | 1817 | /* This function hands scsi cdb's to the firmware */ |
1816 | static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg) | 1818 | static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg) |
1817 | { | 1819 | { |
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index 6a95d111d207..13e39e1fdfe2 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c | |||
@@ -1501,7 +1501,7 @@ out: | |||
1501 | } /* End twl_scsi_eh_reset() */ | 1501 | } /* End twl_scsi_eh_reset() */ |
1502 | 1502 | ||
1503 | /* This is the main scsi queue function to handle scsi opcodes */ | 1503 | /* This is the main scsi queue function to handle scsi opcodes */ |
1504 | static int twl_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 1504 | static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
1505 | { | 1505 | { |
1506 | int request_id, retval; | 1506 | int request_id, retval; |
1507 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; | 1507 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; |
@@ -1536,6 +1536,8 @@ out: | |||
1536 | return retval; | 1536 | return retval; |
1537 | } /* End twl_scsi_queue() */ | 1537 | } /* End twl_scsi_queue() */ |
1538 | 1538 | ||
1539 | static DEF_SCSI_QCMD(twl_scsi_queue) | ||
1540 | |||
1539 | /* This function tells the controller to shut down */ | 1541 | /* This function tells the controller to shut down */ |
1540 | static void __twl_shutdown(TW_Device_Extension *tw_dev) | 1542 | static void __twl_shutdown(TW_Device_Extension *tw_dev) |
1541 | { | 1543 | { |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index b1125341f4c8..7fe96ff60c58 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -1947,7 +1947,7 @@ static int tw_scsiop_test_unit_ready_complete(TW_Device_Extension *tw_dev, int r | |||
1947 | } /* End tw_scsiop_test_unit_ready_complete() */ | 1947 | } /* End tw_scsiop_test_unit_ready_complete() */ |
1948 | 1948 | ||
1949 | /* This is the main scsi queue function to handle scsi opcodes */ | 1949 | /* This is the main scsi queue function to handle scsi opcodes */ |
1950 | static int tw_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 1950 | static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
1951 | { | 1951 | { |
1952 | unsigned char *command = SCpnt->cmnd; | 1952 | unsigned char *command = SCpnt->cmnd; |
1953 | int request_id = 0; | 1953 | int request_id = 0; |
@@ -2023,6 +2023,8 @@ static int tw_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd | |||
2023 | return retval; | 2023 | return retval; |
2024 | } /* End tw_scsi_queue() */ | 2024 | } /* End tw_scsi_queue() */ |
2025 | 2025 | ||
2026 | static DEF_SCSI_QCMD(tw_scsi_queue) | ||
2027 | |||
2026 | /* This function is the interrupt service routine */ | 2028 | /* This function is the interrupt service routine */ |
2027 | static irqreturn_t tw_interrupt(int irq, void *dev_instance) | 2029 | static irqreturn_t tw_interrupt(int irq, void *dev_instance) |
2028 | { | 2030 | { |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 89fc1c8af86b..f672491774eb 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -167,7 +167,7 @@ MODULE_LICENSE("GPL"); | |||
167 | #include "53c700_d.h" | 167 | #include "53c700_d.h" |
168 | 168 | ||
169 | 169 | ||
170 | STATIC int NCR_700_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); | 170 | STATIC int NCR_700_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *); |
171 | STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt); | 171 | STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt); |
172 | STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt); | 172 | STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt); |
173 | STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt); | 173 | STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt); |
@@ -1749,8 +1749,8 @@ NCR_700_intr(int irq, void *dev_id) | |||
1749 | return IRQ_RETVAL(handled); | 1749 | return IRQ_RETVAL(handled); |
1750 | } | 1750 | } |
1751 | 1751 | ||
1752 | STATIC int | 1752 | static int |
1753 | NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | 1753 | NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) |
1754 | { | 1754 | { |
1755 | struct NCR_700_Host_Parameters *hostdata = | 1755 | struct NCR_700_Host_Parameters *hostdata = |
1756 | (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; | 1756 | (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; |
@@ -1904,6 +1904,8 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) | |||
1904 | return 0; | 1904 | return 0; |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | STATIC DEF_SCSI_QCMD(NCR_700_queuecommand) | ||
1908 | |||
1907 | STATIC int | 1909 | STATIC int |
1908 | NCR_700_abort(struct scsi_cmnd * SCp) | 1910 | NCR_700_abort(struct scsi_cmnd * SCp) |
1909 | { | 1911 | { |
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index fc0b4b81d552..f66c33b9ab41 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -2807,7 +2807,7 @@ static int BusLogic_host_reset(struct scsi_cmnd * SCpnt) | |||
2807 | Outgoing Mailbox for execution by the associated Host Adapter. | 2807 | Outgoing Mailbox for execution by the associated Host Adapter. |
2808 | */ | 2808 | */ |
2809 | 2809 | ||
2810 | static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *)) | 2810 | static int BusLogic_QueueCommand_lck(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *)) |
2811 | { | 2811 | { |
2812 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; | 2812 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; |
2813 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id]; | 2813 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id]; |
@@ -2994,6 +2994,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou | |||
2994 | return 0; | 2994 | return 0; |
2995 | } | 2995 | } |
2996 | 2996 | ||
2997 | static DEF_SCSI_QCMD(BusLogic_QueueCommand) | ||
2997 | 2998 | ||
2998 | #if 0 | 2999 | #if 0 |
2999 | /* | 3000 | /* |
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h index 73f237a1ed94..649fcb31f26d 100644 --- a/drivers/scsi/BusLogic.h +++ b/drivers/scsi/BusLogic.h | |||
@@ -1319,7 +1319,7 @@ static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T Co | |||
1319 | */ | 1319 | */ |
1320 | 1320 | ||
1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); | 1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); |
1322 | static int BusLogic_QueueCommand(struct scsi_cmnd *, void (*CompletionRoutine) (struct scsi_cmnd *)); | 1322 | static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); |
1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); | 1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); |
1324 | static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int); | 1324 | static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int); |
1325 | static int BusLogic_SlaveConfigure(struct scsi_device *); | 1325 | static int BusLogic_SlaveConfigure(struct scsi_device *); |
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 5d2f148889ad..9a5629f94f95 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -952,7 +952,7 @@ static void NCR5380_exit(struct Scsi_Host *instance) | |||
952 | * Locks: host lock taken by caller | 952 | * Locks: host lock taken by caller |
953 | */ | 953 | */ |
954 | 954 | ||
955 | static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | 955 | static int NCR5380_queue_command_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) |
956 | { | 956 | { |
957 | struct Scsi_Host *instance = cmd->device->host; | 957 | struct Scsi_Host *instance = cmd->device->host; |
958 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 958 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
@@ -1021,6 +1021,7 @@ static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
1021 | return 0; | 1021 | return 0; |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | static DEF_SCSI_QCMD(NCR5380_queue_command) | ||
1024 | 1025 | ||
1025 | /** | 1026 | /** |
1026 | * NCR5380_main - NCR state machines | 1027 | * NCR5380_main - NCR state machines |
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index bdc468c9e1d9..fd40a32b1f6f 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h | |||
@@ -313,7 +313,7 @@ static void NCR5380_print(struct Scsi_Host *instance); | |||
313 | #endif | 313 | #endif |
314 | static int NCR5380_abort(Scsi_Cmnd * cmd); | 314 | static int NCR5380_abort(Scsi_Cmnd * cmd); |
315 | static int NCR5380_bus_reset(Scsi_Cmnd * cmd); | 315 | static int NCR5380_bus_reset(Scsi_Cmnd * cmd); |
316 | static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); | 316 | static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
317 | static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | 317 | static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, |
318 | char *buffer, char **start, off_t offset, int length, int inout); | 318 | char *buffer, char **start, off_t offset, int length, int inout); |
319 | 319 | ||
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c index 6961f78742ae..c91888a0a23c 100644 --- a/drivers/scsi/NCR53c406a.c +++ b/drivers/scsi/NCR53c406a.c | |||
@@ -693,7 +693,7 @@ static void wait_intr(void) | |||
693 | } | 693 | } |
694 | #endif | 694 | #endif |
695 | 695 | ||
696 | static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | 696 | static int NCR53c406a_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) |
697 | { | 697 | { |
698 | int i; | 698 | int i; |
699 | 699 | ||
@@ -726,6 +726,8 @@ static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
726 | return 0; | 726 | return 0; |
727 | } | 727 | } |
728 | 728 | ||
729 | static DEF_SCSI_QCMD(NCR53c406a_queue) | ||
730 | |||
729 | static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) | 731 | static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) |
730 | { | 732 | { |
731 | DEB(printk("NCR53c406a_reset called\n")); | 733 | DEB(printk("NCR53c406a_reset called\n")); |
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index dbbc601948e5..dc5ac6e528c4 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c | |||
@@ -911,7 +911,7 @@ static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struc | |||
911 | * queue the command down to the controller | 911 | * queue the command down to the controller |
912 | */ | 912 | */ |
913 | 913 | ||
914 | static int inia100_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) | 914 | static int inia100_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) |
915 | { | 915 | { |
916 | struct orc_scb *scb; | 916 | struct orc_scb *scb; |
917 | struct orc_host *host; /* Point to Host adapter control block */ | 917 | struct orc_host *host; /* Point to Host adapter control block */ |
@@ -930,6 +930,8 @@ static int inia100_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd | |||
930 | return 0; | 930 | return 0; |
931 | } | 931 | } |
932 | 932 | ||
933 | static DEF_SCSI_QCMD(inia100_queue) | ||
934 | |||
933 | /***************************************************************************** | 935 | /***************************************************************************** |
934 | Function name : inia100_abort | 936 | Function name : inia100_abort |
935 | Description : Abort a queued command. | 937 | Description : Abort a queued command. |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 29c0ed1cf507..2c93d9496d62 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -248,7 +248,7 @@ static struct aac_driver_ident aac_drivers[] = { | |||
248 | * TODO: unify with aac_scsi_cmd(). | 248 | * TODO: unify with aac_scsi_cmd(). |
249 | */ | 249 | */ |
250 | 250 | ||
251 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 251 | static int aac_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
252 | { | 252 | { |
253 | struct Scsi_Host *host = cmd->device->host; | 253 | struct Scsi_Host *host = cmd->device->host; |
254 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; | 254 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; |
@@ -267,6 +267,8 @@ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd | |||
267 | return (aac_scsi_cmd(cmd) ? FAILED : 0); | 267 | return (aac_scsi_cmd(cmd) ? FAILED : 0); |
268 | } | 268 | } |
269 | 269 | ||
270 | static DEF_SCSI_QCMD(aac_queuecommand) | ||
271 | |||
270 | /** | 272 | /** |
271 | * aac_info - Returns the host adapter name | 273 | * aac_info - Returns the host adapter name |
272 | * @shost: Scsi host to report on | 274 | * @shost: Scsi host to report on |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 0ec3da6f3e12..081c6de92bc5 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -9500,7 +9500,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) | |||
9500 | * in the 'scp' result field. | 9500 | * in the 'scp' result field. |
9501 | */ | 9501 | */ |
9502 | static int | 9502 | static int |
9503 | advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) | 9503 | advansys_queuecommand_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) |
9504 | { | 9504 | { |
9505 | struct Scsi_Host *shost = scp->device->host; | 9505 | struct Scsi_Host *shost = scp->device->host; |
9506 | int asc_res, result = 0; | 9506 | int asc_res, result = 0; |
@@ -9525,6 +9525,8 @@ advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) | |||
9525 | return result; | 9525 | return result; |
9526 | } | 9526 | } |
9527 | 9527 | ||
9528 | static DEF_SCSI_QCMD(advansys_queuecommand) | ||
9529 | |||
9528 | static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base) | 9530 | static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base) |
9529 | { | 9531 | { |
9530 | PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) | | 9532 | PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) | |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 8eab8587ff21..c5169f01c1cd 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -1056,7 +1056,7 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete, | |||
1056 | * queue a command | 1056 | * queue a command |
1057 | * | 1057 | * |
1058 | */ | 1058 | */ |
1059 | static int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) | 1059 | static int aha152x_queue_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) |
1060 | { | 1060 | { |
1061 | #if 0 | 1061 | #if 0 |
1062 | if(*SCpnt->cmnd == REQUEST_SENSE) { | 1062 | if(*SCpnt->cmnd == REQUEST_SENSE) { |
@@ -1070,6 +1070,8 @@ static int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) | |||
1070 | return aha152x_internal_queue(SCpnt, NULL, 0, done); | 1070 | return aha152x_internal_queue(SCpnt, NULL, 0, done); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | static DEF_SCSI_QCMD(aha152x_queue) | ||
1074 | |||
1073 | 1075 | ||
1074 | /* | 1076 | /* |
1075 | * | 1077 | * |
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 4f785f254c1f..195823a51aab 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -558,7 +558,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost) | |||
558 | }; | 558 | }; |
559 | } | 559 | } |
560 | 560 | ||
561 | static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | 561 | static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) |
562 | { | 562 | { |
563 | unchar ahacmd = CMD_START_SCSI; | 563 | unchar ahacmd = CMD_START_SCSI; |
564 | unchar direction; | 564 | unchar direction; |
@@ -718,6 +718,8 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
718 | return 0; | 718 | return 0; |
719 | } | 719 | } |
720 | 720 | ||
721 | static DEF_SCSI_QCMD(aha1542_queuecommand) | ||
722 | |||
721 | /* Initialize mailboxes */ | 723 | /* Initialize mailboxes */ |
722 | static void setup_mailboxes(int bse, struct Scsi_Host *shpnt) | 724 | static void setup_mailboxes(int bse, struct Scsi_Host *shpnt) |
723 | { | 725 | { |
diff --git a/drivers/scsi/aha1542.h b/drivers/scsi/aha1542.h index 1db538552d56..b871d2b57f93 100644 --- a/drivers/scsi/aha1542.h +++ b/drivers/scsi/aha1542.h | |||
@@ -132,7 +132,7 @@ struct ccb { /* Command Control Block 5.3 */ | |||
132 | }; | 132 | }; |
133 | 133 | ||
134 | static int aha1542_detect(struct scsi_host_template *); | 134 | static int aha1542_detect(struct scsi_host_template *); |
135 | static int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 135 | static int aha1542_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
136 | static int aha1542_bus_reset(Scsi_Cmnd * SCpnt); | 136 | static int aha1542_bus_reset(Scsi_Cmnd * SCpnt); |
137 | static int aha1542_dev_reset(Scsi_Cmnd * SCpnt); | 137 | static int aha1542_dev_reset(Scsi_Cmnd * SCpnt); |
138 | static int aha1542_host_reset(Scsi_Cmnd * SCpnt); | 138 | static int aha1542_host_reset(Scsi_Cmnd * SCpnt); |
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 0107a4cc3331..d058f1ab82b5 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c | |||
@@ -331,7 +331,7 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id) | |||
331 | return IRQ_RETVAL(handled); | 331 | return IRQ_RETVAL(handled); |
332 | } | 332 | } |
333 | 333 | ||
334 | static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) | 334 | static int aha1740_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) |
335 | { | 335 | { |
336 | unchar direction; | 336 | unchar direction; |
337 | unchar *cmd = (unchar *) SCpnt->cmnd; | 337 | unchar *cmd = (unchar *) SCpnt->cmnd; |
@@ -503,6 +503,8 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) | |||
503 | return 0; | 503 | return 0; |
504 | } | 504 | } |
505 | 505 | ||
506 | static DEF_SCSI_QCMD(aha1740_queuecommand) | ||
507 | |||
506 | /* Query the board for its irq_level and irq_type. Nothing else matters | 508 | /* Query the board for its irq_level and irq_type. Nothing else matters |
507 | in enhanced mode on an EISA bus. */ | 509 | in enhanced mode on an EISA bus. */ |
508 | 510 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 88ad8482ef59..25d066624476 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -573,7 +573,7 @@ ahd_linux_info(struct Scsi_Host *host) | |||
573 | * Queue an SCB to the controller. | 573 | * Queue an SCB to the controller. |
574 | */ | 574 | */ |
575 | static int | 575 | static int |
576 | ahd_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) | 576 | ahd_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) |
577 | { | 577 | { |
578 | struct ahd_softc *ahd; | 578 | struct ahd_softc *ahd; |
579 | struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); | 579 | struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); |
@@ -588,6 +588,8 @@ ahd_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) | |||
588 | return rtn; | 588 | return rtn; |
589 | } | 589 | } |
590 | 590 | ||
591 | static DEF_SCSI_QCMD(ahd_linux_queue) | ||
592 | |||
591 | static struct scsi_target ** | 593 | static struct scsi_target ** |
592 | ahd_linux_target_in_softc(struct scsi_target *starget) | 594 | ahd_linux_target_in_softc(struct scsi_target *starget) |
593 | { | 595 | { |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index aeea7a61478e..4a359bb307c6 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -528,7 +528,7 @@ ahc_linux_info(struct Scsi_Host *host) | |||
528 | * Queue an SCB to the controller. | 528 | * Queue an SCB to the controller. |
529 | */ | 529 | */ |
530 | static int | 530 | static int |
531 | ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) | 531 | ahc_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) |
532 | { | 532 | { |
533 | struct ahc_softc *ahc; | 533 | struct ahc_softc *ahc; |
534 | struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); | 534 | struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); |
@@ -548,6 +548,8 @@ ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) | |||
548 | return rtn; | 548 | return rtn; |
549 | } | 549 | } |
550 | 550 | ||
551 | static DEF_SCSI_QCMD(ahc_linux_queue) | ||
552 | |||
551 | static inline struct scsi_target ** | 553 | static inline struct scsi_target ** |
552 | ahc_linux_target_in_softc(struct scsi_target *starget) | 554 | ahc_linux_target_in_softc(struct scsi_target *starget) |
553 | { | 555 | { |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index aee73fafccc8..4ff60a08df0f 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -10234,7 +10234,7 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd, | |||
10234 | * Description: | 10234 | * Description: |
10235 | * Queue a SCB to the controller. | 10235 | * Queue a SCB to the controller. |
10236 | *-F*************************************************************************/ | 10236 | *-F*************************************************************************/ |
10237 | static int aic7xxx_queue(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) | 10237 | static int aic7xxx_queue_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) |
10238 | { | 10238 | { |
10239 | struct aic7xxx_host *p; | 10239 | struct aic7xxx_host *p; |
10240 | struct aic7xxx_scb *scb; | 10240 | struct aic7xxx_scb *scb; |
@@ -10292,6 +10292,8 @@ static int aic7xxx_queue(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) | |||
10292 | return (0); | 10292 | return (0); |
10293 | } | 10293 | } |
10294 | 10294 | ||
10295 | static DEF_SCSI_QCMD(aic7xxx_queue) | ||
10296 | |||
10295 | /*+F************************************************************************* | 10297 | /*+F************************************************************************* |
10296 | * Function: | 10298 | * Function: |
10297 | * aic7xxx_bus_device_reset | 10299 | * aic7xxx_bus_device_reset |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 05a78e515a24..17e3df4f016f 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -85,8 +85,7 @@ static int arcmsr_abort(struct scsi_cmnd *); | |||
85 | static int arcmsr_bus_reset(struct scsi_cmnd *); | 85 | static int arcmsr_bus_reset(struct scsi_cmnd *); |
86 | static int arcmsr_bios_param(struct scsi_device *sdev, | 86 | static int arcmsr_bios_param(struct scsi_device *sdev, |
87 | struct block_device *bdev, sector_t capacity, int *info); | 87 | struct block_device *bdev, sector_t capacity, int *info); |
88 | static int arcmsr_queue_command(struct scsi_cmnd *cmd, | 88 | static int arcmsr_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
89 | void (*done) (struct scsi_cmnd *)); | ||
90 | static int arcmsr_probe(struct pci_dev *pdev, | 89 | static int arcmsr_probe(struct pci_dev *pdev, |
91 | const struct pci_device_id *id); | 90 | const struct pci_device_id *id); |
92 | static void arcmsr_remove(struct pci_dev *pdev); | 91 | static void arcmsr_remove(struct pci_dev *pdev); |
@@ -2081,7 +2080,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, | |||
2081 | } | 2080 | } |
2082 | } | 2081 | } |
2083 | 2082 | ||
2084 | static int arcmsr_queue_command(struct scsi_cmnd *cmd, | 2083 | static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd, |
2085 | void (* done)(struct scsi_cmnd *)) | 2084 | void (* done)(struct scsi_cmnd *)) |
2086 | { | 2085 | { |
2087 | struct Scsi_Host *host = cmd->device->host; | 2086 | struct Scsi_Host *host = cmd->device->host; |
@@ -2124,6 +2123,8 @@ static int arcmsr_queue_command(struct scsi_cmnd *cmd, | |||
2124 | return 0; | 2123 | return 0; |
2125 | } | 2124 | } |
2126 | 2125 | ||
2126 | static DEF_SCSI_QCMD(arcmsr_queue_command) | ||
2127 | |||
2127 | static bool arcmsr_get_hba_config(struct AdapterControlBlock *acb) | 2128 | static bool arcmsr_get_hba_config(struct AdapterControlBlock *acb) |
2128 | { | 2129 | { |
2129 | struct MessageUnit_A __iomem *reg = acb->pmuA; | 2130 | struct MessageUnit_A __iomem *reg = acb->pmuA; |
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index 918ccf818757..ec166726b314 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c | |||
@@ -2511,7 +2511,7 @@ acornscsi_intr(int irq, void *dev_id) | |||
2511 | * done - function called on completion, with pointer to command descriptor | 2511 | * done - function called on completion, with pointer to command descriptor |
2512 | * Returns : 0, or < 0 on error. | 2512 | * Returns : 0, or < 0 on error. |
2513 | */ | 2513 | */ |
2514 | int acornscsi_queuecmd(struct scsi_cmnd *SCpnt, | 2514 | static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt, |
2515 | void (*done)(struct scsi_cmnd *)) | 2515 | void (*done)(struct scsi_cmnd *)) |
2516 | { | 2516 | { |
2517 | AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; | 2517 | AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; |
@@ -2561,6 +2561,8 @@ int acornscsi_queuecmd(struct scsi_cmnd *SCpnt, | |||
2561 | return 0; | 2561 | return 0; |
2562 | } | 2562 | } |
2563 | 2563 | ||
2564 | DEF_SCSI_QCMD(acornscsi_queuecmd) | ||
2565 | |||
2564 | /* | 2566 | /* |
2565 | * Prototype: void acornscsi_reportstatus(struct scsi_cmnd **SCpntp1, struct scsi_cmnd **SCpntp2, int result) | 2567 | * Prototype: void acornscsi_reportstatus(struct scsi_cmnd **SCpntp1, struct scsi_cmnd **SCpntp2, int result) |
2566 | * Purpose : pass a result to *SCpntp1, and check if *SCpntp1 = *SCpntp2 | 2568 | * Purpose : pass a result to *SCpntp1, and check if *SCpntp1 = *SCpntp2 |
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 9e71ac611146..2b2ce21e227e 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c | |||
@@ -2198,7 +2198,7 @@ no_command: | |||
2198 | * Returns: 0 on success, else error. | 2198 | * Returns: 0 on success, else error. |
2199 | * Notes: io_request_lock is held, interrupts are disabled. | 2199 | * Notes: io_request_lock is held, interrupts are disabled. |
2200 | */ | 2200 | */ |
2201 | int fas216_queue_command(struct scsi_cmnd *SCpnt, | 2201 | static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt, |
2202 | void (*done)(struct scsi_cmnd *)) | 2202 | void (*done)(struct scsi_cmnd *)) |
2203 | { | 2203 | { |
2204 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; | 2204 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; |
@@ -2240,6 +2240,8 @@ int fas216_queue_command(struct scsi_cmnd *SCpnt, | |||
2240 | return result; | 2240 | return result; |
2241 | } | 2241 | } |
2242 | 2242 | ||
2243 | DEF_SCSI_QCMD(fas216_queue_command) | ||
2244 | |||
2243 | /** | 2245 | /** |
2244 | * fas216_internal_done - trigger restart of a waiting thread in fas216_noqueue_command | 2246 | * fas216_internal_done - trigger restart of a waiting thread in fas216_noqueue_command |
2245 | * @SCpnt: Command to wake | 2247 | * @SCpnt: Command to wake |
@@ -2263,7 +2265,7 @@ static void fas216_internal_done(struct scsi_cmnd *SCpnt) | |||
2263 | * Returns: scsi result code. | 2265 | * Returns: scsi result code. |
2264 | * Notes: io_request_lock is held, interrupts are disabled. | 2266 | * Notes: io_request_lock is held, interrupts are disabled. |
2265 | */ | 2267 | */ |
2266 | int fas216_noqueue_command(struct scsi_cmnd *SCpnt, | 2268 | static int fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt, |
2267 | void (*done)(struct scsi_cmnd *)) | 2269 | void (*done)(struct scsi_cmnd *)) |
2268 | { | 2270 | { |
2269 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; | 2271 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; |
@@ -2277,7 +2279,7 @@ int fas216_noqueue_command(struct scsi_cmnd *SCpnt, | |||
2277 | BUG_ON(info->scsi.irq != NO_IRQ); | 2279 | BUG_ON(info->scsi.irq != NO_IRQ); |
2278 | 2280 | ||
2279 | info->internal_done = 0; | 2281 | info->internal_done = 0; |
2280 | fas216_queue_command(SCpnt, fas216_internal_done); | 2282 | fas216_queue_command_lck(SCpnt, fas216_internal_done); |
2281 | 2283 | ||
2282 | /* | 2284 | /* |
2283 | * This wastes time, since we can't return until the command is | 2285 | * This wastes time, since we can't return until the command is |
@@ -2310,6 +2312,8 @@ int fas216_noqueue_command(struct scsi_cmnd *SCpnt, | |||
2310 | return 0; | 2312 | return 0; |
2311 | } | 2313 | } |
2312 | 2314 | ||
2315 | DEF_SCSI_QCMD(fas216_noqueue_command) | ||
2316 | |||
2313 | /* | 2317 | /* |
2314 | * Error handler timeout function. Indicate that we timed out, | 2318 | * Error handler timeout function. Indicate that we timed out, |
2315 | * and wake up any error handler process so it can continue. | 2319 | * and wake up any error handler process so it can continue. |
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h index b65f4cf0eec9..377cfb72cc66 100644 --- a/drivers/scsi/arm/fas216.h +++ b/drivers/scsi/arm/fas216.h | |||
@@ -331,23 +331,21 @@ extern int fas216_init (struct Scsi_Host *instance); | |||
331 | */ | 331 | */ |
332 | extern int fas216_add (struct Scsi_Host *instance, struct device *dev); | 332 | extern int fas216_add (struct Scsi_Host *instance, struct device *dev); |
333 | 333 | ||
334 | /* Function: int fas216_queue_command(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 334 | /* Function: int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt) |
335 | * Purpose : queue a command for adapter to process. | 335 | * Purpose : queue a command for adapter to process. |
336 | * Params : SCpnt - Command to queue | 336 | * Params : h - host adapter |
337 | * done - done function to call once command is complete | 337 | * : SCpnt - Command to queue |
338 | * Returns : 0 - success, else error | 338 | * Returns : 0 - success, else error |
339 | */ | 339 | */ |
340 | extern int fas216_queue_command(struct scsi_cmnd *, | 340 | extern int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); |
341 | void (*done)(struct scsi_cmnd *)); | ||
342 | 341 | ||
343 | /* Function: int fas216_noqueue_command(istruct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 342 | /* Function: int fas216_noqueue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt) |
344 | * Purpose : queue a command for adapter to process, and process it to completion. | 343 | * Purpose : queue a command for adapter to process, and process it to completion. |
345 | * Params : SCpnt - Command to queue | 344 | * Params : h - host adapter |
346 | * done - done function to call once command is complete | 345 | * : SCpnt - Command to queue |
347 | * Returns : 0 - success, else error | 346 | * Returns : 0 - success, else error |
348 | */ | 347 | */ |
349 | extern int fas216_noqueue_command(struct scsi_cmnd *, | 348 | extern int fas216_noqueue_command(struct Scsi_Host *, struct scsi_cmnd *) |
350 | void (*done)(struct scsi_cmnd *)); | ||
351 | 349 | ||
352 | /* Function: irqreturn_t fas216_intr (FAS216_Info *info) | 350 | /* Function: irqreturn_t fas216_intr (FAS216_Info *info) |
353 | * Purpose : handle interrupts from the interface to progress a command | 351 | * Purpose : handle interrupts from the interface to progress a command |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 158ebc3644d8..88b2928b4d3b 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -910,7 +910,7 @@ static int __init NCR5380_init(struct Scsi_Host *instance, int flags) | |||
910 | * | 910 | * |
911 | */ | 911 | */ |
912 | 912 | ||
913 | static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | 913 | static int NCR5380_queue_command_lck(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) |
914 | { | 914 | { |
915 | SETUP_HOSTDATA(cmd->device->host); | 915 | SETUP_HOSTDATA(cmd->device->host); |
916 | Scsi_Cmnd *tmp; | 916 | Scsi_Cmnd *tmp; |
@@ -1022,6 +1022,8 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | |||
1022 | return 0; | 1022 | return 0; |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | static DEF_SCSI_QCMD(NCR5380_queue_command) | ||
1026 | |||
1025 | /* | 1027 | /* |
1026 | * Function : NCR5380_main (void) | 1028 | * Function : NCR5380_main (void) |
1027 | * | 1029 | * |
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index ad7a23aef0ec..3e8658e2f154 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -572,23 +572,6 @@ static void falcon_get_lock(void) | |||
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | /* This is the wrapper function for NCR5380_queue_command(). It just | ||
576 | * tries to get the lock on the ST-DMA (see above) and then calls the | ||
577 | * original function. | ||
578 | */ | ||
579 | |||
580 | #if 0 | ||
581 | int atari_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | ||
582 | { | ||
583 | /* falcon_get_lock(); | ||
584 | * ++guenther: moved to NCR5380_queue_command() to prevent | ||
585 | * race condition, see there for an explanation. | ||
586 | */ | ||
587 | return NCR5380_queue_command(cmd, done); | ||
588 | } | ||
589 | #endif | ||
590 | |||
591 | |||
592 | int __init atari_scsi_detect(struct scsi_host_template *host) | 575 | int __init atari_scsi_detect(struct scsi_host_template *host) |
593 | { | 576 | { |
594 | static int called = 0; | 577 | static int called = 0; |
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index ab5bdda6903e..76029d570beb 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -605,7 +605,7 @@ handled: | |||
605 | * | 605 | * |
606 | * Queue a command to the ATP queue. Called with the host lock held. | 606 | * Queue a command to the ATP queue. Called with the host lock held. |
607 | */ | 607 | */ |
608 | static int atp870u_queuecommand(struct scsi_cmnd * req_p, | 608 | static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, |
609 | void (*done) (struct scsi_cmnd *)) | 609 | void (*done) (struct scsi_cmnd *)) |
610 | { | 610 | { |
611 | unsigned char c; | 611 | unsigned char c; |
@@ -694,6 +694,8 @@ static int atp870u_queuecommand(struct scsi_cmnd * req_p, | |||
694 | return 0; | 694 | return 0; |
695 | } | 695 | } |
696 | 696 | ||
697 | static DEF_SCSI_QCMD(atp870u_queuecommand) | ||
698 | |||
697 | /** | 699 | /** |
698 | * send_s870 - send a command to the controller | 700 | * send_s870 - send a command to the controller |
699 | * @host: host | 701 | * @host: host |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 8daa716739d1..8ca967dee66d 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -30,8 +30,7 @@ DEFINE_IDR(bfad_im_port_index); | |||
30 | struct scsi_transport_template *bfad_im_scsi_transport_template; | 30 | struct scsi_transport_template *bfad_im_scsi_transport_template; |
31 | struct scsi_transport_template *bfad_im_scsi_vport_transport_template; | 31 | struct scsi_transport_template *bfad_im_scsi_vport_transport_template; |
32 | static void bfad_im_itnim_work_handler(struct work_struct *work); | 32 | static void bfad_im_itnim_work_handler(struct work_struct *work); |
33 | static int bfad_im_queuecommand(struct scsi_cmnd *cmnd, | 33 | static int bfad_im_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmnd); |
34 | void (*done)(struct scsi_cmnd *)); | ||
35 | static int bfad_im_slave_alloc(struct scsi_device *sdev); | 34 | static int bfad_im_slave_alloc(struct scsi_device *sdev); |
36 | static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, | 35 | static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, |
37 | struct bfad_itnim_s *itnim); | 36 | struct bfad_itnim_s *itnim); |
@@ -1120,7 +1119,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) | |||
1120 | * Scsi_Host template entry, queue a SCSI command to the BFAD. | 1119 | * Scsi_Host template entry, queue a SCSI command to the BFAD. |
1121 | */ | 1120 | */ |
1122 | static int | 1121 | static int |
1123 | bfad_im_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | 1122 | bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) |
1124 | { | 1123 | { |
1125 | struct bfad_im_port_s *im_port = | 1124 | struct bfad_im_port_s *im_port = |
1126 | (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; | 1125 | (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; |
@@ -1187,6 +1186,8 @@ out_fail_cmd: | |||
1187 | return 0; | 1186 | return 0; |
1188 | } | 1187 | } |
1189 | 1188 | ||
1189 | static DEF_SCSI_QCMD(bfad_im_queuecommand) | ||
1190 | |||
1190 | void | 1191 | void |
1191 | bfad_os_rport_online_wait(struct bfad_s *bfad) | 1192 | bfad_os_rport_online_wait(struct bfad_s *bfad) |
1192 | { | 1193 | { |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 54f50b07dac7..8f1b5c8bf903 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -1080,7 +1080,7 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb, | |||
1080 | * and is expected to be held on return. | 1080 | * and is expected to be held on return. |
1081 | * | 1081 | * |
1082 | **/ | 1082 | **/ |
1083 | static int dc395x_queue_command(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 1083 | static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
1084 | { | 1084 | { |
1085 | struct DeviceCtlBlk *dcb; | 1085 | struct DeviceCtlBlk *dcb; |
1086 | struct ScsiReqBlk *srb; | 1086 | struct ScsiReqBlk *srb; |
@@ -1154,6 +1154,7 @@ complete: | |||
1154 | return 0; | 1154 | return 0; |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | static DEF_SCSI_QCMD(dc395x_queue_command) | ||
1157 | 1158 | ||
1158 | /* | 1159 | /* |
1159 | * Return the disk geometry for the given SCSI device. | 1160 | * Return the disk geometry for the given SCSI device. |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 23dec0063385..cffcb108ac96 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -423,7 +423,7 @@ static int adpt_slave_configure(struct scsi_device * device) | |||
423 | return 0; | 423 | return 0; |
424 | } | 424 | } |
425 | 425 | ||
426 | static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) | 426 | static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) |
427 | { | 427 | { |
428 | adpt_hba* pHba = NULL; | 428 | adpt_hba* pHba = NULL; |
429 | struct adpt_device* pDev = NULL; /* dpt per device information */ | 429 | struct adpt_device* pDev = NULL; /* dpt per device information */ |
@@ -491,6 +491,8 @@ static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) | |||
491 | return adpt_scsi_to_i2o(pHba, cmd, pDev); | 491 | return adpt_scsi_to_i2o(pHba, cmd, pDev); |
492 | } | 492 | } |
493 | 493 | ||
494 | static DEF_SCSI_QCMD(adpt_queue) | ||
495 | |||
494 | static int adpt_bios_param(struct scsi_device *sdev, struct block_device *dev, | 496 | static int adpt_bios_param(struct scsi_device *sdev, struct block_device *dev, |
495 | sector_t capacity, int geom[]) | 497 | sector_t capacity, int geom[]) |
496 | { | 498 | { |
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h index 337746d46043..beded716f93f 100644 --- a/drivers/scsi/dpti.h +++ b/drivers/scsi/dpti.h | |||
@@ -29,7 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | static int adpt_detect(struct scsi_host_template * sht); | 31 | static int adpt_detect(struct scsi_host_template * sht); |
32 | static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); | 32 | static int adpt_queue(struct Scsi_Host *h, struct scsi_cmnd * cmd); |
33 | static int adpt_abort(struct scsi_cmnd * cmd); | 33 | static int adpt_abort(struct scsi_cmnd * cmd); |
34 | static int adpt_reset(struct scsi_cmnd* cmd); | 34 | static int adpt_reset(struct scsi_cmnd* cmd); |
35 | static int adpt_release(struct Scsi_Host *host); | 35 | static int adpt_release(struct Scsi_Host *host); |
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h index 0b205f8c7326..cdc621204b66 100644 --- a/drivers/scsi/dtc.h +++ b/drivers/scsi/dtc.h | |||
@@ -36,7 +36,7 @@ static int dtc_abort(Scsi_Cmnd *); | |||
36 | static int dtc_biosparam(struct scsi_device *, struct block_device *, | 36 | static int dtc_biosparam(struct scsi_device *, struct block_device *, |
37 | sector_t, int*); | 37 | sector_t, int*); |
38 | static int dtc_detect(struct scsi_host_template *); | 38 | static int dtc_detect(struct scsi_host_template *); |
39 | static int dtc_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 39 | static int dtc_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
40 | static int dtc_bus_reset(Scsi_Cmnd *); | 40 | static int dtc_bus_reset(Scsi_Cmnd *); |
41 | 41 | ||
42 | #ifndef CMD_PER_LUN | 42 | #ifndef CMD_PER_LUN |
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index d1c31378f6da..53925ac178fd 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c | |||
@@ -505,8 +505,7 @@ | |||
505 | 505 | ||
506 | static int eata2x_detect(struct scsi_host_template *); | 506 | static int eata2x_detect(struct scsi_host_template *); |
507 | static int eata2x_release(struct Scsi_Host *); | 507 | static int eata2x_release(struct Scsi_Host *); |
508 | static int eata2x_queuecommand(struct scsi_cmnd *, | 508 | static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
509 | void (*done) (struct scsi_cmnd *)); | ||
510 | static int eata2x_eh_abort(struct scsi_cmnd *); | 509 | static int eata2x_eh_abort(struct scsi_cmnd *); |
511 | static int eata2x_eh_host_reset(struct scsi_cmnd *); | 510 | static int eata2x_eh_host_reset(struct scsi_cmnd *); |
512 | static int eata2x_bios_param(struct scsi_device *, struct block_device *, | 511 | static int eata2x_bios_param(struct scsi_device *, struct block_device *, |
@@ -1758,7 +1757,7 @@ static void scsi_to_dev_dir(unsigned int i, struct hostdata *ha) | |||
1758 | 1757 | ||
1759 | } | 1758 | } |
1760 | 1759 | ||
1761 | static int eata2x_queuecommand(struct scsi_cmnd *SCpnt, | 1760 | static int eata2x_queuecommand_lck(struct scsi_cmnd *SCpnt, |
1762 | void (*done) (struct scsi_cmnd *)) | 1761 | void (*done) (struct scsi_cmnd *)) |
1763 | { | 1762 | { |
1764 | struct Scsi_Host *shost = SCpnt->device->host; | 1763 | struct Scsi_Host *shost = SCpnt->device->host; |
@@ -1843,6 +1842,8 @@ static int eata2x_queuecommand(struct scsi_cmnd *SCpnt, | |||
1843 | return 0; | 1842 | return 0; |
1844 | } | 1843 | } |
1845 | 1844 | ||
1845 | static DEF_SCSI_QCMD(eata2x_queuecommand) | ||
1846 | |||
1846 | static int eata2x_eh_abort(struct scsi_cmnd *SCarg) | 1847 | static int eata2x_eh_abort(struct scsi_cmnd *SCarg) |
1847 | { | 1848 | { |
1848 | struct Scsi_Host *shost = SCarg->device->host; | 1849 | struct Scsi_Host *shost = SCarg->device->host; |
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 60886c19065e..4a9641e69f54 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c | |||
@@ -335,7 +335,7 @@ static inline unsigned int eata_pio_send_command(unsigned long base, unsigned ch | |||
335 | return 0; | 335 | return 0; |
336 | } | 336 | } |
337 | 337 | ||
338 | static int eata_pio_queue(struct scsi_cmnd *cmd, | 338 | static int eata_pio_queue_lck(struct scsi_cmnd *cmd, |
339 | void (*done)(struct scsi_cmnd *)) | 339 | void (*done)(struct scsi_cmnd *)) |
340 | { | 340 | { |
341 | unsigned int x, y; | 341 | unsigned int x, y; |
@@ -438,6 +438,8 @@ static int eata_pio_queue(struct scsi_cmnd *cmd, | |||
438 | return 0; | 438 | return 0; |
439 | } | 439 | } |
440 | 440 | ||
441 | static DEF_SCSI_QCMD(eata_pio_queue) | ||
442 | |||
441 | static int eata_pio_abort(struct scsi_cmnd *cmd) | 443 | static int eata_pio_abort(struct scsi_cmnd *cmd) |
442 | { | 444 | { |
443 | unsigned int loop = 100; | 445 | unsigned int loop = 100; |
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index e2bc779f86c1..57558523c1b8 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c | |||
@@ -916,7 +916,7 @@ static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent) | |||
916 | scsi_track_queue_full(dev, lp->num_tagged - 1); | 916 | scsi_track_queue_full(dev, lp->num_tagged - 1); |
917 | } | 917 | } |
918 | 918 | ||
919 | static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 919 | static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
920 | { | 920 | { |
921 | struct scsi_device *dev = cmd->device; | 921 | struct scsi_device *dev = cmd->device; |
922 | struct esp *esp = shost_priv(dev->host); | 922 | struct esp *esp = shost_priv(dev->host); |
@@ -941,6 +941,8 @@ static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd | |||
941 | return 0; | 941 | return 0; |
942 | } | 942 | } |
943 | 943 | ||
944 | static DEF_SCSI_QCMD(esp_queuecommand) | ||
945 | |||
944 | static int esp_check_gross_error(struct esp *esp) | 946 | static int esp_check_gross_error(struct esp *esp) |
945 | { | 947 | { |
946 | if (esp->sreg & ESP_STAT_SPAM) { | 948 | if (esp->sreg & ESP_STAT_SPAM) { |
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c index 2ad95aa8f585..a2c6135d337e 100644 --- a/drivers/scsi/fd_mcs.c +++ b/drivers/scsi/fd_mcs.c | |||
@@ -1072,7 +1072,7 @@ static int fd_mcs_release(struct Scsi_Host *shpnt) | |||
1072 | return 0; | 1072 | return 0; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | 1075 | static int fd_mcs_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) |
1076 | { | 1076 | { |
1077 | struct Scsi_Host *shpnt = SCpnt->device->host; | 1077 | struct Scsi_Host *shpnt = SCpnt->device->host; |
1078 | 1078 | ||
@@ -1122,6 +1122,8 @@ static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
1122 | return 0; | 1122 | return 0; |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | static DEF_SCSI_QCMD(fd_mcs_queue) | ||
1126 | |||
1125 | #if DEBUG_ABORT || DEBUG_RESET | 1127 | #if DEBUG_ABORT || DEBUG_RESET |
1126 | static void fd_mcs_print_info(Scsi_Cmnd * SCpnt) | 1128 | static void fd_mcs_print_info(Scsi_Cmnd * SCpnt) |
1127 | { | 1129 | { |
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index e296bcc57d5c..69b7aa54f43f 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c | |||
@@ -1419,7 +1419,7 @@ static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id) | |||
1419 | return IRQ_HANDLED; | 1419 | return IRQ_HANDLED; |
1420 | } | 1420 | } |
1421 | 1421 | ||
1422 | static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt, | 1422 | static int fdomain_16x0_queue_lck(struct scsi_cmnd *SCpnt, |
1423 | void (*done)(struct scsi_cmnd *)) | 1423 | void (*done)(struct scsi_cmnd *)) |
1424 | { | 1424 | { |
1425 | if (in_command) { | 1425 | if (in_command) { |
@@ -1469,6 +1469,8 @@ static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt, | |||
1469 | return 0; | 1469 | return 0; |
1470 | } | 1470 | } |
1471 | 1471 | ||
1472 | static DEF_SCSI_QCMD(fdomain_16x0_queue) | ||
1473 | |||
1472 | #if DEBUG_ABORT | 1474 | #if DEBUG_ABORT |
1473 | static void print_info(struct scsi_cmnd *SCpnt) | 1475 | static void print_info(struct scsi_cmnd *SCpnt) |
1474 | { | 1476 | { |
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index cbb20b13b228..92f185081e62 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
@@ -246,7 +246,7 @@ void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *); | |||
246 | void fnic_update_mac(struct fc_lport *, u8 *new); | 246 | void fnic_update_mac(struct fc_lport *, u8 *new); |
247 | void fnic_update_mac_locked(struct fnic *, u8 *new); | 247 | void fnic_update_mac_locked(struct fnic *, u8 *new); |
248 | 248 | ||
249 | int fnic_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); | 249 | int fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
250 | int fnic_abort_cmd(struct scsi_cmnd *); | 250 | int fnic_abort_cmd(struct scsi_cmnd *); |
251 | int fnic_device_reset(struct scsi_cmnd *); | 251 | int fnic_device_reset(struct scsi_cmnd *); |
252 | int fnic_host_reset(struct scsi_cmnd *); | 252 | int fnic_host_reset(struct scsi_cmnd *); |
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 198cbab3e894..22d02404d15f 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c | |||
@@ -349,7 +349,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, | |||
349 | * Routine to send a scsi cdb | 349 | * Routine to send a scsi cdb |
350 | * Called with host_lock held and interrupts disabled. | 350 | * Called with host_lock held and interrupts disabled. |
351 | */ | 351 | */ |
352 | int fnic_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) | 352 | static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) |
353 | { | 353 | { |
354 | struct fc_lport *lp; | 354 | struct fc_lport *lp; |
355 | struct fc_rport *rport; | 355 | struct fc_rport *rport; |
@@ -457,6 +457,8 @@ out: | |||
457 | return ret; | 457 | return ret; |
458 | } | 458 | } |
459 | 459 | ||
460 | DEF_SCSI_QCMD(fnic_queuecommand) | ||
461 | |||
460 | /* | 462 | /* |
461 | * fnic_fcpio_fw_reset_cmpl_handler | 463 | * fnic_fcpio_fw_reset_cmpl_handler |
462 | * Routine to handle fw reset completion | 464 | * Routine to handle fw reset completion |
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h index 921764c9ab24..1bcdb7beb77b 100644 --- a/drivers/scsi/g_NCR5380.h +++ b/drivers/scsi/g_NCR5380.h | |||
@@ -46,7 +46,7 @@ | |||
46 | static int generic_NCR5380_abort(Scsi_Cmnd *); | 46 | static int generic_NCR5380_abort(Scsi_Cmnd *); |
47 | static int generic_NCR5380_detect(struct scsi_host_template *); | 47 | static int generic_NCR5380_detect(struct scsi_host_template *); |
48 | static int generic_NCR5380_release_resources(struct Scsi_Host *); | 48 | static int generic_NCR5380_release_resources(struct Scsi_Host *); |
49 | static int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 49 | static int generic_NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
50 | static int generic_NCR5380_bus_reset(Scsi_Cmnd *); | 50 | static int generic_NCR5380_bus_reset(Scsi_Cmnd *); |
51 | static const char* generic_NCR5380_info(struct Scsi_Host *); | 51 | static const char* generic_NCR5380_info(struct Scsi_Host *); |
52 | 52 | ||
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 841101846b88..76365700e2d5 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -185,7 +185,7 @@ static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd, | |||
185 | unsigned long arg); | 185 | unsigned long arg); |
186 | 186 | ||
187 | static void gdth_flush(gdth_ha_str *ha); | 187 | static void gdth_flush(gdth_ha_str *ha); |
188 | static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); | 188 | static int gdth_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
189 | static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, | 189 | static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, |
190 | struct gdth_cmndinfo *cmndinfo); | 190 | struct gdth_cmndinfo *cmndinfo); |
191 | static void gdth_scsi_done(struct scsi_cmnd *scp); | 191 | static void gdth_scsi_done(struct scsi_cmnd *scp); |
@@ -4004,7 +4004,7 @@ static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,se | |||
4004 | } | 4004 | } |
4005 | 4005 | ||
4006 | 4006 | ||
4007 | static int gdth_queuecommand(struct scsi_cmnd *scp, | 4007 | static int gdth_queuecommand_lck(struct scsi_cmnd *scp, |
4008 | void (*done)(struct scsi_cmnd *)) | 4008 | void (*done)(struct scsi_cmnd *)) |
4009 | { | 4009 | { |
4010 | gdth_ha_str *ha = shost_priv(scp->device->host); | 4010 | gdth_ha_str *ha = shost_priv(scp->device->host); |
@@ -4022,6 +4022,8 @@ static int gdth_queuecommand(struct scsi_cmnd *scp, | |||
4022 | return __gdth_queuecommand(ha, scp, cmndinfo); | 4022 | return __gdth_queuecommand(ha, scp, cmndinfo); |
4023 | } | 4023 | } |
4024 | 4024 | ||
4025 | static DEF_SCSI_QCMD(gdth_queuecommand) | ||
4026 | |||
4025 | static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, | 4027 | static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, |
4026 | struct gdth_cmndinfo *cmndinfo) | 4028 | struct gdth_cmndinfo *cmndinfo) |
4027 | { | 4029 | { |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index c5d0606ad097..b2fb2b2a6e70 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/spinlock.h> | 33 | #include <linux/spinlock.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
36 | #include <linux/blktrace_api.h> | 35 | #include <linux/blktrace_api.h> |
37 | #include <linux/uaccess.h> | 36 | #include <linux/uaccess.h> |
@@ -143,8 +142,7 @@ static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, | |||
143 | void *buff, size_t size, u8 page_code, unsigned char *scsi3addr, | 142 | void *buff, size_t size, u8 page_code, unsigned char *scsi3addr, |
144 | int cmd_type); | 143 | int cmd_type); |
145 | 144 | ||
146 | static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd, | 145 | static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
147 | void (*done)(struct scsi_cmnd *)); | ||
148 | static void hpsa_scan_start(struct Scsi_Host *); | 146 | static void hpsa_scan_start(struct Scsi_Host *); |
149 | static int hpsa_scan_finished(struct Scsi_Host *sh, | 147 | static int hpsa_scan_finished(struct Scsi_Host *sh, |
150 | unsigned long elapsed_time); | 148 | unsigned long elapsed_time); |
@@ -1926,7 +1924,7 @@ sglist_finished: | |||
1926 | } | 1924 | } |
1927 | 1925 | ||
1928 | 1926 | ||
1929 | static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd, | 1927 | static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd, |
1930 | void (*done)(struct scsi_cmnd *)) | 1928 | void (*done)(struct scsi_cmnd *)) |
1931 | { | 1929 | { |
1932 | struct ctlr_info *h; | 1930 | struct ctlr_info *h; |
@@ -2020,6 +2018,8 @@ static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd, | |||
2020 | return 0; | 2018 | return 0; |
2021 | } | 2019 | } |
2022 | 2020 | ||
2021 | static DEF_SCSI_QCMD(hpsa_scsi_queue_command) | ||
2022 | |||
2023 | static void hpsa_scan_start(struct Scsi_Host *sh) | 2023 | static void hpsa_scan_start(struct Scsi_Host *sh) |
2024 | { | 2024 | { |
2025 | struct ctlr_info *h = shost_to_hba(sh); | 2025 | struct ctlr_info *h = shost_to_hba(sh); |
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index 0729f150b33a..10b65556937b 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -751,7 +751,7 @@ static void hptiop_post_req_mv(struct hptiop_hba *hba, | |||
751 | MVIOP_MU_QUEUE_ADDR_HOST_BIT | size_bit, hba); | 751 | MVIOP_MU_QUEUE_ADDR_HOST_BIT | size_bit, hba); |
752 | } | 752 | } |
753 | 753 | ||
754 | static int hptiop_queuecommand(struct scsi_cmnd *scp, | 754 | static int hptiop_queuecommand_lck(struct scsi_cmnd *scp, |
755 | void (*done)(struct scsi_cmnd *)) | 755 | void (*done)(struct scsi_cmnd *)) |
756 | { | 756 | { |
757 | struct Scsi_Host *host = scp->device->host; | 757 | struct Scsi_Host *host = scp->device->host; |
@@ -819,6 +819,8 @@ cmd_done: | |||
819 | return 0; | 819 | return 0; |
820 | } | 820 | } |
821 | 821 | ||
822 | static DEF_SCSI_QCMD(hptiop_queuecommand) | ||
823 | |||
822 | static const char *hptiop_info(struct Scsi_Host *host) | 824 | static const char *hptiop_info(struct Scsi_Host *host) |
823 | { | 825 | { |
824 | return driver_name_long; | 826 | return driver_name_long; |
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index 9a4b69d4f4eb..67fc8ffd52e6 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <scsi/scsi_host.h> | 39 | #include <scsi/scsi_host.h> |
40 | 40 | ||
41 | /* Common forward declarations for all Linux-versions: */ | 41 | /* Common forward declarations for all Linux-versions: */ |
42 | static int ibmmca_queuecommand (Scsi_Cmnd *, void (*done) (Scsi_Cmnd *)); | 42 | static int ibmmca_queuecommand (struct Scsi_Host *, struct scsi_cmnd *); |
43 | static int ibmmca_abort (Scsi_Cmnd *); | 43 | static int ibmmca_abort (Scsi_Cmnd *); |
44 | static int ibmmca_host_reset (Scsi_Cmnd *); | 44 | static int ibmmca_host_reset (Scsi_Cmnd *); |
45 | static int ibmmca_biosparam (struct scsi_device *, struct block_device *, sector_t, int *); | 45 | static int ibmmca_biosparam (struct scsi_device *, struct block_device *, sector_t, int *); |
@@ -1691,7 +1691,7 @@ static int __devexit ibmmca_remove(struct device *dev) | |||
1691 | } | 1691 | } |
1692 | 1692 | ||
1693 | /* The following routine is the SCSI command queue for the midlevel driver */ | 1693 | /* The following routine is the SCSI command queue for the midlevel driver */ |
1694 | static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | 1694 | static int ibmmca_queuecommand_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) |
1695 | { | 1695 | { |
1696 | unsigned int ldn; | 1696 | unsigned int ldn; |
1697 | unsigned int scsi_cmd; | 1697 | unsigned int scsi_cmd; |
@@ -1996,6 +1996,8 @@ static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
1996 | return 0; | 1996 | return 0; |
1997 | } | 1997 | } |
1998 | 1998 | ||
1999 | static DEF_SCSI_QCMD(ibmmca_queuecommand) | ||
2000 | |||
1999 | static int __ibmmca_abort(Scsi_Cmnd * cmd) | 2001 | static int __ibmmca_abort(Scsi_Cmnd * cmd) |
2000 | { | 2002 | { |
2001 | /* Abort does not work, as the adapter never generates an interrupt on | 2003 | /* Abort does not work, as the adapter never generates an interrupt on |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 00d08b25425f..57cad7e20caa 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -1606,7 +1606,7 @@ static inline int ibmvfc_host_chkready(struct ibmvfc_host *vhost) | |||
1606 | * Returns: | 1606 | * Returns: |
1607 | * 0 on success / other on failure | 1607 | * 0 on success / other on failure |
1608 | **/ | 1608 | **/ |
1609 | static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd, | 1609 | static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, |
1610 | void (*done) (struct scsi_cmnd *)) | 1610 | void (*done) (struct scsi_cmnd *)) |
1611 | { | 1611 | { |
1612 | struct ibmvfc_host *vhost = shost_priv(cmnd->device->host); | 1612 | struct ibmvfc_host *vhost = shost_priv(cmnd->device->host); |
@@ -1672,6 +1672,8 @@ static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd, | |||
1672 | return 0; | 1672 | return 0; |
1673 | } | 1673 | } |
1674 | 1674 | ||
1675 | static DEF_SCSI_QCMD(ibmvfc_queuecommand) | ||
1676 | |||
1675 | /** | 1677 | /** |
1676 | * ibmvfc_sync_completion - Signal that a synchronous command has completed | 1678 | * ibmvfc_sync_completion - Signal that a synchronous command has completed |
1677 | * @evt: ibmvfc event struct | 1679 | * @evt: ibmvfc event struct |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 67f78a470f5f..041958453e2a 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -713,7 +713,7 @@ static inline u16 lun_from_dev(struct scsi_device *dev) | |||
713 | * @cmd: struct scsi_cmnd to be executed | 713 | * @cmd: struct scsi_cmnd to be executed |
714 | * @done: Callback function to be called when cmd is completed | 714 | * @done: Callback function to be called when cmd is completed |
715 | */ | 715 | */ |
716 | static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd, | 716 | static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd, |
717 | void (*done) (struct scsi_cmnd *)) | 717 | void (*done) (struct scsi_cmnd *)) |
718 | { | 718 | { |
719 | struct srp_cmd *srp_cmd; | 719 | struct srp_cmd *srp_cmd; |
@@ -766,6 +766,8 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd, | |||
766 | return ibmvscsi_send_srp_event(evt_struct, hostdata, 0); | 766 | return ibmvscsi_send_srp_event(evt_struct, hostdata, 0); |
767 | } | 767 | } |
768 | 768 | ||
769 | static DEF_SCSI_QCMD(ibmvscsi_queuecommand) | ||
770 | |||
769 | /* ------------------------------------------------------------ | 771 | /* ------------------------------------------------------------ |
770 | * Routines for driver initialization | 772 | * Routines for driver initialization |
771 | */ | 773 | */ |
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 4734ab0b3ff6..99aa0e5699bc 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c | |||
@@ -926,7 +926,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) | |||
926 | return 0; | 926 | return 0; |
927 | } | 927 | } |
928 | 928 | ||
929 | static int imm_queuecommand(struct scsi_cmnd *cmd, | 929 | static int imm_queuecommand_lck(struct scsi_cmnd *cmd, |
930 | void (*done)(struct scsi_cmnd *)) | 930 | void (*done)(struct scsi_cmnd *)) |
931 | { | 931 | { |
932 | imm_struct *dev = imm_dev(cmd->device->host); | 932 | imm_struct *dev = imm_dev(cmd->device->host); |
@@ -949,6 +949,8 @@ static int imm_queuecommand(struct scsi_cmnd *cmd, | |||
949 | return 0; | 949 | return 0; |
950 | } | 950 | } |
951 | 951 | ||
952 | static DEF_SCSI_QCMD(imm_queuecommand) | ||
953 | |||
952 | /* | 954 | /* |
953 | * Apparently the disk->capacity attribute is off by 1 sector | 955 | * Apparently the disk->capacity attribute is off by 1 sector |
954 | * for all disk drives. We add the one here, but it should really | 956 | * for all disk drives. We add the one here, but it should really |
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index 52bdc6df6b92..6568aab745a0 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c | |||
@@ -334,7 +334,7 @@ static uchar calc_sync_xfer(unsigned int period, unsigned int offset) | |||
334 | 334 | ||
335 | static void in2000_execute(struct Scsi_Host *instance); | 335 | static void in2000_execute(struct Scsi_Host *instance); |
336 | 336 | ||
337 | static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | 337 | static int in2000_queuecommand_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) |
338 | { | 338 | { |
339 | struct Scsi_Host *instance; | 339 | struct Scsi_Host *instance; |
340 | struct IN2000_hostdata *hostdata; | 340 | struct IN2000_hostdata *hostdata; |
@@ -431,6 +431,8 @@ static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
431 | return 0; | 431 | return 0; |
432 | } | 432 | } |
433 | 433 | ||
434 | static DEF_SCSI_QCMD(in2000_queuecommand) | ||
435 | |||
434 | 436 | ||
435 | 437 | ||
436 | /* | 438 | /* |
diff --git a/drivers/scsi/in2000.h b/drivers/scsi/in2000.h index 0fb8b06b8392..5821e1fbce08 100644 --- a/drivers/scsi/in2000.h +++ b/drivers/scsi/in2000.h | |||
@@ -396,7 +396,7 @@ struct IN2000_hostdata { | |||
396 | flags) | 396 | flags) |
397 | 397 | ||
398 | static int in2000_detect(struct scsi_host_template *) in2000__INIT; | 398 | static int in2000_detect(struct scsi_host_template *) in2000__INIT; |
399 | static int in2000_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 399 | static int in2000_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
400 | static int in2000_abort(Scsi_Cmnd *); | 400 | static int in2000_abort(Scsi_Cmnd *); |
401 | static void in2000_setup(char *, int *) in2000__INIT; | 401 | static void in2000_setup(char *, int *) in2000__INIT; |
402 | static int in2000_biosparam(struct scsi_device *, struct block_device *, | 402 | static int in2000_biosparam(struct scsi_device *, struct block_device *, |
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 108797761b95..9627d062e16b 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c | |||
@@ -2639,7 +2639,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c | |||
2639 | * will cause the mid layer to call us again later with the command) | 2639 | * will cause the mid layer to call us again later with the command) |
2640 | */ | 2640 | */ |
2641 | 2641 | ||
2642 | static int i91u_queuecommand(struct scsi_cmnd *cmd, | 2642 | static int i91u_queuecommand_lck(struct scsi_cmnd *cmd, |
2643 | void (*done)(struct scsi_cmnd *)) | 2643 | void (*done)(struct scsi_cmnd *)) |
2644 | { | 2644 | { |
2645 | struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata; | 2645 | struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata; |
@@ -2656,6 +2656,8 @@ static int i91u_queuecommand(struct scsi_cmnd *cmd, | |||
2656 | return 0; | 2656 | return 0; |
2657 | } | 2657 | } |
2658 | 2658 | ||
2659 | static DEF_SCSI_QCMD(i91u_queuecommand) | ||
2660 | |||
2659 | /** | 2661 | /** |
2660 | * i91u_bus_reset - reset the SCSI bus | 2662 | * i91u_bus_reset - reset the SCSI bus |
2661 | * @cmnd: Command block we want to trigger the reset for | 2663 | * @cmnd: Command block we want to trigger the reset for |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index fa60d7df44be..5bbaee597e88 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -5709,7 +5709,7 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) | |||
5709 | * SCSI_MLQUEUE_DEVICE_BUSY if device is busy | 5709 | * SCSI_MLQUEUE_DEVICE_BUSY if device is busy |
5710 | * SCSI_MLQUEUE_HOST_BUSY if host is busy | 5710 | * SCSI_MLQUEUE_HOST_BUSY if host is busy |
5711 | **/ | 5711 | **/ |
5712 | static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd, | 5712 | static int ipr_queuecommand_lck(struct scsi_cmnd *scsi_cmd, |
5713 | void (*done) (struct scsi_cmnd *)) | 5713 | void (*done) (struct scsi_cmnd *)) |
5714 | { | 5714 | { |
5715 | struct ipr_ioa_cfg *ioa_cfg; | 5715 | struct ipr_ioa_cfg *ioa_cfg; |
@@ -5792,6 +5792,8 @@ static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd, | |||
5792 | return 0; | 5792 | return 0; |
5793 | } | 5793 | } |
5794 | 5794 | ||
5795 | static DEF_SCSI_QCMD(ipr_queuecommand) | ||
5796 | |||
5795 | /** | 5797 | /** |
5796 | * ipr_ioctl - IOCTL handler | 5798 | * ipr_ioctl - IOCTL handler |
5797 | * @sdev: scsi device struct | 5799 | * @sdev: scsi device struct |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index f83a116955f2..b2511acd39bd 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -232,7 +232,7 @@ static int ips_detect(struct scsi_host_template *); | |||
232 | static int ips_release(struct Scsi_Host *); | 232 | static int ips_release(struct Scsi_Host *); |
233 | static int ips_eh_abort(struct scsi_cmnd *); | 233 | static int ips_eh_abort(struct scsi_cmnd *); |
234 | static int ips_eh_reset(struct scsi_cmnd *); | 234 | static int ips_eh_reset(struct scsi_cmnd *); |
235 | static int ips_queue(struct scsi_cmnd *, void (*)(struct scsi_cmnd *)); | 235 | static int ips_queue(struct Scsi_Host *, struct scsi_cmnd *); |
236 | static const char *ips_info(struct Scsi_Host *); | 236 | static const char *ips_info(struct Scsi_Host *); |
237 | static irqreturn_t do_ipsintr(int, void *); | 237 | static irqreturn_t do_ipsintr(int, void *); |
238 | static int ips_hainit(ips_ha_t *); | 238 | static int ips_hainit(ips_ha_t *); |
@@ -1046,7 +1046,7 @@ static int ips_eh_reset(struct scsi_cmnd *SC) | |||
1046 | /* Linux obtains io_request_lock before calling this function */ | 1046 | /* Linux obtains io_request_lock before calling this function */ |
1047 | /* */ | 1047 | /* */ |
1048 | /****************************************************************************/ | 1048 | /****************************************************************************/ |
1049 | static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)) | 1049 | static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)) |
1050 | { | 1050 | { |
1051 | ips_ha_t *ha; | 1051 | ips_ha_t *ha; |
1052 | ips_passthru_t *pt; | 1052 | ips_passthru_t *pt; |
@@ -1137,6 +1137,8 @@ static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)) | |||
1137 | return (0); | 1137 | return (0); |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | static DEF_SCSI_QCMD(ips_queue) | ||
1141 | |||
1140 | /****************************************************************************/ | 1142 | /****************************************************************************/ |
1141 | /* */ | 1143 | /* */ |
1142 | /* Routine Name: ips_biosparam */ | 1144 | /* Routine Name: ips_biosparam */ |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index e340373b509b..2924363d142b 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -1753,7 +1753,7 @@ static inline int fc_fcp_lport_queue_ready(struct fc_lport *lport) | |||
1753 | * This is the i/o strategy routine, called by the SCSI layer. This routine | 1753 | * This is the i/o strategy routine, called by the SCSI layer. This routine |
1754 | * is called with the host_lock held. | 1754 | * is called with the host_lock held. |
1755 | */ | 1755 | */ |
1756 | int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *)) | 1756 | static int fc_queuecommand_lck(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *)) |
1757 | { | 1757 | { |
1758 | struct fc_lport *lport; | 1758 | struct fc_lport *lport; |
1759 | struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); | 1759 | struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); |
@@ -1851,6 +1851,8 @@ out: | |||
1851 | spin_lock_irq(lport->host->host_lock); | 1851 | spin_lock_irq(lport->host->host_lock); |
1852 | return rc; | 1852 | return rc; |
1853 | } | 1853 | } |
1854 | |||
1855 | DEF_SCSI_QCMD(fc_queuecommand) | ||
1854 | EXPORT_SYMBOL(fc_queuecommand); | 1856 | EXPORT_SYMBOL(fc_queuecommand); |
1855 | 1857 | ||
1856 | /** | 1858 | /** |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 633e09036357..c15fde808c33 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1599,7 +1599,7 @@ enum { | |||
1599 | FAILURE_SESSION_NOT_READY, | 1599 | FAILURE_SESSION_NOT_READY, |
1600 | }; | 1600 | }; |
1601 | 1601 | ||
1602 | int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) | 1602 | static int iscsi_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) |
1603 | { | 1603 | { |
1604 | struct iscsi_cls_session *cls_session; | 1604 | struct iscsi_cls_session *cls_session; |
1605 | struct Scsi_Host *host; | 1605 | struct Scsi_Host *host; |
@@ -1736,6 +1736,8 @@ fault: | |||
1736 | spin_lock(host->host_lock); | 1736 | spin_lock(host->host_lock); |
1737 | return 0; | 1737 | return 0; |
1738 | } | 1738 | } |
1739 | |||
1740 | DEF_SCSI_QCMD(iscsi_queuecommand) | ||
1739 | EXPORT_SYMBOL_GPL(iscsi_queuecommand); | 1741 | EXPORT_SYMBOL_GPL(iscsi_queuecommand); |
1740 | 1742 | ||
1741 | int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason) | 1743 | int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason) |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 55f09e92ab59..29251fabecc6 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -189,7 +189,7 @@ int sas_queue_up(struct sas_task *task) | |||
189 | * Note: XXX: Remove the host unlock/lock pair when SCSI Core can | 189 | * Note: XXX: Remove the host unlock/lock pair when SCSI Core can |
190 | * call us without holding an IRQ spinlock... | 190 | * call us without holding an IRQ spinlock... |
191 | */ | 191 | */ |
192 | int sas_queuecommand(struct scsi_cmnd *cmd, | 192 | static int sas_queuecommand_lck(struct scsi_cmnd *cmd, |
193 | void (*scsi_done)(struct scsi_cmnd *)) | 193 | void (*scsi_done)(struct scsi_cmnd *)) |
194 | __releases(host->host_lock) | 194 | __releases(host->host_lock) |
195 | __acquires(dev->sata_dev.ap->lock) | 195 | __acquires(dev->sata_dev.ap->lock) |
@@ -254,6 +254,8 @@ out: | |||
254 | return res; | 254 | return res; |
255 | } | 255 | } |
256 | 256 | ||
257 | DEF_SCSI_QCMD(sas_queuecommand) | ||
258 | |||
257 | static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) | 259 | static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) |
258 | { | 260 | { |
259 | struct sas_task *task = TO_SAS_TASK(cmd); | 261 | struct sas_task *task = TO_SAS_TASK(cmd); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index f64b65a770b8..581837b3c71a 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -2899,7 +2899,7 @@ void lpfc_poll_timeout(unsigned long ptr) | |||
2899 | * SCSI_MLQUEUE_HOST_BUSY - Block all devices served by this host temporarily. | 2899 | * SCSI_MLQUEUE_HOST_BUSY - Block all devices served by this host temporarily. |
2900 | **/ | 2900 | **/ |
2901 | static int | 2901 | static int |
2902 | lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | 2902 | lpfc_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) |
2903 | { | 2903 | { |
2904 | struct Scsi_Host *shost = cmnd->device->host; | 2904 | struct Scsi_Host *shost = cmnd->device->host; |
2905 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 2905 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
@@ -3060,6 +3060,8 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
3060 | return 0; | 3060 | return 0; |
3061 | } | 3061 | } |
3062 | 3062 | ||
3063 | static DEF_SCSI_QCMD(lpfc_queuecommand) | ||
3064 | |||
3063 | /** | 3065 | /** |
3064 | * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point | 3066 | * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point |
3065 | * @cmnd: Pointer to scsi_cmnd data structure. | 3067 | * @cmnd: Pointer to scsi_cmnd data structure. |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 3ddb4dc62d5d..6c42dff0f4d3 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -66,7 +66,7 @@ static void cmd_done(struct fsc_state *, int result); | |||
66 | static void set_dma_cmds(struct fsc_state *, struct scsi_cmnd *); | 66 | static void set_dma_cmds(struct fsc_state *, struct scsi_cmnd *); |
67 | 67 | ||
68 | 68 | ||
69 | static int mac53c94_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 69 | static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
70 | { | 70 | { |
71 | struct fsc_state *state; | 71 | struct fsc_state *state; |
72 | 72 | ||
@@ -99,6 +99,8 @@ static int mac53c94_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd * | |||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | static DEF_SCSI_QCMD(mac53c94_queue) | ||
103 | |||
102 | static int mac53c94_host_reset(struct scsi_cmnd *cmd) | 104 | static int mac53c94_host_reset(struct scsi_cmnd *cmd) |
103 | { | 105 | { |
104 | struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; | 106 | struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 7ceb5cf12c6b..9aa048525eb2 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -366,7 +366,7 @@ mega_runpendq(adapter_t *adapter) | |||
366 | * The command queuing entry point for the mid-layer. | 366 | * The command queuing entry point for the mid-layer. |
367 | */ | 367 | */ |
368 | static int | 368 | static int |
369 | megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) | 369 | megaraid_queue_lck(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) |
370 | { | 370 | { |
371 | adapter_t *adapter; | 371 | adapter_t *adapter; |
372 | scb_t *scb; | 372 | scb_t *scb; |
@@ -409,6 +409,8 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) | |||
409 | return busy; | 409 | return busy; |
410 | } | 410 | } |
411 | 411 | ||
412 | static DEF_SCSI_QCMD(megaraid_queue) | ||
413 | |||
412 | /** | 414 | /** |
413 | * mega_allocate_scb() | 415 | * mega_allocate_scb() |
414 | * @adapter - pointer to our soft state | 416 | * @adapter - pointer to our soft state |
@@ -4456,7 +4458,7 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru) | |||
4456 | 4458 | ||
4457 | scb->idx = CMDID_INT_CMDS; | 4459 | scb->idx = CMDID_INT_CMDS; |
4458 | 4460 | ||
4459 | megaraid_queue(scmd, mega_internal_done); | 4461 | megaraid_queue_lck(scmd, mega_internal_done); |
4460 | 4462 | ||
4461 | wait_for_completion(&adapter->int_waitq); | 4463 | wait_for_completion(&adapter->int_waitq); |
4462 | 4464 | ||
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index 2b4a048cadf1..f5644745e24e 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -987,7 +987,7 @@ static int mega_query_adapter(adapter_t *); | |||
987 | static int issue_scb(adapter_t *, scb_t *); | 987 | static int issue_scb(adapter_t *, scb_t *); |
988 | static int mega_setup_mailbox(adapter_t *); | 988 | static int mega_setup_mailbox(adapter_t *); |
989 | 989 | ||
990 | static int megaraid_queue (Scsi_Cmnd *, void (*)(Scsi_Cmnd *)); | 990 | static int megaraid_queue (struct Scsi_Host *, struct scsi_cmnd *); |
991 | static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *); | 991 | static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *); |
992 | static void __mega_runpendq(adapter_t *); | 992 | static void __mega_runpendq(adapter_t *); |
993 | static int issue_scb_block(adapter_t *, u_char *); | 993 | static int issue_scb_block(adapter_t *, u_char *); |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index a7810a106b37..5708cb27d078 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -113,8 +113,7 @@ static int megaraid_mbox_fire_sync_cmd(adapter_t *); | |||
113 | static void megaraid_mbox_display_scb(adapter_t *, scb_t *); | 113 | static void megaraid_mbox_display_scb(adapter_t *, scb_t *); |
114 | static void megaraid_mbox_setup_device_map(adapter_t *); | 114 | static void megaraid_mbox_setup_device_map(adapter_t *); |
115 | 115 | ||
116 | static int megaraid_queue_command(struct scsi_cmnd *, | 116 | static int megaraid_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
117 | void (*)(struct scsi_cmnd *)); | ||
118 | static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *); | 117 | static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *); |
119 | static void megaraid_mbox_runpendq(adapter_t *, scb_t *); | 118 | static void megaraid_mbox_runpendq(adapter_t *, scb_t *); |
120 | static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *, | 119 | static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *, |
@@ -1484,7 +1483,7 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) | |||
1484 | * Queue entry point for mailbox based controllers. | 1483 | * Queue entry point for mailbox based controllers. |
1485 | */ | 1484 | */ |
1486 | static int | 1485 | static int |
1487 | megaraid_queue_command(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) | 1486 | megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) |
1488 | { | 1487 | { |
1489 | adapter_t *adapter; | 1488 | adapter_t *adapter; |
1490 | scb_t *scb; | 1489 | scb_t *scb; |
@@ -1513,6 +1512,8 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) | |||
1513 | return if_busy; | 1512 | return if_busy; |
1514 | } | 1513 | } |
1515 | 1514 | ||
1515 | static DEF_SCSI_QCMD(megaraid_queue_command) | ||
1516 | |||
1516 | /** | 1517 | /** |
1517 | * megaraid_mbox_build_cmd - transform the mid-layer scsi commands | 1518 | * megaraid_mbox_build_cmd - transform the mid-layer scsi commands |
1518 | * @adapter : controller's soft state | 1519 | * @adapter : controller's soft state |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index eb29d5085131..7451bc096a01 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -1334,7 +1334,7 @@ megasas_dump_pending_frames(struct megasas_instance *instance) | |||
1334 | * @done: Callback entry point | 1334 | * @done: Callback entry point |
1335 | */ | 1335 | */ |
1336 | static int | 1336 | static int |
1337 | megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | 1337 | megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) |
1338 | { | 1338 | { |
1339 | u32 frame_count; | 1339 | u32 frame_count; |
1340 | struct megasas_cmd *cmd; | 1340 | struct megasas_cmd *cmd; |
@@ -1417,6 +1417,8 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
1417 | return 0; | 1417 | return 0; |
1418 | } | 1418 | } |
1419 | 1419 | ||
1420 | static DEF_SCSI_QCMD(megasas_queue_command) | ||
1421 | |||
1420 | static struct megasas_instance *megasas_lookup_instance(u16 host_no) | 1422 | static struct megasas_instance *megasas_lookup_instance(u16 host_no) |
1421 | { | 1423 | { |
1422 | int i; | 1424 | int i; |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 1f784fde2510..197aa1b3f0f3 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1627,7 +1627,7 @@ static void cmd_complete(struct mesh_state *ms) | |||
1627 | * Called by midlayer with host locked to queue a new | 1627 | * Called by midlayer with host locked to queue a new |
1628 | * request | 1628 | * request |
1629 | */ | 1629 | */ |
1630 | static int mesh_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 1630 | static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
1631 | { | 1631 | { |
1632 | struct mesh_state *ms; | 1632 | struct mesh_state *ms; |
1633 | 1633 | ||
@@ -1648,6 +1648,8 @@ static int mesh_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
1648 | return 0; | 1648 | return 0; |
1649 | } | 1649 | } |
1650 | 1650 | ||
1651 | static DEF_SCSI_QCMD(mesh_queue) | ||
1652 | |||
1651 | /* | 1653 | /* |
1652 | * Called to handle interrupts, either call by the interrupt | 1654 | * Called to handle interrupts, either call by the interrupt |
1653 | * handler (do_mesh_interrupt) or by other functions in | 1655 | * handler (do_mesh_interrupt) or by other functions in |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 16e99b686354..1a96a00418a4 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -3315,7 +3315,7 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) | |||
3315 | * SCSI_MLQUEUE_HOST_BUSY if the entire host queue is full | 3315 | * SCSI_MLQUEUE_HOST_BUSY if the entire host queue is full |
3316 | */ | 3316 | */ |
3317 | static int | 3317 | static int |
3318 | _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) | 3318 | _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) |
3319 | { | 3319 | { |
3320 | struct MPT2SAS_ADAPTER *ioc = shost_priv(scmd->device->host); | 3320 | struct MPT2SAS_ADAPTER *ioc = shost_priv(scmd->device->host); |
3321 | struct MPT2SAS_DEVICE *sas_device_priv_data; | 3321 | struct MPT2SAS_DEVICE *sas_device_priv_data; |
@@ -3441,6 +3441,8 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) | |||
3441 | return SCSI_MLQUEUE_HOST_BUSY; | 3441 | return SCSI_MLQUEUE_HOST_BUSY; |
3442 | } | 3442 | } |
3443 | 3443 | ||
3444 | static DEF_SCSI_QCMD(_scsih_qcmd) | ||
3445 | |||
3444 | /** | 3446 | /** |
3445 | * _scsih_normalize_sense - normalize descriptor and fixed format sense data | 3447 | * _scsih_normalize_sense - normalize descriptor and fixed format sense data |
3446 | * @sense_buffer: sense data returned by target | 3448 | * @sense_buffer: sense data returned by target |
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index d013a2aa2fd5..46cc3825638d 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c | |||
@@ -8029,7 +8029,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device) | |||
8029 | return 0; | 8029 | return 0; |
8030 | } | 8030 | } |
8031 | 8031 | ||
8032 | static int ncr53c8xx_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | 8032 | static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
8033 | { | 8033 | { |
8034 | struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; | 8034 | struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; |
8035 | unsigned long flags; | 8035 | unsigned long flags; |
@@ -8068,6 +8068,8 @@ printk("ncr53c8xx : command successfully queued\n"); | |||
8068 | return sts; | 8068 | return sts; |
8069 | } | 8069 | } |
8070 | 8070 | ||
8071 | static DEF_SCSI_QCMD(ncr53c8xx_queue_command) | ||
8072 | |||
8071 | irqreturn_t ncr53c8xx_intr(int irq, void *dev_id) | 8073 | irqreturn_t ncr53c8xx_intr(int irq, void *dev_id) |
8072 | { | 8074 | { |
8073 | unsigned long flags; | 8075 | unsigned long flags; |
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 4c1e54545200..6b8b021400f8 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
@@ -196,8 +196,7 @@ static void __exit exit_nsp32 (void); | |||
196 | static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); | 196 | static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); |
197 | 197 | ||
198 | static int nsp32_detect (struct pci_dev *pdev); | 198 | static int nsp32_detect (struct pci_dev *pdev); |
199 | static int nsp32_queuecommand(struct scsi_cmnd *, | 199 | static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
200 | void (*done)(struct scsi_cmnd *)); | ||
201 | static const char *nsp32_info (struct Scsi_Host *); | 200 | static const char *nsp32_info (struct Scsi_Host *); |
202 | static int nsp32_release (struct Scsi_Host *); | 201 | static int nsp32_release (struct Scsi_Host *); |
203 | 202 | ||
@@ -909,7 +908,7 @@ static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt) | |||
909 | return TRUE; | 908 | return TRUE; |
910 | } | 909 | } |
911 | 910 | ||
912 | static int nsp32_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 911 | static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
913 | { | 912 | { |
914 | nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; | 913 | nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; |
915 | nsp32_target *target; | 914 | nsp32_target *target; |
@@ -1050,6 +1049,8 @@ static int nsp32_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ | |||
1050 | return 0; | 1049 | return 0; |
1051 | } | 1050 | } |
1052 | 1051 | ||
1052 | static DEF_SCSI_QCMD(nsp32_queuecommand) | ||
1053 | |||
1053 | /* initialize asic */ | 1054 | /* initialize asic */ |
1054 | static int nsp32hw_init(nsp32_hw_data *data) | 1055 | static int nsp32hw_init(nsp32_hw_data *data) |
1055 | { | 1056 | { |
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h index 8dc5b1a5f5da..a04281cace2e 100644 --- a/drivers/scsi/pas16.h +++ b/drivers/scsi/pas16.h | |||
@@ -118,7 +118,7 @@ static int pas16_abort(Scsi_Cmnd *); | |||
118 | static int pas16_biosparam(struct scsi_device *, struct block_device *, | 118 | static int pas16_biosparam(struct scsi_device *, struct block_device *, |
119 | sector_t, int*); | 119 | sector_t, int*); |
120 | static int pas16_detect(struct scsi_host_template *); | 120 | static int pas16_detect(struct scsi_host_template *); |
121 | static int pas16_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 121 | static int pas16_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
122 | static int pas16_bus_reset(Scsi_Cmnd *); | 122 | static int pas16_bus_reset(Scsi_Cmnd *); |
123 | 123 | ||
124 | #ifndef CMD_PER_LUN | 124 | #ifndef CMD_PER_LUN |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 9326c2c14880..be3f33d31a99 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -184,7 +184,7 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt) | |||
184 | SCpnt->scsi_done(SCpnt); | 184 | SCpnt->scsi_done(SCpnt); |
185 | } | 185 | } |
186 | 186 | ||
187 | static int nsp_queuecommand(struct scsi_cmnd *SCpnt, | 187 | static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt, |
188 | void (*done)(struct scsi_cmnd *)) | 188 | void (*done)(struct scsi_cmnd *)) |
189 | { | 189 | { |
190 | #ifdef NSP_DEBUG | 190 | #ifdef NSP_DEBUG |
@@ -264,6 +264,8 @@ static int nsp_queuecommand(struct scsi_cmnd *SCpnt, | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | static DEF_SCSI_QCMD(nsp_queuecommand) | ||
268 | |||
267 | /* | 269 | /* |
268 | * setup PIO FIFO transfer mode and enable/disable to data out | 270 | * setup PIO FIFO transfer mode and enable/disable to data out |
269 | */ | 271 | */ |
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index d68c9f267c5e..7fc9a9d0a448 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -299,8 +299,7 @@ static int nsp_proc_info ( | |||
299 | off_t offset, | 299 | off_t offset, |
300 | int length, | 300 | int length, |
301 | int inout); | 301 | int inout); |
302 | static int nsp_queuecommand(struct scsi_cmnd *SCpnt, | 302 | static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); |
303 | void (* done)(struct scsi_cmnd *SCpnt)); | ||
304 | 303 | ||
305 | /* Error handler */ | 304 | /* Error handler */ |
306 | /*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ | 305 | /*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 0ae27cb5cd6f..8552296edaa1 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -547,7 +547,7 @@ SYM53C500_info(struct Scsi_Host *SChost) | |||
547 | } | 547 | } |
548 | 548 | ||
549 | static int | 549 | static int |
550 | SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 550 | SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
551 | { | 551 | { |
552 | int i; | 552 | int i; |
553 | int port_base = SCpnt->device->host->io_port; | 553 | int port_base = SCpnt->device->host->io_port; |
@@ -583,6 +583,8 @@ SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
583 | return 0; | 583 | return 0; |
584 | } | 584 | } |
585 | 585 | ||
586 | static DEF_SCSI_QCMD(SYM53C500_queue) | ||
587 | |||
586 | static int | 588 | static int |
587 | SYM53C500_host_reset(struct scsi_cmnd *SCpnt) | 589 | SYM53C500_host_reset(struct scsi_cmnd *SCpnt) |
588 | { | 590 | { |
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 8e38ca8cd101..7f064f9ca828 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/dma-mapping.h> | 50 | #include <linux/dma-mapping.h> |
51 | #include <linux/pci.h> | 51 | #include <linux/pci.h> |
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/smp_lock.h> | ||
54 | #include <scsi/libsas.h> | 53 | #include <scsi/libsas.h> |
55 | #include <scsi/scsi_tcq.h> | 54 | #include <scsi/scsi_tcq.h> |
56 | #include <scsi/sas_ata.h> | 55 | #include <scsi/sas_ata.h> |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index cf89091e4c3d..5e76a624cb08 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -3478,7 +3478,7 @@ static int pmcraid_copy_sglist( | |||
3478 | * SCSI_MLQUEUE_DEVICE_BUSY if device is busy | 3478 | * SCSI_MLQUEUE_DEVICE_BUSY if device is busy |
3479 | * SCSI_MLQUEUE_HOST_BUSY if host is busy | 3479 | * SCSI_MLQUEUE_HOST_BUSY if host is busy |
3480 | */ | 3480 | */ |
3481 | static int pmcraid_queuecommand( | 3481 | static int pmcraid_queuecommand_lck( |
3482 | struct scsi_cmnd *scsi_cmd, | 3482 | struct scsi_cmnd *scsi_cmd, |
3483 | void (*done) (struct scsi_cmnd *) | 3483 | void (*done) (struct scsi_cmnd *) |
3484 | ) | 3484 | ) |
@@ -3584,6 +3584,8 @@ static int pmcraid_queuecommand( | |||
3584 | return rc; | 3584 | return rc; |
3585 | } | 3585 | } |
3586 | 3586 | ||
3587 | static DEF_SCSI_QCMD(pmcraid_queuecommand) | ||
3588 | |||
3587 | /** | 3589 | /** |
3588 | * pmcraid_open -char node "open" entry, allowed only users with admin access | 3590 | * pmcraid_open -char node "open" entry, allowed only users with admin access |
3589 | */ | 3591 | */ |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 7bc2d796e403..d164c9639361 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -798,7 +798,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) | |||
798 | return 0; | 798 | return 0; |
799 | } | 799 | } |
800 | 800 | ||
801 | static int ppa_queuecommand(struct scsi_cmnd *cmd, | 801 | static int ppa_queuecommand_lck(struct scsi_cmnd *cmd, |
802 | void (*done) (struct scsi_cmnd *)) | 802 | void (*done) (struct scsi_cmnd *)) |
803 | { | 803 | { |
804 | ppa_struct *dev = ppa_dev(cmd->device->host); | 804 | ppa_struct *dev = ppa_dev(cmd->device->host); |
@@ -821,6 +821,8 @@ static int ppa_queuecommand(struct scsi_cmnd *cmd, | |||
821 | return 0; | 821 | return 0; |
822 | } | 822 | } |
823 | 823 | ||
824 | static DEF_SCSI_QCMD(ppa_queuecommand) | ||
825 | |||
824 | /* | 826 | /* |
825 | * Apparently the disk->capacity attribute is off by 1 sector | 827 | * Apparently the disk->capacity attribute is off by 1 sector |
826 | * for all disk drives. We add the one here, but it should really | 828 | * for all disk drives. We add the one here, but it should really |
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index 92ffbb510498..cd178b9e40cd 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c | |||
@@ -211,7 +211,7 @@ static int ps3rom_write_request(struct ps3_storage_device *dev, | |||
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | 213 | ||
214 | static int ps3rom_queuecommand(struct scsi_cmnd *cmd, | 214 | static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd, |
215 | void (*done)(struct scsi_cmnd *)) | 215 | void (*done)(struct scsi_cmnd *)) |
216 | { | 216 | { |
217 | struct ps3rom_private *priv = shost_priv(cmd->device->host); | 217 | struct ps3rom_private *priv = shost_priv(cmd->device->host); |
@@ -260,6 +260,8 @@ static int ps3rom_queuecommand(struct scsi_cmnd *cmd, | |||
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static DEF_SCSI_QCMD(ps3rom_queuecommand) | ||
264 | |||
263 | static int decode_lv1_status(u64 status, unsigned char *sense_key, | 265 | static int decode_lv1_status(u64 status, unsigned char *sense_key, |
264 | unsigned char *asc, unsigned char *ascq) | 266 | unsigned char *asc, unsigned char *ascq) |
265 | { | 267 | { |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index b8166ecfd0e3..5dec684bf010 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -727,7 +727,7 @@ qla1280_info(struct Scsi_Host *host) | |||
727 | * context which is a big NO! NO!. | 727 | * context which is a big NO! NO!. |
728 | **************************************************************************/ | 728 | **************************************************************************/ |
729 | static int | 729 | static int |
730 | qla1280_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) | 730 | qla1280_queuecommand_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) |
731 | { | 731 | { |
732 | struct Scsi_Host *host = cmd->device->host; | 732 | struct Scsi_Host *host = cmd->device->host; |
733 | struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; | 733 | struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; |
@@ -756,6 +756,8 @@ qla1280_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) | |||
756 | return status; | 756 | return status; |
757 | } | 757 | } |
758 | 758 | ||
759 | static DEF_SCSI_QCMD(qla1280_queuecommand) | ||
760 | |||
759 | enum action { | 761 | enum action { |
760 | ABORT_COMMAND, | 762 | ABORT_COMMAND, |
761 | DEVICE_RESET, | 763 | DEVICE_RESET, |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 1830e6e97315..1644eabaafeb 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -179,8 +179,7 @@ static int qla2xxx_slave_alloc(struct scsi_device *); | |||
179 | static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); | 179 | static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); |
180 | static void qla2xxx_scan_start(struct Scsi_Host *); | 180 | static void qla2xxx_scan_start(struct Scsi_Host *); |
181 | static void qla2xxx_slave_destroy(struct scsi_device *); | 181 | static void qla2xxx_slave_destroy(struct scsi_device *); |
182 | static int qla2xxx_queuecommand(struct scsi_cmnd *cmd, | 182 | static int qla2xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
183 | void (*fn)(struct scsi_cmnd *)); | ||
184 | static int qla2xxx_eh_abort(struct scsi_cmnd *); | 183 | static int qla2xxx_eh_abort(struct scsi_cmnd *); |
185 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); | 184 | static int qla2xxx_eh_device_reset(struct scsi_cmnd *); |
186 | static int qla2xxx_eh_target_reset(struct scsi_cmnd *); | 185 | static int qla2xxx_eh_target_reset(struct scsi_cmnd *); |
@@ -535,7 +534,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport, | |||
535 | } | 534 | } |
536 | 535 | ||
537 | static int | 536 | static int |
538 | qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 537 | qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
539 | { | 538 | { |
540 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 539 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
541 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; | 540 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
@@ -609,6 +608,8 @@ qc24_fail_command: | |||
609 | return 0; | 608 | return 0; |
610 | } | 609 | } |
611 | 610 | ||
611 | static DEF_SCSI_QCMD(qla2xxx_queuecommand) | ||
612 | |||
612 | 613 | ||
613 | /* | 614 | /* |
614 | * qla2x00_eh_wait_on_command | 615 | * qla2x00_eh_wait_on_command |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index f4cd846abf6d..0d48fb4d1044 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -79,8 +79,7 @@ static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(struct scsi_cmnd *sc); | |||
79 | /* | 79 | /* |
80 | * SCSI host template entry points | 80 | * SCSI host template entry points |
81 | */ | 81 | */ |
82 | static int qla4xxx_queuecommand(struct scsi_cmnd *cmd, | 82 | static int qla4xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
83 | void (*done) (struct scsi_cmnd *)); | ||
84 | static int qla4xxx_eh_abort(struct scsi_cmnd *cmd); | 83 | static int qla4xxx_eh_abort(struct scsi_cmnd *cmd); |
85 | static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd); | 84 | static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd); |
86 | static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd); | 85 | static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd); |
@@ -464,7 +463,7 @@ void qla4xxx_srb_compl(struct kref *ref) | |||
464 | * completion handling). Unfortunely, it sometimes calls the scheduler | 463 | * completion handling). Unfortunely, it sometimes calls the scheduler |
465 | * in interrupt context which is a big NO! NO!. | 464 | * in interrupt context which is a big NO! NO!. |
466 | **/ | 465 | **/ |
467 | static int qla4xxx_queuecommand(struct scsi_cmnd *cmd, | 466 | static int qla4xxx_queuecommand_lck(struct scsi_cmnd *cmd, |
468 | void (*done)(struct scsi_cmnd *)) | 467 | void (*done)(struct scsi_cmnd *)) |
469 | { | 468 | { |
470 | struct scsi_qla_host *ha = to_qla_host(cmd->device->host); | 469 | struct scsi_qla_host *ha = to_qla_host(cmd->device->host); |
@@ -538,6 +537,8 @@ qc_fail_command: | |||
538 | return 0; | 537 | return 0; |
539 | } | 538 | } |
540 | 539 | ||
540 | static DEF_SCSI_QCMD(qla4xxx_queuecommand) | ||
541 | |||
541 | /** | 542 | /** |
542 | * qla4xxx_mem_free - frees memory allocated to adapter | 543 | * qla4xxx_mem_free - frees memory allocated to adapter |
543 | * @ha: Pointer to host adapter structure. | 544 | * @ha: Pointer to host adapter structure. |
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c index 1ad51552d6b1..c3a9151ca823 100644 --- a/drivers/scsi/qlogicfas408.c +++ b/drivers/scsi/qlogicfas408.c | |||
@@ -439,7 +439,7 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id) | |||
439 | * Queued command | 439 | * Queued command |
440 | */ | 440 | */ |
441 | 441 | ||
442 | int qlogicfas408_queuecommand(struct scsi_cmnd *cmd, | 442 | static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd, |
443 | void (*done) (struct scsi_cmnd *)) | 443 | void (*done) (struct scsi_cmnd *)) |
444 | { | 444 | { |
445 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); | 445 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); |
@@ -459,6 +459,8 @@ int qlogicfas408_queuecommand(struct scsi_cmnd *cmd, | |||
459 | return 0; | 459 | return 0; |
460 | } | 460 | } |
461 | 461 | ||
462 | DEF_SCSI_QCMD(qlogicfas408_queuecommand) | ||
463 | |||
462 | /* | 464 | /* |
463 | * Return bios parameters | 465 | * Return bios parameters |
464 | */ | 466 | */ |
diff --git a/drivers/scsi/qlogicfas408.h b/drivers/scsi/qlogicfas408.h index 260626427a32..2f6c0a166200 100644 --- a/drivers/scsi/qlogicfas408.h +++ b/drivers/scsi/qlogicfas408.h | |||
@@ -103,8 +103,7 @@ struct qlogicfas408_priv { | |||
103 | #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) | 103 | #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) |
104 | 104 | ||
105 | irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); | 105 | irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); |
106 | int qlogicfas408_queuecommand(struct scsi_cmnd * cmd, | 106 | int qlogicfas408_queuecommand(struct Scsi_Host *h, struct scsi_cmnd * cmd); |
107 | void (*done) (struct scsi_cmnd *)); | ||
108 | int qlogicfas408_biosparam(struct scsi_device * disk, | 107 | int qlogicfas408_biosparam(struct scsi_device * disk, |
109 | struct block_device *dev, | 108 | struct block_device *dev, |
110 | sector_t capacity, int ip[]); | 109 | sector_t capacity, int ip[]); |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index f8c561cf751e..664c9572d0c9 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -1003,7 +1003,7 @@ static int qlogicpti_slave_configure(struct scsi_device *sdev) | |||
1003 | * | 1003 | * |
1004 | * "This code must fly." -davem | 1004 | * "This code must fly." -davem |
1005 | */ | 1005 | */ |
1006 | static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *)) | 1006 | static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *)) |
1007 | { | 1007 | { |
1008 | struct Scsi_Host *host = Cmnd->device->host; | 1008 | struct Scsi_Host *host = Cmnd->device->host; |
1009 | struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; | 1009 | struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; |
@@ -1052,6 +1052,8 @@ toss_command: | |||
1052 | return 1; | 1052 | return 1; |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | static DEF_SCSI_QCMD(qlogicpti_queuecommand) | ||
1056 | |||
1055 | static int qlogicpti_return_status(struct Status_Entry *sts, int id) | 1057 | static int qlogicpti_return_status(struct Status_Entry *sts, int id) |
1056 | { | 1058 | { |
1057 | int host_status = DID_ERROR; | 1059 | int host_status = DID_ERROR; |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 348fba0a8976..2aeb2e9c4d3b 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -634,12 +634,13 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) | |||
634 | * Description: a serial number identifies a request for error recovery | 634 | * Description: a serial number identifies a request for error recovery |
635 | * and debugging purposes. Protected by the Host_Lock of host. | 635 | * and debugging purposes. Protected by the Host_Lock of host. |
636 | */ | 636 | */ |
637 | static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd) | 637 | void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd) |
638 | { | 638 | { |
639 | cmd->serial_number = host->cmd_serial_number++; | 639 | cmd->serial_number = host->cmd_serial_number++; |
640 | if (cmd->serial_number == 0) | 640 | if (cmd->serial_number == 0) |
641 | cmd->serial_number = host->cmd_serial_number++; | 641 | cmd->serial_number = host->cmd_serial_number++; |
642 | } | 642 | } |
643 | EXPORT_SYMBOL(scsi_cmd_get_serial); | ||
643 | 644 | ||
644 | /** | 645 | /** |
645 | * scsi_dispatch_command - Dispatch a command to the low-level driver. | 646 | * scsi_dispatch_command - Dispatch a command to the low-level driver. |
@@ -651,7 +652,6 @@ static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd | |||
651 | int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | 652 | int scsi_dispatch_cmd(struct scsi_cmnd *cmd) |
652 | { | 653 | { |
653 | struct Scsi_Host *host = cmd->device->host; | 654 | struct Scsi_Host *host = cmd->device->host; |
654 | unsigned long flags = 0; | ||
655 | unsigned long timeout; | 655 | unsigned long timeout; |
656 | int rtn = 0; | 656 | int rtn = 0; |
657 | 657 | ||
@@ -737,23 +737,15 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | |||
737 | goto out; | 737 | goto out; |
738 | } | 738 | } |
739 | 739 | ||
740 | spin_lock_irqsave(host->host_lock, flags); | ||
741 | /* | ||
742 | * AK: unlikely race here: for some reason the timer could | ||
743 | * expire before the serial number is set up below. | ||
744 | * | ||
745 | * TODO: kill serial or move to blk layer | ||
746 | */ | ||
747 | scsi_cmd_get_serial(host, cmd); | ||
748 | |||
749 | if (unlikely(host->shost_state == SHOST_DEL)) { | 740 | if (unlikely(host->shost_state == SHOST_DEL)) { |
750 | cmd->result = (DID_NO_CONNECT << 16); | 741 | cmd->result = (DID_NO_CONNECT << 16); |
751 | scsi_done(cmd); | 742 | scsi_done(cmd); |
752 | } else { | 743 | } else { |
753 | trace_scsi_dispatch_cmd_start(cmd); | 744 | trace_scsi_dispatch_cmd_start(cmd); |
754 | rtn = host->hostt->queuecommand(cmd, scsi_done); | 745 | cmd->scsi_done = scsi_done; |
746 | rtn = host->hostt->queuecommand(host, cmd); | ||
755 | } | 747 | } |
756 | spin_unlock_irqrestore(host->host_lock, flags); | 748 | |
757 | if (rtn) { | 749 | if (rtn) { |
758 | trace_scsi_dispatch_cmd_error(cmd, rtn); | 750 | trace_scsi_dispatch_cmd_error(cmd, rtn); |
759 | if (rtn != SCSI_MLQUEUE_DEVICE_BUSY && | 751 | if (rtn != SCSI_MLQUEUE_DEVICE_BUSY && |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 2c36bae3bd4b..2f1f9b079b10 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -3538,7 +3538,7 @@ static void sdebug_remove_adapter(void) | |||
3538 | } | 3538 | } |
3539 | 3539 | ||
3540 | static | 3540 | static |
3541 | int scsi_debug_queuecommand(struct scsi_cmnd *SCpnt, done_funct_t done) | 3541 | int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done) |
3542 | { | 3542 | { |
3543 | unsigned char *cmd = (unsigned char *) SCpnt->cmnd; | 3543 | unsigned char *cmd = (unsigned char *) SCpnt->cmnd; |
3544 | int len, k; | 3544 | int len, k; |
@@ -3884,6 +3884,8 @@ write: | |||
3884 | (delay_override ? 0 : scsi_debug_delay)); | 3884 | (delay_override ? 0 : scsi_debug_delay)); |
3885 | } | 3885 | } |
3886 | 3886 | ||
3887 | static DEF_SCSI_QCMD(scsi_debug_queuecommand) | ||
3888 | |||
3887 | static struct scsi_host_template sdebug_driver_template = { | 3889 | static struct scsi_host_template sdebug_driver_template = { |
3888 | .proc_info = scsi_debug_proc_info, | 3890 | .proc_info = scsi_debug_proc_info, |
3889 | .proc_name = sdebug_proc_name, | 3891 | .proc_name = sdebug_proc_name, |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index f3cf924a2cd9..824b8fc03ce5 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -773,17 +773,15 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | |||
773 | struct Scsi_Host *shost = sdev->host; | 773 | struct Scsi_Host *shost = sdev->host; |
774 | DECLARE_COMPLETION_ONSTACK(done); | 774 | DECLARE_COMPLETION_ONSTACK(done); |
775 | unsigned long timeleft; | 775 | unsigned long timeleft; |
776 | unsigned long flags; | ||
777 | struct scsi_eh_save ses; | 776 | struct scsi_eh_save ses; |
778 | int rtn; | 777 | int rtn; |
779 | 778 | ||
780 | scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); | 779 | scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); |
781 | shost->eh_action = &done; | 780 | shost->eh_action = &done; |
782 | 781 | ||
783 | spin_lock_irqsave(shost->host_lock, flags); | ||
784 | scsi_log_send(scmd); | 782 | scsi_log_send(scmd); |
785 | shost->hostt->queuecommand(scmd, scsi_eh_done); | 783 | scmd->scsi_done = scsi_eh_done; |
786 | spin_unlock_irqrestore(shost->host_lock, flags); | 784 | shost->hostt->queuecommand(shost, scmd); |
787 | 785 | ||
788 | timeleft = wait_for_completion_timeout(&done, timeout); | 786 | timeleft = wait_for_completion_timeout(&done, timeout); |
789 | 787 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index b9ab3a590e4b..956496182c80 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/blkdev.h> | 46 | #include <linux/blkdev.h> |
47 | #include <linux/blkpg.h> | 47 | #include <linux/blkpg.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/smp_lock.h> | ||
50 | #include <linux/mutex.h> | 49 | #include <linux/mutex.h> |
51 | #include <linux/string_helpers.h> | 50 | #include <linux/string_helpers.h> |
52 | #include <linux/async.h> | 51 | #include <linux/async.h> |
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 9c73dbda3bbb..606215e54b88 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -572,7 +572,7 @@ stex_slave_destroy(struct scsi_device *sdev) | |||
572 | } | 572 | } |
573 | 573 | ||
574 | static int | 574 | static int |
575 | stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | 575 | stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
576 | { | 576 | { |
577 | struct st_hba *hba; | 577 | struct st_hba *hba; |
578 | struct Scsi_Host *host; | 578 | struct Scsi_Host *host; |
@@ -698,6 +698,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
698 | return 0; | 698 | return 0; |
699 | } | 699 | } |
700 | 700 | ||
701 | static DEF_SCSI_QCMD(stex_queuecommand) | ||
702 | |||
701 | static void stex_scsi_done(struct st_ccb *ccb) | 703 | static void stex_scsi_done(struct st_ccb *ccb) |
702 | { | 704 | { |
703 | struct scsi_cmnd *cmd = ccb->cmd; | 705 | struct scsi_cmnd *cmd = ccb->cmd; |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index 713620ed70d9..4f0e5485ffde 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -908,7 +908,7 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags) | |||
908 | */ | 908 | */ |
909 | 909 | ||
910 | /* Only make static if a wrapper function is used */ | 910 | /* Only make static if a wrapper function is used */ |
911 | static int NCR5380_queue_command(struct scsi_cmnd *cmd, | 911 | static int NCR5380_queue_command_lck(struct scsi_cmnd *cmd, |
912 | void (*done)(struct scsi_cmnd *)) | 912 | void (*done)(struct scsi_cmnd *)) |
913 | { | 913 | { |
914 | SETUP_HOSTDATA(cmd->device->host); | 914 | SETUP_HOSTDATA(cmd->device->host); |
@@ -1019,6 +1019,8 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd, | |||
1019 | return 0; | 1019 | return 0; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | static DEF_SCSI_QCMD(NCR5380_queue_command) | ||
1023 | |||
1022 | /* | 1024 | /* |
1023 | * Function : NCR5380_main (void) | 1025 | * Function : NCR5380_main (void) |
1024 | * | 1026 | * |
diff --git a/drivers/scsi/sun3_scsi.h b/drivers/scsi/sun3_scsi.h index b29a9d661ca4..bcefd8458e65 100644 --- a/drivers/scsi/sun3_scsi.h +++ b/drivers/scsi/sun3_scsi.h | |||
@@ -51,8 +51,7 @@ static int sun3scsi_abort(struct scsi_cmnd *); | |||
51 | static int sun3scsi_detect (struct scsi_host_template *); | 51 | static int sun3scsi_detect (struct scsi_host_template *); |
52 | static const char *sun3scsi_info (struct Scsi_Host *); | 52 | static const char *sun3scsi_info (struct Scsi_Host *); |
53 | static int sun3scsi_bus_reset(struct scsi_cmnd *); | 53 | static int sun3scsi_bus_reset(struct scsi_cmnd *); |
54 | static int sun3scsi_queue_command(struct scsi_cmnd *, | 54 | static int sun3scsi_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
55 | void (*done)(struct scsi_cmnd *)); | ||
56 | static int sun3scsi_release (struct Scsi_Host *); | 55 | static int sun3scsi_release (struct Scsi_Host *); |
57 | 56 | ||
58 | #ifndef CMD_PER_LUN | 57 | #ifndef CMD_PER_LUN |
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c index e5c369bb568f..190107ae120b 100644 --- a/drivers/scsi/sym53c416.c +++ b/drivers/scsi/sym53c416.c | |||
@@ -734,7 +734,7 @@ const char *sym53c416_info(struct Scsi_Host *SChost) | |||
734 | return info; | 734 | return info; |
735 | } | 735 | } |
736 | 736 | ||
737 | int sym53c416_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) | 737 | static int sym53c416_queuecommand_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) |
738 | { | 738 | { |
739 | int base; | 739 | int base; |
740 | unsigned long flags = 0; | 740 | unsigned long flags = 0; |
@@ -761,6 +761,8 @@ int sym53c416_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) | |||
761 | return 0; | 761 | return 0; |
762 | } | 762 | } |
763 | 763 | ||
764 | DEF_SCSI_QCMD(sym53c416_queuecommand) | ||
765 | |||
764 | static int sym53c416_host_reset(Scsi_Cmnd *SCpnt) | 766 | static int sym53c416_host_reset(Scsi_Cmnd *SCpnt) |
765 | { | 767 | { |
766 | int base; | 768 | int base; |
diff --git a/drivers/scsi/sym53c416.h b/drivers/scsi/sym53c416.h index 77860d0748ff..387de5d80a70 100644 --- a/drivers/scsi/sym53c416.h +++ b/drivers/scsi/sym53c416.h | |||
@@ -25,7 +25,7 @@ | |||
25 | static int sym53c416_detect(struct scsi_host_template *); | 25 | static int sym53c416_detect(struct scsi_host_template *); |
26 | static const char *sym53c416_info(struct Scsi_Host *); | 26 | static const char *sym53c416_info(struct Scsi_Host *); |
27 | static int sym53c416_release(struct Scsi_Host *); | 27 | static int sym53c416_release(struct Scsi_Host *); |
28 | static int sym53c416_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 28 | static int sym53c416_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
29 | static int sym53c416_host_reset(Scsi_Cmnd *); | 29 | static int sym53c416_host_reset(Scsi_Cmnd *); |
30 | static int sym53c416_bios_param(struct scsi_device *, struct block_device *, | 30 | static int sym53c416_bios_param(struct scsi_device *, struct block_device *, |
31 | sector_t, int *); | 31 | sector_t, int *); |
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 8b955b534a36..6b97ded9d45d 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -505,7 +505,7 @@ void sym_log_bus_error(struct Scsi_Host *shost) | |||
505 | * queuecommand method. Entered with the host adapter lock held and | 505 | * queuecommand method. Entered with the host adapter lock held and |
506 | * interrupts disabled. | 506 | * interrupts disabled. |
507 | */ | 507 | */ |
508 | static int sym53c8xx_queue_command(struct scsi_cmnd *cmd, | 508 | static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd, |
509 | void (*done)(struct scsi_cmnd *)) | 509 | void (*done)(struct scsi_cmnd *)) |
510 | { | 510 | { |
511 | struct sym_hcb *np = SYM_SOFTC_PTR(cmd); | 511 | struct sym_hcb *np = SYM_SOFTC_PTR(cmd); |
@@ -536,6 +536,8 @@ static int sym53c8xx_queue_command(struct scsi_cmnd *cmd, | |||
536 | return 0; | 536 | return 0; |
537 | } | 537 | } |
538 | 538 | ||
539 | static DEF_SCSI_QCMD(sym53c8xx_queue_command) | ||
540 | |||
539 | /* | 541 | /* |
540 | * Linux entry point of the interrupt handler. | 542 | * Linux entry point of the interrupt handler. |
541 | */ | 543 | */ |
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h index 76a069b7ac0b..ada1115079c9 100644 --- a/drivers/scsi/t128.h +++ b/drivers/scsi/t128.h | |||
@@ -96,8 +96,7 @@ static int t128_abort(struct scsi_cmnd *); | |||
96 | static int t128_biosparam(struct scsi_device *, struct block_device *, | 96 | static int t128_biosparam(struct scsi_device *, struct block_device *, |
97 | sector_t, int*); | 97 | sector_t, int*); |
98 | static int t128_detect(struct scsi_host_template *); | 98 | static int t128_detect(struct scsi_host_template *); |
99 | static int t128_queue_command(struct scsi_cmnd *, | 99 | static int t128_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
100 | void (*done)(struct scsi_cmnd *)); | ||
101 | static int t128_bus_reset(struct scsi_cmnd *); | 100 | static int t128_bus_reset(struct scsi_cmnd *); |
102 | 101 | ||
103 | #ifndef CMD_PER_LUN | 102 | #ifndef CMD_PER_LUN |
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 27866b0adfeb..a124a28f2ccb 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -1883,7 +1883,7 @@ dc390_ScsiRstDetect( struct dc390_acb* pACB ) | |||
1883 | return; | 1883 | return; |
1884 | } | 1884 | } |
1885 | 1885 | ||
1886 | static int DC390_queuecommand(struct scsi_cmnd *cmd, | 1886 | static int DC390_queuecommand_lck(struct scsi_cmnd *cmd, |
1887 | void (*done)(struct scsi_cmnd *)) | 1887 | void (*done)(struct scsi_cmnd *)) |
1888 | { | 1888 | { |
1889 | struct scsi_device *sdev = cmd->device; | 1889 | struct scsi_device *sdev = cmd->device; |
@@ -1944,6 +1944,8 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd, | |||
1944 | return SCSI_MLQUEUE_DEVICE_BUSY; | 1944 | return SCSI_MLQUEUE_DEVICE_BUSY; |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | static DEF_SCSI_QCMD(DC390_queuecommand) | ||
1948 | |||
1947 | static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB) | 1949 | static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB) |
1948 | { | 1950 | { |
1949 | struct pci_dev *pdev; | 1951 | struct pci_dev *pdev; |
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 5d9fdeeb2315..edfc5da8be4c 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c | |||
@@ -433,7 +433,7 @@ | |||
433 | 433 | ||
434 | static int u14_34f_detect(struct scsi_host_template *); | 434 | static int u14_34f_detect(struct scsi_host_template *); |
435 | static int u14_34f_release(struct Scsi_Host *); | 435 | static int u14_34f_release(struct Scsi_Host *); |
436 | static int u14_34f_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); | 436 | static int u14_34f_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
437 | static int u14_34f_eh_abort(struct scsi_cmnd *); | 437 | static int u14_34f_eh_abort(struct scsi_cmnd *); |
438 | static int u14_34f_eh_host_reset(struct scsi_cmnd *); | 438 | static int u14_34f_eh_host_reset(struct scsi_cmnd *); |
439 | static int u14_34f_bios_param(struct scsi_device *, struct block_device *, | 439 | static int u14_34f_bios_param(struct scsi_device *, struct block_device *, |
@@ -1248,7 +1248,7 @@ static void scsi_to_dev_dir(unsigned int i, unsigned int j) { | |||
1248 | 1248 | ||
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | static int u14_34f_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { | 1251 | static int u14_34f_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { |
1252 | unsigned int i, j, k; | 1252 | unsigned int i, j, k; |
1253 | struct mscp *cpp; | 1253 | struct mscp *cpp; |
1254 | 1254 | ||
@@ -1329,6 +1329,8 @@ static int u14_34f_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scs | |||
1329 | return 0; | 1329 | return 0; |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | static DEF_SCSI_QCMD(u14_34f_queuecommand) | ||
1333 | |||
1332 | static int u14_34f_eh_abort(struct scsi_cmnd *SCarg) { | 1334 | static int u14_34f_eh_abort(struct scsi_cmnd *SCarg) { |
1333 | unsigned int i, j; | 1335 | unsigned int i, j; |
1334 | 1336 | ||
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c index 27aa40f3980e..0571ef9639cb 100644 --- a/drivers/scsi/ultrastor.c +++ b/drivers/scsi/ultrastor.c | |||
@@ -700,7 +700,7 @@ static inline void build_sg_list(struct mscp *mscp, struct scsi_cmnd *SCpnt) | |||
700 | mscp->transfer_data_length = transfer_length; | 700 | mscp->transfer_data_length = transfer_length; |
701 | } | 701 | } |
702 | 702 | ||
703 | static int ultrastor_queuecommand(struct scsi_cmnd *SCpnt, | 703 | static int ultrastor_queuecommand_lck(struct scsi_cmnd *SCpnt, |
704 | void (*done) (struct scsi_cmnd *)) | 704 | void (*done) (struct scsi_cmnd *)) |
705 | { | 705 | { |
706 | struct mscp *my_mscp; | 706 | struct mscp *my_mscp; |
@@ -825,6 +825,8 @@ retry: | |||
825 | return 0; | 825 | return 0; |
826 | } | 826 | } |
827 | 827 | ||
828 | static DEF_SCSI_QCMD(ultrastor_queuecommand) | ||
829 | |||
828 | /* This code must deal with 2 cases: | 830 | /* This code must deal with 2 cases: |
829 | 831 | ||
830 | 1. The command has not been written to the OGM. In this case, set | 832 | 1. The command has not been written to the OGM. In this case, set |
diff --git a/drivers/scsi/ultrastor.h b/drivers/scsi/ultrastor.h index a692905f95f7..165c18b5cf5f 100644 --- a/drivers/scsi/ultrastor.h +++ b/drivers/scsi/ultrastor.h | |||
@@ -15,8 +15,7 @@ | |||
15 | 15 | ||
16 | static int ultrastor_detect(struct scsi_host_template *); | 16 | static int ultrastor_detect(struct scsi_host_template *); |
17 | static const char *ultrastor_info(struct Scsi_Host *shpnt); | 17 | static const char *ultrastor_info(struct Scsi_Host *shpnt); |
18 | static int ultrastor_queuecommand(struct scsi_cmnd *, | 18 | static int ultrastor_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
19 | void (*done)(struct scsi_cmnd *)); | ||
20 | static int ultrastor_abort(struct scsi_cmnd *); | 19 | static int ultrastor_abort(struct scsi_cmnd *); |
21 | static int ultrastor_host_reset(struct scsi_cmnd *); | 20 | static int ultrastor_host_reset(struct scsi_cmnd *); |
22 | static int ultrastor_biosparam(struct scsi_device *, struct block_device *, | 21 | static int ultrastor_biosparam(struct scsi_device *, struct block_device *, |
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 26894459c37f..a18996d24466 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c | |||
@@ -690,7 +690,7 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter, | |||
690 | return 0; | 690 | return 0; |
691 | } | 691 | } |
692 | 692 | ||
693 | static int pvscsi_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 693 | static int pvscsi_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
694 | { | 694 | { |
695 | struct Scsi_Host *host = cmd->device->host; | 695 | struct Scsi_Host *host = cmd->device->host; |
696 | struct pvscsi_adapter *adapter = shost_priv(host); | 696 | struct pvscsi_adapter *adapter = shost_priv(host); |
@@ -719,6 +719,8 @@ static int pvscsi_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
719 | return 0; | 719 | return 0; |
720 | } | 720 | } |
721 | 721 | ||
722 | static DEF_SCSI_QCMD(pvscsi_queue) | ||
723 | |||
722 | static int pvscsi_abort(struct scsi_cmnd *cmd) | 724 | static int pvscsi_abort(struct scsi_cmnd *cmd) |
723 | { | 725 | { |
724 | struct pvscsi_adapter *adapter = shost_priv(cmd->device->host); | 726 | struct pvscsi_adapter *adapter = shost_priv(cmd->device->host); |
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index b701bf2cc187..5f697e0bd009 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -371,8 +371,8 @@ calc_sync_msg(unsigned int period, unsigned int offset, unsigned int fast, | |||
371 | msg[1] = offset; | 371 | msg[1] = offset; |
372 | } | 372 | } |
373 | 373 | ||
374 | int | 374 | static int |
375 | wd33c93_queuecommand(struct scsi_cmnd *cmd, | 375 | wd33c93_queuecommand_lck(struct scsi_cmnd *cmd, |
376 | void (*done)(struct scsi_cmnd *)) | 376 | void (*done)(struct scsi_cmnd *)) |
377 | { | 377 | { |
378 | struct WD33C93_hostdata *hostdata; | 378 | struct WD33C93_hostdata *hostdata; |
@@ -468,6 +468,8 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd, | |||
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
470 | 470 | ||
471 | DEF_SCSI_QCMD(wd33c93_queuecommand) | ||
472 | |||
471 | /* | 473 | /* |
472 | * This routine attempts to start a scsi command. If the host_card is | 474 | * This routine attempts to start a scsi command. If the host_card is |
473 | * already connected, we give up immediately. Otherwise, look through | 475 | * already connected, we give up immediately. Otherwise, look through |
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h index 1ed5f3bf388e..3b463d7304dc 100644 --- a/drivers/scsi/wd33c93.h +++ b/drivers/scsi/wd33c93.h | |||
@@ -343,8 +343,7 @@ struct WD33C93_hostdata { | |||
343 | void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs, | 343 | void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs, |
344 | dma_setup_t setup, dma_stop_t stop, int clock_freq); | 344 | dma_setup_t setup, dma_stop_t stop, int clock_freq); |
345 | int wd33c93_abort (struct scsi_cmnd *cmd); | 345 | int wd33c93_abort (struct scsi_cmnd *cmd); |
346 | int wd33c93_queuecommand (struct scsi_cmnd *cmd, | 346 | int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd); |
347 | void (*done)(struct scsi_cmnd *)); | ||
348 | void wd33c93_intr (struct Scsi_Host *instance); | 347 | void wd33c93_intr (struct Scsi_Host *instance); |
349 | int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | 348 | int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); |
350 | int wd33c93_host_reset (struct scsi_cmnd *); | 349 | int wd33c93_host_reset (struct scsi_cmnd *); |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index 333580bf37c5..db451ae0a368 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -1082,7 +1082,7 @@ static irqreturn_t wd7000_intr(int irq, void *dev_id) | |||
1082 | return IRQ_HANDLED; | 1082 | return IRQ_HANDLED; |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | static int wd7000_queuecommand(struct scsi_cmnd *SCpnt, | 1085 | static int wd7000_queuecommand_lck(struct scsi_cmnd *SCpnt, |
1086 | void (*done)(struct scsi_cmnd *)) | 1086 | void (*done)(struct scsi_cmnd *)) |
1087 | { | 1087 | { |
1088 | Scb *scb; | 1088 | Scb *scb; |
@@ -1139,6 +1139,8 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt, | |||
1139 | return 0; | 1139 | return 0; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static DEF_SCSI_QCMD(wd7000_queuecommand) | ||
1143 | |||
1142 | static int wd7000_diagnostics(Adapter * host, int code) | 1144 | static int wd7000_diagnostics(Adapter * host, int code) |
1143 | { | 1145 | { |
1144 | static IcbDiag icb = { ICB_OP_DIAGNOSTICS }; | 1146 | static IcbDiag icb = { ICB_OP_DIAGNOSTICS }; |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index dd5e1ac22251..4d8e14b7aa93 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2343,11 +2343,8 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2343 | 2343 | ||
2344 | /* | 2344 | /* |
2345 | * CTS flow control flag and modem status interrupts | 2345 | * CTS flow control flag and modem status interrupts |
2346 | * Only disable MSI if no threads are waiting in | ||
2347 | * serial_core::uart_wait_modem_status | ||
2348 | */ | 2346 | */ |
2349 | if (!waitqueue_active(&up->port.state->port.delta_msr_wait)) | 2347 | up->ier &= ~UART_IER_MSI; |
2350 | up->ier &= ~UART_IER_MSI; | ||
2351 | if (!(up->bugs & UART_BUG_NOMSR) && | 2348 | if (!(up->bugs & UART_BUG_NOMSR) && |
2352 | UART_ENABLE_MS(&up->port, termios->c_cflag)) | 2349 | UART_ENABLE_MS(&up->port, termios->c_cflag)) |
2353 | up->ier |= UART_IER_MSI; | 2350 | up->ier |= UART_IER_MSI; |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index fa62578fcd20..bcc31f2140ac 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -18,7 +18,6 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
18 | #include <linux/tty.h> | 18 | #include <linux/tty.h> |
19 | #include <linux/tty_flip.h> | 19 | #include <linux/tty_flip.h> |
20 | #include <linux/major.h> | 20 | #include <linux/major.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <linux/string.h> | 21 | #include <linux/string.h> |
23 | #include <linux/fcntl.h> | 22 | #include <linux/fcntl.h> |
24 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index c4ea14670d44..9ffa5bee44ab 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/console.h> | 29 | #include <linux/console.h> |
30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
31 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/device.h> | 32 | #include <linux/device.h> |
34 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ | 33 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ |
35 | #include <linux/serial_core.h> | 34 | #include <linux/serial_core.h> |
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index 09615b51d591..cb12a8e1466b 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
@@ -571,7 +571,7 @@ long clk_round_parent(struct clk *clk, unsigned long target, | |||
571 | *best_freq = freq_max; | 571 | *best_freq = freq_max; |
572 | } | 572 | } |
573 | 573 | ||
574 | pr_debug("too low freq %lu, error %lu\n", freq->frequency, | 574 | pr_debug("too low freq %u, error %lu\n", freq->frequency, |
575 | target - freq_max); | 575 | target - freq_max); |
576 | 576 | ||
577 | if (!error) | 577 | if (!error) |
@@ -591,7 +591,7 @@ long clk_round_parent(struct clk *clk, unsigned long target, | |||
591 | *best_freq = freq_min; | 591 | *best_freq = freq_min; |
592 | } | 592 | } |
593 | 593 | ||
594 | pr_debug("too high freq %lu, error %lu\n", freq->frequency, | 594 | pr_debug("too high freq %u, error %lu\n", freq->frequency, |
595 | freq_min - target); | 595 | freq_min - target); |
596 | 596 | ||
597 | if (!error) | 597 | if (!error) |
diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c index e5bf5d3c698e..4e0ff7181164 100644 --- a/drivers/sh/intc/virq.c +++ b/drivers/sh/intc/virq.c | |||
@@ -215,7 +215,7 @@ restart: | |||
215 | entry = radix_tree_deref_slot((void **)entries[i]); | 215 | entry = radix_tree_deref_slot((void **)entries[i]); |
216 | if (unlikely(!entry)) | 216 | if (unlikely(!entry)) |
217 | continue; | 217 | continue; |
218 | if (unlikely(entry == RADIX_TREE_RETRY)) | 218 | if (radix_tree_deref_retry(entry)) |
219 | goto restart; | 219 | goto restart; |
220 | 220 | ||
221 | irq = create_irq(); | 221 | irq = create_irq(); |
diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h index f3c827eb0abe..25961c23dc0f 100644 --- a/drivers/staging/easycap/easycap.h +++ b/drivers/staging/easycap/easycap.h | |||
@@ -77,7 +77,6 @@ | |||
77 | #include <linux/slab.h> | 77 | #include <linux/slab.h> |
78 | #include <linux/module.h> | 78 | #include <linux/module.h> |
79 | #include <linux/kref.h> | 79 | #include <linux/kref.h> |
80 | #include <linux/smp_lock.h> | ||
81 | #include <linux/usb.h> | 80 | #include <linux/usb.h> |
82 | #include <linux/uaccess.h> | 81 | #include <linux/uaccess.h> |
83 | 82 | ||
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 41d9acf4cd61..6f8d67d0d64f 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c | |||
@@ -72,8 +72,7 @@ struct storvsc_driver_context { | |||
72 | 72 | ||
73 | /* Static decl */ | 73 | /* Static decl */ |
74 | static int storvsc_probe(struct device *dev); | 74 | static int storvsc_probe(struct device *dev); |
75 | static int storvsc_queuecommand(struct scsi_cmnd *scmnd, | 75 | static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd); |
76 | void (*done)(struct scsi_cmnd *)); | ||
77 | static int storvsc_device_alloc(struct scsi_device *); | 76 | static int storvsc_device_alloc(struct scsi_device *); |
78 | static int storvsc_device_configure(struct scsi_device *); | 77 | static int storvsc_device_configure(struct scsi_device *); |
79 | static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd); | 78 | static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd); |
@@ -595,7 +594,7 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl, | |||
595 | /* | 594 | /* |
596 | * storvsc_queuecommand - Initiate command processing | 595 | * storvsc_queuecommand - Initiate command processing |
597 | */ | 596 | */ |
598 | static int storvsc_queuecommand(struct scsi_cmnd *scmnd, | 597 | static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd, |
599 | void (*done)(struct scsi_cmnd *)) | 598 | void (*done)(struct scsi_cmnd *)) |
600 | { | 599 | { |
601 | int ret; | 600 | int ret; |
@@ -783,6 +782,8 @@ retry_request: | |||
783 | return ret; | 782 | return ret; |
784 | } | 783 | } |
785 | 784 | ||
785 | static DEF_SCSI_QCMD(storvsc_queuecommand) | ||
786 | |||
786 | static int storvsc_merge_bvec(struct request_queue *q, | 787 | static int storvsc_merge_bvec(struct request_queue *q, |
787 | struct bvec_merge_data *bmd, struct bio_vec *bvec) | 788 | struct bvec_merge_data *bmd, struct bio_vec *bvec) |
788 | { | 789 | { |
diff --git a/drivers/staging/intel_sst/intel_sst_app_interface.c b/drivers/staging/intel_sst/intel_sst_app_interface.c index 9618c7997461..991440015e92 100644 --- a/drivers/staging/intel_sst/intel_sst_app_interface.c +++ b/drivers/staging/intel_sst/intel_sst_app_interface.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/uaccess.h> | 34 | #include <linux/uaccess.h> |
35 | #include <linux/firmware.h> | 35 | #include <linux/firmware.h> |
36 | #include <linux/ioctl.h> | 36 | #include <linux/ioctl.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #ifdef CONFIG_MRST_RAR_HANDLER | 37 | #ifdef CONFIG_MRST_RAR_HANDLER |
39 | #include <linux/rar_register.h> | 38 | #include <linux/rar_register.h> |
40 | #include "../../../drivers/staging/memrar/memrar.h" | 39 | #include "../../../drivers/staging/memrar/memrar.h" |
diff --git a/drivers/staging/keucr/scsiglue.c b/drivers/staging/keucr/scsiglue.c index a2671404f7ac..da4f42af3838 100644 --- a/drivers/staging/keucr/scsiglue.c +++ b/drivers/staging/keucr/scsiglue.c | |||
@@ -87,7 +87,7 @@ static int slave_configure(struct scsi_device *sdev) | |||
87 | 87 | ||
88 | /* This is always called with scsi_lock(host) held */ | 88 | /* This is always called with scsi_lock(host) held */ |
89 | //----- queuecommand() --------------------- | 89 | //----- queuecommand() --------------------- |
90 | static int queuecommand(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *)) | 90 | static int queuecommand_lck(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *)) |
91 | { | 91 | { |
92 | struct us_data *us = host_to_us(srb->device->host); | 92 | struct us_data *us = host_to_us(srb->device->host); |
93 | 93 | ||
@@ -117,6 +117,8 @@ static int queuecommand(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *)) | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | static DEF_SCSI_QCMD(queuecommand) | ||
121 | |||
120 | /*********************************************************************** | 122 | /*********************************************************************** |
121 | * Error handling functions | 123 | * Error handling functions |
122 | ***********************************************************************/ | 124 | ***********************************************************************/ |
diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index 75aa7a36307d..4ca45ec7fd84 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/console.h> | 17 | #include <linux/console.h> |
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/i2c-id.h> | ||
21 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
22 | #include <linux/pci_ids.h> | 21 | #include <linux/pci_ids.h> |
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
@@ -733,7 +732,6 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
733 | edev: | 732 | edev: |
734 | platform_device_unregister(dcon_device); | 733 | platform_device_unregister(dcon_device); |
735 | dcon_device = NULL; | 734 | dcon_device = NULL; |
736 | i2c_set_clientdata(client, NULL); | ||
737 | eirq: | 735 | eirq: |
738 | free_irq(DCON_IRQ, &dcon_driver); | 736 | free_irq(DCON_IRQ, &dcon_driver); |
739 | einit: | 737 | einit: |
@@ -757,8 +755,6 @@ static int dcon_remove(struct i2c_client *client) | |||
757 | platform_device_unregister(dcon_device); | 755 | platform_device_unregister(dcon_device); |
758 | cancel_work_sync(&dcon_work); | 756 | cancel_work_sync(&dcon_work); |
759 | 757 | ||
760 | i2c_set_clientdata(client, NULL); | ||
761 | |||
762 | return 0; | 758 | return 0; |
763 | } | 759 | } |
764 | 760 | ||
diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h index d1674cd282dc..831d81e0e429 100644 --- a/drivers/staging/rtl8712/osdep_service.h +++ b/drivers/staging/rtl8712/osdep_service.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | #include <linux/kref.h> | 24 | #include <linux/kref.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
27 | #include <linux/skbuff.h> | 26 | #include <linux/skbuff.h> |
28 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
diff --git a/drivers/staging/speakup/buffers.c b/drivers/staging/speakup/buffers.c index b7b60d5e8660..a2db956edd54 100644 --- a/drivers/staging/speakup/buffers.c +++ b/drivers/staging/speakup/buffers.c | |||
@@ -1,5 +1,4 @@ | |||
1 | #include <linux/console.h> | 1 | #include <linux/console.h> |
2 | #include <linux/smp_lock.h> | ||
3 | #include <linux/types.h> | 2 | #include <linux/types.h> |
4 | #include <linux/wait.h> | 3 | #include <linux/wait.h> |
5 | 4 | ||
diff --git a/drivers/staging/stradis/Kconfig b/drivers/staging/stradis/Kconfig index 92e891141896..02f0fc504cf5 100644 --- a/drivers/staging/stradis/Kconfig +++ b/drivers/staging/stradis/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_STRADIS | 1 | config VIDEO_STRADIS |
2 | tristate "Stradis 4:2:2 MPEG-2 video driver (DEPRECATED)" | 2 | tristate "Stradis 4:2:2 MPEG-2 video driver (DEPRECATED)" |
3 | depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && VIRT_TO_BUS | 3 | depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && VIRT_TO_BUS && BKL |
4 | help | 4 | help |
5 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video | 5 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video |
6 | driver for PCI. There is a product page at | 6 | driver for PCI. There is a product page at |
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 9ec82796634e..c5690b2a8924 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c | |||
@@ -1032,6 +1032,7 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm) | |||
1032 | struct tm6000_fh *fh=priv; | 1032 | struct tm6000_fh *fh=priv; |
1033 | struct tm6000_core *dev = fh->dev; | 1033 | struct tm6000_core *dev = fh->dev; |
1034 | 1034 | ||
1035 | dev->norm = *norm; | ||
1035 | rc = tm6000_init_analog_mode(dev); | 1036 | rc = tm6000_init_analog_mode(dev); |
1036 | 1037 | ||
1037 | fh->width = dev->width; | 1038 | fh->width = dev->width; |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index eaa5d3efa79d..c556ed9db13d 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
@@ -554,7 +554,7 @@ EXPORT_SYMBOL(handle_sysrq); | |||
554 | #ifdef CONFIG_INPUT | 554 | #ifdef CONFIG_INPUT |
555 | 555 | ||
556 | /* Simple translation table for the SysRq keys */ | 556 | /* Simple translation table for the SysRq keys */ |
557 | static const unsigned char sysrq_xlate[KEY_MAX + 1] = | 557 | static const unsigned char sysrq_xlate[KEY_CNT] = |
558 | "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ | 558 | "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ |
559 | "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ | 559 | "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ |
560 | "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ | 560 | "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ |
@@ -563,53 +563,129 @@ static const unsigned char sysrq_xlate[KEY_MAX + 1] = | |||
563 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ | 563 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ |
564 | "\r\000/"; /* 0x60 - 0x6f */ | 564 | "\r\000/"; /* 0x60 - 0x6f */ |
565 | 565 | ||
566 | static bool sysrq_down; | 566 | struct sysrq_state { |
567 | static int sysrq_alt_use; | 567 | struct input_handle handle; |
568 | static int sysrq_alt; | 568 | struct work_struct reinject_work; |
569 | static DEFINE_SPINLOCK(sysrq_event_lock); | 569 | unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; |
570 | unsigned int alt; | ||
571 | unsigned int alt_use; | ||
572 | bool active; | ||
573 | bool need_reinject; | ||
574 | }; | ||
575 | |||
576 | static void sysrq_reinject_alt_sysrq(struct work_struct *work) | ||
577 | { | ||
578 | struct sysrq_state *sysrq = | ||
579 | container_of(work, struct sysrq_state, reinject_work); | ||
580 | struct input_handle *handle = &sysrq->handle; | ||
581 | unsigned int alt_code = sysrq->alt_use; | ||
582 | |||
583 | if (sysrq->need_reinject) { | ||
584 | /* Simulate press and release of Alt + SysRq */ | ||
585 | input_inject_event(handle, EV_KEY, alt_code, 1); | ||
586 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1); | ||
587 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); | ||
588 | |||
589 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0); | ||
590 | input_inject_event(handle, EV_KEY, alt_code, 0); | ||
591 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); | ||
592 | } | ||
593 | } | ||
570 | 594 | ||
571 | static bool sysrq_filter(struct input_handle *handle, unsigned int type, | 595 | static bool sysrq_filter(struct input_handle *handle, |
572 | unsigned int code, int value) | 596 | unsigned int type, unsigned int code, int value) |
573 | { | 597 | { |
598 | struct sysrq_state *sysrq = handle->private; | ||
599 | bool was_active = sysrq->active; | ||
574 | bool suppress; | 600 | bool suppress; |
575 | 601 | ||
576 | /* We are called with interrupts disabled, just take the lock */ | 602 | switch (type) { |
577 | spin_lock(&sysrq_event_lock); | ||
578 | 603 | ||
579 | if (type != EV_KEY) | 604 | case EV_SYN: |
580 | goto out; | 605 | suppress = false; |
606 | break; | ||
581 | 607 | ||
582 | switch (code) { | 608 | case EV_KEY: |
609 | switch (code) { | ||
583 | 610 | ||
584 | case KEY_LEFTALT: | 611 | case KEY_LEFTALT: |
585 | case KEY_RIGHTALT: | 612 | case KEY_RIGHTALT: |
586 | if (value) | 613 | if (!value) { |
587 | sysrq_alt = code; | 614 | /* One of ALTs is being released */ |
588 | else { | 615 | if (sysrq->active && code == sysrq->alt_use) |
589 | if (sysrq_down && code == sysrq_alt_use) | 616 | sysrq->active = false; |
590 | sysrq_down = false; | ||
591 | 617 | ||
592 | sysrq_alt = 0; | 618 | sysrq->alt = KEY_RESERVED; |
619 | |||
620 | } else if (value != 2) { | ||
621 | sysrq->alt = code; | ||
622 | sysrq->need_reinject = false; | ||
623 | } | ||
624 | break; | ||
625 | |||
626 | case KEY_SYSRQ: | ||
627 | if (value == 1 && sysrq->alt != KEY_RESERVED) { | ||
628 | sysrq->active = true; | ||
629 | sysrq->alt_use = sysrq->alt; | ||
630 | /* | ||
631 | * If nothing else will be pressed we'll need | ||
632 | * to * re-inject Alt-SysRq keysroke. | ||
633 | */ | ||
634 | sysrq->need_reinject = true; | ||
635 | } | ||
636 | |||
637 | /* | ||
638 | * Pretend that sysrq was never pressed at all. This | ||
639 | * is needed to properly handle KGDB which will try | ||
640 | * to release all keys after exiting debugger. If we | ||
641 | * do not clear key bit it KGDB will end up sending | ||
642 | * release events for Alt and SysRq, potentially | ||
643 | * triggering print screen function. | ||
644 | */ | ||
645 | if (sysrq->active) | ||
646 | clear_bit(KEY_SYSRQ, handle->dev->key); | ||
647 | |||
648 | break; | ||
649 | |||
650 | default: | ||
651 | if (sysrq->active && value && value != 2) { | ||
652 | sysrq->need_reinject = false; | ||
653 | __handle_sysrq(sysrq_xlate[code], true); | ||
654 | } | ||
655 | break; | ||
593 | } | 656 | } |
594 | break; | ||
595 | 657 | ||
596 | case KEY_SYSRQ: | 658 | suppress = sysrq->active; |
597 | if (value == 1 && sysrq_alt) { | 659 | |
598 | sysrq_down = true; | 660 | if (!sysrq->active) { |
599 | sysrq_alt_use = sysrq_alt; | 661 | /* |
662 | * If we are not suppressing key presses keep track of | ||
663 | * keyboard state so we can release keys that have been | ||
664 | * pressed before entering SysRq mode. | ||
665 | */ | ||
666 | if (value) | ||
667 | set_bit(code, sysrq->key_down); | ||
668 | else | ||
669 | clear_bit(code, sysrq->key_down); | ||
670 | |||
671 | if (was_active) | ||
672 | schedule_work(&sysrq->reinject_work); | ||
673 | |||
674 | } else if (value == 0 && | ||
675 | test_and_clear_bit(code, sysrq->key_down)) { | ||
676 | /* | ||
677 | * Pass on release events for keys that was pressed before | ||
678 | * entering SysRq mode. | ||
679 | */ | ||
680 | suppress = false; | ||
600 | } | 681 | } |
601 | break; | 682 | break; |
602 | 683 | ||
603 | default: | 684 | default: |
604 | if (sysrq_down && value && value != 2) | 685 | suppress = sysrq->active; |
605 | __handle_sysrq(sysrq_xlate[code], true); | ||
606 | break; | 686 | break; |
607 | } | 687 | } |
608 | 688 | ||
609 | out: | ||
610 | suppress = sysrq_down; | ||
611 | spin_unlock(&sysrq_event_lock); | ||
612 | |||
613 | return suppress; | 689 | return suppress; |
614 | } | 690 | } |
615 | 691 | ||
@@ -617,28 +693,28 @@ static int sysrq_connect(struct input_handler *handler, | |||
617 | struct input_dev *dev, | 693 | struct input_dev *dev, |
618 | const struct input_device_id *id) | 694 | const struct input_device_id *id) |
619 | { | 695 | { |
620 | struct input_handle *handle; | 696 | struct sysrq_state *sysrq; |
621 | int error; | 697 | int error; |
622 | 698 | ||
623 | sysrq_down = false; | 699 | sysrq = kzalloc(sizeof(struct sysrq_state), GFP_KERNEL); |
624 | sysrq_alt = 0; | 700 | if (!sysrq) |
625 | |||
626 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); | ||
627 | if (!handle) | ||
628 | return -ENOMEM; | 701 | return -ENOMEM; |
629 | 702 | ||
630 | handle->dev = dev; | 703 | INIT_WORK(&sysrq->reinject_work, sysrq_reinject_alt_sysrq); |
631 | handle->handler = handler; | 704 | |
632 | handle->name = "sysrq"; | 705 | sysrq->handle.dev = dev; |
706 | sysrq->handle.handler = handler; | ||
707 | sysrq->handle.name = "sysrq"; | ||
708 | sysrq->handle.private = sysrq; | ||
633 | 709 | ||
634 | error = input_register_handle(handle); | 710 | error = input_register_handle(&sysrq->handle); |
635 | if (error) { | 711 | if (error) { |
636 | pr_err("Failed to register input sysrq handler, error %d\n", | 712 | pr_err("Failed to register input sysrq handler, error %d\n", |
637 | error); | 713 | error); |
638 | goto err_free; | 714 | goto err_free; |
639 | } | 715 | } |
640 | 716 | ||
641 | error = input_open_device(handle); | 717 | error = input_open_device(&sysrq->handle); |
642 | if (error) { | 718 | if (error) { |
643 | pr_err("Failed to open input device, error %d\n", error); | 719 | pr_err("Failed to open input device, error %d\n", error); |
644 | goto err_unregister; | 720 | goto err_unregister; |
@@ -647,17 +723,20 @@ static int sysrq_connect(struct input_handler *handler, | |||
647 | return 0; | 723 | return 0; |
648 | 724 | ||
649 | err_unregister: | 725 | err_unregister: |
650 | input_unregister_handle(handle); | 726 | input_unregister_handle(&sysrq->handle); |
651 | err_free: | 727 | err_free: |
652 | kfree(handle); | 728 | kfree(sysrq); |
653 | return error; | 729 | return error; |
654 | } | 730 | } |
655 | 731 | ||
656 | static void sysrq_disconnect(struct input_handle *handle) | 732 | static void sysrq_disconnect(struct input_handle *handle) |
657 | { | 733 | { |
734 | struct sysrq_state *sysrq = handle->private; | ||
735 | |||
658 | input_close_device(handle); | 736 | input_close_device(handle); |
737 | cancel_work_sync(&sysrq->reinject_work); | ||
659 | input_unregister_handle(handle); | 738 | input_unregister_handle(handle); |
660 | kfree(handle); | 739 | kfree(sysrq); |
661 | } | 740 | } |
662 | 741 | ||
663 | /* | 742 | /* |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index ea071a5b6eee..44447f54942f 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -2301,7 +2301,7 @@ out: | |||
2301 | return ret; | 2301 | return ret; |
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); | 2304 | static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); |
2305 | 2305 | ||
2306 | static ssize_t read_human_status(struct device *dev, | 2306 | static ssize_t read_human_status(struct device *dev, |
2307 | struct device_attribute *attr, char *buf) | 2307 | struct device_attribute *attr, char *buf) |
@@ -2364,8 +2364,7 @@ out: | |||
2364 | return ret; | 2364 | return ret; |
2365 | } | 2365 | } |
2366 | 2366 | ||
2367 | static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, | 2367 | static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL); |
2368 | read_human_status, NULL); | ||
2369 | 2368 | ||
2370 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, | 2369 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, |
2371 | char *buf) | 2370 | char *buf) |
@@ -2397,7 +2396,7 @@ out: | |||
2397 | return ret; | 2396 | return ret; |
2398 | } | 2397 | } |
2399 | 2398 | ||
2400 | static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); | 2399 | static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL); |
2401 | 2400 | ||
2402 | #define UEA_ATTR(name, reset) \ | 2401 | #define UEA_ATTR(name, reset) \ |
2403 | \ | 2402 | \ |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index ddb4dc980923..a3d2e2399655 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -54,7 +54,6 @@ | |||
54 | #include <linux/gfp.h> | 54 | #include <linux/gfp.h> |
55 | #include <linux/poll.h> | 55 | #include <linux/poll.h> |
56 | #include <linux/usb.h> | 56 | #include <linux/usb.h> |
57 | #include <linux/smp_lock.h> | ||
58 | #include <linux/usbdevice_fs.h> | 57 | #include <linux/usbdevice_fs.h> |
59 | #include <linux/usb/hcd.h> | 58 | #include <linux/usb/hcd.h> |
60 | #include <linux/mutex.h> | 59 | #include <linux/mutex.h> |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 045bb4b823e1..a7131ad630f9 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/fs.h> | 37 | #include <linux/fs.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/signal.h> | 40 | #include <linux/signal.h> |
42 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
43 | #include <linux/module.h> | 42 | #include <linux/module.h> |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 9fe34fb78ef1..cf6a5423de09 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/rwsem.h> | 20 | #include <linux/rwsem.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/smp_lock.h> | ||
23 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
24 | 23 | ||
25 | #include "usb.h" | 24 | #include "usb.h" |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 9819a4cc3b26..b690aa35df9a 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/parser.h> | 39 | #include <linux/parser.h> |
40 | #include <linux/notifier.h> | 40 | #include <linux/notifier.h> |
41 | #include <linux/seq_file.h> | 41 | #include <linux/seq_file.h> |
42 | #include <linux/smp_lock.h> | ||
43 | #include <linux/usb/hcd.h> | 42 | #include <linux/usb/hcd.h> |
44 | #include <asm/byteorder.h> | 43 | #include <asm/byteorder.h> |
45 | #include "usb.h" | 44 | #include "usb.h" |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index b5e20e873cba..717ff653fa23 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -2017,7 +2017,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
2017 | } | 2017 | } |
2018 | } else { | 2018 | } else { |
2019 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ | 2019 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ |
2020 | ubc->vbus_pin = -EINVAL; | 2020 | udc->vbus_pin = -EINVAL; |
2021 | } | 2021 | } |
2022 | } | 2022 | } |
2023 | 2023 | ||
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 4a830df4fc31..484c5ba5450e 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
31 | #include <linux/pagemap.h> | 31 | #include <linux/pagemap.h> |
32 | #include <asm/unaligned.h> | 32 | #include <asm/unaligned.h> |
33 | #include <linux/smp_lock.h> | ||
34 | 33 | ||
35 | #include <linux/usb/composite.h> | 34 | #include <linux/usb/composite.h> |
36 | #include <linux/usb/functionfs.h> | 35 | #include <linux/usb/functionfs.h> |
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c index 4f891eddd060..598e7e2ab80c 100644 --- a/drivers/usb/gadget/f_hid.c +++ b/drivers/usb/gadget/f_hid.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/cdev.h> | 25 | #include <linux/cdev.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/poll.h> | 27 | #include <linux/poll.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
30 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
31 | #include <linux/usb/g_hid.h> | 30 | #include <linux/usb/g_hid.h> |
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 86afdc73322f..6e2599661b5b 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -1067,7 +1067,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci) | |||
1067 | &debug_registers_fops)) | 1067 | &debug_registers_fops)) |
1068 | goto file_error; | 1068 | goto file_error; |
1069 | 1069 | ||
1070 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, | 1070 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, |
1071 | &debug_lpm_fops)) | 1071 | &debug_lpm_fops)) |
1072 | goto file_error; | 1072 | goto file_error; |
1073 | 1073 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 502a7e6fef42..e9062806d4a2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1063,10 +1063,11 @@ rescan: | |||
1063 | tmp && tmp != qh; | 1063 | tmp && tmp != qh; |
1064 | tmp = tmp->qh_next.qh) | 1064 | tmp = tmp->qh_next.qh) |
1065 | continue; | 1065 | continue; |
1066 | /* periodic qh self-unlinks on empty */ | 1066 | /* periodic qh self-unlinks on empty, and a COMPLETING qh |
1067 | if (!tmp) | 1067 | * may already be unlinked. |
1068 | goto nogood; | 1068 | */ |
1069 | unlink_async (ehci, qh); | 1069 | if (tmp) |
1070 | unlink_async(ehci, qh); | ||
1070 | /* FALL THROUGH */ | 1071 | /* FALL THROUGH */ |
1071 | case QH_STATE_UNLINK: /* wait for hw to finish? */ | 1072 | case QH_STATE_UNLINK: /* wait for hw to finish? */ |
1072 | case QH_STATE_UNLINK_WAIT: | 1073 | case QH_STATE_UNLINK_WAIT: |
@@ -1083,7 +1084,6 @@ idle_timeout: | |||
1083 | } | 1084 | } |
1084 | /* else FALL THROUGH */ | 1085 | /* else FALL THROUGH */ |
1085 | default: | 1086 | default: |
1086 | nogood: | ||
1087 | /* caller was supposed to have unlinked any requests; | 1087 | /* caller was supposed to have unlinked any requests; |
1088 | * that's not our job. just leak this memory. | 1088 | * that's not our job. just leak this memory. |
1089 | */ | 1089 | */ |
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index d36e4e75e08d..12f70c302b0b 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
@@ -141,6 +141,10 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci) | |||
141 | qh_put (ehci->async); | 141 | qh_put (ehci->async); |
142 | ehci->async = NULL; | 142 | ehci->async = NULL; |
143 | 143 | ||
144 | if (ehci->dummy) | ||
145 | qh_put(ehci->dummy); | ||
146 | ehci->dummy = NULL; | ||
147 | |||
144 | /* DMA consistent memory and pools */ | 148 | /* DMA consistent memory and pools */ |
145 | if (ehci->qtd_pool) | 149 | if (ehci->qtd_pool) |
146 | dma_pool_destroy (ehci->qtd_pool); | 150 | dma_pool_destroy (ehci->qtd_pool); |
@@ -227,8 +231,26 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) | |||
227 | if (ehci->periodic == NULL) { | 231 | if (ehci->periodic == NULL) { |
228 | goto fail; | 232 | goto fail; |
229 | } | 233 | } |
230 | for (i = 0; i < ehci->periodic_size; i++) | 234 | |
231 | ehci->periodic [i] = EHCI_LIST_END(ehci); | 235 | if (ehci->use_dummy_qh) { |
236 | struct ehci_qh_hw *hw; | ||
237 | ehci->dummy = ehci_qh_alloc(ehci, flags); | ||
238 | if (!ehci->dummy) | ||
239 | goto fail; | ||
240 | |||
241 | hw = ehci->dummy->hw; | ||
242 | hw->hw_next = EHCI_LIST_END(ehci); | ||
243 | hw->hw_qtd_next = EHCI_LIST_END(ehci); | ||
244 | hw->hw_alt_next = EHCI_LIST_END(ehci); | ||
245 | hw->hw_token &= ~QTD_STS_ACTIVE; | ||
246 | ehci->dummy->hw = hw; | ||
247 | |||
248 | for (i = 0; i < ehci->periodic_size; i++) | ||
249 | ehci->periodic[i] = ehci->dummy->qh_dma; | ||
250 | } else { | ||
251 | for (i = 0; i < ehci->periodic_size; i++) | ||
252 | ehci->periodic[i] = EHCI_LIST_END(ehci); | ||
253 | } | ||
232 | 254 | ||
233 | /* software shadow of hardware table */ | 255 | /* software shadow of hardware table */ |
234 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); | 256 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index a1e8d273103f..01bb72b71832 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -103,6 +103,19 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
103 | if (retval) | 103 | if (retval) |
104 | return retval; | 104 | return retval; |
105 | 105 | ||
106 | if ((pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x7808) || | ||
107 | (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x4396)) { | ||
108 | /* EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may | ||
109 | * read/write memory space which does not belong to it when | ||
110 | * there is NULL pointer with T-bit set to 1 in the frame list | ||
111 | * table. To avoid the issue, the frame list link pointer | ||
112 | * should always contain a valid pointer to a inactive qh. | ||
113 | */ | ||
114 | ehci->use_dummy_qh = 1; | ||
115 | ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI " | ||
116 | "dummy qh workaround\n"); | ||
117 | } | ||
118 | |||
106 | /* data structure init */ | 119 | /* data structure init */ |
107 | retval = ehci_init(hcd); | 120 | retval = ehci_init(hcd); |
108 | if (retval) | 121 | if (retval) |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index a92526d6e5ae..d9f78eb26572 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -98,7 +98,14 @@ static void periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr) | |||
98 | */ | 98 | */ |
99 | *prev_p = *periodic_next_shadow(ehci, &here, | 99 | *prev_p = *periodic_next_shadow(ehci, &here, |
100 | Q_NEXT_TYPE(ehci, *hw_p)); | 100 | Q_NEXT_TYPE(ehci, *hw_p)); |
101 | *hw_p = *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)); | 101 | |
102 | if (!ehci->use_dummy_qh || | ||
103 | *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)) | ||
104 | != EHCI_LIST_END(ehci)) | ||
105 | *hw_p = *shadow_next_periodic(ehci, &here, | ||
106 | Q_NEXT_TYPE(ehci, *hw_p)); | ||
107 | else | ||
108 | *hw_p = ehci->dummy->qh_dma; | ||
102 | } | 109 | } |
103 | 110 | ||
104 | /* how many of the uframe's 125 usecs are allocated? */ | 111 | /* how many of the uframe's 125 usecs are allocated? */ |
@@ -2335,7 +2342,11 @@ restart: | |||
2335 | * pointer for much longer, if at all. | 2342 | * pointer for much longer, if at all. |
2336 | */ | 2343 | */ |
2337 | *q_p = q.itd->itd_next; | 2344 | *q_p = q.itd->itd_next; |
2338 | *hw_p = q.itd->hw_next; | 2345 | if (!ehci->use_dummy_qh || |
2346 | q.itd->hw_next != EHCI_LIST_END(ehci)) | ||
2347 | *hw_p = q.itd->hw_next; | ||
2348 | else | ||
2349 | *hw_p = ehci->dummy->qh_dma; | ||
2339 | type = Q_NEXT_TYPE(ehci, q.itd->hw_next); | 2350 | type = Q_NEXT_TYPE(ehci, q.itd->hw_next); |
2340 | wmb(); | 2351 | wmb(); |
2341 | modified = itd_complete (ehci, q.itd); | 2352 | modified = itd_complete (ehci, q.itd); |
@@ -2368,7 +2379,11 @@ restart: | |||
2368 | * URB completion. | 2379 | * URB completion. |
2369 | */ | 2380 | */ |
2370 | *q_p = q.sitd->sitd_next; | 2381 | *q_p = q.sitd->sitd_next; |
2371 | *hw_p = q.sitd->hw_next; | 2382 | if (!ehci->use_dummy_qh || |
2383 | q.sitd->hw_next != EHCI_LIST_END(ehci)) | ||
2384 | *hw_p = q.sitd->hw_next; | ||
2385 | else | ||
2386 | *hw_p = ehci->dummy->qh_dma; | ||
2372 | type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); | 2387 | type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); |
2373 | wmb(); | 2388 | wmb(); |
2374 | modified = sitd_complete (ehci, q.sitd); | 2389 | modified = sitd_complete (ehci, q.sitd); |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bde823f704e9..ba8eab366b82 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -73,6 +73,7 @@ struct ehci_hcd { /* one per controller */ | |||
73 | 73 | ||
74 | /* async schedule support */ | 74 | /* async schedule support */ |
75 | struct ehci_qh *async; | 75 | struct ehci_qh *async; |
76 | struct ehci_qh *dummy; /* For AMD quirk use */ | ||
76 | struct ehci_qh *reclaim; | 77 | struct ehci_qh *reclaim; |
77 | unsigned scanning : 1; | 78 | unsigned scanning : 1; |
78 | 79 | ||
@@ -131,6 +132,7 @@ struct ehci_hcd { /* one per controller */ | |||
131 | unsigned need_io_watchdog:1; | 132 | unsigned need_io_watchdog:1; |
132 | unsigned broken_periodic:1; | 133 | unsigned broken_periodic:1; |
133 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ | 134 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ |
135 | unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ | ||
134 | 136 | ||
135 | /* required for usb32 quirk */ | 137 | /* required for usb32 quirk */ |
136 | #define OHCI_CTRL_HCFS (3 << 6) | 138 | #define OHCI_CTRL_HCFS (3 << 6) |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 8196fa11fec4..43a39eb56cc6 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -70,7 +70,6 @@ | |||
70 | #include <linux/ioport.h> | 70 | #include <linux/ioport.h> |
71 | #include <linux/sched.h> | 71 | #include <linux/sched.h> |
72 | #include <linux/slab.h> | 72 | #include <linux/slab.h> |
73 | #include <linux/smp_lock.h> | ||
74 | #include <linux/errno.h> | 73 | #include <linux/errno.h> |
75 | #include <linux/init.h> | 74 | #include <linux/init.h> |
76 | #include <linux/list.h> | 75 | #include <linux/list.h> |
@@ -2684,7 +2683,7 @@ static int __devexit isp1362_remove(struct platform_device *pdev) | |||
2684 | return 0; | 2683 | return 0; |
2685 | } | 2684 | } |
2686 | 2685 | ||
2687 | static int __init isp1362_probe(struct platform_device *pdev) | 2686 | static int __devinit isp1362_probe(struct platform_device *pdev) |
2688 | { | 2687 | { |
2689 | struct usb_hcd *hcd; | 2688 | struct usb_hcd *hcd; |
2690 | struct isp1362_hcd *isp1362_hcd; | 2689 | struct isp1362_hcd *isp1362_hcd; |
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index 6e7fb5f38db6..ee60cd3ea642 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/debugfs.h> | 14 | #include <linux/debugfs.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <asm/io.h> | 15 | #include <asm/io.h> |
17 | 16 | ||
18 | #include "uhci-hcd.h" | 17 | #include "uhci-hcd.h" |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 202770676da3..d178761c3981 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1045,7 +1045,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | |||
1045 | if (udev->speed == USB_SPEED_SUPER) | 1045 | if (udev->speed == USB_SPEED_SUPER) |
1046 | return ep->ss_ep_comp.wBytesPerInterval; | 1046 | return ep->ss_ep_comp.wBytesPerInterval; |
1047 | 1047 | ||
1048 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1048 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
1049 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; | 1049 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; |
1050 | /* A 0 in max burst means 1 transfer per ESIT */ | 1050 | /* A 0 in max burst means 1 transfer per ESIT */ |
1051 | return max_packet * (max_burst + 1); | 1051 | return max_packet * (max_burst + 1); |
@@ -1135,7 +1135,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1135 | /* Fall through */ | 1135 | /* Fall through */ |
1136 | case USB_SPEED_FULL: | 1136 | case USB_SPEED_FULL: |
1137 | case USB_SPEED_LOW: | 1137 | case USB_SPEED_LOW: |
1138 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1138 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
1139 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); | 1139 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); |
1140 | break; | 1140 | break; |
1141 | default: | 1141 | default: |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9f3115e729b1..df558f6f84e3 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2104,7 +2104,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
2104 | 2104 | ||
2105 | if (!(status & STS_EINT)) { | 2105 | if (!(status & STS_EINT)) { |
2106 | spin_unlock(&xhci->lock); | 2106 | spin_unlock(&xhci->lock); |
2107 | xhci_warn(xhci, "Spurious interrupt.\n"); | ||
2108 | return IRQ_NONE; | 2107 | return IRQ_NONE; |
2109 | } | 2108 | } |
2110 | xhci_dbg(xhci, "op reg status = %08x\n", status); | 2109 | xhci_dbg(xhci, "op reg status = %08x\n", status); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5d7d4e951ea4..06fca0835b52 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -577,6 +577,65 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
577 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 577 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
578 | } | 578 | } |
579 | 579 | ||
580 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | ||
581 | { | ||
582 | u64 val_64; | ||
583 | |||
584 | /* step 2: initialize command ring buffer */ | ||
585 | val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
586 | val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | | ||
587 | (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
588 | xhci->cmd_ring->dequeue) & | ||
589 | (u64) ~CMD_RING_RSVD_BITS) | | ||
590 | xhci->cmd_ring->cycle_state; | ||
591 | xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", | ||
592 | (long unsigned long) val_64); | ||
593 | xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); | ||
594 | } | ||
595 | |||
596 | /* | ||
597 | * The whole command ring must be cleared to zero when we suspend the host. | ||
598 | * | ||
599 | * The host doesn't save the command ring pointer in the suspend well, so we | ||
600 | * need to re-program it on resume. Unfortunately, the pointer must be 64-byte | ||
601 | * aligned, because of the reserved bits in the command ring dequeue pointer | ||
602 | * register. Therefore, we can't just set the dequeue pointer back in the | ||
603 | * middle of the ring (TRBs are 16-byte aligned). | ||
604 | */ | ||
605 | static void xhci_clear_command_ring(struct xhci_hcd *xhci) | ||
606 | { | ||
607 | struct xhci_ring *ring; | ||
608 | struct xhci_segment *seg; | ||
609 | |||
610 | ring = xhci->cmd_ring; | ||
611 | seg = ring->deq_seg; | ||
612 | do { | ||
613 | memset(seg->trbs, 0, SEGMENT_SIZE); | ||
614 | seg = seg->next; | ||
615 | } while (seg != ring->deq_seg); | ||
616 | |||
617 | /* Reset the software enqueue and dequeue pointers */ | ||
618 | ring->deq_seg = ring->first_seg; | ||
619 | ring->dequeue = ring->first_seg->trbs; | ||
620 | ring->enq_seg = ring->deq_seg; | ||
621 | ring->enqueue = ring->dequeue; | ||
622 | |||
623 | /* | ||
624 | * Ring is now zeroed, so the HW should look for change of ownership | ||
625 | * when the cycle bit is set to 1. | ||
626 | */ | ||
627 | ring->cycle_state = 1; | ||
628 | |||
629 | /* | ||
630 | * Reset the hardware dequeue pointer. | ||
631 | * Yes, this will need to be re-written after resume, but we're paranoid | ||
632 | * and want to make sure the hardware doesn't access bogus memory | ||
633 | * because, say, the BIOS or an SMI started the host without changing | ||
634 | * the command ring pointers. | ||
635 | */ | ||
636 | xhci_set_cmd_ring_deq(xhci); | ||
637 | } | ||
638 | |||
580 | /* | 639 | /* |
581 | * Stop HC (not bus-specific) | 640 | * Stop HC (not bus-specific) |
582 | * | 641 | * |
@@ -604,6 +663,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
604 | spin_unlock_irq(&xhci->lock); | 663 | spin_unlock_irq(&xhci->lock); |
605 | return -ETIMEDOUT; | 664 | return -ETIMEDOUT; |
606 | } | 665 | } |
666 | xhci_clear_command_ring(xhci); | ||
607 | 667 | ||
608 | /* step 3: save registers */ | 668 | /* step 3: save registers */ |
609 | xhci_save_registers(xhci); | 669 | xhci_save_registers(xhci); |
@@ -635,7 +695,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
635 | u32 command, temp = 0; | 695 | u32 command, temp = 0; |
636 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 696 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
637 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | 697 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
638 | u64 val_64; | ||
639 | int old_state, retval; | 698 | int old_state, retval; |
640 | 699 | ||
641 | old_state = hcd->state; | 700 | old_state = hcd->state; |
@@ -648,15 +707,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
648 | /* step 1: restore register */ | 707 | /* step 1: restore register */ |
649 | xhci_restore_registers(xhci); | 708 | xhci_restore_registers(xhci); |
650 | /* step 2: initialize command ring buffer */ | 709 | /* step 2: initialize command ring buffer */ |
651 | val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 710 | xhci_set_cmd_ring_deq(xhci); |
652 | val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | | ||
653 | (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
654 | xhci->cmd_ring->dequeue) & | ||
655 | (u64) ~CMD_RING_RSVD_BITS) | | ||
656 | xhci->cmd_ring->cycle_state; | ||
657 | xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", | ||
658 | (long unsigned long) val_64); | ||
659 | xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); | ||
660 | /* step 3: restore state and start state*/ | 711 | /* step 3: restore state and start state*/ |
661 | /* step 3: set CRS flag */ | 712 | /* step 3: set CRS flag */ |
662 | command = xhci_readl(xhci, &xhci->op_regs->command); | 713 | command = xhci_readl(xhci, &xhci->op_regs->command); |
@@ -714,6 +765,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
714 | return retval; | 765 | return retval; |
715 | } | 766 | } |
716 | 767 | ||
768 | spin_unlock_irq(&xhci->lock); | ||
717 | /* Re-setup MSI-X */ | 769 | /* Re-setup MSI-X */ |
718 | if (hcd->irq) | 770 | if (hcd->irq) |
719 | free_irq(hcd->irq, hcd); | 771 | free_irq(hcd->irq, hcd); |
@@ -736,6 +788,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
736 | hcd->irq = pdev->irq; | 788 | hcd->irq = pdev->irq; |
737 | } | 789 | } |
738 | 790 | ||
791 | spin_lock_irq(&xhci->lock); | ||
739 | /* step 4: set Run/Stop bit */ | 792 | /* step 4: set Run/Stop bit */ |
740 | command = xhci_readl(xhci, &xhci->op_regs->command); | 793 | command = xhci_readl(xhci, &xhci->op_regs->command); |
741 | command |= CMD_RUN; | 794 | command |= CMD_RUN; |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 93d3bf4d213c..85e65647d445 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -621,6 +621,11 @@ struct xhci_ep_ctx { | |||
621 | #define MAX_PACKET_MASK (0xffff << 16) | 621 | #define MAX_PACKET_MASK (0xffff << 16) |
622 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) | 622 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) |
623 | 623 | ||
624 | /* Get max packet size from ep desc. Bit 10..0 specify the max packet size. | ||
625 | * USB2.0 spec 9.6.6. | ||
626 | */ | ||
627 | #define GET_MAX_PACKET(p) ((p) & 0x7ff) | ||
628 | |||
624 | /* tx_info bitmasks */ | 629 | /* tx_info bitmasks */ |
625 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) | 630 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) |
626 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) | 631 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) |
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 5a47805d9580..c90c89dc0003 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -364,7 +364,7 @@ static int mts_scsi_host_reset(struct scsi_cmnd *srb) | |||
364 | } | 364 | } |
365 | 365 | ||
366 | static int | 366 | static int |
367 | mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback); | 367 | mts_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *srb); |
368 | 368 | ||
369 | static void mts_transfer_cleanup( struct urb *transfer ); | 369 | static void mts_transfer_cleanup( struct urb *transfer ); |
370 | static void mts_do_sg(struct urb * transfer); | 370 | static void mts_do_sg(struct urb * transfer); |
@@ -573,7 +573,7 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc) | |||
573 | 573 | ||
574 | 574 | ||
575 | static int | 575 | static int |
576 | mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback) | 576 | mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback) |
577 | { | 577 | { |
578 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); | 578 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); |
579 | int err = 0; | 579 | int err = 0; |
@@ -626,6 +626,8 @@ out: | |||
626 | return err; | 626 | return err; |
627 | } | 627 | } |
628 | 628 | ||
629 | static DEF_SCSI_QCMD(mts_scsi_queuecommand) | ||
630 | |||
629 | static struct scsi_host_template mts_scsi_host_template = { | 631 | static struct scsi_host_template mts_scsi_host_template = { |
630 | .module = THIS_MODULE, | 632 | .module = THIS_MODULE, |
631 | .name = "microtekX6", | 633 | .name = "microtekX6", |
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 2f43c57743c9..9251773ecef4 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
@@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev, | |||
196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); | 196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); |
197 | } | 197 | } |
198 | 198 | ||
199 | static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, | 199 | static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); |
200 | get_port0_handler, set_port0_handler); | ||
201 | 200 | ||
202 | static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, | 201 | static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); |
203 | get_port1_handler, set_port1_handler); | ||
204 | 202 | ||
205 | 203 | ||
206 | static int cypress_probe(struct usb_interface *interface, | 204 | static int cypress_probe(struct usb_interface *interface, |
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index d77aba46ae85..f63776a48e2a 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c | |||
@@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr, | |||
86 | return count; | 86 | return count; |
87 | } | 87 | } |
88 | 88 | ||
89 | static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); | 89 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); |
90 | 90 | ||
91 | static int tv_probe(struct usb_interface *interface, | 91 | static int tv_probe(struct usb_interface *interface, |
92 | const struct usb_device_id *id) | 92 | const struct usb_device_id *id) |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 63da2c3c838f..c96f51de1696 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co | |||
94 | change_color(led); \ | 94 | change_color(led); \ |
95 | return count; \ | 95 | return count; \ |
96 | } \ | 96 | } \ |
97 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); | 97 | static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); |
98 | show_set(blue); | 98 | show_set(blue); |
99 | show_set(red); | 99 | show_set(red); |
100 | show_set(green); | 100 | show_set(green); |
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index de8ef945b536..417b8f207e8b 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c | |||
@@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \ | |||
192 | \ | 192 | \ |
193 | return count; \ | 193 | return count; \ |
194 | } \ | 194 | } \ |
195 | static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); | 195 | static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); |
196 | 196 | ||
197 | static ssize_t show_attr_text(struct device *dev, | 197 | static ssize_t show_attr_text(struct device *dev, |
198 | struct device_attribute *attr, char *buf) | 198 | struct device_attribute *attr, char *buf) |
@@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev, | |||
223 | return count; | 223 | return count; |
224 | } | 224 | } |
225 | 225 | ||
226 | static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); | 226 | static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); |
227 | 227 | ||
228 | static ssize_t show_attr_decimals(struct device *dev, | 228 | static ssize_t show_attr_decimals(struct device *dev, |
229 | struct device_attribute *attr, char *buf) | 229 | struct device_attribute *attr, char *buf) |
@@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev, | |||
272 | return count; | 272 | return count; |
273 | } | 273 | } |
274 | 274 | ||
275 | static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, | 275 | static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); |
276 | show_attr_decimals, set_attr_decimals); | ||
277 | 276 | ||
278 | static ssize_t show_attr_textmode(struct device *dev, | 277 | static ssize_t show_attr_textmode(struct device *dev, |
279 | struct device_attribute *attr, char *buf) | 278 | struct device_attribute *attr, char *buf) |
@@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev, | |||
319 | return -EINVAL; | 318 | return -EINVAL; |
320 | } | 319 | } |
321 | 320 | ||
322 | static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, | 321 | static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); |
323 | show_attr_textmode, set_attr_textmode); | ||
324 | 322 | ||
325 | 323 | ||
326 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); | 324 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); |
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index 44cb37b5a4dc..c436e1e2c3b6 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/poll.h> | 15 | #include <linux/poll.h> |
16 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
21 | 20 | ||
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c index 8ec94f15a738..e5ce42bd316e 100644 --- a/drivers/usb/mon/mon_stat.c +++ b/drivers/usb/mon/mon_stat.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/usb.h> | 12 | #include <linux/usb.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
16 | 15 | ||
17 | #include "usb_mon.h" | 16 | #include "usb_mon.h" |
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c index bdc3ea66be69..9fea48264fa2 100644 --- a/drivers/usb/otg/langwell_otg.c +++ b/drivers/usb/otg/langwell_otg.c | |||
@@ -1896,7 +1896,7 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
1896 | } | 1896 | } |
1897 | return count; | 1897 | return count; |
1898 | } | 1898 | } |
1899 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); | 1899 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); |
1900 | 1900 | ||
1901 | static ssize_t | 1901 | static ssize_t |
1902 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) | 1902 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -1942,8 +1942,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr, | |||
1942 | } | 1942 | } |
1943 | return count; | 1943 | return count; |
1944 | } | 1944 | } |
1945 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, | 1945 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, set_a_bus_drop); |
1946 | get_a_bus_drop, set_a_bus_drop); | ||
1947 | 1946 | ||
1948 | static ssize_t | 1947 | static ssize_t |
1949 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | 1948 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -1988,7 +1987,7 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, | |||
1988 | } | 1987 | } |
1989 | return count; | 1988 | return count; |
1990 | } | 1989 | } |
1991 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); | 1990 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUSR, get_b_bus_req, set_b_bus_req); |
1992 | 1991 | ||
1993 | static ssize_t | 1992 | static ssize_t |
1994 | set_a_clr_err(struct device *dev, struct device_attribute *attr, | 1993 | set_a_clr_err(struct device *dev, struct device_attribute *attr, |
@@ -2012,7 +2011,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr, | |||
2012 | } | 2011 | } |
2013 | return count; | 2012 | return count; |
2014 | } | 2013 | } |
2015 | static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); | 2014 | static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); |
2016 | 2015 | ||
2017 | static struct attribute *inputs_attrs[] = { | 2016 | static struct attribute *inputs_attrs[] = { |
2018 | &dev_attr_a_bus_req.attr, | 2017 | &dev_attr_a_bus_req.attr, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index e64da74bdcc5..861223f2af6e 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/tty.h> | 24 | #include <linux/tty.h> |
26 | #include <linux/tty_driver.h> | 25 | #include <linux/tty_driver.h> |
27 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index a688b1e686ea..689ee1fb702a 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -285,7 +285,7 @@ static int slave_configure(struct scsi_device *sdev) | |||
285 | 285 | ||
286 | /* queue a command */ | 286 | /* queue a command */ |
287 | /* This is always called with scsi_lock(host) held */ | 287 | /* This is always called with scsi_lock(host) held */ |
288 | static int queuecommand(struct scsi_cmnd *srb, | 288 | static int queuecommand_lck(struct scsi_cmnd *srb, |
289 | void (*done)(struct scsi_cmnd *)) | 289 | void (*done)(struct scsi_cmnd *)) |
290 | { | 290 | { |
291 | struct us_data *us = host_to_us(srb->device->host); | 291 | struct us_data *us = host_to_us(srb->device->host); |
@@ -315,6 +315,8 @@ static int queuecommand(struct scsi_cmnd *srb, | |||
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | static DEF_SCSI_QCMD(queuecommand) | ||
319 | |||
318 | /*********************************************************************** | 320 | /*********************************************************************** |
319 | * Error handling functions | 321 | * Error handling functions |
320 | ***********************************************************************/ | 322 | ***********************************************************************/ |
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 57fc2f532cab..ceba512f84d0 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c | |||
@@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, | |||
121 | } | 121 | } |
122 | return result; | 122 | return result; |
123 | } | 123 | } |
124 | static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); | 124 | static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL); |
125 | 125 | ||
126 | int sierra_ms_init(struct us_data *us) | 126 | int sierra_ms_init(struct us_data *us) |
127 | { | 127 | { |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index d1268191acbd..339fac3949df 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -430,7 +430,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd, | |||
430 | return 0; | 430 | return 0; |
431 | } | 431 | } |
432 | 432 | ||
433 | static int uas_queuecommand(struct scsi_cmnd *cmnd, | 433 | static int uas_queuecommand_lck(struct scsi_cmnd *cmnd, |
434 | void (*done)(struct scsi_cmnd *)) | 434 | void (*done)(struct scsi_cmnd *)) |
435 | { | 435 | { |
436 | struct scsi_device *sdev = cmnd->device; | 436 | struct scsi_device *sdev = cmnd->device; |
@@ -488,6 +488,8 @@ static int uas_queuecommand(struct scsi_cmnd *cmnd, | |||
488 | return 0; | 488 | return 0; |
489 | } | 489 | } |
490 | 490 | ||
491 | static DEF_SCSI_QCMD(uas_queuecommand) | ||
492 | |||
491 | static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) | 493 | static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) |
492 | { | 494 | { |
493 | struct scsi_device *sdev = cmnd->device; | 495 | struct scsi_device *sdev = cmnd->device; |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 54e32c513610..915448ec75bf 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <linux/ioport.h> | 47 | #include <linux/ioport.h> |
48 | #include <linux/init.h> | 48 | #include <linux/init.h> |
49 | #include <linux/screen_info.h> | 49 | #include <linux/screen_info.h> |
50 | #include <linux/smp_lock.h> | ||
51 | #include <video/vga.h> | 50 | #include <video/vga.h> |
52 | #include <asm/io.h> | 51 | #include <asm/io.h> |
53 | 52 | ||
diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c index fed2a72bc6b6..2fd7e5271be9 100644 --- a/drivers/video/omap2/vram.c +++ b/drivers/video/omap2/vram.c | |||
@@ -554,9 +554,15 @@ void __init omap_vram_reserve_sdram_memblock(void) | |||
554 | size = PAGE_ALIGN(size); | 554 | size = PAGE_ALIGN(size); |
555 | 555 | ||
556 | if (paddr) { | 556 | if (paddr) { |
557 | if ((paddr & ~PAGE_MASK) || | 557 | if (paddr & ~PAGE_MASK) { |
558 | !memblock_is_region_memory(paddr, size)) { | 558 | pr_err("VRAM start address 0x%08x not page aligned\n", |
559 | pr_err("Illegal SDRAM region for VRAM\n"); | 559 | paddr); |
560 | return; | ||
561 | } | ||
562 | |||
563 | if (!memblock_is_region_memory(paddr, size)) { | ||
564 | pr_err("Illegal SDRAM region 0x%08x..0x%08x for VRAM\n", | ||
565 | paddr, paddr + size - 1); | ||
560 | return; | 566 | return; |
561 | } | 567 | } |
562 | 568 | ||
@@ -570,9 +576,12 @@ void __init omap_vram_reserve_sdram_memblock(void) | |||
570 | return; | 576 | return; |
571 | } | 577 | } |
572 | } else { | 578 | } else { |
573 | paddr = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_REAL_LIMIT); | 579 | paddr = memblock_alloc(size, PAGE_SIZE); |
574 | } | 580 | } |
575 | 581 | ||
582 | memblock_free(paddr, size); | ||
583 | memblock_remove(paddr, size); | ||
584 | |||
576 | omap_vram_add_region(paddr, size); | 585 | omap_vram_add_region(paddr, size); |
577 | 586 | ||
578 | pr_info("Reserving %u bytes SDRAM for VRAM\n", size); | 587 | pr_info("Reserving %u bytes SDRAM for VRAM\n", size); |
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c index a0e22ac483a3..167400e2a182 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/riva/rivafb-i2c.c | |||
@@ -94,7 +94,6 @@ static int __devinit riva_setup_i2c_bus(struct riva_i2c_chan *chan, | |||
94 | 94 | ||
95 | strcpy(chan->adapter.name, name); | 95 | strcpy(chan->adapter.name, name); |
96 | chan->adapter.owner = THIS_MODULE; | 96 | chan->adapter.owner = THIS_MODULE; |
97 | chan->adapter.id = I2C_HW_B_RIVA; | ||
98 | chan->adapter.class = i2c_class; | 97 | chan->adapter.class = i2c_class; |
99 | chan->adapter.algo_data = &chan->algo; | 98 | chan->adapter.algo_data = &chan->algo; |
100 | chan->adapter.dev.parent = &chan->par->pdev->dev; | 99 | chan->adapter.dev.parent = &chan->par->pdev->dev; |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 55b3077ff6ff..d7df10315d8d 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1071,6 +1071,10 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1071 | if (!hdmi->info) | 1071 | if (!hdmi->info) |
1072 | goto out; | 1072 | goto out; |
1073 | 1073 | ||
1074 | hdmi->monspec.modedb_len = 0; | ||
1075 | fb_destroy_modedb(hdmi->monspec.modedb); | ||
1076 | hdmi->monspec.modedb = NULL; | ||
1077 | |||
1074 | acquire_console_sem(); | 1078 | acquire_console_sem(); |
1075 | 1079 | ||
1076 | /* HDMI disconnect */ | 1080 | /* HDMI disconnect */ |
@@ -1078,7 +1082,6 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1078 | 1082 | ||
1079 | release_console_sem(); | 1083 | release_console_sem(); |
1080 | pm_runtime_put(hdmi->dev); | 1084 | pm_runtime_put(hdmi->dev); |
1081 | fb_destroy_modedb(hdmi->monspec.modedb); | ||
1082 | } | 1085 | } |
1083 | 1086 | ||
1084 | out: | 1087 | out: |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 50963739a409..9b1364723c65 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -115,15 +115,16 @@ static const struct fb_videomode default_720p = { | |||
115 | .xres = 1280, | 115 | .xres = 1280, |
116 | .yres = 720, | 116 | .yres = 720, |
117 | 117 | ||
118 | .left_margin = 200, | 118 | .left_margin = 220, |
119 | .right_margin = 88, | 119 | .right_margin = 110, |
120 | .hsync_len = 48, | 120 | .hsync_len = 40, |
121 | 121 | ||
122 | .upper_margin = 20, | 122 | .upper_margin = 20, |
123 | .lower_margin = 5, | 123 | .lower_margin = 5, |
124 | .vsync_len = 5, | 124 | .vsync_len = 5, |
125 | 125 | ||
126 | .pixclock = 13468, | 126 | .pixclock = 13468, |
127 | .refresh = 60, | ||
127 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, | 128 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, |
128 | }; | 129 | }; |
129 | 130 | ||
@@ -1197,6 +1198,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1197 | const struct fb_videomode *mode = cfg->lcd_cfg; | 1198 | const struct fb_videomode *mode = cfg->lcd_cfg; |
1198 | unsigned long max_size = 0; | 1199 | unsigned long max_size = 0; |
1199 | int k; | 1200 | int k; |
1201 | int num_cfg; | ||
1200 | 1202 | ||
1201 | ch->info = framebuffer_alloc(0, &pdev->dev); | 1203 | ch->info = framebuffer_alloc(0, &pdev->dev); |
1202 | if (!ch->info) { | 1204 | if (!ch->info) { |
@@ -1232,8 +1234,14 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1232 | info->fix = sh_mobile_lcdc_fix; | 1234 | info->fix = sh_mobile_lcdc_fix; |
1233 | info->fix.smem_len = max_size * (cfg->bpp / 8) * 2; | 1235 | info->fix.smem_len = max_size * (cfg->bpp / 8) * 2; |
1234 | 1236 | ||
1235 | if (!mode) | 1237 | if (!mode) { |
1236 | mode = &default_720p; | 1238 | mode = &default_720p; |
1239 | num_cfg = 1; | ||
1240 | } else { | ||
1241 | num_cfg = ch->cfg.num_cfg; | ||
1242 | } | ||
1243 | |||
1244 | fb_videomode_to_modelist(mode, num_cfg, &info->modelist); | ||
1237 | 1245 | ||
1238 | fb_videomode_to_var(var, mode); | 1246 | fb_videomode_to_var(var, mode); |
1239 | /* Default Y virtual resolution is 2x panel size */ | 1247 | /* Default Y virtual resolution is 2x panel size */ |
@@ -1281,10 +1289,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1281 | 1289 | ||
1282 | for (i = 0; i < j; i++) { | 1290 | for (i = 0; i < j; i++) { |
1283 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; | 1291 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; |
1284 | const struct fb_videomode *mode = ch->cfg.lcd_cfg; | ||
1285 | |||
1286 | if (!mode) | ||
1287 | mode = &default_720p; | ||
1288 | 1292 | ||
1289 | info = ch->info; | 1293 | info = ch->info; |
1290 | 1294 | ||
@@ -1297,7 +1301,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1297 | } | 1301 | } |
1298 | } | 1302 | } |
1299 | 1303 | ||
1300 | fb_videomode_to_modelist(mode, ch->cfg.num_cfg, &info->modelist); | ||
1301 | error = register_framebuffer(info); | 1304 | error = register_framebuffer(info); |
1302 | if (error < 0) | 1305 | if (error < 0) |
1303 | goto err1; | 1306 | goto err1; |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index b52f8e4ef1fd..3dde12b0ab06 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -4181,6 +4181,9 @@ static void __devinit | |||
4181 | sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize, | 4181 | sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize, |
4182 | unsigned int min) | 4182 | unsigned int min) |
4183 | { | 4183 | { |
4184 | if (*mapsize < (min << 20)) | ||
4185 | return; | ||
4186 | |||
4184 | ivideo->video_vbase = ioremap(ivideo->video_base, (*mapsize)); | 4187 | ivideo->video_vbase = ioremap(ivideo->video_base, (*mapsize)); |
4185 | 4188 | ||
4186 | if(!ivideo->video_vbase) { | 4189 | if(!ivideo->video_vbase) { |
@@ -4514,7 +4517,7 @@ sisfb_post_sis300(struct pci_dev *pdev) | |||
4514 | } else { | 4517 | } else { |
4515 | #endif | 4518 | #endif |
4516 | /* Need to map max FB size for finding out about RAM size */ | 4519 | /* Need to map max FB size for finding out about RAM size */ |
4517 | mapsize = 64 << 20; | 4520 | mapsize = ivideo->video_size; |
4518 | sisfb_post_map_vram(ivideo, &mapsize, 4); | 4521 | sisfb_post_map_vram(ivideo, &mapsize, 4); |
4519 | 4522 | ||
4520 | if(ivideo->video_vbase) { | 4523 | if(ivideo->video_vbase) { |
@@ -4680,7 +4683,7 @@ sisfb_post_xgi_ramsize(struct sis_video_info *ivideo) | |||
4680 | orSISIDXREG(SISSR, 0x20, (0x80 | 0x04)); | 4683 | orSISIDXREG(SISSR, 0x20, (0x80 | 0x04)); |
4681 | 4684 | ||
4682 | /* Need to map max FB size for finding out about RAM size */ | 4685 | /* Need to map max FB size for finding out about RAM size */ |
4683 | mapsize = 256 << 20; | 4686 | mapsize = ivideo->video_size; |
4684 | sisfb_post_map_vram(ivideo, &mapsize, 32); | 4687 | sisfb_post_map_vram(ivideo, &mapsize, 32); |
4685 | 4688 | ||
4686 | if(!ivideo->video_vbase) { | 4689 | if(!ivideo->video_vbase) { |
@@ -5936,6 +5939,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5936 | } | 5939 | } |
5937 | 5940 | ||
5938 | ivideo->video_base = pci_resource_start(pdev, 0); | 5941 | ivideo->video_base = pci_resource_start(pdev, 0); |
5942 | ivideo->video_size = pci_resource_len(pdev, 0); | ||
5939 | ivideo->mmio_base = pci_resource_start(pdev, 1); | 5943 | ivideo->mmio_base = pci_resource_start(pdev, 1); |
5940 | ivideo->mmio_size = pci_resource_len(pdev, 1); | 5944 | ivideo->mmio_size = pci_resource_len(pdev, 1); |
5941 | ivideo->SiS_Pr.RelIO = pci_resource_start(pdev, 2) + 0x30; | 5945 | ivideo->SiS_Pr.RelIO = pci_resource_start(pdev, 2) + 0x30; |
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c index f80be7f6eb95..0f5d4162b22d 100644 --- a/drivers/xen/xenfs/privcmd.c +++ b/drivers/xen/xenfs/privcmd.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/mman.h> | 15 | #include <linux/mman.h> |
16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
20 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
21 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index cafc50454292..e0c84725d3e9 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
18 | #include <asm/amigahw.h> | 17 | #include <asm/amigahw.h> |
19 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |