diff options
author | Jiri Kosina <jkosina@suse.cz> | 2008-06-04 04:26:59 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-06-04 04:26:59 -0400 |
commit | f38bb7de289f5c15e287386d35e9c325f1062c49 (patch) | |
tree | 38e69a9ecea18243e3f66bcf51bc89cd7b8f0c94 /drivers | |
parent | 2d4b3f37ded8998a362c8d0b4be02f583dd9a002 (diff) | |
parent | c3b25b32e8bef526cca748e1ba023c6bdd705a99 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers')
267 files changed, 5650 insertions, 1648 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index e48a3ea03117..2509809a36cf 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -565,7 +565,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
565 | 565 | ||
566 | acpi_os_release_mutex(method_desc->method. | 566 | acpi_os_release_mutex(method_desc->method. |
567 | mutex->mutex.os_mutex); | 567 | mutex->mutex.os_mutex); |
568 | method_desc->method.mutex->mutex.thread_id = 0; | 568 | method_desc->method.mutex->mutex.thread_id = NULL; |
569 | } | 569 | } |
570 | } | 570 | } |
571 | 571 | ||
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index c873ab40cd0e..a8bf3d713e28 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -326,7 +326,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | |||
326 | 326 | ||
327 | /* Clear mutex info */ | 327 | /* Clear mutex info */ |
328 | 328 | ||
329 | obj_desc->mutex.thread_id = 0; | 329 | obj_desc->mutex.thread_id = NULL; |
330 | return_ACPI_STATUS(status); | 330 | return_ACPI_STATUS(status); |
331 | } | 331 | } |
332 | 332 | ||
@@ -463,7 +463,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
463 | /* Mark mutex unowned */ | 463 | /* Mark mutex unowned */ |
464 | 464 | ||
465 | obj_desc->mutex.owner_thread = NULL; | 465 | obj_desc->mutex.owner_thread = NULL; |
466 | obj_desc->mutex.thread_id = 0; | 466 | obj_desc->mutex.thread_id = NULL; |
467 | 467 | ||
468 | /* Update Thread sync_level (Last mutex is the important one) */ | 468 | /* Update Thread sync_level (Last mutex is the important one) */ |
469 | 469 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 97f83fb2ee2e..544b7d6c617c 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -502,10 +502,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
502 | { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ | 502 | { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ |
503 | { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ | 503 | { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ |
504 | { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ | 504 | { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ |
505 | { PCI_VDEVICE(NVIDIA, 0x0bd0), board_ahci }, /* MCP7B */ | 505 | { PCI_VDEVICE(NVIDIA, 0x0bc4), board_ahci }, /* MCP7B */ |
506 | { PCI_VDEVICE(NVIDIA, 0x0bd1), board_ahci }, /* MCP7B */ | 506 | { PCI_VDEVICE(NVIDIA, 0x0bc5), board_ahci }, /* MCP7B */ |
507 | { PCI_VDEVICE(NVIDIA, 0x0bd2), board_ahci }, /* MCP7B */ | 507 | { PCI_VDEVICE(NVIDIA, 0x0bc6), board_ahci }, /* MCP7B */ |
508 | { PCI_VDEVICE(NVIDIA, 0x0bd3), board_ahci }, /* MCP7B */ | 508 | { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ |
509 | 509 | ||
510 | /* SiS */ | 510 | /* SiS */ |
511 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ | 511 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index a9027b8fbdd5..3548ee7014ca 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -247,10 +247,11 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
247 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 247 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
248 | /* SATA Controller 2 IDE (ICH8) */ | 248 | /* SATA Controller 2 IDE (ICH8) */ |
249 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 249 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
250 | /* Mobile SATA Controller IDE (ICH8M) */ | ||
251 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
252 | /* Mobile SATA Controller IDE (ICH8M), Apple */ | 250 | /* Mobile SATA Controller IDE (ICH8M), Apple */ |
253 | { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata }, | 251 | { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata }, |
252 | { 0x8086, 0x2828, 0x106b, 0x00a1, 0, 0, ich8m_apple_sata }, | ||
253 | /* Mobile SATA Controller IDE (ICH8M) */ | ||
254 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
254 | /* SATA Controller IDE (ICH9) */ | 255 | /* SATA Controller IDE (ICH9) */ |
255 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 256 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
256 | /* SATA Controller IDE (ICH9) */ | 257 | /* SATA Controller IDE (ICH9) */ |
@@ -526,7 +527,7 @@ static struct ata_port_info piix_port_info[] = { | |||
526 | 527 | ||
527 | [ich8m_apple_sata] = | 528 | [ich8m_apple_sata] = |
528 | { | 529 | { |
529 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR, | 530 | .flags = PIIX_SATA_FLAGS, |
530 | .pio_mask = 0x1f, /* pio0-4 */ | 531 | .pio_mask = 0x1f, /* pio0-4 */ |
531 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 532 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
532 | .udma_mask = ATA_UDMA6, | 533 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3c89f205c83f..cc816ca623d3 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -5403,7 +5403,7 @@ static void ata_host_stop(struct device *gendev, void *res) | |||
5403 | */ | 5403 | */ |
5404 | static void ata_finalize_port_ops(struct ata_port_operations *ops) | 5404 | static void ata_finalize_port_ops(struct ata_port_operations *ops) |
5405 | { | 5405 | { |
5406 | static spinlock_t lock = SPIN_LOCK_UNLOCKED; | 5406 | static DEFINE_SPINLOCK(lock); |
5407 | const struct ata_port_operations *cur; | 5407 | const struct ata_port_operations *cur; |
5408 | void **begin = (void **)ops; | 5408 | void **begin = (void **)ops; |
5409 | void **end = (void **)&ops->inherits; | 5409 | void **end = (void **)&ops->inherits; |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 0f9386d4a5a0..7daf4c0f6216 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -322,9 +322,12 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
322 | if (vendor == 0x1095 && devid == 0x3726) { | 322 | if (vendor == 0x1095 && devid == 0x3726) { |
323 | /* sil3726 quirks */ | 323 | /* sil3726 quirks */ |
324 | ata_port_for_each_link(link, ap) { | 324 | ata_port_for_each_link(link, ap) { |
325 | /* class code report is unreliable */ | 325 | /* Class code report is unreliable and SRST |
326 | * times out under certain configurations. | ||
327 | */ | ||
326 | if (link->pmp < 5) | 328 | if (link->pmp < 5) |
327 | link->flags |= ATA_LFLAG_ASSUME_ATA; | 329 | link->flags |= ATA_LFLAG_NO_SRST | |
330 | ATA_LFLAG_ASSUME_ATA; | ||
328 | 331 | ||
329 | /* port 5 is for SEMB device and it doesn't like SRST */ | 332 | /* port 5 is for SEMB device and it doesn't like SRST */ |
330 | if (link->pmp == 5) | 333 | if (link->pmp == 5) |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index aeb6e01d82ce..2e6e1622dc6d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1637,6 +1637,7 @@ defer: | |||
1637 | 1637 | ||
1638 | /** | 1638 | /** |
1639 | * ata_scsi_rbuf_get - Map response buffer. | 1639 | * ata_scsi_rbuf_get - Map response buffer. |
1640 | * @cmd: SCSI command containing buffer to be mapped. | ||
1640 | * @flags: unsigned long variable to store irq enable status | 1641 | * @flags: unsigned long variable to store irq enable status |
1641 | * @copy_in: copy in from user buffer | 1642 | * @copy_in: copy in from user buffer |
1642 | * | 1643 | * |
@@ -1954,7 +1955,7 @@ static unsigned int ata_msense_ctl_mode(u8 *buf) | |||
1954 | 1955 | ||
1955 | /** | 1956 | /** |
1956 | * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page | 1957 | * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page |
1957 | * @bufp: output buffer | 1958 | * @buf: output buffer |
1958 | * | 1959 | * |
1959 | * Generate a generic MODE SENSE r/w error recovery page. | 1960 | * Generate a generic MODE SENSE r/w error recovery page. |
1960 | * | 1961 | * |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 853559e32315..3924e7209a44 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -34,7 +34,7 @@ enum { | |||
34 | 34 | ||
35 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 35 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
36 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 36 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
37 | ATA_FLAG_NCQ), | 37 | ATA_FLAG_PMP | ATA_FLAG_NCQ), |
38 | 38 | ||
39 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, | 39 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, |
40 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ | 40 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ |
@@ -395,7 +395,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) | |||
395 | cd = (struct command_desc *)pp->cmdentry + tag; | 395 | cd = (struct command_desc *)pp->cmdentry + tag; |
396 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; | 396 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; |
397 | 397 | ||
398 | ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis); | 398 | ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *) &cd->cfis); |
399 | 399 | ||
400 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", | 400 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", |
401 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); | 401 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); |
@@ -438,6 +438,8 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc) | |||
438 | ioread32(CA + hcr_base), | 438 | ioread32(CA + hcr_base), |
439 | ioread32(CE + hcr_base), ioread32(CC + hcr_base)); | 439 | ioread32(CE + hcr_base), ioread32(CC + hcr_base)); |
440 | 440 | ||
441 | iowrite32(qc->dev->link->pmp, CQPMP + hcr_base); | ||
442 | |||
441 | /* Simply queue command to the controller/device */ | 443 | /* Simply queue command to the controller/device */ |
442 | iowrite32(1 << tag, CQ + hcr_base); | 444 | iowrite32(1 << tag, CQ + hcr_base); |
443 | 445 | ||
@@ -558,11 +560,36 @@ static void sata_fsl_thaw(struct ata_port *ap) | |||
558 | ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS)); | 560 | ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS)); |
559 | } | 561 | } |
560 | 562 | ||
563 | static void sata_fsl_pmp_attach(struct ata_port *ap) | ||
564 | { | ||
565 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | ||
566 | void __iomem *hcr_base = host_priv->hcr_base; | ||
567 | u32 temp; | ||
568 | |||
569 | temp = ioread32(hcr_base + HCONTROL); | ||
570 | iowrite32((temp | HCONTROL_PMP_ATTACHED), hcr_base + HCONTROL); | ||
571 | } | ||
572 | |||
573 | static void sata_fsl_pmp_detach(struct ata_port *ap) | ||
574 | { | ||
575 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | ||
576 | void __iomem *hcr_base = host_priv->hcr_base; | ||
577 | u32 temp; | ||
578 | |||
579 | temp = ioread32(hcr_base + HCONTROL); | ||
580 | temp &= ~HCONTROL_PMP_ATTACHED; | ||
581 | iowrite32(temp, hcr_base + HCONTROL); | ||
582 | |||
583 | /* enable interrupts on the controller/port */ | ||
584 | temp = ioread32(hcr_base + HCONTROL); | ||
585 | iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL); | ||
586 | |||
587 | } | ||
588 | |||
561 | static int sata_fsl_port_start(struct ata_port *ap) | 589 | static int sata_fsl_port_start(struct ata_port *ap) |
562 | { | 590 | { |
563 | struct device *dev = ap->host->dev; | 591 | struct device *dev = ap->host->dev; |
564 | struct sata_fsl_port_priv *pp; | 592 | struct sata_fsl_port_priv *pp; |
565 | int retval; | ||
566 | void *mem; | 593 | void *mem; |
567 | dma_addr_t mem_dma; | 594 | dma_addr_t mem_dma; |
568 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 595 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
@@ -688,12 +715,13 @@ static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline) | |||
688 | } | 715 | } |
689 | 716 | ||
690 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, | 717 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, |
691 | unsigned long deadline) | 718 | unsigned long deadline) |
692 | { | 719 | { |
693 | struct ata_port *ap = link->ap; | 720 | struct ata_port *ap = link->ap; |
694 | struct sata_fsl_port_priv *pp = ap->private_data; | 721 | struct sata_fsl_port_priv *pp = ap->private_data; |
695 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 722 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
696 | void __iomem *hcr_base = host_priv->hcr_base; | 723 | void __iomem *hcr_base = host_priv->hcr_base; |
724 | int pmp = sata_srst_pmp(link); | ||
697 | u32 temp; | 725 | u32 temp; |
698 | struct ata_taskfile tf; | 726 | struct ata_taskfile tf; |
699 | u8 *cfis; | 727 | u8 *cfis; |
@@ -703,6 +731,9 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, | |||
703 | 731 | ||
704 | DPRINTK("in xx_softreset\n"); | 732 | DPRINTK("in xx_softreset\n"); |
705 | 733 | ||
734 | if (pmp != SATA_PMP_CTRL_PORT) | ||
735 | goto issue_srst; | ||
736 | |||
706 | try_offline_again: | 737 | try_offline_again: |
707 | /* | 738 | /* |
708 | * Force host controller to go off-line, aborting current operations | 739 | * Force host controller to go off-line, aborting current operations |
@@ -746,6 +777,7 @@ try_offline_again: | |||
746 | 777 | ||
747 | temp = ioread32(hcr_base + HCONTROL); | 778 | temp = ioread32(hcr_base + HCONTROL); |
748 | temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE); | 779 | temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE); |
780 | temp |= HCONTROL_PMP_ATTACHED; | ||
749 | iowrite32(temp, hcr_base + HCONTROL); | 781 | iowrite32(temp, hcr_base + HCONTROL); |
750 | 782 | ||
751 | temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500); | 783 | temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500); |
@@ -771,7 +803,8 @@ try_offline_again: | |||
771 | ata_port_printk(ap, KERN_WARNING, | 803 | ata_port_printk(ap, KERN_WARNING, |
772 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", | 804 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", |
773 | ioread32(hcr_base + HSTATUS)); | 805 | ioread32(hcr_base + HSTATUS)); |
774 | goto err; | 806 | *class = ATA_DEV_NONE; |
807 | goto out; | ||
775 | } | 808 | } |
776 | 809 | ||
777 | /* | 810 | /* |
@@ -783,7 +816,8 @@ try_offline_again: | |||
783 | 816 | ||
784 | if ((temp & 0xFF) != 0x18) { | 817 | if ((temp & 0xFF) != 0x18) { |
785 | ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); | 818 | ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); |
786 | goto err; | 819 | *class = ATA_DEV_NONE; |
820 | goto out; | ||
787 | } else { | 821 | } else { |
788 | ata_port_printk(ap, KERN_INFO, | 822 | ata_port_printk(ap, KERN_INFO, |
789 | "Signature Update detected @ %d msecs\n", | 823 | "Signature Update detected @ %d msecs\n", |
@@ -798,6 +832,7 @@ try_offline_again: | |||
798 | * reached here, we can send a command to the target device | 832 | * reached here, we can send a command to the target device |
799 | */ | 833 | */ |
800 | 834 | ||
835 | issue_srst: | ||
801 | DPRINTK("Sending SRST/device reset\n"); | 836 | DPRINTK("Sending SRST/device reset\n"); |
802 | 837 | ||
803 | ata_tf_init(link->device, &tf); | 838 | ata_tf_init(link->device, &tf); |
@@ -808,7 +843,7 @@ try_offline_again: | |||
808 | SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); | 843 | SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); |
809 | 844 | ||
810 | tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ | 845 | tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ |
811 | ata_tf_to_fis(&tf, 0, 0, cfis); | 846 | ata_tf_to_fis(&tf, pmp, 0, cfis); |
812 | 847 | ||
813 | DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n", | 848 | DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n", |
814 | cfis[0], cfis[1], cfis[2], cfis[3]); | 849 | cfis[0], cfis[1], cfis[2], cfis[3]); |
@@ -854,8 +889,10 @@ try_offline_again: | |||
854 | sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); | 889 | sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); |
855 | 890 | ||
856 | tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ | 891 | tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ |
857 | ata_tf_to_fis(&tf, 0, 0, cfis); | 892 | ata_tf_to_fis(&tf, pmp, 0, cfis); |
858 | 893 | ||
894 | if (pmp != SATA_PMP_CTRL_PORT) | ||
895 | iowrite32(pmp, CQPMP + hcr_base); | ||
859 | iowrite32(1, CQ + hcr_base); | 896 | iowrite32(1, CQ + hcr_base); |
860 | msleep(150); /* ?? */ | 897 | msleep(150); /* ?? */ |
861 | 898 | ||
@@ -886,12 +923,21 @@ try_offline_again: | |||
886 | VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); | 923 | VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); |
887 | } | 924 | } |
888 | 925 | ||
926 | out: | ||
889 | return 0; | 927 | return 0; |
890 | 928 | ||
891 | err: | 929 | err: |
892 | return -EIO; | 930 | return -EIO; |
893 | } | 931 | } |
894 | 932 | ||
933 | static void sata_fsl_error_handler(struct ata_port *ap) | ||
934 | { | ||
935 | |||
936 | DPRINTK("in xx_error_handler\n"); | ||
937 | sata_pmp_error_handler(ap); | ||
938 | |||
939 | } | ||
940 | |||
895 | static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) | 941 | static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) |
896 | { | 942 | { |
897 | if (qc->flags & ATA_QCFLAG_FAILED) | 943 | if (qc->flags & ATA_QCFLAG_FAILED) |
@@ -905,18 +951,21 @@ static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) | |||
905 | 951 | ||
906 | static void sata_fsl_error_intr(struct ata_port *ap) | 952 | static void sata_fsl_error_intr(struct ata_port *ap) |
907 | { | 953 | { |
908 | struct ata_link *link = &ap->link; | ||
909 | struct ata_eh_info *ehi = &link->eh_info; | ||
910 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 954 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
911 | void __iomem *hcr_base = host_priv->hcr_base; | 955 | void __iomem *hcr_base = host_priv->hcr_base; |
912 | u32 hstatus, dereg, cereg = 0, SError = 0; | 956 | u32 hstatus, dereg=0, cereg = 0, SError = 0; |
913 | unsigned int err_mask = 0, action = 0; | 957 | unsigned int err_mask = 0, action = 0; |
914 | struct ata_queued_cmd *qc; | 958 | int freeze = 0, abort=0; |
915 | int freeze = 0; | 959 | struct ata_link *link = NULL; |
960 | struct ata_queued_cmd *qc = NULL; | ||
961 | struct ata_eh_info *ehi; | ||
916 | 962 | ||
917 | hstatus = ioread32(hcr_base + HSTATUS); | 963 | hstatus = ioread32(hcr_base + HSTATUS); |
918 | cereg = ioread32(hcr_base + CE); | 964 | cereg = ioread32(hcr_base + CE); |
919 | 965 | ||
966 | /* first, analyze and record host port events */ | ||
967 | link = &ap->link; | ||
968 | ehi = &link->eh_info; | ||
920 | ata_ehi_clear_desc(ehi); | 969 | ata_ehi_clear_desc(ehi); |
921 | 970 | ||
922 | /* | 971 | /* |
@@ -926,42 +975,28 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
926 | sata_fsl_scr_read(ap, SCR_ERROR, &SError); | 975 | sata_fsl_scr_read(ap, SCR_ERROR, &SError); |
927 | if (unlikely(SError & 0xFFFF0000)) { | 976 | if (unlikely(SError & 0xFFFF0000)) { |
928 | sata_fsl_scr_write(ap, SCR_ERROR, SError); | 977 | sata_fsl_scr_write(ap, SCR_ERROR, SError); |
929 | err_mask |= AC_ERR_ATA_BUS; | ||
930 | } | 978 | } |
931 | 979 | ||
932 | DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", | 980 | DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", |
933 | hstatus, cereg, ioread32(hcr_base + DE), SError); | 981 | hstatus, cereg, ioread32(hcr_base + DE), SError); |
934 | 982 | ||
935 | /* handle single device errors */ | 983 | /* handle fatal errors */ |
936 | if (cereg) { | 984 | if (hstatus & FATAL_ERROR_DECODE) { |
937 | /* | 985 | ehi->err_mask |= AC_ERR_ATA_BUS; |
938 | * clear the command error, also clears queue to the device | 986 | ehi->action |= ATA_EH_SOFTRESET; |
939 | * in error, and we can (re)issue commands to this device. | ||
940 | * When a device is in error all commands queued into the | ||
941 | * host controller and at the device are considered aborted | ||
942 | * and the queue for that device is stopped. Now, after | ||
943 | * clearing the device error, we can issue commands to the | ||
944 | * device to interrogate it to find the source of the error. | ||
945 | */ | ||
946 | dereg = ioread32(hcr_base + DE); | ||
947 | iowrite32(dereg, hcr_base + DE); | ||
948 | iowrite32(cereg, hcr_base + CE); | ||
949 | 987 | ||
950 | DPRINTK("single device error, CE=0x%x, DE=0x%x\n", | ||
951 | ioread32(hcr_base + CE), ioread32(hcr_base + DE)); | ||
952 | /* | 988 | /* |
953 | * We should consider this as non fatal error, and TF must | 989 | * Ignore serror in case of fatal errors as we always want |
954 | * be updated as done below. | 990 | * to do a soft-reset of the FSL SATA controller. Analyzing |
991 | * serror may cause libata to schedule a hard-reset action, | ||
992 | * and hard-reset currently does not do controller | ||
993 | * offline/online, causing command timeouts and leads to an | ||
994 | * un-recoverable state, hence make libATA ignore | ||
995 | * autopsy in case of fatal errors. | ||
955 | */ | 996 | */ |
956 | 997 | ||
957 | err_mask |= AC_ERR_DEV; | 998 | ehi->flags |= ATA_EHI_NO_AUTOPSY; |
958 | } | ||
959 | 999 | ||
960 | /* handle fatal errors */ | ||
961 | if (hstatus & FATAL_ERROR_DECODE) { | ||
962 | err_mask |= AC_ERR_ATA_BUS; | ||
963 | action |= ATA_EH_RESET; | ||
964 | /* how will fatal error interrupts be completed ?? */ | ||
965 | freeze = 1; | 1000 | freeze = 1; |
966 | } | 1001 | } |
967 | 1002 | ||
@@ -971,30 +1006,83 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
971 | 1006 | ||
972 | /* Setup a soft-reset EH action */ | 1007 | /* Setup a soft-reset EH action */ |
973 | ata_ehi_hotplugged(ehi); | 1008 | ata_ehi_hotplugged(ehi); |
1009 | ata_ehi_push_desc(ehi, "%s", "PHY RDY changed"); | ||
974 | freeze = 1; | 1010 | freeze = 1; |
975 | } | 1011 | } |
976 | 1012 | ||
977 | /* record error info */ | 1013 | /* handle single device errors */ |
978 | qc = ata_qc_from_tag(ap, link->active_tag); | 1014 | if (cereg) { |
1015 | /* | ||
1016 | * clear the command error, also clears queue to the device | ||
1017 | * in error, and we can (re)issue commands to this device. | ||
1018 | * When a device is in error all commands queued into the | ||
1019 | * host controller and at the device are considered aborted | ||
1020 | * and the queue for that device is stopped. Now, after | ||
1021 | * clearing the device error, we can issue commands to the | ||
1022 | * device to interrogate it to find the source of the error. | ||
1023 | */ | ||
1024 | abort = 1; | ||
1025 | |||
1026 | DPRINTK("single device error, CE=0x%x, DE=0x%x\n", | ||
1027 | ioread32(hcr_base + CE), ioread32(hcr_base + DE)); | ||
979 | 1028 | ||
980 | if (qc) | 1029 | /* find out the offending link and qc */ |
1030 | if (ap->nr_pmp_links) { | ||
1031 | dereg = ioread32(hcr_base + DE); | ||
1032 | iowrite32(dereg, hcr_base + DE); | ||
1033 | iowrite32(cereg, hcr_base + CE); | ||
1034 | |||
1035 | if (dereg < ap->nr_pmp_links) { | ||
1036 | link = &ap->pmp_link[dereg]; | ||
1037 | ehi = &link->eh_info; | ||
1038 | qc = ata_qc_from_tag(ap, link->active_tag); | ||
1039 | /* | ||
1040 | * We should consider this as non fatal error, | ||
1041 | * and TF must be updated as done below. | ||
1042 | */ | ||
1043 | |||
1044 | err_mask |= AC_ERR_DEV; | ||
1045 | |||
1046 | } else { | ||
1047 | err_mask |= AC_ERR_HSM; | ||
1048 | action |= ATA_EH_HARDRESET; | ||
1049 | freeze = 1; | ||
1050 | } | ||
1051 | } else { | ||
1052 | dereg = ioread32(hcr_base + DE); | ||
1053 | iowrite32(dereg, hcr_base + DE); | ||
1054 | iowrite32(cereg, hcr_base + CE); | ||
1055 | |||
1056 | qc = ata_qc_from_tag(ap, link->active_tag); | ||
1057 | /* | ||
1058 | * We should consider this as non fatal error, | ||
1059 | * and TF must be updated as done below. | ||
1060 | */ | ||
1061 | err_mask |= AC_ERR_DEV; | ||
1062 | } | ||
1063 | } | ||
1064 | |||
1065 | /* record error info */ | ||
1066 | if (qc) { | ||
981 | qc->err_mask |= err_mask; | 1067 | qc->err_mask |= err_mask; |
982 | else | 1068 | } else |
983 | ehi->err_mask |= err_mask; | 1069 | ehi->err_mask |= err_mask; |
984 | 1070 | ||
985 | ehi->action |= action; | 1071 | ehi->action |= action; |
986 | ehi->serror |= SError; | ||
987 | 1072 | ||
988 | /* freeze or abort */ | 1073 | /* freeze or abort */ |
989 | if (freeze) | 1074 | if (freeze) |
990 | ata_port_freeze(ap); | 1075 | ata_port_freeze(ap); |
991 | else | 1076 | else if (abort) { |
992 | ata_port_abort(ap); | 1077 | if (qc) |
1078 | ata_link_abort(qc->dev->link); | ||
1079 | else | ||
1080 | ata_port_abort(ap); | ||
1081 | } | ||
993 | } | 1082 | } |
994 | 1083 | ||
995 | static void sata_fsl_host_intr(struct ata_port *ap) | 1084 | static void sata_fsl_host_intr(struct ata_port *ap) |
996 | { | 1085 | { |
997 | struct ata_link *link = &ap->link; | ||
998 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 1086 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
999 | void __iomem *hcr_base = host_priv->hcr_base; | 1087 | void __iomem *hcr_base = host_priv->hcr_base; |
1000 | u32 hstatus, qc_active = 0; | 1088 | u32 hstatus, qc_active = 0; |
@@ -1017,10 +1105,19 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1017 | return; | 1105 | return; |
1018 | } | 1106 | } |
1019 | 1107 | ||
1020 | if (link->sactive) { /* only true for NCQ commands */ | 1108 | /* Read command completed register */ |
1109 | qc_active = ioread32(hcr_base + CC); | ||
1110 | |||
1111 | VPRINTK("Status of all queues :\n"); | ||
1112 | VPRINTK("qc_active/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%x\n", | ||
1113 | qc_active, | ||
1114 | ioread32(hcr_base + CA), | ||
1115 | ioread32(hcr_base + CE), | ||
1116 | ioread32(hcr_base + CQ), | ||
1117 | ap->qc_active); | ||
1118 | |||
1119 | if (qc_active & ap->qc_active) { | ||
1021 | int i; | 1120 | int i; |
1022 | /* Read command completed register */ | ||
1023 | qc_active = ioread32(hcr_base + CC); | ||
1024 | /* clear CC bit, this will also complete the interrupt */ | 1121 | /* clear CC bit, this will also complete the interrupt */ |
1025 | iowrite32(qc_active, hcr_base + CC); | 1122 | iowrite32(qc_active, hcr_base + CC); |
1026 | 1123 | ||
@@ -1032,8 +1129,9 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1032 | for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) { | 1129 | for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) { |
1033 | if (qc_active & (1 << i)) { | 1130 | if (qc_active & (1 << i)) { |
1034 | qc = ata_qc_from_tag(ap, i); | 1131 | qc = ata_qc_from_tag(ap, i); |
1035 | if (qc) | 1132 | if (qc) { |
1036 | ata_qc_complete(qc); | 1133 | ata_qc_complete(qc); |
1134 | } | ||
1037 | DPRINTK | 1135 | DPRINTK |
1038 | ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n", | 1136 | ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n", |
1039 | i, ioread32(hcr_base + CC), | 1137 | i, ioread32(hcr_base + CC), |
@@ -1042,19 +1140,21 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1042 | } | 1140 | } |
1043 | return; | 1141 | return; |
1044 | 1142 | ||
1045 | } else if (ap->qc_active) { | 1143 | } else if ((ap->qc_active & (1 << ATA_TAG_INTERNAL))) { |
1046 | iowrite32(1, hcr_base + CC); | 1144 | iowrite32(1, hcr_base + CC); |
1047 | qc = ata_qc_from_tag(ap, link->active_tag); | 1145 | qc = ata_qc_from_tag(ap, ATA_TAG_INTERNAL); |
1048 | 1146 | ||
1049 | DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", | 1147 | DPRINTK("completing non-ncq cmd, CC=0x%x\n", |
1050 | link->active_tag, ioread32(hcr_base + CC)); | 1148 | ioread32(hcr_base + CC)); |
1051 | 1149 | ||
1052 | if (qc) | 1150 | if (qc) { |
1053 | ata_qc_complete(qc); | 1151 | ata_qc_complete(qc); |
1152 | } | ||
1054 | } else { | 1153 | } else { |
1055 | /* Spurious Interrupt!! */ | 1154 | /* Spurious Interrupt!! */ |
1056 | DPRINTK("spurious interrupt!!, CC = 0x%x\n", | 1155 | DPRINTK("spurious interrupt!!, CC = 0x%x\n", |
1057 | ioread32(hcr_base + CC)); | 1156 | ioread32(hcr_base + CC)); |
1157 | iowrite32(qc_active, hcr_base + CC); | ||
1058 | return; | 1158 | return; |
1059 | } | 1159 | } |
1060 | } | 1160 | } |
@@ -1130,9 +1230,6 @@ static int sata_fsl_init_controller(struct ata_host *host) | |||
1130 | iowrite32(0x00000FFFF, hcr_base + CE); | 1230 | iowrite32(0x00000FFFF, hcr_base + CE); |
1131 | iowrite32(0x00000FFFF, hcr_base + DE); | 1231 | iowrite32(0x00000FFFF, hcr_base + DE); |
1132 | 1232 | ||
1133 | /* initially assuming no Port multiplier, set CQPMP to 0 */ | ||
1134 | iowrite32(0x0, hcr_base + CQPMP); | ||
1135 | |||
1136 | /* | 1233 | /* |
1137 | * host controller will be brought on-line, during xx_port_start() | 1234 | * host controller will be brought on-line, during xx_port_start() |
1138 | * callback, that should also initiate the OOB, COMINIT sequence | 1235 | * callback, that should also initiate the OOB, COMINIT sequence |
@@ -1154,8 +1251,8 @@ static struct scsi_host_template sata_fsl_sht = { | |||
1154 | .dma_boundary = ATA_DMA_BOUNDARY, | 1251 | .dma_boundary = ATA_DMA_BOUNDARY, |
1155 | }; | 1252 | }; |
1156 | 1253 | ||
1157 | static const struct ata_port_operations sata_fsl_ops = { | 1254 | static struct ata_port_operations sata_fsl_ops = { |
1158 | .inherits = &sata_port_ops, | 1255 | .inherits = &sata_pmp_port_ops, |
1159 | 1256 | ||
1160 | .qc_prep = sata_fsl_qc_prep, | 1257 | .qc_prep = sata_fsl_qc_prep, |
1161 | .qc_issue = sata_fsl_qc_issue, | 1258 | .qc_issue = sata_fsl_qc_issue, |
@@ -1168,10 +1265,15 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1168 | .thaw = sata_fsl_thaw, | 1265 | .thaw = sata_fsl_thaw, |
1169 | .prereset = sata_fsl_prereset, | 1266 | .prereset = sata_fsl_prereset, |
1170 | .softreset = sata_fsl_softreset, | 1267 | .softreset = sata_fsl_softreset, |
1268 | .pmp_softreset = sata_fsl_softreset, | ||
1269 | .error_handler = sata_fsl_error_handler, | ||
1171 | .post_internal_cmd = sata_fsl_post_internal_cmd, | 1270 | .post_internal_cmd = sata_fsl_post_internal_cmd, |
1172 | 1271 | ||
1173 | .port_start = sata_fsl_port_start, | 1272 | .port_start = sata_fsl_port_start, |
1174 | .port_stop = sata_fsl_port_stop, | 1273 | .port_stop = sata_fsl_port_stop, |
1274 | |||
1275 | .pmp_attach = sata_fsl_pmp_attach, | ||
1276 | .pmp_detach = sata_fsl_pmp_detach, | ||
1175 | }; | 1277 | }; |
1176 | 1278 | ||
1177 | static const struct ata_port_info sata_fsl_port_info[] = { | 1279 | static const struct ata_port_info sata_fsl_port_info[] = { |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index fb81f0c7a8c2..acf347f71a2f 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include <linux/libata.h> | 72 | #include <linux/libata.h> |
73 | 73 | ||
74 | #define DRV_NAME "sata_mv" | 74 | #define DRV_NAME "sata_mv" |
75 | #define DRV_VERSION "1.21" | 75 | #define DRV_VERSION "1.24" |
76 | 76 | ||
77 | enum { | 77 | enum { |
78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -122,8 +122,6 @@ enum { | |||
122 | /* Host Flags */ | 122 | /* Host Flags */ |
123 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ | 123 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ |
124 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ | 124 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ |
125 | /* SoC integrated controllers, no PCI interface */ | ||
126 | MV_FLAG_SOC = (1 << 28), | ||
127 | 125 | ||
128 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 126 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
129 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | | 127 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | |
@@ -356,12 +354,12 @@ enum { | |||
356 | MV_HP_ERRATA_50XXB2 = (1 << 2), | 354 | MV_HP_ERRATA_50XXB2 = (1 << 2), |
357 | MV_HP_ERRATA_60X1B2 = (1 << 3), | 355 | MV_HP_ERRATA_60X1B2 = (1 << 3), |
358 | MV_HP_ERRATA_60X1C0 = (1 << 4), | 356 | MV_HP_ERRATA_60X1C0 = (1 << 4), |
359 | MV_HP_ERRATA_XX42A0 = (1 << 5), | ||
360 | MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ | 357 | MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ |
361 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ | 358 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ |
362 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ | 359 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ |
363 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ | 360 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ |
364 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ | 361 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ |
362 | MV_HP_FLAG_SOC = (1 << 11), /* SystemOnChip, no PCI */ | ||
365 | 363 | ||
366 | /* Port private flags (pp_flags) */ | 364 | /* Port private flags (pp_flags) */ |
367 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ | 365 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ |
@@ -374,7 +372,7 @@ enum { | |||
374 | #define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) | 372 | #define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) |
375 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) | 373 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) |
376 | #define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE) | 374 | #define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE) |
377 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) | 375 | #define IS_SOC(hpriv) ((hpriv)->hp_flags & MV_HP_FLAG_SOC) |
378 | 376 | ||
379 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) | 377 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) |
380 | #define WINDOW_BASE(i) (0x20034 + ((i) << 4)) | 378 | #define WINDOW_BASE(i) (0x20034 + ((i) << 4)) |
@@ -652,7 +650,7 @@ static const struct ata_port_info mv_port_info[] = { | |||
652 | .port_ops = &mv_iie_ops, | 650 | .port_ops = &mv_iie_ops, |
653 | }, | 651 | }, |
654 | { /* chip_soc */ | 652 | { /* chip_soc */ |
655 | .flags = MV_GENIIE_FLAGS | MV_FLAG_SOC, | 653 | .flags = MV_GENIIE_FLAGS, |
656 | .pio_mask = 0x1f, /* pio0-4 */ | 654 | .pio_mask = 0x1f, /* pio0-4 */ |
657 | .udma_mask = ATA_UDMA6, | 655 | .udma_mask = ATA_UDMA6, |
658 | .port_ops = &mv_iie_ops, | 656 | .port_ops = &mv_iie_ops, |
@@ -812,12 +810,7 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio, | |||
812 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); | 810 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); |
813 | writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index, | 811 | writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index, |
814 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 812 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
815 | 813 | writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | |
816 | if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0) | ||
817 | writelfl((pp->crqb_dma & 0xffffffff) | index, | ||
818 | port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | ||
819 | else | ||
820 | writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | ||
821 | 814 | ||
822 | /* | 815 | /* |
823 | * initialize response queue | 816 | * initialize response queue |
@@ -827,13 +820,7 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio, | |||
827 | 820 | ||
828 | WARN_ON(pp->crpb_dma & 0xff); | 821 | WARN_ON(pp->crpb_dma & 0xff); |
829 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); | 822 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); |
830 | 823 | writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | |
831 | if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0) | ||
832 | writelfl((pp->crpb_dma & 0xffffffff) | index, | ||
833 | port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | ||
834 | else | ||
835 | writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | ||
836 | |||
837 | writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index, | 824 | writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index, |
838 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 825 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
839 | } | 826 | } |
@@ -1254,7 +1241,7 @@ static void mv_edma_cfg(struct ata_port *ap, int want_ncq) | |||
1254 | 1241 | ||
1255 | cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ | 1242 | cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ |
1256 | cfg |= (1 << 22); /* enab 4-entry host queue cache */ | 1243 | cfg |= (1 << 22); /* enab 4-entry host queue cache */ |
1257 | if (HAS_PCI(ap->host)) | 1244 | if (!IS_SOC(hpriv)) |
1258 | cfg |= (1 << 18); /* enab early completion */ | 1245 | cfg |= (1 << 18); /* enab early completion */ |
1259 | if (hpriv->hp_flags & MV_HP_CUT_THROUGH) | 1246 | if (hpriv->hp_flags & MV_HP_CUT_THROUGH) |
1260 | cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */ | 1247 | cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */ |
@@ -2225,7 +2212,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
2225 | * a bogus register value which can indicate HW removal or PCI fault. | 2212 | * a bogus register value which can indicate HW removal or PCI fault. |
2226 | */ | 2213 | */ |
2227 | if (pending_irqs && main_irq_cause != 0xffffffffU) { | 2214 | if (pending_irqs && main_irq_cause != 0xffffffffU) { |
2228 | if (unlikely((pending_irqs & PCI_ERR) && HAS_PCI(host))) | 2215 | if (unlikely((pending_irqs & PCI_ERR) && !IS_SOC(hpriv))) |
2229 | handled = mv_pci_error(host, hpriv->base); | 2216 | handled = mv_pci_error(host, hpriv->base); |
2230 | else | 2217 | else |
2231 | handled = mv_host_intr(host, pending_irqs); | 2218 | handled = mv_host_intr(host, pending_irqs); |
@@ -2547,7 +2534,7 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
2547 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | 2534 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); |
2548 | int fix_phy_mode4 = | 2535 | int fix_phy_mode4 = |
2549 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | 2536 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); |
2550 | u32 m2, tmp; | 2537 | u32 m2, m3; |
2551 | 2538 | ||
2552 | if (fix_phy_mode2) { | 2539 | if (fix_phy_mode2) { |
2553 | m2 = readl(port_mmio + PHY_MODE2); | 2540 | m2 = readl(port_mmio + PHY_MODE2); |
@@ -2564,28 +2551,37 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
2564 | udelay(200); | 2551 | udelay(200); |
2565 | } | 2552 | } |
2566 | 2553 | ||
2567 | /* who knows what this magic does */ | 2554 | /* |
2568 | tmp = readl(port_mmio + PHY_MODE3); | 2555 | * Gen-II/IIe PHY_MODE3 errata RM#2: |
2569 | tmp &= ~0x7F800000; | 2556 | * Achieves better receiver noise performance than the h/w default: |
2570 | tmp |= 0x2A800000; | 2557 | */ |
2571 | writel(tmp, port_mmio + PHY_MODE3); | 2558 | m3 = readl(port_mmio + PHY_MODE3); |
2559 | m3 = (m3 & 0x1f) | (0x5555601 << 5); | ||
2560 | |||
2561 | /* Guideline 88F5182 (GL# SATA-S11) */ | ||
2562 | if (IS_SOC(hpriv)) | ||
2563 | m3 &= ~0x1c; | ||
2572 | 2564 | ||
2573 | if (fix_phy_mode4) { | 2565 | if (fix_phy_mode4) { |
2574 | u32 m4; | 2566 | u32 m4; |
2575 | 2567 | ||
2576 | m4 = readl(port_mmio + PHY_MODE4); | 2568 | m4 = readl(port_mmio + PHY_MODE4); |
2577 | 2569 | ||
2578 | if (hp_flags & MV_HP_ERRATA_60X1B2) | ||
2579 | tmp = readl(port_mmio + PHY_MODE3); | ||
2580 | |||
2581 | /* workaround for errata FEr SATA#10 (part 1) */ | 2570 | /* workaround for errata FEr SATA#10 (part 1) */ |
2582 | m4 = (m4 & ~(1 << 1)) | (1 << 0); | 2571 | m4 = (m4 & ~(1 << 1)) | (1 << 0); |
2583 | 2572 | ||
2584 | writel(m4, port_mmio + PHY_MODE4); | 2573 | /* enforce bit restrictions on GenIIe devices */ |
2574 | if (IS_GEN_IIE(hpriv)) | ||
2575 | m4 = (m4 & ~0x5DE3FFFC) | (1 << 2); | ||
2585 | 2576 | ||
2586 | if (hp_flags & MV_HP_ERRATA_60X1B2) | 2577 | writel(m4, port_mmio + PHY_MODE4); |
2587 | writel(tmp, port_mmio + PHY_MODE3); | ||
2588 | } | 2578 | } |
2579 | /* | ||
2580 | * Workaround for 60x1-B2 errata SATA#13: | ||
2581 | * Any write to PHY_MODE4 (above) may corrupt PHY_MODE3, | ||
2582 | * so we must always rewrite PHY_MODE3 after PHY_MODE4. | ||
2583 | */ | ||
2584 | writel(m3, port_mmio + PHY_MODE3); | ||
2589 | 2585 | ||
2590 | /* Revert values of pre-emphasis and signal amps to the saved ones */ | 2586 | /* Revert values of pre-emphasis and signal amps to the saved ones */ |
2591 | m2 = readl(port_mmio + PHY_MODE2); | 2587 | m2 = readl(port_mmio + PHY_MODE2); |
@@ -2876,7 +2872,7 @@ static unsigned int mv_in_pcix_mode(struct ata_host *host) | |||
2876 | void __iomem *mmio = hpriv->base; | 2872 | void __iomem *mmio = hpriv->base; |
2877 | u32 reg; | 2873 | u32 reg; |
2878 | 2874 | ||
2879 | if (!HAS_PCI(host) || !IS_PCIE(hpriv)) | 2875 | if (IS_SOC(hpriv) || !IS_PCIE(hpriv)) |
2880 | return 0; /* not PCI-X capable */ | 2876 | return 0; /* not PCI-X capable */ |
2881 | reg = readl(mmio + MV_PCI_MODE_OFS); | 2877 | reg = readl(mmio + MV_PCI_MODE_OFS); |
2882 | if ((reg & MV_PCI_MODE_MASK) == 0) | 2878 | if ((reg & MV_PCI_MODE_MASK) == 0) |
@@ -3003,10 +2999,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
3003 | hp_flags |= MV_HP_CUT_THROUGH; | 2999 | hp_flags |= MV_HP_CUT_THROUGH; |
3004 | 3000 | ||
3005 | switch (pdev->revision) { | 3001 | switch (pdev->revision) { |
3006 | case 0x0: | 3002 | case 0x2: /* Rev.B0: the first/only public release */ |
3007 | hp_flags |= MV_HP_ERRATA_XX42A0; | ||
3008 | break; | ||
3009 | case 0x1: | ||
3010 | hp_flags |= MV_HP_ERRATA_60X1C0; | 3003 | hp_flags |= MV_HP_ERRATA_60X1C0; |
3011 | break; | 3004 | break; |
3012 | default: | 3005 | default: |
@@ -3018,7 +3011,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
3018 | break; | 3011 | break; |
3019 | case chip_soc: | 3012 | case chip_soc: |
3020 | hpriv->ops = &mv_soc_ops; | 3013 | hpriv->ops = &mv_soc_ops; |
3021 | hp_flags |= MV_HP_ERRATA_60X1C0; | 3014 | hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; |
3022 | break; | 3015 | break; |
3023 | 3016 | ||
3024 | default: | 3017 | default: |
@@ -3062,12 +3055,12 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3062 | if (rc) | 3055 | if (rc) |
3063 | goto done; | 3056 | goto done; |
3064 | 3057 | ||
3065 | if (HAS_PCI(host)) { | 3058 | if (IS_SOC(hpriv)) { |
3066 | hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; | ||
3067 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; | ||
3068 | } else { | ||
3069 | hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; | 3059 | hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; |
3070 | hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; | 3060 | hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; |
3061 | } else { | ||
3062 | hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; | ||
3063 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; | ||
3071 | } | 3064 | } |
3072 | 3065 | ||
3073 | /* global interrupt mask: 0 == mask everything */ | 3066 | /* global interrupt mask: 0 == mask everything */ |
@@ -3093,7 +3086,7 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3093 | mv_port_init(&ap->ioaddr, port_mmio); | 3086 | mv_port_init(&ap->ioaddr, port_mmio); |
3094 | 3087 | ||
3095 | #ifdef CONFIG_PCI | 3088 | #ifdef CONFIG_PCI |
3096 | if (HAS_PCI(host)) { | 3089 | if (!IS_SOC(hpriv)) { |
3097 | unsigned int offset = port_mmio - mmio; | 3090 | unsigned int offset = port_mmio - mmio; |
3098 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); | 3091 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); |
3099 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); | 3092 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); |
@@ -3113,7 +3106,7 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3113 | writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); | 3106 | writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); |
3114 | } | 3107 | } |
3115 | 3108 | ||
3116 | if (HAS_PCI(host)) { | 3109 | if (!IS_SOC(hpriv)) { |
3117 | /* Clear any currently outstanding host interrupt conditions */ | 3110 | /* Clear any currently outstanding host interrupt conditions */ |
3118 | writelfl(0, mmio + hpriv->irq_cause_ofs); | 3111 | writelfl(0, mmio + hpriv->irq_cause_ofs); |
3119 | 3112 | ||
diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h index 183841cc8fdf..8dd4aa76c3bd 100644 --- a/drivers/atm/fore200e.h +++ b/drivers/atm/fore200e.h | |||
@@ -1,4 +1,3 @@ | |||
1 | /* $Id: fore200e.h,v 1.4 2000/04/14 10:10:34 davem Exp $ */ | ||
2 | #ifndef _FORE200E_H | 1 | #ifndef _FORE200E_H |
3 | #define _FORE200E_H | 2 | #define _FORE200E_H |
4 | 3 | ||
diff --git a/drivers/atm/fore200e_mkfirm.c b/drivers/atm/fore200e_mkfirm.c index 2ebe1a1e6f8b..520e14b488ff 100644 --- a/drivers/atm/fore200e_mkfirm.c +++ b/drivers/atm/fore200e_mkfirm.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: fore200e_mkfirm.c,v 1.1 2000/02/21 16:04:32 davem Exp $ | ||
3 | |||
4 | mkfirm.c: generates a C readable file from a binary firmware image | 2 | mkfirm.c: generates a C readable file from a binary firmware image |
5 | 3 | ||
6 | Christophe Lizzi (lizzi@{csti.fr, cnam.fr}), June 1999. | 4 | Christophe Lizzi (lizzi@{csti.fr, cnam.fr}), June 1999. |
diff --git a/drivers/atm/he.h b/drivers/atm/he.h index 1dc277547a73..fe6cd15a78a4 100644 --- a/drivers/atm/he.h +++ b/drivers/atm/he.h | |||
@@ -1,5 +1,3 @@ | |||
1 | /* $Id: he.h,v 1.4 2003/05/06 22:48:00 chas Exp $ */ | ||
2 | |||
3 | /* | 1 | /* |
4 | 2 | ||
5 | he.h | 3 | he.h |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 28d77b5195de..3a504e94a4d9 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -1,8 +1,4 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * ident "$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $" | ||
3 | * | ||
4 | * $Author: ecd $ | ||
5 | * $Date: 2001/11/11 08:13:54 $ | ||
6 | * | 2 | * |
7 | * Copyright (c) 2000 ATecoM GmbH | 3 | * Copyright (c) 2000 ATecoM GmbH |
8 | * | 4 | * |
@@ -29,9 +25,6 @@ | |||
29 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
30 | * | 26 | * |
31 | *******************************************************************/ | 27 | *******************************************************************/ |
32 | static char const rcsid[] = | ||
33 | "$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $"; | ||
34 | |||
35 | 28 | ||
36 | #include <linux/module.h> | 29 | #include <linux/module.h> |
37 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h index 6f2b4a5875fb..e83eaf120da0 100644 --- a/drivers/atm/idt77252.h +++ b/drivers/atm/idt77252.h | |||
@@ -1,8 +1,4 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * ident "$Id: idt77252.h,v 1.2 2001/11/11 08:13:54 ecd Exp $" | ||
3 | * | ||
4 | * $Author: ecd $ | ||
5 | * $Date: 2001/11/11 08:13:54 $ | ||
6 | * | 2 | * |
7 | * Copyright (c) 2000 ATecoM GmbH | 3 | * Copyright (c) 2000 ATecoM GmbH |
8 | * | 4 | * |
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index 133eefcc0475..b2cd20f549cb 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h | |||
@@ -1025,7 +1025,8 @@ typedef struct iadev_t { | |||
1025 | spinlock_t rx_lock, misc_lock; | 1025 | spinlock_t rx_lock, misc_lock; |
1026 | struct atm_vcc **rx_open; /* list of all open VCs */ | 1026 | struct atm_vcc **rx_open; /* list of all open VCs */ |
1027 | u16 num_rx_desc, rx_buf_sz, rxing; | 1027 | u16 num_rx_desc, rx_buf_sz, rxing; |
1028 | u32 rx_pkt_ram, rx_tmp_cnt, rx_tmp_jif; | 1028 | u32 rx_pkt_ram, rx_tmp_cnt; |
1029 | unsigned long rx_tmp_jif; | ||
1029 | void __iomem *RX_DESC_BASE_ADDR; | 1030 | void __iomem *RX_DESC_BASE_ADDR; |
1030 | u32 drop_rxpkt, drop_rxcell, rx_cell_cnt, rx_pkt_cnt; | 1031 | u32 drop_rxpkt, drop_rxcell, rx_cell_cnt, rx_pkt_cnt; |
1031 | struct atm_dev *next_board; /* other iphase devices */ | 1032 | struct atm_dev *next_board; /* other iphase devices */ |
diff --git a/drivers/atm/nicstarmac.copyright b/drivers/atm/nicstarmac.copyright index 2e15b39fac4f..180531a83c62 100644 --- a/drivers/atm/nicstarmac.copyright +++ b/drivers/atm/nicstarmac.copyright | |||
@@ -13,7 +13,7 @@ | |||
13 | * | 13 | * |
14 | * Modified to work with the IDT7721 nicstar -- AAL5 (tested) only. | 14 | * Modified to work with the IDT7721 nicstar -- AAL5 (tested) only. |
15 | * | 15 | * |
16 | * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997 $Revision: 1.1 $ $Date: 1999/08/20 11:00:11 $ | 16 | * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997 |
17 | * | 17 | * |
18 | * Linux driver for the IDT77201 NICStAR PCI ATM controller. | 18 | * Linux driver for the IDT77201 NICStAR PCI ATM controller. |
19 | * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155; | 19 | * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index be288b5e4180..422cfcad486d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -760,6 +760,21 @@ static void device_remove_class_symlinks(struct device *dev) | |||
760 | } | 760 | } |
761 | 761 | ||
762 | /** | 762 | /** |
763 | * dev_set_name - set a device name | ||
764 | * @dev: device | ||
765 | */ | ||
766 | int dev_set_name(struct device *dev, const char *fmt, ...) | ||
767 | { | ||
768 | va_list vargs; | ||
769 | |||
770 | va_start(vargs, fmt); | ||
771 | vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs); | ||
772 | va_end(vargs); | ||
773 | return 0; | ||
774 | } | ||
775 | EXPORT_SYMBOL_GPL(dev_set_name); | ||
776 | |||
777 | /** | ||
763 | * device_add - add device to device hierarchy. | 778 | * device_add - add device to device hierarchy. |
764 | * @dev: device. | 779 | * @dev: device. |
765 | * | 780 | * |
@@ -1084,11 +1099,13 @@ static void device_create_release(struct device *dev) | |||
1084 | } | 1099 | } |
1085 | 1100 | ||
1086 | /** | 1101 | /** |
1087 | * device_create - creates a device and registers it with sysfs | 1102 | * device_create_vargs - creates a device and registers it with sysfs |
1088 | * @class: pointer to the struct class that this device should be registered to | 1103 | * @class: pointer to the struct class that this device should be registered to |
1089 | * @parent: pointer to the parent struct device of this new device, if any | 1104 | * @parent: pointer to the parent struct device of this new device, if any |
1090 | * @devt: the dev_t for the char device to be added | 1105 | * @devt: the dev_t for the char device to be added |
1106 | * @drvdata: the data to be added to the device for callbacks | ||
1091 | * @fmt: string for the device's name | 1107 | * @fmt: string for the device's name |
1108 | * @args: va_list for the device's name | ||
1092 | * | 1109 | * |
1093 | * This function can be used by char device classes. A struct device | 1110 | * This function can be used by char device classes. A struct device |
1094 | * will be created in sysfs, registered to the specified class. | 1111 | * will be created in sysfs, registered to the specified class. |
@@ -1104,10 +1121,10 @@ static void device_create_release(struct device *dev) | |||
1104 | * Note: the struct class passed to this function must have previously | 1121 | * Note: the struct class passed to this function must have previously |
1105 | * been created with a call to class_create(). | 1122 | * been created with a call to class_create(). |
1106 | */ | 1123 | */ |
1107 | struct device *device_create(struct class *class, struct device *parent, | 1124 | struct device *device_create_vargs(struct class *class, struct device *parent, |
1108 | dev_t devt, const char *fmt, ...) | 1125 | dev_t devt, void *drvdata, const char *fmt, |
1126 | va_list args) | ||
1109 | { | 1127 | { |
1110 | va_list args; | ||
1111 | struct device *dev = NULL; | 1128 | struct device *dev = NULL; |
1112 | int retval = -ENODEV; | 1129 | int retval = -ENODEV; |
1113 | 1130 | ||
@@ -1124,10 +1141,9 @@ struct device *device_create(struct class *class, struct device *parent, | |||
1124 | dev->class = class; | 1141 | dev->class = class; |
1125 | dev->parent = parent; | 1142 | dev->parent = parent; |
1126 | dev->release = device_create_release; | 1143 | dev->release = device_create_release; |
1144 | dev_set_drvdata(dev, drvdata); | ||
1127 | 1145 | ||
1128 | va_start(args, fmt); | ||
1129 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); | 1146 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); |
1130 | va_end(args); | ||
1131 | retval = device_register(dev); | 1147 | retval = device_register(dev); |
1132 | if (retval) | 1148 | if (retval) |
1133 | goto error; | 1149 | goto error; |
@@ -1138,6 +1154,78 @@ error: | |||
1138 | kfree(dev); | 1154 | kfree(dev); |
1139 | return ERR_PTR(retval); | 1155 | return ERR_PTR(retval); |
1140 | } | 1156 | } |
1157 | EXPORT_SYMBOL_GPL(device_create_vargs); | ||
1158 | |||
1159 | /** | ||
1160 | * device_create_drvdata - creates a device and registers it with sysfs | ||
1161 | * @class: pointer to the struct class that this device should be registered to | ||
1162 | * @parent: pointer to the parent struct device of this new device, if any | ||
1163 | * @devt: the dev_t for the char device to be added | ||
1164 | * @drvdata: the data to be added to the device for callbacks | ||
1165 | * @fmt: string for the device's name | ||
1166 | * | ||
1167 | * This function can be used by char device classes. A struct device | ||
1168 | * will be created in sysfs, registered to the specified class. | ||
1169 | * | ||
1170 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1171 | * the dev_t is not 0,0. | ||
1172 | * If a pointer to a parent struct device is passed in, the newly created | ||
1173 | * struct device will be a child of that device in sysfs. | ||
1174 | * The pointer to the struct device will be returned from the call. | ||
1175 | * Any further sysfs files that might be required can be created using this | ||
1176 | * pointer. | ||
1177 | * | ||
1178 | * Note: the struct class passed to this function must have previously | ||
1179 | * been created with a call to class_create(). | ||
1180 | */ | ||
1181 | struct device *device_create_drvdata(struct class *class, | ||
1182 | struct device *parent, | ||
1183 | dev_t devt, | ||
1184 | void *drvdata, | ||
1185 | const char *fmt, ...) | ||
1186 | { | ||
1187 | va_list vargs; | ||
1188 | struct device *dev; | ||
1189 | |||
1190 | va_start(vargs, fmt); | ||
1191 | dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs); | ||
1192 | va_end(vargs); | ||
1193 | return dev; | ||
1194 | } | ||
1195 | EXPORT_SYMBOL_GPL(device_create_drvdata); | ||
1196 | |||
1197 | /** | ||
1198 | * device_create - creates a device and registers it with sysfs | ||
1199 | * @class: pointer to the struct class that this device should be registered to | ||
1200 | * @parent: pointer to the parent struct device of this new device, if any | ||
1201 | * @devt: the dev_t for the char device to be added | ||
1202 | * @fmt: string for the device's name | ||
1203 | * | ||
1204 | * This function can be used by char device classes. A struct device | ||
1205 | * will be created in sysfs, registered to the specified class. | ||
1206 | * | ||
1207 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1208 | * the dev_t is not 0,0. | ||
1209 | * If a pointer to a parent struct device is passed in, the newly created | ||
1210 | * struct device will be a child of that device in sysfs. | ||
1211 | * The pointer to the struct device will be returned from the call. | ||
1212 | * Any further sysfs files that might be required can be created using this | ||
1213 | * pointer. | ||
1214 | * | ||
1215 | * Note: the struct class passed to this function must have previously | ||
1216 | * been created with a call to class_create(). | ||
1217 | */ | ||
1218 | struct device *device_create(struct class *class, struct device *parent, | ||
1219 | dev_t devt, const char *fmt, ...) | ||
1220 | { | ||
1221 | va_list vargs; | ||
1222 | struct device *dev; | ||
1223 | |||
1224 | va_start(vargs, fmt); | ||
1225 | dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs); | ||
1226 | va_end(vargs); | ||
1227 | return dev; | ||
1228 | } | ||
1141 | EXPORT_SYMBOL_GPL(device_create); | 1229 | EXPORT_SYMBOL_GPL(device_create); |
1142 | 1230 | ||
1143 | static int __match_devt(struct device *dev, void *data) | 1231 | static int __match_devt(struct device *dev, void *data) |
@@ -1218,13 +1306,11 @@ int device_rename(struct device *dev, char *new_name) | |||
1218 | } | 1306 | } |
1219 | #else | 1307 | #else |
1220 | if (dev->class) { | 1308 | if (dev->class) { |
1221 | sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); | ||
1222 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, | 1309 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, |
1223 | dev->bus_id); | 1310 | dev->bus_id); |
1224 | if (error) { | 1311 | if (error) |
1225 | dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n", | 1312 | goto out; |
1226 | __func__, error); | 1313 | sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); |
1227 | } | ||
1228 | } | 1314 | } |
1229 | #endif | 1315 | #endif |
1230 | 1316 | ||
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index a196ef7f147f..680cdfc00b90 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -447,6 +447,7 @@ static struct brd_device *brd_alloc(int i) | |||
447 | disk->fops = &brd_fops; | 447 | disk->fops = &brd_fops; |
448 | disk->private_data = brd; | 448 | disk->private_data = brd; |
449 | disk->queue = brd->brd_queue; | 449 | disk->queue = brd->brd_queue; |
450 | disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | ||
450 | sprintf(disk->disk_name, "ram%d", i); | 451 | sprintf(disk->disk_name, "ram%d", i); |
451 | set_capacity(disk, rd_size * 2); | 452 | set_capacity(disk, rd_size * 2); |
452 | 453 | ||
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index ebfe038d859e..f1c8feb5510b 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 3 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
4 | * Ryan Arnold <ryanarn@us.ibm.com> | 4 | * Ryan Arnold <ryanarn@us.ibm.com> |
5 | * Colin Devilbiss <devilbis@us.ibm.com> | 5 | * Colin Devilbiss <devilbis@us.ibm.com> |
6 | * Stephen Rothwell <sfr@au1.ibm.com> | 6 | * Stephen Rothwell |
7 | * | 7 | * |
8 | * (C) Copyright 2000-2004 IBM Corporation | 8 | * (C) Copyright 2000-2004 IBM Corporation |
9 | * | 9 | * |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 84e064ffee52..dd7ea203f940 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -260,6 +260,10 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
260 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) | 260 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) |
261 | blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); | 261 | blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); |
262 | 262 | ||
263 | /* If disk is read-only in the host, the guest should obey */ | ||
264 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) | ||
265 | set_disk_ro(vblk->disk, 1); | ||
266 | |||
263 | /* Host must always specify the capacity. */ | 267 | /* Host must always specify the capacity. */ |
264 | vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity), | 268 | vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity), |
265 | &cap, sizeof(cap)); | 269 | &cap, sizeof(cap)); |
@@ -311,6 +315,7 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
311 | /* Stop all the virtqueues. */ | 315 | /* Stop all the virtqueues. */ |
312 | vdev->config->reset(vdev); | 316 | vdev->config->reset(vdev); |
313 | 317 | ||
318 | del_gendisk(vblk->disk); | ||
314 | blk_cleanup_queue(vblk->disk->queue); | 319 | blk_cleanup_queue(vblk->disk->queue); |
315 | put_disk(vblk->disk); | 320 | put_disk(vblk->disk); |
316 | mempool_destroy(vblk->pool); | 321 | mempool_destroy(vblk->pool); |
@@ -325,7 +330,7 @@ static struct virtio_device_id id_table[] = { | |||
325 | 330 | ||
326 | static unsigned int features[] = { | 331 | static unsigned int features[] = { |
327 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, | 332 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, |
328 | VIRTIO_BLK_F_GEOMETRY, | 333 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, |
329 | }; | 334 | }; |
330 | 335 | ||
331 | static struct virtio_driver virtio_blk = { | 336 | static struct virtio_driver virtio_blk = { |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 5245a4a0ba74..9d0dfe6e0d63 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
7 | * Ryan Arnold <ryanarn@us.ibm.com> | 7 | * Ryan Arnold <ryanarn@us.ibm.com> |
8 | * Colin Devilbiss <devilbis@us.ibm.com> | 8 | * Colin Devilbiss <devilbis@us.ibm.com> |
9 | * Stephen Rothwell <sfr@au1.ibm.com> | 9 | * Stephen Rothwell |
10 | * | 10 | * |
11 | * (C) Copyright 2000-2004 IBM Corporation | 11 | * (C) Copyright 2000-2004 IBM Corporation |
12 | * | 12 | * |
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 9a32169e88fb..af211a0ef179 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -34,8 +34,6 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state) | |||
34 | struct drm_minor *drm_minor = to_drm_minor(dev); | 34 | struct drm_minor *drm_minor = to_drm_minor(dev); |
35 | struct drm_device *drm_dev = drm_minor->dev; | 35 | struct drm_device *drm_dev = drm_minor->dev; |
36 | 36 | ||
37 | printk(KERN_ERR "%s\n", __func__); | ||
38 | |||
39 | if (drm_dev->driver->suspend) | 37 | if (drm_dev->driver->suspend) |
40 | return drm_dev->driver->suspend(drm_dev, state); | 38 | return drm_dev->driver->suspend(drm_dev, state); |
41 | 39 | ||
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 8d6c2089d2a8..efd0b4db7c8e 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -112,3 +112,12 @@ config HW_RANDOM_PASEMI | |||
112 | 112 | ||
113 | If unsure, say Y. | 113 | If unsure, say Y. |
114 | 114 | ||
115 | config HW_RANDOM_VIRTIO | ||
116 | tristate "VirtIO Random Number Generator support" | ||
117 | depends on HW_RANDOM && VIRTIO | ||
118 | ---help--- | ||
119 | This driver provides kernel-side support for the virtual Random Number | ||
120 | Generator hardware. | ||
121 | |||
122 | To compile this driver as a module, choose M here: the | ||
123 | module will be called virtio-rng. If unsure, say N. | ||
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index c8b7300e2fb1..b4940ddbb35f 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -11,3 +11,4 @@ obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o | |||
11 | obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o | 11 | obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o |
12 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o | 12 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o |
13 | obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o | 13 | obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o |
14 | obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o | ||
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c new file mode 100644 index 000000000000..d0e563e4fc39 --- /dev/null +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | * Randomness driver for virtio | ||
3 | * Copyright (C) 2007, 2008 Rusty Russell IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/hw_random.h> | ||
21 | #include <linux/scatterlist.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/virtio.h> | ||
24 | #include <linux/virtio_rng.h> | ||
25 | |||
26 | /* The host will fill any buffer we give it with sweet, sweet randomness. We | ||
27 | * give it 64 bytes at a time, and the hwrng framework takes it 4 bytes at a | ||
28 | * time. */ | ||
29 | #define RANDOM_DATA_SIZE 64 | ||
30 | |||
31 | static struct virtqueue *vq; | ||
32 | static u32 *random_data; | ||
33 | static unsigned int data_left; | ||
34 | static DECLARE_COMPLETION(have_data); | ||
35 | |||
36 | static void random_recv_done(struct virtqueue *vq) | ||
37 | { | ||
38 | int len; | ||
39 | |||
40 | /* We never get spurious callbacks. */ | ||
41 | if (!vq->vq_ops->get_buf(vq, &len)) | ||
42 | BUG(); | ||
43 | |||
44 | data_left = len / sizeof(random_data[0]); | ||
45 | complete(&have_data); | ||
46 | } | ||
47 | |||
48 | static void register_buffer(void) | ||
49 | { | ||
50 | struct scatterlist sg; | ||
51 | |||
52 | sg_init_one(&sg, random_data, RANDOM_DATA_SIZE); | ||
53 | /* There should always be room for one buffer. */ | ||
54 | if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0) | ||
55 | BUG(); | ||
56 | vq->vq_ops->kick(vq); | ||
57 | } | ||
58 | |||
59 | /* At least we don't udelay() in a loop like some other drivers. */ | ||
60 | static int virtio_data_present(struct hwrng *rng, int wait) | ||
61 | { | ||
62 | if (data_left) | ||
63 | return 1; | ||
64 | |||
65 | if (!wait) | ||
66 | return 0; | ||
67 | |||
68 | wait_for_completion(&have_data); | ||
69 | return 1; | ||
70 | } | ||
71 | |||
72 | /* virtio_data_present() must have succeeded before this is called. */ | ||
73 | static int virtio_data_read(struct hwrng *rng, u32 *data) | ||
74 | { | ||
75 | BUG_ON(!data_left); | ||
76 | |||
77 | *data = random_data[--data_left]; | ||
78 | |||
79 | if (!data_left) { | ||
80 | init_completion(&have_data); | ||
81 | register_buffer(); | ||
82 | } | ||
83 | return sizeof(*data); | ||
84 | } | ||
85 | |||
86 | static struct hwrng virtio_hwrng = { | ||
87 | .name = "virtio", | ||
88 | .data_present = virtio_data_present, | ||
89 | .data_read = virtio_data_read, | ||
90 | }; | ||
91 | |||
92 | static int virtrng_probe(struct virtio_device *vdev) | ||
93 | { | ||
94 | int err; | ||
95 | |||
96 | /* We expect a single virtqueue. */ | ||
97 | vq = vdev->config->find_vq(vdev, 0, random_recv_done); | ||
98 | if (IS_ERR(vq)) | ||
99 | return PTR_ERR(vq); | ||
100 | |||
101 | err = hwrng_register(&virtio_hwrng); | ||
102 | if (err) { | ||
103 | vdev->config->del_vq(vq); | ||
104 | return err; | ||
105 | } | ||
106 | |||
107 | register_buffer(); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static void virtrng_remove(struct virtio_device *vdev) | ||
112 | { | ||
113 | vdev->config->reset(vdev); | ||
114 | hwrng_unregister(&virtio_hwrng); | ||
115 | vdev->config->del_vq(vq); | ||
116 | } | ||
117 | |||
118 | static struct virtio_device_id id_table[] = { | ||
119 | { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, | ||
120 | { 0 }, | ||
121 | }; | ||
122 | |||
123 | static struct virtio_driver virtio_rng = { | ||
124 | .driver.name = KBUILD_MODNAME, | ||
125 | .driver.owner = THIS_MODULE, | ||
126 | .id_table = id_table, | ||
127 | .probe = virtrng_probe, | ||
128 | .remove = __devexit_p(virtrng_remove), | ||
129 | }; | ||
130 | |||
131 | static int __init init(void) | ||
132 | { | ||
133 | int err; | ||
134 | |||
135 | random_data = kmalloc(RANDOM_DATA_SIZE, GFP_KERNEL); | ||
136 | if (!random_data) | ||
137 | return -ENOMEM; | ||
138 | |||
139 | err = register_virtio_driver(&virtio_rng); | ||
140 | if (err) | ||
141 | kfree(random_data); | ||
142 | return err; | ||
143 | } | ||
144 | |||
145 | static void __exit fini(void) | ||
146 | { | ||
147 | kfree(random_data); | ||
148 | unregister_virtio_driver(&virtio_rng); | ||
149 | } | ||
150 | module_init(init); | ||
151 | module_exit(fini); | ||
152 | |||
153 | MODULE_DEVICE_TABLE(virtio, id_table); | ||
154 | MODULE_DESCRIPTION("Virtio random number driver"); | ||
155 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/ip2/Makefile b/drivers/char/ip2/Makefile index 6bfe2543ddc2..939618f62fe1 100644 --- a/drivers/char/ip2/Makefile +++ b/drivers/char/ip2/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Computone IntelliPort Plus Driver | 2 | # Makefile for the Computone IntelliPort Plus Driver |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_COMPUTONE) += ip2.o ip2main.o | 5 | obj-$(CONFIG_COMPUTONE) += ip2.o |
6 | 6 | ||
7 | ip2-objs := ip2base.o | 7 | ip2-objs := ip2base.o ip2main.o |
8 | 8 | ||
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 70957acaa960..c12cf8fc4be0 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -346,27 +346,6 @@ have_requested_irq( char irq ) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /******************************************************************************/ | 348 | /******************************************************************************/ |
349 | /* Function: init_module() */ | ||
350 | /* Parameters: None */ | ||
351 | /* Returns: Success (0) */ | ||
352 | /* */ | ||
353 | /* Description: */ | ||
354 | /* This is a required entry point for an installable module. It simply calls */ | ||
355 | /* the driver initialisation function and returns what it returns. */ | ||
356 | /******************************************************************************/ | ||
357 | #ifdef MODULE | ||
358 | static int __init | ||
359 | ip2_init_module(void) | ||
360 | { | ||
361 | #ifdef IP2DEBUG_INIT | ||
362 | printk (KERN_DEBUG "Loading module ...\n" ); | ||
363 | #endif | ||
364 | return 0; | ||
365 | } | ||
366 | module_init(ip2_init_module); | ||
367 | #endif /* MODULE */ | ||
368 | |||
369 | /******************************************************************************/ | ||
370 | /* Function: cleanup_module() */ | 349 | /* Function: cleanup_module() */ |
371 | /* Parameters: None */ | 350 | /* Parameters: None */ |
372 | /* Returns: Nothing */ | 351 | /* Returns: Nothing */ |
@@ -779,8 +758,6 @@ out: | |||
779 | return err; | 758 | return err; |
780 | } | 759 | } |
781 | 760 | ||
782 | EXPORT_SYMBOL(ip2_loadmain); | ||
783 | |||
784 | /******************************************************************************/ | 761 | /******************************************************************************/ |
785 | /* Function: ip2_init_board() */ | 762 | /* Function: ip2_init_board() */ |
786 | /* Parameters: Index of board in configuration structure */ | 763 | /* Parameters: Index of board in configuration structure */ |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 9e9bad8bdcf4..dbce1263bdff 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -402,6 +402,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
402 | &sysrq_showstate_blocked_op, /* w */ | 402 | &sysrq_showstate_blocked_op, /* w */ |
403 | /* x: May be registered on ppc/powerpc for xmon */ | 403 | /* x: May be registered on ppc/powerpc for xmon */ |
404 | NULL, /* x */ | 404 | NULL, /* x */ |
405 | /* y: May be registered on sparc64 for global register dump */ | ||
405 | NULL, /* y */ | 406 | NULL, /* y */ |
406 | NULL /* z */ | 407 | NULL /* z */ |
407 | }; | 408 | }; |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 3d3e1c2b310f..65fb848e1cce 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 7 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
8 | * Ryan Arnold <ryanarn@us.ibm.com> | 8 | * Ryan Arnold <ryanarn@us.ibm.com> |
9 | * Colin Devilbiss <devilbis@us.ibm.com> | 9 | * Colin Devilbiss <devilbis@us.ibm.com> |
10 | * Stephen Rothwell <sfr@au1.ibm.com> | 10 | * Stephen Rothwell |
11 | * | 11 | * |
12 | * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation | 12 | * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation |
13 | * | 13 | * |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 58aad63831f4..c39ddaff5e8f 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
7 | * Ryan Arnold <ryanarn@us.ibm.com> | 7 | * Ryan Arnold <ryanarn@us.ibm.com> |
8 | * Colin Devilbiss <devilbis@us.ibm.com> | 8 | * Colin Devilbiss <devilbis@us.ibm.com> |
9 | * Stephen Rothwell <sfr@au1.ibm.com> | 9 | * Stephen Rothwell |
10 | * | 10 | * |
11 | * (C) Copyright 2000-2004 IBM Corporation | 11 | * (C) Copyright 2000-2004 IBM Corporation |
12 | * | 12 | * |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7fce038fa57e..86f0a2430624 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -928,13 +928,13 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
928 | policy->user_policy.policy = policy->policy; | 928 | policy->user_policy.policy = policy->policy; |
929 | policy->user_policy.governor = policy->governor; | 929 | policy->user_policy.governor = policy->governor; |
930 | 930 | ||
931 | unlock_policy_rwsem_write(cpu); | ||
932 | |||
933 | if (ret) { | 931 | if (ret) { |
934 | dprintk("setting policy failed\n"); | 932 | dprintk("setting policy failed\n"); |
935 | goto err_out_unregister; | 933 | goto err_out_unregister; |
936 | } | 934 | } |
937 | 935 | ||
936 | unlock_policy_rwsem_write(cpu); | ||
937 | |||
938 | kobject_uevent(&policy->kobj, KOBJ_ADD); | 938 | kobject_uevent(&policy->kobj, KOBJ_ADD); |
939 | module_put(cpufreq_driver->owner); | 939 | module_put(cpufreq_driver->owner); |
940 | dprintk("initialization complete\n"); | 940 | dprintk("initialization complete\n"); |
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index ae6cd60d5c14..b64c6bc445e3 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -2,6 +2,11 @@ | |||
2 | * linux/drivers/cpufreq/freq_table.c | 2 | * linux/drivers/cpufreq/freq_table.c |
3 | * | 3 | * |
4 | * Copyright (C) 2002 - 2003 Dominik Brodowski | 4 | * Copyright (C) 2002 - 2003 Dominik Brodowski |
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
5 | */ | 10 | */ |
6 | 11 | ||
7 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 762b729672e0..0ec0f431e6a1 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
821 | 821 | ||
822 | dev_dbg(device->common.dev, "%s\n", __func__); | 822 | dev_dbg(device->common.dev, "%s\n", __func__); |
823 | 823 | ||
824 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 824 | src = kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
825 | if (!src) | 825 | if (!src) |
826 | return -ENOMEM; | 826 | return -ENOMEM; |
827 | dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 827 | dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
828 | if (!dest) { | 828 | if (!dest) { |
829 | kfree(src); | 829 | kfree(src); |
830 | return -ENOMEM; | 830 | return -ENOMEM; |
@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) | 834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) |
835 | ((u8 *) src)[i] = (u8)i; | 835 | ((u8 *) src)[i] = (u8)i; |
836 | 836 | ||
837 | memset(dest, 0, IOP_ADMA_TEST_SIZE); | ||
838 | |||
839 | /* Start copy, using first DMA channel */ | 837 | /* Start copy, using first DMA channel */ |
840 | dma_chan = container_of(device->common.channels.next, | 838 | dma_chan = container_of(device->common.channels.next, |
841 | struct dma_chan, | 839 | struct dma_chan, |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 065732ddf40c..d49361bfe670 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
22 | #include <linux/of_device.h> | 22 | #include <linux/of_device.h> |
23 | #include <asm/mpc85xx.h> | ||
24 | #include "edac_module.h" | 23 | #include "edac_module.h" |
25 | #include "edac_core.h" | 24 | #include "edac_core.h" |
26 | #include "mpc85xx_edac.h" | 25 | #include "mpc85xx_edac.h" |
@@ -43,8 +42,6 @@ static u32 orig_pci_err_en; | |||
43 | static u32 orig_l2_err_disable; | 42 | static u32 orig_l2_err_disable; |
44 | static u32 orig_hid1; | 43 | static u32 orig_hid1; |
45 | 44 | ||
46 | static const char *mpc85xx_ctl_name = "MPC85xx"; | ||
47 | |||
48 | /************************ MC SYSFS parts ***********************************/ | 45 | /************************ MC SYSFS parts ***********************************/ |
49 | 46 | ||
50 | static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci, | 47 | static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci, |
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 4a541921a14a..dda14015e873 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -113,6 +113,11 @@ static int fw_device_op_open(struct inode *inode, struct file *file) | |||
113 | if (device == NULL) | 113 | if (device == NULL) |
114 | return -ENODEV; | 114 | return -ENODEV; |
115 | 115 | ||
116 | if (fw_device_is_shutdown(device)) { | ||
117 | fw_device_put(device); | ||
118 | return -ENODEV; | ||
119 | } | ||
120 | |||
116 | client = kzalloc(sizeof(*client), GFP_KERNEL); | 121 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
117 | if (client == NULL) { | 122 | if (client == NULL) { |
118 | fw_device_put(device); | 123 | fw_device_put(device); |
@@ -901,6 +906,9 @@ fw_device_op_ioctl(struct file *file, | |||
901 | { | 906 | { |
902 | struct client *client = file->private_data; | 907 | struct client *client = file->private_data; |
903 | 908 | ||
909 | if (fw_device_is_shutdown(client->device)) | ||
910 | return -ENODEV; | ||
911 | |||
904 | return dispatch_ioctl(client, cmd, (void __user *) arg); | 912 | return dispatch_ioctl(client, cmd, (void __user *) arg); |
905 | } | 913 | } |
906 | 914 | ||
@@ -911,6 +919,9 @@ fw_device_op_compat_ioctl(struct file *file, | |||
911 | { | 919 | { |
912 | struct client *client = file->private_data; | 920 | struct client *client = file->private_data; |
913 | 921 | ||
922 | if (fw_device_is_shutdown(client->device)) | ||
923 | return -ENODEV; | ||
924 | |||
914 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); | 925 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); |
915 | } | 926 | } |
916 | #endif | 927 | #endif |
@@ -922,6 +933,9 @@ static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) | |||
922 | unsigned long size; | 933 | unsigned long size; |
923 | int page_count, retval; | 934 | int page_count, retval; |
924 | 935 | ||
936 | if (fw_device_is_shutdown(client->device)) | ||
937 | return -ENODEV; | ||
938 | |||
925 | /* FIXME: We could support multiple buffers, but we don't. */ | 939 | /* FIXME: We could support multiple buffers, but we don't. */ |
926 | if (client->buffer.pages != NULL) | 940 | if (client->buffer.pages != NULL) |
927 | return -EBUSY; | 941 | return -EBUSY; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 7f138c6195ff..beaf6b3a37dc 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -127,7 +127,7 @@ int __init gpiochip_reserve(int start, int ngpio) | |||
127 | unsigned long flags; | 127 | unsigned long flags; |
128 | int i; | 128 | int i; |
129 | 129 | ||
130 | if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio)) | 130 | if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio - 1)) |
131 | return -EINVAL; | 131 | return -EINVAL; |
132 | 132 | ||
133 | spin_lock_irqsave(&gpio_lock, flags); | 133 | spin_lock_irqsave(&gpio_lock, flags); |
@@ -170,7 +170,7 @@ int gpiochip_add(struct gpio_chip *chip) | |||
170 | unsigned id; | 170 | unsigned id; |
171 | int base = chip->base; | 171 | int base = chip->base; |
172 | 172 | ||
173 | if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio)) | 173 | if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio - 1)) |
174 | && base >= 0) { | 174 | && base >= 0) { |
175 | status = -EINVAL; | 175 | status = -EINVAL; |
176 | goto fail; | 176 | goto fail; |
@@ -207,7 +207,7 @@ fail: | |||
207 | /* failures here can mean systems won't boot... */ | 207 | /* failures here can mean systems won't boot... */ |
208 | if (status) | 208 | if (status) |
209 | pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", | 209 | pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", |
210 | chip->base, chip->base + chip->ngpio, | 210 | chip->base, chip->base + chip->ngpio - 1, |
211 | chip->label ? : "generic"); | 211 | chip->label ? : "generic"); |
212 | return status; | 212 | return status; |
213 | } | 213 | } |
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c index 7fb5b9d009d4..7f92fdd5f0e2 100644 --- a/drivers/gpio/mcp23s08.c +++ b/drivers/gpio/mcp23s08.c | |||
@@ -168,7 +168,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
168 | { | 168 | { |
169 | struct mcp23s08 *mcp; | 169 | struct mcp23s08 *mcp; |
170 | char bank; | 170 | char bank; |
171 | unsigned t; | 171 | int t; |
172 | unsigned mask; | 172 | unsigned mask; |
173 | 173 | ||
174 | mcp = container_of(chip, struct mcp23s08, chip); | 174 | mcp = container_of(chip, struct mcp23s08, chip); |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 93f916720b13..7e40e8a55edf 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -30,6 +30,7 @@ static const struct i2c_device_id pca953x_id[] = { | |||
30 | { "pca9537", 4, }, | 30 | { "pca9537", 4, }, |
31 | { "pca9538", 8, }, | 31 | { "pca9538", 8, }, |
32 | { "pca9539", 16, }, | 32 | { "pca9539", 16, }, |
33 | { "pca9554", 8, }, | ||
33 | { "pca9555", 16, }, | 34 | { "pca9555", 16, }, |
34 | { "pca9557", 8, }, | 35 | { "pca9557", 8, }, |
35 | /* REVISIT several pca955x parts should work here too */ | 36 | /* REVISIT several pca955x parts should work here too */ |
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index f88714b06000..47ac1a7d66e1 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hid-debug.h,v 1.8 2001/09/25 09:37:57 vojtech Exp $ | ||
3 | * | ||
4 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> | 2 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> |
5 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> | 3 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> |
6 | * (c) 2007 Jiri Kosina | 4 | * (c) 2007 Jiri Kosina |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index c3eb3f13e2ca..5c52a20ad344 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $ | ||
3 | * | ||
4 | * Copyright (c) 2000-2001 Vojtech Pavlik | 2 | * Copyright (c) 2000-2001 Vojtech Pavlik |
5 | * Copyright (c) 2006-2007 Jiri Kosina | 3 | * Copyright (c) 2006-2007 Jiri Kosina |
6 | * | 4 | * |
@@ -218,8 +216,9 @@ int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
218 | } | 216 | } |
219 | } | 217 | } |
220 | 218 | ||
221 | if (test_bit(usage->code, hid->pb_pressed_numlock) || | 219 | if (hid->quirks & HID_QUIRK_APPLE_NUMLOCK_EMULATION && ( |
222 | test_bit(LED_NUML, input->led)) { | 220 | test_bit(usage->code, hid->pb_pressed_numlock) || |
221 | test_bit(LED_NUML, input->led))) { | ||
223 | trans = find_translation(powerbook_numlock_keys, usage->code); | 222 | trans = find_translation(powerbook_numlock_keys, usage->code); |
224 | 223 | ||
225 | if (trans) { | 224 | if (trans) { |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index b93d91371b14..b98ec426b4d4 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -325,6 +325,10 @@ | |||
325 | #define USB_DEVICE_ID_MGE_UPS 0xffff | 325 | #define USB_DEVICE_ID_MGE_UPS 0xffff |
326 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 | 326 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 |
327 | 327 | ||
328 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 | ||
329 | #define USB_DEVICE_ID_PICKIT1 0x0032 | ||
330 | #define USB_DEVICE_ID_PICKIT2 0x0033 | ||
331 | |||
328 | #define USB_VENDOR_ID_MICROSOFT 0x045e | 332 | #define USB_VENDOR_ID_MICROSOFT 0x045e |
329 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b | 333 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b |
330 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d | 334 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d |
@@ -371,6 +375,9 @@ | |||
371 | #define USB_VENDOR_ID_SONY 0x054c | 375 | #define USB_VENDOR_ID_SONY 0x054c |
372 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | 376 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 |
373 | 377 | ||
378 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | ||
379 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038 | ||
380 | |||
374 | #define USB_VENDOR_ID_SUN 0x0430 | 381 | #define USB_VENDOR_ID_SUN 0x0430 |
375 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 382 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
376 | 383 | ||
@@ -567,6 +574,7 @@ static const struct hid_blacklist { | |||
567 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | 574 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, |
568 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | 575 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, |
569 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | 576 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, |
577 | { USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD, HID_QUIRK_IGNORE }, | ||
570 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, | 578 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, |
571 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, | 579 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, |
572 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, | 580 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, |
@@ -580,6 +588,9 @@ static const struct hid_blacklist { | |||
580 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, | 588 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, |
581 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, | 589 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, |
582 | 590 | ||
591 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1, HID_QUIRK_IGNORE }, | ||
592 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2, HID_QUIRK_IGNORE }, | ||
593 | |||
583 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | 594 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, |
584 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | 595 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, |
585 | 596 | ||
@@ -611,28 +622,28 @@ static const struct hid_blacklist { | |||
611 | 622 | ||
612 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 623 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
613 | 624 | ||
614 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
615 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
616 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
617 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
618 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
619 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
620 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
621 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
622 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
623 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
624 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 635 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 636 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, |
626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 637 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | 638 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, |
628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 639 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 640 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 641 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 642 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 643 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_HAS_FN }, | 644 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 645 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
635 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 646 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
636 | 647 | ||
637 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, | 648 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, |
638 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, | 649 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, |
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 5d9dbb47e4a8..3cd46d2e53c1 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: usbkbd.c,v 1.27 2001/12/27 10:37:41 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
5 | * | 3 | * |
6 | * USB HIDBP Keyboard support | 4 | * USB HIDBP Keyboard support |
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index df0d96d989de..703e9d0e8714 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: usbmouse.c,v 1.15 2001/12/27 10:37:41 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
5 | * | 3 | * |
6 | * USB HIDBP Mouse support | 4 | * USB HIDBP Mouse support |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4dc76bc45c9d..00ff53348491 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -330,6 +330,20 @@ config SENSORS_CORETEMP | |||
330 | sensor inside your CPU. Supported all are all known variants | 330 | sensor inside your CPU. Supported all are all known variants |
331 | of Intel Core family. | 331 | of Intel Core family. |
332 | 332 | ||
333 | config SENSORS_IBMAEM | ||
334 | tristate "IBM Active Energy Manager temperature/power sensors and control" | ||
335 | select IPMI_SI | ||
336 | depends on IPMI_HANDLER | ||
337 | help | ||
338 | If you say yes here you get support for the temperature and | ||
339 | power sensors and capping hardware in various IBM System X | ||
340 | servers that support Active Energy Manager. This includes | ||
341 | the x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2, | ||
342 | and certain HS2x/LS2x/QS2x blades. | ||
343 | |||
344 | This driver can also be built as a module. If so, the module | ||
345 | will be called ibmaem. | ||
346 | |||
333 | config SENSORS_IBMPEX | 347 | config SENSORS_IBMPEX |
334 | tristate "IBM PowerExecutive temperature/power sensors" | 348 | tristate "IBM PowerExecutive temperature/power sensors" |
335 | select IPMI_SI | 349 | select IPMI_SI |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 3bdb05a5cbd7..d098677e08de 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | |||
41 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | 41 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o |
42 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o | 42 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o |
43 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o | 43 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o |
44 | obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o | ||
44 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o | 45 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o |
45 | obj-$(CONFIG_SENSORS_IT87) += it87.o | 46 | obj-$(CONFIG_SENSORS_IT87) += it87.o |
46 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o | 47 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index bab5fd2e4dfd..88e89653daaf 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -515,6 +515,7 @@ static struct dmi_system_id __initdata hdaps_whitelist[] = { | |||
515 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), | 515 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), |
516 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), | 516 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), |
517 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"), | 517 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"), |
518 | HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61i"), | ||
518 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"), | 519 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"), |
519 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"), | 520 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"), |
520 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"), | 521 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"), |
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index 6ac5c6f53585..f9e2ed621f7b 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -111,6 +111,7 @@ struct i5k_amb_data { | |||
111 | void __iomem *amb_mmio; | 111 | void __iomem *amb_mmio; |
112 | struct i5k_device_attribute *attrs; | 112 | struct i5k_device_attribute *attrs; |
113 | unsigned int num_attrs; | 113 | unsigned int num_attrs; |
114 | unsigned long chipset_id; | ||
114 | }; | 115 | }; |
115 | 116 | ||
116 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | 117 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, |
@@ -382,7 +383,8 @@ err: | |||
382 | return res; | 383 | return res; |
383 | } | 384 | } |
384 | 385 | ||
385 | static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | 386 | static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data, |
387 | unsigned long devid) | ||
386 | { | 388 | { |
387 | struct pci_dev *pcidev; | 389 | struct pci_dev *pcidev; |
388 | u32 val32; | 390 | u32 val32; |
@@ -390,7 +392,7 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | |||
390 | 392 | ||
391 | /* Find AMB register memory space */ | 393 | /* Find AMB register memory space */ |
392 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, | 394 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, |
393 | PCI_DEVICE_ID_INTEL_5000_ERR, | 395 | devid, |
394 | NULL); | 396 | NULL); |
395 | if (!pcidev) | 397 | if (!pcidev) |
396 | return -ENODEV; | 398 | return -ENODEV; |
@@ -409,6 +411,8 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | |||
409 | goto out; | 411 | goto out; |
410 | } | 412 | } |
411 | 413 | ||
414 | data->chipset_id = devid; | ||
415 | |||
412 | res = 0; | 416 | res = 0; |
413 | out: | 417 | out: |
414 | pci_dev_put(pcidev); | 418 | pci_dev_put(pcidev); |
@@ -441,10 +445,30 @@ out: | |||
441 | return res; | 445 | return res; |
442 | } | 446 | } |
443 | 447 | ||
448 | static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data, | ||
449 | unsigned long channel) | ||
450 | { | ||
451 | switch (data->chipset_id) { | ||
452 | case PCI_DEVICE_ID_INTEL_5000_ERR: | ||
453 | return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel; | ||
454 | case PCI_DEVICE_ID_INTEL_5400_ERR: | ||
455 | return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel; | ||
456 | default: | ||
457 | BUG(); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | static unsigned long chipset_ids[] = { | ||
462 | PCI_DEVICE_ID_INTEL_5000_ERR, | ||
463 | PCI_DEVICE_ID_INTEL_5400_ERR, | ||
464 | 0 | ||
465 | }; | ||
466 | |||
444 | static int __devinit i5k_amb_probe(struct platform_device *pdev) | 467 | static int __devinit i5k_amb_probe(struct platform_device *pdev) |
445 | { | 468 | { |
446 | struct i5k_amb_data *data; | 469 | struct i5k_amb_data *data; |
447 | struct resource *reso; | 470 | struct resource *reso; |
471 | int i; | ||
448 | int res = -ENODEV; | 472 | int res = -ENODEV; |
449 | 473 | ||
450 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 474 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -452,19 +476,24 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev) | |||
452 | return -ENOMEM; | 476 | return -ENOMEM; |
453 | 477 | ||
454 | /* Figure out where the AMB registers live */ | 478 | /* Figure out where the AMB registers live */ |
455 | res = i5k_find_amb_registers(data); | 479 | i = 0; |
480 | do { | ||
481 | res = i5k_find_amb_registers(data, chipset_ids[i]); | ||
482 | i++; | ||
483 | } while (res && chipset_ids[i]); | ||
484 | |||
456 | if (res) | 485 | if (res) |
457 | goto err; | 486 | goto err; |
458 | 487 | ||
459 | /* Copy the DIMM presence map for the first two channels */ | 488 | /* Copy the DIMM presence map for the first two channels */ |
460 | res = i5k_channel_probe(&data->amb_present[0], | 489 | res = i5k_channel_probe(&data->amb_present[0], |
461 | PCI_DEVICE_ID_INTEL_5000_FBD0); | 490 | i5k_channel_pci_id(data, 0)); |
462 | if (res) | 491 | if (res) |
463 | goto err; | 492 | goto err; |
464 | 493 | ||
465 | /* Copy the DIMM presence map for the optional second two channels */ | 494 | /* Copy the DIMM presence map for the optional second two channels */ |
466 | i5k_channel_probe(&data->amb_present[2], | 495 | i5k_channel_probe(&data->amb_present[2], |
467 | PCI_DEVICE_ID_INTEL_5000_FBD1); | 496 | i5k_channel_pci_id(data, 1)); |
468 | 497 | ||
469 | /* Set up resource regions */ | 498 | /* Set up resource regions */ |
470 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); | 499 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); |
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c new file mode 100644 index 000000000000..5c006c9a4311 --- /dev/null +++ b/drivers/hwmon/ibmaem.c | |||
@@ -0,0 +1,1111 @@ | |||
1 | /* | ||
2 | * A hwmon driver for the IBM Active Energy Manager temperature/power sensors | ||
3 | * and capping functionality. | ||
4 | * Copyright (C) 2008 IBM | ||
5 | * | ||
6 | * Author: Darrick J. Wong <djwong@us.ibm.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/ipmi.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/hwmon.h> | ||
26 | #include <linux/hwmon-sysfs.h> | ||
27 | #include <linux/jiffies.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/kdev_t.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/idr.h> | ||
32 | #include <linux/sched.h> | ||
33 | #include <linux/platform_device.h> | ||
34 | #include <linux/math64.h> | ||
35 | #include <linux/time.h> | ||
36 | |||
37 | #define REFRESH_INTERVAL (HZ) | ||
38 | #define IPMI_TIMEOUT (30 * HZ) | ||
39 | #define DRVNAME "aem" | ||
40 | |||
41 | #define AEM_NETFN 0x2E | ||
42 | |||
43 | #define AEM_FIND_FW_CMD 0x80 | ||
44 | #define AEM_ELEMENT_CMD 0x81 | ||
45 | #define AEM_FW_INSTANCE_CMD 0x82 | ||
46 | |||
47 | #define AEM_READ_ELEMENT_CFG 0x80 | ||
48 | #define AEM_READ_BUFFER 0x81 | ||
49 | #define AEM_READ_REGISTER 0x82 | ||
50 | #define AEM_WRITE_REGISTER 0x83 | ||
51 | #define AEM_SET_REG_MASK 0x84 | ||
52 | #define AEM_CLEAR_REG_MASK 0x85 | ||
53 | #define AEM_READ_ELEMENT_CFG2 0x86 | ||
54 | |||
55 | #define AEM_CONTROL_ELEMENT 0 | ||
56 | #define AEM_ENERGY_ELEMENT 1 | ||
57 | #define AEM_CLOCK_ELEMENT 4 | ||
58 | #define AEM_POWER_CAP_ELEMENT 7 | ||
59 | #define AEM_EXHAUST_ELEMENT 9 | ||
60 | #define AEM_POWER_ELEMENT 10 | ||
61 | |||
62 | #define AEM_MODULE_TYPE_ID 0x0001 | ||
63 | |||
64 | #define AEM2_NUM_ENERGY_REGS 2 | ||
65 | #define AEM2_NUM_PCAP_REGS 6 | ||
66 | #define AEM2_NUM_TEMP_REGS 2 | ||
67 | #define AEM2_NUM_SENSORS 14 | ||
68 | |||
69 | #define AEM1_NUM_ENERGY_REGS 1 | ||
70 | #define AEM1_NUM_SENSORS 3 | ||
71 | |||
72 | /* AEM 2.x has more energy registers */ | ||
73 | #define AEM_NUM_ENERGY_REGS AEM2_NUM_ENERGY_REGS | ||
74 | /* AEM 2.x needs more sensor files */ | ||
75 | #define AEM_NUM_SENSORS AEM2_NUM_SENSORS | ||
76 | |||
77 | #define POWER_CAP 0 | ||
78 | #define POWER_CAP_MAX_HOTPLUG 1 | ||
79 | #define POWER_CAP_MAX 2 | ||
80 | #define POWER_CAP_MIN_WARNING 3 | ||
81 | #define POWER_CAP_MIN 4 | ||
82 | #define POWER_AUX 5 | ||
83 | |||
84 | #define AEM_DEFAULT_POWER_INTERVAL 1000 | ||
85 | #define AEM_MIN_POWER_INTERVAL 200 | ||
86 | #define UJ_PER_MJ 1000L | ||
87 | |||
88 | static DEFINE_IDR(aem_idr); | ||
89 | static DEFINE_SPINLOCK(aem_idr_lock); | ||
90 | |||
91 | static struct device_driver aem_driver = { | ||
92 | .name = DRVNAME, | ||
93 | .bus = &platform_bus_type, | ||
94 | }; | ||
95 | |||
96 | struct aem_ipmi_data { | ||
97 | struct completion read_complete; | ||
98 | struct ipmi_addr address; | ||
99 | ipmi_user_t user; | ||
100 | int interface; | ||
101 | |||
102 | struct kernel_ipmi_msg tx_message; | ||
103 | long tx_msgid; | ||
104 | |||
105 | void *rx_msg_data; | ||
106 | unsigned short rx_msg_len; | ||
107 | unsigned char rx_result; | ||
108 | int rx_recv_type; | ||
109 | |||
110 | struct device *bmc_device; | ||
111 | }; | ||
112 | |||
113 | struct aem_ro_sensor_template { | ||
114 | char *label; | ||
115 | ssize_t (*show)(struct device *dev, | ||
116 | struct device_attribute *devattr, | ||
117 | char *buf); | ||
118 | int index; | ||
119 | }; | ||
120 | |||
121 | struct aem_rw_sensor_template { | ||
122 | char *label; | ||
123 | ssize_t (*show)(struct device *dev, | ||
124 | struct device_attribute *devattr, | ||
125 | char *buf); | ||
126 | ssize_t (*set)(struct device *dev, | ||
127 | struct device_attribute *devattr, | ||
128 | const char *buf, size_t count); | ||
129 | int index; | ||
130 | }; | ||
131 | |||
132 | struct aem_data { | ||
133 | struct list_head list; | ||
134 | |||
135 | struct device *hwmon_dev; | ||
136 | struct platform_device *pdev; | ||
137 | struct mutex lock; | ||
138 | char valid; | ||
139 | unsigned long last_updated; /* In jiffies */ | ||
140 | u8 ver_major; | ||
141 | u8 ver_minor; | ||
142 | u8 module_handle; | ||
143 | int id; | ||
144 | struct aem_ipmi_data ipmi; | ||
145 | |||
146 | /* Function to update sensors */ | ||
147 | void (*update)(struct aem_data *data); | ||
148 | |||
149 | /* | ||
150 | * AEM 1.x sensors: | ||
151 | * Available sensors: | ||
152 | * Energy meter | ||
153 | * Power meter | ||
154 | * | ||
155 | * AEM 2.x sensors: | ||
156 | * Two energy meters | ||
157 | * Two power meters | ||
158 | * Two temperature sensors | ||
159 | * Six power cap registers | ||
160 | */ | ||
161 | |||
162 | /* sysfs attrs */ | ||
163 | struct sensor_device_attribute sensors[AEM_NUM_SENSORS]; | ||
164 | |||
165 | /* energy use in mJ */ | ||
166 | u64 energy[AEM_NUM_ENERGY_REGS]; | ||
167 | |||
168 | /* power sampling interval in ms */ | ||
169 | unsigned long power_period[AEM_NUM_ENERGY_REGS]; | ||
170 | |||
171 | /* Everything past here is for AEM2 only */ | ||
172 | |||
173 | /* power caps in dW */ | ||
174 | u16 pcap[AEM2_NUM_PCAP_REGS]; | ||
175 | |||
176 | /* exhaust temperature in C */ | ||
177 | u8 temp[AEM2_NUM_TEMP_REGS]; | ||
178 | }; | ||
179 | |||
180 | /* Data structures returned by the AEM firmware */ | ||
181 | struct aem_iana_id { | ||
182 | u8 bytes[3]; | ||
183 | }; | ||
184 | static struct aem_iana_id system_x_id = { | ||
185 | .bytes = {0x4D, 0x4F, 0x00} | ||
186 | }; | ||
187 | |||
188 | /* These are used to find AEM1 instances */ | ||
189 | struct aem_find_firmware_req { | ||
190 | struct aem_iana_id id; | ||
191 | u8 rsvd; | ||
192 | u16 index; | ||
193 | u16 module_type_id; | ||
194 | } __packed; | ||
195 | |||
196 | struct aem_find_firmware_resp { | ||
197 | struct aem_iana_id id; | ||
198 | u8 num_instances; | ||
199 | } __packed; | ||
200 | |||
201 | /* These are used to find AEM2 instances */ | ||
202 | struct aem_find_instance_req { | ||
203 | struct aem_iana_id id; | ||
204 | u8 instance_number; | ||
205 | u16 module_type_id; | ||
206 | } __packed; | ||
207 | |||
208 | struct aem_find_instance_resp { | ||
209 | struct aem_iana_id id; | ||
210 | u8 num_instances; | ||
211 | u8 major; | ||
212 | u8 minor; | ||
213 | u8 module_handle; | ||
214 | u16 record_id; | ||
215 | } __packed; | ||
216 | |||
217 | /* These are used to query sensors */ | ||
218 | struct aem_read_sensor_req { | ||
219 | struct aem_iana_id id; | ||
220 | u8 module_handle; | ||
221 | u8 element; | ||
222 | u8 subcommand; | ||
223 | u8 reg; | ||
224 | u8 rx_buf_size; | ||
225 | } __packed; | ||
226 | |||
227 | struct aem_read_sensor_resp { | ||
228 | struct aem_iana_id id; | ||
229 | u8 bytes[0]; | ||
230 | } __packed; | ||
231 | |||
232 | /* Data structures to talk to the IPMI layer */ | ||
233 | struct aem_driver_data { | ||
234 | struct list_head aem_devices; | ||
235 | struct ipmi_smi_watcher bmc_events; | ||
236 | struct ipmi_user_hndl ipmi_hndlrs; | ||
237 | }; | ||
238 | |||
239 | static void aem_register_bmc(int iface, struct device *dev); | ||
240 | static void aem_bmc_gone(int iface); | ||
241 | static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data); | ||
242 | |||
243 | static void aem_remove_sensors(struct aem_data *data); | ||
244 | static int aem_init_aem1(struct aem_ipmi_data *probe); | ||
245 | static int aem_init_aem2(struct aem_ipmi_data *probe); | ||
246 | static int aem1_find_sensors(struct aem_data *data); | ||
247 | static int aem2_find_sensors(struct aem_data *data); | ||
248 | static void update_aem1_sensors(struct aem_data *data); | ||
249 | static void update_aem2_sensors(struct aem_data *data); | ||
250 | |||
251 | static struct aem_driver_data driver_data = { | ||
252 | .aem_devices = LIST_HEAD_INIT(driver_data.aem_devices), | ||
253 | .bmc_events = { | ||
254 | .owner = THIS_MODULE, | ||
255 | .new_smi = aem_register_bmc, | ||
256 | .smi_gone = aem_bmc_gone, | ||
257 | }, | ||
258 | .ipmi_hndlrs = { | ||
259 | .ipmi_recv_hndl = aem_msg_handler, | ||
260 | }, | ||
261 | }; | ||
262 | |||
263 | /* Functions to talk to the IPMI layer */ | ||
264 | |||
265 | /* Initialize IPMI address, message buffers and user data */ | ||
266 | static int aem_init_ipmi_data(struct aem_ipmi_data *data, int iface, | ||
267 | struct device *bmc) | ||
268 | { | ||
269 | int err; | ||
270 | |||
271 | init_completion(&data->read_complete); | ||
272 | data->bmc_device = bmc; | ||
273 | |||
274 | /* Initialize IPMI address */ | ||
275 | data->address.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; | ||
276 | data->address.channel = IPMI_BMC_CHANNEL; | ||
277 | data->address.data[0] = 0; | ||
278 | data->interface = iface; | ||
279 | |||
280 | /* Initialize message buffers */ | ||
281 | data->tx_msgid = 0; | ||
282 | data->tx_message.netfn = AEM_NETFN; | ||
283 | |||
284 | /* Create IPMI messaging interface user */ | ||
285 | err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, | ||
286 | data, &data->user); | ||
287 | if (err < 0) { | ||
288 | dev_err(bmc, "Unable to register user with IPMI " | ||
289 | "interface %d\n", data->interface); | ||
290 | return -EACCES; | ||
291 | } | ||
292 | |||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | /* Send an IPMI command */ | ||
297 | static int aem_send_message(struct aem_ipmi_data *data) | ||
298 | { | ||
299 | int err; | ||
300 | |||
301 | err = ipmi_validate_addr(&data->address, sizeof(data->address)); | ||
302 | if (err) | ||
303 | goto out; | ||
304 | |||
305 | data->tx_msgid++; | ||
306 | err = ipmi_request_settime(data->user, &data->address, data->tx_msgid, | ||
307 | &data->tx_message, data, 0, 0, 0); | ||
308 | if (err) | ||
309 | goto out1; | ||
310 | |||
311 | return 0; | ||
312 | out1: | ||
313 | dev_err(data->bmc_device, "request_settime=%x\n", err); | ||
314 | return err; | ||
315 | out: | ||
316 | dev_err(data->bmc_device, "validate_addr=%x\n", err); | ||
317 | return err; | ||
318 | } | ||
319 | |||
320 | /* Dispatch IPMI messages to callers */ | ||
321 | static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | ||
322 | { | ||
323 | unsigned short rx_len; | ||
324 | struct aem_ipmi_data *data = user_msg_data; | ||
325 | |||
326 | if (msg->msgid != data->tx_msgid) { | ||
327 | dev_err(data->bmc_device, "Mismatch between received msgid " | ||
328 | "(%02x) and transmitted msgid (%02x)!\n", | ||
329 | (int)msg->msgid, | ||
330 | (int)data->tx_msgid); | ||
331 | ipmi_free_recv_msg(msg); | ||
332 | return; | ||
333 | } | ||
334 | |||
335 | data->rx_recv_type = msg->recv_type; | ||
336 | if (msg->msg.data_len > 0) | ||
337 | data->rx_result = msg->msg.data[0]; | ||
338 | else | ||
339 | data->rx_result = IPMI_UNKNOWN_ERR_COMPLETION_CODE; | ||
340 | |||
341 | if (msg->msg.data_len > 1) { | ||
342 | rx_len = msg->msg.data_len - 1; | ||
343 | if (data->rx_msg_len < rx_len) | ||
344 | rx_len = data->rx_msg_len; | ||
345 | data->rx_msg_len = rx_len; | ||
346 | memcpy(data->rx_msg_data, msg->msg.data + 1, data->rx_msg_len); | ||
347 | } else | ||
348 | data->rx_msg_len = 0; | ||
349 | |||
350 | ipmi_free_recv_msg(msg); | ||
351 | complete(&data->read_complete); | ||
352 | } | ||
353 | |||
354 | /* ID functions */ | ||
355 | |||
356 | /* Obtain an id */ | ||
357 | static int aem_idr_get(int *id) | ||
358 | { | ||
359 | int i, err; | ||
360 | |||
361 | again: | ||
362 | if (unlikely(!idr_pre_get(&aem_idr, GFP_KERNEL))) | ||
363 | return -ENOMEM; | ||
364 | |||
365 | spin_lock(&aem_idr_lock); | ||
366 | err = idr_get_new(&aem_idr, NULL, &i); | ||
367 | spin_unlock(&aem_idr_lock); | ||
368 | |||
369 | if (unlikely(err == -EAGAIN)) | ||
370 | goto again; | ||
371 | else if (unlikely(err)) | ||
372 | return err; | ||
373 | |||
374 | *id = i & MAX_ID_MASK; | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | /* Release an object ID */ | ||
379 | static void aem_idr_put(int id) | ||
380 | { | ||
381 | spin_lock(&aem_idr_lock); | ||
382 | idr_remove(&aem_idr, id); | ||
383 | spin_unlock(&aem_idr_lock); | ||
384 | } | ||
385 | |||
386 | /* Sensor support functions */ | ||
387 | |||
388 | /* Read a sensor value */ | ||
389 | static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, | ||
390 | void *buf, size_t size) | ||
391 | { | ||
392 | int rs_size, res; | ||
393 | struct aem_read_sensor_req rs_req; | ||
394 | struct aem_read_sensor_resp *rs_resp; | ||
395 | struct aem_ipmi_data *ipmi = &data->ipmi; | ||
396 | |||
397 | /* AEM registers are 1, 2, 4 or 8 bytes */ | ||
398 | switch (size) { | ||
399 | case 1: | ||
400 | case 2: | ||
401 | case 4: | ||
402 | case 8: | ||
403 | break; | ||
404 | default: | ||
405 | return -EINVAL; | ||
406 | } | ||
407 | |||
408 | rs_req.id = system_x_id; | ||
409 | rs_req.module_handle = data->module_handle; | ||
410 | rs_req.element = elt; | ||
411 | rs_req.subcommand = AEM_READ_REGISTER; | ||
412 | rs_req.reg = reg; | ||
413 | rs_req.rx_buf_size = size; | ||
414 | |||
415 | ipmi->tx_message.cmd = AEM_ELEMENT_CMD; | ||
416 | ipmi->tx_message.data = (char *)&rs_req; | ||
417 | ipmi->tx_message.data_len = sizeof(rs_req); | ||
418 | |||
419 | rs_size = sizeof(*rs_resp) + size; | ||
420 | rs_resp = kzalloc(rs_size, GFP_KERNEL); | ||
421 | if (!rs_resp) | ||
422 | return -ENOMEM; | ||
423 | |||
424 | ipmi->rx_msg_data = rs_resp; | ||
425 | ipmi->rx_msg_len = rs_size; | ||
426 | |||
427 | aem_send_message(ipmi); | ||
428 | |||
429 | res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT); | ||
430 | if (!res) | ||
431 | return -ETIMEDOUT; | ||
432 | |||
433 | if (ipmi->rx_result || ipmi->rx_msg_len != rs_size || | ||
434 | memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) { | ||
435 | kfree(rs_resp); | ||
436 | return -ENOENT; | ||
437 | } | ||
438 | |||
439 | switch (size) { | ||
440 | case 1: { | ||
441 | u8 *x = buf; | ||
442 | *x = rs_resp->bytes[0]; | ||
443 | break; | ||
444 | } | ||
445 | case 2: { | ||
446 | u16 *x = buf; | ||
447 | *x = be16_to_cpup((u16 *)rs_resp->bytes); | ||
448 | break; | ||
449 | } | ||
450 | case 4: { | ||
451 | u32 *x = buf; | ||
452 | *x = be32_to_cpup((u32 *)rs_resp->bytes); | ||
453 | break; | ||
454 | } | ||
455 | case 8: { | ||
456 | u64 *x = buf; | ||
457 | *x = be64_to_cpup((u64 *)rs_resp->bytes); | ||
458 | break; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | /* Update AEM energy registers */ | ||
466 | static void update_aem_energy(struct aem_data *data) | ||
467 | { | ||
468 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, 0, &data->energy[0], 8); | ||
469 | if (data->ver_major < 2) | ||
470 | return; | ||
471 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, 1, &data->energy[1], 8); | ||
472 | } | ||
473 | |||
474 | /* Update all AEM1 sensors */ | ||
475 | static void update_aem1_sensors(struct aem_data *data) | ||
476 | { | ||
477 | mutex_lock(&data->lock); | ||
478 | if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) && | ||
479 | data->valid) | ||
480 | goto out; | ||
481 | |||
482 | update_aem_energy(data); | ||
483 | out: | ||
484 | mutex_unlock(&data->lock); | ||
485 | } | ||
486 | |||
487 | /* Update all AEM2 sensors */ | ||
488 | static void update_aem2_sensors(struct aem_data *data) | ||
489 | { | ||
490 | int i; | ||
491 | |||
492 | mutex_lock(&data->lock); | ||
493 | if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) && | ||
494 | data->valid) | ||
495 | goto out; | ||
496 | |||
497 | update_aem_energy(data); | ||
498 | aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 0, &data->temp[0], 1); | ||
499 | aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 1, &data->temp[1], 1); | ||
500 | |||
501 | for (i = POWER_CAP; i <= POWER_AUX; i++) | ||
502 | aem_read_sensor(data, AEM_POWER_CAP_ELEMENT, i, | ||
503 | &data->pcap[i], 2); | ||
504 | out: | ||
505 | mutex_unlock(&data->lock); | ||
506 | } | ||
507 | |||
508 | /* Delete an AEM instance */ | ||
509 | static void aem_delete(struct aem_data *data) | ||
510 | { | ||
511 | list_del(&data->list); | ||
512 | aem_remove_sensors(data); | ||
513 | hwmon_device_unregister(data->hwmon_dev); | ||
514 | ipmi_destroy_user(data->ipmi.user); | ||
515 | dev_set_drvdata(&data->pdev->dev, NULL); | ||
516 | platform_device_unregister(data->pdev); | ||
517 | aem_idr_put(data->id); | ||
518 | kfree(data); | ||
519 | } | ||
520 | |||
521 | /* Probe functions for AEM1 devices */ | ||
522 | |||
523 | /* Retrieve version and module handle for an AEM1 instance */ | ||
524 | static int aem_find_aem1_count(struct aem_ipmi_data *data) | ||
525 | { | ||
526 | int res; | ||
527 | struct aem_find_firmware_req ff_req; | ||
528 | struct aem_find_firmware_resp ff_resp; | ||
529 | |||
530 | ff_req.id = system_x_id; | ||
531 | ff_req.index = 0; | ||
532 | ff_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID); | ||
533 | |||
534 | data->tx_message.cmd = AEM_FIND_FW_CMD; | ||
535 | data->tx_message.data = (char *)&ff_req; | ||
536 | data->tx_message.data_len = sizeof(ff_req); | ||
537 | |||
538 | data->rx_msg_data = &ff_resp; | ||
539 | data->rx_msg_len = sizeof(ff_resp); | ||
540 | |||
541 | aem_send_message(data); | ||
542 | |||
543 | res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); | ||
544 | if (!res) | ||
545 | return -ETIMEDOUT; | ||
546 | |||
547 | if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) || | ||
548 | memcmp(&ff_resp.id, &system_x_id, sizeof(system_x_id))) | ||
549 | return -ENOENT; | ||
550 | |||
551 | return ff_resp.num_instances; | ||
552 | } | ||
553 | |||
554 | /* Find and initialize one AEM1 instance */ | ||
555 | static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) | ||
556 | { | ||
557 | struct aem_data *data; | ||
558 | int i; | ||
559 | int res = -ENOMEM; | ||
560 | |||
561 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
562 | if (!data) | ||
563 | return res; | ||
564 | mutex_init(&data->lock); | ||
565 | |||
566 | /* Copy instance data */ | ||
567 | data->ver_major = 1; | ||
568 | data->ver_minor = 0; | ||
569 | data->module_handle = module_handle; | ||
570 | for (i = 0; i < AEM1_NUM_ENERGY_REGS; i++) | ||
571 | data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL; | ||
572 | |||
573 | /* Create sub-device for this fw instance */ | ||
574 | if (aem_idr_get(&data->id)) | ||
575 | goto id_err; | ||
576 | |||
577 | data->pdev = platform_device_alloc(DRVNAME, data->id); | ||
578 | if (!data->pdev) | ||
579 | goto dev_err; | ||
580 | data->pdev->dev.driver = &aem_driver; | ||
581 | |||
582 | res = platform_device_add(data->pdev); | ||
583 | if (res) | ||
584 | goto ipmi_err; | ||
585 | |||
586 | dev_set_drvdata(&data->pdev->dev, data); | ||
587 | |||
588 | /* Set up IPMI interface */ | ||
589 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, | ||
590 | probe->bmc_device)) | ||
591 | goto ipmi_err; | ||
592 | |||
593 | /* Register with hwmon */ | ||
594 | data->hwmon_dev = hwmon_device_register(&data->pdev->dev); | ||
595 | |||
596 | if (IS_ERR(data->hwmon_dev)) { | ||
597 | dev_err(&data->pdev->dev, "Unable to register hwmon " | ||
598 | "device for IPMI interface %d\n", | ||
599 | probe->interface); | ||
600 | goto hwmon_reg_err; | ||
601 | } | ||
602 | |||
603 | data->update = update_aem1_sensors; | ||
604 | |||
605 | /* Find sensors */ | ||
606 | if (aem1_find_sensors(data)) | ||
607 | goto sensor_err; | ||
608 | |||
609 | /* Add to our list of AEM devices */ | ||
610 | list_add_tail(&data->list, &driver_data.aem_devices); | ||
611 | |||
612 | dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n", | ||
613 | data->ver_major, data->ver_minor, | ||
614 | data->module_handle); | ||
615 | return 0; | ||
616 | |||
617 | sensor_err: | ||
618 | hwmon_device_unregister(data->hwmon_dev); | ||
619 | hwmon_reg_err: | ||
620 | ipmi_destroy_user(data->ipmi.user); | ||
621 | ipmi_err: | ||
622 | dev_set_drvdata(&data->pdev->dev, NULL); | ||
623 | platform_device_unregister(data->pdev); | ||
624 | dev_err: | ||
625 | aem_idr_put(data->id); | ||
626 | id_err: | ||
627 | kfree(data); | ||
628 | |||
629 | return res; | ||
630 | } | ||
631 | |||
632 | /* Find and initialize all AEM1 instances */ | ||
633 | static int aem_init_aem1(struct aem_ipmi_data *probe) | ||
634 | { | ||
635 | int num, i, err; | ||
636 | |||
637 | num = aem_find_aem1_count(probe); | ||
638 | for (i = 0; i < num; i++) { | ||
639 | err = aem_init_aem1_inst(probe, i); | ||
640 | if (err) { | ||
641 | dev_err(probe->bmc_device, | ||
642 | "Error %d initializing AEM1 0x%X\n", | ||
643 | err, i); | ||
644 | return err; | ||
645 | } | ||
646 | } | ||
647 | |||
648 | return 0; | ||
649 | } | ||
650 | |||
651 | /* Probe functions for AEM2 devices */ | ||
652 | |||
653 | /* Retrieve version and module handle for an AEM2 instance */ | ||
654 | static int aem_find_aem2(struct aem_ipmi_data *data, | ||
655 | struct aem_find_instance_resp *fi_resp, | ||
656 | int instance_num) | ||
657 | { | ||
658 | int res; | ||
659 | struct aem_find_instance_req fi_req; | ||
660 | |||
661 | fi_req.id = system_x_id; | ||
662 | fi_req.instance_number = instance_num; | ||
663 | fi_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID); | ||
664 | |||
665 | data->tx_message.cmd = AEM_FW_INSTANCE_CMD; | ||
666 | data->tx_message.data = (char *)&fi_req; | ||
667 | data->tx_message.data_len = sizeof(fi_req); | ||
668 | |||
669 | data->rx_msg_data = fi_resp; | ||
670 | data->rx_msg_len = sizeof(*fi_resp); | ||
671 | |||
672 | aem_send_message(data); | ||
673 | |||
674 | res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); | ||
675 | if (!res) | ||
676 | return -ETIMEDOUT; | ||
677 | |||
678 | if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) || | ||
679 | memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id))) | ||
680 | return -ENOENT; | ||
681 | |||
682 | return 0; | ||
683 | } | ||
684 | |||
685 | /* Find and initialize one AEM2 instance */ | ||
686 | static int aem_init_aem2_inst(struct aem_ipmi_data *probe, | ||
687 | struct aem_find_instance_resp *fi_resp) | ||
688 | { | ||
689 | struct aem_data *data; | ||
690 | int i; | ||
691 | int res = -ENOMEM; | ||
692 | |||
693 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
694 | if (!data) | ||
695 | return res; | ||
696 | mutex_init(&data->lock); | ||
697 | |||
698 | /* Copy instance data */ | ||
699 | data->ver_major = fi_resp->major; | ||
700 | data->ver_minor = fi_resp->minor; | ||
701 | data->module_handle = fi_resp->module_handle; | ||
702 | for (i = 0; i < AEM2_NUM_ENERGY_REGS; i++) | ||
703 | data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL; | ||
704 | |||
705 | /* Create sub-device for this fw instance */ | ||
706 | if (aem_idr_get(&data->id)) | ||
707 | goto id_err; | ||
708 | |||
709 | data->pdev = platform_device_alloc(DRVNAME, data->id); | ||
710 | if (!data->pdev) | ||
711 | goto dev_err; | ||
712 | data->pdev->dev.driver = &aem_driver; | ||
713 | |||
714 | res = platform_device_add(data->pdev); | ||
715 | if (res) | ||
716 | goto ipmi_err; | ||
717 | |||
718 | dev_set_drvdata(&data->pdev->dev, data); | ||
719 | |||
720 | /* Set up IPMI interface */ | ||
721 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, | ||
722 | probe->bmc_device)) | ||
723 | goto ipmi_err; | ||
724 | |||
725 | /* Register with hwmon */ | ||
726 | data->hwmon_dev = hwmon_device_register(&data->pdev->dev); | ||
727 | |||
728 | if (IS_ERR(data->hwmon_dev)) { | ||
729 | dev_err(&data->pdev->dev, "Unable to register hwmon " | ||
730 | "device for IPMI interface %d\n", | ||
731 | probe->interface); | ||
732 | goto hwmon_reg_err; | ||
733 | } | ||
734 | |||
735 | data->update = update_aem2_sensors; | ||
736 | |||
737 | /* Find sensors */ | ||
738 | if (aem2_find_sensors(data)) | ||
739 | goto sensor_err; | ||
740 | |||
741 | /* Add to our list of AEM devices */ | ||
742 | list_add_tail(&data->list, &driver_data.aem_devices); | ||
743 | |||
744 | dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n", | ||
745 | data->ver_major, data->ver_minor, | ||
746 | data->module_handle); | ||
747 | return 0; | ||
748 | |||
749 | sensor_err: | ||
750 | hwmon_device_unregister(data->hwmon_dev); | ||
751 | hwmon_reg_err: | ||
752 | ipmi_destroy_user(data->ipmi.user); | ||
753 | ipmi_err: | ||
754 | dev_set_drvdata(&data->pdev->dev, NULL); | ||
755 | platform_device_unregister(data->pdev); | ||
756 | dev_err: | ||
757 | aem_idr_put(data->id); | ||
758 | id_err: | ||
759 | kfree(data); | ||
760 | |||
761 | return res; | ||
762 | } | ||
763 | |||
764 | /* Find and initialize all AEM2 instances */ | ||
765 | static int aem_init_aem2(struct aem_ipmi_data *probe) | ||
766 | { | ||
767 | struct aem_find_instance_resp fi_resp; | ||
768 | int err; | ||
769 | int i = 0; | ||
770 | |||
771 | while (!aem_find_aem2(probe, &fi_resp, i)) { | ||
772 | if (fi_resp.major != 2) { | ||
773 | dev_err(probe->bmc_device, "Unknown AEM v%d; please " | ||
774 | "report this to the maintainer.\n", | ||
775 | fi_resp.major); | ||
776 | i++; | ||
777 | continue; | ||
778 | } | ||
779 | err = aem_init_aem2_inst(probe, &fi_resp); | ||
780 | if (err) { | ||
781 | dev_err(probe->bmc_device, | ||
782 | "Error %d initializing AEM2 0x%X\n", | ||
783 | err, fi_resp.module_handle); | ||
784 | return err; | ||
785 | } | ||
786 | i++; | ||
787 | } | ||
788 | |||
789 | return 0; | ||
790 | } | ||
791 | |||
792 | /* Probe a BMC for AEM firmware instances */ | ||
793 | static void aem_register_bmc(int iface, struct device *dev) | ||
794 | { | ||
795 | struct aem_ipmi_data probe; | ||
796 | |||
797 | if (aem_init_ipmi_data(&probe, iface, dev)) | ||
798 | return; | ||
799 | |||
800 | /* Ignore probe errors; they won't cause problems */ | ||
801 | aem_init_aem1(&probe); | ||
802 | aem_init_aem2(&probe); | ||
803 | |||
804 | ipmi_destroy_user(probe.user); | ||
805 | } | ||
806 | |||
807 | /* Handle BMC deletion */ | ||
808 | static void aem_bmc_gone(int iface) | ||
809 | { | ||
810 | struct aem_data *p1, *next1; | ||
811 | |||
812 | list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list) | ||
813 | if (p1->ipmi.interface == iface) | ||
814 | aem_delete(p1); | ||
815 | } | ||
816 | |||
817 | /* sysfs support functions */ | ||
818 | |||
819 | /* AEM device name */ | ||
820 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | ||
821 | char *buf) | ||
822 | { | ||
823 | struct aem_data *data = dev_get_drvdata(dev); | ||
824 | |||
825 | return sprintf(buf, "%s%d\n", DRVNAME, data->ver_major); | ||
826 | } | ||
827 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); | ||
828 | |||
829 | /* AEM device version */ | ||
830 | static ssize_t show_version(struct device *dev, | ||
831 | struct device_attribute *devattr, | ||
832 | char *buf) | ||
833 | { | ||
834 | struct aem_data *data = dev_get_drvdata(dev); | ||
835 | |||
836 | return sprintf(buf, "%d.%d\n", data->ver_major, data->ver_minor); | ||
837 | } | ||
838 | static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, 0); | ||
839 | |||
840 | /* Display power use */ | ||
841 | static ssize_t aem_show_power(struct device *dev, | ||
842 | struct device_attribute *devattr, | ||
843 | char *buf) | ||
844 | { | ||
845 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
846 | struct aem_data *data = dev_get_drvdata(dev); | ||
847 | u64 before, after, delta, time; | ||
848 | signed long leftover; | ||
849 | struct timespec b, a; | ||
850 | |||
851 | mutex_lock(&data->lock); | ||
852 | update_aem_energy(data); | ||
853 | getnstimeofday(&b); | ||
854 | before = data->energy[attr->index]; | ||
855 | |||
856 | leftover = schedule_timeout_interruptible( | ||
857 | msecs_to_jiffies(data->power_period[attr->index]) | ||
858 | ); | ||
859 | if (leftover) { | ||
860 | mutex_unlock(&data->lock); | ||
861 | return 0; | ||
862 | } | ||
863 | |||
864 | update_aem_energy(data); | ||
865 | getnstimeofday(&a); | ||
866 | after = data->energy[attr->index]; | ||
867 | mutex_unlock(&data->lock); | ||
868 | |||
869 | time = timespec_to_ns(&a) - timespec_to_ns(&b); | ||
870 | delta = (after - before) * UJ_PER_MJ; | ||
871 | |||
872 | return sprintf(buf, "%llu\n", | ||
873 | (unsigned long long)div64_u64(delta * NSEC_PER_SEC, time)); | ||
874 | } | ||
875 | |||
876 | /* Display energy use */ | ||
877 | static ssize_t aem_show_energy(struct device *dev, | ||
878 | struct device_attribute *devattr, | ||
879 | char *buf) | ||
880 | { | ||
881 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
882 | struct aem_data *a = dev_get_drvdata(dev); | ||
883 | a->update(a); | ||
884 | |||
885 | return sprintf(buf, "%llu\n", | ||
886 | (unsigned long long)a->energy[attr->index] * 1000); | ||
887 | } | ||
888 | |||
889 | /* Display power interval registers */ | ||
890 | static ssize_t aem_show_power_period(struct device *dev, | ||
891 | struct device_attribute *devattr, | ||
892 | char *buf) | ||
893 | { | ||
894 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
895 | struct aem_data *a = dev_get_drvdata(dev); | ||
896 | a->update(a); | ||
897 | |||
898 | return sprintf(buf, "%lu\n", a->power_period[attr->index]); | ||
899 | } | ||
900 | |||
901 | /* Set power interval registers */ | ||
902 | static ssize_t aem_set_power_period(struct device *dev, | ||
903 | struct device_attribute *devattr, | ||
904 | const char *buf, size_t count) | ||
905 | { | ||
906 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
907 | struct aem_data *a = dev_get_drvdata(dev); | ||
908 | unsigned long temp; | ||
909 | int res; | ||
910 | |||
911 | res = strict_strtoul(buf, 10, &temp); | ||
912 | if (res) | ||
913 | return res; | ||
914 | |||
915 | if (temp < AEM_MIN_POWER_INTERVAL) | ||
916 | return -EINVAL; | ||
917 | |||
918 | mutex_lock(&a->lock); | ||
919 | a->power_period[attr->index] = temp; | ||
920 | mutex_unlock(&a->lock); | ||
921 | |||
922 | return count; | ||
923 | } | ||
924 | |||
925 | /* Discover sensors on an AEM device */ | ||
926 | static int aem_register_sensors(struct aem_data *data, | ||
927 | struct aem_ro_sensor_template *ro, | ||
928 | struct aem_rw_sensor_template *rw) | ||
929 | { | ||
930 | struct device *dev = &data->pdev->dev; | ||
931 | struct sensor_device_attribute *sensors = data->sensors; | ||
932 | int err; | ||
933 | |||
934 | /* Set up read-only sensors */ | ||
935 | while (ro->label) { | ||
936 | sensors->dev_attr.attr.name = ro->label; | ||
937 | sensors->dev_attr.attr.mode = S_IRUGO; | ||
938 | sensors->dev_attr.show = ro->show; | ||
939 | sensors->index = ro->index; | ||
940 | |||
941 | err = device_create_file(dev, &sensors->dev_attr); | ||
942 | if (err) { | ||
943 | sensors->dev_attr.attr.name = NULL; | ||
944 | goto error; | ||
945 | } | ||
946 | sensors++; | ||
947 | ro++; | ||
948 | } | ||
949 | |||
950 | /* Set up read-write sensors */ | ||
951 | while (rw->label) { | ||
952 | sensors->dev_attr.attr.name = rw->label; | ||
953 | sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; | ||
954 | sensors->dev_attr.show = rw->show; | ||
955 | sensors->dev_attr.store = rw->set; | ||
956 | sensors->index = rw->index; | ||
957 | |||
958 | err = device_create_file(dev, &sensors->dev_attr); | ||
959 | if (err) { | ||
960 | sensors->dev_attr.attr.name = NULL; | ||
961 | goto error; | ||
962 | } | ||
963 | sensors++; | ||
964 | rw++; | ||
965 | } | ||
966 | |||
967 | err = device_create_file(dev, &sensor_dev_attr_name.dev_attr); | ||
968 | if (err) | ||
969 | goto error; | ||
970 | err = device_create_file(dev, &sensor_dev_attr_version.dev_attr); | ||
971 | return err; | ||
972 | |||
973 | error: | ||
974 | aem_remove_sensors(data); | ||
975 | return err; | ||
976 | } | ||
977 | |||
978 | /* sysfs support functions for AEM2 sensors */ | ||
979 | |||
980 | /* Display temperature use */ | ||
981 | static ssize_t aem2_show_temp(struct device *dev, | ||
982 | struct device_attribute *devattr, | ||
983 | char *buf) | ||
984 | { | ||
985 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
986 | struct aem_data *a = dev_get_drvdata(dev); | ||
987 | a->update(a); | ||
988 | |||
989 | return sprintf(buf, "%u\n", a->temp[attr->index] * 1000); | ||
990 | } | ||
991 | |||
992 | /* Display power-capping registers */ | ||
993 | static ssize_t aem2_show_pcap_value(struct device *dev, | ||
994 | struct device_attribute *devattr, | ||
995 | char *buf) | ||
996 | { | ||
997 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
998 | struct aem_data *a = dev_get_drvdata(dev); | ||
999 | a->update(a); | ||
1000 | |||
1001 | return sprintf(buf, "%u\n", a->pcap[attr->index] * 100000); | ||
1002 | } | ||
1003 | |||
1004 | /* Remove sensors attached to an AEM device */ | ||
1005 | static void aem_remove_sensors(struct aem_data *data) | ||
1006 | { | ||
1007 | int i; | ||
1008 | |||
1009 | for (i = 0; i < AEM_NUM_SENSORS; i++) { | ||
1010 | if (!data->sensors[i].dev_attr.attr.name) | ||
1011 | continue; | ||
1012 | device_remove_file(&data->pdev->dev, | ||
1013 | &data->sensors[i].dev_attr); | ||
1014 | } | ||
1015 | |||
1016 | device_remove_file(&data->pdev->dev, | ||
1017 | &sensor_dev_attr_name.dev_attr); | ||
1018 | device_remove_file(&data->pdev->dev, | ||
1019 | &sensor_dev_attr_version.dev_attr); | ||
1020 | } | ||
1021 | |||
1022 | /* Sensor probe functions */ | ||
1023 | |||
1024 | /* Description of AEM1 sensors */ | ||
1025 | static struct aem_ro_sensor_template aem1_ro_sensors[] = { | ||
1026 | {"energy1_input", aem_show_energy, 0}, | ||
1027 | {"power1_average", aem_show_power, 0}, | ||
1028 | {NULL, NULL, 0}, | ||
1029 | }; | ||
1030 | |||
1031 | static struct aem_rw_sensor_template aem1_rw_sensors[] = { | ||
1032 | {"power1_average_interval", aem_show_power_period, aem_set_power_period, 0}, | ||
1033 | {NULL, NULL, NULL, 0}, | ||
1034 | }; | ||
1035 | |||
1036 | /* Description of AEM2 sensors */ | ||
1037 | static struct aem_ro_sensor_template aem2_ro_sensors[] = { | ||
1038 | {"energy1_input", aem_show_energy, 0}, | ||
1039 | {"energy2_input", aem_show_energy, 1}, | ||
1040 | {"power1_average", aem_show_power, 0}, | ||
1041 | {"power2_average", aem_show_power, 1}, | ||
1042 | {"temp1_input", aem2_show_temp, 0}, | ||
1043 | {"temp2_input", aem2_show_temp, 1}, | ||
1044 | |||
1045 | {"power4_average", aem2_show_pcap_value, POWER_CAP_MAX_HOTPLUG}, | ||
1046 | {"power5_average", aem2_show_pcap_value, POWER_CAP_MAX}, | ||
1047 | {"power6_average", aem2_show_pcap_value, POWER_CAP_MIN_WARNING}, | ||
1048 | {"power7_average", aem2_show_pcap_value, POWER_CAP_MIN}, | ||
1049 | |||
1050 | {"power3_average", aem2_show_pcap_value, POWER_AUX}, | ||
1051 | {"power_cap", aem2_show_pcap_value, POWER_CAP}, | ||
1052 | {NULL, NULL, 0}, | ||
1053 | }; | ||
1054 | |||
1055 | static struct aem_rw_sensor_template aem2_rw_sensors[] = { | ||
1056 | {"power1_average_interval", aem_show_power_period, aem_set_power_period, 0}, | ||
1057 | {"power2_average_interval", aem_show_power_period, aem_set_power_period, 1}, | ||
1058 | {NULL, NULL, NULL, 0}, | ||
1059 | }; | ||
1060 | |||
1061 | /* Set up AEM1 sensor attrs */ | ||
1062 | static int aem1_find_sensors(struct aem_data *data) | ||
1063 | { | ||
1064 | return aem_register_sensors(data, aem1_ro_sensors, aem1_rw_sensors); | ||
1065 | } | ||
1066 | |||
1067 | /* Set up AEM2 sensor attrs */ | ||
1068 | static int aem2_find_sensors(struct aem_data *data) | ||
1069 | { | ||
1070 | return aem_register_sensors(data, aem2_ro_sensors, aem2_rw_sensors); | ||
1071 | } | ||
1072 | |||
1073 | /* Module init/exit routines */ | ||
1074 | |||
1075 | static int __init aem_init(void) | ||
1076 | { | ||
1077 | int res; | ||
1078 | |||
1079 | res = driver_register(&aem_driver); | ||
1080 | if (res) { | ||
1081 | printk(KERN_ERR "Can't register aem driver\n"); | ||
1082 | return res; | ||
1083 | } | ||
1084 | |||
1085 | res = ipmi_smi_watcher_register(&driver_data.bmc_events); | ||
1086 | if (res) | ||
1087 | goto ipmi_reg_err; | ||
1088 | return 0; | ||
1089 | |||
1090 | ipmi_reg_err: | ||
1091 | driver_unregister(&aem_driver); | ||
1092 | return res; | ||
1093 | |||
1094 | } | ||
1095 | |||
1096 | static void __exit aem_exit(void) | ||
1097 | { | ||
1098 | struct aem_data *p1, *next1; | ||
1099 | |||
1100 | ipmi_smi_watcher_unregister(&driver_data.bmc_events); | ||
1101 | driver_unregister(&aem_driver); | ||
1102 | list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list) | ||
1103 | aem_delete(p1); | ||
1104 | } | ||
1105 | |||
1106 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); | ||
1107 | MODULE_DESCRIPTION("IBM Active Energy Manager power/temp sensor driver"); | ||
1108 | MODULE_LICENSE("GPL"); | ||
1109 | |||
1110 | module_init(aem_init); | ||
1111 | module_exit(aem_exit); | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 34b0d4f26b58..655ec7ef568a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif) | |||
648 | 648 | ||
649 | get_device(&hwif->gendev); | 649 | get_device(&hwif->gendev); |
650 | 650 | ||
651 | hwif->portdev = device_create(ide_port_class, &hwif->gendev, | 651 | hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev, |
652 | MKDEV(0, 0), hwif->name); | 652 | MKDEV(0, 0), hwif, hwif->name); |
653 | if (IS_ERR(hwif->portdev)) { | 653 | if (IS_ERR(hwif->portdev)) { |
654 | ret = PTR_ERR(hwif->portdev); | 654 | ret = PTR_ERR(hwif->portdev); |
655 | device_unregister(&hwif->gendev); | 655 | device_unregister(&hwif->gendev); |
656 | } | 656 | } |
657 | dev_set_drvdata(hwif->portdev, hwif); | ||
658 | out: | 657 | out: |
659 | return ret; | 658 | return ret; |
660 | } | 659 | } |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 16b9d0ad154e..a5ceff287a28 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1539,15 +1539,13 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb, | |||
1539 | 1539 | ||
1540 | static void sbp2_create_command_orb(struct sbp2_lu *lu, | 1540 | static void sbp2_create_command_orb(struct sbp2_lu *lu, |
1541 | struct sbp2_command_info *cmd, | 1541 | struct sbp2_command_info *cmd, |
1542 | unchar *scsi_cmd, | 1542 | struct scsi_cmnd *SCpnt) |
1543 | unsigned int scsi_use_sg, | ||
1544 | unsigned int scsi_request_bufflen, | ||
1545 | struct scatterlist *sg, | ||
1546 | enum dma_data_direction dma_dir) | ||
1547 | { | 1543 | { |
1548 | struct sbp2_fwhost_info *hi = lu->hi; | 1544 | struct sbp2_fwhost_info *hi = lu->hi; |
1549 | struct sbp2_command_orb *orb = &cmd->command_orb; | 1545 | struct sbp2_command_orb *orb = &cmd->command_orb; |
1550 | u32 orb_direction; | 1546 | u32 orb_direction; |
1547 | unsigned int scsi_request_bufflen = scsi_bufflen(SCpnt); | ||
1548 | enum dma_data_direction dma_dir = SCpnt->sc_data_direction; | ||
1551 | 1549 | ||
1552 | /* | 1550 | /* |
1553 | * Set-up our command ORB. | 1551 | * Set-up our command ORB. |
@@ -1580,13 +1578,14 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu, | |||
1580 | orb->data_descriptor_lo = 0x0; | 1578 | orb->data_descriptor_lo = 0x0; |
1581 | orb->misc |= ORB_SET_DIRECTION(1); | 1579 | orb->misc |= ORB_SET_DIRECTION(1); |
1582 | } else | 1580 | } else |
1583 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg, | 1581 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_sg_count(SCpnt), |
1582 | scsi_sglist(SCpnt), | ||
1584 | orb_direction, dma_dir); | 1583 | orb_direction, dma_dir); |
1585 | 1584 | ||
1586 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); | 1585 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); |
1587 | 1586 | ||
1588 | memset(orb->cdb, 0, 12); | 1587 | memset(orb->cdb, 0, sizeof(orb->cdb)); |
1589 | memcpy(orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd)); | 1588 | memcpy(orb->cdb, SCpnt->cmnd, SCpnt->cmd_len); |
1590 | } | 1589 | } |
1591 | 1590 | ||
1592 | static void sbp2_link_orb_command(struct sbp2_lu *lu, | 1591 | static void sbp2_link_orb_command(struct sbp2_lu *lu, |
@@ -1669,16 +1668,13 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu, | |||
1669 | static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, | 1668 | static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, |
1670 | void (*done)(struct scsi_cmnd *)) | 1669 | void (*done)(struct scsi_cmnd *)) |
1671 | { | 1670 | { |
1672 | unchar *scsi_cmd = (unchar *)SCpnt->cmnd; | ||
1673 | struct sbp2_command_info *cmd; | 1671 | struct sbp2_command_info *cmd; |
1674 | 1672 | ||
1675 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); | 1673 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); |
1676 | if (!cmd) | 1674 | if (!cmd) |
1677 | return -EIO; | 1675 | return -EIO; |
1678 | 1676 | ||
1679 | sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt), | 1677 | sbp2_create_command_orb(lu, cmd, SCpnt); |
1680 | scsi_bufflen(SCpnt), scsi_sglist(SCpnt), | ||
1681 | SCpnt->sc_data_direction); | ||
1682 | sbp2_link_orb_command(lu, cmd); | 1678 | sbp2_link_orb_command(lu, cmd); |
1683 | 1679 | ||
1684 | return 0; | 1680 | return 0; |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index fbe16d5250a4..1adf2efd3cb3 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -747,7 +747,9 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
747 | break; | 747 | break; |
748 | case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED: | 748 | case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED: |
749 | kmem_cache_free(ib_mad_cache, mad_priv); | 749 | kmem_cache_free(ib_mad_cache, mad_priv); |
750 | break; | 750 | kfree(local); |
751 | ret = 1; | ||
752 | goto out; | ||
751 | case IB_MAD_RESULT_SUCCESS: | 753 | case IB_MAD_RESULT_SUCCESS: |
752 | /* Treat like an incoming receive MAD */ | 754 | /* Treat like an incoming receive MAD */ |
753 | port_priv = ib_get_mad_port(mad_agent_priv->agent.device, | 755 | port_priv = ib_get_mad_port(mad_agent_priv->agent.device, |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 3aa2db54eae4..840ede9ae965 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -1005,8 +1005,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) | 1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) |
1006 | goto err_cdev; | 1006 | goto err_cdev; |
1007 | 1007 | ||
1008 | port->dev = device_create(umad_class, device->dma_device, | 1008 | port->dev = device_create_drvdata(umad_class, device->dma_device, |
1009 | port->cdev->dev, "umad%d", port->dev_num); | 1009 | port->cdev->dev, port, |
1010 | "umad%d", port->dev_num); | ||
1010 | if (IS_ERR(port->dev)) | 1011 | if (IS_ERR(port->dev)) |
1011 | goto err_cdev; | 1012 | goto err_cdev; |
1012 | 1013 | ||
@@ -1024,15 +1025,12 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1024 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) | 1025 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) |
1025 | goto err_sm_cdev; | 1026 | goto err_sm_cdev; |
1026 | 1027 | ||
1027 | port->sm_dev = device_create(umad_class, device->dma_device, | 1028 | port->sm_dev = device_create_drvdata(umad_class, device->dma_device, |
1028 | port->sm_cdev->dev, | 1029 | port->sm_cdev->dev, port, |
1029 | "issm%d", port->dev_num); | 1030 | "issm%d", port->dev_num); |
1030 | if (IS_ERR(port->sm_dev)) | 1031 | if (IS_ERR(port->sm_dev)) |
1031 | goto err_sm_cdev; | 1032 | goto err_sm_cdev; |
1032 | 1033 | ||
1033 | dev_set_drvdata(port->dev, port); | ||
1034 | dev_set_drvdata(port->sm_dev, port); | ||
1035 | |||
1036 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) | 1034 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) |
1037 | goto err_sm_dev; | 1035 | goto err_sm_dev; |
1038 | if (device_create_file(port->sm_dev, &dev_attr_port)) | 1036 | if (device_create_file(port->sm_dev, &dev_attr_port)) |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index cc1afa28c181..f806da184b51 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -755,14 +755,15 @@ static void ib_uverbs_add_one(struct ib_device *device) | |||
755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) | 755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) |
756 | goto err_cdev; | 756 | goto err_cdev; |
757 | 757 | ||
758 | uverbs_dev->dev = device_create(uverbs_class, device->dma_device, | 758 | uverbs_dev->dev = device_create_drvdata(uverbs_class, |
759 | uverbs_dev->cdev->dev, | 759 | device->dma_device, |
760 | "uverbs%d", uverbs_dev->devnum); | 760 | uverbs_dev->cdev->dev, |
761 | uverbs_dev, | ||
762 | "uverbs%d", | ||
763 | uverbs_dev->devnum); | ||
761 | if (IS_ERR(uverbs_dev->dev)) | 764 | if (IS_ERR(uverbs_dev->dev)) |
762 | goto err_cdev; | 765 | goto err_cdev; |
763 | 766 | ||
764 | dev_set_drvdata(uverbs_dev->dev, uverbs_dev); | ||
765 | |||
766 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) | 767 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) |
767 | goto err_class; | 768 | goto err_class; |
768 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) | 769 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index 79dbe5beae52..992613799228 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -229,7 +229,7 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
229 | struct ib_send_wr **bad_wr) | 229 | struct ib_send_wr **bad_wr) |
230 | { | 230 | { |
231 | int err = 0; | 231 | int err = 0; |
232 | u8 t3_wr_flit_cnt; | 232 | u8 uninitialized_var(t3_wr_flit_cnt); |
233 | enum t3_wr_opcode t3_wr_opcode = 0; | 233 | enum t3_wr_opcode t3_wr_opcode = 0; |
234 | enum t3_wr_flags t3_wr_flags; | 234 | enum t3_wr_flags t3_wr_flags; |
235 | struct iwch_qp *qhp; | 235 | struct iwch_qp *qhp; |
diff --git a/drivers/infiniband/hw/ipath/ipath_sdma.c b/drivers/infiniband/hw/ipath/ipath_sdma.c index 3697449c1ba4..0a8c1b8091a2 100644 --- a/drivers/infiniband/hw/ipath/ipath_sdma.c +++ b/drivers/infiniband/hw/ipath/ipath_sdma.c | |||
@@ -345,7 +345,7 @@ resched: | |||
345 | * state change | 345 | * state change |
346 | */ | 346 | */ |
347 | if (jiffies > dd->ipath_sdma_abort_jiffies) { | 347 | if (jiffies > dd->ipath_sdma_abort_jiffies) { |
348 | ipath_dbg("looping with status 0x%016llx\n", | 348 | ipath_dbg("looping with status 0x%08lx\n", |
349 | dd->ipath_sdma_status); | 349 | dd->ipath_sdma_status); |
350 | dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ; | 350 | dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ; |
351 | } | 351 | } |
@@ -615,7 +615,7 @@ void ipath_restart_sdma(struct ipath_devdata *dd) | |||
615 | } | 615 | } |
616 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); | 616 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); |
617 | if (!needed) { | 617 | if (!needed) { |
618 | ipath_dbg("invalid attempt to restart SDMA, status 0x%016llx\n", | 618 | ipath_dbg("invalid attempt to restart SDMA, status 0x%08lx\n", |
619 | dd->ipath_sdma_status); | 619 | dd->ipath_sdma_status); |
620 | goto bail; | 620 | goto bail; |
621 | } | 621 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c index 7fd18e833907..0596ec16fcbd 100644 --- a/drivers/infiniband/hw/ipath/ipath_uc.c +++ b/drivers/infiniband/hw/ipath/ipath_uc.c | |||
@@ -407,12 +407,11 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
407 | dev->n_pkt_drops++; | 407 | dev->n_pkt_drops++; |
408 | goto done; | 408 | goto done; |
409 | } | 409 | } |
410 | /* XXX Need to free SGEs */ | 410 | wc.opcode = IB_WC_RECV; |
411 | last_imm: | 411 | last_imm: |
412 | ipath_copy_sge(&qp->r_sge, data, tlen); | 412 | ipath_copy_sge(&qp->r_sge, data, tlen); |
413 | wc.wr_id = qp->r_wr_id; | 413 | wc.wr_id = qp->r_wr_id; |
414 | wc.status = IB_WC_SUCCESS; | 414 | wc.status = IB_WC_SUCCESS; |
415 | wc.opcode = IB_WC_RECV; | ||
416 | wc.qp = &qp->ibqp; | 415 | wc.qp = &qp->ibqp; |
417 | wc.src_qp = qp->remote_qpn; | 416 | wc.src_qp = qp->remote_qpn; |
418 | wc.slid = qp->remote_ah_attr.dlid; | 417 | wc.slid = qp->remote_ah_attr.dlid; |
@@ -514,6 +513,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
514 | goto done; | 513 | goto done; |
515 | } | 514 | } |
516 | wc.byte_len = qp->r_len; | 515 | wc.byte_len = qp->r_len; |
516 | wc.opcode = IB_WC_RECV_RDMA_WITH_IMM; | ||
517 | goto last_imm; | 517 | goto last_imm; |
518 | 518 | ||
519 | case OP(RDMA_WRITE_LAST): | 519 | case OP(RDMA_WRITE_LAST): |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 8e02ecfec188..a80df22deae8 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -333,6 +333,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
333 | cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) + | 333 | cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) + |
334 | send_wqe_overhead(type, qp->flags); | 334 | send_wqe_overhead(type, qp->flags); |
335 | 335 | ||
336 | if (s > dev->dev->caps.max_sq_desc_sz) | ||
337 | return -EINVAL; | ||
338 | |||
336 | /* | 339 | /* |
337 | * Hermon supports shrinking WQEs, such that a single work | 340 | * Hermon supports shrinking WQEs, such that a single work |
338 | * request can include multiple units of 1 << wqe_shift. This | 341 | * request can include multiple units of 1 << wqe_shift. This |
@@ -372,9 +375,6 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
372 | qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s)); | 375 | qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s)); |
373 | 376 | ||
374 | for (;;) { | 377 | for (;;) { |
375 | if (1 << qp->sq.wqe_shift > dev->dev->caps.max_sq_desc_sz) | ||
376 | return -EINVAL; | ||
377 | |||
378 | qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift); | 378 | qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift); |
379 | 379 | ||
380 | /* | 380 | /* |
@@ -395,7 +395,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
395 | ++qp->sq.wqe_shift; | 395 | ++qp->sq.wqe_shift; |
396 | } | 396 | } |
397 | 397 | ||
398 | qp->sq.max_gs = ((qp->sq_max_wqes_per_wr << qp->sq.wqe_shift) - | 398 | qp->sq.max_gs = (min(dev->dev->caps.max_sq_desc_sz, |
399 | (qp->sq_max_wqes_per_wr << qp->sq.wqe_shift)) - | ||
399 | send_wqe_overhead(type, qp->flags)) / | 400 | send_wqe_overhead(type, qp->flags)) / |
400 | sizeof (struct mlx4_wqe_data_seg); | 401 | sizeof (struct mlx4_wqe_data_seg); |
401 | 402 | ||
@@ -411,7 +412,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
411 | 412 | ||
412 | cap->max_send_wr = qp->sq.max_post = | 413 | cap->max_send_wr = qp->sq.max_post = |
413 | (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr; | 414 | (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr; |
414 | cap->max_send_sge = qp->sq.max_gs; | 415 | cap->max_send_sge = min(qp->sq.max_gs, |
416 | min(dev->dev->caps.max_sq_sg, | ||
417 | dev->dev->caps.max_rq_sg)); | ||
415 | /* We don't support inline sends for kernel QPs (yet) */ | 418 | /* We don't support inline sends for kernel QPs (yet) */ |
416 | cap->max_inline_data = 0; | 419 | cap->max_inline_data = 0; |
417 | 420 | ||
@@ -1457,7 +1460,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1457 | unsigned ind; | 1460 | unsigned ind; |
1458 | int uninitialized_var(stamp); | 1461 | int uninitialized_var(stamp); |
1459 | int uninitialized_var(size); | 1462 | int uninitialized_var(size); |
1460 | unsigned seglen; | 1463 | unsigned uninitialized_var(seglen); |
1461 | int i; | 1464 | int i; |
1462 | 1465 | ||
1463 | spin_lock_irqsave(&qp->sq.lock, flags); | 1466 | spin_lock_irqsave(&qp->sq.lock, flags); |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 9ebadd6e0cfb..200cf13fc9bb 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "mthca_cmd.h" | 45 | #include "mthca_cmd.h" |
46 | #include "mthca_profile.h" | 46 | #include "mthca_profile.h" |
47 | #include "mthca_memfree.h" | 47 | #include "mthca_memfree.h" |
48 | #include "mthca_wqe.h" | ||
48 | 49 | ||
49 | MODULE_AUTHOR("Roland Dreier"); | 50 | MODULE_AUTHOR("Roland Dreier"); |
50 | MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver"); | 51 | MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver"); |
@@ -200,7 +201,18 @@ static int mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim *dev_lim) | |||
200 | mdev->limits.gid_table_len = dev_lim->max_gids; | 201 | mdev->limits.gid_table_len = dev_lim->max_gids; |
201 | mdev->limits.pkey_table_len = dev_lim->max_pkeys; | 202 | mdev->limits.pkey_table_len = dev_lim->max_pkeys; |
202 | mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay; | 203 | mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay; |
203 | mdev->limits.max_sg = dev_lim->max_sg; | 204 | /* |
205 | * Need to allow for worst case send WQE overhead and check | ||
206 | * whether max_desc_sz imposes a lower limit than max_sg; UD | ||
207 | * send has the biggest overhead. | ||
208 | */ | ||
209 | mdev->limits.max_sg = min_t(int, dev_lim->max_sg, | ||
210 | (dev_lim->max_desc_sz - | ||
211 | sizeof (struct mthca_next_seg) - | ||
212 | (mthca_is_memfree(mdev) ? | ||
213 | sizeof (struct mthca_arbel_ud_seg) : | ||
214 | sizeof (struct mthca_tavor_ud_seg))) / | ||
215 | sizeof (struct mthca_data_seg)); | ||
204 | mdev->limits.max_wqes = dev_lim->max_qp_sz; | 216 | mdev->limits.max_wqes = dev_lim->max_qp_sz; |
205 | mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp; | 217 | mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp; |
206 | mdev->limits.reserved_qps = dev_lim->reserved_qps; | 218 | mdev->limits.reserved_qps = dev_lim->reserved_qps; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index d00a2c174aee..3f663fb852c1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -194,7 +194,13 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
194 | /* Set the cached Q_Key before we attach if it's the broadcast group */ | 194 | /* Set the cached Q_Key before we attach if it's the broadcast group */ |
195 | if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4, | 195 | if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4, |
196 | sizeof (union ib_gid))) { | 196 | sizeof (union ib_gid))) { |
197 | spin_lock_irq(&priv->lock); | ||
198 | if (!priv->broadcast) { | ||
199 | spin_unlock_irq(&priv->lock); | ||
200 | return -EAGAIN; | ||
201 | } | ||
197 | priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey); | 202 | priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey); |
203 | spin_unlock_irq(&priv->lock); | ||
198 | priv->tx_wr.wr.ud.remote_qkey = priv->qkey; | 204 | priv->tx_wr.wr.ud.remote_qkey = priv->qkey; |
199 | } | 205 | } |
200 | 206 | ||
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c index a293e8b3f508..8a77bfcd05bc 100644 --- a/drivers/input/keyboard/aaed2000_kbd.c +++ b/drivers/input/keyboard/aaed2000_kbd.c | |||
@@ -183,4 +183,4 @@ module_exit(aaedkbd_exit); | |||
183 | 183 | ||
184 | MODULE_AUTHOR("Nicolas Bellido Y Ortega"); | 184 | MODULE_AUTHOR("Nicolas Bellido Y Ortega"); |
185 | MODULE_DESCRIPTION("AAED-2000 Keyboard Driver"); | 185 | MODULE_DESCRIPTION("AAED-2000 Keyboard Driver"); |
186 | MODULE_LICENSE("GPLv2"); | 186 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 4a95adc4cc78..af58a6f1e898 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -807,6 +807,8 @@ static int atkbd_activate(struct atkbd *atkbd) | |||
807 | static void atkbd_cleanup(struct serio *serio) | 807 | static void atkbd_cleanup(struct serio *serio) |
808 | { | 808 | { |
809 | struct atkbd *atkbd = serio_get_drvdata(serio); | 809 | struct atkbd *atkbd = serio_get_drvdata(serio); |
810 | |||
811 | atkbd_disable(atkbd); | ||
810 | ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); | 812 | ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); |
811 | } | 813 | } |
812 | 814 | ||
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 29fbec6218b9..1aa46ae12630 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -412,5 +412,5 @@ module_exit(corgikbd_exit); | |||
412 | 412 | ||
413 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | 413 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); |
414 | MODULE_DESCRIPTION("Corgi Keyboard Driver"); | 414 | MODULE_DESCRIPTION("Corgi Keyboard Driver"); |
415 | MODULE_LICENSE("GPLv2"); | 415 | MODULE_LICENSE("GPL v2"); |
416 | MODULE_ALIAS("platform:corgi-keyboard"); | 416 | MODULE_ALIAS("platform:corgi-keyboard"); |
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c index 9387da343f97..781fc6102860 100644 --- a/drivers/input/keyboard/jornada680_kbd.c +++ b/drivers/input/keyboard/jornada680_kbd.c | |||
@@ -275,5 +275,5 @@ module_exit(jornada680kbd_exit); | |||
275 | 275 | ||
276 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | 276 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); |
277 | MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); | 277 | MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); |
278 | MODULE_LICENSE("GPLv2"); | 278 | MODULE_LICENSE("GPL v2"); |
279 | MODULE_ALIAS("platform:jornada680_kbd"); | 279 | MODULE_ALIAS("platform:jornada680_kbd"); |
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index a1164a0c7736..ce650af6d649 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | MODULE_AUTHOR("Kristoffer Ericson <Kristoffer.Ericson@gmail.com>"); | 30 | MODULE_AUTHOR("Kristoffer Ericson <Kristoffer.Ericson@gmail.com>"); |
31 | MODULE_DESCRIPTION("HP Jornada 710/720/728 keyboard driver"); | 31 | MODULE_DESCRIPTION("HP Jornada 710/720/728 keyboard driver"); |
32 | MODULE_LICENSE("GPLv2"); | 32 | MODULE_LICENSE("GPL v2"); |
33 | 33 | ||
34 | static unsigned short jornada_std_keymap[128] = { /* ROW */ | 34 | static unsigned short jornada_std_keymap[128] = { /* ROW */ |
35 | 0, KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* #1 */ | 35 | 0, KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* #1 */ |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 3dea0c5077a9..45767e73f071 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -136,6 +136,9 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
136 | set_bit(code, input_dev->keybit); | 136 | set_bit(code, input_dev->keybit); |
137 | } | 137 | } |
138 | 138 | ||
139 | for (i = 0; i < pdata->direct_key_num; i++) | ||
140 | set_bit(pdata->direct_key_map[i], input_dev->keybit); | ||
141 | |||
139 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; | 142 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; |
140 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; | 143 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; |
141 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; | 144 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; |
@@ -143,17 +146,21 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
143 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; | 146 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; |
144 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; | 147 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; |
145 | 148 | ||
146 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { | 149 | if (pdata->enable_rotary0) { |
147 | set_bit(pdata->rotary0_up_key, input_dev->keybit); | 150 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { |
148 | set_bit(pdata->rotary0_down_key, input_dev->keybit); | 151 | set_bit(pdata->rotary0_up_key, input_dev->keybit); |
149 | } else | 152 | set_bit(pdata->rotary0_down_key, input_dev->keybit); |
150 | set_bit(pdata->rotary0_rel_code, input_dev->relbit); | 153 | } else |
151 | 154 | set_bit(pdata->rotary0_rel_code, input_dev->relbit); | |
152 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { | 155 | } |
153 | set_bit(pdata->rotary1_up_key, input_dev->keybit); | 156 | |
154 | set_bit(pdata->rotary1_down_key, input_dev->keybit); | 157 | if (pdata->enable_rotary1) { |
155 | } else | 158 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { |
156 | set_bit(pdata->rotary1_rel_code, input_dev->relbit); | 159 | set_bit(pdata->rotary1_up_key, input_dev->keybit); |
160 | set_bit(pdata->rotary1_down_key, input_dev->keybit); | ||
161 | } else | ||
162 | set_bit(pdata->rotary1_rel_code, input_dev->relbit); | ||
163 | } | ||
157 | } | 164 | } |
158 | 165 | ||
159 | static inline unsigned int lookup_matrix_keycode( | 166 | static inline unsigned int lookup_matrix_keycode( |
@@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | |||
484 | keypad->input_dev = input_dev; | 491 | keypad->input_dev = input_dev; |
485 | input_set_drvdata(input_dev, keypad); | 492 | input_set_drvdata(input_dev, keypad); |
486 | 493 | ||
487 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | | 494 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
488 | BIT_MASK(EV_REL); | 495 | if ((keypad->pdata->enable_rotary0 && |
496 | keypad->pdata->rotary0_rel_code) || | ||
497 | (keypad->pdata->enable_rotary1 && | ||
498 | keypad->pdata->rotary1_rel_code)) { | ||
499 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | ||
500 | } | ||
489 | 501 | ||
490 | pxa27x_keypad_build_keycode(keypad); | 502 | pxa27x_keypad_build_keycode(keypad); |
491 | platform_set_drvdata(pdev, keypad); | 503 | platform_set_drvdata(pdev, keypad); |
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 61e401bc9109..1aa37181c40f 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -494,5 +494,5 @@ module_exit(spitzkbd_exit); | |||
494 | 494 | ||
495 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | 495 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); |
496 | MODULE_DESCRIPTION("Spitz Keyboard Driver"); | 496 | MODULE_DESCRIPTION("Spitz Keyboard Driver"); |
497 | MODULE_LICENSE("GPLv2"); | 497 | MODULE_LICENSE("GPL v2"); |
498 | MODULE_ALIAS("platform:spitz-keyboard"); | 498 | MODULE_ALIAS("platform:spitz-keyboard"); |
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index 9531d8c7444f..d82f7f727f7a 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/module.h> | ||
24 | #include <linux/input-polldev.h> | 23 | #include <linux/input-polldev.h> |
25 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
26 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 5ece9f56babc..9aafa96cb746 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -331,6 +331,13 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { | |||
331 | }, | 331 | }, |
332 | }, | 332 | }, |
333 | { | 333 | { |
334 | .ident = "Acer TravelMate 660", | ||
335 | .matches = { | ||
336 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
337 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"), | ||
338 | }, | ||
339 | }, | ||
340 | { | ||
334 | .ident = "Acer TravelMate 2490", | 341 | .ident = "Acer TravelMate 2490", |
335 | .matches = { | 342 | .matches = { |
336 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 343 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 65a74cfc187b..592ff55b62d0 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -885,6 +885,20 @@ static long i8042_panic_blink(long count) | |||
885 | 885 | ||
886 | #undef DELAY | 886 | #undef DELAY |
887 | 887 | ||
888 | #ifdef CONFIG_X86 | ||
889 | static void i8042_dritek_enable(void) | ||
890 | { | ||
891 | char param = 0x90; | ||
892 | int error; | ||
893 | |||
894 | error = i8042_command(¶m, 0x1059); | ||
895 | if (error) | ||
896 | printk(KERN_WARNING | ||
897 | "Failed to enable DRITEK extension: %d\n", | ||
898 | error); | ||
899 | } | ||
900 | #endif | ||
901 | |||
888 | #ifdef CONFIG_PM | 902 | #ifdef CONFIG_PM |
889 | /* | 903 | /* |
890 | * Here we try to restore the original BIOS settings. We only want to | 904 | * Here we try to restore the original BIOS settings. We only want to |
@@ -942,6 +956,12 @@ static int i8042_resume(struct platform_device *dev) | |||
942 | return -EIO; | 956 | return -EIO; |
943 | } | 957 | } |
944 | 958 | ||
959 | |||
960 | #ifdef CONFIG_X86 | ||
961 | if (i8042_dritek) | ||
962 | i8042_dritek_enable(); | ||
963 | #endif | ||
964 | |||
945 | if (i8042_mux_present) { | 965 | if (i8042_mux_present) { |
946 | if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports()) | 966 | if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports()) |
947 | printk(KERN_WARNING | 967 | printk(KERN_WARNING |
@@ -1160,6 +1180,11 @@ static int __devinit i8042_probe(struct platform_device *dev) | |||
1160 | if (error) | 1180 | if (error) |
1161 | return error; | 1181 | return error; |
1162 | 1182 | ||
1183 | #ifdef CONFIG_X86 | ||
1184 | if (i8042_dritek) | ||
1185 | i8042_dritek_enable(); | ||
1186 | #endif | ||
1187 | |||
1163 | if (!i8042_noaux) { | 1188 | if (!i8042_noaux) { |
1164 | error = i8042_setup_aux(); | 1189 | error = i8042_setup_aux(); |
1165 | if (error && error != -ENODEV && error != -EBUSY) | 1190 | if (error && error != -ENODEV && error != -EBUSY) |
@@ -1171,14 +1196,6 @@ static int __devinit i8042_probe(struct platform_device *dev) | |||
1171 | if (error) | 1196 | if (error) |
1172 | goto out_fail; | 1197 | goto out_fail; |
1173 | } | 1198 | } |
1174 | #ifdef CONFIG_X86 | ||
1175 | if (i8042_dritek) { | ||
1176 | char param = 0x90; | ||
1177 | error = i8042_command(¶m, 0x1059); | ||
1178 | if (error) | ||
1179 | goto out_fail; | ||
1180 | } | ||
1181 | #endif | ||
1182 | /* | 1199 | /* |
1183 | * Ok, everything is ready, let's register all serio ports | 1200 | * Ok, everything is ready, let's register all serio ports |
1184 | */ | 1201 | */ |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index c5a8661a1baa..1e748e46d12e 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -830,7 +830,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
830 | struct gtco *gtco; | 830 | struct gtco *gtco; |
831 | struct input_dev *input_dev; | 831 | struct input_dev *input_dev; |
832 | struct hid_descriptor *hid_desc; | 832 | struct hid_descriptor *hid_desc; |
833 | char *report = NULL; | 833 | char *report; |
834 | int result = 0, retry; | 834 | int result = 0, retry; |
835 | int error; | 835 | int error; |
836 | struct usb_endpoint_descriptor *endpoint; | 836 | struct usb_endpoint_descriptor *endpoint; |
@@ -916,12 +916,16 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
916 | le16_to_cpu(hid_desc->wDescriptorLength), | 916 | le16_to_cpu(hid_desc->wDescriptorLength), |
917 | 5000); /* 5 secs */ | 917 | 5000); /* 5 secs */ |
918 | 918 | ||
919 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) | 919 | dbg("usb_control_msg result: %d", result); |
920 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { | ||
921 | parse_hid_report_descriptor(gtco, report, result); | ||
920 | break; | 922 | break; |
923 | } | ||
921 | } | 924 | } |
922 | 925 | ||
926 | kfree(report); | ||
927 | |||
923 | /* If we didn't get the report, fail */ | 928 | /* If we didn't get the report, fail */ |
924 | dbg("usb_control_msg result: :%d", result); | ||
925 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { | 929 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { |
926 | err("Failed to get HID Report Descriptor of size: %d", | 930 | err("Failed to get HID Report Descriptor of size: %d", |
927 | hid_desc->wDescriptorLength); | 931 | hid_desc->wDescriptorLength); |
@@ -929,12 +933,6 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
929 | goto err_free_urb; | 933 | goto err_free_urb; |
930 | } | 934 | } |
931 | 935 | ||
932 | /* Now we parse the report */ | ||
933 | parse_hid_report_descriptor(gtco, report, result); | ||
934 | |||
935 | /* Now we delete it */ | ||
936 | kfree(report); | ||
937 | |||
938 | /* Create a device file node */ | 936 | /* Create a device file node */ |
939 | usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); | 937 | usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); |
940 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); | 938 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); |
@@ -988,7 +986,6 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
988 | usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, | 986 | usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, |
989 | gtco->buffer, gtco->buf_dma); | 987 | gtco->buffer, gtco->buf_dma); |
990 | err_free_devs: | 988 | err_free_devs: |
991 | kfree(report); | ||
992 | input_free_device(input_dev); | 989 | input_free_device(input_dev); |
993 | kfree(gtco); | 990 | kfree(gtco); |
994 | return error; | 991 | return error; |
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index 742242111bf1..1aca108b1031 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | 25 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); |
26 | MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver"); | 26 | MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver"); |
27 | MODULE_LICENSE("GPLv2"); | 27 | MODULE_LICENSE("GPL v2"); |
28 | 28 | ||
29 | struct jornada_ts { | 29 | struct jornada_ts { |
30 | struct input_dev *dev; | 30 | struct input_dev *dev; |
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c index 01278bd7e65c..838458792ea0 100644 --- a/drivers/input/touchscreen/wm9713.c +++ b/drivers/input/touchscreen/wm9713.c | |||
@@ -85,6 +85,15 @@ module_param(delay, int, 0); | |||
85 | MODULE_PARM_DESC(delay, "Set adc sample delay."); | 85 | MODULE_PARM_DESC(delay, "Set adc sample delay."); |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Set five_wire = 1 to use a 5 wire touchscreen. | ||
89 | * | ||
90 | * NOTE: Five wire mode does not allow for readback of pressure. | ||
91 | */ | ||
92 | static int five_wire; | ||
93 | module_param(five_wire, int, 0); | ||
94 | MODULE_PARM_DESC(five_wire, "Set to '1' to use 5-wire touchscreen."); | ||
95 | |||
96 | /* | ||
88 | * Set adc mask function. | 97 | * Set adc mask function. |
89 | * | 98 | * |
90 | * Sources of glitch noise, such as signals driving an LCD display, may feed | 99 | * Sources of glitch noise, such as signals driving an LCD display, may feed |
@@ -162,6 +171,19 @@ static void wm9713_phy_init(struct wm97xx *wm) | |||
162 | 64000 / rpu); | 171 | 64000 / rpu); |
163 | } | 172 | } |
164 | 173 | ||
174 | /* Five wire panel? */ | ||
175 | if (five_wire) { | ||
176 | dig3 |= WM9713_45W; | ||
177 | dev_info(wm->dev, "setting 5-wire touchscreen mode."); | ||
178 | |||
179 | if (pil) { | ||
180 | dev_warn(wm->dev, | ||
181 | "Pressure measurement not supported in 5 " | ||
182 | "wire mode, disabling\n"); | ||
183 | pil = 0; | ||
184 | } | ||
185 | } | ||
186 | |||
165 | /* touchpanel pressure */ | 187 | /* touchpanel pressure */ |
166 | if (pil == 2) { | 188 | if (pil == 2) { |
167 | dig3 |= WM9712_PIL; | 189 | dig3 |= WM9712_PIL; |
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index e9c7ea46b6e3..cdc24ad314e0 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c | |||
@@ -608,6 +608,17 @@ static int wm97xx_probe(struct device *dev) | |||
608 | goto alloc_err; | 608 | goto alloc_err; |
609 | } | 609 | } |
610 | 610 | ||
611 | /* set up physical characteristics */ | ||
612 | wm->codec->phy_init(wm); | ||
613 | |||
614 | /* load gpio cache */ | ||
615 | wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG); | ||
616 | wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY); | ||
617 | wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY); | ||
618 | wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP); | ||
619 | wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS); | ||
620 | wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE); | ||
621 | |||
611 | wm->input_dev = input_allocate_device(); | 622 | wm->input_dev = input_allocate_device(); |
612 | if (wm->input_dev == NULL) { | 623 | if (wm->input_dev == NULL) { |
613 | ret = -ENOMEM; | 624 | ret = -ENOMEM; |
@@ -616,6 +627,7 @@ static int wm97xx_probe(struct device *dev) | |||
616 | 627 | ||
617 | /* set up touch configuration */ | 628 | /* set up touch configuration */ |
618 | wm->input_dev->name = "wm97xx touchscreen"; | 629 | wm->input_dev->name = "wm97xx touchscreen"; |
630 | wm->input_dev->phys = "wm97xx"; | ||
619 | wm->input_dev->open = wm97xx_ts_input_open; | 631 | wm->input_dev->open = wm97xx_ts_input_open; |
620 | wm->input_dev->close = wm97xx_ts_input_close; | 632 | wm->input_dev->close = wm97xx_ts_input_close; |
621 | set_bit(EV_ABS, wm->input_dev->evbit); | 633 | set_bit(EV_ABS, wm->input_dev->evbit); |
@@ -634,17 +646,6 @@ static int wm97xx_probe(struct device *dev) | |||
634 | if (ret < 0) | 646 | if (ret < 0) |
635 | goto dev_alloc_err; | 647 | goto dev_alloc_err; |
636 | 648 | ||
637 | /* set up physical characteristics */ | ||
638 | wm->codec->phy_init(wm); | ||
639 | |||
640 | /* load gpio cache */ | ||
641 | wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG); | ||
642 | wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY); | ||
643 | wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY); | ||
644 | wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP); | ||
645 | wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS); | ||
646 | wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE); | ||
647 | |||
648 | /* register our battery device */ | 649 | /* register our battery device */ |
649 | wm->battery_dev = platform_device_alloc("wm97xx-battery", -1); | 650 | wm->battery_dev = platform_device_alloc("wm97xx-battery", -1); |
650 | if (!wm->battery_dev) { | 651 | if (!wm->battery_dev) { |
@@ -801,7 +802,7 @@ void wm97xx_unregister_mach_ops(struct wm97xx *wm) | |||
801 | EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops); | 802 | EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops); |
802 | 803 | ||
803 | static struct device_driver wm97xx_driver = { | 804 | static struct device_driver wm97xx_driver = { |
804 | .name = "ac97", | 805 | .name = "wm97xx-ts", |
805 | .bus = &ac97_bus_type, | 806 | .bus = &ac97_bus_type, |
806 | .owner = THIS_MODULE, | 807 | .owner = THIS_MODULE, |
807 | .probe = wm97xx_probe, | 808 | .probe = wm97xx_probe, |
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c index ebef4ce1b00c..29419a8d31dc 100644 --- a/drivers/isdn/capi/capiutil.c +++ b/drivers/isdn/capi/capiutil.c | |||
@@ -948,17 +948,17 @@ int __init cdebug_init(void) | |||
948 | { | 948 | { |
949 | g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL); | 949 | g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL); |
950 | if (!g_cmsg) | 950 | if (!g_cmsg) |
951 | return ENOMEM; | 951 | return -ENOMEM; |
952 | g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL); | 952 | g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL); |
953 | if (!g_debbuf) { | 953 | if (!g_debbuf) { |
954 | kfree(g_cmsg); | 954 | kfree(g_cmsg); |
955 | return ENOMEM; | 955 | return -ENOMEM; |
956 | } | 956 | } |
957 | g_debbuf->buf = kmalloc(CDEBUG_GSIZE, GFP_KERNEL); | 957 | g_debbuf->buf = kmalloc(CDEBUG_GSIZE, GFP_KERNEL); |
958 | if (!g_debbuf->buf) { | 958 | if (!g_debbuf->buf) { |
959 | kfree(g_cmsg); | 959 | kfree(g_cmsg); |
960 | kfree(g_debbuf); | 960 | kfree(g_debbuf); |
961 | return ENOMEM;; | 961 | return -ENOMEM;; |
962 | } | 962 | } |
963 | g_debbuf->size = CDEBUG_GSIZE; | 963 | g_debbuf->size = CDEBUG_GSIZE; |
964 | g_debbuf->buf[0] = 0; | 964 | g_debbuf->buf[0] = 0; |
diff --git a/drivers/isdn/hysdn/Kconfig b/drivers/isdn/hysdn/Kconfig index c6d8a7042988..c9e4231968ef 100644 --- a/drivers/isdn/hysdn/Kconfig +++ b/drivers/isdn/hysdn/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | config HYSDN | 4 | config HYSDN |
5 | tristate "Hypercope HYSDN cards (Champ, Ergo, Metro) support (module only)" | 5 | tristate "Hypercope HYSDN cards (Champ, Ergo, Metro) support (module only)" |
6 | depends on m && PROC_FS && PCI && BROKEN_ON_SMP | 6 | depends on m && PROC_FS && PCI |
7 | help | 7 | help |
8 | Say Y here if you have one of Hypercope's active PCI ISDN cards | 8 | Say Y here if you have one of Hypercope's active PCI ISDN cards |
9 | Champ, Ergo and Metro. You will then get a module called hysdn. | 9 | Champ, Ergo and Metro. You will then get a module called hysdn. |
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c index 6cdbad3a9926..3eb096f0ae1b 100644 --- a/drivers/isdn/hysdn/boardergo.c +++ b/drivers/isdn/hysdn/boardergo.c | |||
@@ -64,10 +64,11 @@ ergo_interrupt(int intno, void *dev_id) | |||
64 | } /* ergo_interrupt */ | 64 | } /* ergo_interrupt */ |
65 | 65 | ||
66 | /******************************************************************************/ | 66 | /******************************************************************************/ |
67 | /* ergo_irq_bh is the function called by the immediate kernel task list after */ | 67 | /* ergo_irq_bh will be called as part of the kernel clearing its shared work */ |
68 | /* being activated with queue_task and no interrupts active. This task is the */ | 68 | /* queue sometime after a call to schedule_work has been made passing our */ |
69 | /* only one handling data transfer from or to the card after booting. The task */ | 69 | /* work_struct. This task is the only one handling data transfer from or to */ |
70 | /* may be queued from everywhere (interrupts included). */ | 70 | /* the card after booting. The task may be queued from everywhere */ |
71 | /* (interrupts included). */ | ||
71 | /******************************************************************************/ | 72 | /******************************************************************************/ |
72 | static void | 73 | static void |
73 | ergo_irq_bh(struct work_struct *ugli_api) | 74 | ergo_irq_bh(struct work_struct *ugli_api) |
@@ -90,7 +91,6 @@ ergo_irq_bh(struct work_struct *ugli_api) | |||
90 | card->hw_lock = 1; /* we now lock the hardware */ | 91 | card->hw_lock = 1; /* we now lock the hardware */ |
91 | 92 | ||
92 | do { | 93 | do { |
93 | sti(); /* reenable other ints */ | ||
94 | again = 0; /* assume loop not to be repeated */ | 94 | again = 0; /* assume loop not to be repeated */ |
95 | 95 | ||
96 | if (!dpr->ToHyFlag) { | 96 | if (!dpr->ToHyFlag) { |
@@ -110,7 +110,6 @@ ergo_irq_bh(struct work_struct *ugli_api) | |||
110 | again = 1; /* restart loop */ | 110 | again = 1; /* restart loop */ |
111 | } | 111 | } |
112 | } /* a message has arrived for us */ | 112 | } /* a message has arrived for us */ |
113 | cli(); /* no further ints */ | ||
114 | if (again) { | 113 | if (again) { |
115 | dpr->ToHyInt = 1; | 114 | dpr->ToHyInt = 1; |
116 | dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ | 115 | dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ |
@@ -242,7 +241,6 @@ ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf, | |||
242 | byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */ | 241 | byteout(card->iobase + PCI9050_USER_IO, PCI9050_E1_RUN); /* start E1 processor */ |
243 | /* the interrupts are still masked */ | 242 | /* the interrupts are still masked */ |
244 | 243 | ||
245 | sti(); | ||
246 | msleep_interruptible(20); /* Timeout 20ms */ | 244 | msleep_interruptible(20); /* Timeout 20ms */ |
247 | 245 | ||
248 | if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) { | 246 | if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) { |
@@ -276,7 +274,6 @@ ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len) | |||
276 | dst = sp->Data; /* point to data in spool structure */ | 274 | dst = sp->Data; /* point to data in spool structure */ |
277 | buflen = sp->Len; /* maximum len of spooled data */ | 275 | buflen = sp->Len; /* maximum len of spooled data */ |
278 | wr_mirror = sp->WrPtr; /* only once read */ | 276 | wr_mirror = sp->WrPtr; /* only once read */ |
279 | sti(); | ||
280 | 277 | ||
281 | /* try until all bytes written or error */ | 278 | /* try until all bytes written or error */ |
282 | i = 0x1000; /* timeout value */ | 279 | i = 0x1000; /* timeout value */ |
@@ -380,7 +377,6 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
380 | #endif /* CONFIG_HYSDN_CAPI */ | 377 | #endif /* CONFIG_HYSDN_CAPI */ |
381 | return (0); /* success */ | 378 | return (0); /* success */ |
382 | } /* data has arrived */ | 379 | } /* data has arrived */ |
383 | sti(); | ||
384 | msleep_interruptible(50); /* Timeout 50ms */ | 380 | msleep_interruptible(50); /* Timeout 50ms */ |
385 | } /* wait until timeout */ | 381 | } /* wait until timeout */ |
386 | 382 | ||
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index d3999a8e9f88..53f6ad1235db 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -462,11 +462,11 @@ static int hycapi_read_proc(char *page, char **start, off_t off, | |||
462 | default: s = "???"; break; | 462 | default: s = "???"; break; |
463 | } | 463 | } |
464 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 464 | len += sprintf(page+len, "%-16s %s\n", "type", s); |
465 | if ((s = cinfo->version[VER_DRIVER]) != 0) | 465 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); |
467 | if ((s = cinfo->version[VER_CARDTYPE]) != 0) | 467 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); |
469 | if ((s = cinfo->version[VER_SERIAL]) != 0) | 469 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); |
471 | 471 | ||
472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); | 472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index b3c54be74556..559a40861c39 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
103 | { | 103 | { |
104 | int rc; | 104 | int rc; |
105 | 105 | ||
106 | led_cdev->dev = device_create(leds_class, parent, 0, "%s", | 106 | led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev, |
107 | led_cdev->name); | 107 | "%s", led_cdev->name); |
108 | if (IS_ERR(led_cdev->dev)) | 108 | if (IS_ERR(led_cdev->dev)) |
109 | return PTR_ERR(led_cdev->dev); | 109 | return PTR_ERR(led_cdev->dev); |
110 | 110 | ||
111 | dev_set_drvdata(led_cdev->dev, led_cdev); | ||
112 | |||
113 | /* register the attributes */ | 111 | /* register the attributes */ |
114 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); | 112 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); |
115 | if (rc) | 113 | if (rc) |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 8080249957af..1a8de57289eb 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -20,14 +20,11 @@ | |||
20 | /* The pointer to our (page) of device descriptions. */ | 20 | /* The pointer to our (page) of device descriptions. */ |
21 | static void *lguest_devices; | 21 | static void *lguest_devices; |
22 | 22 | ||
23 | /* Unique numbering for lguest devices. */ | ||
24 | static unsigned int dev_index; | ||
25 | |||
26 | /* For Guests, device memory can be used as normal memory, so we cast away the | 23 | /* For Guests, device memory can be used as normal memory, so we cast away the |
27 | * __iomem to quieten sparse. */ | 24 | * __iomem to quieten sparse. */ |
28 | static inline void *lguest_map(unsigned long phys_addr, unsigned long pages) | 25 | static inline void *lguest_map(unsigned long phys_addr, unsigned long pages) |
29 | { | 26 | { |
30 | return (__force void *)ioremap(phys_addr, PAGE_SIZE*pages); | 27 | return (__force void *)ioremap_cache(phys_addr, PAGE_SIZE*pages); |
31 | } | 28 | } |
32 | 29 | ||
33 | static inline void lguest_unmap(void *addr) | 30 | static inline void lguest_unmap(void *addr) |
@@ -325,8 +322,10 @@ static struct device lguest_root = { | |||
325 | * As Andrew Tridgell says, "Untested code is buggy code". | 322 | * As Andrew Tridgell says, "Untested code is buggy code". |
326 | * | 323 | * |
327 | * It's worth reading this carefully: we start with a pointer to the new device | 324 | * It's worth reading this carefully: we start with a pointer to the new device |
328 | * descriptor in the "lguest_devices" page. */ | 325 | * descriptor in the "lguest_devices" page, and the offset into the device |
329 | static void add_lguest_device(struct lguest_device_desc *d) | 326 | * descriptor page so we can uniquely identify it if things go badly wrong. */ |
327 | static void add_lguest_device(struct lguest_device_desc *d, | ||
328 | unsigned int offset) | ||
330 | { | 329 | { |
331 | struct lguest_device *ldev; | 330 | struct lguest_device *ldev; |
332 | 331 | ||
@@ -334,18 +333,14 @@ static void add_lguest_device(struct lguest_device_desc *d) | |||
334 | * it. */ | 333 | * it. */ |
335 | ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); | 334 | ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); |
336 | if (!ldev) { | 335 | if (!ldev) { |
337 | printk(KERN_EMERG "Cannot allocate lguest dev %u\n", | 336 | printk(KERN_EMERG "Cannot allocate lguest dev %u type %u\n", |
338 | dev_index++); | 337 | offset, d->type); |
339 | return; | 338 | return; |
340 | } | 339 | } |
341 | 340 | ||
342 | /* This devices' parent is the lguest/ dir. */ | 341 | /* This devices' parent is the lguest/ dir. */ |
343 | ldev->vdev.dev.parent = &lguest_root; | 342 | ldev->vdev.dev.parent = &lguest_root; |
344 | /* We have a unique device index thanks to the dev_index counter. */ | 343 | /* We have a unique device index thanks to the dev_index counter. */ |
345 | ldev->vdev.index = dev_index++; | ||
346 | /* The device type comes straight from the descriptor. There's also a | ||
347 | * device vendor field in the virtio_device struct, which we leave as | ||
348 | * 0. */ | ||
349 | ldev->vdev.id.device = d->type; | 344 | ldev->vdev.id.device = d->type; |
350 | /* We have a simple set of routines for querying the device's | 345 | /* We have a simple set of routines for querying the device's |
351 | * configuration information and setting its status. */ | 346 | * configuration information and setting its status. */ |
@@ -357,8 +352,8 @@ static void add_lguest_device(struct lguest_device_desc *d) | |||
357 | * virtio_device and calls device_register(). This makes the bus | 352 | * virtio_device and calls device_register(). This makes the bus |
358 | * infrastructure look for a matching driver. */ | 353 | * infrastructure look for a matching driver. */ |
359 | if (register_virtio_device(&ldev->vdev) != 0) { | 354 | if (register_virtio_device(&ldev->vdev) != 0) { |
360 | printk(KERN_ERR "Failed to register lguest device %u\n", | 355 | printk(KERN_ERR "Failed to register lguest dev %u type %u\n", |
361 | ldev->vdev.index); | 356 | offset, d->type); |
362 | kfree(ldev); | 357 | kfree(ldev); |
363 | } | 358 | } |
364 | } | 359 | } |
@@ -379,7 +374,7 @@ static void scan_devices(void) | |||
379 | break; | 374 | break; |
380 | 375 | ||
381 | printk("Device at %i has size %u\n", i, desc_size(d)); | 376 | printk("Device at %i has size %u\n", i, desc_size(d)); |
382 | add_lguest_device(d); | 377 | add_lguest_device(d, i); |
383 | } | 378 | } |
384 | } | 379 | } |
385 | 380 | ||
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index c14dacdacfac..b26927ce889c 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -203,17 +203,6 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) | |||
203 | * bitmap file handling - read and write the bitmap file and its superblock | 203 | * bitmap file handling - read and write the bitmap file and its superblock |
204 | */ | 204 | */ |
205 | 205 | ||
206 | /* copy the pathname of a file to a buffer */ | ||
207 | char *file_path(struct file *file, char *buf, int count) | ||
208 | { | ||
209 | if (!buf) | ||
210 | return NULL; | ||
211 | |||
212 | buf = d_path(&file->f_path, buf, count); | ||
213 | |||
214 | return IS_ERR(buf) ? NULL : buf; | ||
215 | } | ||
216 | |||
217 | /* | 206 | /* |
218 | * basic page I/O operations | 207 | * basic page I/O operations |
219 | */ | 208 | */ |
@@ -721,11 +710,13 @@ static void bitmap_file_kick(struct bitmap *bitmap) | |||
721 | if (bitmap->file) { | 710 | if (bitmap->file) { |
722 | path = kmalloc(PAGE_SIZE, GFP_KERNEL); | 711 | path = kmalloc(PAGE_SIZE, GFP_KERNEL); |
723 | if (path) | 712 | if (path) |
724 | ptr = file_path(bitmap->file, path, PAGE_SIZE); | 713 | ptr = d_path(&bitmap->file->f_path, path, |
714 | PAGE_SIZE); | ||
715 | |||
725 | 716 | ||
726 | printk(KERN_ALERT | 717 | printk(KERN_ALERT |
727 | "%s: kicking failed bitmap file %s from array!\n", | 718 | "%s: kicking failed bitmap file %s from array!\n", |
728 | bmname(bitmap), ptr ? ptr : ""); | 719 | bmname(bitmap), IS_ERR(ptr) ? "" : ptr); |
729 | 720 | ||
730 | kfree(path); | 721 | kfree(path); |
731 | } else | 722 | } else |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 83eb78b00137..51c19f86ff99 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -74,6 +74,8 @@ static DEFINE_SPINLOCK(pers_lock); | |||
74 | 74 | ||
75 | static void md_print_devices(void); | 75 | static void md_print_devices(void); |
76 | 76 | ||
77 | static DECLARE_WAIT_QUEUE_HEAD(resync_wait); | ||
78 | |||
77 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } | 79 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } |
78 | 80 | ||
79 | /* | 81 | /* |
@@ -3013,6 +3015,36 @@ degraded_show(mddev_t *mddev, char *page) | |||
3013 | static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); | 3015 | static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); |
3014 | 3016 | ||
3015 | static ssize_t | 3017 | static ssize_t |
3018 | sync_force_parallel_show(mddev_t *mddev, char *page) | ||
3019 | { | ||
3020 | return sprintf(page, "%d\n", mddev->parallel_resync); | ||
3021 | } | ||
3022 | |||
3023 | static ssize_t | ||
3024 | sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len) | ||
3025 | { | ||
3026 | long n; | ||
3027 | |||
3028 | if (strict_strtol(buf, 10, &n)) | ||
3029 | return -EINVAL; | ||
3030 | |||
3031 | if (n != 0 && n != 1) | ||
3032 | return -EINVAL; | ||
3033 | |||
3034 | mddev->parallel_resync = n; | ||
3035 | |||
3036 | if (mddev->sync_thread) | ||
3037 | wake_up(&resync_wait); | ||
3038 | |||
3039 | return len; | ||
3040 | } | ||
3041 | |||
3042 | /* force parallel resync, even with shared block devices */ | ||
3043 | static struct md_sysfs_entry md_sync_force_parallel = | ||
3044 | __ATTR(sync_force_parallel, S_IRUGO|S_IWUSR, | ||
3045 | sync_force_parallel_show, sync_force_parallel_store); | ||
3046 | |||
3047 | static ssize_t | ||
3016 | sync_speed_show(mddev_t *mddev, char *page) | 3048 | sync_speed_show(mddev_t *mddev, char *page) |
3017 | { | 3049 | { |
3018 | unsigned long resync, dt, db; | 3050 | unsigned long resync, dt, db; |
@@ -3187,6 +3219,7 @@ static struct attribute *md_redundancy_attrs[] = { | |||
3187 | &md_sync_min.attr, | 3219 | &md_sync_min.attr, |
3188 | &md_sync_max.attr, | 3220 | &md_sync_max.attr, |
3189 | &md_sync_speed.attr, | 3221 | &md_sync_speed.attr, |
3222 | &md_sync_force_parallel.attr, | ||
3190 | &md_sync_completed.attr, | 3223 | &md_sync_completed.attr, |
3191 | &md_max_sync.attr, | 3224 | &md_max_sync.attr, |
3192 | &md_suspend_lo.attr, | 3225 | &md_suspend_lo.attr, |
@@ -3691,6 +3724,8 @@ static int do_md_stop(mddev_t * mddev, int mode) | |||
3691 | 3724 | ||
3692 | module_put(mddev->pers->owner); | 3725 | module_put(mddev->pers->owner); |
3693 | mddev->pers = NULL; | 3726 | mddev->pers = NULL; |
3727 | /* tell userspace to handle 'inactive' */ | ||
3728 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
3694 | 3729 | ||
3695 | set_capacity(disk, 0); | 3730 | set_capacity(disk, 0); |
3696 | mddev->changed = 1; | 3731 | mddev->changed = 1; |
@@ -3987,8 +4022,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg) | |||
3987 | if (!buf) | 4022 | if (!buf) |
3988 | goto out; | 4023 | goto out; |
3989 | 4024 | ||
3990 | ptr = file_path(mddev->bitmap->file, buf, sizeof(file->pathname)); | 4025 | ptr = d_path(&mddev->bitmap->file->f_path, buf, sizeof(file->pathname)); |
3991 | if (!ptr) | 4026 | if (IS_ERR(ptr)) |
3992 | goto out; | 4027 | goto out; |
3993 | 4028 | ||
3994 | strcpy(file->pathname, ptr); | 4029 | strcpy(file->pathname, ptr); |
@@ -5399,7 +5434,7 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok) | |||
5399 | atomic_sub(blocks, &mddev->recovery_active); | 5434 | atomic_sub(blocks, &mddev->recovery_active); |
5400 | wake_up(&mddev->recovery_wait); | 5435 | wake_up(&mddev->recovery_wait); |
5401 | if (!ok) { | 5436 | if (!ok) { |
5402 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 5437 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5403 | md_wakeup_thread(mddev->thread); | 5438 | md_wakeup_thread(mddev->thread); |
5404 | // stop recovery, signal do_sync .... | 5439 | // stop recovery, signal do_sync .... |
5405 | } | 5440 | } |
@@ -5435,8 +5470,11 @@ void md_write_start(mddev_t *mddev, struct bio *bi) | |||
5435 | md_wakeup_thread(mddev->thread); | 5470 | md_wakeup_thread(mddev->thread); |
5436 | } | 5471 | } |
5437 | spin_unlock_irq(&mddev->write_lock); | 5472 | spin_unlock_irq(&mddev->write_lock); |
5473 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
5438 | } | 5474 | } |
5439 | wait_event(mddev->sb_wait, mddev->flags==0); | 5475 | wait_event(mddev->sb_wait, |
5476 | !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && | ||
5477 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | ||
5440 | } | 5478 | } |
5441 | 5479 | ||
5442 | void md_write_end(mddev_t *mddev) | 5480 | void md_write_end(mddev_t *mddev) |
@@ -5471,13 +5509,17 @@ void md_allow_write(mddev_t *mddev) | |||
5471 | mddev->safemode = 1; | 5509 | mddev->safemode = 1; |
5472 | spin_unlock_irq(&mddev->write_lock); | 5510 | spin_unlock_irq(&mddev->write_lock); |
5473 | md_update_sb(mddev, 0); | 5511 | md_update_sb(mddev, 0); |
5512 | |||
5513 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
5514 | /* wait for the dirty state to be recorded in the metadata */ | ||
5515 | wait_event(mddev->sb_wait, | ||
5516 | !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && | ||
5517 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | ||
5474 | } else | 5518 | } else |
5475 | spin_unlock_irq(&mddev->write_lock); | 5519 | spin_unlock_irq(&mddev->write_lock); |
5476 | } | 5520 | } |
5477 | EXPORT_SYMBOL_GPL(md_allow_write); | 5521 | EXPORT_SYMBOL_GPL(md_allow_write); |
5478 | 5522 | ||
5479 | static DECLARE_WAIT_QUEUE_HEAD(resync_wait); | ||
5480 | |||
5481 | #define SYNC_MARKS 10 | 5523 | #define SYNC_MARKS 10 |
5482 | #define SYNC_MARK_STEP (3*HZ) | 5524 | #define SYNC_MARK_STEP (3*HZ) |
5483 | void md_do_sync(mddev_t *mddev) | 5525 | void md_do_sync(mddev_t *mddev) |
@@ -5541,8 +5583,9 @@ void md_do_sync(mddev_t *mddev) | |||
5541 | for_each_mddev(mddev2, tmp) { | 5583 | for_each_mddev(mddev2, tmp) { |
5542 | if (mddev2 == mddev) | 5584 | if (mddev2 == mddev) |
5543 | continue; | 5585 | continue; |
5544 | if (mddev2->curr_resync && | 5586 | if (!mddev->parallel_resync |
5545 | match_mddev_units(mddev,mddev2)) { | 5587 | && mddev2->curr_resync |
5588 | && match_mddev_units(mddev, mddev2)) { | ||
5546 | DEFINE_WAIT(wq); | 5589 | DEFINE_WAIT(wq); |
5547 | if (mddev < mddev2 && mddev->curr_resync == 2) { | 5590 | if (mddev < mddev2 && mddev->curr_resync == 2) { |
5548 | /* arbitrarily yield */ | 5591 | /* arbitrarily yield */ |
@@ -5647,7 +5690,7 @@ void md_do_sync(mddev_t *mddev) | |||
5647 | sectors = mddev->pers->sync_request(mddev, j, &skipped, | 5690 | sectors = mddev->pers->sync_request(mddev, j, &skipped, |
5648 | currspeed < speed_min(mddev)); | 5691 | currspeed < speed_min(mddev)); |
5649 | if (sectors == 0) { | 5692 | if (sectors == 0) { |
5650 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 5693 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5651 | goto out; | 5694 | goto out; |
5652 | } | 5695 | } |
5653 | 5696 | ||
@@ -5670,8 +5713,7 @@ void md_do_sync(mddev_t *mddev) | |||
5670 | 5713 | ||
5671 | last_check = io_sectors; | 5714 | last_check = io_sectors; |
5672 | 5715 | ||
5673 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery) || | 5716 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) |
5674 | test_bit(MD_RECOVERY_ERR, &mddev->recovery)) | ||
5675 | break; | 5717 | break; |
5676 | 5718 | ||
5677 | repeat: | 5719 | repeat: |
@@ -5725,8 +5767,7 @@ void md_do_sync(mddev_t *mddev) | |||
5725 | /* tell personality that we are finished */ | 5767 | /* tell personality that we are finished */ |
5726 | mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); | 5768 | mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); |
5727 | 5769 | ||
5728 | if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && | 5770 | if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && |
5729 | !test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && | ||
5730 | mddev->curr_resync > 2) { | 5771 | mddev->curr_resync > 2) { |
5731 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | 5772 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
5732 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | 5773 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
@@ -5795,7 +5836,10 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5795 | } | 5836 | } |
5796 | 5837 | ||
5797 | if (mddev->degraded) { | 5838 | if (mddev->degraded) { |
5798 | rdev_for_each(rdev, rtmp, mddev) | 5839 | rdev_for_each(rdev, rtmp, mddev) { |
5840 | if (rdev->raid_disk >= 0 && | ||
5841 | !test_bit(In_sync, &rdev->flags)) | ||
5842 | spares++; | ||
5799 | if (rdev->raid_disk < 0 | 5843 | if (rdev->raid_disk < 0 |
5800 | && !test_bit(Faulty, &rdev->flags)) { | 5844 | && !test_bit(Faulty, &rdev->flags)) { |
5801 | rdev->recovery_offset = 0; | 5845 | rdev->recovery_offset = 0; |
@@ -5813,6 +5857,7 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5813 | } else | 5857 | } else |
5814 | break; | 5858 | break; |
5815 | } | 5859 | } |
5860 | } | ||
5816 | } | 5861 | } |
5817 | return spares; | 5862 | return spares; |
5818 | } | 5863 | } |
@@ -5826,7 +5871,7 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5826 | * to do that as needed. | 5871 | * to do that as needed. |
5827 | * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in | 5872 | * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in |
5828 | * "->recovery" and create a thread at ->sync_thread. | 5873 | * "->recovery" and create a thread at ->sync_thread. |
5829 | * When the thread finishes it sets MD_RECOVERY_DONE (and might set MD_RECOVERY_ERR) | 5874 | * When the thread finishes it sets MD_RECOVERY_DONE |
5830 | * and wakeups up this thread which will reap the thread and finish up. | 5875 | * and wakeups up this thread which will reap the thread and finish up. |
5831 | * This thread also removes any faulty devices (with nr_pending == 0). | 5876 | * This thread also removes any faulty devices (with nr_pending == 0). |
5832 | * | 5877 | * |
@@ -5901,8 +5946,7 @@ void md_check_recovery(mddev_t *mddev) | |||
5901 | /* resync has finished, collect result */ | 5946 | /* resync has finished, collect result */ |
5902 | md_unregister_thread(mddev->sync_thread); | 5947 | md_unregister_thread(mddev->sync_thread); |
5903 | mddev->sync_thread = NULL; | 5948 | mddev->sync_thread = NULL; |
5904 | if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && | 5949 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
5905 | !test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | ||
5906 | /* success...*/ | 5950 | /* success...*/ |
5907 | /* activate any spares */ | 5951 | /* activate any spares */ |
5908 | mddev->pers->spare_active(mddev); | 5952 | mddev->pers->spare_active(mddev); |
@@ -5926,7 +5970,6 @@ void md_check_recovery(mddev_t *mddev) | |||
5926 | * might be left set | 5970 | * might be left set |
5927 | */ | 5971 | */ |
5928 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 5972 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
5929 | clear_bit(MD_RECOVERY_ERR, &mddev->recovery); | ||
5930 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); | 5973 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5931 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | 5974 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); |
5932 | 5975 | ||
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 4f4d1f383842..e968116e0de9 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -327,7 +327,8 @@ static int multipath_remove_disk(mddev_t *mddev, int number) | |||
327 | if (rdev) { | 327 | if (rdev) { |
328 | if (test_bit(In_sync, &rdev->flags) || | 328 | if (test_bit(In_sync, &rdev->flags) || |
329 | atomic_read(&rdev->nr_pending)) { | 329 | atomic_read(&rdev->nr_pending)) { |
330 | printk(KERN_ERR "hot-remove-disk, slot %d is identified" " but is still operational!\n", number); | 330 | printk(KERN_ERR "hot-remove-disk, slot %d is identified" |
331 | " but is still operational!\n", number); | ||
331 | err = -EBUSY; | 332 | err = -EBUSY; |
332 | goto abort; | 333 | goto abort; |
333 | } | 334 | } |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ac409b7d83f5..c610b947218a 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -773,7 +773,7 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
773 | r1bio_t *r1_bio; | 773 | r1bio_t *r1_bio; |
774 | struct bio *read_bio; | 774 | struct bio *read_bio; |
775 | int i, targets = 0, disks; | 775 | int i, targets = 0, disks; |
776 | struct bitmap *bitmap = mddev->bitmap; | 776 | struct bitmap *bitmap; |
777 | unsigned long flags; | 777 | unsigned long flags; |
778 | struct bio_list bl; | 778 | struct bio_list bl; |
779 | struct page **behind_pages = NULL; | 779 | struct page **behind_pages = NULL; |
@@ -802,6 +802,8 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
802 | 802 | ||
803 | wait_barrier(conf); | 803 | wait_barrier(conf); |
804 | 804 | ||
805 | bitmap = mddev->bitmap; | ||
806 | |||
805 | disk_stat_inc(mddev->gendisk, ios[rw]); | 807 | disk_stat_inc(mddev->gendisk, ios[rw]); |
806 | disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); | 808 | disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); |
807 | 809 | ||
@@ -1025,7 +1027,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1025 | /* | 1027 | /* |
1026 | * if recovery is running, make sure it aborts. | 1028 | * if recovery is running, make sure it aborts. |
1027 | */ | 1029 | */ |
1028 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 1030 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1029 | } else | 1031 | } else |
1030 | set_bit(Faulty, &rdev->flags); | 1032 | set_bit(Faulty, &rdev->flags); |
1031 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 1033 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
@@ -1146,6 +1148,14 @@ static int raid1_remove_disk(mddev_t *mddev, int number) | |||
1146 | err = -EBUSY; | 1148 | err = -EBUSY; |
1147 | goto abort; | 1149 | goto abort; |
1148 | } | 1150 | } |
1151 | /* Only remove non-faulty devices is recovery | ||
1152 | * is not possible. | ||
1153 | */ | ||
1154 | if (!test_bit(Faulty, &rdev->flags) && | ||
1155 | mddev->degraded < conf->raid_disks) { | ||
1156 | err = -EBUSY; | ||
1157 | goto abort; | ||
1158 | } | ||
1149 | p->rdev = NULL; | 1159 | p->rdev = NULL; |
1150 | synchronize_rcu(); | 1160 | synchronize_rcu(); |
1151 | if (atomic_read(&rdev->nr_pending)) { | 1161 | if (atomic_read(&rdev->nr_pending)) { |
@@ -1282,6 +1292,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1282 | rdev_dec_pending(conf->mirrors[i].rdev, mddev); | 1292 | rdev_dec_pending(conf->mirrors[i].rdev, mddev); |
1283 | } else { | 1293 | } else { |
1284 | /* fixup the bio for reuse */ | 1294 | /* fixup the bio for reuse */ |
1295 | int size; | ||
1285 | sbio->bi_vcnt = vcnt; | 1296 | sbio->bi_vcnt = vcnt; |
1286 | sbio->bi_size = r1_bio->sectors << 9; | 1297 | sbio->bi_size = r1_bio->sectors << 9; |
1287 | sbio->bi_idx = 0; | 1298 | sbio->bi_idx = 0; |
@@ -1295,10 +1306,20 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1295 | sbio->bi_sector = r1_bio->sector + | 1306 | sbio->bi_sector = r1_bio->sector + |
1296 | conf->mirrors[i].rdev->data_offset; | 1307 | conf->mirrors[i].rdev->data_offset; |
1297 | sbio->bi_bdev = conf->mirrors[i].rdev->bdev; | 1308 | sbio->bi_bdev = conf->mirrors[i].rdev->bdev; |
1298 | for (j = 0; j < vcnt ; j++) | 1309 | size = sbio->bi_size; |
1299 | memcpy(page_address(sbio->bi_io_vec[j].bv_page), | 1310 | for (j = 0; j < vcnt ; j++) { |
1311 | struct bio_vec *bi; | ||
1312 | bi = &sbio->bi_io_vec[j]; | ||
1313 | bi->bv_offset = 0; | ||
1314 | if (size > PAGE_SIZE) | ||
1315 | bi->bv_len = PAGE_SIZE; | ||
1316 | else | ||
1317 | bi->bv_len = size; | ||
1318 | size -= PAGE_SIZE; | ||
1319 | memcpy(page_address(bi->bv_page), | ||
1300 | page_address(pbio->bi_io_vec[j].bv_page), | 1320 | page_address(pbio->bi_io_vec[j].bv_page), |
1301 | PAGE_SIZE); | 1321 | PAGE_SIZE); |
1322 | } | ||
1302 | 1323 | ||
1303 | } | 1324 | } |
1304 | } | 1325 | } |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8536ede1e712..1de17da34a95 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1020,7 +1020,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1020 | /* | 1020 | /* |
1021 | * if recovery is running, make sure it aborts. | 1021 | * if recovery is running, make sure it aborts. |
1022 | */ | 1022 | */ |
1023 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 1023 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1024 | } | 1024 | } |
1025 | set_bit(Faulty, &rdev->flags); | 1025 | set_bit(Faulty, &rdev->flags); |
1026 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 1026 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
@@ -1171,6 +1171,14 @@ static int raid10_remove_disk(mddev_t *mddev, int number) | |||
1171 | err = -EBUSY; | 1171 | err = -EBUSY; |
1172 | goto abort; | 1172 | goto abort; |
1173 | } | 1173 | } |
1174 | /* Only remove faulty devices in recovery | ||
1175 | * is not possible. | ||
1176 | */ | ||
1177 | if (!test_bit(Faulty, &rdev->flags) && | ||
1178 | enough(conf)) { | ||
1179 | err = -EBUSY; | ||
1180 | goto abort; | ||
1181 | } | ||
1174 | p->rdev = NULL; | 1182 | p->rdev = NULL; |
1175 | synchronize_rcu(); | 1183 | synchronize_rcu(); |
1176 | if (atomic_read(&rdev->nr_pending)) { | 1184 | if (atomic_read(&rdev->nr_pending)) { |
@@ -1237,6 +1245,7 @@ static void end_sync_write(struct bio *bio, int error) | |||
1237 | 1245 | ||
1238 | if (!uptodate) | 1246 | if (!uptodate) |
1239 | md_error(mddev, conf->mirrors[d].rdev); | 1247 | md_error(mddev, conf->mirrors[d].rdev); |
1248 | |||
1240 | update_head_pos(i, r10_bio); | 1249 | update_head_pos(i, r10_bio); |
1241 | 1250 | ||
1242 | while (atomic_dec_and_test(&r10_bio->remaining)) { | 1251 | while (atomic_dec_and_test(&r10_bio->remaining)) { |
@@ -1844,7 +1853,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1844 | if (rb2) | 1853 | if (rb2) |
1845 | atomic_dec(&rb2->remaining); | 1854 | atomic_dec(&rb2->remaining); |
1846 | r10_bio = rb2; | 1855 | r10_bio = rb2; |
1847 | if (!test_and_set_bit(MD_RECOVERY_ERR, &mddev->recovery)) | 1856 | if (!test_and_set_bit(MD_RECOVERY_INTR, |
1857 | &mddev->recovery)) | ||
1848 | printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n", | 1858 | printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n", |
1849 | mdname(mddev)); | 1859 | mdname(mddev)); |
1850 | break; | 1860 | break; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 93fde48c0f42..425958a76b84 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -94,6 +94,8 @@ | |||
94 | #define __inline__ | 94 | #define __inline__ |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | #define printk_rl(args...) ((void) (printk_ratelimit() && printk(args))) | ||
98 | |||
97 | #if !RAID6_USE_EMPTY_ZERO_PAGE | 99 | #if !RAID6_USE_EMPTY_ZERO_PAGE |
98 | /* In .bss so it's zeroed */ | 100 | /* In .bss so it's zeroed */ |
99 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); | 101 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); |
@@ -1143,10 +1145,12 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1143 | set_bit(R5_UPTODATE, &sh->dev[i].flags); | 1145 | set_bit(R5_UPTODATE, &sh->dev[i].flags); |
1144 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { | 1146 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { |
1145 | rdev = conf->disks[i].rdev; | 1147 | rdev = conf->disks[i].rdev; |
1146 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", | 1148 | printk_rl(KERN_INFO "raid5:%s: read error corrected" |
1147 | mdname(conf->mddev), STRIPE_SECTORS, | 1149 | " (%lu sectors at %llu on %s)\n", |
1148 | (unsigned long long)(sh->sector + rdev->data_offset), | 1150 | mdname(conf->mddev), STRIPE_SECTORS, |
1149 | bdevname(rdev->bdev, b)); | 1151 | (unsigned long long)(sh->sector |
1152 | + rdev->data_offset), | ||
1153 | bdevname(rdev->bdev, b)); | ||
1150 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1154 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
1151 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1155 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
1152 | } | 1156 | } |
@@ -1160,16 +1164,22 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1160 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); | 1164 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); |
1161 | atomic_inc(&rdev->read_errors); | 1165 | atomic_inc(&rdev->read_errors); |
1162 | if (conf->mddev->degraded) | 1166 | if (conf->mddev->degraded) |
1163 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", | 1167 | printk_rl(KERN_WARNING |
1164 | mdname(conf->mddev), | 1168 | "raid5:%s: read error not correctable " |
1165 | (unsigned long long)(sh->sector + rdev->data_offset), | 1169 | "(sector %llu on %s).\n", |
1166 | bdn); | 1170 | mdname(conf->mddev), |
1171 | (unsigned long long)(sh->sector | ||
1172 | + rdev->data_offset), | ||
1173 | bdn); | ||
1167 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1174 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) |
1168 | /* Oh, no!!! */ | 1175 | /* Oh, no!!! */ |
1169 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", | 1176 | printk_rl(KERN_WARNING |
1170 | mdname(conf->mddev), | 1177 | "raid5:%s: read error NOT corrected!! " |
1171 | (unsigned long long)(sh->sector + rdev->data_offset), | 1178 | "(sector %llu on %s).\n", |
1172 | bdn); | 1179 | mdname(conf->mddev), |
1180 | (unsigned long long)(sh->sector | ||
1181 | + rdev->data_offset), | ||
1182 | bdn); | ||
1173 | else if (atomic_read(&rdev->read_errors) | 1183 | else if (atomic_read(&rdev->read_errors) |
1174 | > conf->max_nr_stripes) | 1184 | > conf->max_nr_stripes) |
1175 | printk(KERN_WARNING | 1185 | printk(KERN_WARNING |
@@ -1258,7 +1268,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1258 | /* | 1268 | /* |
1259 | * if recovery was running, make sure it aborts. | 1269 | * if recovery was running, make sure it aborts. |
1260 | */ | 1270 | */ |
1261 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 1271 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1262 | } | 1272 | } |
1263 | set_bit(Faulty, &rdev->flags); | 1273 | set_bit(Faulty, &rdev->flags); |
1264 | printk (KERN_ALERT | 1274 | printk (KERN_ALERT |
@@ -4564,6 +4574,14 @@ static int raid5_remove_disk(mddev_t *mddev, int number) | |||
4564 | err = -EBUSY; | 4574 | err = -EBUSY; |
4565 | goto abort; | 4575 | goto abort; |
4566 | } | 4576 | } |
4577 | /* Only remove non-faulty devices if recovery | ||
4578 | * isn't possible. | ||
4579 | */ | ||
4580 | if (!test_bit(Faulty, &rdev->flags) && | ||
4581 | mddev->degraded <= conf->max_degraded) { | ||
4582 | err = -EBUSY; | ||
4583 | goto abort; | ||
4584 | } | ||
4567 | p->rdev = NULL; | 4585 | p->rdev = NULL; |
4568 | synchronize_rcu(); | 4586 | synchronize_rcu(); |
4569 | if (atomic_read(&rdev->nr_pending)) { | 4587 | if (atomic_read(&rdev->nr_pending)) { |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 89d8d37838a3..3b26fbd3e558 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -901,7 +901,7 @@ endif # V4L_USB_DRIVERS | |||
901 | 901 | ||
902 | config SOC_CAMERA | 902 | config SOC_CAMERA |
903 | tristate "SoC camera support" | 903 | tristate "SoC camera support" |
904 | depends on VIDEO_V4L2 | 904 | depends on VIDEO_V4L2 && HAS_DMA |
905 | select VIDEOBUF_DMA_SG | 905 | select VIDEOBUF_DMA_SG |
906 | help | 906 | help |
907 | SoC Camera is a common API to several cameras, not connecting | 907 | SoC Camera is a common API to several cameras, not connecting |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 2ca3e9cfb2bb..0165aac533bf 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2613,7 +2613,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2613 | struct bttv_fh *fh = priv; | 2613 | struct bttv_fh *fh = priv; |
2614 | 2614 | ||
2615 | mutex_lock(&fh->cap.vb_lock); | 2615 | mutex_lock(&fh->cap.vb_lock); |
2616 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2616 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2617 | V4L2_MEMORY_MMAP); | 2617 | V4L2_MEMORY_MMAP); |
2618 | if (retval < 0) { | 2618 | if (retval < 0) { |
2619 | mutex_unlock(&fh->cap.vb_lock); | 2619 | mutex_unlock(&fh->cap.vb_lock); |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 198f0afb812e..a0f7bc1edaa2 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -92,6 +92,7 @@ struct tuner { | |||
92 | unsigned int type; /* chip type id */ | 92 | unsigned int type; /* chip type id */ |
93 | unsigned int config; | 93 | unsigned int config; |
94 | int (*tuner_callback) (void *dev, int command, int arg); | 94 | int (*tuner_callback) (void *dev, int command, int arg); |
95 | const char *name; | ||
95 | }; | 96 | }; |
96 | 97 | ||
97 | /* standard i2c insmod options */ | 98 | /* standard i2c insmod options */ |
@@ -330,13 +331,13 @@ static void tuner_i2c_address_check(struct tuner *t) | |||
330 | tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); | 331 | tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); |
331 | tuner_warn("will soon be dropped. This message indicates that your\n"); | 332 | tuner_warn("will soon be dropped. This message indicates that your\n"); |
332 | tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", | 333 | tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", |
333 | t->i2c->name, t->i2c->addr); | 334 | t->name, t->i2c->addr); |
334 | tuner_warn("To ensure continued support for your device, please\n"); | 335 | tuner_warn("To ensure continued support for your device, please\n"); |
335 | tuner_warn("send a copy of this message, along with full dmesg\n"); | 336 | tuner_warn("send a copy of this message, along with full dmesg\n"); |
336 | tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); | 337 | tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); |
337 | tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); | 338 | tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); |
338 | tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", | 339 | tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", |
339 | t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name); | 340 | t->i2c->adapter->name, t->i2c->addr, t->type, t->name); |
340 | tuner_warn("====================== WARNING! ======================\n"); | 341 | tuner_warn("====================== WARNING! ======================\n"); |
341 | } | 342 | } |
342 | 343 | ||
@@ -470,19 +471,17 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
470 | if ((NULL == analog_ops->set_params) && | 471 | if ((NULL == analog_ops->set_params) && |
471 | (fe_tuner_ops->set_analog_params)) { | 472 | (fe_tuner_ops->set_analog_params)) { |
472 | 473 | ||
473 | strlcpy(t->i2c->name, fe_tuner_ops->info.name, | 474 | t->name = fe_tuner_ops->info.name; |
474 | sizeof(t->i2c->name)); | ||
475 | 475 | ||
476 | t->fe.analog_demod_priv = t; | 476 | t->fe.analog_demod_priv = t; |
477 | memcpy(analog_ops, &tuner_core_ops, | 477 | memcpy(analog_ops, &tuner_core_ops, |
478 | sizeof(struct analog_demod_ops)); | 478 | sizeof(struct analog_demod_ops)); |
479 | 479 | ||
480 | } else { | 480 | } else { |
481 | strlcpy(t->i2c->name, analog_ops->info.name, | 481 | t->name = analog_ops->info.name; |
482 | sizeof(t->i2c->name)); | ||
483 | } | 482 | } |
484 | 483 | ||
485 | tuner_dbg("type set to %s\n", t->i2c->name); | 484 | tuner_dbg("type set to %s\n", t->name); |
486 | 485 | ||
487 | if (t->mode_mask == T_UNINITIALIZED) | 486 | if (t->mode_mask == T_UNINITIALIZED) |
488 | t->mode_mask = new_mode_mask; | 487 | t->mode_mask = new_mode_mask; |
@@ -1115,6 +1114,7 @@ static int tuner_probe(struct i2c_client *client, | |||
1115 | if (NULL == t) | 1114 | if (NULL == t) |
1116 | return -ENOMEM; | 1115 | return -ENOMEM; |
1117 | t->i2c = client; | 1116 | t->i2c = client; |
1117 | t->name = "(tuner unset)"; | ||
1118 | i2c_set_clientdata(client, t); | 1118 | i2c_set_clientdata(client, t); |
1119 | t->type = UNSET; | 1119 | t->type = UNSET; |
1120 | t->audmode = V4L2_TUNER_MODE_STEREO; | 1120 | t->audmode = V4L2_TUNER_MODE_STEREO; |
@@ -1272,12 +1272,6 @@ static int tuner_remove(struct i2c_client *client) | |||
1272 | 1272 | ||
1273 | list_del(&t->list); | 1273 | list_del(&t->list); |
1274 | kfree(t); | 1274 | kfree(t); |
1275 | |||
1276 | /* The probing code has overwritten the device name, restore it so | ||
1277 | that reloading the driver will work. Ideally the device name | ||
1278 | should not be overwritten in the first place, but for now that | ||
1279 | will do. */ | ||
1280 | strlcpy(client->name, "tuner", I2C_NAME_SIZE); | ||
1281 | return 0; | 1275 | return 0; |
1282 | } | 1276 | } |
1283 | 1277 | ||
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 982f4463896c..0a88c44ace00 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -331,7 +331,7 @@ int videobuf_mmap_free(struct videobuf_queue *q) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | /* Locking: Caller holds q->vb_lock */ | 333 | /* Locking: Caller holds q->vb_lock */ |
334 | static int __videobuf_mmap_setup(struct videobuf_queue *q, | 334 | int __videobuf_mmap_setup(struct videobuf_queue *q, |
335 | unsigned int bcount, unsigned int bsize, | 335 | unsigned int bcount, unsigned int bsize, |
336 | enum v4l2_memory memory) | 336 | enum v4l2_memory memory) |
337 | { | 337 | { |
@@ -1129,6 +1129,7 @@ EXPORT_SYMBOL_GPL(videobuf_read_stream); | |||
1129 | EXPORT_SYMBOL_GPL(videobuf_read_one); | 1129 | EXPORT_SYMBOL_GPL(videobuf_read_one); |
1130 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); | 1130 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); |
1131 | 1131 | ||
1132 | EXPORT_SYMBOL_GPL(__videobuf_mmap_setup); | ||
1132 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); | 1133 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); |
1133 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); | 1134 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); |
1134 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); | 1135 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 2566479937c9..ae96bd6242f2 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -24,7 +24,7 @@ config MFD_ASIC3 | |||
24 | 24 | ||
25 | config HTC_EGPIO | 25 | config HTC_EGPIO |
26 | bool "HTC EGPIO support" | 26 | bool "HTC EGPIO support" |
27 | depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB | 27 | depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM |
28 | help | 28 | help |
29 | This driver supports the CPLD egpio chip present on | 29 | This driver supports the CPLD egpio chip present on |
30 | several HTC phones. It provides basic support for input | 30 | several HTC phones. It provides basic support for input |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 3f28f6eabdbf..a0ce0b2fa03e 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -3821,7 +3821,7 @@ TPACPI_HANDLE(led, ec, "SLED", /* 570 */ | |||
3821 | #define TPACPI_LED_NUMLEDS 8 | 3821 | #define TPACPI_LED_NUMLEDS 8 |
3822 | static struct tpacpi_led_classdev *tpacpi_leds; | 3822 | static struct tpacpi_led_classdev *tpacpi_leds; |
3823 | static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; | 3823 | static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; |
3824 | static const char const *tpacpi_led_names[TPACPI_LED_NUMLEDS] = { | 3824 | static const char * const tpacpi_led_names[TPACPI_LED_NUMLEDS] = { |
3825 | /* there's a limit of 19 chars + NULL before 2.6.26 */ | 3825 | /* there's a limit of 19 chars + NULL before 2.6.26 */ |
3826 | "tpacpi::power", | 3826 | "tpacpi::power", |
3827 | "tpacpi:orange:batt", | 3827 | "tpacpi:orange:batt", |
@@ -3860,10 +3860,10 @@ static int led_get_status(unsigned int led) | |||
3860 | static int led_set_status(unsigned int led, enum led_status_t ledstatus) | 3860 | static int led_set_status(unsigned int led, enum led_status_t ledstatus) |
3861 | { | 3861 | { |
3862 | /* off, on, blink. Index is led_status_t */ | 3862 | /* off, on, blink. Index is led_status_t */ |
3863 | static const int const led_sled_arg1[] = { 0, 1, 3 }; | 3863 | static const int led_sled_arg1[] = { 0, 1, 3 }; |
3864 | static const int const led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ | 3864 | static const int led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ |
3865 | static const int const led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ | 3865 | static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ |
3866 | static const int const led_led_arg1[] = { 0, 0x80, 0xc0 }; | 3866 | static const int led_led_arg1[] = { 0, 0x80, 0xc0 }; |
3867 | 3867 | ||
3868 | int rc = 0; | 3868 | int rc = 0; |
3869 | 3869 | ||
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 3b3cd0e74715..dead61754ad7 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -119,7 +119,7 @@ config MMC_TIFM_SD | |||
119 | 119 | ||
120 | config MMC_SPI | 120 | config MMC_SPI |
121 | tristate "MMC/SD over SPI" | 121 | tristate "MMC/SD over SPI" |
122 | depends on MMC && SPI_MASTER && !HIGHMEM | 122 | depends on MMC && SPI_MASTER && !HIGHMEM && HAS_DMA |
123 | select CRC7 | 123 | select CRC7 |
124 | select CRC_ITU_T | 124 | select CRC_ITU_T |
125 | help | 125 | help |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 59d8fb49270a..effaf7cdefab 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
@@ -331,15 +331,15 @@ static void __devexit ck804xrom_remove_one (struct pci_dev *pdev) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | static struct pci_device_id ck804xrom_pci_tbl[] = { | 333 | static struct pci_device_id ck804xrom_pci_tbl[] = { |
334 | { PCI_VENDOR_ID_NVIDIA, 0x0051, PCI_ANY_ID, PCI_ANY_ID, DEV_CK804 }, | 334 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0051), .driver_data = DEV_CK804 }, |
335 | { PCI_VENDOR_ID_NVIDIA, 0x0360, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 335 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0360), .driver_data = DEV_MCP55 }, |
336 | { PCI_VENDOR_ID_NVIDIA, 0x0361, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 336 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0361), .driver_data = DEV_MCP55 }, |
337 | { PCI_VENDOR_ID_NVIDIA, 0x0362, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 337 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0362), .driver_data = DEV_MCP55 }, |
338 | { PCI_VENDOR_ID_NVIDIA, 0x0363, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 338 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0363), .driver_data = DEV_MCP55 }, |
339 | { PCI_VENDOR_ID_NVIDIA, 0x0364, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 339 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0364), .driver_data = DEV_MCP55 }, |
340 | { PCI_VENDOR_ID_NVIDIA, 0x0365, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 340 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0365), .driver_data = DEV_MCP55 }, |
341 | { PCI_VENDOR_ID_NVIDIA, 0x0366, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 341 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0366), .driver_data = DEV_MCP55 }, |
342 | { PCI_VENDOR_ID_NVIDIA, 0x0367, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 342 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0367), .driver_data = DEV_MCP55 }, |
343 | { 0, } | 343 | { 0, } |
344 | }; | 344 | }; |
345 | 345 | ||
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index e6c545fe5f58..b9d097c9f6bb 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -413,7 +413,7 @@ static int __devinit el3_pnp_probe(struct pnp_dev *pdev, | |||
413 | { | 413 | { |
414 | short i; | 414 | short i; |
415 | int ioaddr, irq, if_port; | 415 | int ioaddr, irq, if_port; |
416 | u16 phys_addr[3]; | 416 | __be16 phys_addr[3]; |
417 | struct net_device *dev = NULL; | 417 | struct net_device *dev = NULL; |
418 | int err; | 418 | int err; |
419 | 419 | ||
@@ -605,7 +605,7 @@ static int __init el3_mca_probe(struct device *device) | |||
605 | 605 | ||
606 | short i; | 606 | short i; |
607 | int ioaddr, irq, if_port; | 607 | int ioaddr, irq, if_port; |
608 | u16 phys_addr[3]; | 608 | __be16 phys_addr[3]; |
609 | struct net_device *dev = NULL; | 609 | struct net_device *dev = NULL; |
610 | u_char pos4, pos5; | 610 | u_char pos4, pos5; |
611 | struct mca_device *mdev = to_mca_device(device); | 611 | struct mca_device *mdev = to_mca_device(device); |
@@ -635,14 +635,13 @@ static int __init el3_mca_probe(struct device *device) | |||
635 | printk(KERN_DEBUG "3c529: irq %d ioaddr 0x%x ifport %d\n", irq, ioaddr, if_port); | 635 | printk(KERN_DEBUG "3c529: irq %d ioaddr 0x%x ifport %d\n", irq, ioaddr, if_port); |
636 | } | 636 | } |
637 | EL3WINDOW(0); | 637 | EL3WINDOW(0); |
638 | for (i = 0; i < 3; i++) { | 638 | for (i = 0; i < 3; i++) |
639 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); | 639 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); |
640 | } | ||
641 | 640 | ||
642 | dev = alloc_etherdev(sizeof (struct el3_private)); | 641 | dev = alloc_etherdev(sizeof (struct el3_private)); |
643 | if (dev == NULL) { | 642 | if (dev == NULL) { |
644 | release_region(ioaddr, EL3_IO_EXTENT); | 643 | release_region(ioaddr, EL3_IO_EXTENT); |
645 | return -ENOMEM; | 644 | return -ENOMEM; |
646 | } | 645 | } |
647 | 646 | ||
648 | netdev_boot_setup_check(dev); | 647 | netdev_boot_setup_check(dev); |
@@ -668,7 +667,7 @@ static int __init el3_eisa_probe (struct device *device) | |||
668 | { | 667 | { |
669 | short i; | 668 | short i; |
670 | int ioaddr, irq, if_port; | 669 | int ioaddr, irq, if_port; |
671 | u16 phys_addr[3]; | 670 | __be16 phys_addr[3]; |
672 | struct net_device *dev = NULL; | 671 | struct net_device *dev = NULL; |
673 | struct eisa_device *edev; | 672 | struct eisa_device *edev; |
674 | int err; | 673 | int err; |
@@ -1063,7 +1062,6 @@ el3_rx(struct net_device *dev) | |||
1063 | struct sk_buff *skb; | 1062 | struct sk_buff *skb; |
1064 | 1063 | ||
1065 | skb = dev_alloc_skb(pkt_len+5); | 1064 | skb = dev_alloc_skb(pkt_len+5); |
1066 | dev->stats.rx_bytes += pkt_len; | ||
1067 | if (el3_debug > 4) | 1065 | if (el3_debug > 4) |
1068 | printk("Receiving packet size %d status %4.4x.\n", | 1066 | printk("Receiving packet size %d status %4.4x.\n", |
1069 | pkt_len, rx_status); | 1067 | pkt_len, rx_status); |
@@ -1078,6 +1076,7 @@ el3_rx(struct net_device *dev) | |||
1078 | skb->protocol = eth_type_trans(skb,dev); | 1076 | skb->protocol = eth_type_trans(skb,dev); |
1079 | netif_rx(skb); | 1077 | netif_rx(skb); |
1080 | dev->last_rx = jiffies; | 1078 | dev->last_rx = jiffies; |
1079 | dev->stats.rx_bytes += pkt_len; | ||
1081 | dev->stats.rx_packets++; | 1080 | dev->stats.rx_packets++; |
1082 | continue; | 1081 | continue; |
1083 | } | 1082 | } |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9f6cc8a56073..dd0ec9ebc939 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1353,7 +1353,7 @@ config APRICOT | |||
1353 | 1353 | ||
1354 | config B44 | 1354 | config B44 |
1355 | tristate "Broadcom 440x/47xx ethernet support" | 1355 | tristate "Broadcom 440x/47xx ethernet support" |
1356 | depends on SSB_POSSIBLE | 1356 | depends on SSB_POSSIBLE && HAS_DMA |
1357 | select SSB | 1357 | select SSB |
1358 | select MII | 1358 | select MII |
1359 | help | 1359 | help |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 9c2394d49428..6e4c80d41b08 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -2135,7 +2135,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
2135 | return -1; | 2135 | return -1; |
2136 | } | 2136 | } |
2137 | 2137 | ||
2138 | if (skb->protocol == ntohs(ETH_P_IP)) { | 2138 | if (skb->protocol == htons(ETH_P_IP)) { |
2139 | struct iphdr *iph = ip_hdr(skb); | 2139 | struct iphdr *iph = ip_hdr(skb); |
2140 | 2140 | ||
2141 | real_len = (((unsigned char *)iph - skb->data) + | 2141 | real_len = (((unsigned char *)iph - skb->data) + |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 3634b5fd7919..7023d77bf380 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -1239,12 +1239,7 @@ static int au1000_rx(struct net_device *dev) | |||
1239 | */ | 1239 | */ |
1240 | static irqreturn_t au1000_interrupt(int irq, void *dev_id) | 1240 | static irqreturn_t au1000_interrupt(int irq, void *dev_id) |
1241 | { | 1241 | { |
1242 | struct net_device *dev = (struct net_device *) dev_id; | 1242 | struct net_device *dev = dev_id; |
1243 | |||
1244 | if (dev == NULL) { | ||
1245 | printk(KERN_ERR "%s: isr: null dev ptr\n", dev->name); | ||
1246 | return IRQ_RETVAL(1); | ||
1247 | } | ||
1248 | 1243 | ||
1249 | /* Handle RX interrupts first to minimize chance of overrun */ | 1244 | /* Handle RX interrupts first to minimize chance of overrun */ |
1250 | 1245 | ||
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 89c0018132ec..41443435ab1c 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/crc32.h> | 22 | #include <linux/crc32.h> |
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/ethtool.h> | ||
26 | #include <linux/mii.h> | 25 | #include <linux/mii.h> |
27 | #include <linux/phy.h> | 26 | #include <linux/phy.h> |
28 | #include <linux/netdevice.h> | 27 | #include <linux/netdevice.h> |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 68c41a00d93d..08f3d396bcd6 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1437,8 +1437,16 @@ int bond_create_sysfs(void) | |||
1437 | * configure multiple bonding devices. | 1437 | * configure multiple bonding devices. |
1438 | */ | 1438 | */ |
1439 | if (ret == -EEXIST) { | 1439 | if (ret == -EEXIST) { |
1440 | netdev_class = NULL; | 1440 | /* Is someone being kinky and naming a device bonding_master? */ |
1441 | return 0; | 1441 | if (__dev_get_by_name(&init_net, |
1442 | class_attr_bonding_masters.attr.name)) | ||
1443 | printk(KERN_ERR | ||
1444 | "network device named %s already exists in sysfs", | ||
1445 | class_attr_bonding_masters.attr.name); | ||
1446 | else { | ||
1447 | netdev_class = NULL; | ||
1448 | return 0; | ||
1449 | } | ||
1442 | } | 1450 | } |
1443 | 1451 | ||
1444 | return ret; | 1452 | return ret; |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 93e13636f8dd..83768df27806 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -142,8 +142,8 @@ | |||
142 | 142 | ||
143 | #define DRV_MODULE_NAME "cassini" | 143 | #define DRV_MODULE_NAME "cassini" |
144 | #define PFX DRV_MODULE_NAME ": " | 144 | #define PFX DRV_MODULE_NAME ": " |
145 | #define DRV_MODULE_VERSION "1.5" | 145 | #define DRV_MODULE_VERSION "1.6" |
146 | #define DRV_MODULE_RELDATE "4 Jan 2008" | 146 | #define DRV_MODULE_RELDATE "21 May 2008" |
147 | 147 | ||
148 | #define CAS_DEF_MSG_ENABLE \ | 148 | #define CAS_DEF_MSG_ENABLE \ |
149 | (NETIF_MSG_DRV | \ | 149 | (NETIF_MSG_DRV | \ |
@@ -2136,9 +2136,12 @@ end_copy_pkt: | |||
2136 | if (addr) | 2136 | if (addr) |
2137 | cas_page_unmap(addr); | 2137 | cas_page_unmap(addr); |
2138 | } | 2138 | } |
2139 | skb->csum = csum_unfold(~csum); | ||
2140 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
2141 | skb->protocol = eth_type_trans(skb, cp->dev); | 2139 | skb->protocol = eth_type_trans(skb, cp->dev); |
2140 | if (skb->protocol == htons(ETH_P_IP)) { | ||
2141 | skb->csum = csum_unfold(~csum); | ||
2142 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
2143 | } else | ||
2144 | skb->ip_summed = CHECKSUM_NONE; | ||
2142 | return len; | 2145 | return len; |
2143 | } | 2146 | } |
2144 | 2147 | ||
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 2b5740b3d182..7f3f62e1b113 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
40 | #include <asm/gpio.h> | 40 | #include <asm/gpio.h> |
41 | #include <asm/atomic.h> | ||
41 | 42 | ||
42 | MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>"); | 43 | MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>"); |
43 | MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)"); | 44 | MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)"); |
@@ -187,6 +188,7 @@ struct cpmac_desc { | |||
187 | #define CPMAC_EOQ 0x1000 | 188 | #define CPMAC_EOQ 0x1000 |
188 | struct sk_buff *skb; | 189 | struct sk_buff *skb; |
189 | struct cpmac_desc *next; | 190 | struct cpmac_desc *next; |
191 | struct cpmac_desc *prev; | ||
190 | dma_addr_t mapping; | 192 | dma_addr_t mapping; |
191 | dma_addr_t data_mapping; | 193 | dma_addr_t data_mapping; |
192 | }; | 194 | }; |
@@ -208,6 +210,7 @@ struct cpmac_priv { | |||
208 | struct work_struct reset_work; | 210 | struct work_struct reset_work; |
209 | struct platform_device *pdev; | 211 | struct platform_device *pdev; |
210 | struct napi_struct napi; | 212 | struct napi_struct napi; |
213 | atomic_t reset_pending; | ||
211 | }; | 214 | }; |
212 | 215 | ||
213 | static irqreturn_t cpmac_irq(int, void *); | 216 | static irqreturn_t cpmac_irq(int, void *); |
@@ -241,6 +244,16 @@ static void cpmac_dump_desc(struct net_device *dev, struct cpmac_desc *desc) | |||
241 | printk("\n"); | 244 | printk("\n"); |
242 | } | 245 | } |
243 | 246 | ||
247 | static void cpmac_dump_all_desc(struct net_device *dev) | ||
248 | { | ||
249 | struct cpmac_priv *priv = netdev_priv(dev); | ||
250 | struct cpmac_desc *dump = priv->rx_head; | ||
251 | do { | ||
252 | cpmac_dump_desc(dev, dump); | ||
253 | dump = dump->next; | ||
254 | } while (dump != priv->rx_head); | ||
255 | } | ||
256 | |||
244 | static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb) | 257 | static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb) |
245 | { | 258 | { |
246 | int i; | 259 | int i; |
@@ -412,21 +425,42 @@ static struct sk_buff *cpmac_rx_one(struct cpmac_priv *priv, | |||
412 | static int cpmac_poll(struct napi_struct *napi, int budget) | 425 | static int cpmac_poll(struct napi_struct *napi, int budget) |
413 | { | 426 | { |
414 | struct sk_buff *skb; | 427 | struct sk_buff *skb; |
415 | struct cpmac_desc *desc; | 428 | struct cpmac_desc *desc, *restart; |
416 | int received = 0; | ||
417 | struct cpmac_priv *priv = container_of(napi, struct cpmac_priv, napi); | 429 | struct cpmac_priv *priv = container_of(napi, struct cpmac_priv, napi); |
430 | int received = 0, processed = 0; | ||
418 | 431 | ||
419 | spin_lock(&priv->rx_lock); | 432 | spin_lock(&priv->rx_lock); |
420 | if (unlikely(!priv->rx_head)) { | 433 | if (unlikely(!priv->rx_head)) { |
421 | if (netif_msg_rx_err(priv) && net_ratelimit()) | 434 | if (netif_msg_rx_err(priv) && net_ratelimit()) |
422 | printk(KERN_WARNING "%s: rx: polling, but no queue\n", | 435 | printk(KERN_WARNING "%s: rx: polling, but no queue\n", |
423 | priv->dev->name); | 436 | priv->dev->name); |
437 | spin_unlock(&priv->rx_lock); | ||
424 | netif_rx_complete(priv->dev, napi); | 438 | netif_rx_complete(priv->dev, napi); |
425 | return 0; | 439 | return 0; |
426 | } | 440 | } |
427 | 441 | ||
428 | desc = priv->rx_head; | 442 | desc = priv->rx_head; |
443 | restart = NULL; | ||
429 | while (((desc->dataflags & CPMAC_OWN) == 0) && (received < budget)) { | 444 | while (((desc->dataflags & CPMAC_OWN) == 0) && (received < budget)) { |
445 | processed++; | ||
446 | |||
447 | if ((desc->dataflags & CPMAC_EOQ) != 0) { | ||
448 | /* The last update to eoq->hw_next didn't happen | ||
449 | * soon enough, and the receiver stopped here. | ||
450 | *Remember this descriptor so we can restart | ||
451 | * the receiver after freeing some space. | ||
452 | */ | ||
453 | if (unlikely(restart)) { | ||
454 | if (netif_msg_rx_err(priv)) | ||
455 | printk(KERN_ERR "%s: poll found a" | ||
456 | " duplicate EOQ: %p and %p\n", | ||
457 | priv->dev->name, restart, desc); | ||
458 | goto fatal_error; | ||
459 | } | ||
460 | |||
461 | restart = desc->next; | ||
462 | } | ||
463 | |||
430 | skb = cpmac_rx_one(priv, desc); | 464 | skb = cpmac_rx_one(priv, desc); |
431 | if (likely(skb)) { | 465 | if (likely(skb)) { |
432 | netif_receive_skb(skb); | 466 | netif_receive_skb(skb); |
@@ -435,19 +469,90 @@ static int cpmac_poll(struct napi_struct *napi, int budget) | |||
435 | desc = desc->next; | 469 | desc = desc->next; |
436 | } | 470 | } |
437 | 471 | ||
472 | if (desc != priv->rx_head) { | ||
473 | /* We freed some buffers, but not the whole ring, | ||
474 | * add what we did free to the rx list */ | ||
475 | desc->prev->hw_next = (u32)0; | ||
476 | priv->rx_head->prev->hw_next = priv->rx_head->mapping; | ||
477 | } | ||
478 | |||
479 | /* Optimization: If we did not actually process an EOQ (perhaps because | ||
480 | * of quota limits), check to see if the tail of the queue has EOQ set. | ||
481 | * We should immediately restart in that case so that the receiver can | ||
482 | * restart and run in parallel with more packet processing. | ||
483 | * This lets us handle slightly larger bursts before running | ||
484 | * out of ring space (assuming dev->weight < ring_size) */ | ||
485 | |||
486 | if (!restart && | ||
487 | (priv->rx_head->prev->dataflags & (CPMAC_OWN|CPMAC_EOQ)) | ||
488 | == CPMAC_EOQ && | ||
489 | (priv->rx_head->dataflags & CPMAC_OWN) != 0) { | ||
490 | /* reset EOQ so the poll loop (above) doesn't try to | ||
491 | * restart this when it eventually gets to this descriptor. | ||
492 | */ | ||
493 | priv->rx_head->prev->dataflags &= ~CPMAC_EOQ; | ||
494 | restart = priv->rx_head; | ||
495 | } | ||
496 | |||
497 | if (restart) { | ||
498 | priv->dev->stats.rx_errors++; | ||
499 | priv->dev->stats.rx_fifo_errors++; | ||
500 | if (netif_msg_rx_err(priv) && net_ratelimit()) | ||
501 | printk(KERN_WARNING "%s: rx dma ring overrun\n", | ||
502 | priv->dev->name); | ||
503 | |||
504 | if (unlikely((restart->dataflags & CPMAC_OWN) == 0)) { | ||
505 | if (netif_msg_drv(priv)) | ||
506 | printk(KERN_ERR "%s: cpmac_poll is trying to " | ||
507 | "restart rx from a descriptor that's " | ||
508 | "not free: %p\n", | ||
509 | priv->dev->name, restart); | ||
510 | goto fatal_error; | ||
511 | } | ||
512 | |||
513 | cpmac_write(priv->regs, CPMAC_RX_PTR(0), restart->mapping); | ||
514 | } | ||
515 | |||
438 | priv->rx_head = desc; | 516 | priv->rx_head = desc; |
439 | spin_unlock(&priv->rx_lock); | 517 | spin_unlock(&priv->rx_lock); |
440 | if (unlikely(netif_msg_rx_status(priv))) | 518 | if (unlikely(netif_msg_rx_status(priv))) |
441 | printk(KERN_DEBUG "%s: poll processed %d packets\n", | 519 | printk(KERN_DEBUG "%s: poll processed %d packets\n", |
442 | priv->dev->name, received); | 520 | priv->dev->name, received); |
443 | if (desc->dataflags & CPMAC_OWN) { | 521 | if (processed == 0) { |
522 | /* we ran out of packets to read, | ||
523 | * revert to interrupt-driven mode */ | ||
444 | netif_rx_complete(priv->dev, napi); | 524 | netif_rx_complete(priv->dev, napi); |
445 | cpmac_write(priv->regs, CPMAC_RX_PTR(0), (u32)desc->mapping); | ||
446 | cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1); | 525 | cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1); |
447 | return 0; | 526 | return 0; |
448 | } | 527 | } |
449 | 528 | ||
450 | return 1; | 529 | return 1; |
530 | |||
531 | fatal_error: | ||
532 | /* Something went horribly wrong. | ||
533 | * Reset hardware to try to recover rather than wedging. */ | ||
534 | |||
535 | if (netif_msg_drv(priv)) { | ||
536 | printk(KERN_ERR "%s: cpmac_poll is confused. " | ||
537 | "Resetting hardware\n", priv->dev->name); | ||
538 | cpmac_dump_all_desc(priv->dev); | ||
539 | printk(KERN_DEBUG "%s: RX_PTR(0)=0x%08x RX_ACK(0)=0x%08x\n", | ||
540 | priv->dev->name, | ||
541 | cpmac_read(priv->regs, CPMAC_RX_PTR(0)), | ||
542 | cpmac_read(priv->regs, CPMAC_RX_ACK(0))); | ||
543 | } | ||
544 | |||
545 | spin_unlock(&priv->rx_lock); | ||
546 | netif_rx_complete(priv->dev, napi); | ||
547 | netif_stop_queue(priv->dev); | ||
548 | napi_disable(&priv->napi); | ||
549 | |||
550 | atomic_inc(&priv->reset_pending); | ||
551 | cpmac_hw_stop(priv->dev); | ||
552 | if (!schedule_work(&priv->reset_work)) | ||
553 | atomic_dec(&priv->reset_pending); | ||
554 | return 0; | ||
555 | |||
451 | } | 556 | } |
452 | 557 | ||
453 | static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | 558 | static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -456,6 +561,9 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
456 | struct cpmac_desc *desc; | 561 | struct cpmac_desc *desc; |
457 | struct cpmac_priv *priv = netdev_priv(dev); | 562 | struct cpmac_priv *priv = netdev_priv(dev); |
458 | 563 | ||
564 | if (unlikely(atomic_read(&priv->reset_pending))) | ||
565 | return NETDEV_TX_BUSY; | ||
566 | |||
459 | if (unlikely(skb_padto(skb, ETH_ZLEN))) | 567 | if (unlikely(skb_padto(skb, ETH_ZLEN))) |
460 | return NETDEV_TX_OK; | 568 | return NETDEV_TX_OK; |
461 | 569 | ||
@@ -621,8 +729,10 @@ static void cpmac_clear_rx(struct net_device *dev) | |||
621 | desc->dataflags = CPMAC_OWN; | 729 | desc->dataflags = CPMAC_OWN; |
622 | dev->stats.rx_dropped++; | 730 | dev->stats.rx_dropped++; |
623 | } | 731 | } |
732 | desc->hw_next = desc->next->mapping; | ||
624 | desc = desc->next; | 733 | desc = desc->next; |
625 | } | 734 | } |
735 | priv->rx_head->prev->hw_next = 0; | ||
626 | } | 736 | } |
627 | 737 | ||
628 | static void cpmac_clear_tx(struct net_device *dev) | 738 | static void cpmac_clear_tx(struct net_device *dev) |
@@ -635,14 +745,14 @@ static void cpmac_clear_tx(struct net_device *dev) | |||
635 | priv->desc_ring[i].dataflags = 0; | 745 | priv->desc_ring[i].dataflags = 0; |
636 | if (priv->desc_ring[i].skb) { | 746 | if (priv->desc_ring[i].skb) { |
637 | dev_kfree_skb_any(priv->desc_ring[i].skb); | 747 | dev_kfree_skb_any(priv->desc_ring[i].skb); |
638 | if (netif_subqueue_stopped(dev, i)) | 748 | priv->desc_ring[i].skb = NULL; |
639 | netif_wake_subqueue(dev, i); | ||
640 | } | 749 | } |
641 | } | 750 | } |
642 | } | 751 | } |
643 | 752 | ||
644 | static void cpmac_hw_error(struct work_struct *work) | 753 | static void cpmac_hw_error(struct work_struct *work) |
645 | { | 754 | { |
755 | int i; | ||
646 | struct cpmac_priv *priv = | 756 | struct cpmac_priv *priv = |
647 | container_of(work, struct cpmac_priv, reset_work); | 757 | container_of(work, struct cpmac_priv, reset_work); |
648 | 758 | ||
@@ -651,8 +761,48 @@ static void cpmac_hw_error(struct work_struct *work) | |||
651 | spin_unlock(&priv->rx_lock); | 761 | spin_unlock(&priv->rx_lock); |
652 | cpmac_clear_tx(priv->dev); | 762 | cpmac_clear_tx(priv->dev); |
653 | cpmac_hw_start(priv->dev); | 763 | cpmac_hw_start(priv->dev); |
654 | napi_enable(&priv->napi); | 764 | barrier(); |
655 | netif_start_queue(priv->dev); | 765 | atomic_dec(&priv->reset_pending); |
766 | |||
767 | for (i = 0; i < CPMAC_QUEUES; i++) | ||
768 | netif_wake_subqueue(priv->dev, i); | ||
769 | netif_wake_queue(priv->dev); | ||
770 | cpmac_write(priv->regs, CPMAC_MAC_INT_ENABLE, 3); | ||
771 | } | ||
772 | |||
773 | static void cpmac_check_status(struct net_device *dev) | ||
774 | { | ||
775 | struct cpmac_priv *priv = netdev_priv(dev); | ||
776 | |||
777 | u32 macstatus = cpmac_read(priv->regs, CPMAC_MAC_STATUS); | ||
778 | int rx_channel = (macstatus >> 8) & 7; | ||
779 | int rx_code = (macstatus >> 12) & 15; | ||
780 | int tx_channel = (macstatus >> 16) & 7; | ||
781 | int tx_code = (macstatus >> 20) & 15; | ||
782 | |||
783 | if (rx_code || tx_code) { | ||
784 | if (netif_msg_drv(priv) && net_ratelimit()) { | ||
785 | /* Can't find any documentation on what these | ||
786 | *error codes actually are. So just log them and hope.. | ||
787 | */ | ||
788 | if (rx_code) | ||
789 | printk(KERN_WARNING "%s: host error %d on rx " | ||
790 | "channel %d (macstatus %08x), resetting\n", | ||
791 | dev->name, rx_code, rx_channel, macstatus); | ||
792 | if (tx_code) | ||
793 | printk(KERN_WARNING "%s: host error %d on tx " | ||
794 | "channel %d (macstatus %08x), resetting\n", | ||
795 | dev->name, tx_code, tx_channel, macstatus); | ||
796 | } | ||
797 | |||
798 | netif_stop_queue(dev); | ||
799 | cpmac_hw_stop(dev); | ||
800 | if (schedule_work(&priv->reset_work)) | ||
801 | atomic_inc(&priv->reset_pending); | ||
802 | if (unlikely(netif_msg_hw(priv))) | ||
803 | cpmac_dump_regs(dev); | ||
804 | } | ||
805 | cpmac_write(priv->regs, CPMAC_MAC_INT_CLEAR, 0xff); | ||
656 | } | 806 | } |
657 | 807 | ||
658 | static irqreturn_t cpmac_irq(int irq, void *dev_id) | 808 | static irqreturn_t cpmac_irq(int irq, void *dev_id) |
@@ -683,49 +833,32 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id) | |||
683 | 833 | ||
684 | cpmac_write(priv->regs, CPMAC_MAC_EOI_VECTOR, 0); | 834 | cpmac_write(priv->regs, CPMAC_MAC_EOI_VECTOR, 0); |
685 | 835 | ||
686 | if (unlikely(status & (MAC_INT_HOST | MAC_INT_STATUS))) { | 836 | if (unlikely(status & (MAC_INT_HOST | MAC_INT_STATUS))) |
687 | if (netif_msg_drv(priv) && net_ratelimit()) | 837 | cpmac_check_status(dev); |
688 | printk(KERN_ERR "%s: hw error, resetting...\n", | ||
689 | dev->name); | ||
690 | netif_stop_queue(dev); | ||
691 | napi_disable(&priv->napi); | ||
692 | cpmac_hw_stop(dev); | ||
693 | schedule_work(&priv->reset_work); | ||
694 | if (unlikely(netif_msg_hw(priv))) | ||
695 | cpmac_dump_regs(dev); | ||
696 | } | ||
697 | 838 | ||
698 | return IRQ_HANDLED; | 839 | return IRQ_HANDLED; |
699 | } | 840 | } |
700 | 841 | ||
701 | static void cpmac_tx_timeout(struct net_device *dev) | 842 | static void cpmac_tx_timeout(struct net_device *dev) |
702 | { | 843 | { |
703 | struct cpmac_priv *priv = netdev_priv(dev); | ||
704 | int i; | 844 | int i; |
845 | struct cpmac_priv *priv = netdev_priv(dev); | ||
705 | 846 | ||
706 | spin_lock(&priv->lock); | 847 | spin_lock(&priv->lock); |
707 | dev->stats.tx_errors++; | 848 | dev->stats.tx_errors++; |
708 | spin_unlock(&priv->lock); | 849 | spin_unlock(&priv->lock); |
709 | if (netif_msg_tx_err(priv) && net_ratelimit()) | 850 | if (netif_msg_tx_err(priv) && net_ratelimit()) |
710 | printk(KERN_WARNING "%s: transmit timeout\n", dev->name); | 851 | printk(KERN_WARNING "%s: transmit timeout\n", dev->name); |
711 | /* | 852 | |
712 | * FIXME: waking up random queue is not the best thing to | 853 | atomic_inc(&priv->reset_pending); |
713 | * do... on the other hand why we got here at all? | 854 | barrier(); |
714 | */ | 855 | cpmac_clear_tx(dev); |
715 | #ifdef CONFIG_NETDEVICES_MULTIQUEUE | 856 | barrier(); |
857 | atomic_dec(&priv->reset_pending); | ||
858 | |||
859 | netif_wake_queue(priv->dev); | ||
716 | for (i = 0; i < CPMAC_QUEUES; i++) | 860 | for (i = 0; i < CPMAC_QUEUES; i++) |
717 | if (priv->desc_ring[i].skb) { | 861 | netif_wake_subqueue(dev, i); |
718 | priv->desc_ring[i].dataflags = 0; | ||
719 | dev_kfree_skb_any(priv->desc_ring[i].skb); | ||
720 | netif_wake_subqueue(dev, i); | ||
721 | break; | ||
722 | } | ||
723 | #else | ||
724 | priv->desc_ring[0].dataflags = 0; | ||
725 | if (priv->desc_ring[0].skb) | ||
726 | dev_kfree_skb_any(priv->desc_ring[0].skb); | ||
727 | netif_wake_queue(dev); | ||
728 | #endif | ||
729 | } | 862 | } |
730 | 863 | ||
731 | static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 864 | static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
@@ -901,9 +1034,12 @@ static int cpmac_open(struct net_device *dev) | |||
901 | desc->buflen = CPMAC_SKB_SIZE; | 1034 | desc->buflen = CPMAC_SKB_SIZE; |
902 | desc->dataflags = CPMAC_OWN; | 1035 | desc->dataflags = CPMAC_OWN; |
903 | desc->next = &priv->rx_head[(i + 1) % priv->ring_size]; | 1036 | desc->next = &priv->rx_head[(i + 1) % priv->ring_size]; |
1037 | desc->next->prev = desc; | ||
904 | desc->hw_next = (u32)desc->next->mapping; | 1038 | desc->hw_next = (u32)desc->next->mapping; |
905 | } | 1039 | } |
906 | 1040 | ||
1041 | priv->rx_head->prev->hw_next = (u32)0; | ||
1042 | |||
907 | if ((res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, | 1043 | if ((res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, |
908 | dev->name, dev))) { | 1044 | dev->name, dev))) { |
909 | if (netif_msg_drv(priv)) | 1045 | if (netif_msg_drv(priv)) |
@@ -912,6 +1048,7 @@ static int cpmac_open(struct net_device *dev) | |||
912 | goto fail_irq; | 1048 | goto fail_irq; |
913 | } | 1049 | } |
914 | 1050 | ||
1051 | atomic_set(&priv->reset_pending, 0); | ||
915 | INIT_WORK(&priv->reset_work, cpmac_hw_error); | 1052 | INIT_WORK(&priv->reset_work, cpmac_hw_error); |
916 | cpmac_hw_start(dev); | 1053 | cpmac_hw_start(dev); |
917 | 1054 | ||
@@ -1007,21 +1144,10 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1007 | 1144 | ||
1008 | if (phy_id == PHY_MAX_ADDR) { | 1145 | if (phy_id == PHY_MAX_ADDR) { |
1009 | if (external_switch || dumb_switch) { | 1146 | if (external_switch || dumb_switch) { |
1010 | struct fixed_phy_status status = {}; | 1147 | mdio_bus_id = 0; /* fixed phys bus */ |
1011 | 1148 | phy_id = pdev->id; | |
1012 | /* | ||
1013 | * FIXME: this should be in the platform code! | ||
1014 | * Since there is not platform code at all (that is, | ||
1015 | * no mainline users of that driver), place it here | ||
1016 | * for now. | ||
1017 | */ | ||
1018 | phy_id = 0; | ||
1019 | status.link = 1; | ||
1020 | status.duplex = 1; | ||
1021 | status.speed = 100; | ||
1022 | fixed_phy_add(PHY_POLL, phy_id, &status); | ||
1023 | } else { | 1149 | } else { |
1024 | printk(KERN_ERR "cpmac: no PHY present\n"); | 1150 | dev_err(&pdev->dev, "no PHY present\n"); |
1025 | return -ENODEV; | 1151 | return -ENODEV; |
1026 | } | 1152 | } |
1027 | } | 1153 | } |
@@ -1064,10 +1190,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1064 | priv->msg_enable = netif_msg_init(debug_level, 0xff); | 1190 | priv->msg_enable = netif_msg_init(debug_level, 0xff); |
1065 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); | 1191 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); |
1066 | 1192 | ||
1067 | snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | 1193 | priv->phy = phy_connect(dev, cpmac_mii.phy_map[phy_id]->dev.bus_id, |
1068 | 1194 | &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); | |
1069 | priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0, | ||
1070 | PHY_INTERFACE_MODE_MII); | ||
1071 | if (IS_ERR(priv->phy)) { | 1195 | if (IS_ERR(priv->phy)) { |
1072 | if (netif_msg_drv(priv)) | 1196 | if (netif_msg_drv(priv)) |
1073 | printk(KERN_ERR "%s: Could not attach to PHY\n", | 1197 | printk(KERN_ERR "%s: Could not attach to PHY\n", |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index d45bcd2660af..864295e081b6 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -903,7 +903,7 @@ dm9000_stop(struct net_device *ndev) | |||
903 | if (netif_msg_ifdown(db)) | 903 | if (netif_msg_ifdown(db)) |
904 | dev_dbg(db->dev, "shutting down %s\n", ndev->name); | 904 | dev_dbg(db->dev, "shutting down %s\n", ndev->name); |
905 | 905 | ||
906 | cancel_delayed_work(&db->phy_poll); | 906 | cancel_delayed_work_sync(&db->phy_poll); |
907 | 907 | ||
908 | netif_stop_queue(ndev); | 908 | netif_stop_queue(ndev); |
909 | netif_carrier_off(ndev); | 909 | netif_carrier_off(ndev); |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 8cbb40f3a506..cab1835173cd 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4201,8 +4201,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4201 | struct e1000_adapter *adapter; | 4201 | struct e1000_adapter *adapter; |
4202 | struct e1000_hw *hw; | 4202 | struct e1000_hw *hw; |
4203 | const struct e1000_info *ei = e1000_info_tbl[ent->driver_data]; | 4203 | const struct e1000_info *ei = e1000_info_tbl[ent->driver_data]; |
4204 | unsigned long mmio_start, mmio_len; | 4204 | resource_size_t mmio_start, mmio_len; |
4205 | unsigned long flash_start, flash_len; | 4205 | resource_size_t flash_start, flash_len; |
4206 | 4206 | ||
4207 | static int cards_found; | 4207 | static int cards_found; |
4208 | int i, err, pci_using_dac; | 4208 | int i, err, pci_using_dac; |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index d1b6d4e7495d..287a61918739 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -2213,8 +2213,6 @@ static void ehea_vlan_rx_register(struct net_device *dev, | |||
2213 | goto out; | 2213 | goto out; |
2214 | } | 2214 | } |
2215 | 2215 | ||
2216 | memset(cb1->vlan_filter, 0, sizeof(cb1->vlan_filter)); | ||
2217 | |||
2218 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, | 2216 | hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, |
2219 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); | 2217 | H_PORT_CB1, H_PORT_CB1_ALL, cb1); |
2220 | if (hret != H_SUCCESS) | 2218 | if (hret != H_SUCCESS) |
@@ -3178,11 +3176,12 @@ out_err: | |||
3178 | 3176 | ||
3179 | static void ehea_shutdown_single_port(struct ehea_port *port) | 3177 | static void ehea_shutdown_single_port(struct ehea_port *port) |
3180 | { | 3178 | { |
3179 | struct ehea_adapter *adapter = port->adapter; | ||
3181 | unregister_netdev(port->netdev); | 3180 | unregister_netdev(port->netdev); |
3182 | ehea_unregister_port(port); | 3181 | ehea_unregister_port(port); |
3183 | kfree(port->mc_list); | 3182 | kfree(port->mc_list); |
3184 | free_netdev(port->netdev); | 3183 | free_netdev(port->netdev); |
3185 | port->adapter->active_ports--; | 3184 | adapter->active_ports--; |
3186 | } | 3185 | } |
3187 | 3186 | ||
3188 | static int ehea_setup_ports(struct ehea_adapter *adapter) | 3187 | static int ehea_setup_ports(struct ehea_adapter *adapter) |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 35f66d4a4595..9eca97fb0a54 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5823,6 +5823,7 @@ static int nv_resume(struct pci_dev *pdev) | |||
5823 | writel(txreg, base + NvRegTransmitPoll); | 5823 | writel(txreg, base + NvRegTransmitPoll); |
5824 | 5824 | ||
5825 | rc = nv_open(dev); | 5825 | rc = nv_open(dev); |
5826 | nv_set_multicast(dev); | ||
5826 | out: | 5827 | out: |
5827 | return rc; | 5828 | return rc; |
5828 | } | 5829 | } |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 67b4b0728fce..a5baaf59ff66 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -1093,7 +1093,7 @@ err: | |||
1093 | if (registered) | 1093 | if (registered) |
1094 | unregister_netdev(ndev); | 1094 | unregister_netdev(ndev); |
1095 | 1095 | ||
1096 | if (fep != NULL) { | 1096 | if (fep && fep->ops) { |
1097 | (*fep->ops->free_bd)(ndev); | 1097 | (*fep->ops->free_bd)(ndev); |
1098 | (*fep->ops->cleanup_data)(ndev); | 1098 | (*fep->ops->cleanup_data)(ndev); |
1099 | } | 1099 | } |
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index f90515935833..45ae9d1191d7 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c | |||
@@ -1340,9 +1340,10 @@ static unsigned int scc_set_param(struct scc_channel *scc, unsigned int cmd, uns | |||
1340 | case PARAM_RTS: | 1340 | case PARAM_RTS: |
1341 | if ( !(scc->wreg[R5] & RTS) ) | 1341 | if ( !(scc->wreg[R5] & RTS) ) |
1342 | { | 1342 | { |
1343 | if (arg != TX_OFF) | 1343 | if (arg != TX_OFF) { |
1344 | scc_key_trx(scc, TX_ON); | 1344 | scc_key_trx(scc, TX_ON); |
1345 | scc_start_tx_timer(scc, t_txdelay, scc->kiss.txdelay); | 1345 | scc_start_tx_timer(scc, t_txdelay, scc->kiss.txdelay); |
1346 | } | ||
1346 | } else { | 1347 | } else { |
1347 | if (arg == TX_OFF) | 1348 | if (arg == TX_OFF) |
1348 | { | 1349 | { |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 9081234ab458..6f50ed7b183f 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1120,7 +1120,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
1120 | } | 1120 | } |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | if (self->usbdev->descriptor.bcdDevice == fw_version) { | 1123 | if (self->usbdev->descriptor.bcdDevice == cpu_to_le16(fw_version)) { |
1124 | /* | 1124 | /* |
1125 | * If we're here, we've found a correct patch | 1125 | * If we're here, we've found a correct patch |
1126 | * The actual image starts after the "STMP" keyword | 1126 | * The actual image starts after the "STMP" keyword |
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h index e846c38224a3..a0ca9c1fe196 100644 --- a/drivers/net/irda/irda-usb.h +++ b/drivers/net/irda/irda-usb.h | |||
@@ -117,11 +117,11 @@ | |||
117 | struct irda_class_desc { | 117 | struct irda_class_desc { |
118 | __u8 bLength; | 118 | __u8 bLength; |
119 | __u8 bDescriptorType; | 119 | __u8 bDescriptorType; |
120 | __u16 bcdSpecRevision; | 120 | __le16 bcdSpecRevision; |
121 | __u8 bmDataSize; | 121 | __u8 bmDataSize; |
122 | __u8 bmWindowSize; | 122 | __u8 bmWindowSize; |
123 | __u8 bmMinTurnaroundTime; | 123 | __u8 bmMinTurnaroundTime; |
124 | __u16 wBaudRate; | 124 | __le16 wBaudRate; |
125 | __u8 bmAdditionalBOFs; | 125 | __u8 bmAdditionalBOFs; |
126 | __u8 bIrdaRateSniff; | 126 | __u8 bIrdaRateSniff; |
127 | __u8 bMaxUnicastList; | 127 | __u8 bMaxUnicastList; |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index c91b12ea26ad..36be6efc6398 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -631,7 +631,7 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp) | |||
631 | return status; | 631 | return status; |
632 | } | 632 | } |
633 | 633 | ||
634 | int myri10ge_get_firmware_capabilities(struct myri10ge_priv *mgp) | 634 | static int myri10ge_get_firmware_capabilities(struct myri10ge_priv *mgp) |
635 | { | 635 | { |
636 | struct myri10ge_cmd cmd; | 636 | struct myri10ge_cmd cmd; |
637 | int status; | 637 | int status; |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 8f328a03847b..a550c9bd126f 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -391,7 +391,9 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
391 | cardtype = CONTEC; | 391 | cardtype = CONTEC; |
392 | break; | 392 | break; |
393 | case MANFID_FUJITSU: | 393 | case MANFID_FUJITSU: |
394 | if (link->card_id == PRODID_FUJITSU_MBH10302) | 394 | if (link->conf.ConfigBase == 0x0fe0) |
395 | cardtype = MBH10302; | ||
396 | else if (link->card_id == PRODID_FUJITSU_MBH10302) | ||
395 | /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), | 397 | /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), |
396 | but these are MBH10304 based card. */ | 398 | but these are MBH10304 based card. */ |
397 | cardtype = MBH10304; | 399 | cardtype = MBH10304; |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index d041f831a18d..f6c4698ce738 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1461,22 +1461,25 @@ static void | |||
1461 | set_multicast_list(struct net_device *dev) | 1461 | set_multicast_list(struct net_device *dev) |
1462 | { | 1462 | { |
1463 | unsigned int ioaddr = dev->base_addr; | 1463 | unsigned int ioaddr = dev->base_addr; |
1464 | unsigned value; | ||
1464 | 1465 | ||
1465 | SelectPage(0x42); | 1466 | SelectPage(0x42); |
1467 | value = GetByte(XIRCREG42_SWC1) & 0xC0; | ||
1468 | |||
1466 | if (dev->flags & IFF_PROMISC) { /* snoop */ | 1469 | if (dev->flags & IFF_PROMISC) { /* snoop */ |
1467 | PutByte(XIRCREG42_SWC1, 0x06); /* set MPE and PME */ | 1470 | PutByte(XIRCREG42_SWC1, value | 0x06); /* set MPE and PME */ |
1468 | } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) { | 1471 | } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) { |
1469 | PutByte(XIRCREG42_SWC1, 0x02); /* set MPE */ | 1472 | PutByte(XIRCREG42_SWC1, value | 0x02); /* set MPE */ |
1470 | } else if (dev->mc_count) { | 1473 | } else if (dev->mc_count) { |
1471 | /* the chip can filter 9 addresses perfectly */ | 1474 | /* the chip can filter 9 addresses perfectly */ |
1472 | PutByte(XIRCREG42_SWC1, 0x01); | 1475 | PutByte(XIRCREG42_SWC1, value | 0x01); |
1473 | SelectPage(0x40); | 1476 | SelectPage(0x40); |
1474 | PutByte(XIRCREG40_CMD0, Offline); | 1477 | PutByte(XIRCREG40_CMD0, Offline); |
1475 | set_addresses(dev); | 1478 | set_addresses(dev); |
1476 | SelectPage(0x40); | 1479 | SelectPage(0x40); |
1477 | PutByte(XIRCREG40_CMD0, EnableRecv | Online); | 1480 | PutByte(XIRCREG40_CMD0, EnableRecv | Online); |
1478 | } else { /* standard usage */ | 1481 | } else { /* standard usage */ |
1479 | PutByte(XIRCREG42_SWC1, 0x00); | 1482 | PutByte(XIRCREG42_SWC1, value | 0x00); |
1480 | } | 1483 | } |
1481 | SelectPage(0); | 1484 | SelectPage(0); |
1482 | } | 1485 | } |
@@ -1722,6 +1725,7 @@ do_reset(struct net_device *dev, int full) | |||
1722 | 1725 | ||
1723 | /* enable receiver and put the mac online */ | 1726 | /* enable receiver and put the mac online */ |
1724 | if (full) { | 1727 | if (full) { |
1728 | set_multicast_list(dev); | ||
1725 | SelectPage(0x40); | 1729 | SelectPage(0x40); |
1726 | PutByte(XIRCREG40_CMD0, EnableRecv | Online); | 1730 | PutByte(XIRCREG40_CMD0, EnableRecv | Online); |
1727 | } | 1731 | } |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index a1c454dbc164..1c89b97f4e09 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -325,7 +325,7 @@ static int pcnet32_get_regs_len(struct net_device *dev); | |||
325 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | 325 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
326 | void *ptr); | 326 | void *ptr); |
327 | static void pcnet32_purge_tx_ring(struct net_device *dev); | 327 | static void pcnet32_purge_tx_ring(struct net_device *dev); |
328 | static int pcnet32_alloc_ring(struct net_device *dev, char *name); | 328 | static int pcnet32_alloc_ring(struct net_device *dev, const char *name); |
329 | static void pcnet32_free_ring(struct net_device *dev); | 329 | static void pcnet32_free_ring(struct net_device *dev); |
330 | static void pcnet32_check_media(struct net_device *dev, int verbose); | 330 | static void pcnet32_check_media(struct net_device *dev, int verbose); |
331 | 331 | ||
@@ -1983,7 +1983,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | /* if any allocation fails, caller must also call pcnet32_free_ring */ | 1985 | /* if any allocation fails, caller must also call pcnet32_free_ring */ |
1986 | static int pcnet32_alloc_ring(struct net_device *dev, char *name) | 1986 | static int pcnet32_alloc_ring(struct net_device *dev, const char *name) |
1987 | { | 1987 | { |
1988 | struct pcnet32_private *lp = netdev_priv(dev); | 1988 | struct pcnet32_private *lp = netdev_priv(dev); |
1989 | 1989 | ||
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 6bf9e76b0a00..6eb2d31d1e34 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -5,7 +5,7 @@ | |||
5 | menuconfig PHYLIB | 5 | menuconfig PHYLIB |
6 | tristate "PHY Device support and infrastructure" | 6 | tristate "PHY Device support and infrastructure" |
7 | depends on !S390 | 7 | depends on !S390 |
8 | depends on NET_ETHERNET && (BROKEN || !S390) | 8 | depends on NET_ETHERNET |
9 | help | 9 | help |
10 | Ethernet controllers are usually attached to PHY | 10 | Ethernet controllers are usually attached to PHY |
11 | devices. This option provides infrastructure for | 11 | devices. This option provides infrastructure for |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index ac3c01d28fdf..16a0e7de5888 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -207,6 +207,7 @@ int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id) | |||
207 | 207 | ||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | EXPORT_SYMBOL(get_phy_id); | ||
210 | 211 | ||
211 | /** | 212 | /** |
212 | * get_phy_device - reads the specified PHY device and returns its @phy_device struct | 213 | * get_phy_device - reads the specified PHY device and returns its @phy_device struct |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 79359919335b..8db342f2fdc9 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -980,6 +980,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
980 | __wsum csum = 0; | 980 | __wsum csum = 0; |
981 | struct udphdr *uh; | 981 | struct udphdr *uh; |
982 | unsigned int len; | 982 | unsigned int len; |
983 | int old_headroom; | ||
984 | int new_headroom; | ||
983 | 985 | ||
984 | if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) | 986 | if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) |
985 | goto abort; | 987 | goto abort; |
@@ -1001,16 +1003,18 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1001 | 1003 | ||
1002 | /* Check that there's enough headroom in the skb to insert IP, | 1004 | /* Check that there's enough headroom in the skb to insert IP, |
1003 | * UDP and L2TP and PPP headers. If not enough, expand it to | 1005 | * UDP and L2TP and PPP headers. If not enough, expand it to |
1004 | * make room. Note that a new skb (or a clone) is | 1006 | * make room. Adjust truesize. |
1005 | * allocated. If we return an error from this point on, make | ||
1006 | * sure we free the new skb but do not free the original skb | ||
1007 | * since that is done by the caller for the error case. | ||
1008 | */ | 1007 | */ |
1009 | headroom = NET_SKB_PAD + sizeof(struct iphdr) + | 1008 | headroom = NET_SKB_PAD + sizeof(struct iphdr) + |
1010 | sizeof(struct udphdr) + hdr_len + sizeof(ppph); | 1009 | sizeof(struct udphdr) + hdr_len + sizeof(ppph); |
1010 | old_headroom = skb_headroom(skb); | ||
1011 | if (skb_cow_head(skb, headroom)) | 1011 | if (skb_cow_head(skb, headroom)) |
1012 | goto abort; | 1012 | goto abort; |
1013 | 1013 | ||
1014 | new_headroom = skb_headroom(skb); | ||
1015 | skb_orphan(skb); | ||
1016 | skb->truesize += new_headroom - old_headroom; | ||
1017 | |||
1014 | /* Setup PPP header */ | 1018 | /* Setup PPP header */ |
1015 | __skb_push(skb, sizeof(ppph)); | 1019 | __skb_push(skb, sizeof(ppph)); |
1016 | skb->data[0] = ppph[0]; | 1020 | skb->data[0] = ppph[0]; |
@@ -1065,7 +1069,6 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1065 | /* Get routing info from the tunnel socket */ | 1069 | /* Get routing info from the tunnel socket */ |
1066 | dst_release(skb->dst); | 1070 | dst_release(skb->dst); |
1067 | skb->dst = dst_clone(__sk_dst_get(sk_tun)); | 1071 | skb->dst = dst_clone(__sk_dst_get(sk_tun)); |
1068 | skb_orphan(skb); | ||
1069 | skb->sk = sk_tun; | 1072 | skb->sk = sk_tun; |
1070 | 1073 | ||
1071 | /* Queue the packet to IP for output */ | 1074 | /* Queue the packet to IP for output */ |
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h index 2109508c047a..f8274f8941ea 100644 --- a/drivers/net/s2io-regs.h +++ b/drivers/net/s2io-regs.h | |||
@@ -250,7 +250,7 @@ struct XENA_dev_config { | |||
250 | u64 tx_mat0_n[0x8]; | 250 | u64 tx_mat0_n[0x8]; |
251 | #define TX_MAT_SET(fifo, msi) vBIT(msi, (8 * fifo), 8) | 251 | #define TX_MAT_SET(fifo, msi) vBIT(msi, (8 * fifo), 8) |
252 | 252 | ||
253 | u8 unused_1[0x8]; | 253 | u64 xmsi_mask_reg; |
254 | u64 stat_byte_cnt; | 254 | u64 stat_byte_cnt; |
255 | #define STAT_BC(n) vBIT(n,4,12) | 255 | #define STAT_BC(n) vBIT(n,4,12) |
256 | 256 | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 523478ebfd69..a20693e09ae8 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -86,7 +86,7 @@ | |||
86 | #include "s2io.h" | 86 | #include "s2io.h" |
87 | #include "s2io-regs.h" | 87 | #include "s2io-regs.h" |
88 | 88 | ||
89 | #define DRV_VERSION "2.0.26.23" | 89 | #define DRV_VERSION "2.0.26.24" |
90 | 90 | ||
91 | /* S2io Driver name & version. */ | 91 | /* S2io Driver name & version. */ |
92 | static char s2io_driver_name[] = "Neterion"; | 92 | static char s2io_driver_name[] = "Neterion"; |
@@ -1113,9 +1113,10 @@ static int s2io_on_nec_bridge(struct pci_dev *s2io_pdev) | |||
1113 | struct pci_dev *tdev = NULL; | 1113 | struct pci_dev *tdev = NULL; |
1114 | while ((tdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) { | 1114 | while ((tdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) { |
1115 | if (tdev->vendor == NEC_VENID && tdev->device == NEC_DEVID) { | 1115 | if (tdev->vendor == NEC_VENID && tdev->device == NEC_DEVID) { |
1116 | if (tdev->bus == s2io_pdev->bus->parent) | 1116 | if (tdev->bus == s2io_pdev->bus->parent) { |
1117 | pci_dev_put(tdev); | 1117 | pci_dev_put(tdev); |
1118 | return 1; | 1118 | return 1; |
1119 | } | ||
1119 | } | 1120 | } |
1120 | } | 1121 | } |
1121 | return 0; | 1122 | return 0; |
@@ -1219,15 +1220,33 @@ static int init_tti(struct s2io_nic *nic, int link) | |||
1219 | TTI_DATA1_MEM_TX_URNG_B(0x10) | | 1220 | TTI_DATA1_MEM_TX_URNG_B(0x10) | |
1220 | TTI_DATA1_MEM_TX_URNG_C(0x30) | | 1221 | TTI_DATA1_MEM_TX_URNG_C(0x30) | |
1221 | TTI_DATA1_MEM_TX_TIMER_AC_EN; | 1222 | TTI_DATA1_MEM_TX_TIMER_AC_EN; |
1222 | 1223 | if (i == 0) | |
1223 | if (use_continuous_tx_intrs && (link == LINK_UP)) | 1224 | if (use_continuous_tx_intrs && (link == LINK_UP)) |
1224 | val64 |= TTI_DATA1_MEM_TX_TIMER_CI_EN; | 1225 | val64 |= TTI_DATA1_MEM_TX_TIMER_CI_EN; |
1225 | writeq(val64, &bar0->tti_data1_mem); | 1226 | writeq(val64, &bar0->tti_data1_mem); |
1226 | 1227 | ||
1227 | val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) | | 1228 | if (nic->config.intr_type == MSI_X) { |
1228 | TTI_DATA2_MEM_TX_UFC_B(0x20) | | 1229 | val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) | |
1229 | TTI_DATA2_MEM_TX_UFC_C(0x40) | | 1230 | TTI_DATA2_MEM_TX_UFC_B(0x100) | |
1230 | TTI_DATA2_MEM_TX_UFC_D(0x80); | 1231 | TTI_DATA2_MEM_TX_UFC_C(0x200) | |
1232 | TTI_DATA2_MEM_TX_UFC_D(0x300); | ||
1233 | } else { | ||
1234 | if ((nic->config.tx_steering_type == | ||
1235 | TX_DEFAULT_STEERING) && | ||
1236 | (config->tx_fifo_num > 1) && | ||
1237 | (i >= nic->udp_fifo_idx) && | ||
1238 | (i < (nic->udp_fifo_idx + | ||
1239 | nic->total_udp_fifos))) | ||
1240 | val64 = TTI_DATA2_MEM_TX_UFC_A(0x50) | | ||
1241 | TTI_DATA2_MEM_TX_UFC_B(0x80) | | ||
1242 | TTI_DATA2_MEM_TX_UFC_C(0x100) | | ||
1243 | TTI_DATA2_MEM_TX_UFC_D(0x120); | ||
1244 | else | ||
1245 | val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) | | ||
1246 | TTI_DATA2_MEM_TX_UFC_B(0x20) | | ||
1247 | TTI_DATA2_MEM_TX_UFC_C(0x40) | | ||
1248 | TTI_DATA2_MEM_TX_UFC_D(0x80); | ||
1249 | } | ||
1231 | 1250 | ||
1232 | writeq(val64, &bar0->tti_data2_mem); | 1251 | writeq(val64, &bar0->tti_data2_mem); |
1233 | 1252 | ||
@@ -2813,6 +2832,15 @@ static void free_rx_buffers(struct s2io_nic *sp) | |||
2813 | } | 2832 | } |
2814 | } | 2833 | } |
2815 | 2834 | ||
2835 | static int s2io_chk_rx_buffers(struct ring_info *ring) | ||
2836 | { | ||
2837 | if (fill_rx_buffers(ring) == -ENOMEM) { | ||
2838 | DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name); | ||
2839 | DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); | ||
2840 | } | ||
2841 | return 0; | ||
2842 | } | ||
2843 | |||
2816 | /** | 2844 | /** |
2817 | * s2io_poll - Rx interrupt handler for NAPI support | 2845 | * s2io_poll - Rx interrupt handler for NAPI support |
2818 | * @napi : pointer to the napi structure. | 2846 | * @napi : pointer to the napi structure. |
@@ -2826,57 +2854,72 @@ static void free_rx_buffers(struct s2io_nic *sp) | |||
2826 | * 0 on success and 1 if there are No Rx packets to be processed. | 2854 | * 0 on success and 1 if there are No Rx packets to be processed. |
2827 | */ | 2855 | */ |
2828 | 2856 | ||
2829 | static int s2io_poll(struct napi_struct *napi, int budget) | 2857 | static int s2io_poll_msix(struct napi_struct *napi, int budget) |
2830 | { | 2858 | { |
2831 | struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi); | 2859 | struct ring_info *ring = container_of(napi, struct ring_info, napi); |
2832 | struct net_device *dev = nic->dev; | 2860 | struct net_device *dev = ring->dev; |
2833 | int pkt_cnt = 0, org_pkts_to_process; | ||
2834 | struct mac_info *mac_control; | ||
2835 | struct config_param *config; | 2861 | struct config_param *config; |
2862 | struct mac_info *mac_control; | ||
2863 | int pkts_processed = 0; | ||
2864 | u8 *addr = NULL, val8 = 0; | ||
2865 | struct s2io_nic *nic = dev->priv; | ||
2836 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 2866 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
2837 | int i; | 2867 | int budget_org = budget; |
2838 | 2868 | ||
2839 | mac_control = &nic->mac_control; | ||
2840 | config = &nic->config; | 2869 | config = &nic->config; |
2870 | mac_control = &nic->mac_control; | ||
2841 | 2871 | ||
2842 | nic->pkts_to_process = budget; | 2872 | if (unlikely(!is_s2io_card_up(nic))) |
2843 | org_pkts_to_process = nic->pkts_to_process; | 2873 | return 0; |
2844 | 2874 | ||
2845 | writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); | 2875 | pkts_processed = rx_intr_handler(ring, budget); |
2846 | readl(&bar0->rx_traffic_int); | 2876 | s2io_chk_rx_buffers(ring); |
2847 | 2877 | ||
2848 | for (i = 0; i < config->rx_ring_num; i++) { | 2878 | if (pkts_processed < budget_org) { |
2849 | rx_intr_handler(&mac_control->rings[i]); | 2879 | netif_rx_complete(dev, napi); |
2850 | pkt_cnt = org_pkts_to_process - nic->pkts_to_process; | 2880 | /*Re Enable MSI-Rx Vector*/ |
2851 | if (!nic->pkts_to_process) { | 2881 | addr = (u8 *)&bar0->xmsi_mask_reg; |
2852 | /* Quota for the current iteration has been met */ | 2882 | addr += 7 - ring->ring_no; |
2853 | goto no_rx; | 2883 | val8 = (ring->ring_no == 0) ? 0x3f : 0xbf; |
2854 | } | 2884 | writeb(val8, addr); |
2885 | val8 = readb(addr); | ||
2855 | } | 2886 | } |
2887 | return pkts_processed; | ||
2888 | } | ||
2889 | static int s2io_poll_inta(struct napi_struct *napi, int budget) | ||
2890 | { | ||
2891 | struct s2io_nic *nic = container_of(napi, struct s2io_nic, napi); | ||
2892 | struct ring_info *ring; | ||
2893 | struct net_device *dev = nic->dev; | ||
2894 | struct config_param *config; | ||
2895 | struct mac_info *mac_control; | ||
2896 | int pkts_processed = 0; | ||
2897 | int ring_pkts_processed, i; | ||
2898 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | ||
2899 | int budget_org = budget; | ||
2856 | 2900 | ||
2857 | netif_rx_complete(dev, napi); | 2901 | config = &nic->config; |
2902 | mac_control = &nic->mac_control; | ||
2858 | 2903 | ||
2859 | for (i = 0; i < config->rx_ring_num; i++) { | 2904 | if (unlikely(!is_s2io_card_up(nic))) |
2860 | if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { | 2905 | return 0; |
2861 | DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); | ||
2862 | DBG_PRINT(INFO_DBG, " in Rx Poll!!\n"); | ||
2863 | break; | ||
2864 | } | ||
2865 | } | ||
2866 | /* Re enable the Rx interrupts. */ | ||
2867 | writeq(0x0, &bar0->rx_traffic_mask); | ||
2868 | readl(&bar0->rx_traffic_mask); | ||
2869 | return pkt_cnt; | ||
2870 | 2906 | ||
2871 | no_rx: | ||
2872 | for (i = 0; i < config->rx_ring_num; i++) { | 2907 | for (i = 0; i < config->rx_ring_num; i++) { |
2873 | if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { | 2908 | ring = &mac_control->rings[i]; |
2874 | DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); | 2909 | ring_pkts_processed = rx_intr_handler(ring, budget); |
2875 | DBG_PRINT(INFO_DBG, " in Rx Poll!!\n"); | 2910 | s2io_chk_rx_buffers(ring); |
2911 | pkts_processed += ring_pkts_processed; | ||
2912 | budget -= ring_pkts_processed; | ||
2913 | if (budget <= 0) | ||
2876 | break; | 2914 | break; |
2877 | } | ||
2878 | } | 2915 | } |
2879 | return pkt_cnt; | 2916 | if (pkts_processed < budget_org) { |
2917 | netif_rx_complete(dev, napi); | ||
2918 | /* Re enable the Rx interrupts for the ring */ | ||
2919 | writeq(0, &bar0->rx_traffic_mask); | ||
2920 | readl(&bar0->rx_traffic_mask); | ||
2921 | } | ||
2922 | return pkts_processed; | ||
2880 | } | 2923 | } |
2881 | 2924 | ||
2882 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2925 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -2918,7 +2961,7 @@ static void s2io_netpoll(struct net_device *dev) | |||
2918 | 2961 | ||
2919 | /* check for received packet and indicate up to network */ | 2962 | /* check for received packet and indicate up to network */ |
2920 | for (i = 0; i < config->rx_ring_num; i++) | 2963 | for (i = 0; i < config->rx_ring_num; i++) |
2921 | rx_intr_handler(&mac_control->rings[i]); | 2964 | rx_intr_handler(&mac_control->rings[i], 0); |
2922 | 2965 | ||
2923 | for (i = 0; i < config->rx_ring_num; i++) { | 2966 | for (i = 0; i < config->rx_ring_num; i++) { |
2924 | if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { | 2967 | if (fill_rx_buffers(&mac_control->rings[i]) == -ENOMEM) { |
@@ -2934,7 +2977,8 @@ static void s2io_netpoll(struct net_device *dev) | |||
2934 | 2977 | ||
2935 | /** | 2978 | /** |
2936 | * rx_intr_handler - Rx interrupt handler | 2979 | * rx_intr_handler - Rx interrupt handler |
2937 | * @nic: device private variable. | 2980 | * @ring_info: per ring structure. |
2981 | * @budget: budget for napi processing. | ||
2938 | * Description: | 2982 | * Description: |
2939 | * If the interrupt is because of a received frame or if the | 2983 | * If the interrupt is because of a received frame or if the |
2940 | * receive ring contains fresh as yet un-processed frames,this function is | 2984 | * receive ring contains fresh as yet un-processed frames,this function is |
@@ -2942,15 +2986,15 @@ static void s2io_netpoll(struct net_device *dev) | |||
2942 | * stopped and sends the skb to the OSM's Rx handler and then increments | 2986 | * stopped and sends the skb to the OSM's Rx handler and then increments |
2943 | * the offset. | 2987 | * the offset. |
2944 | * Return Value: | 2988 | * Return Value: |
2945 | * NONE. | 2989 | * No. of napi packets processed. |
2946 | */ | 2990 | */ |
2947 | static void rx_intr_handler(struct ring_info *ring_data) | 2991 | static int rx_intr_handler(struct ring_info *ring_data, int budget) |
2948 | { | 2992 | { |
2949 | int get_block, put_block; | 2993 | int get_block, put_block; |
2950 | struct rx_curr_get_info get_info, put_info; | 2994 | struct rx_curr_get_info get_info, put_info; |
2951 | struct RxD_t *rxdp; | 2995 | struct RxD_t *rxdp; |
2952 | struct sk_buff *skb; | 2996 | struct sk_buff *skb; |
2953 | int pkt_cnt = 0; | 2997 | int pkt_cnt = 0, napi_pkts = 0; |
2954 | int i; | 2998 | int i; |
2955 | struct RxD1* rxdp1; | 2999 | struct RxD1* rxdp1; |
2956 | struct RxD3* rxdp3; | 3000 | struct RxD3* rxdp3; |
@@ -2977,7 +3021,7 @@ static void rx_intr_handler(struct ring_info *ring_data) | |||
2977 | DBG_PRINT(ERR_DBG, "%s: The skb is ", | 3021 | DBG_PRINT(ERR_DBG, "%s: The skb is ", |
2978 | ring_data->dev->name); | 3022 | ring_data->dev->name); |
2979 | DBG_PRINT(ERR_DBG, "Null in Rx Intr\n"); | 3023 | DBG_PRINT(ERR_DBG, "Null in Rx Intr\n"); |
2980 | return; | 3024 | return 0; |
2981 | } | 3025 | } |
2982 | if (ring_data->rxd_mode == RXD_MODE_1) { | 3026 | if (ring_data->rxd_mode == RXD_MODE_1) { |
2983 | rxdp1 = (struct RxD1*)rxdp; | 3027 | rxdp1 = (struct RxD1*)rxdp; |
@@ -3014,9 +3058,10 @@ static void rx_intr_handler(struct ring_info *ring_data) | |||
3014 | rxdp = ring_data->rx_blocks[get_block].block_virt_addr; | 3058 | rxdp = ring_data->rx_blocks[get_block].block_virt_addr; |
3015 | } | 3059 | } |
3016 | 3060 | ||
3017 | if(ring_data->nic->config.napi){ | 3061 | if (ring_data->nic->config.napi) { |
3018 | ring_data->nic->pkts_to_process -= 1; | 3062 | budget--; |
3019 | if (!ring_data->nic->pkts_to_process) | 3063 | napi_pkts++; |
3064 | if (!budget) | ||
3020 | break; | 3065 | break; |
3021 | } | 3066 | } |
3022 | pkt_cnt++; | 3067 | pkt_cnt++; |
@@ -3034,6 +3079,7 @@ static void rx_intr_handler(struct ring_info *ring_data) | |||
3034 | } | 3079 | } |
3035 | } | 3080 | } |
3036 | } | 3081 | } |
3082 | return(napi_pkts); | ||
3037 | } | 3083 | } |
3038 | 3084 | ||
3039 | /** | 3085 | /** |
@@ -3730,14 +3776,19 @@ static void restore_xmsi_data(struct s2io_nic *nic) | |||
3730 | { | 3776 | { |
3731 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 3777 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
3732 | u64 val64; | 3778 | u64 val64; |
3733 | int i; | 3779 | int i, msix_index; |
3780 | |||
3781 | |||
3782 | if (nic->device_type == XFRAME_I_DEVICE) | ||
3783 | return; | ||
3734 | 3784 | ||
3735 | for (i=0; i < MAX_REQUESTED_MSI_X; i++) { | 3785 | for (i=0; i < MAX_REQUESTED_MSI_X; i++) { |
3786 | msix_index = (i) ? ((i-1) * 8 + 1): 0; | ||
3736 | writeq(nic->msix_info[i].addr, &bar0->xmsi_address); | 3787 | writeq(nic->msix_info[i].addr, &bar0->xmsi_address); |
3737 | writeq(nic->msix_info[i].data, &bar0->xmsi_data); | 3788 | writeq(nic->msix_info[i].data, &bar0->xmsi_data); |
3738 | val64 = (s2BIT(7) | s2BIT(15) | vBIT(i, 26, 6)); | 3789 | val64 = (s2BIT(7) | s2BIT(15) | vBIT(msix_index, 26, 6)); |
3739 | writeq(val64, &bar0->xmsi_access); | 3790 | writeq(val64, &bar0->xmsi_access); |
3740 | if (wait_for_msix_trans(nic, i)) { | 3791 | if (wait_for_msix_trans(nic, msix_index)) { |
3741 | DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); | 3792 | DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); |
3742 | continue; | 3793 | continue; |
3743 | } | 3794 | } |
@@ -3748,13 +3799,17 @@ static void store_xmsi_data(struct s2io_nic *nic) | |||
3748 | { | 3799 | { |
3749 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 3800 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
3750 | u64 val64, addr, data; | 3801 | u64 val64, addr, data; |
3751 | int i; | 3802 | int i, msix_index; |
3803 | |||
3804 | if (nic->device_type == XFRAME_I_DEVICE) | ||
3805 | return; | ||
3752 | 3806 | ||
3753 | /* Store and display */ | 3807 | /* Store and display */ |
3754 | for (i=0; i < MAX_REQUESTED_MSI_X; i++) { | 3808 | for (i=0; i < MAX_REQUESTED_MSI_X; i++) { |
3755 | val64 = (s2BIT(15) | vBIT(i, 26, 6)); | 3809 | msix_index = (i) ? ((i-1) * 8 + 1): 0; |
3810 | val64 = (s2BIT(15) | vBIT(msix_index, 26, 6)); | ||
3756 | writeq(val64, &bar0->xmsi_access); | 3811 | writeq(val64, &bar0->xmsi_access); |
3757 | if (wait_for_msix_trans(nic, i)) { | 3812 | if (wait_for_msix_trans(nic, msix_index)) { |
3758 | DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); | 3813 | DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); |
3759 | continue; | 3814 | continue; |
3760 | } | 3815 | } |
@@ -3770,11 +3825,11 @@ static void store_xmsi_data(struct s2io_nic *nic) | |||
3770 | static int s2io_enable_msi_x(struct s2io_nic *nic) | 3825 | static int s2io_enable_msi_x(struct s2io_nic *nic) |
3771 | { | 3826 | { |
3772 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 3827 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
3773 | u64 tx_mat, rx_mat; | 3828 | u64 rx_mat; |
3774 | u16 msi_control; /* Temp variable */ | 3829 | u16 msi_control; /* Temp variable */ |
3775 | int ret, i, j, msix_indx = 1; | 3830 | int ret, i, j, msix_indx = 1; |
3776 | 3831 | ||
3777 | nic->entries = kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct msix_entry), | 3832 | nic->entries = kmalloc(nic->num_entries * sizeof(struct msix_entry), |
3778 | GFP_KERNEL); | 3833 | GFP_KERNEL); |
3779 | if (!nic->entries) { | 3834 | if (!nic->entries) { |
3780 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \ | 3835 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \ |
@@ -3783,10 +3838,12 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3783 | return -ENOMEM; | 3838 | return -ENOMEM; |
3784 | } | 3839 | } |
3785 | nic->mac_control.stats_info->sw_stat.mem_allocated | 3840 | nic->mac_control.stats_info->sw_stat.mem_allocated |
3786 | += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | 3841 | += (nic->num_entries * sizeof(struct msix_entry)); |
3842 | |||
3843 | memset(nic->entries, 0, nic->num_entries * sizeof(struct msix_entry)); | ||
3787 | 3844 | ||
3788 | nic->s2io_entries = | 3845 | nic->s2io_entries = |
3789 | kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct s2io_msix_entry), | 3846 | kmalloc(nic->num_entries * sizeof(struct s2io_msix_entry), |
3790 | GFP_KERNEL); | 3847 | GFP_KERNEL); |
3791 | if (!nic->s2io_entries) { | 3848 | if (!nic->s2io_entries) { |
3792 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", | 3849 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", |
@@ -3794,60 +3851,52 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3794 | nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; | 3851 | nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++; |
3795 | kfree(nic->entries); | 3852 | kfree(nic->entries); |
3796 | nic->mac_control.stats_info->sw_stat.mem_freed | 3853 | nic->mac_control.stats_info->sw_stat.mem_freed |
3797 | += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | 3854 | += (nic->num_entries * sizeof(struct msix_entry)); |
3798 | return -ENOMEM; | 3855 | return -ENOMEM; |
3799 | } | 3856 | } |
3800 | nic->mac_control.stats_info->sw_stat.mem_allocated | 3857 | nic->mac_control.stats_info->sw_stat.mem_allocated |
3801 | += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); | 3858 | += (nic->num_entries * sizeof(struct s2io_msix_entry)); |
3802 | 3859 | memset(nic->s2io_entries, 0, | |
3803 | for (i=0; i< MAX_REQUESTED_MSI_X; i++) { | 3860 | nic->num_entries * sizeof(struct s2io_msix_entry)); |
3804 | nic->entries[i].entry = i; | 3861 | |
3805 | nic->s2io_entries[i].entry = i; | 3862 | nic->entries[0].entry = 0; |
3863 | nic->s2io_entries[0].entry = 0; | ||
3864 | nic->s2io_entries[0].in_use = MSIX_FLG; | ||
3865 | nic->s2io_entries[0].type = MSIX_ALARM_TYPE; | ||
3866 | nic->s2io_entries[0].arg = &nic->mac_control.fifos; | ||
3867 | |||
3868 | for (i = 1; i < nic->num_entries; i++) { | ||
3869 | nic->entries[i].entry = ((i - 1) * 8) + 1; | ||
3870 | nic->s2io_entries[i].entry = ((i - 1) * 8) + 1; | ||
3806 | nic->s2io_entries[i].arg = NULL; | 3871 | nic->s2io_entries[i].arg = NULL; |
3807 | nic->s2io_entries[i].in_use = 0; | 3872 | nic->s2io_entries[i].in_use = 0; |
3808 | } | 3873 | } |
3809 | 3874 | ||
3810 | tx_mat = readq(&bar0->tx_mat0_n[0]); | ||
3811 | for (i=0; i<nic->config.tx_fifo_num; i++, msix_indx++) { | ||
3812 | tx_mat |= TX_MAT_SET(i, msix_indx); | ||
3813 | nic->s2io_entries[msix_indx].arg = &nic->mac_control.fifos[i]; | ||
3814 | nic->s2io_entries[msix_indx].type = MSIX_FIFO_TYPE; | ||
3815 | nic->s2io_entries[msix_indx].in_use = MSIX_FLG; | ||
3816 | } | ||
3817 | writeq(tx_mat, &bar0->tx_mat0_n[0]); | ||
3818 | |||
3819 | rx_mat = readq(&bar0->rx_mat); | 3875 | rx_mat = readq(&bar0->rx_mat); |
3820 | for (j = 0; j < nic->config.rx_ring_num; j++, msix_indx++) { | 3876 | for (j = 0; j < nic->config.rx_ring_num; j++) { |
3821 | rx_mat |= RX_MAT_SET(j, msix_indx); | 3877 | rx_mat |= RX_MAT_SET(j, msix_indx); |
3822 | nic->s2io_entries[msix_indx].arg | 3878 | nic->s2io_entries[j+1].arg = &nic->mac_control.rings[j]; |
3823 | = &nic->mac_control.rings[j]; | 3879 | nic->s2io_entries[j+1].type = MSIX_RING_TYPE; |
3824 | nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE; | 3880 | nic->s2io_entries[j+1].in_use = MSIX_FLG; |
3825 | nic->s2io_entries[msix_indx].in_use = MSIX_FLG; | 3881 | msix_indx += 8; |
3826 | } | 3882 | } |
3827 | writeq(rx_mat, &bar0->rx_mat); | 3883 | writeq(rx_mat, &bar0->rx_mat); |
3884 | readq(&bar0->rx_mat); | ||
3828 | 3885 | ||
3829 | nic->avail_msix_vectors = 0; | 3886 | ret = pci_enable_msix(nic->pdev, nic->entries, nic->num_entries); |
3830 | ret = pci_enable_msix(nic->pdev, nic->entries, MAX_REQUESTED_MSI_X); | ||
3831 | /* We fail init if error or we get less vectors than min required */ | 3887 | /* We fail init if error or we get less vectors than min required */ |
3832 | if (ret >= (nic->config.tx_fifo_num + nic->config.rx_ring_num + 1)) { | ||
3833 | nic->avail_msix_vectors = ret; | ||
3834 | ret = pci_enable_msix(nic->pdev, nic->entries, ret); | ||
3835 | } | ||
3836 | if (ret) { | 3888 | if (ret) { |
3837 | DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name); | 3889 | DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name); |
3838 | kfree(nic->entries); | 3890 | kfree(nic->entries); |
3839 | nic->mac_control.stats_info->sw_stat.mem_freed | 3891 | nic->mac_control.stats_info->sw_stat.mem_freed |
3840 | += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | 3892 | += (nic->num_entries * sizeof(struct msix_entry)); |
3841 | kfree(nic->s2io_entries); | 3893 | kfree(nic->s2io_entries); |
3842 | nic->mac_control.stats_info->sw_stat.mem_freed | 3894 | nic->mac_control.stats_info->sw_stat.mem_freed |
3843 | += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); | 3895 | += (nic->num_entries * sizeof(struct s2io_msix_entry)); |
3844 | nic->entries = NULL; | 3896 | nic->entries = NULL; |
3845 | nic->s2io_entries = NULL; | 3897 | nic->s2io_entries = NULL; |
3846 | nic->avail_msix_vectors = 0; | ||
3847 | return -ENOMEM; | 3898 | return -ENOMEM; |
3848 | } | 3899 | } |
3849 | if (!nic->avail_msix_vectors) | ||
3850 | nic->avail_msix_vectors = MAX_REQUESTED_MSI_X; | ||
3851 | 3900 | ||
3852 | /* | 3901 | /* |
3853 | * To enable MSI-X, MSI also needs to be enabled, due to a bug | 3902 | * To enable MSI-X, MSI also needs to be enabled, due to a bug |
@@ -3919,7 +3968,7 @@ static void remove_msix_isr(struct s2io_nic *sp) | |||
3919 | int i; | 3968 | int i; |
3920 | u16 msi_control; | 3969 | u16 msi_control; |
3921 | 3970 | ||
3922 | for (i = 0; i < MAX_REQUESTED_MSI_X; i++) { | 3971 | for (i = 0; i < sp->num_entries; i++) { |
3923 | if (sp->s2io_entries[i].in_use == | 3972 | if (sp->s2io_entries[i].in_use == |
3924 | MSIX_REGISTERED_SUCCESS) { | 3973 | MSIX_REGISTERED_SUCCESS) { |
3925 | int vector = sp->entries[i].vector; | 3974 | int vector = sp->entries[i].vector; |
@@ -3975,29 +4024,6 @@ static int s2io_open(struct net_device *dev) | |||
3975 | netif_carrier_off(dev); | 4024 | netif_carrier_off(dev); |
3976 | sp->last_link_state = 0; | 4025 | sp->last_link_state = 0; |
3977 | 4026 | ||
3978 | if (sp->config.intr_type == MSI_X) { | ||
3979 | int ret = s2io_enable_msi_x(sp); | ||
3980 | |||
3981 | if (!ret) { | ||
3982 | ret = s2io_test_msi(sp); | ||
3983 | /* rollback MSI-X, will re-enable during add_isr() */ | ||
3984 | remove_msix_isr(sp); | ||
3985 | } | ||
3986 | if (ret) { | ||
3987 | |||
3988 | DBG_PRINT(ERR_DBG, | ||
3989 | "%s: MSI-X requested but failed to enable\n", | ||
3990 | dev->name); | ||
3991 | sp->config.intr_type = INTA; | ||
3992 | } | ||
3993 | } | ||
3994 | |||
3995 | /* NAPI doesn't work well with MSI(X) */ | ||
3996 | if (sp->config.intr_type != INTA) { | ||
3997 | if(sp->config.napi) | ||
3998 | sp->config.napi = 0; | ||
3999 | } | ||
4000 | |||
4001 | /* Initialize H/W and enable interrupts */ | 4027 | /* Initialize H/W and enable interrupts */ |
4002 | err = s2io_card_up(sp); | 4028 | err = s2io_card_up(sp); |
4003 | if (err) { | 4029 | if (err) { |
@@ -4020,12 +4046,12 @@ hw_init_failed: | |||
4020 | if (sp->entries) { | 4046 | if (sp->entries) { |
4021 | kfree(sp->entries); | 4047 | kfree(sp->entries); |
4022 | sp->mac_control.stats_info->sw_stat.mem_freed | 4048 | sp->mac_control.stats_info->sw_stat.mem_freed |
4023 | += (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | 4049 | += (sp->num_entries * sizeof(struct msix_entry)); |
4024 | } | 4050 | } |
4025 | if (sp->s2io_entries) { | 4051 | if (sp->s2io_entries) { |
4026 | kfree(sp->s2io_entries); | 4052 | kfree(sp->s2io_entries); |
4027 | sp->mac_control.stats_info->sw_stat.mem_freed | 4053 | sp->mac_control.stats_info->sw_stat.mem_freed |
4028 | += (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); | 4054 | += (sp->num_entries * sizeof(struct s2io_msix_entry)); |
4029 | } | 4055 | } |
4030 | } | 4056 | } |
4031 | return err; | 4057 | return err; |
@@ -4327,40 +4353,64 @@ s2io_alarm_handle(unsigned long data) | |||
4327 | mod_timer(&sp->alarm_timer, jiffies + HZ / 2); | 4353 | mod_timer(&sp->alarm_timer, jiffies + HZ / 2); |
4328 | } | 4354 | } |
4329 | 4355 | ||
4330 | static int s2io_chk_rx_buffers(struct ring_info *ring) | ||
4331 | { | ||
4332 | if (fill_rx_buffers(ring) == -ENOMEM) { | ||
4333 | DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name); | ||
4334 | DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); | ||
4335 | } | ||
4336 | return 0; | ||
4337 | } | ||
4338 | |||
4339 | static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id) | 4356 | static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id) |
4340 | { | 4357 | { |
4341 | struct ring_info *ring = (struct ring_info *)dev_id; | 4358 | struct ring_info *ring = (struct ring_info *)dev_id; |
4342 | struct s2io_nic *sp = ring->nic; | 4359 | struct s2io_nic *sp = ring->nic; |
4360 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | ||
4361 | struct net_device *dev = sp->dev; | ||
4343 | 4362 | ||
4344 | if (!is_s2io_card_up(sp)) | 4363 | if (unlikely(!is_s2io_card_up(sp))) |
4345 | return IRQ_HANDLED; | 4364 | return IRQ_HANDLED; |
4346 | 4365 | ||
4347 | rx_intr_handler(ring); | 4366 | if (sp->config.napi) { |
4348 | s2io_chk_rx_buffers(ring); | 4367 | u8 *addr = NULL, val8 = 0; |
4368 | |||
4369 | addr = (u8 *)&bar0->xmsi_mask_reg; | ||
4370 | addr += (7 - ring->ring_no); | ||
4371 | val8 = (ring->ring_no == 0) ? 0x7f : 0xff; | ||
4372 | writeb(val8, addr); | ||
4373 | val8 = readb(addr); | ||
4374 | netif_rx_schedule(dev, &ring->napi); | ||
4375 | } else { | ||
4376 | rx_intr_handler(ring, 0); | ||
4377 | s2io_chk_rx_buffers(ring); | ||
4378 | } | ||
4349 | 4379 | ||
4350 | return IRQ_HANDLED; | 4380 | return IRQ_HANDLED; |
4351 | } | 4381 | } |
4352 | 4382 | ||
4353 | static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id) | 4383 | static irqreturn_t s2io_msix_fifo_handle(int irq, void *dev_id) |
4354 | { | 4384 | { |
4355 | struct fifo_info *fifo = (struct fifo_info *)dev_id; | 4385 | int i; |
4356 | struct s2io_nic *sp = fifo->nic; | 4386 | struct fifo_info *fifos = (struct fifo_info *)dev_id; |
4387 | struct s2io_nic *sp = fifos->nic; | ||
4388 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | ||
4389 | struct config_param *config = &sp->config; | ||
4390 | u64 reason; | ||
4357 | 4391 | ||
4358 | if (!is_s2io_card_up(sp)) | 4392 | if (unlikely(!is_s2io_card_up(sp))) |
4393 | return IRQ_NONE; | ||
4394 | |||
4395 | reason = readq(&bar0->general_int_status); | ||
4396 | if (unlikely(reason == S2IO_MINUS_ONE)) | ||
4397 | /* Nothing much can be done. Get out */ | ||
4359 | return IRQ_HANDLED; | 4398 | return IRQ_HANDLED; |
4360 | 4399 | ||
4361 | tx_intr_handler(fifo); | 4400 | writeq(S2IO_MINUS_ONE, &bar0->general_int_mask); |
4401 | |||
4402 | if (reason & GEN_INTR_TXTRAFFIC) | ||
4403 | writeq(S2IO_MINUS_ONE, &bar0->tx_traffic_int); | ||
4404 | |||
4405 | for (i = 0; i < config->tx_fifo_num; i++) | ||
4406 | tx_intr_handler(&fifos[i]); | ||
4407 | |||
4408 | writeq(sp->general_int_mask, &bar0->general_int_mask); | ||
4409 | readl(&bar0->general_int_status); | ||
4410 | |||
4362 | return IRQ_HANDLED; | 4411 | return IRQ_HANDLED; |
4363 | } | 4412 | } |
4413 | |||
4364 | static void s2io_txpic_intr_handle(struct s2io_nic *sp) | 4414 | static void s2io_txpic_intr_handle(struct s2io_nic *sp) |
4365 | { | 4415 | { |
4366 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | 4416 | struct XENA_dev_config __iomem *bar0 = sp->bar0; |
@@ -4762,14 +4812,10 @@ static irqreturn_t s2io_isr(int irq, void *dev_id) | |||
4762 | 4812 | ||
4763 | if (config->napi) { | 4813 | if (config->napi) { |
4764 | if (reason & GEN_INTR_RXTRAFFIC) { | 4814 | if (reason & GEN_INTR_RXTRAFFIC) { |
4765 | if (likely(netif_rx_schedule_prep(dev, | 4815 | netif_rx_schedule(dev, &sp->napi); |
4766 | &sp->napi))) { | 4816 | writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_mask); |
4767 | __netif_rx_schedule(dev, &sp->napi); | 4817 | writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); |
4768 | writeq(S2IO_MINUS_ONE, | 4818 | readl(&bar0->rx_traffic_int); |
4769 | &bar0->rx_traffic_mask); | ||
4770 | } else | ||
4771 | writeq(S2IO_MINUS_ONE, | ||
4772 | &bar0->rx_traffic_int); | ||
4773 | } | 4819 | } |
4774 | } else { | 4820 | } else { |
4775 | /* | 4821 | /* |
@@ -4781,7 +4827,7 @@ static irqreturn_t s2io_isr(int irq, void *dev_id) | |||
4781 | writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); | 4827 | writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int); |
4782 | 4828 | ||
4783 | for (i = 0; i < config->rx_ring_num; i++) | 4829 | for (i = 0; i < config->rx_ring_num; i++) |
4784 | rx_intr_handler(&mac_control->rings[i]); | 4830 | rx_intr_handler(&mac_control->rings[i], 0); |
4785 | } | 4831 | } |
4786 | 4832 | ||
4787 | /* | 4833 | /* |
@@ -6984,62 +7030,62 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6984 | 7030 | ||
6985 | /* After proper initialization of H/W, register ISR */ | 7031 | /* After proper initialization of H/W, register ISR */ |
6986 | if (sp->config.intr_type == MSI_X) { | 7032 | if (sp->config.intr_type == MSI_X) { |
6987 | int i, msix_tx_cnt=0,msix_rx_cnt=0; | 7033 | int i, msix_rx_cnt = 0; |
6988 | 7034 | ||
6989 | for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { | 7035 | for (i = 0; i < sp->num_entries; i++) { |
6990 | if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { | 7036 | if (sp->s2io_entries[i].in_use == MSIX_FLG) { |
6991 | sprintf(sp->desc[i], "%s:MSI-X-%d-TX", | 7037 | if (sp->s2io_entries[i].type == |
7038 | MSIX_RING_TYPE) { | ||
7039 | sprintf(sp->desc[i], "%s:MSI-X-%d-RX", | ||
7040 | dev->name, i); | ||
7041 | err = request_irq(sp->entries[i].vector, | ||
7042 | s2io_msix_ring_handle, 0, | ||
7043 | sp->desc[i], | ||
7044 | sp->s2io_entries[i].arg); | ||
7045 | } else if (sp->s2io_entries[i].type == | ||
7046 | MSIX_ALARM_TYPE) { | ||
7047 | sprintf(sp->desc[i], "%s:MSI-X-%d-TX", | ||
6992 | dev->name, i); | 7048 | dev->name, i); |
6993 | err = request_irq(sp->entries[i].vector, | 7049 | err = request_irq(sp->entries[i].vector, |
6994 | s2io_msix_fifo_handle, 0, sp->desc[i], | 7050 | s2io_msix_fifo_handle, 0, |
6995 | sp->s2io_entries[i].arg); | 7051 | sp->desc[i], |
6996 | /* If either data or addr is zero print it */ | 7052 | sp->s2io_entries[i].arg); |
6997 | if(!(sp->msix_info[i].addr && | 7053 | |
6998 | sp->msix_info[i].data)) { | ||
6999 | DBG_PRINT(ERR_DBG, "%s @ Addr:0x%llx " | ||
7000 | "Data:0x%llx\n",sp->desc[i], | ||
7001 | (unsigned long long) | ||
7002 | sp->msix_info[i].addr, | ||
7003 | (unsigned long long) | ||
7004 | sp->msix_info[i].data); | ||
7005 | } else { | ||
7006 | msix_tx_cnt++; | ||
7007 | } | 7054 | } |
7008 | } else { | 7055 | /* if either data or addr is zero print it. */ |
7009 | sprintf(sp->desc[i], "%s:MSI-X-%d-RX", | 7056 | if (!(sp->msix_info[i].addr && |
7010 | dev->name, i); | ||
7011 | err = request_irq(sp->entries[i].vector, | ||
7012 | s2io_msix_ring_handle, 0, sp->desc[i], | ||
7013 | sp->s2io_entries[i].arg); | ||
7014 | /* If either data or addr is zero print it */ | ||
7015 | if(!(sp->msix_info[i].addr && | ||
7016 | sp->msix_info[i].data)) { | 7057 | sp->msix_info[i].data)) { |
7017 | DBG_PRINT(ERR_DBG, "%s @ Addr:0x%llx " | 7058 | DBG_PRINT(ERR_DBG, |
7018 | "Data:0x%llx\n",sp->desc[i], | 7059 | "%s @Addr:0x%llx Data:0x%llx\n", |
7060 | sp->desc[i], | ||
7019 | (unsigned long long) | 7061 | (unsigned long long) |
7020 | sp->msix_info[i].addr, | 7062 | sp->msix_info[i].addr, |
7021 | (unsigned long long) | 7063 | (unsigned long long) |
7022 | sp->msix_info[i].data); | 7064 | ntohl(sp->msix_info[i].data)); |
7023 | } else { | 7065 | } else |
7024 | msix_rx_cnt++; | 7066 | msix_rx_cnt++; |
7067 | if (err) { | ||
7068 | remove_msix_isr(sp); | ||
7069 | |||
7070 | DBG_PRINT(ERR_DBG, | ||
7071 | "%s:MSI-X-%d registration " | ||
7072 | "failed\n", dev->name, i); | ||
7073 | |||
7074 | DBG_PRINT(ERR_DBG, | ||
7075 | "%s: Defaulting to INTA\n", | ||
7076 | dev->name); | ||
7077 | sp->config.intr_type = INTA; | ||
7078 | break; | ||
7025 | } | 7079 | } |
7080 | sp->s2io_entries[i].in_use = | ||
7081 | MSIX_REGISTERED_SUCCESS; | ||
7026 | } | 7082 | } |
7027 | if (err) { | ||
7028 | remove_msix_isr(sp); | ||
7029 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " | ||
7030 | "failed\n", dev->name, i); | ||
7031 | DBG_PRINT(ERR_DBG, "%s: defaulting to INTA\n", | ||
7032 | dev->name); | ||
7033 | sp->config.intr_type = INTA; | ||
7034 | break; | ||
7035 | } | ||
7036 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; | ||
7037 | } | 7083 | } |
7038 | if (!err) { | 7084 | if (!err) { |
7039 | printk(KERN_INFO "MSI-X-TX %d entries enabled\n", | ||
7040 | msix_tx_cnt); | ||
7041 | printk(KERN_INFO "MSI-X-RX %d entries enabled\n", | 7085 | printk(KERN_INFO "MSI-X-RX %d entries enabled\n", |
7042 | msix_rx_cnt); | 7086 | --msix_rx_cnt); |
7087 | DBG_PRINT(INFO_DBG, "MSI-X-TX entries enabled" | ||
7088 | " through alarm vector\n"); | ||
7043 | } | 7089 | } |
7044 | } | 7090 | } |
7045 | if (sp->config.intr_type == INTA) { | 7091 | if (sp->config.intr_type == INTA) { |
@@ -7080,8 +7126,15 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | |||
7080 | clear_bit(__S2IO_STATE_CARD_UP, &sp->state); | 7126 | clear_bit(__S2IO_STATE_CARD_UP, &sp->state); |
7081 | 7127 | ||
7082 | /* Disable napi */ | 7128 | /* Disable napi */ |
7083 | if (config->napi) | 7129 | if (sp->config.napi) { |
7084 | napi_disable(&sp->napi); | 7130 | int off = 0; |
7131 | if (config->intr_type == MSI_X) { | ||
7132 | for (; off < sp->config.rx_ring_num; off++) | ||
7133 | napi_disable(&sp->mac_control.rings[off].napi); | ||
7134 | } | ||
7135 | else | ||
7136 | napi_disable(&sp->napi); | ||
7137 | } | ||
7085 | 7138 | ||
7086 | /* disable Tx and Rx traffic on the NIC */ | 7139 | /* disable Tx and Rx traffic on the NIC */ |
7087 | if (do_io) | 7140 | if (do_io) |
@@ -7173,8 +7226,15 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
7173 | } | 7226 | } |
7174 | 7227 | ||
7175 | /* Initialise napi */ | 7228 | /* Initialise napi */ |
7176 | if (config->napi) | 7229 | if (config->napi) { |
7177 | napi_enable(&sp->napi); | 7230 | int i; |
7231 | if (config->intr_type == MSI_X) { | ||
7232 | for (i = 0; i < sp->config.rx_ring_num; i++) | ||
7233 | napi_enable(&sp->mac_control.rings[i].napi); | ||
7234 | } else { | ||
7235 | napi_enable(&sp->napi); | ||
7236 | } | ||
7237 | } | ||
7178 | 7238 | ||
7179 | /* Maintain the state prior to the open */ | 7239 | /* Maintain the state prior to the open */ |
7180 | if (sp->promisc_flg) | 7240 | if (sp->promisc_flg) |
@@ -7217,7 +7277,7 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
7217 | /* Enable select interrupts */ | 7277 | /* Enable select interrupts */ |
7218 | en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS); | 7278 | en_dis_err_alarms(sp, ENA_ALL_INTRS, ENABLE_INTRS); |
7219 | if (sp->config.intr_type != INTA) | 7279 | if (sp->config.intr_type != INTA) |
7220 | en_dis_able_nic_intrs(sp, ENA_ALL_INTRS, DISABLE_INTRS); | 7280 | en_dis_able_nic_intrs(sp, TX_TRAFFIC_INTR, ENABLE_INTRS); |
7221 | else { | 7281 | else { |
7222 | interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; | 7282 | interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; |
7223 | interruptible |= TX_PIC_INTR; | 7283 | interruptible |= TX_PIC_INTR; |
@@ -7615,9 +7675,6 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type, | |||
7615 | rx_ring_num = MAX_RX_RINGS; | 7675 | rx_ring_num = MAX_RX_RINGS; |
7616 | } | 7676 | } |
7617 | 7677 | ||
7618 | if (*dev_intr_type != INTA) | ||
7619 | napi = 0; | ||
7620 | |||
7621 | if ((*dev_intr_type != INTA) && (*dev_intr_type != MSI_X)) { | 7678 | if ((*dev_intr_type != INTA) && (*dev_intr_type != MSI_X)) { |
7622 | DBG_PRINT(ERR_DBG, "s2io: Wrong intr_type requested. " | 7679 | DBG_PRINT(ERR_DBG, "s2io: Wrong intr_type requested. " |
7623 | "Defaulting to INTA\n"); | 7680 | "Defaulting to INTA\n"); |
@@ -7918,8 +7975,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7918 | * will use eth_mac_addr() for dev->set_mac_address | 7975 | * will use eth_mac_addr() for dev->set_mac_address |
7919 | * mac address will be set every time dev->open() is called | 7976 | * mac address will be set every time dev->open() is called |
7920 | */ | 7977 | */ |
7921 | netif_napi_add(dev, &sp->napi, s2io_poll, 32); | ||
7922 | |||
7923 | #ifdef CONFIG_NET_POLL_CONTROLLER | 7978 | #ifdef CONFIG_NET_POLL_CONTROLLER |
7924 | dev->poll_controller = s2io_netpoll; | 7979 | dev->poll_controller = s2io_netpoll; |
7925 | #endif | 7980 | #endif |
@@ -7963,6 +8018,32 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7963 | } | 8018 | } |
7964 | } | 8019 | } |
7965 | 8020 | ||
8021 | if (sp->config.intr_type == MSI_X) { | ||
8022 | sp->num_entries = config->rx_ring_num + 1; | ||
8023 | ret = s2io_enable_msi_x(sp); | ||
8024 | |||
8025 | if (!ret) { | ||
8026 | ret = s2io_test_msi(sp); | ||
8027 | /* rollback MSI-X, will re-enable during add_isr() */ | ||
8028 | remove_msix_isr(sp); | ||
8029 | } | ||
8030 | if (ret) { | ||
8031 | |||
8032 | DBG_PRINT(ERR_DBG, | ||
8033 | "%s: MSI-X requested but failed to enable\n", | ||
8034 | dev->name); | ||
8035 | sp->config.intr_type = INTA; | ||
8036 | } | ||
8037 | } | ||
8038 | |||
8039 | if (config->intr_type == MSI_X) { | ||
8040 | for (i = 0; i < config->rx_ring_num ; i++) | ||
8041 | netif_napi_add(dev, &mac_control->rings[i].napi, | ||
8042 | s2io_poll_msix, 64); | ||
8043 | } else { | ||
8044 | netif_napi_add(dev, &sp->napi, s2io_poll_inta, 64); | ||
8045 | } | ||
8046 | |||
7966 | /* Not needed for Herc */ | 8047 | /* Not needed for Herc */ |
7967 | if (sp->device_type & XFRAME_I_DEVICE) { | 8048 | if (sp->device_type & XFRAME_I_DEVICE) { |
7968 | /* | 8049 | /* |
@@ -8013,6 +8094,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
8013 | /* store mac addresses from CAM to s2io_nic structure */ | 8094 | /* store mac addresses from CAM to s2io_nic structure */ |
8014 | do_s2io_store_unicast_mc(sp); | 8095 | do_s2io_store_unicast_mc(sp); |
8015 | 8096 | ||
8097 | /* Configure MSIX vector for number of rings configured plus one */ | ||
8098 | if ((sp->device_type == XFRAME_II_DEVICE) && | ||
8099 | (config->intr_type == MSI_X)) | ||
8100 | sp->num_entries = config->rx_ring_num + 1; | ||
8101 | |||
8016 | /* Store the values of the MSIX table in the s2io_nic structure */ | 8102 | /* Store the values of the MSIX table in the s2io_nic structure */ |
8017 | store_xmsi_data(sp); | 8103 | store_xmsi_data(sp); |
8018 | /* reset Nic and bring it to known state */ | 8104 | /* reset Nic and bring it to known state */ |
@@ -8078,8 +8164,14 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
8078 | break; | 8164 | break; |
8079 | } | 8165 | } |
8080 | 8166 | ||
8081 | if (napi) | 8167 | switch (sp->config.napi) { |
8168 | case 0: | ||
8169 | DBG_PRINT(ERR_DBG, "%s: NAPI disabled\n", dev->name); | ||
8170 | break; | ||
8171 | case 1: | ||
8082 | DBG_PRINT(ERR_DBG, "%s: NAPI enabled\n", dev->name); | 8172 | DBG_PRINT(ERR_DBG, "%s: NAPI enabled\n", dev->name); |
8173 | break; | ||
8174 | } | ||
8083 | 8175 | ||
8084 | DBG_PRINT(ERR_DBG, "%s: Using %d Tx fifo(s)\n", dev->name, | 8176 | DBG_PRINT(ERR_DBG, "%s: Using %d Tx fifo(s)\n", dev->name, |
8085 | sp->config.tx_fifo_num); | 8177 | sp->config.tx_fifo_num); |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 0709ebae9139..4706f7f9acb6 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -706,7 +706,7 @@ struct ring_info { | |||
706 | /* per-ring buffer counter */ | 706 | /* per-ring buffer counter */ |
707 | u32 rx_bufs_left; | 707 | u32 rx_bufs_left; |
708 | 708 | ||
709 | #define MAX_LRO_SESSIONS 32 | 709 | #define MAX_LRO_SESSIONS 32 |
710 | struct lro lro0_n[MAX_LRO_SESSIONS]; | 710 | struct lro lro0_n[MAX_LRO_SESSIONS]; |
711 | u8 lro; | 711 | u8 lro; |
712 | 712 | ||
@@ -725,6 +725,11 @@ struct ring_info { | |||
725 | /* copy of sp->pdev pointer */ | 725 | /* copy of sp->pdev pointer */ |
726 | struct pci_dev *pdev; | 726 | struct pci_dev *pdev; |
727 | 727 | ||
728 | /* Per ring napi struct */ | ||
729 | struct napi_struct napi; | ||
730 | |||
731 | unsigned long interrupt_count; | ||
732 | |||
728 | /* | 733 | /* |
729 | * Place holders for the virtual and physical addresses of | 734 | * Place holders for the virtual and physical addresses of |
730 | * all the Rx Blocks | 735 | * all the Rx Blocks |
@@ -841,7 +846,7 @@ struct usr_addr { | |||
841 | * Structure to keep track of the MSI-X vectors and the corresponding | 846 | * Structure to keep track of the MSI-X vectors and the corresponding |
842 | * argument registered against each vector | 847 | * argument registered against each vector |
843 | */ | 848 | */ |
844 | #define MAX_REQUESTED_MSI_X 17 | 849 | #define MAX_REQUESTED_MSI_X 9 |
845 | struct s2io_msix_entry | 850 | struct s2io_msix_entry |
846 | { | 851 | { |
847 | u16 vector; | 852 | u16 vector; |
@@ -849,8 +854,8 @@ struct s2io_msix_entry | |||
849 | void *arg; | 854 | void *arg; |
850 | 855 | ||
851 | u8 type; | 856 | u8 type; |
852 | #define MSIX_FIFO_TYPE 1 | 857 | #define MSIX_ALARM_TYPE 1 |
853 | #define MSIX_RING_TYPE 2 | 858 | #define MSIX_RING_TYPE 2 |
854 | 859 | ||
855 | u8 in_use; | 860 | u8 in_use; |
856 | #define MSIX_REGISTERED_SUCCESS 0xAA | 861 | #define MSIX_REGISTERED_SUCCESS 0xAA |
@@ -877,7 +882,6 @@ struct s2io_nic { | |||
877 | */ | 882 | */ |
878 | int pkts_to_process; | 883 | int pkts_to_process; |
879 | struct net_device *dev; | 884 | struct net_device *dev; |
880 | struct napi_struct napi; | ||
881 | struct mac_info mac_control; | 885 | struct mac_info mac_control; |
882 | struct config_param config; | 886 | struct config_param config; |
883 | struct pci_dev *pdev; | 887 | struct pci_dev *pdev; |
@@ -948,6 +952,7 @@ struct s2io_nic { | |||
948 | */ | 952 | */ |
949 | u8 other_fifo_idx; | 953 | u8 other_fifo_idx; |
950 | 954 | ||
955 | struct napi_struct napi; | ||
951 | /* after blink, the adapter must be restored with original | 956 | /* after blink, the adapter must be restored with original |
952 | * values. | 957 | * values. |
953 | */ | 958 | */ |
@@ -962,6 +967,7 @@ struct s2io_nic { | |||
962 | unsigned long long start_time; | 967 | unsigned long long start_time; |
963 | struct vlan_group *vlgrp; | 968 | struct vlan_group *vlgrp; |
964 | #define MSIX_FLG 0xA5 | 969 | #define MSIX_FLG 0xA5 |
970 | int num_entries; | ||
965 | struct msix_entry *entries; | 971 | struct msix_entry *entries; |
966 | int msi_detected; | 972 | int msi_detected; |
967 | wait_queue_head_t msi_wait; | 973 | wait_queue_head_t msi_wait; |
@@ -982,6 +988,7 @@ struct s2io_nic { | |||
982 | u16 lro_max_aggr_per_sess; | 988 | u16 lro_max_aggr_per_sess; |
983 | volatile unsigned long state; | 989 | volatile unsigned long state; |
984 | u64 general_int_mask; | 990 | u64 general_int_mask; |
991 | |||
985 | #define VPD_STRING_LEN 80 | 992 | #define VPD_STRING_LEN 80 |
986 | u8 product_name[VPD_STRING_LEN]; | 993 | u8 product_name[VPD_STRING_LEN]; |
987 | u8 serial_num[VPD_STRING_LEN]; | 994 | u8 serial_num[VPD_STRING_LEN]; |
@@ -1103,7 +1110,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev); | |||
1103 | static int init_shared_mem(struct s2io_nic *sp); | 1110 | static int init_shared_mem(struct s2io_nic *sp); |
1104 | static void free_shared_mem(struct s2io_nic *sp); | 1111 | static void free_shared_mem(struct s2io_nic *sp); |
1105 | static int init_nic(struct s2io_nic *nic); | 1112 | static int init_nic(struct s2io_nic *nic); |
1106 | static void rx_intr_handler(struct ring_info *ring_data); | 1113 | static int rx_intr_handler(struct ring_info *ring_data, int budget); |
1107 | static void tx_intr_handler(struct fifo_info *fifo_data); | 1114 | static void tx_intr_handler(struct fifo_info *fifo_data); |
1108 | static void s2io_handle_errors(void * dev_id); | 1115 | static void s2io_handle_errors(void * dev_id); |
1109 | 1116 | ||
@@ -1114,7 +1121,8 @@ static void s2io_set_multicast(struct net_device *dev); | |||
1114 | static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp); | 1121 | static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp); |
1115 | static void s2io_link(struct s2io_nic * sp, int link); | 1122 | static void s2io_link(struct s2io_nic * sp, int link); |
1116 | static void s2io_reset(struct s2io_nic * sp); | 1123 | static void s2io_reset(struct s2io_nic * sp); |
1117 | static int s2io_poll(struct napi_struct *napi, int budget); | 1124 | static int s2io_poll_msix(struct napi_struct *napi, int budget); |
1125 | static int s2io_poll_inta(struct napi_struct *napi, int budget); | ||
1118 | static void s2io_init_pci(struct s2io_nic * sp); | 1126 | static void s2io_init_pci(struct s2io_nic * sp); |
1119 | static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr); | 1127 | static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr); |
1120 | static void s2io_alarm_handle(unsigned long data); | 1128 | static void s2io_alarm_handle(unsigned long data); |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 888b7dec9866..33bb18f810fb 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
@@ -179,8 +179,7 @@ enum sbmac_state { | |||
179 | #define SBMAC_MAX_TXDESCR 256 | 179 | #define SBMAC_MAX_TXDESCR 256 |
180 | #define SBMAC_MAX_RXDESCR 256 | 180 | #define SBMAC_MAX_RXDESCR 256 |
181 | 181 | ||
182 | #define ETHER_ALIGN 2 | 182 | #define ETHER_ADDR_LEN 6 |
183 | #define ETHER_ADDR_LEN 6 | ||
184 | #define ENET_PACKET_SIZE 1518 | 183 | #define ENET_PACKET_SIZE 1518 |
185 | /*#define ENET_PACKET_SIZE 9216 */ | 184 | /*#define ENET_PACKET_SIZE 9216 */ |
186 | 185 | ||
@@ -262,8 +261,6 @@ struct sbmac_softc { | |||
262 | spinlock_t sbm_lock; /* spin lock */ | 261 | spinlock_t sbm_lock; /* spin lock */ |
263 | int sbm_devflags; /* current device flags */ | 262 | int sbm_devflags; /* current device flags */ |
264 | 263 | ||
265 | int sbm_buffersize; | ||
266 | |||
267 | /* | 264 | /* |
268 | * Controller-specific things | 265 | * Controller-specific things |
269 | */ | 266 | */ |
@@ -305,10 +302,11 @@ struct sbmac_softc { | |||
305 | static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan, | 302 | static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan, |
306 | int txrx, int maxdescr); | 303 | int txrx, int maxdescr); |
307 | static void sbdma_channel_start(struct sbmacdma *d, int rxtx); | 304 | static void sbdma_channel_start(struct sbmacdma *d, int rxtx); |
308 | static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *m); | 305 | static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d, |
306 | struct sk_buff *m); | ||
309 | static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m); | 307 | static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m); |
310 | static void sbdma_emptyring(struct sbmacdma *d); | 308 | static void sbdma_emptyring(struct sbmacdma *d); |
311 | static void sbdma_fillring(struct sbmacdma *d); | 309 | static void sbdma_fillring(struct sbmac_softc *sc, struct sbmacdma *d); |
312 | static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d, | 310 | static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d, |
313 | int work_to_do, int poll); | 311 | int work_to_do, int poll); |
314 | static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d, | 312 | static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d, |
@@ -777,16 +775,13 @@ static void sbdma_channel_stop(struct sbmacdma *d) | |||
777 | d->sbdma_remptr = NULL; | 775 | d->sbdma_remptr = NULL; |
778 | } | 776 | } |
779 | 777 | ||
780 | static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) | 778 | static inline void sbdma_align_skb(struct sk_buff *skb, |
779 | unsigned int power2, unsigned int offset) | ||
781 | { | 780 | { |
782 | unsigned long addr; | 781 | unsigned char *addr = skb->data; |
783 | unsigned long newaddr; | 782 | unsigned char *newaddr = PTR_ALIGN(addr, power2); |
784 | |||
785 | addr = (unsigned long) skb->data; | ||
786 | |||
787 | newaddr = (addr + power2 - 1) & ~(power2 - 1); | ||
788 | 783 | ||
789 | skb_reserve(skb,newaddr-addr+offset); | 784 | skb_reserve(skb, newaddr - addr + offset); |
790 | } | 785 | } |
791 | 786 | ||
792 | 787 | ||
@@ -797,7 +792,8 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) | |||
797 | * this queues a buffer for inbound packets. | 792 | * this queues a buffer for inbound packets. |
798 | * | 793 | * |
799 | * Input parameters: | 794 | * Input parameters: |
800 | * d - DMA channel descriptor | 795 | * sc - softc structure |
796 | * d - DMA channel descriptor | ||
801 | * sb - sk_buff to add, or NULL if we should allocate one | 797 | * sb - sk_buff to add, or NULL if we should allocate one |
802 | * | 798 | * |
803 | * Return value: | 799 | * Return value: |
@@ -806,8 +802,10 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) | |||
806 | ********************************************************************* */ | 802 | ********************************************************************* */ |
807 | 803 | ||
808 | 804 | ||
809 | static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb) | 805 | static int sbdma_add_rcvbuffer(struct sbmac_softc *sc, struct sbmacdma *d, |
806 | struct sk_buff *sb) | ||
810 | { | 807 | { |
808 | struct net_device *dev = sc->sbm_dev; | ||
811 | struct sbdmadscr *dsc; | 809 | struct sbdmadscr *dsc; |
812 | struct sbdmadscr *nextdsc; | 810 | struct sbdmadscr *nextdsc; |
813 | struct sk_buff *sb_new = NULL; | 811 | struct sk_buff *sb_new = NULL; |
@@ -848,14 +846,16 @@ static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb) | |||
848 | */ | 846 | */ |
849 | 847 | ||
850 | if (sb == NULL) { | 848 | if (sb == NULL) { |
851 | sb_new = dev_alloc_skb(ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN); | 849 | sb_new = netdev_alloc_skb(dev, ENET_PACKET_SIZE + |
850 | SMP_CACHE_BYTES * 2 + | ||
851 | NET_IP_ALIGN); | ||
852 | if (sb_new == NULL) { | 852 | if (sb_new == NULL) { |
853 | pr_info("%s: sk_buff allocation failed\n", | 853 | pr_info("%s: sk_buff allocation failed\n", |
854 | d->sbdma_eth->sbm_dev->name); | 854 | d->sbdma_eth->sbm_dev->name); |
855 | return -ENOBUFS; | 855 | return -ENOBUFS; |
856 | } | 856 | } |
857 | 857 | ||
858 | sbdma_align_skb(sb_new, SMP_CACHE_BYTES, ETHER_ALIGN); | 858 | sbdma_align_skb(sb_new, SMP_CACHE_BYTES, NET_IP_ALIGN); |
859 | } | 859 | } |
860 | else { | 860 | else { |
861 | sb_new = sb; | 861 | sb_new = sb; |
@@ -874,10 +874,10 @@ static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb) | |||
874 | * Do not interrupt per DMA transfer. | 874 | * Do not interrupt per DMA transfer. |
875 | */ | 875 | */ |
876 | dsc->dscr_a = virt_to_phys(sb_new->data) | | 876 | dsc->dscr_a = virt_to_phys(sb_new->data) | |
877 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; | 877 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize + NET_IP_ALIGN)) | 0; |
878 | #else | 878 | #else |
879 | dsc->dscr_a = virt_to_phys(sb_new->data) | | 879 | dsc->dscr_a = virt_to_phys(sb_new->data) | |
880 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | | 880 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize + NET_IP_ALIGN)) | |
881 | M_DMA_DSCRA_INTERRUPT; | 881 | M_DMA_DSCRA_INTERRUPT; |
882 | #endif | 882 | #endif |
883 | 883 | ||
@@ -1032,18 +1032,19 @@ static void sbdma_emptyring(struct sbmacdma *d) | |||
1032 | * with sk_buffs | 1032 | * with sk_buffs |
1033 | * | 1033 | * |
1034 | * Input parameters: | 1034 | * Input parameters: |
1035 | * d - DMA channel | 1035 | * sc - softc structure |
1036 | * d - DMA channel | ||
1036 | * | 1037 | * |
1037 | * Return value: | 1038 | * Return value: |
1038 | * nothing | 1039 | * nothing |
1039 | ********************************************************************* */ | 1040 | ********************************************************************* */ |
1040 | 1041 | ||
1041 | static void sbdma_fillring(struct sbmacdma *d) | 1042 | static void sbdma_fillring(struct sbmac_softc *sc, struct sbmacdma *d) |
1042 | { | 1043 | { |
1043 | int idx; | 1044 | int idx; |
1044 | 1045 | ||
1045 | for (idx = 0; idx < SBMAC_MAX_RXDESCR-1; idx++) { | 1046 | for (idx = 0; idx < SBMAC_MAX_RXDESCR - 1; idx++) { |
1046 | if (sbdma_add_rcvbuffer(d,NULL) != 0) | 1047 | if (sbdma_add_rcvbuffer(sc, d, NULL) != 0) |
1047 | break; | 1048 | break; |
1048 | } | 1049 | } |
1049 | } | 1050 | } |
@@ -1159,10 +1160,11 @@ again: | |||
1159 | * packet and put it right back on the receive ring. | 1160 | * packet and put it right back on the receive ring. |
1160 | */ | 1161 | */ |
1161 | 1162 | ||
1162 | if (unlikely (sbdma_add_rcvbuffer(d,NULL) == | 1163 | if (unlikely(sbdma_add_rcvbuffer(sc, d, NULL) == |
1163 | -ENOBUFS)) { | 1164 | -ENOBUFS)) { |
1164 | dev->stats.rx_dropped++; | 1165 | dev->stats.rx_dropped++; |
1165 | sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ | 1166 | /* Re-add old buffer */ |
1167 | sbdma_add_rcvbuffer(sc, d, sb); | ||
1166 | /* No point in continuing at the moment */ | 1168 | /* No point in continuing at the moment */ |
1167 | printk(KERN_ERR "dropped packet (1)\n"); | 1169 | printk(KERN_ERR "dropped packet (1)\n"); |
1168 | d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); | 1170 | d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); |
@@ -1212,7 +1214,7 @@ again: | |||
1212 | * put it back on the receive ring. | 1214 | * put it back on the receive ring. |
1213 | */ | 1215 | */ |
1214 | dev->stats.rx_errors++; | 1216 | dev->stats.rx_errors++; |
1215 | sbdma_add_rcvbuffer(d,sb); | 1217 | sbdma_add_rcvbuffer(sc, d, sb); |
1216 | } | 1218 | } |
1217 | 1219 | ||
1218 | 1220 | ||
@@ -1570,7 +1572,7 @@ static void sbmac_channel_start(struct sbmac_softc *s) | |||
1570 | * Fill the receive ring | 1572 | * Fill the receive ring |
1571 | */ | 1573 | */ |
1572 | 1574 | ||
1573 | sbdma_fillring(&(s->sbm_rxdma)); | 1575 | sbdma_fillring(s, &(s->sbm_rxdma)); |
1574 | 1576 | ||
1575 | /* | 1577 | /* |
1576 | * Turn on the rest of the bits in the enable register | 1578 | * Turn on the rest of the bits in the enable register |
@@ -2312,13 +2314,6 @@ static int sbmac_init(struct platform_device *pldev, long long base) | |||
2312 | dev->dev_addr[i] = eaddr[i]; | 2314 | dev->dev_addr[i] = eaddr[i]; |
2313 | } | 2315 | } |
2314 | 2316 | ||
2315 | |||
2316 | /* | ||
2317 | * Init packet size | ||
2318 | */ | ||
2319 | |||
2320 | sc->sbm_buffersize = ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN; | ||
2321 | |||
2322 | /* | 2317 | /* |
2323 | * Initialize context (get pointers to registers and stuff), then | 2318 | * Initialize context (get pointers to registers and stuff), then |
2324 | * allocate the memory for the descriptor tables. | 2319 | * allocate the memory for the descriptor tables. |
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index f64a860029b7..b4b63805ee8f 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c | |||
@@ -953,9 +953,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
953 | unsigned entry; | 953 | unsigned entry; |
954 | u32 tx_status; | 954 | u32 tx_status; |
955 | 955 | ||
956 | if (skb_padto(skb, ETH_ZLEN)) | ||
957 | return NETDEV_TX_OK; | ||
958 | |||
959 | if (unlikely(skb->len > TX_BUF_SIZE)) { | 956 | if (unlikely(skb->len > TX_BUF_SIZE)) { |
960 | dev->stats.tx_dropped++; | 957 | dev->stats.tx_dropped++; |
961 | goto out; | 958 | goto out; |
@@ -975,6 +972,11 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
975 | skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); | 972 | skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); |
976 | 973 | ||
977 | len = skb->len; | 974 | len = skb->len; |
975 | if (unlikely(len < ETH_ZLEN)) { | ||
976 | memset(priv->tx_bufs + entry * TX_BUF_SIZE + len, | ||
977 | 0, ETH_ZLEN - len); | ||
978 | len = ETH_ZLEN; | ||
979 | } | ||
978 | 980 | ||
979 | wmb(); | 981 | wmb(); |
980 | 982 | ||
diff --git a/drivers/net/sfc/bitfield.h b/drivers/net/sfc/bitfield.h index 2806201644cc..2c79d27404e0 100644 --- a/drivers/net/sfc/bitfield.h +++ b/drivers/net/sfc/bitfield.h | |||
@@ -483,7 +483,7 @@ typedef union efx_oword { | |||
483 | #endif | 483 | #endif |
484 | 484 | ||
485 | #define EFX_SET_OWORD_FIELD_VER(efx, oword, field, value) do { \ | 485 | #define EFX_SET_OWORD_FIELD_VER(efx, oword, field, value) do { \ |
486 | if (FALCON_REV(efx) >= FALCON_REV_B0) { \ | 486 | if (falcon_rev(efx) >= FALCON_REV_B0) { \ |
487 | EFX_SET_OWORD_FIELD((oword), field##_B0, (value)); \ | 487 | EFX_SET_OWORD_FIELD((oword), field##_B0, (value)); \ |
488 | } else { \ | 488 | } else { \ |
489 | EFX_SET_OWORD_FIELD((oword), field##_A1, (value)); \ | 489 | EFX_SET_OWORD_FIELD((oword), field##_A1, (value)); \ |
@@ -491,7 +491,7 @@ typedef union efx_oword { | |||
491 | } while (0) | 491 | } while (0) |
492 | 492 | ||
493 | #define EFX_QWORD_FIELD_VER(efx, qword, field) \ | 493 | #define EFX_QWORD_FIELD_VER(efx, qword, field) \ |
494 | (FALCON_REV(efx) >= FALCON_REV_B0 ? \ | 494 | (falcon_rev(efx) >= FALCON_REV_B0 ? \ |
495 | EFX_QWORD_FIELD((qword), field##_B0) : \ | 495 | EFX_QWORD_FIELD((qword), field##_B0) : \ |
496 | EFX_QWORD_FIELD((qword), field##_A1)) | 496 | EFX_QWORD_FIELD((qword), field##_A1)) |
497 | 497 | ||
@@ -501,8 +501,5 @@ typedef union efx_oword { | |||
501 | #define DMA_ADDR_T_WIDTH (8 * sizeof(dma_addr_t)) | 501 | #define DMA_ADDR_T_WIDTH (8 * sizeof(dma_addr_t)) |
502 | #define EFX_DMA_TYPE_WIDTH(width) \ | 502 | #define EFX_DMA_TYPE_WIDTH(width) \ |
503 | (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH) | 503 | (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH) |
504 | #define EFX_DMA_MAX_MASK ((DMA_ADDR_T_WIDTH == 64) ? \ | ||
505 | ~((u64) 0) : ~((u32) 0)) | ||
506 | #define EFX_DMA_MASK(mask) ((mask) & EFX_DMA_MAX_MASK) | ||
507 | 504 | ||
508 | #endif /* EFX_BITFIELD_H */ | 505 | #endif /* EFX_BITFIELD_H */ |
diff --git a/drivers/net/sfc/boards.c b/drivers/net/sfc/boards.c index eecaa6d58584..7fc0328dc055 100644 --- a/drivers/net/sfc/boards.c +++ b/drivers/net/sfc/boards.c | |||
@@ -27,10 +27,8 @@ static void blink_led_timer(unsigned long context) | |||
27 | struct efx_blinker *bl = &efx->board_info.blinker; | 27 | struct efx_blinker *bl = &efx->board_info.blinker; |
28 | efx->board_info.set_fault_led(efx, bl->state); | 28 | efx->board_info.set_fault_led(efx, bl->state); |
29 | bl->state = !bl->state; | 29 | bl->state = !bl->state; |
30 | if (bl->resubmit) { | 30 | if (bl->resubmit) |
31 | bl->timer.expires = jiffies + BLINK_INTERVAL; | 31 | mod_timer(&bl->timer, jiffies + BLINK_INTERVAL); |
32 | add_timer(&bl->timer); | ||
33 | } | ||
34 | } | 32 | } |
35 | 33 | ||
36 | static void board_blink(struct efx_nic *efx, int blink) | 34 | static void board_blink(struct efx_nic *efx, int blink) |
@@ -44,8 +42,7 @@ static void board_blink(struct efx_nic *efx, int blink) | |||
44 | blinker->state = 0; | 42 | blinker->state = 0; |
45 | setup_timer(&blinker->timer, blink_led_timer, | 43 | setup_timer(&blinker->timer, blink_led_timer, |
46 | (unsigned long)efx); | 44 | (unsigned long)efx); |
47 | blinker->timer.expires = jiffies + BLINK_INTERVAL; | 45 | mod_timer(&blinker->timer, jiffies + BLINK_INTERVAL); |
48 | add_timer(&blinker->timer); | ||
49 | } else { | 46 | } else { |
50 | blinker->resubmit = 0; | 47 | blinker->resubmit = 0; |
51 | if (blinker->timer.function) | 48 | if (blinker->timer.function) |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 418f2e53a95b..449760642e31 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -199,11 +199,12 @@ static inline int efx_process_channel(struct efx_channel *channel, int rx_quota) | |||
199 | */ | 199 | */ |
200 | static inline void efx_channel_processed(struct efx_channel *channel) | 200 | static inline void efx_channel_processed(struct efx_channel *channel) |
201 | { | 201 | { |
202 | /* Write to EVQ_RPTR_REG. If a new event arrived in a race | 202 | /* The interrupt handler for this channel may set work_pending |
203 | * with finishing processing, a new interrupt will be raised. | 203 | * as soon as we acknowledge the events we've seen. Make sure |
204 | */ | 204 | * it's cleared before then. */ |
205 | channel->work_pending = 0; | 205 | channel->work_pending = 0; |
206 | smp_wmb(); /* Ensure channel updated before any new interrupt. */ | 206 | smp_wmb(); |
207 | |||
207 | falcon_eventq_read_ack(channel); | 208 | falcon_eventq_read_ack(channel); |
208 | } | 209 | } |
209 | 210 | ||
@@ -265,7 +266,7 @@ void efx_process_channel_now(struct efx_channel *channel) | |||
265 | napi_disable(&channel->napi_str); | 266 | napi_disable(&channel->napi_str); |
266 | 267 | ||
267 | /* Poll the channel */ | 268 | /* Poll the channel */ |
268 | (void) efx_process_channel(channel, efx->type->evq_size); | 269 | efx_process_channel(channel, efx->type->evq_size); |
269 | 270 | ||
270 | /* Ack the eventq. This may cause an interrupt to be generated | 271 | /* Ack the eventq. This may cause an interrupt to be generated |
271 | * when they are reenabled */ | 272 | * when they are reenabled */ |
@@ -317,26 +318,6 @@ static void efx_remove_eventq(struct efx_channel *channel) | |||
317 | * | 318 | * |
318 | *************************************************************************/ | 319 | *************************************************************************/ |
319 | 320 | ||
320 | /* Setup per-NIC RX buffer parameters. | ||
321 | * Calculate the rx buffer allocation parameters required to support | ||
322 | * the current MTU, including padding for header alignment and overruns. | ||
323 | */ | ||
324 | static void efx_calc_rx_buffer_params(struct efx_nic *efx) | ||
325 | { | ||
326 | unsigned int order, len; | ||
327 | |||
328 | len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) + | ||
329 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + | ||
330 | efx->type->rx_buffer_padding); | ||
331 | |||
332 | /* Calculate page-order */ | ||
333 | for (order = 0; ((1u << order) * PAGE_SIZE) < len; ++order) | ||
334 | ; | ||
335 | |||
336 | efx->rx_buffer_len = len; | ||
337 | efx->rx_buffer_order = order; | ||
338 | } | ||
339 | |||
340 | static int efx_probe_channel(struct efx_channel *channel) | 321 | static int efx_probe_channel(struct efx_channel *channel) |
341 | { | 322 | { |
342 | struct efx_tx_queue *tx_queue; | 323 | struct efx_tx_queue *tx_queue; |
@@ -387,7 +368,14 @@ static int efx_init_channels(struct efx_nic *efx) | |||
387 | struct efx_channel *channel; | 368 | struct efx_channel *channel; |
388 | int rc = 0; | 369 | int rc = 0; |
389 | 370 | ||
390 | efx_calc_rx_buffer_params(efx); | 371 | /* Calculate the rx buffer allocation parameters required to |
372 | * support the current MTU, including padding for header | ||
373 | * alignment and overruns. | ||
374 | */ | ||
375 | efx->rx_buffer_len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) + | ||
376 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + | ||
377 | efx->type->rx_buffer_padding); | ||
378 | efx->rx_buffer_order = get_order(efx->rx_buffer_len); | ||
391 | 379 | ||
392 | /* Initialise the channels */ | 380 | /* Initialise the channels */ |
393 | efx_for_each_channel(channel, efx) { | 381 | efx_for_each_channel(channel, efx) { |
@@ -440,9 +428,12 @@ static void efx_start_channel(struct efx_channel *channel) | |||
440 | netif_napi_add(channel->napi_dev, &channel->napi_str, | 428 | netif_napi_add(channel->napi_dev, &channel->napi_str, |
441 | efx_poll, napi_weight); | 429 | efx_poll, napi_weight); |
442 | 430 | ||
431 | /* The interrupt handler for this channel may set work_pending | ||
432 | * as soon as we enable it. Make sure it's cleared before | ||
433 | * then. Similarly, make sure it sees the enabled flag set. */ | ||
443 | channel->work_pending = 0; | 434 | channel->work_pending = 0; |
444 | channel->enabled = 1; | 435 | channel->enabled = 1; |
445 | smp_wmb(); /* ensure channel updated before first interrupt */ | 436 | smp_wmb(); |
446 | 437 | ||
447 | napi_enable(&channel->napi_str); | 438 | napi_enable(&channel->napi_str); |
448 | 439 | ||
@@ -704,7 +695,7 @@ static void efx_stop_port(struct efx_nic *efx) | |||
704 | mutex_unlock(&efx->mac_lock); | 695 | mutex_unlock(&efx->mac_lock); |
705 | 696 | ||
706 | /* Serialise against efx_set_multicast_list() */ | 697 | /* Serialise against efx_set_multicast_list() */ |
707 | if (NET_DEV_REGISTERED(efx)) { | 698 | if (efx_dev_registered(efx)) { |
708 | netif_tx_lock_bh(efx->net_dev); | 699 | netif_tx_lock_bh(efx->net_dev); |
709 | netif_tx_unlock_bh(efx->net_dev); | 700 | netif_tx_unlock_bh(efx->net_dev); |
710 | } | 701 | } |
@@ -791,22 +782,23 @@ static int efx_init_io(struct efx_nic *efx) | |||
791 | efx->membase = ioremap_nocache(efx->membase_phys, | 782 | efx->membase = ioremap_nocache(efx->membase_phys, |
792 | efx->type->mem_map_size); | 783 | efx->type->mem_map_size); |
793 | if (!efx->membase) { | 784 | if (!efx->membase) { |
794 | EFX_ERR(efx, "could not map memory BAR %d at %lx+%x\n", | 785 | EFX_ERR(efx, "could not map memory BAR %d at %llx+%x\n", |
795 | efx->type->mem_bar, efx->membase_phys, | 786 | efx->type->mem_bar, |
787 | (unsigned long long)efx->membase_phys, | ||
796 | efx->type->mem_map_size); | 788 | efx->type->mem_map_size); |
797 | rc = -ENOMEM; | 789 | rc = -ENOMEM; |
798 | goto fail4; | 790 | goto fail4; |
799 | } | 791 | } |
800 | EFX_LOG(efx, "memory BAR %u at %lx+%x (virtual %p)\n", | 792 | EFX_LOG(efx, "memory BAR %u at %llx+%x (virtual %p)\n", |
801 | efx->type->mem_bar, efx->membase_phys, efx->type->mem_map_size, | 793 | efx->type->mem_bar, (unsigned long long)efx->membase_phys, |
802 | efx->membase); | 794 | efx->type->mem_map_size, efx->membase); |
803 | 795 | ||
804 | return 0; | 796 | return 0; |
805 | 797 | ||
806 | fail4: | 798 | fail4: |
807 | release_mem_region(efx->membase_phys, efx->type->mem_map_size); | 799 | release_mem_region(efx->membase_phys, efx->type->mem_map_size); |
808 | fail3: | 800 | fail3: |
809 | efx->membase_phys = 0UL; | 801 | efx->membase_phys = 0; |
810 | fail2: | 802 | fail2: |
811 | pci_disable_device(efx->pci_dev); | 803 | pci_disable_device(efx->pci_dev); |
812 | fail1: | 804 | fail1: |
@@ -824,7 +816,7 @@ static void efx_fini_io(struct efx_nic *efx) | |||
824 | 816 | ||
825 | if (efx->membase_phys) { | 817 | if (efx->membase_phys) { |
826 | pci_release_region(efx->pci_dev, efx->type->mem_bar); | 818 | pci_release_region(efx->pci_dev, efx->type->mem_bar); |
827 | efx->membase_phys = 0UL; | 819 | efx->membase_phys = 0; |
828 | } | 820 | } |
829 | 821 | ||
830 | pci_disable_device(efx->pci_dev); | 822 | pci_disable_device(efx->pci_dev); |
@@ -1043,7 +1035,7 @@ static void efx_start_all(struct efx_nic *efx) | |||
1043 | return; | 1035 | return; |
1044 | if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT)) | 1036 | if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT)) |
1045 | return; | 1037 | return; |
1046 | if (NET_DEV_REGISTERED(efx) && !netif_running(efx->net_dev)) | 1038 | if (efx_dev_registered(efx) && !netif_running(efx->net_dev)) |
1047 | return; | 1039 | return; |
1048 | 1040 | ||
1049 | /* Mark the port as enabled so port reconfigurations can start, then | 1041 | /* Mark the port as enabled so port reconfigurations can start, then |
@@ -1073,9 +1065,8 @@ static void efx_flush_all(struct efx_nic *efx) | |||
1073 | cancel_delayed_work_sync(&efx->monitor_work); | 1065 | cancel_delayed_work_sync(&efx->monitor_work); |
1074 | 1066 | ||
1075 | /* Ensure that all RX slow refills are complete. */ | 1067 | /* Ensure that all RX slow refills are complete. */ |
1076 | efx_for_each_rx_queue(rx_queue, efx) { | 1068 | efx_for_each_rx_queue(rx_queue, efx) |
1077 | cancel_delayed_work_sync(&rx_queue->work); | 1069 | cancel_delayed_work_sync(&rx_queue->work); |
1078 | } | ||
1079 | 1070 | ||
1080 | /* Stop scheduled port reconfigurations */ | 1071 | /* Stop scheduled port reconfigurations */ |
1081 | cancel_work_sync(&efx->reconfigure_work); | 1072 | cancel_work_sync(&efx->reconfigure_work); |
@@ -1101,9 +1092,10 @@ static void efx_stop_all(struct efx_nic *efx) | |||
1101 | falcon_disable_interrupts(efx); | 1092 | falcon_disable_interrupts(efx); |
1102 | if (efx->legacy_irq) | 1093 | if (efx->legacy_irq) |
1103 | synchronize_irq(efx->legacy_irq); | 1094 | synchronize_irq(efx->legacy_irq); |
1104 | efx_for_each_channel_with_interrupt(channel, efx) | 1095 | efx_for_each_channel_with_interrupt(channel, efx) { |
1105 | if (channel->irq) | 1096 | if (channel->irq) |
1106 | synchronize_irq(channel->irq); | 1097 | synchronize_irq(channel->irq); |
1098 | } | ||
1107 | 1099 | ||
1108 | /* Stop all NAPI processing and synchronous rx refills */ | 1100 | /* Stop all NAPI processing and synchronous rx refills */ |
1109 | efx_for_each_channel(channel, efx) | 1101 | efx_for_each_channel(channel, efx) |
@@ -1125,7 +1117,7 @@ static void efx_stop_all(struct efx_nic *efx) | |||
1125 | /* Stop the kernel transmit interface late, so the watchdog | 1117 | /* Stop the kernel transmit interface late, so the watchdog |
1126 | * timer isn't ticking over the flush */ | 1118 | * timer isn't ticking over the flush */ |
1127 | efx_stop_queue(efx); | 1119 | efx_stop_queue(efx); |
1128 | if (NET_DEV_REGISTERED(efx)) { | 1120 | if (efx_dev_registered(efx)) { |
1129 | netif_tx_lock_bh(efx->net_dev); | 1121 | netif_tx_lock_bh(efx->net_dev); |
1130 | netif_tx_unlock_bh(efx->net_dev); | 1122 | netif_tx_unlock_bh(efx->net_dev); |
1131 | } | 1123 | } |
@@ -1344,13 +1336,17 @@ static int efx_net_stop(struct net_device *net_dev) | |||
1344 | return 0; | 1336 | return 0; |
1345 | } | 1337 | } |
1346 | 1338 | ||
1347 | /* Context: process, dev_base_lock held, non-blocking. */ | 1339 | /* Context: process, dev_base_lock or RTNL held, non-blocking. */ |
1348 | static struct net_device_stats *efx_net_stats(struct net_device *net_dev) | 1340 | static struct net_device_stats *efx_net_stats(struct net_device *net_dev) |
1349 | { | 1341 | { |
1350 | struct efx_nic *efx = net_dev->priv; | 1342 | struct efx_nic *efx = net_dev->priv; |
1351 | struct efx_mac_stats *mac_stats = &efx->mac_stats; | 1343 | struct efx_mac_stats *mac_stats = &efx->mac_stats; |
1352 | struct net_device_stats *stats = &net_dev->stats; | 1344 | struct net_device_stats *stats = &net_dev->stats; |
1353 | 1345 | ||
1346 | /* Update stats if possible, but do not wait if another thread | ||
1347 | * is updating them (or resetting the NIC); slightly stale | ||
1348 | * stats are acceptable. | ||
1349 | */ | ||
1354 | if (!spin_trylock(&efx->stats_lock)) | 1350 | if (!spin_trylock(&efx->stats_lock)) |
1355 | return stats; | 1351 | return stats; |
1356 | if (efx->state == STATE_RUNNING) { | 1352 | if (efx->state == STATE_RUNNING) { |
@@ -1494,7 +1490,7 @@ static void efx_set_multicast_list(struct net_device *net_dev) | |||
1494 | static int efx_netdev_event(struct notifier_block *this, | 1490 | static int efx_netdev_event(struct notifier_block *this, |
1495 | unsigned long event, void *ptr) | 1491 | unsigned long event, void *ptr) |
1496 | { | 1492 | { |
1497 | struct net_device *net_dev = (struct net_device *)ptr; | 1493 | struct net_device *net_dev = ptr; |
1498 | 1494 | ||
1499 | if (net_dev->open == efx_net_open && event == NETDEV_CHANGENAME) { | 1495 | if (net_dev->open == efx_net_open && event == NETDEV_CHANGENAME) { |
1500 | struct efx_nic *efx = net_dev->priv; | 1496 | struct efx_nic *efx = net_dev->priv; |
@@ -1563,7 +1559,7 @@ static void efx_unregister_netdev(struct efx_nic *efx) | |||
1563 | efx_for_each_tx_queue(tx_queue, efx) | 1559 | efx_for_each_tx_queue(tx_queue, efx) |
1564 | efx_release_tx_buffers(tx_queue); | 1560 | efx_release_tx_buffers(tx_queue); |
1565 | 1561 | ||
1566 | if (NET_DEV_REGISTERED(efx)) { | 1562 | if (efx_dev_registered(efx)) { |
1567 | strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name)); | 1563 | strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name)); |
1568 | unregister_netdev(efx->net_dev); | 1564 | unregister_netdev(efx->net_dev); |
1569 | } | 1565 | } |
@@ -1688,7 +1684,7 @@ static int efx_reset(struct efx_nic *efx) | |||
1688 | if (method == RESET_TYPE_DISABLE) { | 1684 | if (method == RESET_TYPE_DISABLE) { |
1689 | /* Reinitialise the device anyway so the driver unload sequence | 1685 | /* Reinitialise the device anyway so the driver unload sequence |
1690 | * can talk to the external SRAM */ | 1686 | * can talk to the external SRAM */ |
1691 | (void) falcon_init_nic(efx); | 1687 | falcon_init_nic(efx); |
1692 | rc = -EIO; | 1688 | rc = -EIO; |
1693 | goto fail4; | 1689 | goto fail4; |
1694 | } | 1690 | } |
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index b57cc68058c0..d3f749c72d41 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -116,17 +116,8 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold"); | |||
116 | ************************************************************************** | 116 | ************************************************************************** |
117 | */ | 117 | */ |
118 | 118 | ||
119 | /* DMA address mask (up to 46-bit, avoiding compiler warnings) | 119 | /* DMA address mask */ |
120 | * | 120 | #define FALCON_DMA_MASK DMA_BIT_MASK(46) |
121 | * Note that it is possible to have a platform with 64-bit longs and | ||
122 | * 32-bit DMA addresses, or vice versa. EFX_DMA_MASK takes care of the | ||
123 | * platform DMA mask. | ||
124 | */ | ||
125 | #if BITS_PER_LONG == 64 | ||
126 | #define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffUL) | ||
127 | #else | ||
128 | #define FALCON_DMA_MASK EFX_DMA_MASK(0x00003fffffffffffULL) | ||
129 | #endif | ||
130 | 121 | ||
131 | /* TX DMA length mask (13-bit) */ | 122 | /* TX DMA length mask (13-bit) */ |
132 | #define FALCON_TX_DMA_MASK (4096 - 1) | 123 | #define FALCON_TX_DMA_MASK (4096 - 1) |
@@ -145,7 +136,7 @@ MODULE_PARM_DESC(rx_xon_thresh_bytes, "RX fifo XON threshold"); | |||
145 | #define PCI_EXP_LNKSTA_LNK_WID_LBN 4 | 136 | #define PCI_EXP_LNKSTA_LNK_WID_LBN 4 |
146 | 137 | ||
147 | #define FALCON_IS_DUAL_FUNC(efx) \ | 138 | #define FALCON_IS_DUAL_FUNC(efx) \ |
148 | (FALCON_REV(efx) < FALCON_REV_B0) | 139 | (falcon_rev(efx) < FALCON_REV_B0) |
149 | 140 | ||
150 | /************************************************************************** | 141 | /************************************************************************** |
151 | * | 142 | * |
@@ -465,7 +456,7 @@ int falcon_init_tx(struct efx_tx_queue *tx_queue) | |||
465 | TX_DESCQ_TYPE, 0, | 456 | TX_DESCQ_TYPE, 0, |
466 | TX_NON_IP_DROP_DIS_B0, 1); | 457 | TX_NON_IP_DROP_DIS_B0, 1); |
467 | 458 | ||
468 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 459 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
469 | int csum = !(efx->net_dev->features & NETIF_F_IP_CSUM); | 460 | int csum = !(efx->net_dev->features & NETIF_F_IP_CSUM); |
470 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_IP_CHKSM_DIS_B0, csum); | 461 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_IP_CHKSM_DIS_B0, csum); |
471 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_TCP_CHKSM_DIS_B0, csum); | 462 | EFX_SET_OWORD_FIELD(tx_desc_ptr, TX_TCP_CHKSM_DIS_B0, csum); |
@@ -474,7 +465,7 @@ int falcon_init_tx(struct efx_tx_queue *tx_queue) | |||
474 | falcon_write_table(efx, &tx_desc_ptr, efx->type->txd_ptr_tbl_base, | 465 | falcon_write_table(efx, &tx_desc_ptr, efx->type->txd_ptr_tbl_base, |
475 | tx_queue->queue); | 466 | tx_queue->queue); |
476 | 467 | ||
477 | if (FALCON_REV(efx) < FALCON_REV_B0) { | 468 | if (falcon_rev(efx) < FALCON_REV_B0) { |
478 | efx_oword_t reg; | 469 | efx_oword_t reg; |
479 | 470 | ||
480 | BUG_ON(tx_queue->queue >= 128); /* HW limit */ | 471 | BUG_ON(tx_queue->queue >= 128); /* HW limit */ |
@@ -635,7 +626,7 @@ int falcon_init_rx(struct efx_rx_queue *rx_queue) | |||
635 | efx_oword_t rx_desc_ptr; | 626 | efx_oword_t rx_desc_ptr; |
636 | struct efx_nic *efx = rx_queue->efx; | 627 | struct efx_nic *efx = rx_queue->efx; |
637 | int rc; | 628 | int rc; |
638 | int is_b0 = FALCON_REV(efx) >= FALCON_REV_B0; | 629 | int is_b0 = falcon_rev(efx) >= FALCON_REV_B0; |
639 | int iscsi_digest_en = is_b0; | 630 | int iscsi_digest_en = is_b0; |
640 | 631 | ||
641 | EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n", | 632 | EFX_LOG(efx, "RX queue %d ring in special buffers %d-%d\n", |
@@ -822,10 +813,10 @@ static inline void falcon_handle_tx_event(struct efx_channel *channel, | |||
822 | tx_ev_q_label = EFX_QWORD_FIELD(*event, TX_EV_Q_LABEL); | 813 | tx_ev_q_label = EFX_QWORD_FIELD(*event, TX_EV_Q_LABEL); |
823 | tx_queue = &efx->tx_queue[tx_ev_q_label]; | 814 | tx_queue = &efx->tx_queue[tx_ev_q_label]; |
824 | 815 | ||
825 | if (NET_DEV_REGISTERED(efx)) | 816 | if (efx_dev_registered(efx)) |
826 | netif_tx_lock(efx->net_dev); | 817 | netif_tx_lock(efx->net_dev); |
827 | falcon_notify_tx_desc(tx_queue); | 818 | falcon_notify_tx_desc(tx_queue); |
828 | if (NET_DEV_REGISTERED(efx)) | 819 | if (efx_dev_registered(efx)) |
829 | netif_tx_unlock(efx->net_dev); | 820 | netif_tx_unlock(efx->net_dev); |
830 | } else if (EFX_QWORD_FIELD(*event, TX_EV_PKT_ERR) && | 821 | } else if (EFX_QWORD_FIELD(*event, TX_EV_PKT_ERR) && |
831 | EFX_WORKAROUND_10727(efx)) { | 822 | EFX_WORKAROUND_10727(efx)) { |
@@ -884,7 +875,7 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue, | |||
884 | RX_EV_TCP_UDP_CHKSUM_ERR); | 875 | RX_EV_TCP_UDP_CHKSUM_ERR); |
885 | rx_ev_eth_crc_err = EFX_QWORD_FIELD(*event, RX_EV_ETH_CRC_ERR); | 876 | rx_ev_eth_crc_err = EFX_QWORD_FIELD(*event, RX_EV_ETH_CRC_ERR); |
886 | rx_ev_frm_trunc = EFX_QWORD_FIELD(*event, RX_EV_FRM_TRUNC); | 877 | rx_ev_frm_trunc = EFX_QWORD_FIELD(*event, RX_EV_FRM_TRUNC); |
887 | rx_ev_drib_nib = ((FALCON_REV(efx) >= FALCON_REV_B0) ? | 878 | rx_ev_drib_nib = ((falcon_rev(efx) >= FALCON_REV_B0) ? |
888 | 0 : EFX_QWORD_FIELD(*event, RX_EV_DRIB_NIB)); | 879 | 0 : EFX_QWORD_FIELD(*event, RX_EV_DRIB_NIB)); |
889 | rx_ev_pause_frm = EFX_QWORD_FIELD(*event, RX_EV_PAUSE_FRM_ERR); | 880 | rx_ev_pause_frm = EFX_QWORD_FIELD(*event, RX_EV_PAUSE_FRM_ERR); |
890 | 881 | ||
@@ -1065,7 +1056,7 @@ static void falcon_handle_global_event(struct efx_channel *channel, | |||
1065 | EFX_QWORD_FIELD(*event, XG_PHY_INTR)) | 1056 | EFX_QWORD_FIELD(*event, XG_PHY_INTR)) |
1066 | is_phy_event = 1; | 1057 | is_phy_event = 1; |
1067 | 1058 | ||
1068 | if ((FALCON_REV(efx) >= FALCON_REV_B0) && | 1059 | if ((falcon_rev(efx) >= FALCON_REV_B0) && |
1069 | EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0)) | 1060 | EFX_OWORD_FIELD(*event, XG_MNT_INTR_B0)) |
1070 | is_phy_event = 1; | 1061 | is_phy_event = 1; |
1071 | 1062 | ||
@@ -1405,7 +1396,7 @@ static inline void falcon_irq_ack_a1(struct efx_nic *efx) | |||
1405 | static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx) | 1396 | static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx) |
1406 | { | 1397 | { |
1407 | struct falcon_nic_data *nic_data = efx->nic_data; | 1398 | struct falcon_nic_data *nic_data = efx->nic_data; |
1408 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1399 | efx_oword_t *int_ker = efx->irq_status.addr; |
1409 | efx_oword_t fatal_intr; | 1400 | efx_oword_t fatal_intr; |
1410 | int error, mem_perr; | 1401 | int error, mem_perr; |
1411 | static int n_int_errors; | 1402 | static int n_int_errors; |
@@ -1451,8 +1442,8 @@ out: | |||
1451 | */ | 1442 | */ |
1452 | static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) | 1443 | static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) |
1453 | { | 1444 | { |
1454 | struct efx_nic *efx = (struct efx_nic *)dev_id; | 1445 | struct efx_nic *efx = dev_id; |
1455 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1446 | efx_oword_t *int_ker = efx->irq_status.addr; |
1456 | struct efx_channel *channel; | 1447 | struct efx_channel *channel; |
1457 | efx_dword_t reg; | 1448 | efx_dword_t reg; |
1458 | u32 queues; | 1449 | u32 queues; |
@@ -1489,8 +1480,8 @@ static irqreturn_t falcon_legacy_interrupt_b0(int irq, void *dev_id) | |||
1489 | 1480 | ||
1490 | static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) | 1481 | static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) |
1491 | { | 1482 | { |
1492 | struct efx_nic *efx = (struct efx_nic *)dev_id; | 1483 | struct efx_nic *efx = dev_id; |
1493 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1484 | efx_oword_t *int_ker = efx->irq_status.addr; |
1494 | struct efx_channel *channel; | 1485 | struct efx_channel *channel; |
1495 | int syserr; | 1486 | int syserr; |
1496 | int queues; | 1487 | int queues; |
@@ -1542,9 +1533,9 @@ static irqreturn_t falcon_legacy_interrupt_a1(int irq, void *dev_id) | |||
1542 | */ | 1533 | */ |
1543 | static irqreturn_t falcon_msi_interrupt(int irq, void *dev_id) | 1534 | static irqreturn_t falcon_msi_interrupt(int irq, void *dev_id) |
1544 | { | 1535 | { |
1545 | struct efx_channel *channel = (struct efx_channel *)dev_id; | 1536 | struct efx_channel *channel = dev_id; |
1546 | struct efx_nic *efx = channel->efx; | 1537 | struct efx_nic *efx = channel->efx; |
1547 | efx_oword_t *int_ker = (efx_oword_t *) efx->irq_status.addr; | 1538 | efx_oword_t *int_ker = efx->irq_status.addr; |
1548 | int syserr; | 1539 | int syserr; |
1549 | 1540 | ||
1550 | efx->last_irq_cpu = raw_smp_processor_id(); | 1541 | efx->last_irq_cpu = raw_smp_processor_id(); |
@@ -1572,7 +1563,7 @@ static void falcon_setup_rss_indir_table(struct efx_nic *efx) | |||
1572 | unsigned long offset; | 1563 | unsigned long offset; |
1573 | efx_dword_t dword; | 1564 | efx_dword_t dword; |
1574 | 1565 | ||
1575 | if (FALCON_REV(efx) < FALCON_REV_B0) | 1566 | if (falcon_rev(efx) < FALCON_REV_B0) |
1576 | return; | 1567 | return; |
1577 | 1568 | ||
1578 | for (offset = RX_RSS_INDIR_TBL_B0; | 1569 | for (offset = RX_RSS_INDIR_TBL_B0; |
@@ -1595,7 +1586,7 @@ int falcon_init_interrupt(struct efx_nic *efx) | |||
1595 | 1586 | ||
1596 | if (!EFX_INT_MODE_USE_MSI(efx)) { | 1587 | if (!EFX_INT_MODE_USE_MSI(efx)) { |
1597 | irq_handler_t handler; | 1588 | irq_handler_t handler; |
1598 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 1589 | if (falcon_rev(efx) >= FALCON_REV_B0) |
1599 | handler = falcon_legacy_interrupt_b0; | 1590 | handler = falcon_legacy_interrupt_b0; |
1600 | else | 1591 | else |
1601 | handler = falcon_legacy_interrupt_a1; | 1592 | handler = falcon_legacy_interrupt_a1; |
@@ -1636,12 +1627,13 @@ void falcon_fini_interrupt(struct efx_nic *efx) | |||
1636 | efx_oword_t reg; | 1627 | efx_oword_t reg; |
1637 | 1628 | ||
1638 | /* Disable MSI/MSI-X interrupts */ | 1629 | /* Disable MSI/MSI-X interrupts */ |
1639 | efx_for_each_channel_with_interrupt(channel, efx) | 1630 | efx_for_each_channel_with_interrupt(channel, efx) { |
1640 | if (channel->irq) | 1631 | if (channel->irq) |
1641 | free_irq(channel->irq, channel); | 1632 | free_irq(channel->irq, channel); |
1633 | } | ||
1642 | 1634 | ||
1643 | /* ACK legacy interrupt */ | 1635 | /* ACK legacy interrupt */ |
1644 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 1636 | if (falcon_rev(efx) >= FALCON_REV_B0) |
1645 | falcon_read(efx, ®, INT_ISR0_B0); | 1637 | falcon_read(efx, ®, INT_ISR0_B0); |
1646 | else | 1638 | else |
1647 | falcon_irq_ack_a1(efx); | 1639 | falcon_irq_ack_a1(efx); |
@@ -1732,7 +1724,7 @@ void falcon_drain_tx_fifo(struct efx_nic *efx) | |||
1732 | efx_oword_t temp; | 1724 | efx_oword_t temp; |
1733 | int count; | 1725 | int count; |
1734 | 1726 | ||
1735 | if ((FALCON_REV(efx) < FALCON_REV_B0) || | 1727 | if ((falcon_rev(efx) < FALCON_REV_B0) || |
1736 | (efx->loopback_mode != LOOPBACK_NONE)) | 1728 | (efx->loopback_mode != LOOPBACK_NONE)) |
1737 | return; | 1729 | return; |
1738 | 1730 | ||
@@ -1785,7 +1777,7 @@ void falcon_deconfigure_mac_wrapper(struct efx_nic *efx) | |||
1785 | { | 1777 | { |
1786 | efx_oword_t temp; | 1778 | efx_oword_t temp; |
1787 | 1779 | ||
1788 | if (FALCON_REV(efx) < FALCON_REV_B0) | 1780 | if (falcon_rev(efx) < FALCON_REV_B0) |
1789 | return; | 1781 | return; |
1790 | 1782 | ||
1791 | /* Isolate the MAC -> RX */ | 1783 | /* Isolate the MAC -> RX */ |
@@ -1823,7 +1815,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1823 | MAC_SPEED, link_speed); | 1815 | MAC_SPEED, link_speed); |
1824 | /* On B0, MAC backpressure can be disabled and packets get | 1816 | /* On B0, MAC backpressure can be disabled and packets get |
1825 | * discarded. */ | 1817 | * discarded. */ |
1826 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 1818 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
1827 | EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, | 1819 | EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, |
1828 | !efx->link_up); | 1820 | !efx->link_up); |
1829 | } | 1821 | } |
@@ -1841,7 +1833,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1841 | EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc); | 1833 | EFX_SET_OWORD_FIELD_VER(efx, reg, RX_XOFF_MAC_EN, tx_fc); |
1842 | 1834 | ||
1843 | /* Unisolate the MAC -> RX */ | 1835 | /* Unisolate the MAC -> RX */ |
1844 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 1836 | if (falcon_rev(efx) >= FALCON_REV_B0) |
1845 | EFX_SET_OWORD_FIELD(reg, RX_INGR_EN_B0, 1); | 1837 | EFX_SET_OWORD_FIELD(reg, RX_INGR_EN_B0, 1); |
1846 | falcon_write(efx, ®, RX_CFG_REG_KER); | 1838 | falcon_write(efx, ®, RX_CFG_REG_KER); |
1847 | } | 1839 | } |
@@ -1856,7 +1848,7 @@ int falcon_dma_stats(struct efx_nic *efx, unsigned int done_offset) | |||
1856 | return 0; | 1848 | return 0; |
1857 | 1849 | ||
1858 | /* Statistics fetch will fail if the MAC is in TX drain */ | 1850 | /* Statistics fetch will fail if the MAC is in TX drain */ |
1859 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 1851 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
1860 | efx_oword_t temp; | 1852 | efx_oword_t temp; |
1861 | falcon_read(efx, &temp, MAC0_CTRL_REG_KER); | 1853 | falcon_read(efx, &temp, MAC0_CTRL_REG_KER); |
1862 | if (EFX_OWORD_FIELD(temp, TXFIFO_DRAIN_EN_B0)) | 1854 | if (EFX_OWORD_FIELD(temp, TXFIFO_DRAIN_EN_B0)) |
@@ -1940,7 +1932,7 @@ static int falcon_gmii_wait(struct efx_nic *efx) | |||
1940 | static void falcon_mdio_write(struct net_device *net_dev, int phy_id, | 1932 | static void falcon_mdio_write(struct net_device *net_dev, int phy_id, |
1941 | int addr, int value) | 1933 | int addr, int value) |
1942 | { | 1934 | { |
1943 | struct efx_nic *efx = (struct efx_nic *)net_dev->priv; | 1935 | struct efx_nic *efx = net_dev->priv; |
1944 | unsigned int phy_id2 = phy_id & FALCON_PHY_ID_ID_MASK; | 1936 | unsigned int phy_id2 = phy_id & FALCON_PHY_ID_ID_MASK; |
1945 | efx_oword_t reg; | 1937 | efx_oword_t reg; |
1946 | 1938 | ||
@@ -2008,7 +2000,7 @@ static void falcon_mdio_write(struct net_device *net_dev, int phy_id, | |||
2008 | * could be read, -1 will be returned. */ | 2000 | * could be read, -1 will be returned. */ |
2009 | static int falcon_mdio_read(struct net_device *net_dev, int phy_id, int addr) | 2001 | static int falcon_mdio_read(struct net_device *net_dev, int phy_id, int addr) |
2010 | { | 2002 | { |
2011 | struct efx_nic *efx = (struct efx_nic *)net_dev->priv; | 2003 | struct efx_nic *efx = net_dev->priv; |
2012 | unsigned int phy_addr = phy_id & FALCON_PHY_ID_ID_MASK; | 2004 | unsigned int phy_addr = phy_id & FALCON_PHY_ID_ID_MASK; |
2013 | efx_oword_t reg; | 2005 | efx_oword_t reg; |
2014 | int value = -1; | 2006 | int value = -1; |
@@ -2113,7 +2105,7 @@ int falcon_probe_port(struct efx_nic *efx) | |||
2113 | falcon_init_mdio(&efx->mii); | 2105 | falcon_init_mdio(&efx->mii); |
2114 | 2106 | ||
2115 | /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */ | 2107 | /* Hardware flow ctrl. FalconA RX FIFO too small for pause generation */ |
2116 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 2108 | if (falcon_rev(efx) >= FALCON_REV_B0) |
2117 | efx->flow_control = EFX_FC_RX | EFX_FC_TX; | 2109 | efx->flow_control = EFX_FC_RX | EFX_FC_TX; |
2118 | else | 2110 | else |
2119 | efx->flow_control = EFX_FC_RX; | 2111 | efx->flow_control = EFX_FC_RX; |
@@ -2373,7 +2365,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx) | |||
2373 | return -ENODEV; | 2365 | return -ENODEV; |
2374 | } | 2366 | } |
2375 | 2367 | ||
2376 | switch (FALCON_REV(efx)) { | 2368 | switch (falcon_rev(efx)) { |
2377 | case FALCON_REV_A0: | 2369 | case FALCON_REV_A0: |
2378 | case 0xff: | 2370 | case 0xff: |
2379 | EFX_ERR(efx, "Falcon rev A0 not supported\n"); | 2371 | EFX_ERR(efx, "Falcon rev A0 not supported\n"); |
@@ -2399,7 +2391,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx) | |||
2399 | break; | 2391 | break; |
2400 | 2392 | ||
2401 | default: | 2393 | default: |
2402 | EFX_ERR(efx, "Unknown Falcon rev %d\n", FALCON_REV(efx)); | 2394 | EFX_ERR(efx, "Unknown Falcon rev %d\n", falcon_rev(efx)); |
2403 | return -ENODEV; | 2395 | return -ENODEV; |
2404 | } | 2396 | } |
2405 | 2397 | ||
@@ -2419,7 +2411,7 @@ int falcon_probe_nic(struct efx_nic *efx) | |||
2419 | 2411 | ||
2420 | /* Allocate storage for hardware specific data */ | 2412 | /* Allocate storage for hardware specific data */ |
2421 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); | 2413 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); |
2422 | efx->nic_data = (void *) nic_data; | 2414 | efx->nic_data = nic_data; |
2423 | 2415 | ||
2424 | /* Determine number of ports etc. */ | 2416 | /* Determine number of ports etc. */ |
2425 | rc = falcon_probe_nic_variant(efx); | 2417 | rc = falcon_probe_nic_variant(efx); |
@@ -2489,13 +2481,10 @@ int falcon_probe_nic(struct efx_nic *efx) | |||
2489 | */ | 2481 | */ |
2490 | int falcon_init_nic(struct efx_nic *efx) | 2482 | int falcon_init_nic(struct efx_nic *efx) |
2491 | { | 2483 | { |
2492 | struct falcon_nic_data *data; | ||
2493 | efx_oword_t temp; | 2484 | efx_oword_t temp; |
2494 | unsigned thresh; | 2485 | unsigned thresh; |
2495 | int rc; | 2486 | int rc; |
2496 | 2487 | ||
2497 | data = (struct falcon_nic_data *)efx->nic_data; | ||
2498 | |||
2499 | /* Set up the address region register. This is only needed | 2488 | /* Set up the address region register. This is only needed |
2500 | * for the B0 FPGA, but since we are just pushing in the | 2489 | * for the B0 FPGA, but since we are just pushing in the |
2501 | * reset defaults this may as well be unconditional. */ | 2490 | * reset defaults this may as well be unconditional. */ |
@@ -2562,7 +2551,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2562 | 2551 | ||
2563 | /* Set number of RSS queues for receive path. */ | 2552 | /* Set number of RSS queues for receive path. */ |
2564 | falcon_read(efx, &temp, RX_FILTER_CTL_REG); | 2553 | falcon_read(efx, &temp, RX_FILTER_CTL_REG); |
2565 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 2554 | if (falcon_rev(efx) >= FALCON_REV_B0) |
2566 | EFX_SET_OWORD_FIELD(temp, NUM_KER, 0); | 2555 | EFX_SET_OWORD_FIELD(temp, NUM_KER, 0); |
2567 | else | 2556 | else |
2568 | EFX_SET_OWORD_FIELD(temp, NUM_KER, efx->rss_queues - 1); | 2557 | EFX_SET_OWORD_FIELD(temp, NUM_KER, efx->rss_queues - 1); |
@@ -2600,7 +2589,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2600 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ | 2589 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ |
2601 | EFX_SET_OWORD_FIELD(temp, TX_PREF_THRESHOLD, 2); | 2590 | EFX_SET_OWORD_FIELD(temp, TX_PREF_THRESHOLD, 2); |
2602 | /* Squash TX of packets of 16 bytes or less */ | 2591 | /* Squash TX of packets of 16 bytes or less */ |
2603 | if (FALCON_REV(efx) >= FALCON_REV_B0 && EFX_WORKAROUND_9141(efx)) | 2592 | if (falcon_rev(efx) >= FALCON_REV_B0 && EFX_WORKAROUND_9141(efx)) |
2604 | EFX_SET_OWORD_FIELD(temp, TX_FLUSH_MIN_LEN_EN_B0, 1); | 2593 | EFX_SET_OWORD_FIELD(temp, TX_FLUSH_MIN_LEN_EN_B0, 1); |
2605 | falcon_write(efx, &temp, TX_CFG2_REG_KER); | 2594 | falcon_write(efx, &temp, TX_CFG2_REG_KER); |
2606 | 2595 | ||
@@ -2617,7 +2606,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2617 | if (EFX_WORKAROUND_7575(efx)) | 2606 | if (EFX_WORKAROUND_7575(efx)) |
2618 | EFX_SET_OWORD_FIELD_VER(efx, temp, RX_USR_BUF_SIZE, | 2607 | EFX_SET_OWORD_FIELD_VER(efx, temp, RX_USR_BUF_SIZE, |
2619 | (3 * 4096) / 32); | 2608 | (3 * 4096) / 32); |
2620 | if (FALCON_REV(efx) >= FALCON_REV_B0) | 2609 | if (falcon_rev(efx) >= FALCON_REV_B0) |
2621 | EFX_SET_OWORD_FIELD(temp, RX_INGR_EN_B0, 1); | 2610 | EFX_SET_OWORD_FIELD(temp, RX_INGR_EN_B0, 1); |
2622 | 2611 | ||
2623 | /* RX FIFO flow control thresholds */ | 2612 | /* RX FIFO flow control thresholds */ |
@@ -2633,7 +2622,7 @@ int falcon_init_nic(struct efx_nic *efx) | |||
2633 | falcon_write(efx, &temp, RX_CFG_REG_KER); | 2622 | falcon_write(efx, &temp, RX_CFG_REG_KER); |
2634 | 2623 | ||
2635 | /* Set destination of both TX and RX Flush events */ | 2624 | /* Set destination of both TX and RX Flush events */ |
2636 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 2625 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
2637 | EFX_POPULATE_OWORD_1(temp, FLS_EVQ_ID, 0); | 2626 | EFX_POPULATE_OWORD_1(temp, FLS_EVQ_ID, 0); |
2638 | falcon_write(efx, &temp, DP_CTRL_REG); | 2627 | falcon_write(efx, &temp, DP_CTRL_REG); |
2639 | } | 2628 | } |
@@ -2647,7 +2636,7 @@ void falcon_remove_nic(struct efx_nic *efx) | |||
2647 | 2636 | ||
2648 | falcon_free_buffer(efx, &efx->irq_status); | 2637 | falcon_free_buffer(efx, &efx->irq_status); |
2649 | 2638 | ||
2650 | (void) falcon_reset_hw(efx, RESET_TYPE_ALL); | 2639 | falcon_reset_hw(efx, RESET_TYPE_ALL); |
2651 | 2640 | ||
2652 | /* Release the second function after the reset */ | 2641 | /* Release the second function after the reset */ |
2653 | if (nic_data->pci_dev2) { | 2642 | if (nic_data->pci_dev2) { |
diff --git a/drivers/net/sfc/falcon.h b/drivers/net/sfc/falcon.h index 6117403b0c03..492f9bc28840 100644 --- a/drivers/net/sfc/falcon.h +++ b/drivers/net/sfc/falcon.h | |||
@@ -23,7 +23,10 @@ enum falcon_revision { | |||
23 | FALCON_REV_B0 = 2, | 23 | FALCON_REV_B0 = 2, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #define FALCON_REV(efx) ((efx)->pci_dev->revision) | 26 | static inline int falcon_rev(struct efx_nic *efx) |
27 | { | ||
28 | return efx->pci_dev->revision; | ||
29 | } | ||
27 | 30 | ||
28 | extern struct efx_nic_type falcon_a_nic_type; | 31 | extern struct efx_nic_type falcon_a_nic_type; |
29 | extern struct efx_nic_type falcon_b_nic_type; | 32 | extern struct efx_nic_type falcon_b_nic_type; |
diff --git a/drivers/net/sfc/falcon_hwdefs.h b/drivers/net/sfc/falcon_hwdefs.h index 06e2d68fc3d1..6d003114eeab 100644 --- a/drivers/net/sfc/falcon_hwdefs.h +++ b/drivers/net/sfc/falcon_hwdefs.h | |||
@@ -1125,7 +1125,7 @@ struct falcon_nvconfig_board_v2 { | |||
1125 | u8 port1_phy_type; | 1125 | u8 port1_phy_type; |
1126 | __le16 asic_sub_revision; | 1126 | __le16 asic_sub_revision; |
1127 | __le16 board_revision; | 1127 | __le16 board_revision; |
1128 | } __attribute__ ((packed)); | 1128 | } __packed; |
1129 | 1129 | ||
1130 | #define NVCONFIG_BASE 0x300 | 1130 | #define NVCONFIG_BASE 0x300 |
1131 | #define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C | 1131 | #define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C |
@@ -1144,6 +1144,6 @@ struct falcon_nvconfig { | |||
1144 | __le16 board_struct_ver; | 1144 | __le16 board_struct_ver; |
1145 | __le16 board_checksum; | 1145 | __le16 board_checksum; |
1146 | struct falcon_nvconfig_board_v2 board_v2; | 1146 | struct falcon_nvconfig_board_v2 board_v2; |
1147 | } __attribute__ ((packed)); | 1147 | } __packed; |
1148 | 1148 | ||
1149 | #endif /* EFX_FALCON_HWDEFS_H */ | 1149 | #endif /* EFX_FALCON_HWDEFS_H */ |
diff --git a/drivers/net/sfc/falcon_io.h b/drivers/net/sfc/falcon_io.h index ea08184ddfa9..6670cdfc41ab 100644 --- a/drivers/net/sfc/falcon_io.h +++ b/drivers/net/sfc/falcon_io.h | |||
@@ -56,14 +56,27 @@ | |||
56 | #define FALCON_USE_QWORD_IO 1 | 56 | #define FALCON_USE_QWORD_IO 1 |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #define _falcon_writeq(efx, value, reg) \ | 59 | #ifdef FALCON_USE_QWORD_IO |
60 | __raw_writeq((__force u64) (value), (efx)->membase + (reg)) | 60 | static inline void _falcon_writeq(struct efx_nic *efx, __le64 value, |
61 | #define _falcon_writel(efx, value, reg) \ | 61 | unsigned int reg) |
62 | __raw_writel((__force u32) (value), (efx)->membase + (reg)) | 62 | { |
63 | #define _falcon_readq(efx, reg) \ | 63 | __raw_writeq((__force u64)value, efx->membase + reg); |
64 | ((__force __le64) __raw_readq((efx)->membase + (reg))) | 64 | } |
65 | #define _falcon_readl(efx, reg) \ | 65 | static inline __le64 _falcon_readq(struct efx_nic *efx, unsigned int reg) |
66 | ((__force __le32) __raw_readl((efx)->membase + (reg))) | 66 | { |
67 | return (__force __le64)__raw_readq(efx->membase + reg); | ||
68 | } | ||
69 | #endif | ||
70 | |||
71 | static inline void _falcon_writel(struct efx_nic *efx, __le32 value, | ||
72 | unsigned int reg) | ||
73 | { | ||
74 | __raw_writel((__force u32)value, efx->membase + reg); | ||
75 | } | ||
76 | static inline __le32 _falcon_readl(struct efx_nic *efx, unsigned int reg) | ||
77 | { | ||
78 | return (__force __le32)__raw_readl(efx->membase + reg); | ||
79 | } | ||
67 | 80 | ||
68 | /* Writes to a normal 16-byte Falcon register, locking as appropriate. */ | 81 | /* Writes to a normal 16-byte Falcon register, locking as appropriate. */ |
69 | static inline void falcon_write(struct efx_nic *efx, efx_oword_t *value, | 82 | static inline void falcon_write(struct efx_nic *efx, efx_oword_t *value, |
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index a74b7931a3c4..dbdcee4b0f8d 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -221,7 +221,7 @@ static int falcon_xgmii_status(struct efx_nic *efx) | |||
221 | { | 221 | { |
222 | efx_dword_t reg; | 222 | efx_dword_t reg; |
223 | 223 | ||
224 | if (FALCON_REV(efx) < FALCON_REV_B0) | 224 | if (falcon_rev(efx) < FALCON_REV_B0) |
225 | return 1; | 225 | return 1; |
226 | 226 | ||
227 | /* The ISR latches, so clear it and re-read */ | 227 | /* The ISR latches, so clear it and re-read */ |
@@ -241,7 +241,7 @@ static void falcon_mask_status_intr(struct efx_nic *efx, int enable) | |||
241 | { | 241 | { |
242 | efx_dword_t reg; | 242 | efx_dword_t reg; |
243 | 243 | ||
244 | if ((FALCON_REV(efx) < FALCON_REV_B0) || LOOPBACK_INTERNAL(efx)) | 244 | if ((falcon_rev(efx) < FALCON_REV_B0) || LOOPBACK_INTERNAL(efx)) |
245 | return; | 245 | return; |
246 | 246 | ||
247 | /* Flush the ISR */ | 247 | /* Flush the ISR */ |
@@ -454,7 +454,7 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx) | |||
454 | 454 | ||
455 | EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n", | 455 | EFX_LOG(efx, "%s Clobbering XAUI (%d tries left).\n", |
456 | __func__, tries); | 456 | __func__, tries); |
457 | (void) falcon_reset_xaui(efx); | 457 | falcon_reset_xaui(efx); |
458 | udelay(200); | 458 | udelay(200); |
459 | tries--; | 459 | tries--; |
460 | } | 460 | } |
@@ -572,7 +572,7 @@ int falcon_check_xmac(struct efx_nic *efx) | |||
572 | xaui_link_ok = falcon_xaui_link_ok(efx); | 572 | xaui_link_ok = falcon_xaui_link_ok(efx); |
573 | 573 | ||
574 | if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok) | 574 | if (EFX_WORKAROUND_5147(efx) && !xaui_link_ok) |
575 | (void) falcon_reset_xaui(efx); | 575 | falcon_reset_xaui(efx); |
576 | 576 | ||
577 | /* Call the PHY check_hw routine */ | 577 | /* Call the PHY check_hw routine */ |
578 | rc = efx->phy_op->check_hw(efx); | 578 | rc = efx->phy_op->check_hw(efx); |
@@ -639,7 +639,7 @@ int falcon_xmac_set_pause(struct efx_nic *efx, enum efx_fc_type flow_control) | |||
639 | reset = ((flow_control & EFX_FC_TX) && | 639 | reset = ((flow_control & EFX_FC_TX) && |
640 | !(efx->flow_control & EFX_FC_TX)); | 640 | !(efx->flow_control & EFX_FC_TX)); |
641 | if (EFX_WORKAROUND_11482(efx) && reset) { | 641 | if (EFX_WORKAROUND_11482(efx) && reset) { |
642 | if (FALCON_REV(efx) >= FALCON_REV_B0) { | 642 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
643 | /* Recover by resetting the EM block */ | 643 | /* Recover by resetting the EM block */ |
644 | if (efx->link_up) | 644 | if (efx->link_up) |
645 | falcon_drain_tx_fifo(efx); | 645 | falcon_drain_tx_fifo(efx); |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 59f261b4171f..5e20e7551dae 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -42,7 +42,7 @@ | |||
42 | #ifndef EFX_DRIVER_NAME | 42 | #ifndef EFX_DRIVER_NAME |
43 | #define EFX_DRIVER_NAME "sfc" | 43 | #define EFX_DRIVER_NAME "sfc" |
44 | #endif | 44 | #endif |
45 | #define EFX_DRIVER_VERSION "2.2.0136" | 45 | #define EFX_DRIVER_VERSION "2.2" |
46 | 46 | ||
47 | #ifdef EFX_ENABLE_DEBUG | 47 | #ifdef EFX_ENABLE_DEBUG |
48 | #define EFX_BUG_ON_PARANOID(x) BUG_ON(x) | 48 | #define EFX_BUG_ON_PARANOID(x) BUG_ON(x) |
@@ -52,28 +52,19 @@ | |||
52 | #define EFX_WARN_ON_PARANOID(x) do {} while (0) | 52 | #define EFX_WARN_ON_PARANOID(x) do {} while (0) |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #define NET_DEV_REGISTERED(efx) \ | ||
56 | ((efx)->net_dev->reg_state == NETREG_REGISTERED) | ||
57 | |||
58 | /* Include net device name in log messages if it has been registered. | ||
59 | * Use efx->name not efx->net_dev->name so that races with (un)registration | ||
60 | * are harmless. | ||
61 | */ | ||
62 | #define NET_DEV_NAME(efx) (NET_DEV_REGISTERED(efx) ? (efx)->name : "") | ||
63 | |||
64 | /* Un-rate-limited logging */ | 55 | /* Un-rate-limited logging */ |
65 | #define EFX_ERR(efx, fmt, args...) \ | 56 | #define EFX_ERR(efx, fmt, args...) \ |
66 | dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, NET_DEV_NAME(efx), ##args) | 57 | dev_err(&((efx)->pci_dev->dev), "ERR: %s " fmt, efx_dev_name(efx), ##args) |
67 | 58 | ||
68 | #define EFX_INFO(efx, fmt, args...) \ | 59 | #define EFX_INFO(efx, fmt, args...) \ |
69 | dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, NET_DEV_NAME(efx), ##args) | 60 | dev_info(&((efx)->pci_dev->dev), "INFO: %s " fmt, efx_dev_name(efx), ##args) |
70 | 61 | ||
71 | #ifdef EFX_ENABLE_DEBUG | 62 | #ifdef EFX_ENABLE_DEBUG |
72 | #define EFX_LOG(efx, fmt, args...) \ | 63 | #define EFX_LOG(efx, fmt, args...) \ |
73 | dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) | 64 | dev_info(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args) |
74 | #else | 65 | #else |
75 | #define EFX_LOG(efx, fmt, args...) \ | 66 | #define EFX_LOG(efx, fmt, args...) \ |
76 | dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, NET_DEV_NAME(efx), ##args) | 67 | dev_dbg(&((efx)->pci_dev->dev), "DBG: %s " fmt, efx_dev_name(efx), ##args) |
77 | #endif | 68 | #endif |
78 | 69 | ||
79 | #define EFX_TRACE(efx, fmt, args...) do {} while (0) | 70 | #define EFX_TRACE(efx, fmt, args...) do {} while (0) |
@@ -90,11 +81,6 @@ do {if (net_ratelimit()) EFX_INFO(efx, fmt, ##args); } while (0) | |||
90 | #define EFX_LOG_RL(efx, fmt, args...) \ | 81 | #define EFX_LOG_RL(efx, fmt, args...) \ |
91 | do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0) | 82 | do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0) |
92 | 83 | ||
93 | /* Kernel headers may redefine inline anyway */ | ||
94 | #ifndef inline | ||
95 | #define inline inline __attribute__ ((always_inline)) | ||
96 | #endif | ||
97 | |||
98 | /************************************************************************** | 84 | /************************************************************************** |
99 | * | 85 | * |
100 | * Efx data structures | 86 | * Efx data structures |
@@ -695,7 +681,7 @@ struct efx_nic { | |||
695 | struct workqueue_struct *workqueue; | 681 | struct workqueue_struct *workqueue; |
696 | struct work_struct reset_work; | 682 | struct work_struct reset_work; |
697 | struct delayed_work monitor_work; | 683 | struct delayed_work monitor_work; |
698 | unsigned long membase_phys; | 684 | resource_size_t membase_phys; |
699 | void __iomem *membase; | 685 | void __iomem *membase; |
700 | spinlock_t biu_lock; | 686 | spinlock_t biu_lock; |
701 | enum efx_int_mode interrupt_mode; | 687 | enum efx_int_mode interrupt_mode; |
@@ -719,7 +705,7 @@ struct efx_nic { | |||
719 | 705 | ||
720 | unsigned n_rx_nodesc_drop_cnt; | 706 | unsigned n_rx_nodesc_drop_cnt; |
721 | 707 | ||
722 | void *nic_data; | 708 | struct falcon_nic_data *nic_data; |
723 | 709 | ||
724 | struct mutex mac_lock; | 710 | struct mutex mac_lock; |
725 | int port_enabled; | 711 | int port_enabled; |
@@ -760,6 +746,20 @@ struct efx_nic { | |||
760 | void *loopback_selftest; | 746 | void *loopback_selftest; |
761 | }; | 747 | }; |
762 | 748 | ||
749 | static inline int efx_dev_registered(struct efx_nic *efx) | ||
750 | { | ||
751 | return efx->net_dev->reg_state == NETREG_REGISTERED; | ||
752 | } | ||
753 | |||
754 | /* Net device name, for inclusion in log messages if it has been registered. | ||
755 | * Use efx->name not efx->net_dev->name so that races with (un)registration | ||
756 | * are harmless. | ||
757 | */ | ||
758 | static inline const char *efx_dev_name(struct efx_nic *efx) | ||
759 | { | ||
760 | return efx_dev_registered(efx) ? efx->name : ""; | ||
761 | } | ||
762 | |||
763 | /** | 763 | /** |
764 | * struct efx_nic_type - Efx device type definition | 764 | * struct efx_nic_type - Efx device type definition |
765 | * @mem_bar: Memory BAR number | 765 | * @mem_bar: Memory BAR number |
@@ -795,7 +795,7 @@ struct efx_nic_type { | |||
795 | unsigned int txd_ring_mask; | 795 | unsigned int txd_ring_mask; |
796 | unsigned int rxd_ring_mask; | 796 | unsigned int rxd_ring_mask; |
797 | unsigned int evq_size; | 797 | unsigned int evq_size; |
798 | dma_addr_t max_dma_mask; | 798 | u64 max_dma_mask; |
799 | unsigned int tx_dma_mask; | 799 | unsigned int tx_dma_mask; |
800 | unsigned bug5391_mask; | 800 | unsigned bug5391_mask; |
801 | 801 | ||
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c index 670622373ddf..601b001437c0 100644 --- a/drivers/net/sfc/rx.c +++ b/drivers/net/sfc/rx.c | |||
@@ -86,14 +86,17 @@ static unsigned int rx_refill_limit = 95; | |||
86 | */ | 86 | */ |
87 | #define EFX_RXD_HEAD_ROOM 2 | 87 | #define EFX_RXD_HEAD_ROOM 2 |
88 | 88 | ||
89 | /* Macros for zero-order pages (potentially) containing multiple RX buffers */ | 89 | static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf) |
90 | #define RX_DATA_OFFSET(_data) \ | 90 | { |
91 | (((unsigned long) (_data)) & (PAGE_SIZE-1)) | 91 | /* Offset is always within one page, so we don't need to consider |
92 | #define RX_BUF_OFFSET(_rx_buf) \ | 92 | * the page order. |
93 | RX_DATA_OFFSET((_rx_buf)->data) | 93 | */ |
94 | 94 | return (__force unsigned long) buf->data & (PAGE_SIZE - 1); | |
95 | #define RX_PAGE_SIZE(_efx) \ | 95 | } |
96 | (PAGE_SIZE * (1u << (_efx)->rx_buffer_order)) | 96 | static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) |
97 | { | ||
98 | return PAGE_SIZE << efx->rx_buffer_order; | ||
99 | } | ||
97 | 100 | ||
98 | 101 | ||
99 | /************************************************************************** | 102 | /************************************************************************** |
@@ -106,7 +109,7 @@ static unsigned int rx_refill_limit = 95; | |||
106 | static int efx_lro_get_skb_hdr(struct sk_buff *skb, void **ip_hdr, | 109 | static int efx_lro_get_skb_hdr(struct sk_buff *skb, void **ip_hdr, |
107 | void **tcpudp_hdr, u64 *hdr_flags, void *priv) | 110 | void **tcpudp_hdr, u64 *hdr_flags, void *priv) |
108 | { | 111 | { |
109 | struct efx_channel *channel = (struct efx_channel *)priv; | 112 | struct efx_channel *channel = priv; |
110 | struct iphdr *iph; | 113 | struct iphdr *iph; |
111 | struct tcphdr *th; | 114 | struct tcphdr *th; |
112 | 115 | ||
@@ -131,12 +134,12 @@ static int efx_get_frag_hdr(struct skb_frag_struct *frag, void **mac_hdr, | |||
131 | void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags, | 134 | void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags, |
132 | void *priv) | 135 | void *priv) |
133 | { | 136 | { |
134 | struct efx_channel *channel = (struct efx_channel *)priv; | 137 | struct efx_channel *channel = priv; |
135 | struct ethhdr *eh; | 138 | struct ethhdr *eh; |
136 | struct iphdr *iph; | 139 | struct iphdr *iph; |
137 | 140 | ||
138 | /* We support EtherII and VLAN encapsulated IPv4 */ | 141 | /* We support EtherII and VLAN encapsulated IPv4 */ |
139 | eh = (struct ethhdr *)(page_address(frag->page) + frag->page_offset); | 142 | eh = page_address(frag->page) + frag->page_offset; |
140 | *mac_hdr = eh; | 143 | *mac_hdr = eh; |
141 | 144 | ||
142 | if (eh->h_proto == htons(ETH_P_IP)) { | 145 | if (eh->h_proto == htons(ETH_P_IP)) { |
@@ -269,7 +272,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, | |||
269 | return -ENOMEM; | 272 | return -ENOMEM; |
270 | 273 | ||
271 | dma_addr = pci_map_page(efx->pci_dev, rx_buf->page, | 274 | dma_addr = pci_map_page(efx->pci_dev, rx_buf->page, |
272 | 0, RX_PAGE_SIZE(efx), | 275 | 0, efx_rx_buf_size(efx), |
273 | PCI_DMA_FROMDEVICE); | 276 | PCI_DMA_FROMDEVICE); |
274 | 277 | ||
275 | if (unlikely(pci_dma_mapping_error(dma_addr))) { | 278 | if (unlikely(pci_dma_mapping_error(dma_addr))) { |
@@ -280,14 +283,14 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, | |||
280 | 283 | ||
281 | rx_queue->buf_page = rx_buf->page; | 284 | rx_queue->buf_page = rx_buf->page; |
282 | rx_queue->buf_dma_addr = dma_addr; | 285 | rx_queue->buf_dma_addr = dma_addr; |
283 | rx_queue->buf_data = ((char *) page_address(rx_buf->page) + | 286 | rx_queue->buf_data = (page_address(rx_buf->page) + |
284 | EFX_PAGE_IP_ALIGN); | 287 | EFX_PAGE_IP_ALIGN); |
285 | } | 288 | } |
286 | 289 | ||
287 | offset = RX_DATA_OFFSET(rx_queue->buf_data); | ||
288 | rx_buf->len = bytes; | 290 | rx_buf->len = bytes; |
289 | rx_buf->dma_addr = rx_queue->buf_dma_addr + offset; | ||
290 | rx_buf->data = rx_queue->buf_data; | 291 | rx_buf->data = rx_queue->buf_data; |
292 | offset = efx_rx_buf_offset(rx_buf); | ||
293 | rx_buf->dma_addr = rx_queue->buf_dma_addr + offset; | ||
291 | 294 | ||
292 | /* Try to pack multiple buffers per page */ | 295 | /* Try to pack multiple buffers per page */ |
293 | if (efx->rx_buffer_order == 0) { | 296 | if (efx->rx_buffer_order == 0) { |
@@ -295,7 +298,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, | |||
295 | rx_queue->buf_data += ((bytes + 0x1ff) & ~0x1ff); | 298 | rx_queue->buf_data += ((bytes + 0x1ff) & ~0x1ff); |
296 | offset += ((bytes + 0x1ff) & ~0x1ff); | 299 | offset += ((bytes + 0x1ff) & ~0x1ff); |
297 | 300 | ||
298 | space = RX_PAGE_SIZE(efx) - offset; | 301 | space = efx_rx_buf_size(efx) - offset; |
299 | if (space >= bytes) { | 302 | if (space >= bytes) { |
300 | /* Refs dropped on kernel releasing each skb */ | 303 | /* Refs dropped on kernel releasing each skb */ |
301 | get_page(rx_queue->buf_page); | 304 | get_page(rx_queue->buf_page); |
@@ -344,7 +347,8 @@ static inline void efx_unmap_rx_buffer(struct efx_nic *efx, | |||
344 | EFX_BUG_ON_PARANOID(rx_buf->skb); | 347 | EFX_BUG_ON_PARANOID(rx_buf->skb); |
345 | if (rx_buf->unmap_addr) { | 348 | if (rx_buf->unmap_addr) { |
346 | pci_unmap_page(efx->pci_dev, rx_buf->unmap_addr, | 349 | pci_unmap_page(efx->pci_dev, rx_buf->unmap_addr, |
347 | RX_PAGE_SIZE(efx), PCI_DMA_FROMDEVICE); | 350 | efx_rx_buf_size(efx), |
351 | PCI_DMA_FROMDEVICE); | ||
348 | rx_buf->unmap_addr = 0; | 352 | rx_buf->unmap_addr = 0; |
349 | } | 353 | } |
350 | } else if (likely(rx_buf->skb)) { | 354 | } else if (likely(rx_buf->skb)) { |
@@ -400,9 +404,10 @@ static int __efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, | |||
400 | return 0; | 404 | return 0; |
401 | 405 | ||
402 | /* Record minimum fill level */ | 406 | /* Record minimum fill level */ |
403 | if (unlikely(fill_level < rx_queue->min_fill)) | 407 | if (unlikely(fill_level < rx_queue->min_fill)) { |
404 | if (fill_level) | 408 | if (fill_level) |
405 | rx_queue->min_fill = fill_level; | 409 | rx_queue->min_fill = fill_level; |
410 | } | ||
406 | 411 | ||
407 | /* Acquire RX add lock. If this lock is contended, then a fast | 412 | /* Acquire RX add lock. If this lock is contended, then a fast |
408 | * fill must already be in progress (e.g. in the refill | 413 | * fill must already be in progress (e.g. in the refill |
@@ -552,7 +557,7 @@ static inline void efx_rx_packet_lro(struct efx_channel *channel, | |||
552 | struct skb_frag_struct frags; | 557 | struct skb_frag_struct frags; |
553 | 558 | ||
554 | frags.page = rx_buf->page; | 559 | frags.page = rx_buf->page; |
555 | frags.page_offset = RX_BUF_OFFSET(rx_buf); | 560 | frags.page_offset = efx_rx_buf_offset(rx_buf); |
556 | frags.size = rx_buf->len; | 561 | frags.size = rx_buf->len; |
557 | 562 | ||
558 | lro_receive_frags(lro_mgr, &frags, rx_buf->len, | 563 | lro_receive_frags(lro_mgr, &frags, rx_buf->len, |
@@ -597,7 +602,7 @@ static inline struct sk_buff *efx_rx_mk_skb(struct efx_rx_buffer *rx_buf, | |||
597 | if (unlikely(rx_buf->len > hdr_len)) { | 602 | if (unlikely(rx_buf->len > hdr_len)) { |
598 | struct skb_frag_struct *frag = skb_shinfo(skb)->frags; | 603 | struct skb_frag_struct *frag = skb_shinfo(skb)->frags; |
599 | frag->page = rx_buf->page; | 604 | frag->page = rx_buf->page; |
600 | frag->page_offset = RX_BUF_OFFSET(rx_buf) + hdr_len; | 605 | frag->page_offset = efx_rx_buf_offset(rx_buf) + hdr_len; |
601 | frag->size = skb->len - hdr_len; | 606 | frag->size = skb->len - hdr_len; |
602 | skb_shinfo(skb)->nr_frags = 1; | 607 | skb_shinfo(skb)->nr_frags = 1; |
603 | skb->data_len = frag->size; | 608 | skb->data_len = frag->size; |
@@ -851,7 +856,8 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue) | |||
851 | /* For a page that is part-way through splitting into RX buffers */ | 856 | /* For a page that is part-way through splitting into RX buffers */ |
852 | if (rx_queue->buf_page != NULL) { | 857 | if (rx_queue->buf_page != NULL) { |
853 | pci_unmap_page(rx_queue->efx->pci_dev, rx_queue->buf_dma_addr, | 858 | pci_unmap_page(rx_queue->efx->pci_dev, rx_queue->buf_dma_addr, |
854 | RX_PAGE_SIZE(rx_queue->efx), PCI_DMA_FROMDEVICE); | 859 | efx_rx_buf_size(rx_queue->efx), |
860 | PCI_DMA_FROMDEVICE); | ||
855 | __free_pages(rx_queue->buf_page, | 861 | __free_pages(rx_queue->buf_page, |
856 | rx_queue->efx->rx_buffer_order); | 862 | rx_queue->efx->rx_buffer_order); |
857 | rx_queue->buf_page = NULL; | 863 | rx_queue->buf_page = NULL; |
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index cbda15946e8f..3b2de9fe7f27 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -290,7 +290,7 @@ void efx_loopback_rx_packet(struct efx_nic *efx, | |||
290 | 290 | ||
291 | payload = &state->payload; | 291 | payload = &state->payload; |
292 | 292 | ||
293 | received = (struct efx_loopback_payload *)(char *) buf_ptr; | 293 | received = (struct efx_loopback_payload *) buf_ptr; |
294 | received->ip.saddr = payload->ip.saddr; | 294 | received->ip.saddr = payload->ip.saddr; |
295 | received->ip.check = payload->ip.check; | 295 | received->ip.check = payload->ip.check; |
296 | 296 | ||
@@ -424,10 +424,10 @@ static int efx_tx_loopback(struct efx_tx_queue *tx_queue) | |||
424 | * interrupt handler. */ | 424 | * interrupt handler. */ |
425 | smp_wmb(); | 425 | smp_wmb(); |
426 | 426 | ||
427 | if (NET_DEV_REGISTERED(efx)) | 427 | if (efx_dev_registered(efx)) |
428 | netif_tx_lock_bh(efx->net_dev); | 428 | netif_tx_lock_bh(efx->net_dev); |
429 | rc = efx_xmit(efx, tx_queue, skb); | 429 | rc = efx_xmit(efx, tx_queue, skb); |
430 | if (NET_DEV_REGISTERED(efx)) | 430 | if (efx_dev_registered(efx)) |
431 | netif_tx_unlock_bh(efx->net_dev); | 431 | netif_tx_unlock_bh(efx->net_dev); |
432 | 432 | ||
433 | if (rc != NETDEV_TX_OK) { | 433 | if (rc != NETDEV_TX_OK) { |
@@ -453,7 +453,7 @@ static int efx_rx_loopback(struct efx_tx_queue *tx_queue, | |||
453 | int tx_done = 0, rx_good, rx_bad; | 453 | int tx_done = 0, rx_good, rx_bad; |
454 | int i, rc = 0; | 454 | int i, rc = 0; |
455 | 455 | ||
456 | if (NET_DEV_REGISTERED(efx)) | 456 | if (efx_dev_registered(efx)) |
457 | netif_tx_lock_bh(efx->net_dev); | 457 | netif_tx_lock_bh(efx->net_dev); |
458 | 458 | ||
459 | /* Count the number of tx completions, and decrement the refcnt. Any | 459 | /* Count the number of tx completions, and decrement the refcnt. Any |
@@ -465,7 +465,7 @@ static int efx_rx_loopback(struct efx_tx_queue *tx_queue, | |||
465 | dev_kfree_skb_any(skb); | 465 | dev_kfree_skb_any(skb); |
466 | } | 466 | } |
467 | 467 | ||
468 | if (NET_DEV_REGISTERED(efx)) | 468 | if (efx_dev_registered(efx)) |
469 | netif_tx_unlock_bh(efx->net_dev); | 469 | netif_tx_unlock_bh(efx->net_dev); |
470 | 470 | ||
471 | /* Check TX completion and received packet counts */ | 471 | /* Check TX completion and received packet counts */ |
@@ -517,6 +517,8 @@ efx_test_loopback(struct efx_tx_queue *tx_queue, | |||
517 | state->packet_count = min(1 << (i << 2), state->packet_count); | 517 | state->packet_count = min(1 << (i << 2), state->packet_count); |
518 | state->skbs = kzalloc(sizeof(state->skbs[0]) * | 518 | state->skbs = kzalloc(sizeof(state->skbs[0]) * |
519 | state->packet_count, GFP_KERNEL); | 519 | state->packet_count, GFP_KERNEL); |
520 | if (!state->skbs) | ||
521 | return -ENOMEM; | ||
520 | state->flush = 0; | 522 | state->flush = 0; |
521 | 523 | ||
522 | EFX_LOG(efx, "TX queue %d testing %s loopback with %d " | 524 | EFX_LOG(efx, "TX queue %d testing %s loopback with %d " |
@@ -700,7 +702,7 @@ int efx_offline_test(struct efx_nic *efx, | |||
700 | * "flushing" so all inflight packets are dropped */ | 702 | * "flushing" so all inflight packets are dropped */ |
701 | BUG_ON(efx->loopback_selftest); | 703 | BUG_ON(efx->loopback_selftest); |
702 | state->flush = 1; | 704 | state->flush = 1; |
703 | efx->loopback_selftest = (void *)state; | 705 | efx->loopback_selftest = state; |
704 | 706 | ||
705 | rc = efx_test_loopbacks(efx, tests, loopback_modes); | 707 | rc = efx_test_loopbacks(efx, tests, loopback_modes); |
706 | 708 | ||
diff --git a/drivers/net/sfc/sfe4001.c b/drivers/net/sfc/sfe4001.c index 725d1a539c49..66a0d1442aba 100644 --- a/drivers/net/sfc/sfe4001.c +++ b/drivers/net/sfc/sfe4001.c | |||
@@ -116,18 +116,18 @@ void sfe4001_poweroff(struct efx_nic *efx) | |||
116 | 116 | ||
117 | /* Turn off all power rails */ | 117 | /* Turn off all power rails */ |
118 | out = 0xff; | 118 | out = 0xff; |
119 | (void) efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); | 119 | efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); |
120 | 120 | ||
121 | /* Disable port 1 outputs on IO expander */ | 121 | /* Disable port 1 outputs on IO expander */ |
122 | cfg = 0xff; | 122 | cfg = 0xff; |
123 | (void) efx_i2c_write(i2c, PCA9539, P1_CONFIG, &cfg, 1); | 123 | efx_i2c_write(i2c, PCA9539, P1_CONFIG, &cfg, 1); |
124 | 124 | ||
125 | /* Disable port 0 outputs on IO expander */ | 125 | /* Disable port 0 outputs on IO expander */ |
126 | cfg = 0xff; | 126 | cfg = 0xff; |
127 | (void) efx_i2c_write(i2c, PCA9539, P0_CONFIG, &cfg, 1); | 127 | efx_i2c_write(i2c, PCA9539, P0_CONFIG, &cfg, 1); |
128 | 128 | ||
129 | /* Clear any over-temperature alert */ | 129 | /* Clear any over-temperature alert */ |
130 | (void) efx_i2c_read(i2c, MAX6647, RSL, &in, 1); | 130 | efx_i2c_read(i2c, MAX6647, RSL, &in, 1); |
131 | } | 131 | } |
132 | 132 | ||
133 | /* The P0_EN_3V3X line on SFE4001 boards (from A2 onward) is connected | 133 | /* The P0_EN_3V3X line on SFE4001 boards (from A2 onward) is connected |
@@ -253,14 +253,14 @@ done: | |||
253 | fail3: | 253 | fail3: |
254 | /* Turn off all power rails */ | 254 | /* Turn off all power rails */ |
255 | out = 0xff; | 255 | out = 0xff; |
256 | (void) efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); | 256 | efx_i2c_write(i2c, PCA9539, P0_OUT, &out, 1); |
257 | /* Disable port 1 outputs on IO expander */ | 257 | /* Disable port 1 outputs on IO expander */ |
258 | out = 0xff; | 258 | out = 0xff; |
259 | (void) efx_i2c_write(i2c, PCA9539, P1_CONFIG, &out, 1); | 259 | efx_i2c_write(i2c, PCA9539, P1_CONFIG, &out, 1); |
260 | fail2: | 260 | fail2: |
261 | /* Disable port 0 outputs on IO expander */ | 261 | /* Disable port 0 outputs on IO expander */ |
262 | out = 0xff; | 262 | out = 0xff; |
263 | (void) efx_i2c_write(i2c, PCA9539, P0_CONFIG, &out, 1); | 263 | efx_i2c_write(i2c, PCA9539, P0_CONFIG, &out, 1); |
264 | fail1: | 264 | fail1: |
265 | return rc; | 265 | return rc; |
266 | } | 266 | } |
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index b1cd6deec01f..c0146061c326 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -211,6 +211,8 @@ static int tenxpress_phy_init(struct efx_nic *efx) | |||
211 | int rc = 0; | 211 | int rc = 0; |
212 | 212 | ||
213 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | 213 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); |
214 | if (!phy_data) | ||
215 | return -ENOMEM; | ||
214 | efx->phy_data = phy_data; | 216 | efx->phy_data = phy_data; |
215 | 217 | ||
216 | tenxpress_set_state(efx, TENXPRESS_STATUS_NORMAL); | 218 | tenxpress_set_state(efx, TENXPRESS_STATUS_NORMAL); |
@@ -376,7 +378,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx) | |||
376 | * perform a special software reset */ | 378 | * perform a special software reset */ |
377 | if ((phy_data->tx_disabled && !efx->tx_disabled) || | 379 | if ((phy_data->tx_disabled && !efx->tx_disabled) || |
378 | loop_change) { | 380 | loop_change) { |
379 | (void) tenxpress_special_reset(efx); | 381 | tenxpress_special_reset(efx); |
380 | falcon_reset_xaui(efx); | 382 | falcon_reset_xaui(efx); |
381 | } | 383 | } |
382 | 384 | ||
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c index 9b436f5b4888..5cdd082ab8f6 100644 --- a/drivers/net/sfc/tx.c +++ b/drivers/net/sfc/tx.c | |||
@@ -387,7 +387,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) | |||
387 | if (unlikely(tx_queue->stopped)) { | 387 | if (unlikely(tx_queue->stopped)) { |
388 | fill_level = tx_queue->insert_count - tx_queue->read_count; | 388 | fill_level = tx_queue->insert_count - tx_queue->read_count; |
389 | if (fill_level < EFX_NETDEV_TX_THRESHOLD(tx_queue)) { | 389 | if (fill_level < EFX_NETDEV_TX_THRESHOLD(tx_queue)) { |
390 | EFX_BUG_ON_PARANOID(!NET_DEV_REGISTERED(efx)); | 390 | EFX_BUG_ON_PARANOID(!efx_dev_registered(efx)); |
391 | 391 | ||
392 | /* Do this under netif_tx_lock(), to avoid racing | 392 | /* Do this under netif_tx_lock(), to avoid racing |
393 | * with efx_xmit(). */ | 393 | * with efx_xmit(). */ |
@@ -639,11 +639,12 @@ static void efx_tsoh_block_free(struct efx_tx_queue *tx_queue, | |||
639 | base_dma = tsoh->dma_addr & PAGE_MASK; | 639 | base_dma = tsoh->dma_addr & PAGE_MASK; |
640 | 640 | ||
641 | p = &tx_queue->tso_headers_free; | 641 | p = &tx_queue->tso_headers_free; |
642 | while (*p != NULL) | 642 | while (*p != NULL) { |
643 | if (((unsigned long)*p & PAGE_MASK) == base_kva) | 643 | if (((unsigned long)*p & PAGE_MASK) == base_kva) |
644 | *p = (*p)->next; | 644 | *p = (*p)->next; |
645 | else | 645 | else |
646 | p = &(*p)->next; | 646 | p = &(*p)->next; |
647 | } | ||
647 | 648 | ||
648 | pci_free_consistent(pci_dev, PAGE_SIZE, (void *)base_kva, base_dma); | 649 | pci_free_consistent(pci_dev, PAGE_SIZE, (void *)base_kva, base_dma); |
649 | } | 650 | } |
@@ -939,9 +940,10 @@ static inline int tso_start_new_packet(struct efx_tx_queue *tx_queue, | |||
939 | 940 | ||
940 | /* Allocate a DMA-mapped header buffer. */ | 941 | /* Allocate a DMA-mapped header buffer. */ |
941 | if (likely(TSOH_SIZE(st->p.header_length) <= TSOH_STD_SIZE)) { | 942 | if (likely(TSOH_SIZE(st->p.header_length) <= TSOH_STD_SIZE)) { |
942 | if (tx_queue->tso_headers_free == NULL) | 943 | if (tx_queue->tso_headers_free == NULL) { |
943 | if (efx_tsoh_block_alloc(tx_queue)) | 944 | if (efx_tsoh_block_alloc(tx_queue)) |
944 | return -1; | 945 | return -1; |
946 | } | ||
945 | EFX_BUG_ON_PARANOID(!tx_queue->tso_headers_free); | 947 | EFX_BUG_ON_PARANOID(!tx_queue->tso_headers_free); |
946 | tsoh = tx_queue->tso_headers_free; | 948 | tsoh = tx_queue->tso_headers_free; |
947 | tx_queue->tso_headers_free = tsoh->next; | 949 | tx_queue->tso_headers_free = tsoh->next; |
@@ -1106,9 +1108,10 @@ static void efx_fini_tso(struct efx_tx_queue *tx_queue) | |||
1106 | { | 1108 | { |
1107 | unsigned i; | 1109 | unsigned i; |
1108 | 1110 | ||
1109 | if (tx_queue->buffer) | 1111 | if (tx_queue->buffer) { |
1110 | for (i = 0; i <= tx_queue->efx->type->txd_ring_mask; ++i) | 1112 | for (i = 0; i <= tx_queue->efx->type->txd_ring_mask; ++i) |
1111 | efx_tsoh_free(tx_queue, &tx_queue->buffer[i]); | 1113 | efx_tsoh_free(tx_queue, &tx_queue->buffer[i]); |
1114 | } | ||
1112 | 1115 | ||
1113 | while (tx_queue->tso_headers_free != NULL) | 1116 | while (tx_queue->tso_headers_free != NULL) |
1114 | efx_tsoh_block_free(tx_queue, tx_queue->tso_headers_free, | 1117 | efx_tsoh_block_free(tx_queue, tx_queue->tso_headers_free, |
diff --git a/drivers/net/sfc/workarounds.h b/drivers/net/sfc/workarounds.h index dca62f190198..35ab19c27f8d 100644 --- a/drivers/net/sfc/workarounds.h +++ b/drivers/net/sfc/workarounds.h | |||
@@ -16,7 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define EFX_WORKAROUND_ALWAYS(efx) 1 | 18 | #define EFX_WORKAROUND_ALWAYS(efx) 1 |
19 | #define EFX_WORKAROUND_FALCON_A(efx) (FALCON_REV(efx) <= FALCON_REV_A1) | 19 | #define EFX_WORKAROUND_FALCON_A(efx) (falcon_rev(efx) <= FALCON_REV_A1) |
20 | 20 | ||
21 | /* XAUI resets if link not detected */ | 21 | /* XAUI resets if link not detected */ |
22 | #define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS | 22 | #define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS |
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c index 3b9f9ddbc372..f3684ad28887 100644 --- a/drivers/net/sfc/xfp_phy.c +++ b/drivers/net/sfc/xfp_phy.c | |||
@@ -85,7 +85,9 @@ static int xfp_phy_init(struct efx_nic *efx) | |||
85 | int rc; | 85 | int rc; |
86 | 86 | ||
87 | phy_data = kzalloc(sizeof(struct xfp_phy_data), GFP_KERNEL); | 87 | phy_data = kzalloc(sizeof(struct xfp_phy_data), GFP_KERNEL); |
88 | efx->phy_data = (void *) phy_data; | 88 | if (!phy_data) |
89 | return -ENOMEM; | ||
90 | efx->phy_data = phy_data; | ||
89 | 91 | ||
90 | EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision" | 92 | EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision" |
91 | " %x)\n", devid, MDIO_ID_OUI(devid), MDIO_ID_MODEL(devid), | 93 | " %x)\n", devid, MDIO_ID_OUI(devid), MDIO_ID_MODEL(devid), |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index f226bcac7d17..3bb60530d4d7 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1159,17 +1159,9 @@ static int sky2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | #ifdef SKY2_VLAN_TAG_USED | 1161 | #ifdef SKY2_VLAN_TAG_USED |
1162 | static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | 1162 | static void sky2_set_vlan_mode(struct sky2_hw *hw, u16 port, bool onoff) |
1163 | { | 1163 | { |
1164 | struct sky2_port *sky2 = netdev_priv(dev); | 1164 | if (onoff) { |
1165 | struct sky2_hw *hw = sky2->hw; | ||
1166 | u16 port = sky2->port; | ||
1167 | |||
1168 | netif_tx_lock_bh(dev); | ||
1169 | napi_disable(&hw->napi); | ||
1170 | |||
1171 | sky2->vlgrp = grp; | ||
1172 | if (grp) { | ||
1173 | sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), | 1165 | sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), |
1174 | RX_VLAN_STRIP_ON); | 1166 | RX_VLAN_STRIP_ON); |
1175 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | 1167 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), |
@@ -1180,6 +1172,19 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp | |||
1180 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | 1172 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), |
1181 | TX_VLAN_TAG_OFF); | 1173 | TX_VLAN_TAG_OFF); |
1182 | } | 1174 | } |
1175 | } | ||
1176 | |||
1177 | static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | ||
1178 | { | ||
1179 | struct sky2_port *sky2 = netdev_priv(dev); | ||
1180 | struct sky2_hw *hw = sky2->hw; | ||
1181 | u16 port = sky2->port; | ||
1182 | |||
1183 | netif_tx_lock_bh(dev); | ||
1184 | napi_disable(&hw->napi); | ||
1185 | |||
1186 | sky2->vlgrp = grp; | ||
1187 | sky2_set_vlan_mode(hw, port, grp != NULL); | ||
1183 | 1188 | ||
1184 | sky2_read32(hw, B0_Y2_SP_LISR); | 1189 | sky2_read32(hw, B0_Y2_SP_LISR); |
1185 | napi_enable(&hw->napi); | 1190 | napi_enable(&hw->napi); |
@@ -1418,6 +1423,10 @@ static int sky2_up(struct net_device *dev) | |||
1418 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, | 1423 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, |
1419 | TX_RING_SIZE - 1); | 1424 | TX_RING_SIZE - 1); |
1420 | 1425 | ||
1426 | #ifdef SKY2_VLAN_TAG_USED | ||
1427 | sky2_set_vlan_mode(hw, port, sky2->vlgrp != NULL); | ||
1428 | #endif | ||
1429 | |||
1421 | err = sky2_rx_start(sky2); | 1430 | err = sky2_rx_start(sky2); |
1422 | if (err) | 1431 | if (err) |
1423 | goto err_out; | 1432 | goto err_out; |
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h index b880cba0f6fd..74cf8e1a181b 100644 --- a/drivers/net/tokenring/3c359.h +++ b/drivers/net/tokenring/3c359.h | |||
@@ -264,7 +264,7 @@ struct xl_private { | |||
264 | u16 asb; | 264 | u16 asb; |
265 | 265 | ||
266 | u8 __iomem *xl_mmio; | 266 | u8 __iomem *xl_mmio; |
267 | char *xl_card_name; | 267 | const char *xl_card_name; |
268 | struct pci_dev *pdev ; | 268 | struct pci_dev *pdev ; |
269 | 269 | ||
270 | spinlock_t xl_lock ; | 270 | spinlock_t xl_lock ; |
diff --git a/drivers/net/tokenring/olympic.h b/drivers/net/tokenring/olympic.h index c91956310fb2..10fbba08978f 100644 --- a/drivers/net/tokenring/olympic.h +++ b/drivers/net/tokenring/olympic.h | |||
@@ -254,7 +254,7 @@ struct olympic_private { | |||
254 | u8 __iomem *olympic_mmio; | 254 | u8 __iomem *olympic_mmio; |
255 | u8 __iomem *olympic_lap; | 255 | u8 __iomem *olympic_lap; |
256 | struct pci_dev *pdev ; | 256 | struct pci_dev *pdev ; |
257 | char *olympic_card_name ; | 257 | const char *olympic_card_name; |
258 | 258 | ||
259 | spinlock_t olympic_lock ; | 259 | spinlock_t olympic_lock ; |
260 | 260 | ||
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 2511ca7a12aa..e9e628621639 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -225,6 +225,9 @@ static void uli526x_set_filter_mode(struct net_device *); | |||
225 | static const struct ethtool_ops netdev_ethtool_ops; | 225 | static const struct ethtool_ops netdev_ethtool_ops; |
226 | static u16 read_srom_word(long, int); | 226 | static u16 read_srom_word(long, int); |
227 | static irqreturn_t uli526x_interrupt(int, void *); | 227 | static irqreturn_t uli526x_interrupt(int, void *); |
228 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
229 | static void uli526x_poll(struct net_device *dev); | ||
230 | #endif | ||
228 | static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); | 231 | static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); |
229 | static void allocate_rx_buffer(struct uli526x_board_info *); | 232 | static void allocate_rx_buffer(struct uli526x_board_info *); |
230 | static void update_cr6(u32, unsigned long); | 233 | static void update_cr6(u32, unsigned long); |
@@ -339,6 +342,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
339 | dev->get_stats = &uli526x_get_stats; | 342 | dev->get_stats = &uli526x_get_stats; |
340 | dev->set_multicast_list = &uli526x_set_filter_mode; | 343 | dev->set_multicast_list = &uli526x_set_filter_mode; |
341 | dev->ethtool_ops = &netdev_ethtool_ops; | 344 | dev->ethtool_ops = &netdev_ethtool_ops; |
345 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
346 | dev->poll_controller = &uli526x_poll; | ||
347 | #endif | ||
342 | spin_lock_init(&db->lock); | 348 | spin_lock_init(&db->lock); |
343 | 349 | ||
344 | 350 | ||
@@ -681,8 +687,9 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id) | |||
681 | db->cr5_data = inl(ioaddr + DCR5); | 687 | db->cr5_data = inl(ioaddr + DCR5); |
682 | outl(db->cr5_data, ioaddr + DCR5); | 688 | outl(db->cr5_data, ioaddr + DCR5); |
683 | if ( !(db->cr5_data & 0x180c1) ) { | 689 | if ( !(db->cr5_data & 0x180c1) ) { |
684 | spin_unlock_irqrestore(&db->lock, flags); | 690 | /* Restore CR7 to enable interrupt mask */ |
685 | outl(db->cr7_data, ioaddr + DCR7); | 691 | outl(db->cr7_data, ioaddr + DCR7); |
692 | spin_unlock_irqrestore(&db->lock, flags); | ||
686 | return IRQ_HANDLED; | 693 | return IRQ_HANDLED; |
687 | } | 694 | } |
688 | 695 | ||
@@ -715,6 +722,13 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id) | |||
715 | return IRQ_HANDLED; | 722 | return IRQ_HANDLED; |
716 | } | 723 | } |
717 | 724 | ||
725 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
726 | static void uli526x_poll(struct net_device *dev) | ||
727 | { | ||
728 | /* ISR grabs the irqsave lock, so this should be safe */ | ||
729 | uli526x_interrupt(dev->irq, dev); | ||
730 | } | ||
731 | #endif | ||
718 | 732 | ||
719 | /* | 733 | /* |
720 | * Free TX resource after TX complete | 734 | * Free TX resource after TX complete |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index ca0bdac07a78..fb0b918e5ccb 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -237,7 +237,7 @@ static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth, | |||
237 | skb->dev = ugeth->dev; | 237 | skb->dev = ugeth->dev; |
238 | 238 | ||
239 | out_be32(&((struct qe_bd __iomem *)bd)->buf, | 239 | out_be32(&((struct qe_bd __iomem *)bd)->buf, |
240 | dma_map_single(NULL, | 240 | dma_map_single(&ugeth->dev->dev, |
241 | skb->data, | 241 | skb->data, |
242 | ugeth->ug_info->uf_info.max_rx_buf_length + | 242 | ugeth->ug_info->uf_info.max_rx_buf_length + |
243 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, | 243 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, |
@@ -2158,7 +2158,7 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) | |||
2158 | continue; | 2158 | continue; |
2159 | for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { | 2159 | for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { |
2160 | if (ugeth->tx_skbuff[i][j]) { | 2160 | if (ugeth->tx_skbuff[i][j]) { |
2161 | dma_unmap_single(NULL, | 2161 | dma_unmap_single(&ugeth->dev->dev, |
2162 | in_be32(&((struct qe_bd __iomem *)bd)->buf), | 2162 | in_be32(&((struct qe_bd __iomem *)bd)->buf), |
2163 | (in_be32((u32 __iomem *)bd) & | 2163 | (in_be32((u32 __iomem *)bd) & |
2164 | BD_LENGTH_MASK), | 2164 | BD_LENGTH_MASK), |
@@ -2186,7 +2186,7 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) | |||
2186 | bd = ugeth->p_rx_bd_ring[i]; | 2186 | bd = ugeth->p_rx_bd_ring[i]; |
2187 | for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { | 2187 | for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { |
2188 | if (ugeth->rx_skbuff[i][j]) { | 2188 | if (ugeth->rx_skbuff[i][j]) { |
2189 | dma_unmap_single(NULL, | 2189 | dma_unmap_single(&ugeth->dev->dev, |
2190 | in_be32(&((struct qe_bd __iomem *)bd)->buf), | 2190 | in_be32(&((struct qe_bd __iomem *)bd)->buf), |
2191 | ugeth->ug_info-> | 2191 | ugeth->ug_info-> |
2192 | uf_info.max_rx_buf_length + | 2192 | uf_info.max_rx_buf_length + |
@@ -3406,7 +3406,8 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3406 | 3406 | ||
3407 | /* set up the buffer descriptor */ | 3407 | /* set up the buffer descriptor */ |
3408 | out_be32(&((struct qe_bd __iomem *)bd)->buf, | 3408 | out_be32(&((struct qe_bd __iomem *)bd)->buf, |
3409 | dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE)); | 3409 | dma_map_single(&ugeth->dev->dev, skb->data, |
3410 | skb->len, DMA_TO_DEVICE)); | ||
3410 | 3411 | ||
3411 | /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */ | 3412 | /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */ |
3412 | 3413 | ||
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index dc6f097062df..37ecf845edfe 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -1440,6 +1440,10 @@ static const struct usb_device_id products [] = { | |||
1440 | // Belkin F5D5055 | 1440 | // Belkin F5D5055 |
1441 | USB_DEVICE(0x050d, 0x5055), | 1441 | USB_DEVICE(0x050d, 0x5055), |
1442 | .driver_info = (unsigned long) &ax88178_info, | 1442 | .driver_info = (unsigned long) &ax88178_info, |
1443 | }, { | ||
1444 | // Apple USB Ethernet Adapter | ||
1445 | USB_DEVICE(0x05ac, 0x1402), | ||
1446 | .driver_info = (unsigned long) &ax88772_info, | ||
1443 | }, | 1447 | }, |
1444 | { }, // END | 1448 | { }, // END |
1445 | }; | 1449 | }; |
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index 76752d84a30f..22c17bbacb69 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -423,7 +423,10 @@ static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
423 | 423 | ||
424 | catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6; | 424 | catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6; |
425 | tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr; | 425 | tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr; |
426 | *((u16*)tx_buf) = (catc->is_f5u011) ? cpu_to_be16((u16)skb->len) : cpu_to_le16((u16)skb->len); | 426 | if (catc->is_f5u011) |
427 | *(__be16 *)tx_buf = cpu_to_be16(skb->len); | ||
428 | else | ||
429 | *(__le16 *)tx_buf = cpu_to_le16(skb->len); | ||
427 | skb_copy_from_linear_data(skb, tx_buf + 2, skb->len); | 430 | skb_copy_from_linear_data(skb, tx_buf + 2, skb->len); |
428 | catc->tx_ptr += skb->len + 2; | 431 | catc->tx_ptr += skb->len + 2; |
429 | 432 | ||
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index 0ec7936cbe21..c66b9c324f54 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c | |||
@@ -218,7 +218,7 @@ static const struct driver_info blob_info = { | |||
218 | /*-------------------------------------------------------------------------*/ | 218 | /*-------------------------------------------------------------------------*/ |
219 | 219 | ||
220 | #ifndef HAVE_HARDWARE | 220 | #ifndef HAVE_HARDWARE |
221 | #error You need to configure some hardware for this driver | 221 | #warning You need to configure some hardware for this driver |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | /* | 224 | /* |
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 21a7785cb8b6..ae467f182c40 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -194,7 +194,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf) | |||
194 | dev_dbg(&info->control->dev, | 194 | dev_dbg(&info->control->dev, |
195 | "rndis response error, code %d\n", retval); | 195 | "rndis response error, code %d\n", retval); |
196 | } | 196 | } |
197 | msleep(2); | 197 | msleep(20); |
198 | } | 198 | } |
199 | dev_dbg(&info->control->dev, "rndis response timeout\n"); | 199 | dev_dbg(&info->control->dev, "rndis response timeout\n"); |
200 | return -ETIMEDOUT; | 200 | return -ETIMEDOUT; |
@@ -283,8 +283,8 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
283 | struct rndis_set_c *set_c; | 283 | struct rndis_set_c *set_c; |
284 | struct rndis_halt *halt; | 284 | struct rndis_halt *halt; |
285 | } u; | 285 | } u; |
286 | u32 tmp, phym_unspec; | 286 | u32 tmp; |
287 | __le32 *phym; | 287 | __le32 phym_unspec, *phym; |
288 | int reply_len; | 288 | int reply_len; |
289 | unsigned char *bp; | 289 | unsigned char *bp; |
290 | 290 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f926b5ab3d09..fe7cdf2a2a23 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -470,8 +470,7 @@ static void virtnet_remove(struct virtio_device *vdev) | |||
470 | kfree_skb(skb); | 470 | kfree_skb(skb); |
471 | vi->num--; | 471 | vi->num--; |
472 | } | 472 | } |
473 | while ((skb = __skb_dequeue(&vi->send)) != NULL) | 473 | __skb_queue_purge(&vi->send); |
474 | kfree_skb(skb); | ||
475 | 474 | ||
476 | BUG_ON(vi->num != 0); | 475 | BUG_ON(vi->num != 0); |
477 | 476 | ||
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 9a83c9d5b8cf..7f984895b0d5 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -43,8 +43,7 @@ static const char* version = "HDLC support module revision 1.22"; | |||
43 | 43 | ||
44 | #undef DEBUG_LINK | 44 | #undef DEBUG_LINK |
45 | 45 | ||
46 | static struct hdlc_proto *first_proto = NULL; | 46 | static struct hdlc_proto *first_proto; |
47 | |||
48 | 47 | ||
49 | static int hdlc_change_mtu(struct net_device *dev, int new_mtu) | 48 | static int hdlc_change_mtu(struct net_device *dev, int new_mtu) |
50 | { | 49 | { |
@@ -314,21 +313,25 @@ void detach_hdlc_protocol(struct net_device *dev) | |||
314 | 313 | ||
315 | void register_hdlc_protocol(struct hdlc_proto *proto) | 314 | void register_hdlc_protocol(struct hdlc_proto *proto) |
316 | { | 315 | { |
316 | rtnl_lock(); | ||
317 | proto->next = first_proto; | 317 | proto->next = first_proto; |
318 | first_proto = proto; | 318 | first_proto = proto; |
319 | rtnl_unlock(); | ||
319 | } | 320 | } |
320 | 321 | ||
321 | 322 | ||
322 | void unregister_hdlc_protocol(struct hdlc_proto *proto) | 323 | void unregister_hdlc_protocol(struct hdlc_proto *proto) |
323 | { | 324 | { |
324 | struct hdlc_proto **p = &first_proto; | 325 | struct hdlc_proto **p; |
325 | while (*p) { | 326 | |
326 | if (*p == proto) { | 327 | rtnl_lock(); |
327 | *p = proto->next; | 328 | p = &first_proto; |
328 | return; | 329 | while (*p != proto) { |
329 | } | 330 | BUG_ON(!*p); |
330 | p = &((*p)->next); | 331 | p = &((*p)->next); |
331 | } | 332 | } |
333 | *p = proto->next; | ||
334 | rtnl_unlock(); | ||
332 | } | 335 | } |
333 | 336 | ||
334 | 337 | ||
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 7133c688cf20..762d21c1c703 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -56,6 +56,7 @@ struct cisco_state { | |||
56 | cisco_proto settings; | 56 | cisco_proto settings; |
57 | 57 | ||
58 | struct timer_list timer; | 58 | struct timer_list timer; |
59 | spinlock_t lock; | ||
59 | unsigned long last_poll; | 60 | unsigned long last_poll; |
60 | int up; | 61 | int up; |
61 | int request_sent; | 62 | int request_sent; |
@@ -158,6 +159,7 @@ static int cisco_rx(struct sk_buff *skb) | |||
158 | { | 159 | { |
159 | struct net_device *dev = skb->dev; | 160 | struct net_device *dev = skb->dev; |
160 | hdlc_device *hdlc = dev_to_hdlc(dev); | 161 | hdlc_device *hdlc = dev_to_hdlc(dev); |
162 | struct cisco_state *st = state(hdlc); | ||
161 | struct hdlc_header *data = (struct hdlc_header*)skb->data; | 163 | struct hdlc_header *data = (struct hdlc_header*)skb->data; |
162 | struct cisco_packet *cisco_data; | 164 | struct cisco_packet *cisco_data; |
163 | struct in_device *in_dev; | 165 | struct in_device *in_dev; |
@@ -220,11 +222,12 @@ static int cisco_rx(struct sk_buff *skb) | |||
220 | goto rx_error; | 222 | goto rx_error; |
221 | 223 | ||
222 | case CISCO_KEEPALIVE_REQ: | 224 | case CISCO_KEEPALIVE_REQ: |
223 | state(hdlc)->rxseq = ntohl(cisco_data->par1); | 225 | spin_lock(&st->lock); |
224 | if (state(hdlc)->request_sent && | 226 | st->rxseq = ntohl(cisco_data->par1); |
225 | ntohl(cisco_data->par2) == state(hdlc)->txseq) { | 227 | if (st->request_sent && |
226 | state(hdlc)->last_poll = jiffies; | 228 | ntohl(cisco_data->par2) == st->txseq) { |
227 | if (!state(hdlc)->up) { | 229 | st->last_poll = jiffies; |
230 | if (!st->up) { | ||
228 | u32 sec, min, hrs, days; | 231 | u32 sec, min, hrs, days; |
229 | sec = ntohl(cisco_data->time) / 1000; | 232 | sec = ntohl(cisco_data->time) / 1000; |
230 | min = sec / 60; sec -= min * 60; | 233 | min = sec / 60; sec -= min * 60; |
@@ -232,12 +235,12 @@ static int cisco_rx(struct sk_buff *skb) | |||
232 | days = hrs / 24; hrs -= days * 24; | 235 | days = hrs / 24; hrs -= days * 24; |
233 | printk(KERN_INFO "%s: Link up (peer " | 236 | printk(KERN_INFO "%s: Link up (peer " |
234 | "uptime %ud%uh%um%us)\n", | 237 | "uptime %ud%uh%um%us)\n", |
235 | dev->name, days, hrs, | 238 | dev->name, days, hrs, min, sec); |
236 | min, sec); | ||
237 | netif_dormant_off(dev); | 239 | netif_dormant_off(dev); |
238 | state(hdlc)->up = 1; | 240 | st->up = 1; |
239 | } | 241 | } |
240 | } | 242 | } |
243 | spin_unlock(&st->lock); | ||
241 | 244 | ||
242 | dev_kfree_skb_any(skb); | 245 | dev_kfree_skb_any(skb); |
243 | return NET_RX_SUCCESS; | 246 | return NET_RX_SUCCESS; |
@@ -261,24 +264,25 @@ static void cisco_timer(unsigned long arg) | |||
261 | { | 264 | { |
262 | struct net_device *dev = (struct net_device *)arg; | 265 | struct net_device *dev = (struct net_device *)arg; |
263 | hdlc_device *hdlc = dev_to_hdlc(dev); | 266 | hdlc_device *hdlc = dev_to_hdlc(dev); |
267 | struct cisco_state *st = state(hdlc); | ||
264 | 268 | ||
265 | if (state(hdlc)->up && | 269 | spin_lock(&st->lock); |
266 | time_after(jiffies, state(hdlc)->last_poll + | 270 | if (st->up && |
267 | state(hdlc)->settings.timeout * HZ)) { | 271 | time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) { |
268 | state(hdlc)->up = 0; | 272 | st->up = 0; |
269 | printk(KERN_INFO "%s: Link down\n", dev->name); | 273 | printk(KERN_INFO "%s: Link down\n", dev->name); |
270 | netif_dormant_on(dev); | 274 | netif_dormant_on(dev); |
271 | } | 275 | } |
272 | 276 | ||
273 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, | 277 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq), |
274 | htonl(++state(hdlc)->txseq), | 278 | htonl(st->rxseq)); |
275 | htonl(state(hdlc)->rxseq)); | 279 | st->request_sent = 1; |
276 | state(hdlc)->request_sent = 1; | 280 | spin_unlock(&st->lock); |
277 | state(hdlc)->timer.expires = jiffies + | 281 | |
278 | state(hdlc)->settings.interval * HZ; | 282 | st->timer.expires = jiffies + st->settings.interval * HZ; |
279 | state(hdlc)->timer.function = cisco_timer; | 283 | st->timer.function = cisco_timer; |
280 | state(hdlc)->timer.data = arg; | 284 | st->timer.data = arg; |
281 | add_timer(&state(hdlc)->timer); | 285 | add_timer(&st->timer); |
282 | } | 286 | } |
283 | 287 | ||
284 | 288 | ||
@@ -286,15 +290,20 @@ static void cisco_timer(unsigned long arg) | |||
286 | static void cisco_start(struct net_device *dev) | 290 | static void cisco_start(struct net_device *dev) |
287 | { | 291 | { |
288 | hdlc_device *hdlc = dev_to_hdlc(dev); | 292 | hdlc_device *hdlc = dev_to_hdlc(dev); |
289 | state(hdlc)->up = 0; | 293 | struct cisco_state *st = state(hdlc); |
290 | state(hdlc)->request_sent = 0; | 294 | unsigned long flags; |
291 | state(hdlc)->txseq = state(hdlc)->rxseq = 0; | 295 | |
292 | 296 | spin_lock_irqsave(&st->lock, flags); | |
293 | init_timer(&state(hdlc)->timer); | 297 | st->up = 0; |
294 | state(hdlc)->timer.expires = jiffies + HZ; /*First poll after 1s*/ | 298 | st->request_sent = 0; |
295 | state(hdlc)->timer.function = cisco_timer; | 299 | st->txseq = st->rxseq = 0; |
296 | state(hdlc)->timer.data = (unsigned long)dev; | 300 | spin_unlock_irqrestore(&st->lock, flags); |
297 | add_timer(&state(hdlc)->timer); | 301 | |
302 | init_timer(&st->timer); | ||
303 | st->timer.expires = jiffies + HZ; /* First poll after 1 s */ | ||
304 | st->timer.function = cisco_timer; | ||
305 | st->timer.data = (unsigned long)dev; | ||
306 | add_timer(&st->timer); | ||
298 | } | 307 | } |
299 | 308 | ||
300 | 309 | ||
@@ -302,10 +311,16 @@ static void cisco_start(struct net_device *dev) | |||
302 | static void cisco_stop(struct net_device *dev) | 311 | static void cisco_stop(struct net_device *dev) |
303 | { | 312 | { |
304 | hdlc_device *hdlc = dev_to_hdlc(dev); | 313 | hdlc_device *hdlc = dev_to_hdlc(dev); |
305 | del_timer_sync(&state(hdlc)->timer); | 314 | struct cisco_state *st = state(hdlc); |
315 | unsigned long flags; | ||
316 | |||
317 | del_timer_sync(&st->timer); | ||
318 | |||
319 | spin_lock_irqsave(&st->lock, flags); | ||
306 | netif_dormant_on(dev); | 320 | netif_dormant_on(dev); |
307 | state(hdlc)->up = 0; | 321 | st->up = 0; |
308 | state(hdlc)->request_sent = 0; | 322 | st->request_sent = 0; |
323 | spin_unlock_irqrestore(&st->lock, flags); | ||
309 | } | 324 | } |
310 | 325 | ||
311 | 326 | ||
@@ -367,6 +382,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
367 | return result; | 382 | return result; |
368 | 383 | ||
369 | memcpy(&state(hdlc)->settings, &new_settings, size); | 384 | memcpy(&state(hdlc)->settings, &new_settings, size); |
385 | spin_lock_init(&state(hdlc)->lock); | ||
370 | dev->hard_start_xmit = hdlc->xmit; | 386 | dev->hard_start_xmit = hdlc->xmit; |
371 | dev->header_ops = &cisco_header_ops; | 387 | dev->header_ops = &cisco_header_ops; |
372 | dev->type = ARPHRD_CISCO; | 388 | dev->type = ARPHRD_CISCO; |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 45f47c1c0a35..4e1c690ff45f 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2668,6 +2668,7 @@ static struct net_device *init_wifidev(struct airo_info *ai, | |||
2668 | dev->irq = ethdev->irq; | 2668 | dev->irq = ethdev->irq; |
2669 | dev->base_addr = ethdev->base_addr; | 2669 | dev->base_addr = ethdev->base_addr; |
2670 | dev->wireless_data = ethdev->wireless_data; | 2670 | dev->wireless_data = ethdev->wireless_data; |
2671 | SET_NETDEV_DEV(dev, ethdev->dev.parent); | ||
2671 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); | 2672 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); |
2672 | err = register_netdev(dev); | 2673 | err = register_netdev(dev); |
2673 | if (err<0) { | 2674 | if (err<0) { |
@@ -2904,7 +2905,7 @@ EXPORT_SYMBOL(init_airo_card); | |||
2904 | 2905 | ||
2905 | static int waitbusy (struct airo_info *ai) { | 2906 | static int waitbusy (struct airo_info *ai) { |
2906 | int delay = 0; | 2907 | int delay = 0; |
2907 | while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) & (delay < 10000)) { | 2908 | while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) { |
2908 | udelay (10); | 2909 | udelay (10); |
2909 | if ((++delay % 20) == 0) | 2910 | if ((++delay % 20) == 0) |
2910 | OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); | 2911 | OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 4e5c8fc35200..635b9ac9aaa1 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
@@ -1787,6 +1787,8 @@ ath5k_tasklet_rx(unsigned long data) | |||
1787 | 1787 | ||
1788 | spin_lock(&sc->rxbuflock); | 1788 | spin_lock(&sc->rxbuflock); |
1789 | do { | 1789 | do { |
1790 | rxs.flag = 0; | ||
1791 | |||
1790 | if (unlikely(list_empty(&sc->rxbuf))) { | 1792 | if (unlikely(list_empty(&sc->rxbuf))) { |
1791 | ATH5K_WARN(sc, "empty rx buf pool\n"); | 1793 | ATH5K_WARN(sc, "empty rx buf pool\n"); |
1792 | break; | 1794 | break; |
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index 5fb1ae6ad3e2..77990b56860b 100644 --- a/drivers/net/wireless/ath5k/hw.c +++ b/drivers/net/wireless/ath5k/hw.c | |||
@@ -4119,6 +4119,7 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah, | |||
4119 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, | 4119 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, |
4120 | AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); | 4120 | AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); |
4121 | rs->rs_status = 0; | 4121 | rs->rs_status = 0; |
4122 | rs->rs_phyerr = 0; | ||
4122 | 4123 | ||
4123 | /* | 4124 | /* |
4124 | * Key table status | 4125 | * Key table status |
@@ -4145,7 +4146,7 @@ static int ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah, | |||
4145 | if (rx_status->rx_status_1 & | 4146 | if (rx_status->rx_status_1 & |
4146 | AR5K_5210_RX_DESC_STATUS1_PHY_ERROR) { | 4147 | AR5K_5210_RX_DESC_STATUS1_PHY_ERROR) { |
4147 | rs->rs_status |= AR5K_RXERR_PHY; | 4148 | rs->rs_status |= AR5K_RXERR_PHY; |
4148 | rs->rs_phyerr = AR5K_REG_MS(rx_status->rx_status_1, | 4149 | rs->rs_phyerr |= AR5K_REG_MS(rx_status->rx_status_1, |
4149 | AR5K_5210_RX_DESC_STATUS1_PHY_ERROR); | 4150 | AR5K_5210_RX_DESC_STATUS1_PHY_ERROR); |
4150 | } | 4151 | } |
4151 | 4152 | ||
@@ -4193,6 +4194,7 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah, | |||
4193 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, | 4194 | rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, |
4194 | AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); | 4195 | AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); |
4195 | rs->rs_status = 0; | 4196 | rs->rs_status = 0; |
4197 | rs->rs_phyerr = 0; | ||
4196 | 4198 | ||
4197 | /* | 4199 | /* |
4198 | * Key table status | 4200 | * Key table status |
@@ -4215,7 +4217,7 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah, | |||
4215 | if (rx_status->rx_status_1 & | 4217 | if (rx_status->rx_status_1 & |
4216 | AR5K_5212_RX_DESC_STATUS1_PHY_ERROR) { | 4218 | AR5K_5212_RX_DESC_STATUS1_PHY_ERROR) { |
4217 | rs->rs_status |= AR5K_RXERR_PHY; | 4219 | rs->rs_status |= AR5K_RXERR_PHY; |
4218 | rs->rs_phyerr = AR5K_REG_MS(rx_err->rx_error_1, | 4220 | rs->rs_phyerr |= AR5K_REG_MS(rx_err->rx_error_1, |
4219 | AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE); | 4221 | AR5K_RX_DESC_ERROR1_PHY_ERROR_CODE); |
4220 | } | 4222 | } |
4221 | 4223 | ||
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index f51b2d9b085b..1fa043d1802c 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config B43 | 1 | config B43 |
2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" | 2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" |
3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 | 3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA |
4 | select SSB | 4 | select SSB |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select HW_RANDOM | 6 | select HW_RANDOM |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 37783cdd301a..dfa4bdd5597c 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -737,6 +737,7 @@ struct b43_wl { | |||
737 | struct ieee80211_tx_control beacon_txctl; | 737 | struct ieee80211_tx_control beacon_txctl; |
738 | bool beacon0_uploaded; | 738 | bool beacon0_uploaded; |
739 | bool beacon1_uploaded; | 739 | bool beacon1_uploaded; |
740 | bool beacon_templates_virgin; /* Never wrote the templates? */ | ||
740 | struct work_struct beacon_update_trigger; | 741 | struct work_struct beacon_update_trigger; |
741 | 742 | ||
742 | /* The current QOS parameters for the 4 queues. | 743 | /* The current QOS parameters for the 4 queues. |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 8fdba9415c04..6c3d9ea0a9f8 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1544,6 +1544,30 @@ static void b43_write_probe_resp_template(struct b43_wldev *dev, | |||
1544 | kfree(probe_resp_data); | 1544 | kfree(probe_resp_data); |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | static void b43_upload_beacon0(struct b43_wldev *dev) | ||
1548 | { | ||
1549 | struct b43_wl *wl = dev->wl; | ||
1550 | |||
1551 | if (wl->beacon0_uploaded) | ||
1552 | return; | ||
1553 | b43_write_beacon_template(dev, 0x68, 0x18); | ||
1554 | /* FIXME: Probe resp upload doesn't really belong here, | ||
1555 | * but we don't use that feature anyway. */ | ||
1556 | b43_write_probe_resp_template(dev, 0x268, 0x4A, | ||
1557 | &__b43_ratetable[3]); | ||
1558 | wl->beacon0_uploaded = 1; | ||
1559 | } | ||
1560 | |||
1561 | static void b43_upload_beacon1(struct b43_wldev *dev) | ||
1562 | { | ||
1563 | struct b43_wl *wl = dev->wl; | ||
1564 | |||
1565 | if (wl->beacon1_uploaded) | ||
1566 | return; | ||
1567 | b43_write_beacon_template(dev, 0x468, 0x1A); | ||
1568 | wl->beacon1_uploaded = 1; | ||
1569 | } | ||
1570 | |||
1547 | static void handle_irq_beacon(struct b43_wldev *dev) | 1571 | static void handle_irq_beacon(struct b43_wldev *dev) |
1548 | { | 1572 | { |
1549 | struct b43_wl *wl = dev->wl; | 1573 | struct b43_wl *wl = dev->wl; |
@@ -1568,24 +1592,27 @@ static void handle_irq_beacon(struct b43_wldev *dev) | |||
1568 | return; | 1592 | return; |
1569 | } | 1593 | } |
1570 | 1594 | ||
1571 | if (!beacon0_valid) { | 1595 | if (unlikely(wl->beacon_templates_virgin)) { |
1572 | if (!wl->beacon0_uploaded) { | 1596 | /* We never uploaded a beacon before. |
1573 | b43_write_beacon_template(dev, 0x68, 0x18); | 1597 | * Upload both templates now, but only mark one valid. */ |
1574 | b43_write_probe_resp_template(dev, 0x268, 0x4A, | 1598 | wl->beacon_templates_virgin = 0; |
1575 | &__b43_ratetable[3]); | 1599 | b43_upload_beacon0(dev); |
1576 | wl->beacon0_uploaded = 1; | 1600 | b43_upload_beacon1(dev); |
1577 | } | ||
1578 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | 1601 | cmd = b43_read32(dev, B43_MMIO_MACCMD); |
1579 | cmd |= B43_MACCMD_BEACON0_VALID; | 1602 | cmd |= B43_MACCMD_BEACON0_VALID; |
1580 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | 1603 | b43_write32(dev, B43_MMIO_MACCMD, cmd); |
1581 | } else if (!beacon1_valid) { | 1604 | } else { |
1582 | if (!wl->beacon1_uploaded) { | 1605 | if (!beacon0_valid) { |
1583 | b43_write_beacon_template(dev, 0x468, 0x1A); | 1606 | b43_upload_beacon0(dev); |
1584 | wl->beacon1_uploaded = 1; | 1607 | cmd = b43_read32(dev, B43_MMIO_MACCMD); |
1608 | cmd |= B43_MACCMD_BEACON0_VALID; | ||
1609 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | ||
1610 | } else if (!beacon1_valid) { | ||
1611 | b43_upload_beacon1(dev); | ||
1612 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | ||
1613 | cmd |= B43_MACCMD_BEACON1_VALID; | ||
1614 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | ||
1585 | } | 1615 | } |
1586 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | ||
1587 | cmd |= B43_MACCMD_BEACON1_VALID; | ||
1588 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | ||
1589 | } | 1616 | } |
1590 | } | 1617 | } |
1591 | 1618 | ||
@@ -4073,6 +4100,9 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4073 | wl->filter_flags = 0; | 4100 | wl->filter_flags = 0; |
4074 | wl->radiotap_enabled = 0; | 4101 | wl->radiotap_enabled = 0; |
4075 | b43_qos_clear(wl); | 4102 | b43_qos_clear(wl); |
4103 | wl->beacon0_uploaded = 0; | ||
4104 | wl->beacon1_uploaded = 0; | ||
4105 | wl->beacon_templates_virgin = 1; | ||
4076 | 4106 | ||
4077 | /* First register RFkill. | 4107 | /* First register RFkill. |
4078 | * LEDs that are registered later depend on it. */ | 4108 | * LEDs that are registered later depend on it. */ |
@@ -4241,7 +4271,9 @@ static void b43_chip_reset(struct work_struct *work) | |||
4241 | goto out; | 4271 | goto out; |
4242 | } | 4272 | } |
4243 | } | 4273 | } |
4244 | out: | 4274 | out: |
4275 | if (err) | ||
4276 | wl->current_dev = NULL; /* Failed to init the dev. */ | ||
4245 | mutex_unlock(&wl->mutex); | 4277 | mutex_unlock(&wl->mutex); |
4246 | if (err) | 4278 | if (err) |
4247 | b43err(wl, "Controller restart FAILED\n"); | 4279 | b43err(wl, "Controller restart FAILED\n"); |
@@ -4382,9 +4414,11 @@ static void b43_one_core_detach(struct ssb_device *dev) | |||
4382 | struct b43_wldev *wldev; | 4414 | struct b43_wldev *wldev; |
4383 | struct b43_wl *wl; | 4415 | struct b43_wl *wl; |
4384 | 4416 | ||
4417 | /* Do not cancel ieee80211-workqueue based work here. | ||
4418 | * See comment in b43_remove(). */ | ||
4419 | |||
4385 | wldev = ssb_get_drvdata(dev); | 4420 | wldev = ssb_get_drvdata(dev); |
4386 | wl = wldev->wl; | 4421 | wl = wldev->wl; |
4387 | cancel_work_sync(&wldev->restart_work); | ||
4388 | b43_debugfs_remove_device(wldev); | 4422 | b43_debugfs_remove_device(wldev); |
4389 | b43_wireless_core_detach(wldev); | 4423 | b43_wireless_core_detach(wldev); |
4390 | list_del(&wldev->list); | 4424 | list_del(&wldev->list); |
@@ -4569,6 +4603,10 @@ static void b43_remove(struct ssb_device *dev) | |||
4569 | struct b43_wl *wl = ssb_get_devtypedata(dev); | 4603 | struct b43_wl *wl = ssb_get_devtypedata(dev); |
4570 | struct b43_wldev *wldev = ssb_get_drvdata(dev); | 4604 | struct b43_wldev *wldev = ssb_get_drvdata(dev); |
4571 | 4605 | ||
4606 | /* We must cancel any work here before unregistering from ieee80211, | ||
4607 | * as the ieee80211 unreg will destroy the workqueue. */ | ||
4608 | cancel_work_sync(&wldev->restart_work); | ||
4609 | |||
4572 | B43_WARN_ON(!wl); | 4610 | B43_WARN_ON(!wl); |
4573 | if (wl->current_dev == wldev) | 4611 | if (wl->current_dev == wldev) |
4574 | ieee80211_unregister_hw(wl->hw); | 4612 | ieee80211_unregister_hw(wl->hw); |
diff --git a/drivers/net/wireless/b43legacy/Kconfig b/drivers/net/wireless/b43legacy/Kconfig index 13c65faf0247..aef2298d37ac 100644 --- a/drivers/net/wireless/b43legacy/Kconfig +++ b/drivers/net/wireless/b43legacy/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config B43LEGACY | 1 | config B43LEGACY |
2 | tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" | 2 | tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" |
3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 | 3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA |
4 | select SSB | 4 | select SSB |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select HW_RANDOM | 6 | select HW_RANDOM |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 437a9bcc9bd3..ed4317a17cbb 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -833,6 +833,7 @@ static struct pcmcia_device_id hostap_cs_ids[] = { | |||
833 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), | 833 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), |
834 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), | 834 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), |
835 | /* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */ | 835 | /* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */ |
836 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), | ||
836 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), | 837 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), |
837 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), | 838 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), |
838 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), | 839 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 7be68db6f300..cdf90c40f11b 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -3276,11 +3276,6 @@ while (0) | |||
3276 | } | 3276 | } |
3277 | printk(KERN_INFO "%s: Registered netdevice %s\n", dev_info, dev->name); | 3277 | printk(KERN_INFO "%s: Registered netdevice %s\n", dev_info, dev->name); |
3278 | 3278 | ||
3279 | #ifndef PRISM2_NO_PROCFS_DEBUG | ||
3280 | create_proc_read_entry("registers", 0, local->proc, | ||
3281 | prism2_registers_proc_read, local); | ||
3282 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | ||
3283 | |||
3284 | hostap_init_data(local); | 3279 | hostap_init_data(local); |
3285 | return dev; | 3280 | return dev; |
3286 | 3281 | ||
@@ -3307,6 +3302,10 @@ static int hostap_hw_ready(struct net_device *dev) | |||
3307 | netif_carrier_off(local->ddev); | 3302 | netif_carrier_off(local->ddev); |
3308 | } | 3303 | } |
3309 | hostap_init_proc(local); | 3304 | hostap_init_proc(local); |
3305 | #ifndef PRISM2_NO_PROCFS_DEBUG | ||
3306 | create_proc_read_entry("registers", 0, local->proc, | ||
3307 | prism2_registers_proc_read, local); | ||
3308 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | ||
3310 | hostap_init_ap_proc(local); | 3309 | hostap_init_ap_proc(local); |
3311 | return 0; | 3310 | return 0; |
3312 | } | 3311 | } |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index fa87c5c2ae0b..d74c061994ae 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -11584,6 +11584,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv) | |||
11584 | priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit; | 11584 | priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit; |
11585 | 11585 | ||
11586 | priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR; | 11586 | priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR; |
11587 | SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev); | ||
11587 | 11588 | ||
11588 | rc = register_netdev(priv->prom_net_dev); | 11589 | rc = register_netdev(priv->prom_net_dev); |
11589 | if (rc) { | 11590 | if (rc) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index c9847b1a67f7..3a7f0cb710ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -1162,7 +1162,6 @@ static s32 rs_get_best_rate(struct iwl_priv *priv, | |||
1162 | 1162 | ||
1163 | /* Higher rate not available, use the original */ | 1163 | /* Higher rate not available, use the original */ |
1164 | } else { | 1164 | } else { |
1165 | new_rate = rate; | ||
1166 | break; | 1165 | break; |
1167 | } | 1166 | } |
1168 | } | 1167 | } |
@@ -2009,7 +2008,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2009 | * 2) Not just finishing up a search | 2008 | * 2) Not just finishing up a search |
2010 | * 3) Allowing a new search | 2009 | * 3) Allowing a new search |
2011 | */ | 2010 | */ |
2012 | if (!update_lq && !done_search && !lq_sta->stay_in_tbl) { | 2011 | if (!update_lq && !done_search && !lq_sta->stay_in_tbl && window->counter) { |
2013 | /* Save current throughput to compare with "search" throughput*/ | 2012 | /* Save current throughput to compare with "search" throughput*/ |
2014 | lq_sta->last_tpt = current_tpt; | 2013 | lq_sta->last_tpt = current_tpt; |
2015 | 2014 | ||
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index dcfdb404678b..688d60de55cb 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c | |||
@@ -73,8 +73,8 @@ out: | |||
73 | return ret; | 73 | return ret; |
74 | } | 74 | } |
75 | 75 | ||
76 | static void lbs_ethtool_get_stats(struct net_device * dev, | 76 | static void lbs_ethtool_get_stats(struct net_device *dev, |
77 | struct ethtool_stats * stats, u64 * data) | 77 | struct ethtool_stats *stats, uint64_t *data) |
78 | { | 78 | { |
79 | struct lbs_private *priv = dev->priv; | 79 | struct lbs_private *priv = dev->priv; |
80 | struct cmd_ds_mesh_access mesh_access; | 80 | struct cmd_ds_mesh_access mesh_access; |
@@ -83,12 +83,12 @@ static void lbs_ethtool_get_stats(struct net_device * dev, | |||
83 | lbs_deb_enter(LBS_DEB_ETHTOOL); | 83 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
84 | 84 | ||
85 | /* Get Mesh Statistics */ | 85 | /* Get Mesh Statistics */ |
86 | ret = lbs_prepare_and_send_command(priv, | 86 | ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access); |
87 | CMD_MESH_ACCESS, CMD_ACT_MESH_GET_STATS, | ||
88 | CMD_OPTION_WAITFORRSP, 0, &mesh_access); | ||
89 | 87 | ||
90 | if (ret) | 88 | if (ret) { |
89 | memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t))); | ||
91 | return; | 90 | return; |
91 | } | ||
92 | 92 | ||
93 | priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); | 93 | priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); |
94 | priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); | 94 | priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); |
@@ -111,19 +111,18 @@ static void lbs_ethtool_get_stats(struct net_device * dev, | |||
111 | lbs_deb_enter(LBS_DEB_ETHTOOL); | 111 | lbs_deb_enter(LBS_DEB_ETHTOOL); |
112 | } | 112 | } |
113 | 113 | ||
114 | static int lbs_ethtool_get_sset_count(struct net_device * dev, int sset) | 114 | static int lbs_ethtool_get_sset_count(struct net_device *dev, int sset) |
115 | { | 115 | { |
116 | switch (sset) { | 116 | struct lbs_private *priv = dev->priv; |
117 | case ETH_SS_STATS: | 117 | |
118 | if (sset == ETH_SS_STATS && dev == priv->mesh_dev) | ||
118 | return MESH_STATS_NUM; | 119 | return MESH_STATS_NUM; |
119 | default: | 120 | |
120 | return -EOPNOTSUPP; | 121 | return -EOPNOTSUPP; |
121 | } | ||
122 | } | 122 | } |
123 | 123 | ||
124 | static void lbs_ethtool_get_strings(struct net_device *dev, | 124 | static void lbs_ethtool_get_strings(struct net_device *dev, |
125 | u32 stringset, | 125 | uint32_t stringset, uint8_t *s) |
126 | u8 * s) | ||
127 | { | 126 | { |
128 | int i; | 127 | int i; |
129 | 128 | ||
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 406f54d40956..e1f066068590 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -756,6 +756,7 @@ static int lbs_thread(void *data) | |||
756 | priv->nr_retries = 0; | 756 | priv->nr_retries = 0; |
757 | } else { | 757 | } else { |
758 | priv->cur_cmd = NULL; | 758 | priv->cur_cmd = NULL; |
759 | priv->dnld_sent = DNLD_RES_RECEIVED; | ||
759 | lbs_pr_info("requeueing command %x due to timeout (#%d)\n", | 760 | lbs_pr_info("requeueing command %x due to timeout (#%d)\n", |
760 | le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries); | 761 | le16_to_cpu(cmdnode->cmdbuf->command), priv->nr_retries); |
761 | 762 | ||
@@ -1564,6 +1565,7 @@ static int lbs_add_rtap(struct lbs_private *priv) | |||
1564 | rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; | 1565 | rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; |
1565 | rtap_dev->set_multicast_list = lbs_set_multicast_list; | 1566 | rtap_dev->set_multicast_list = lbs_set_multicast_list; |
1566 | rtap_dev->priv = priv; | 1567 | rtap_dev->priv = priv; |
1568 | SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent); | ||
1567 | 1569 | ||
1568 | ret = register_netdev(rtap_dev); | 1570 | ret = register_netdev(rtap_dev); |
1569 | if (ret) { | 1571 | if (ret) { |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 8b7f5768a103..1c216e015f64 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -461,6 +461,7 @@ static struct pcmcia_device_id orinoco_cs_ids[] = { | |||
461 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */ | 461 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */ |
462 | PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */ | 462 | PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */ |
463 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */ | 463 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */ |
464 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), /* SpeedStream Wireless Adapter */ | ||
464 | PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */ | 465 | PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */ |
465 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */ | 466 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */ |
466 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */ | 467 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */ |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index d0b1fb15c709..18c9931e3267 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -116,6 +116,7 @@ MODULE_PARM_DESC(workaround_interval, | |||
116 | #define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b) | 116 | #define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b) |
117 | #define OID_802_11_ADD_KEY ccpu2(0x0d01011d) | 117 | #define OID_802_11_ADD_KEY ccpu2(0x0d01011d) |
118 | #define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e) | 118 | #define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e) |
119 | #define OID_802_11_ASSOCIATION_INFORMATION ccpu2(0x0d01011f) | ||
119 | #define OID_802_11_PMKID ccpu2(0x0d010123) | 120 | #define OID_802_11_PMKID ccpu2(0x0d010123) |
120 | #define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203) | 121 | #define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203) |
121 | #define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204) | 122 | #define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204) |
@@ -271,6 +272,26 @@ struct ndis_config_param { | |||
271 | __le32 value_length; | 272 | __le32 value_length; |
272 | } __attribute__((packed)); | 273 | } __attribute__((packed)); |
273 | 274 | ||
275 | struct ndis_80211_assoc_info { | ||
276 | __le32 length; | ||
277 | __le16 req_ies; | ||
278 | struct req_ie { | ||
279 | __le16 capa; | ||
280 | __le16 listen_interval; | ||
281 | u8 cur_ap_address[6]; | ||
282 | } req_ie; | ||
283 | __le32 req_ie_length; | ||
284 | __le32 offset_req_ies; | ||
285 | __le16 resp_ies; | ||
286 | struct resp_ie { | ||
287 | __le16 capa; | ||
288 | __le16 status_code; | ||
289 | __le16 assoc_id; | ||
290 | } resp_ie; | ||
291 | __le32 resp_ie_length; | ||
292 | __le32 offset_resp_ies; | ||
293 | } __attribute__((packed)); | ||
294 | |||
274 | /* these have to match what is in wpa_supplicant */ | 295 | /* these have to match what is in wpa_supplicant */ |
275 | enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; | 296 | enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; |
276 | enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, | 297 | enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, |
@@ -674,6 +695,12 @@ static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN]) | |||
674 | return ret; | 695 | return ret; |
675 | } | 696 | } |
676 | 697 | ||
698 | static int get_association_info(struct usbnet *usbdev, | ||
699 | struct ndis_80211_assoc_info *info, int len) | ||
700 | { | ||
701 | return rndis_query_oid(usbdev, OID_802_11_ASSOCIATION_INFORMATION, | ||
702 | info, &len); | ||
703 | } | ||
677 | 704 | ||
678 | static int is_associated(struct usbnet *usbdev) | 705 | static int is_associated(struct usbnet *usbdev) |
679 | { | 706 | { |
@@ -2182,11 +2209,40 @@ static void rndis_wext_worker(struct work_struct *work) | |||
2182 | struct usbnet *usbdev = priv->usbdev; | 2209 | struct usbnet *usbdev = priv->usbdev; |
2183 | union iwreq_data evt; | 2210 | union iwreq_data evt; |
2184 | unsigned char bssid[ETH_ALEN]; | 2211 | unsigned char bssid[ETH_ALEN]; |
2185 | int ret; | 2212 | struct ndis_80211_assoc_info *info; |
2213 | int assoc_size = sizeof(*info) + IW_CUSTOM_MAX + 32; | ||
2214 | int ret, offset; | ||
2186 | 2215 | ||
2187 | if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) { | 2216 | if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) { |
2188 | ret = get_bssid(usbdev, bssid); | 2217 | info = kzalloc(assoc_size, GFP_KERNEL); |
2218 | if (!info) | ||
2219 | goto get_bssid; | ||
2220 | |||
2221 | /* Get association info IEs from device and send them back to | ||
2222 | * userspace. */ | ||
2223 | ret = get_association_info(usbdev, info, assoc_size); | ||
2224 | if (!ret) { | ||
2225 | evt.data.length = le32_to_cpu(info->req_ie_length); | ||
2226 | if (evt.data.length > 0) { | ||
2227 | offset = le32_to_cpu(info->offset_req_ies); | ||
2228 | wireless_send_event(usbdev->net, | ||
2229 | IWEVASSOCREQIE, &evt, | ||
2230 | (char *)info + offset); | ||
2231 | } | ||
2232 | |||
2233 | evt.data.length = le32_to_cpu(info->resp_ie_length); | ||
2234 | if (evt.data.length > 0) { | ||
2235 | offset = le32_to_cpu(info->offset_resp_ies); | ||
2236 | wireless_send_event(usbdev->net, | ||
2237 | IWEVASSOCRESPIE, &evt, | ||
2238 | (char *)info + offset); | ||
2239 | } | ||
2240 | } | ||
2241 | |||
2242 | kfree(info); | ||
2189 | 2243 | ||
2244 | get_bssid: | ||
2245 | ret = get_bssid(usbdev, bssid); | ||
2190 | if (!ret) { | 2246 | if (!ret) { |
2191 | evt.data.flags = 0; | 2247 | evt.data.flags = 0; |
2192 | evt.data.length = 0; | 2248 | evt.data.length = 0; |
@@ -2414,6 +2470,11 @@ static int bcm4320_early_init(struct usbnet *dev) | |||
2414 | else if (priv->param_power_save > 2) | 2470 | else if (priv->param_power_save > 2) |
2415 | priv->param_power_save = 2; | 2471 | priv->param_power_save = 2; |
2416 | 2472 | ||
2473 | if (priv->param_power_output < 0) | ||
2474 | priv->param_power_output = 0; | ||
2475 | else if (priv->param_power_output > 3) | ||
2476 | priv->param_power_output = 3; | ||
2477 | |||
2417 | if (priv->param_roamtrigger < -80) | 2478 | if (priv->param_roamtrigger < -80) |
2418 | priv->param_roamtrigger = -80; | 2479 | priv->param_roamtrigger = -80; |
2419 | else if (priv->param_roamtrigger > -60) | 2480 | else if (priv->param_roamtrigger > -60) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 57bdc153952f..611d98320593 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -328,6 +328,11 @@ static inline int rt2x00_get_link_ant_rssi(struct link *link) | |||
328 | return DEFAULT_RSSI; | 328 | return DEFAULT_RSSI; |
329 | } | 329 | } |
330 | 330 | ||
331 | static inline void rt2x00_reset_link_ant_rssi(struct link *link) | ||
332 | { | ||
333 | link->ant.rssi_ant = 0; | ||
334 | } | ||
335 | |||
331 | static inline int rt2x00_get_link_ant_rssi_history(struct link *link, | 336 | static inline int rt2x00_get_link_ant_rssi_history(struct link *link, |
332 | enum antenna ant) | 337 | enum antenna ant) |
333 | { | 338 | { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index a9930a03f450..48608e8cc8b4 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -129,6 +129,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
129 | */ | 129 | */ |
130 | rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA); | 130 | rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA); |
131 | rt2x00lib_reset_link_tuner(rt2x00dev); | 131 | rt2x00lib_reset_link_tuner(rt2x00dev); |
132 | rt2x00_reset_link_ant_rssi(&rt2x00dev->link); | ||
132 | 133 | ||
133 | rt2x00dev->link.ant.active.rx = libconf.ant.rx; | 134 | rt2x00dev->link.ant.active.rx = libconf.ant.rx; |
134 | rt2x00dev->link.ant.active.tx = libconf.ant.tx; | 135 | rt2x00dev->link.ant.active.tx = libconf.ant.tx; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index b22c02737185..2673d568bcac 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -483,9 +483,9 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev) | |||
483 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 483 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) |
484 | return; | 484 | return; |
485 | 485 | ||
486 | ieee80211_iterate_active_interfaces(rt2x00dev->hw, | 486 | ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, |
487 | rt2x00lib_beacondone_iter, | 487 | rt2x00lib_beacondone_iter, |
488 | rt2x00dev); | 488 | rt2x00dev); |
489 | 489 | ||
490 | queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); | 490 | queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); |
491 | } | 491 | } |
@@ -507,7 +507,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
507 | * Update TX statistics. | 507 | * Update TX statistics. |
508 | */ | 508 | */ |
509 | rt2x00dev->link.qual.tx_success += success; | 509 | rt2x00dev->link.qual.tx_success += success; |
510 | rt2x00dev->link.qual.tx_failed += txdesc->retry + fail; | 510 | rt2x00dev->link.qual.tx_failed += fail; |
511 | 511 | ||
512 | /* | 512 | /* |
513 | * Initialize TX status | 513 | * Initialize TX status |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index c206b5092070..87e280a21971 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -93,6 +93,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
93 | */ | 93 | */ |
94 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { | 94 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { |
95 | ieee80211_stop_queues(hw); | 95 | ieee80211_stop_queues(hw); |
96 | dev_kfree_skb_any(skb); | ||
96 | return NETDEV_TX_OK; | 97 | return NETDEV_TX_OK; |
97 | } | 98 | } |
98 | 99 | ||
diff --git a/drivers/net/wireless/rtl8180_grf5101.c b/drivers/net/wireless/rtl8180_grf5101.c index 5d47935dbac3..947ee55f18b2 100644 --- a/drivers/net/wireless/rtl8180_grf5101.c +++ b/drivers/net/wireless/rtl8180_grf5101.c | |||
@@ -88,7 +88,7 @@ static void grf5101_rf_set_channel(struct ieee80211_hw *dev, | |||
88 | write_grf5101(dev, 0x0B, chan); | 88 | write_grf5101(dev, 0x0B, chan); |
89 | write_grf5101(dev, 0x07, 0x1000); | 89 | write_grf5101(dev, 0x07, 0x1000); |
90 | 90 | ||
91 | grf5101_write_phy_antenna(dev, chan); | 91 | grf5101_write_phy_antenna(dev, channel); |
92 | } | 92 | } |
93 | 93 | ||
94 | static void grf5101_rf_stop(struct ieee80211_hw *dev) | 94 | static void grf5101_rf_stop(struct ieee80211_hw *dev) |
diff --git a/drivers/net/wireless/rtl8180_max2820.c b/drivers/net/wireless/rtl8180_max2820.c index a34dfd382b6d..6c825fd7f3b6 100644 --- a/drivers/net/wireless/rtl8180_max2820.c +++ b/drivers/net/wireless/rtl8180_max2820.c | |||
@@ -78,7 +78,8 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev, | |||
78 | struct ieee80211_conf *conf) | 78 | struct ieee80211_conf *conf) |
79 | { | 79 | { |
80 | struct rtl8180_priv *priv = dev->priv; | 80 | struct rtl8180_priv *priv = dev->priv; |
81 | int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); | 81 | int channel = conf ? |
82 | ieee80211_frequency_to_channel(conf->channel->center_freq) : 1; | ||
82 | unsigned int chan_idx = channel - 1; | 83 | unsigned int chan_idx = channel - 1; |
83 | u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; | 84 | u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; |
84 | u32 chan = max2820_chan[chan_idx]; | 85 | u32 chan = max2820_chan[chan_idx]; |
@@ -87,7 +88,7 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev, | |||
87 | * sa2400, for MAXIM we do this directly from BB */ | 88 | * sa2400, for MAXIM we do this directly from BB */ |
88 | rtl8180_write_phy(dev, 3, txpw); | 89 | rtl8180_write_phy(dev, 3, txpw); |
89 | 90 | ||
90 | max2820_write_phy_antenna(dev, chan); | 91 | max2820_write_phy_antenna(dev, channel); |
91 | write_max2820(dev, 3, chan); | 92 | write_max2820(dev, 3, chan); |
92 | } | 93 | } |
93 | 94 | ||
diff --git a/drivers/net/wireless/rtl8180_sa2400.c b/drivers/net/wireless/rtl8180_sa2400.c index 0311b4ea124c..cea4e0ccb92d 100644 --- a/drivers/net/wireless/rtl8180_sa2400.c +++ b/drivers/net/wireless/rtl8180_sa2400.c | |||
@@ -86,7 +86,7 @@ static void sa2400_rf_set_channel(struct ieee80211_hw *dev, | |||
86 | 86 | ||
87 | write_sa2400(dev, 7, txpw); | 87 | write_sa2400(dev, 7, txpw); |
88 | 88 | ||
89 | sa2400_write_phy_antenna(dev, chan); | 89 | sa2400_write_phy_antenna(dev, channel); |
90 | 90 | ||
91 | write_sa2400(dev, 0, chan); | 91 | write_sa2400(dev, 0, chan); |
92 | write_sa2400(dev, 1, 0xbb50); | 92 | write_sa2400(dev, 1, 0xbb50); |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index d5787b37e1fb..9223ada5f00e 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -92,6 +92,7 @@ static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr, | |||
92 | u8 data[4]; | 92 | u8 data[4]; |
93 | struct usb_ctrlrequest dr; | 93 | struct usb_ctrlrequest dr; |
94 | } *buf; | 94 | } *buf; |
95 | int rc; | ||
95 | 96 | ||
96 | buf = kmalloc(sizeof(*buf), GFP_ATOMIC); | 97 | buf = kmalloc(sizeof(*buf), GFP_ATOMIC); |
97 | if (!buf) | 98 | if (!buf) |
@@ -116,7 +117,11 @@ static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr, | |||
116 | usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0), | 117 | usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0), |
117 | (unsigned char *)dr, buf, len, | 118 | (unsigned char *)dr, buf, len, |
118 | rtl8187_iowrite_async_cb, buf); | 119 | rtl8187_iowrite_async_cb, buf); |
119 | usb_submit_urb(urb, GFP_ATOMIC); | 120 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
121 | if (rc < 0) { | ||
122 | kfree(buf); | ||
123 | usb_free_urb(urb); | ||
124 | } | ||
120 | } | 125 | } |
121 | 126 | ||
122 | static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv, | 127 | static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv, |
@@ -169,6 +174,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
169 | struct urb *urb; | 174 | struct urb *urb; |
170 | __le16 rts_dur = 0; | 175 | __le16 rts_dur = 0; |
171 | u32 flags; | 176 | u32 flags; |
177 | int rc; | ||
172 | 178 | ||
173 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 179 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
174 | if (!urb) { | 180 | if (!urb) { |
@@ -208,7 +214,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
208 | info->dev = dev; | 214 | info->dev = dev; |
209 | usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2), | 215 | usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2), |
210 | hdr, skb->len, rtl8187_tx_cb, skb); | 216 | hdr, skb->len, rtl8187_tx_cb, skb); |
211 | usb_submit_urb(urb, GFP_ATOMIC); | 217 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
218 | if (rc < 0) { | ||
219 | usb_free_urb(urb); | ||
220 | kfree_skb(skb); | ||
221 | } | ||
212 | 222 | ||
213 | return 0; | 223 | return 0; |
214 | } | 224 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 69c45ca99051..6424e5a2c83d 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -805,7 +805,7 @@ void zd_process_intr(struct work_struct *work) | |||
805 | u16 int_status; | 805 | u16 int_status; |
806 | struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); | 806 | struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); |
807 | 807 | ||
808 | int_status = le16_to_cpu(*(u16 *)(mac->intr_buffer+4)); | 808 | int_status = le16_to_cpu(*(__le16 *)(mac->intr_buffer+4)); |
809 | if (int_status & INT_CFG_NEXT_BCN) { | 809 | if (int_status & INT_CFG_NEXT_BCN) { |
810 | if (net_ratelimit()) | 810 | if (net_ratelimit()) |
811 | dev_dbg_f(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n"); | 811 | dev_dbg_f(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n"); |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 12e24f04dddf..8941f5eb96c2 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -342,7 +342,7 @@ static inline void handle_regs_int(struct urb *urb) | |||
342 | ZD_ASSERT(in_interrupt()); | 342 | ZD_ASSERT(in_interrupt()); |
343 | spin_lock(&intr->lock); | 343 | spin_lock(&intr->lock); |
344 | 344 | ||
345 | int_num = le16_to_cpu(*(u16 *)(urb->transfer_buffer+2)); | 345 | int_num = le16_to_cpu(*(__le16 *)(urb->transfer_buffer+2)); |
346 | if (int_num == CR_INTERRUPT) { | 346 | if (int_num == CR_INTERRUPT) { |
347 | struct zd_mac *mac = zd_hw_mac(zd_usb_to_hw(urb->context)); | 347 | struct zd_mac *mac = zd_hw_mac(zd_usb_to_hw(urb->context)); |
348 | memcpy(&mac->intr_buffer, urb->transfer_buffer, | 348 | memcpy(&mac->intr_buffer, urb->transfer_buffer, |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 8bddff150c70..d26f69b0184f 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -946,8 +946,7 @@ err: | |||
946 | work_done++; | 946 | work_done++; |
947 | } | 947 | } |
948 | 948 | ||
949 | while ((skb = __skb_dequeue(&errq))) | 949 | __skb_queue_purge(&errq); |
950 | kfree_skb(skb); | ||
951 | 950 | ||
952 | work_done -= handle_incoming_queue(dev, &rxq); | 951 | work_done -= handle_incoming_queue(dev, &rxq); |
953 | 952 | ||
@@ -1079,8 +1078,7 @@ static void xennet_release_rx_bufs(struct netfront_info *np) | |||
1079 | } | 1078 | } |
1080 | } | 1079 | } |
1081 | 1080 | ||
1082 | while ((skb = __skb_dequeue(&free_list)) != NULL) | 1081 | __skb_queue_purge(&free_list); |
1083 | dev_kfree_skb(skb); | ||
1084 | 1082 | ||
1085 | spin_unlock_bh(&np->rx_lock); | 1083 | spin_unlock_bh(&np->rx_lock); |
1086 | } | 1084 | } |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 925ba16355ce..a11021e8ce37 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -619,6 +619,7 @@ static struct hotplug_slot *get_slot_from_name (const char *name) | |||
619 | int pci_hp_register (struct hotplug_slot *slot) | 619 | int pci_hp_register (struct hotplug_slot *slot) |
620 | { | 620 | { |
621 | int result; | 621 | int result; |
622 | struct hotplug_slot *tmp; | ||
622 | 623 | ||
623 | if (slot == NULL) | 624 | if (slot == NULL) |
624 | return -ENODEV; | 625 | return -ENODEV; |
@@ -630,7 +631,11 @@ int pci_hp_register (struct hotplug_slot *slot) | |||
630 | return -EINVAL; | 631 | return -EINVAL; |
631 | } | 632 | } |
632 | 633 | ||
633 | /* this can fail if we have already registered a slot with the same name */ | 634 | /* Check if we have already registered a slot with the same name. */ |
635 | tmp = get_slot_from_name(slot->name); | ||
636 | if (tmp) | ||
637 | return -EEXIST; | ||
638 | |||
634 | slot->kobj.kset = pci_hotplug_slots_kset; | 639 | slot->kobj.kset = pci_hotplug_slots_kset; |
635 | result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, | 640 | result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, |
636 | "%s", slot->name); | 641 | "%s", slot->name); |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 8264a7680435..79c9ddaad3fb 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -97,6 +97,7 @@ struct controller { | |||
97 | u8 cap_base; | 97 | u8 cap_base; |
98 | struct timer_list poll_timer; | 98 | struct timer_list poll_timer; |
99 | volatile int cmd_busy; | 99 | volatile int cmd_busy; |
100 | unsigned int no_cmd_complete:1; | ||
100 | }; | 101 | }; |
101 | 102 | ||
102 | #define INT_BUTTON_IGNORE 0 | 103 | #define INT_BUTTON_IGNORE 0 |
@@ -135,6 +136,7 @@ struct controller { | |||
135 | #define PWR_LED_PRSN 0x00000010 | 136 | #define PWR_LED_PRSN 0x00000010 |
136 | #define HP_SUPR_RM_SUP 0x00000020 | 137 | #define HP_SUPR_RM_SUP 0x00000020 |
137 | #define EMI_PRSN 0x00020000 | 138 | #define EMI_PRSN 0x00020000 |
139 | #define NO_CMD_CMPL_SUP 0x00040000 | ||
138 | 140 | ||
139 | #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) | 141 | #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) |
140 | #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) | 142 | #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) |
@@ -143,13 +145,14 @@ struct controller { | |||
143 | #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) | 145 | #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) |
144 | #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) | 146 | #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) |
145 | #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) | 147 | #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) |
148 | #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & NO_CMD_CMPL_SUP) | ||
146 | 149 | ||
147 | extern int pciehp_sysfs_enable_slot(struct slot *slot); | 150 | extern int pciehp_sysfs_enable_slot(struct slot *slot); |
148 | extern int pciehp_sysfs_disable_slot(struct slot *slot); | 151 | extern int pciehp_sysfs_disable_slot(struct slot *slot); |
149 | extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); | 152 | extern u8 pciehp_handle_attention_button(struct slot *p_slot); |
150 | extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); | 153 | extern u8 pciehp_handle_switch_change(struct slot *p_slot); |
151 | extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); | 154 | extern u8 pciehp_handle_presence_change(struct slot *p_slot); |
152 | extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); | 155 | extern u8 pciehp_handle_power_fault(struct slot *p_slot); |
153 | extern int pciehp_configure_device(struct slot *p_slot); | 156 | extern int pciehp_configure_device(struct slot *p_slot); |
154 | extern int pciehp_unconfigure_device(struct slot *p_slot); | 157 | extern int pciehp_unconfigure_device(struct slot *p_slot); |
155 | extern void pciehp_queue_pushbutton_work(struct work_struct *work); | 158 | extern void pciehp_queue_pushbutton_work(struct work_struct *work); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 43d8ddb2d679..48a2ed378914 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -254,7 +254,11 @@ static int init_slots(struct controller *ctrl) | |||
254 | slot->hp_slot, slot->number, ctrl->slot_device_offset); | 254 | slot->hp_slot, slot->number, ctrl->slot_device_offset); |
255 | retval = pci_hp_register(hotplug_slot); | 255 | retval = pci_hp_register(hotplug_slot); |
256 | if (retval) { | 256 | if (retval) { |
257 | err ("pci_hp_register failed with error %d\n", retval); | 257 | err("pci_hp_register failed with error %d\n", retval); |
258 | if (retval == -EEXIST) | ||
259 | err("Failed to register slot because of name " | ||
260 | "collision. Try \'pciehp_slot_with_bus\' " | ||
261 | "module option.\n"); | ||
258 | goto error_info; | 262 | goto error_info; |
259 | } | 263 | } |
260 | /* create additional sysfs entries */ | 264 | /* create additional sysfs entries */ |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 0a7aa628e955..96a5d55a4983 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -55,16 +55,13 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) | |||
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) | 58 | u8 pciehp_handle_attention_button(struct slot *p_slot) |
59 | { | 59 | { |
60 | struct slot *p_slot; | ||
61 | u32 event_type; | 60 | u32 event_type; |
62 | 61 | ||
63 | /* Attention Button Change */ | 62 | /* Attention Button Change */ |
64 | dbg("pciehp: Attention button interrupt received.\n"); | 63 | dbg("pciehp: Attention button interrupt received.\n"); |
65 | 64 | ||
66 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
67 | |||
68 | /* | 65 | /* |
69 | * Button pressed - See if need to TAKE ACTION!!! | 66 | * Button pressed - See if need to TAKE ACTION!!! |
70 | */ | 67 | */ |
@@ -76,18 +73,15 @@ u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) | |||
76 | return 0; | 73 | return 0; |
77 | } | 74 | } |
78 | 75 | ||
79 | u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) | 76 | u8 pciehp_handle_switch_change(struct slot *p_slot) |
80 | { | 77 | { |
81 | struct slot *p_slot; | ||
82 | u8 getstatus; | 78 | u8 getstatus; |
83 | u32 event_type; | 79 | u32 event_type; |
84 | 80 | ||
85 | /* Switch Change */ | 81 | /* Switch Change */ |
86 | dbg("pciehp: Switch interrupt received.\n"); | 82 | dbg("pciehp: Switch interrupt received.\n"); |
87 | 83 | ||
88 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
89 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 84 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
90 | |||
91 | if (getstatus) { | 85 | if (getstatus) { |
92 | /* | 86 | /* |
93 | * Switch opened | 87 | * Switch opened |
@@ -107,17 +101,14 @@ u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) | |||
107 | return 1; | 101 | return 1; |
108 | } | 102 | } |
109 | 103 | ||
110 | u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) | 104 | u8 pciehp_handle_presence_change(struct slot *p_slot) |
111 | { | 105 | { |
112 | struct slot *p_slot; | ||
113 | u32 event_type; | 106 | u32 event_type; |
114 | u8 presence_save; | 107 | u8 presence_save; |
115 | 108 | ||
116 | /* Presence Change */ | 109 | /* Presence Change */ |
117 | dbg("pciehp: Presence/Notify input change.\n"); | 110 | dbg("pciehp: Presence/Notify input change.\n"); |
118 | 111 | ||
119 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
120 | |||
121 | /* Switch is open, assume a presence change | 112 | /* Switch is open, assume a presence change |
122 | * Save the presence state | 113 | * Save the presence state |
123 | */ | 114 | */ |
@@ -141,16 +132,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) | |||
141 | return 1; | 132 | return 1; |
142 | } | 133 | } |
143 | 134 | ||
144 | u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) | 135 | u8 pciehp_handle_power_fault(struct slot *p_slot) |
145 | { | 136 | { |
146 | struct slot *p_slot; | ||
147 | u32 event_type; | 137 | u32 event_type; |
148 | 138 | ||
149 | /* power fault */ | 139 | /* power fault */ |
150 | dbg("pciehp: Power fault interrupt received.\n"); | 140 | dbg("pciehp: Power fault interrupt received.\n"); |
151 | 141 | ||
152 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
153 | |||
154 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { | 142 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { |
155 | /* | 143 | /* |
156 | * power fault Cleared | 144 | * power fault Cleared |
@@ -163,7 +151,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) | |||
163 | */ | 151 | */ |
164 | info("Power fault on Slot(%s)\n", p_slot->name); | 152 | info("Power fault on Slot(%s)\n", p_slot->name); |
165 | event_type = INT_POWER_FAULT; | 153 | event_type = INT_POWER_FAULT; |
166 | info("power fault bit %x set\n", hp_slot); | 154 | info("power fault bit %x set\n", 0); |
167 | } | 155 | } |
168 | 156 | ||
169 | queue_interrupt_event(p_slot, event_type); | 157 | queue_interrupt_event(p_slot, event_type); |
@@ -186,6 +174,13 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
186 | } | 174 | } |
187 | } | 175 | } |
188 | 176 | ||
177 | /* | ||
178 | * After turning power off, we must wait for at least 1 second | ||
179 | * before taking any action that relies on power having been | ||
180 | * removed from the slot/adapter. | ||
181 | */ | ||
182 | msleep(1000); | ||
183 | |||
189 | if (PWR_LED(ctrl)) | 184 | if (PWR_LED(ctrl)) |
190 | pslot->hpc_ops->green_led_off(pslot); | 185 | pslot->hpc_ops->green_led_off(pslot); |
191 | 186 | ||
@@ -289,6 +284,13 @@ static int remove_board(struct slot *p_slot) | |||
289 | } | 284 | } |
290 | } | 285 | } |
291 | 286 | ||
287 | /* | ||
288 | * After turning power off, we must wait for at least 1 second | ||
289 | * before taking any action that relies on power having been | ||
290 | * removed from the slot/adapter. | ||
291 | */ | ||
292 | msleep(1000); | ||
293 | |||
292 | if (PWR_LED(ctrl)) | 294 | if (PWR_LED(ctrl)) |
293 | /* turn off Green LED */ | 295 | /* turn off Green LED */ |
294 | p_slot->hpc_ops->green_led_off(p_slot); | 296 | p_slot->hpc_ops->green_led_off(p_slot); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 891f81a0400c..79f104963166 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -247,14 +247,38 @@ static inline void pciehp_free_irq(struct controller *ctrl) | |||
247 | free_irq(ctrl->pci_dev->irq, ctrl); | 247 | free_irq(ctrl->pci_dev->irq, ctrl); |
248 | } | 248 | } |
249 | 249 | ||
250 | static inline int pcie_wait_cmd(struct controller *ctrl) | 250 | static inline int pcie_poll_cmd(struct controller *ctrl) |
251 | { | ||
252 | u16 slot_status; | ||
253 | int timeout = 1000; | ||
254 | |||
255 | if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) | ||
256 | if (slot_status & CMD_COMPLETED) | ||
257 | goto completed; | ||
258 | for (timeout = 1000; timeout > 0; timeout -= 100) { | ||
259 | msleep(100); | ||
260 | if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) | ||
261 | if (slot_status & CMD_COMPLETED) | ||
262 | goto completed; | ||
263 | } | ||
264 | return 0; /* timeout */ | ||
265 | |||
266 | completed: | ||
267 | pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED); | ||
268 | return timeout; | ||
269 | } | ||
270 | |||
271 | static inline int pcie_wait_cmd(struct controller *ctrl, int poll) | ||
251 | { | 272 | { |
252 | int retval = 0; | 273 | int retval = 0; |
253 | unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; | 274 | unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; |
254 | unsigned long timeout = msecs_to_jiffies(msecs); | 275 | unsigned long timeout = msecs_to_jiffies(msecs); |
255 | int rc; | 276 | int rc; |
256 | 277 | ||
257 | rc = wait_event_interruptible_timeout(ctrl->queue, | 278 | if (poll) |
279 | rc = pcie_poll_cmd(ctrl); | ||
280 | else | ||
281 | rc = wait_event_interruptible_timeout(ctrl->queue, | ||
258 | !ctrl->cmd_busy, timeout); | 282 | !ctrl->cmd_busy, timeout); |
259 | if (!rc) | 283 | if (!rc) |
260 | dbg("Command not completed in 1000 msec\n"); | 284 | dbg("Command not completed in 1000 msec\n"); |
@@ -286,12 +310,28 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
286 | goto out; | 310 | goto out; |
287 | } | 311 | } |
288 | 312 | ||
289 | if ((slot_status & CMD_COMPLETED) == CMD_COMPLETED ) { | 313 | if (slot_status & CMD_COMPLETED) { |
290 | /* After 1 sec and CMD_COMPLETED still not set, just | 314 | if (!ctrl->no_cmd_complete) { |
291 | proceed forward to issue the next command according | 315 | /* |
292 | to spec. Just print out the error message */ | 316 | * After 1 sec and CMD_COMPLETED still not set, just |
293 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", | 317 | * proceed forward to issue the next command according |
294 | __func__); | 318 | * to spec. Just print out the error message. |
319 | */ | ||
320 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", | ||
321 | __func__); | ||
322 | } else if (!NO_CMD_CMPL(ctrl)) { | ||
323 | /* | ||
324 | * This controller semms to notify of command completed | ||
325 | * event even though it supports none of power | ||
326 | * controller, attention led, power led and EMI. | ||
327 | */ | ||
328 | dbg("%s: Unexpected CMD_COMPLETED. Need to wait for " | ||
329 | "command completed event.\n", __func__); | ||
330 | ctrl->no_cmd_complete = 0; | ||
331 | } else { | ||
332 | dbg("%s: Unexpected CMD_COMPLETED. Maybe the " | ||
333 | "controller is broken.\n", __func__); | ||
334 | } | ||
295 | } | 335 | } |
296 | 336 | ||
297 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 337 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
@@ -315,8 +355,18 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
315 | /* | 355 | /* |
316 | * Wait for command completion. | 356 | * Wait for command completion. |
317 | */ | 357 | */ |
318 | if (!retval) | 358 | if (!retval && !ctrl->no_cmd_complete) { |
319 | retval = pcie_wait_cmd(ctrl); | 359 | int poll = 0; |
360 | /* | ||
361 | * if hotplug interrupt is not enabled or command | ||
362 | * completed interrupt is not enabled, we need to poll | ||
363 | * command completed event. | ||
364 | */ | ||
365 | if (!(slot_ctrl & HP_INTR_ENABLE) || | ||
366 | !(slot_ctrl & CMD_CMPL_INTR_ENABLE)) | ||
367 | poll = 1; | ||
368 | retval = pcie_wait_cmd(ctrl, poll); | ||
369 | } | ||
320 | out: | 370 | out: |
321 | mutex_unlock(&ctrl->ctrl_lock); | 371 | mutex_unlock(&ctrl->ctrl_lock); |
322 | return retval; | 372 | return retval; |
@@ -704,13 +754,6 @@ static int hpc_power_off_slot(struct slot * slot) | |||
704 | } | 754 | } |
705 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 755 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
706 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 756 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
707 | |||
708 | /* | ||
709 | * After turning power off, we must wait for at least 1 second | ||
710 | * before taking any action that relies on power having been | ||
711 | * removed from the slot/adapter. | ||
712 | */ | ||
713 | msleep(1000); | ||
714 | out: | 757 | out: |
715 | if (changed) | 758 | if (changed) |
716 | pcie_unmask_bad_dllp(ctrl); | 759 | pcie_unmask_bad_dllp(ctrl); |
@@ -722,6 +765,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
722 | { | 765 | { |
723 | struct controller *ctrl = (struct controller *)dev_id; | 766 | struct controller *ctrl = (struct controller *)dev_id; |
724 | u16 detected, intr_loc; | 767 | u16 detected, intr_loc; |
768 | struct slot *p_slot; | ||
725 | 769 | ||
726 | /* | 770 | /* |
727 | * In order to guarantee that all interrupt events are | 771 | * In order to guarantee that all interrupt events are |
@@ -756,21 +800,38 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
756 | wake_up_interruptible(&ctrl->queue); | 800 | wake_up_interruptible(&ctrl->queue); |
757 | } | 801 | } |
758 | 802 | ||
803 | if (!(intr_loc & ~CMD_COMPLETED)) | ||
804 | return IRQ_HANDLED; | ||
805 | |||
806 | /* | ||
807 | * Return without handling events if this handler routine is | ||
808 | * called before controller initialization is done. This may | ||
809 | * happen if hotplug event or another interrupt that shares | ||
810 | * the IRQ with pciehp arrives before slot initialization is | ||
811 | * done after interrupt handler is registered. | ||
812 | * | ||
813 | * FIXME - Need more structural fixes. We need to be ready to | ||
814 | * handle the event before installing interrupt handler. | ||
815 | */ | ||
816 | p_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); | ||
817 | if (!p_slot || !p_slot->hpc_ops) | ||
818 | return IRQ_HANDLED; | ||
819 | |||
759 | /* Check MRL Sensor Changed */ | 820 | /* Check MRL Sensor Changed */ |
760 | if (intr_loc & MRL_SENS_CHANGED) | 821 | if (intr_loc & MRL_SENS_CHANGED) |
761 | pciehp_handle_switch_change(0, ctrl); | 822 | pciehp_handle_switch_change(p_slot); |
762 | 823 | ||
763 | /* Check Attention Button Pressed */ | 824 | /* Check Attention Button Pressed */ |
764 | if (intr_loc & ATTN_BUTTN_PRESSED) | 825 | if (intr_loc & ATTN_BUTTN_PRESSED) |
765 | pciehp_handle_attention_button(0, ctrl); | 826 | pciehp_handle_attention_button(p_slot); |
766 | 827 | ||
767 | /* Check Presence Detect Changed */ | 828 | /* Check Presence Detect Changed */ |
768 | if (intr_loc & PRSN_DETECT_CHANGED) | 829 | if (intr_loc & PRSN_DETECT_CHANGED) |
769 | pciehp_handle_presence_change(0, ctrl); | 830 | pciehp_handle_presence_change(p_slot); |
770 | 831 | ||
771 | /* Check Power Fault Detected */ | 832 | /* Check Power Fault Detected */ |
772 | if (intr_loc & PWR_FAULT_DETECTED) | 833 | if (intr_loc & PWR_FAULT_DETECTED) |
773 | pciehp_handle_power_fault(0, ctrl); | 834 | pciehp_handle_power_fault(p_slot); |
774 | 835 | ||
775 | return IRQ_HANDLED; | 836 | return IRQ_HANDLED; |
776 | } | 837 | } |
@@ -1028,6 +1089,12 @@ static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev) | |||
1028 | static int pcie_init_hardware_part1(struct controller *ctrl, | 1089 | static int pcie_init_hardware_part1(struct controller *ctrl, |
1029 | struct pcie_device *dev) | 1090 | struct pcie_device *dev) |
1030 | { | 1091 | { |
1092 | /* Clear all remaining event bits in Slot Status register */ | ||
1093 | if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) { | ||
1094 | err("%s: Cannot write to SLOTSTATUS register\n", __func__); | ||
1095 | return -1; | ||
1096 | } | ||
1097 | |||
1031 | /* Mask Hot-plug Interrupt Enable */ | 1098 | /* Mask Hot-plug Interrupt Enable */ |
1032 | if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { | 1099 | if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { |
1033 | err("%s: Cannot mask hotplug interrupt enable\n", __func__); | 1100 | err("%s: Cannot mask hotplug interrupt enable\n", __func__); |
@@ -1040,16 +1107,6 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) | |||
1040 | { | 1107 | { |
1041 | u16 cmd, mask; | 1108 | u16 cmd, mask; |
1042 | 1109 | ||
1043 | /* | ||
1044 | * We need to clear all events before enabling hotplug interrupt | ||
1045 | * notification mechanism in order for hotplug controler to | ||
1046 | * generate interrupts. | ||
1047 | */ | ||
1048 | if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) { | ||
1049 | err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); | ||
1050 | return -1; | ||
1051 | } | ||
1052 | |||
1053 | cmd = PRSN_DETECT_ENABLE; | 1110 | cmd = PRSN_DETECT_ENABLE; |
1054 | if (ATTN_BUTTN(ctrl)) | 1111 | if (ATTN_BUTTN(ctrl)) |
1055 | cmd |= ATTN_BUTTN_ENABLE; | 1112 | cmd |= ATTN_BUTTN_ENABLE; |
@@ -1116,6 +1173,7 @@ static inline void dbg_ctrl(struct controller *ctrl) | |||
1116 | dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); | 1173 | dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); |
1117 | dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); | 1174 | dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); |
1118 | dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); | 1175 | dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); |
1176 | dbg(" Comamnd Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes"); | ||
1119 | pciehp_readw(ctrl, SLOTSTATUS, ®16); | 1177 | pciehp_readw(ctrl, SLOTSTATUS, ®16); |
1120 | dbg("Slot Status : 0x%04x\n", reg16); | 1178 | dbg("Slot Status : 0x%04x\n", reg16); |
1121 | pciehp_readw(ctrl, SLOTSTATUS, ®16); | 1179 | pciehp_readw(ctrl, SLOTSTATUS, ®16); |
@@ -1147,6 +1205,15 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev) | |||
1147 | mutex_init(&ctrl->ctrl_lock); | 1205 | mutex_init(&ctrl->ctrl_lock); |
1148 | init_waitqueue_head(&ctrl->queue); | 1206 | init_waitqueue_head(&ctrl->queue); |
1149 | dbg_ctrl(ctrl); | 1207 | dbg_ctrl(ctrl); |
1208 | /* | ||
1209 | * Controller doesn't notify of command completion if the "No | ||
1210 | * Command Completed Support" bit is set in Slot Capability | ||
1211 | * register or the controller supports none of power | ||
1212 | * controller, attention led, power led and EMI. | ||
1213 | */ | ||
1214 | if (NO_CMD_CMPL(ctrl) || | ||
1215 | !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) | ||
1216 | ctrl->no_cmd_complete = 1; | ||
1150 | 1217 | ||
1151 | info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", | 1218 | info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", |
1152 | pdev->vendor, pdev->device, | 1219 | pdev->vendor, pdev->device, |
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c index e32148a8fa12..779c5db71be4 100644 --- a/drivers/pci/hotplug/rpadlpar_sysfs.c +++ b/drivers/pci/hotplug/rpadlpar_sysfs.c | |||
@@ -18,8 +18,12 @@ | |||
18 | #include "rpadlpar.h" | 18 | #include "rpadlpar.h" |
19 | 19 | ||
20 | #define DLPAR_KOBJ_NAME "control" | 20 | #define DLPAR_KOBJ_NAME "control" |
21 | #define ADD_SLOT_ATTR_NAME "add_slot" | 21 | |
22 | #define REMOVE_SLOT_ATTR_NAME "remove_slot" | 22 | /* Those two have no quotes because they are passed to __ATTR() which |
23 | * stringifies the argument (yuck !) | ||
24 | */ | ||
25 | #define ADD_SLOT_ATTR_NAME add_slot | ||
26 | #define REMOVE_SLOT_ATTR_NAME remove_slot | ||
23 | 27 | ||
24 | #define MAX_DRC_NAME_LEN 64 | 28 | #define MAX_DRC_NAME_LEN 64 |
25 | 29 | ||
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 1648076600fc..97848654652a 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -162,6 +162,10 @@ static int init_slots(struct controller *ctrl) | |||
162 | retval = pci_hp_register(slot->hotplug_slot); | 162 | retval = pci_hp_register(slot->hotplug_slot); |
163 | if (retval) { | 163 | if (retval) { |
164 | err("pci_hp_register failed with error %d\n", retval); | 164 | err("pci_hp_register failed with error %d\n", retval); |
165 | if (retval == -EEXIST) | ||
166 | err("Failed to register slot because of name " | ||
167 | "collision. Try \'shpchp_slot_with_bus\' " | ||
168 | "module option.\n"); | ||
165 | goto error_info; | 169 | goto error_info; |
166 | } | 170 | } |
167 | 171 | ||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 61fedb2448b6..f82495583e63 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -506,6 +506,23 @@ static void free_link_state(struct pci_dev *pdev) | |||
506 | pdev->link_state = NULL; | 506 | pdev->link_state = NULL; |
507 | } | 507 | } |
508 | 508 | ||
509 | static int pcie_aspm_sanity_check(struct pci_dev *pdev) | ||
510 | { | ||
511 | struct pci_dev *child_dev; | ||
512 | int child_pos; | ||
513 | |||
514 | /* | ||
515 | * Some functions in a slot might not all be PCIE functions, very | ||
516 | * strange. Disable ASPM for the whole slot | ||
517 | */ | ||
518 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
519 | child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
520 | if (!child_pos) | ||
521 | return -EINVAL; | ||
522 | } | ||
523 | return 0; | ||
524 | } | ||
525 | |||
509 | /* | 526 | /* |
510 | * pcie_aspm_init_link_state: Initiate PCI express link state. | 527 | * pcie_aspm_init_link_state: Initiate PCI express link state. |
511 | * It is called after the pcie and its children devices are scaned. | 528 | * It is called after the pcie and its children devices are scaned. |
@@ -526,6 +543,9 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev) | |||
526 | if (list_empty(&pdev->subordinate->devices)) | 543 | if (list_empty(&pdev->subordinate->devices)) |
527 | goto out; | 544 | goto out; |
528 | 545 | ||
546 | if (pcie_aspm_sanity_check(pdev)) | ||
547 | goto out; | ||
548 | |||
529 | mutex_lock(&aspm_lock); | 549 | mutex_lock(&aspm_lock); |
530 | 550 | ||
531 | link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); | 551 | link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index 0a6cea1316b4..52d0aa8c2e7a 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c | |||
@@ -352,6 +352,7 @@ static struct of_device_id electra_cf_match[] = { | |||
352 | }, | 352 | }, |
353 | {}, | 353 | {}, |
354 | }; | 354 | }; |
355 | MODULE_DEVICE_TABLE(of, electra_cf_match); | ||
355 | 356 | ||
356 | static struct of_platform_driver electra_cf_driver = { | 357 | static struct of_platform_driver electra_cf_driver = { |
357 | .name = (char *)driver_name, | 358 | .name = (char *)driver_name, |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 138dd76ee347..af1633eb3b70 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -91,15 +91,13 @@ int power_supply_register(struct device *parent, struct power_supply *psy) | |||
91 | { | 91 | { |
92 | int rc = 0; | 92 | int rc = 0; |
93 | 93 | ||
94 | psy->dev = device_create(power_supply_class, parent, 0, | 94 | psy->dev = device_create_drvdata(power_supply_class, parent, 0, |
95 | "%s", psy->name); | 95 | psy, "%s", psy->name); |
96 | if (IS_ERR(psy->dev)) { | 96 | if (IS_ERR(psy->dev)) { |
97 | rc = PTR_ERR(psy->dev); | 97 | rc = PTR_ERR(psy->dev); |
98 | goto dev_create_failed; | 98 | goto dev_create_failed; |
99 | } | 99 | } |
100 | 100 | ||
101 | dev_set_drvdata(psy->dev, psy); | ||
102 | |||
103 | INIT_WORK(&psy->changed_work, power_supply_changed_work); | 101 | INIT_WORK(&psy->changed_work, power_supply_changed_work); |
104 | 102 | ||
105 | rc = power_supply_create_attrs(psy); | 103 | rc = power_supply_create_attrs(psy); |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 8ba3f135da22..1a4025683362 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -63,6 +63,7 @@ static void dasd_return_cqr_cb(struct dasd_ccw_req *, void *); | |||
63 | */ | 63 | */ |
64 | static wait_queue_head_t dasd_init_waitq; | 64 | static wait_queue_head_t dasd_init_waitq; |
65 | static wait_queue_head_t dasd_flush_wq; | 65 | static wait_queue_head_t dasd_flush_wq; |
66 | static wait_queue_head_t generic_waitq; | ||
66 | 67 | ||
67 | /* | 68 | /* |
68 | * Allocate memory for a new device structure. | 69 | * Allocate memory for a new device structure. |
@@ -1151,11 +1152,15 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, | |||
1151 | struct list_head *l, *n; | 1152 | struct list_head *l, *n; |
1152 | struct dasd_ccw_req *cqr; | 1153 | struct dasd_ccw_req *cqr; |
1153 | struct dasd_block *block; | 1154 | struct dasd_block *block; |
1155 | void (*callback)(struct dasd_ccw_req *, void *data); | ||
1156 | void *callback_data; | ||
1154 | 1157 | ||
1155 | list_for_each_safe(l, n, final_queue) { | 1158 | list_for_each_safe(l, n, final_queue) { |
1156 | cqr = list_entry(l, struct dasd_ccw_req, devlist); | 1159 | cqr = list_entry(l, struct dasd_ccw_req, devlist); |
1157 | list_del_init(&cqr->devlist); | 1160 | list_del_init(&cqr->devlist); |
1158 | block = cqr->block; | 1161 | block = cqr->block; |
1162 | callback = cqr->callback; | ||
1163 | callback_data = cqr->callback_data; | ||
1159 | if (block) | 1164 | if (block) |
1160 | spin_lock_bh(&block->queue_lock); | 1165 | spin_lock_bh(&block->queue_lock); |
1161 | switch (cqr->status) { | 1166 | switch (cqr->status) { |
@@ -1176,7 +1181,7 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, | |||
1176 | BUG(); | 1181 | BUG(); |
1177 | } | 1182 | } |
1178 | if (cqr->callback != NULL) | 1183 | if (cqr->callback != NULL) |
1179 | (cqr->callback)(cqr, cqr->callback_data); | 1184 | (callback)(cqr, callback_data); |
1180 | if (block) | 1185 | if (block) |
1181 | spin_unlock_bh(&block->queue_lock); | 1186 | spin_unlock_bh(&block->queue_lock); |
1182 | } | 1187 | } |
@@ -1406,17 +1411,15 @@ static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr) | |||
1406 | */ | 1411 | */ |
1407 | int dasd_sleep_on(struct dasd_ccw_req *cqr) | 1412 | int dasd_sleep_on(struct dasd_ccw_req *cqr) |
1408 | { | 1413 | { |
1409 | wait_queue_head_t wait_q; | ||
1410 | struct dasd_device *device; | 1414 | struct dasd_device *device; |
1411 | int rc; | 1415 | int rc; |
1412 | 1416 | ||
1413 | device = cqr->startdev; | 1417 | device = cqr->startdev; |
1414 | 1418 | ||
1415 | init_waitqueue_head (&wait_q); | ||
1416 | cqr->callback = dasd_wakeup_cb; | 1419 | cqr->callback = dasd_wakeup_cb; |
1417 | cqr->callback_data = (void *) &wait_q; | 1420 | cqr->callback_data = (void *) &generic_waitq; |
1418 | dasd_add_request_tail(cqr); | 1421 | dasd_add_request_tail(cqr); |
1419 | wait_event(wait_q, _wait_for_wakeup(cqr)); | 1422 | wait_event(generic_waitq, _wait_for_wakeup(cqr)); |
1420 | 1423 | ||
1421 | /* Request status is either done or failed. */ | 1424 | /* Request status is either done or failed. */ |
1422 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; | 1425 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; |
@@ -1429,20 +1432,18 @@ int dasd_sleep_on(struct dasd_ccw_req *cqr) | |||
1429 | */ | 1432 | */ |
1430 | int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr) | 1433 | int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr) |
1431 | { | 1434 | { |
1432 | wait_queue_head_t wait_q; | ||
1433 | struct dasd_device *device; | 1435 | struct dasd_device *device; |
1434 | int rc; | 1436 | int rc; |
1435 | 1437 | ||
1436 | device = cqr->startdev; | 1438 | device = cqr->startdev; |
1437 | init_waitqueue_head (&wait_q); | ||
1438 | cqr->callback = dasd_wakeup_cb; | 1439 | cqr->callback = dasd_wakeup_cb; |
1439 | cqr->callback_data = (void *) &wait_q; | 1440 | cqr->callback_data = (void *) &generic_waitq; |
1440 | dasd_add_request_tail(cqr); | 1441 | dasd_add_request_tail(cqr); |
1441 | rc = wait_event_interruptible(wait_q, _wait_for_wakeup(cqr)); | 1442 | rc = wait_event_interruptible(generic_waitq, _wait_for_wakeup(cqr)); |
1442 | if (rc == -ERESTARTSYS) { | 1443 | if (rc == -ERESTARTSYS) { |
1443 | dasd_cancel_req(cqr); | 1444 | dasd_cancel_req(cqr); |
1444 | /* wait (non-interruptible) for final status */ | 1445 | /* wait (non-interruptible) for final status */ |
1445 | wait_event(wait_q, _wait_for_wakeup(cqr)); | 1446 | wait_event(generic_waitq, _wait_for_wakeup(cqr)); |
1446 | } | 1447 | } |
1447 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; | 1448 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; |
1448 | return rc; | 1449 | return rc; |
@@ -1466,7 +1467,6 @@ static inline int _dasd_term_running_cqr(struct dasd_device *device) | |||
1466 | 1467 | ||
1467 | int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | 1468 | int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) |
1468 | { | 1469 | { |
1469 | wait_queue_head_t wait_q; | ||
1470 | struct dasd_device *device; | 1470 | struct dasd_device *device; |
1471 | int rc; | 1471 | int rc; |
1472 | 1472 | ||
@@ -1478,9 +1478,8 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
1478 | return rc; | 1478 | return rc; |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | init_waitqueue_head (&wait_q); | ||
1482 | cqr->callback = dasd_wakeup_cb; | 1481 | cqr->callback = dasd_wakeup_cb; |
1483 | cqr->callback_data = (void *) &wait_q; | 1482 | cqr->callback_data = (void *) &generic_waitq; |
1484 | cqr->status = DASD_CQR_QUEUED; | 1483 | cqr->status = DASD_CQR_QUEUED; |
1485 | list_add(&cqr->devlist, &device->ccw_queue); | 1484 | list_add(&cqr->devlist, &device->ccw_queue); |
1486 | 1485 | ||
@@ -1489,7 +1488,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
1489 | 1488 | ||
1490 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | 1489 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); |
1491 | 1490 | ||
1492 | wait_event(wait_q, _wait_for_wakeup(cqr)); | 1491 | wait_event(generic_waitq, _wait_for_wakeup(cqr)); |
1493 | 1492 | ||
1494 | /* Request status is either done or failed. */ | 1493 | /* Request status is either done or failed. */ |
1495 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; | 1494 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; |
@@ -2430,6 +2429,7 @@ static int __init dasd_init(void) | |||
2430 | 2429 | ||
2431 | init_waitqueue_head(&dasd_init_waitq); | 2430 | init_waitqueue_head(&dasd_init_waitq); |
2432 | init_waitqueue_head(&dasd_flush_wq); | 2431 | init_waitqueue_head(&dasd_flush_wq); |
2432 | init_waitqueue_head(&generic_waitq); | ||
2433 | 2433 | ||
2434 | /* register 'common' DASD debug area, used for all DBF_XXX calls */ | 2434 | /* register 'common' DASD debug area, used for all DBF_XXX calls */ |
2435 | dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long)); | 2435 | dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long)); |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 0d98f1ff2edd..848ef7e8523f 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -549,7 +549,6 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, | |||
549 | struct raw3270_request *rq) | 549 | struct raw3270_request *rq) |
550 | { | 550 | { |
551 | unsigned long flags; | 551 | unsigned long flags; |
552 | wait_queue_head_t wq; | ||
553 | int rc; | 552 | int rc; |
554 | 553 | ||
555 | #ifdef CONFIG_TN3270_CONSOLE | 554 | #ifdef CONFIG_TN3270_CONSOLE |
@@ -566,20 +565,20 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, | |||
566 | return rq->rc; | 565 | return rq->rc; |
567 | } | 566 | } |
568 | #endif | 567 | #endif |
569 | init_waitqueue_head(&wq); | ||
570 | rq->callback = raw3270_wake_init; | 568 | rq->callback = raw3270_wake_init; |
571 | rq->callback_data = &wq; | 569 | rq->callback_data = &raw3270_wait_queue; |
572 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); | 570 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); |
573 | rc = __raw3270_start(rp, view, rq); | 571 | rc = __raw3270_start(rp, view, rq); |
574 | spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags); | 572 | spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags); |
575 | if (rc) | 573 | if (rc) |
576 | return rc; | 574 | return rc; |
577 | /* Now wait for the completion. */ | 575 | /* Now wait for the completion. */ |
578 | rc = wait_event_interruptible(wq, raw3270_request_final(rq)); | 576 | rc = wait_event_interruptible(raw3270_wait_queue, |
577 | raw3270_request_final(rq)); | ||
579 | if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */ | 578 | if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */ |
580 | raw3270_halt_io(view->dev, rq); | 579 | raw3270_halt_io(view->dev, rq); |
581 | /* No wait for the halt to complete. */ | 580 | /* No wait for the halt to complete. */ |
582 | wait_event(wq, raw3270_request_final(rq)); | 581 | wait_event(raw3270_wait_queue, raw3270_request_final(rq)); |
583 | return -ERESTARTSYS; | 582 | return -ERESTARTSYS; |
584 | } | 583 | } |
585 | return rq->rc; | 584 | return rq->rc; |
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c index 9e784d5f7f57..ad05a87bc480 100644 --- a/drivers/s390/char/sclp_config.c +++ b/drivers/s390/char/sclp_config.c | |||
@@ -40,7 +40,7 @@ static void sclp_cpu_capability_notify(struct work_struct *work) | |||
40 | put_online_cpus(); | 40 | put_online_cpus(); |
41 | } | 41 | } |
42 | 42 | ||
43 | static void sclp_cpu_change_notify(struct work_struct *work) | 43 | static void __ref sclp_cpu_change_notify(struct work_struct *work) |
44 | { | 44 | { |
45 | smp_rescan_cpus(); | 45 | smp_rescan_cpus(); |
46 | } | 46 | } |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 35707c04e613..62576af36f47 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -71,9 +71,6 @@ static struct list_head sclp_vt220_outqueue; | |||
71 | /* Number of requests in outqueue */ | 71 | /* Number of requests in outqueue */ |
72 | static int sclp_vt220_outqueue_count; | 72 | static int sclp_vt220_outqueue_count; |
73 | 73 | ||
74 | /* Wait queue used to delay write requests while we've run out of buffers */ | ||
75 | static wait_queue_head_t sclp_vt220_waitq; | ||
76 | |||
77 | /* Timer used for delaying write requests to merge subsequent messages into | 74 | /* Timer used for delaying write requests to merge subsequent messages into |
78 | * a single buffer */ | 75 | * a single buffer */ |
79 | static struct timer_list sclp_vt220_timer; | 76 | static struct timer_list sclp_vt220_timer; |
@@ -133,7 +130,6 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request) | |||
133 | } while (request && __sclp_vt220_emit(request)); | 130 | } while (request && __sclp_vt220_emit(request)); |
134 | if (request == NULL && sclp_vt220_flush_later) | 131 | if (request == NULL && sclp_vt220_flush_later) |
135 | sclp_vt220_emit_current(); | 132 | sclp_vt220_emit_current(); |
136 | wake_up(&sclp_vt220_waitq); | ||
137 | /* Check if the tty needs a wake up call */ | 133 | /* Check if the tty needs a wake up call */ |
138 | if (sclp_vt220_tty != NULL) { | 134 | if (sclp_vt220_tty != NULL) { |
139 | tty_wakeup(sclp_vt220_tty); | 135 | tty_wakeup(sclp_vt220_tty); |
@@ -383,7 +379,7 @@ sclp_vt220_timeout(unsigned long data) | |||
383 | */ | 379 | */ |
384 | static int | 380 | static int |
385 | __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, | 381 | __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, |
386 | int convertlf, int may_schedule) | 382 | int convertlf, int may_fail) |
387 | { | 383 | { |
388 | unsigned long flags; | 384 | unsigned long flags; |
389 | void *page; | 385 | void *page; |
@@ -395,15 +391,14 @@ __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, | |||
395 | overall_written = 0; | 391 | overall_written = 0; |
396 | spin_lock_irqsave(&sclp_vt220_lock, flags); | 392 | spin_lock_irqsave(&sclp_vt220_lock, flags); |
397 | do { | 393 | do { |
398 | /* Create a sclp output buffer if none exists yet */ | 394 | /* Create an sclp output buffer if none exists yet */ |
399 | if (sclp_vt220_current_request == NULL) { | 395 | if (sclp_vt220_current_request == NULL) { |
400 | while (list_empty(&sclp_vt220_empty)) { | 396 | while (list_empty(&sclp_vt220_empty)) { |
401 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); | 397 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); |
402 | if (in_interrupt() || !may_schedule) | 398 | if (may_fail) |
403 | sclp_sync_wait(); | 399 | goto out; |
404 | else | 400 | else |
405 | wait_event(sclp_vt220_waitq, | 401 | sclp_sync_wait(); |
406 | !list_empty(&sclp_vt220_empty)); | ||
407 | spin_lock_irqsave(&sclp_vt220_lock, flags); | 402 | spin_lock_irqsave(&sclp_vt220_lock, flags); |
408 | } | 403 | } |
409 | page = (void *) sclp_vt220_empty.next; | 404 | page = (void *) sclp_vt220_empty.next; |
@@ -437,6 +432,7 @@ __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, | |||
437 | add_timer(&sclp_vt220_timer); | 432 | add_timer(&sclp_vt220_timer); |
438 | } | 433 | } |
439 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); | 434 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); |
435 | out: | ||
440 | return overall_written; | 436 | return overall_written; |
441 | } | 437 | } |
442 | 438 | ||
@@ -520,19 +516,11 @@ sclp_vt220_close(struct tty_struct *tty, struct file *filp) | |||
520 | * character to the tty device. If the kernel uses this routine, | 516 | * character to the tty device. If the kernel uses this routine, |
521 | * it must call the flush_chars() routine (if defined) when it is | 517 | * it must call the flush_chars() routine (if defined) when it is |
522 | * done stuffing characters into the driver. | 518 | * done stuffing characters into the driver. |
523 | * | ||
524 | * NOTE: include/linux/tty_driver.h specifies that a character should be | ||
525 | * ignored if there is no room in the queue. This driver implements a different | ||
526 | * semantic in that it will block when there is no more room left. | ||
527 | * | ||
528 | * FIXME: putchar can currently be called from BH and other non blocking | ||
529 | * handlers so this semantic isn't a good idea. | ||
530 | */ | 519 | */ |
531 | static int | 520 | static int |
532 | sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch) | 521 | sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch) |
533 | { | 522 | { |
534 | __sclp_vt220_write(&ch, 1, 0, 0, 1); | 523 | return __sclp_vt220_write(&ch, 1, 0, 0, 1); |
535 | return 1; | ||
536 | } | 524 | } |
537 | 525 | ||
538 | /* | 526 | /* |
@@ -653,7 +641,6 @@ static int __init __sclp_vt220_init(void) | |||
653 | spin_lock_init(&sclp_vt220_lock); | 641 | spin_lock_init(&sclp_vt220_lock); |
654 | INIT_LIST_HEAD(&sclp_vt220_empty); | 642 | INIT_LIST_HEAD(&sclp_vt220_empty); |
655 | INIT_LIST_HEAD(&sclp_vt220_outqueue); | 643 | INIT_LIST_HEAD(&sclp_vt220_outqueue); |
656 | init_waitqueue_head(&sclp_vt220_waitq); | ||
657 | init_timer(&sclp_vt220_timer); | 644 | init_timer(&sclp_vt220_timer); |
658 | sclp_vt220_current_request = NULL; | 645 | sclp_vt220_current_request = NULL; |
659 | sclp_vt220_buffered_chars = 0; | 646 | sclp_vt220_buffered_chars = 0; |
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h index dddf8d62c153..d0d565a05dfe 100644 --- a/drivers/s390/char/tape.h +++ b/drivers/s390/char/tape.h | |||
@@ -231,6 +231,9 @@ struct tape_device { | |||
231 | /* Request queue. */ | 231 | /* Request queue. */ |
232 | struct list_head req_queue; | 232 | struct list_head req_queue; |
233 | 233 | ||
234 | /* Request wait queue. */ | ||
235 | wait_queue_head_t wait_queue; | ||
236 | |||
234 | /* Each tape device has (currently) two minor numbers. */ | 237 | /* Each tape device has (currently) two minor numbers. */ |
235 | int first_minor; | 238 | int first_minor; |
236 | 239 | ||
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index ddc4a114e7f4..95da72bc17e8 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -179,11 +179,11 @@ tapeblock_requeue(struct work_struct *work) { | |||
179 | tapeblock_end_request(req, -EIO); | 179 | tapeblock_end_request(req, -EIO); |
180 | continue; | 180 | continue; |
181 | } | 181 | } |
182 | blkdev_dequeue_request(req); | ||
183 | nr_queued++; | ||
182 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 184 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
183 | rc = tapeblock_start_request(device, req); | 185 | rc = tapeblock_start_request(device, req); |
184 | spin_lock_irq(&device->blk_data.request_queue_lock); | 186 | spin_lock_irq(&device->blk_data.request_queue_lock); |
185 | blkdev_dequeue_request(req); | ||
186 | nr_queued++; | ||
187 | } | 187 | } |
188 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 188 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
189 | atomic_set(&device->blk_data.requeue_scheduled, 0); | 189 | atomic_set(&device->blk_data.requeue_scheduled, 0); |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index 76e44eb7c47f..c20e3c548343 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -449,6 +449,7 @@ tape_alloc_device(void) | |||
449 | INIT_LIST_HEAD(&device->req_queue); | 449 | INIT_LIST_HEAD(&device->req_queue); |
450 | INIT_LIST_HEAD(&device->node); | 450 | INIT_LIST_HEAD(&device->node); |
451 | init_waitqueue_head(&device->state_change_wq); | 451 | init_waitqueue_head(&device->state_change_wq); |
452 | init_waitqueue_head(&device->wait_queue); | ||
452 | device->tape_state = TS_INIT; | 453 | device->tape_state = TS_INIT; |
453 | device->medium_state = MS_UNKNOWN; | 454 | device->medium_state = MS_UNKNOWN; |
454 | *device->modeset_byte = 0; | 455 | *device->modeset_byte = 0; |
@@ -954,21 +955,19 @@ __tape_wake_up(struct tape_request *request, void *data) | |||
954 | int | 955 | int |
955 | tape_do_io(struct tape_device *device, struct tape_request *request) | 956 | tape_do_io(struct tape_device *device, struct tape_request *request) |
956 | { | 957 | { |
957 | wait_queue_head_t wq; | ||
958 | int rc; | 958 | int rc; |
959 | 959 | ||
960 | init_waitqueue_head(&wq); | ||
961 | spin_lock_irq(get_ccwdev_lock(device->cdev)); | 960 | spin_lock_irq(get_ccwdev_lock(device->cdev)); |
962 | /* Setup callback */ | 961 | /* Setup callback */ |
963 | request->callback = __tape_wake_up; | 962 | request->callback = __tape_wake_up; |
964 | request->callback_data = &wq; | 963 | request->callback_data = &device->wait_queue; |
965 | /* Add request to request queue and try to start it. */ | 964 | /* Add request to request queue and try to start it. */ |
966 | rc = __tape_start_request(device, request); | 965 | rc = __tape_start_request(device, request); |
967 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | 966 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); |
968 | if (rc) | 967 | if (rc) |
969 | return rc; | 968 | return rc; |
970 | /* Request added to the queue. Wait for its completion. */ | 969 | /* Request added to the queue. Wait for its completion. */ |
971 | wait_event(wq, (request->callback == NULL)); | 970 | wait_event(device->wait_queue, (request->callback == NULL)); |
972 | /* Get rc from request */ | 971 | /* Get rc from request */ |
973 | return request->rc; | 972 | return request->rc; |
974 | } | 973 | } |
@@ -989,20 +988,19 @@ int | |||
989 | tape_do_io_interruptible(struct tape_device *device, | 988 | tape_do_io_interruptible(struct tape_device *device, |
990 | struct tape_request *request) | 989 | struct tape_request *request) |
991 | { | 990 | { |
992 | wait_queue_head_t wq; | ||
993 | int rc; | 991 | int rc; |
994 | 992 | ||
995 | init_waitqueue_head(&wq); | ||
996 | spin_lock_irq(get_ccwdev_lock(device->cdev)); | 993 | spin_lock_irq(get_ccwdev_lock(device->cdev)); |
997 | /* Setup callback */ | 994 | /* Setup callback */ |
998 | request->callback = __tape_wake_up_interruptible; | 995 | request->callback = __tape_wake_up_interruptible; |
999 | request->callback_data = &wq; | 996 | request->callback_data = &device->wait_queue; |
1000 | rc = __tape_start_request(device, request); | 997 | rc = __tape_start_request(device, request); |
1001 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | 998 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); |
1002 | if (rc) | 999 | if (rc) |
1003 | return rc; | 1000 | return rc; |
1004 | /* Request added to the queue. Wait for its completion. */ | 1001 | /* Request added to the queue. Wait for its completion. */ |
1005 | rc = wait_event_interruptible(wq, (request->callback == NULL)); | 1002 | rc = wait_event_interruptible(device->wait_queue, |
1003 | (request->callback == NULL)); | ||
1006 | if (rc != -ERESTARTSYS) | 1004 | if (rc != -ERESTARTSYS) |
1007 | /* Request finished normally. */ | 1005 | /* Request finished normally. */ |
1008 | return request->rc; | 1006 | return request->rc; |
@@ -1015,7 +1013,7 @@ tape_do_io_interruptible(struct tape_device *device, | |||
1015 | /* Wait for the interrupt that acknowledges the halt. */ | 1013 | /* Wait for the interrupt that acknowledges the halt. */ |
1016 | do { | 1014 | do { |
1017 | rc = wait_event_interruptible( | 1015 | rc = wait_event_interruptible( |
1018 | wq, | 1016 | device->wait_queue, |
1019 | (request->callback == NULL) | 1017 | (request->callback == NULL) |
1020 | ); | 1018 | ); |
1021 | } while (rc == -ERESTARTSYS); | 1019 | } while (rc == -ERESTARTSYS); |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index e8487347e4d4..2c2428cc05d8 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -762,10 +762,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
762 | device_unregister(dev); | 762 | device_unregister(dev); |
763 | return ret; | 763 | return ret; |
764 | } | 764 | } |
765 | priv->class_device = device_create(vmlogrdr_class, dev, | 765 | priv->class_device = device_create_drvdata(vmlogrdr_class, dev, |
766 | MKDEV(vmlogrdr_major, | 766 | MKDEV(vmlogrdr_major, |
767 | priv->minor_num), | 767 | priv->minor_num), |
768 | "%s", dev->bus_id); | 768 | priv, "%s", dev->bus_id); |
769 | if (IS_ERR(priv->class_device)) { | 769 | if (IS_ERR(priv->class_device)) { |
770 | ret = PTR_ERR(priv->class_device); | 770 | ret = PTR_ERR(priv->class_device); |
771 | priv->class_device=NULL; | 771 | priv->class_device=NULL; |
@@ -773,7 +773,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
773 | device_unregister(dev); | 773 | device_unregister(dev); |
774 | return ret; | 774 | return ret; |
775 | } | 775 | } |
776 | dev->driver_data = priv; | ||
777 | priv->device = dev; | 776 | priv->device = dev; |
778 | return 0; | 777 | return 0; |
779 | } | 778 | } |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 9f55ce6f3c78..5ab34340919b 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -31,11 +31,6 @@ | |||
31 | */ | 31 | */ |
32 | static void *kvm_devices; | 32 | static void *kvm_devices; |
33 | 33 | ||
34 | /* | ||
35 | * Unique numbering for kvm devices. | ||
36 | */ | ||
37 | static unsigned int dev_index; | ||
38 | |||
39 | struct kvm_device { | 34 | struct kvm_device { |
40 | struct virtio_device vdev; | 35 | struct virtio_device vdev; |
41 | struct kvm_device_desc *desc; | 36 | struct kvm_device_desc *desc; |
@@ -250,26 +245,25 @@ static struct device kvm_root = { | |||
250 | * adds a new device and register it with virtio | 245 | * adds a new device and register it with virtio |
251 | * appropriate drivers are loaded by the device model | 246 | * appropriate drivers are loaded by the device model |
252 | */ | 247 | */ |
253 | static void add_kvm_device(struct kvm_device_desc *d) | 248 | static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset) |
254 | { | 249 | { |
255 | struct kvm_device *kdev; | 250 | struct kvm_device *kdev; |
256 | 251 | ||
257 | kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); | 252 | kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); |
258 | if (!kdev) { | 253 | if (!kdev) { |
259 | printk(KERN_EMERG "Cannot allocate kvm dev %u\n", | 254 | printk(KERN_EMERG "Cannot allocate kvm dev %u type %u\n", |
260 | dev_index++); | 255 | offset, d->type); |
261 | return; | 256 | return; |
262 | } | 257 | } |
263 | 258 | ||
264 | kdev->vdev.dev.parent = &kvm_root; | 259 | kdev->vdev.dev.parent = &kvm_root; |
265 | kdev->vdev.index = dev_index++; | ||
266 | kdev->vdev.id.device = d->type; | 260 | kdev->vdev.id.device = d->type; |
267 | kdev->vdev.config = &kvm_vq_configspace_ops; | 261 | kdev->vdev.config = &kvm_vq_configspace_ops; |
268 | kdev->desc = d; | 262 | kdev->desc = d; |
269 | 263 | ||
270 | if (register_virtio_device(&kdev->vdev) != 0) { | 264 | if (register_virtio_device(&kdev->vdev) != 0) { |
271 | printk(KERN_ERR "Failed to register kvm device %u\n", | 265 | printk(KERN_ERR "Failed to register kvm device %u type %u\n", |
272 | kdev->vdev.index); | 266 | offset, d->type); |
273 | kfree(kdev); | 267 | kfree(kdev); |
274 | } | 268 | } |
275 | } | 269 | } |
@@ -289,7 +283,7 @@ static void scan_devices(void) | |||
289 | if (d->type == 0) | 283 | if (d->type == 0) |
290 | break; | 284 | break; |
291 | 285 | ||
292 | add_kvm_device(d); | 286 | add_kvm_device(d, i); |
293 | } | 287 | } |
294 | } | 288 | } |
295 | 289 | ||
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index b87037ec9805..03c966059471 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c | |||
@@ -869,7 +869,7 @@ static void probeLptPort(unsigned idx) | |||
869 | instances[idx].mode = COMPATIBILITY; | 869 | instances[idx].mode = COMPATIBILITY; |
870 | instances[idx].run_length = 0; | 870 | instances[idx].run_length = 0; |
871 | instances[idx].run_flag = 0; | 871 | instances[idx].run_flag = 0; |
872 | if (!request_region(lpAddr,3, dev_name)) return; | 872 | if (!request_region(lpAddr,3, bpp_dev_name)) return; |
873 | 873 | ||
874 | /* | 874 | /* |
875 | * First, make sure the instance exists. Do this by writing to | 875 | * First, make sure the instance exists. Do this by writing to |
@@ -1021,7 +1021,7 @@ static int __init bpp_init(void) | |||
1021 | if (rc == 0) | 1021 | if (rc == 0) |
1022 | return -ENODEV; | 1022 | return -ENODEV; |
1023 | 1023 | ||
1024 | rc = register_chrdev(BPP_MAJOR, dev_name, &bpp_fops); | 1024 | rc = register_chrdev(BPP_MAJOR, bpp_dev_name, &bpp_fops); |
1025 | if (rc < 0) | 1025 | if (rc < 0) |
1026 | return rc; | 1026 | return rc; |
1027 | 1027 | ||
@@ -1037,7 +1037,7 @@ static void __exit bpp_cleanup(void) | |||
1037 | { | 1037 | { |
1038 | unsigned idx; | 1038 | unsigned idx; |
1039 | 1039 | ||
1040 | unregister_chrdev(BPP_MAJOR, dev_name); | 1040 | unregister_chrdev(BPP_MAJOR, bpp_dev_name); |
1041 | 1041 | ||
1042 | for (idx = 0; idx < BPP_NO; idx++) { | 1042 | for (idx = 0; idx < BPP_NO; idx++) { |
1043 | if (instances[idx].present) | 1043 | if (instances[idx].present) |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index b31faeccb9cd..867f6fd5c2c0 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1278 | error = 0; | 1278 | error = 0; |
1279 | /* Check for command packet errors */ | 1279 | /* Check for command packet errors */ |
1280 | if (full_command_packet->command.newcommand.status != 0) { | 1280 | if (full_command_packet->command.newcommand.status != 0) { |
1281 | if (tw_dev->srb[request_id] != 0) { | 1281 | if (tw_dev->srb[request_id] != NULL) { |
1282 | error = twa_fill_sense(tw_dev, request_id, 1, 1); | 1282 | error = twa_fill_sense(tw_dev, request_id, 1, 1); |
1283 | } else { | 1283 | } else { |
1284 | /* Skip ioctl error prints */ | 1284 | /* Skip ioctl error prints */ |
@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1290 | 1290 | ||
1291 | /* Check for correct state */ | 1291 | /* Check for correct state */ |
1292 | if (tw_dev->state[request_id] != TW_S_POSTED) { | 1292 | if (tw_dev->state[request_id] != TW_S_POSTED) { |
1293 | if (tw_dev->srb[request_id] != 0) { | 1293 | if (tw_dev->srb[request_id] != NULL) { |
1294 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted"); | 1294 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted"); |
1295 | TW_CLEAR_ALL_INTERRUPTS(tw_dev); | 1295 | TW_CLEAR_ALL_INTERRUPTS(tw_dev); |
1296 | goto twa_interrupt_bail; | 1296 | goto twa_interrupt_bail; |
@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | /* Check for internal command completion */ | 1300 | /* Check for internal command completion */ |
1301 | if (tw_dev->srb[request_id] == 0) { | 1301 | if (tw_dev->srb[request_id] == NULL) { |
1302 | if (request_id != tw_dev->chrdev_request_id) { | 1302 | if (request_id != tw_dev->chrdev_request_id) { |
1303 | if (twa_aen_complete(tw_dev, request_id)) | 1303 | if (twa_aen_complete(tw_dev, request_id)) |
1304 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt"); | 1304 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt"); |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 1dca1775f4b1..0899cb61e3dd 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup *setup) | |||
3582 | if (i == ARRAY_SIZE(ports)) | 3582 | if (i == ARRAY_SIZE(ports)) |
3583 | return 0; | 3583 | return 0; |
3584 | 3584 | ||
3585 | if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) { | 3585 | if (!request_region(setup->io_port, IO_RANGE, "aha152x")) { |
3586 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port); | 3586 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port); |
3587 | return 0; | 3587 | return 0; |
3588 | } | 3588 | } |
@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void) | |||
3842 | if ((setup_count == 1) && (setup[0].io_port == ports[i])) | 3842 | if ((setup_count == 1) && (setup[0].io_port == ports[i])) |
3843 | continue; | 3843 | continue; |
3844 | 3844 | ||
3845 | if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) { | 3845 | if (!request_region(ports[i], IO_RANGE, "aha152x")) { |
3846 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]); | 3846 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]); |
3847 | continue; | 3847 | continue; |
3848 | } | 3848 | } |
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index db6de5e6afb3..7d311541c76c 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c) | |||
747 | dev->quhd[c] = 0; | 747 | dev->quhd[c] = 0; |
748 | } | 748 | } |
749 | workreq = dev->quereq[c][dev->quhd[c]]; | 749 | workreq = dev->quereq[c][dev->quhd[c]]; |
750 | if (dev->id[c][scmd_id(workreq)].curr_req == 0) { | 750 | if (dev->id[c][scmd_id(workreq)].curr_req == NULL) { |
751 | dev->id[c][scmd_id(workreq)].curr_req = workreq; | 751 | dev->id[c][scmd_id(workreq)].curr_req = workreq; |
752 | dev->last_cmd[c] = scmd_id(workreq); | 752 | dev->last_cmd[c] = scmd_id(workreq); |
753 | goto cmd_subp; | 753 | goto cmd_subp; |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 75c84d7b9ce8..c4b938bc30d3 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -910,9 +910,9 @@ static int ch_probe(struct device *dev) | |||
910 | ch->minor = minor; | 910 | ch->minor = minor; |
911 | sprintf(ch->name,"ch%d",ch->minor); | 911 | sprintf(ch->name,"ch%d",ch->minor); |
912 | 912 | ||
913 | class_dev = device_create(ch_sysfs_class, dev, | 913 | class_dev = device_create_drvdata(ch_sysfs_class, dev, |
914 | MKDEV(SCSI_CHANGER_MAJOR,ch->minor), | 914 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), |
915 | "s%s", ch->name); | 915 | ch, "s%s", ch->name); |
916 | if (IS_ERR(class_dev)) { | 916 | if (IS_ERR(class_dev)) { |
917 | printk(KERN_WARNING "ch%d: device_create failed\n", | 917 | printk(KERN_WARNING "ch%d: device_create failed\n", |
918 | ch->minor); | 918 | ch->minor); |
@@ -926,7 +926,6 @@ static int ch_probe(struct device *dev) | |||
926 | if (init) | 926 | if (init) |
927 | ch_init_elem(ch); | 927 | ch_init_elem(ch); |
928 | 928 | ||
929 | dev_set_drvdata(dev, ch); | ||
930 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); | 929 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); |
931 | 930 | ||
932 | return 0; | 931 | return 0; |
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index aaa48e0c8ed0..da876d3924be 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index) | |||
444 | if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) { | 444 | if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) { |
445 | printk(KERN_ERR "scsi%d: pci resource invalid\n", | 445 | printk(KERN_ERR "scsi%d: pci resource invalid\n", |
446 | hba->host->host_no); | 446 | hba->host->host_no); |
447 | return 0; | 447 | return NULL; |
448 | } | 448 | } |
449 | 449 | ||
450 | mem_base_phy = pci_resource_start(pcidev, index); | 450 | mem_base_phy = pci_resource_start(pcidev, index); |
@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index) | |||
454 | if (!mem_base_virt) { | 454 | if (!mem_base_virt) { |
455 | printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n", | 455 | printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n", |
456 | hba->host->host_no); | 456 | hba->host->host_no); |
457 | return 0; | 457 | return NULL; |
458 | } | 458 | } |
459 | return mem_base_virt; | 459 | return mem_base_virt; |
460 | } | 460 | } |
@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct hptiop_hba *hba) | |||
476 | static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba) | 476 | static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba) |
477 | { | 477 | { |
478 | hba->u.mv.regs = hptiop_map_pci_bar(hba, 0); | 478 | hba->u.mv.regs = hptiop_map_pci_bar(hba, 0); |
479 | if (hba->u.mv.regs == 0) | 479 | if (hba->u.mv.regs == NULL) |
480 | return -1; | 480 | return -1; |
481 | 481 | ||
482 | hba->u.mv.mu = hptiop_map_pci_bar(hba, 2); | 482 | hba->u.mv.mu = hptiop_map_pci_bar(hba, 2); |
483 | if (hba->u.mv.mu == 0) { | 483 | if (hba->u.mv.mu == NULL) { |
484 | iounmap(hba->u.mv.regs); | 484 | iounmap(hba->u.mv.regs); |
485 | return -1; | 485 | return -1; |
486 | } | 486 | } |
@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev *pcidev) | |||
1210 | 1210 | ||
1211 | static struct hptiop_adapter_ops hptiop_itl_ops = { | 1211 | static struct hptiop_adapter_ops hptiop_itl_ops = { |
1212 | .iop_wait_ready = iop_wait_ready_itl, | 1212 | .iop_wait_ready = iop_wait_ready_itl, |
1213 | .internal_memalloc = 0, | 1213 | .internal_memalloc = NULL, |
1214 | .internal_memfree = 0, | 1214 | .internal_memfree = NULL, |
1215 | .map_pci_bar = hptiop_map_pci_bar_itl, | 1215 | .map_pci_bar = hptiop_map_pci_bar_itl, |
1216 | .unmap_pci_bar = hptiop_unmap_pci_bar_itl, | 1216 | .unmap_pci_bar = hptiop_unmap_pci_bar_itl, |
1217 | .enable_intr = hptiop_enable_intr_itl, | 1217 | .enable_intr = hptiop_enable_intr_itl, |
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index cd37bd69a115..887682a24e36 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c | |||
@@ -650,7 +650,7 @@ static void __exit mac_esp_exit(void) | |||
650 | 650 | ||
651 | MODULE_DESCRIPTION("Mac ESP SCSI driver"); | 651 | MODULE_DESCRIPTION("Mac ESP SCSI driver"); |
652 | MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); | 652 | MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); |
653 | MODULE_LICENSE("GPLv2"); | 653 | MODULE_LICENSE("GPL v2"); |
654 | MODULE_VERSION(DRV_VERSION); | 654 | MODULE_VERSION(DRV_VERSION); |
655 | 655 | ||
656 | module_init(mac_esp_init); | 656 | module_init(mac_esp_init); |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 31f7aec44d90..243d8becd30f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5695,13 +5695,12 @@ static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * S | |||
5695 | struct device *osst_member; | 5695 | struct device *osst_member; |
5696 | int err; | 5696 | int err; |
5697 | 5697 | ||
5698 | osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); | 5698 | osst_member = device_create_drvdata(osst_sysfs_class, device, dev, STp, "%s", name); |
5699 | if (IS_ERR(osst_member)) { | 5699 | if (IS_ERR(osst_member)) { |
5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); | 5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); |
5701 | return PTR_ERR(osst_member); | 5701 | return PTR_ERR(osst_member); |
5702 | } | 5702 | } |
5703 | 5703 | ||
5704 | dev_set_drvdata(osst_member, STp); | ||
5705 | err = device_create_file(osst_member, &dev_attr_ADR_rev); | 5704 | err = device_create_file(osst_member, &dev_attr_ADR_rev); |
5706 | if (err) | 5705 | if (err) |
5707 | goto err_out; | 5706 | goto err_out; |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 51e2f299dbbb..3754ab87f89a 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
2811 | 2811 | ||
2812 | /* Check for room in outstanding command list. */ | 2812 | /* Check for room in outstanding command list. */ |
2813 | for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS && | 2813 | for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS && |
2814 | ha->outstanding_cmds[cnt] != 0; cnt++); | 2814 | ha->outstanding_cmds[cnt] != NULL; cnt++); |
2815 | 2815 | ||
2816 | if (cnt >= MAX_OUTSTANDING_COMMANDS) { | 2816 | if (cnt >= MAX_OUTSTANDING_COMMANDS) { |
2817 | status = 1; | 2817 | status = 1; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index c9d7f721b9e2..ea0edd1b2e76 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1441,17 +1441,18 @@ sg_add(struct device *cl_dev, struct class_interface *cl_intf) | |||
1441 | if (sg_sysfs_valid) { | 1441 | if (sg_sysfs_valid) { |
1442 | struct device *sg_class_member; | 1442 | struct device *sg_class_member; |
1443 | 1443 | ||
1444 | sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, | 1444 | sg_class_member = device_create_drvdata(sg_sysfs_class, |
1445 | MKDEV(SCSI_GENERIC_MAJOR, | 1445 | cl_dev->parent, |
1446 | sdp->index), | 1446 | MKDEV(SCSI_GENERIC_MAJOR, |
1447 | "%s", disk->disk_name); | 1447 | sdp->index), |
1448 | sdp, | ||
1449 | "%s", disk->disk_name); | ||
1448 | if (IS_ERR(sg_class_member)) { | 1450 | if (IS_ERR(sg_class_member)) { |
1449 | printk(KERN_ERR "sg_add: " | 1451 | printk(KERN_ERR "sg_add: " |
1450 | "device_create failed\n"); | 1452 | "device_create failed\n"); |
1451 | error = PTR_ERR(sg_class_member); | 1453 | error = PTR_ERR(sg_class_member); |
1452 | goto cdev_add_err; | 1454 | goto cdev_add_err; |
1453 | } | 1455 | } |
1454 | dev_set_drvdata(sg_class_member, sdp); | ||
1455 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, | 1456 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, |
1456 | &sg_class_member->kobj, "generic"); | 1457 | &sg_class_member->kobj, "generic"); |
1457 | if (error) | 1458 | if (error) |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index e8db66ad0bde..6e5a5bb31311 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4424,17 +4424,19 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | |||
4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", | 4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", |
4425 | STp->disk->disk_name, st_formats[i]); | 4425 | STp->disk->disk_name, st_formats[i]); |
4426 | st_class_member = | 4426 | st_class_member = |
4427 | device_create(st_sysfs_class, &STp->device->sdev_gendev, | 4427 | device_create_drvdata(st_sysfs_class, |
4428 | MKDEV(SCSI_TAPE_MAJOR, | 4428 | &STp->device->sdev_gendev, |
4429 | TAPE_MINOR(dev_num, mode, rew)), | 4429 | MKDEV(SCSI_TAPE_MAJOR, |
4430 | "%s", name); | 4430 | TAPE_MINOR(dev_num, |
4431 | mode, rew)), | ||
4432 | &STp->modes[mode], | ||
4433 | "%s", name); | ||
4431 | if (IS_ERR(st_class_member)) { | 4434 | if (IS_ERR(st_class_member)) { |
4432 | printk(KERN_WARNING "st%d: device_create failed\n", | 4435 | printk(KERN_WARNING "st%d: device_create failed\n", |
4433 | dev_num); | 4436 | dev_num); |
4434 | error = PTR_ERR(st_class_member); | 4437 | error = PTR_ERR(st_class_member); |
4435 | goto out; | 4438 | goto out; |
4436 | } | 4439 | } |
4437 | dev_set_drvdata(st_class_member, &STp->modes[mode]); | ||
4438 | 4440 | ||
4439 | error = device_create_file(st_class_member, | 4441 | error = device_create_file(st_class_member, |
4440 | &dev_attr_defined); | 4442 | &dev_attr_defined); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 1400ea6a2491..1bc00b721e9d 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #include <asm/io.h> | 44 | #include <asm/io.h> |
45 | #include <asm/irq.h> | 45 | #include <asm/irq.h> |
46 | #include <asm/serial.h> | ||
47 | 46 | ||
48 | #include "8250.h" | 47 | #include "8250.h" |
49 | 48 | ||
@@ -93,6 +92,7 @@ static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; | |||
93 | */ | 92 | */ |
94 | #define CONFIG_HUB6 1 | 93 | #define CONFIG_HUB6 1 |
95 | 94 | ||
95 | #include <asm/serial.h> | ||
96 | /* | 96 | /* |
97 | * SERIAL_PORT_DFNS tells us about built-in ports that have no | 97 | * SERIAL_PORT_DFNS tells us about built-in ports that have no |
98 | * standard enumeration mechanism. Platforms that can find all | 98 | * standard enumeration mechanism. Platforms that can find all |
@@ -1547,8 +1547,6 @@ static int serial_link_irq_chain(struct uart_8250_port *up) | |||
1547 | i->head = &up->list; | 1547 | i->head = &up->list; |
1548 | spin_unlock_irq(&i->lock); | 1548 | spin_unlock_irq(&i->lock); |
1549 | 1549 | ||
1550 | irq_flags |= SERIAL_EXTRA_IRQ_FLAGS; | ||
1551 | |||
1552 | ret = request_irq(up->port.irq, serial8250_interrupt, | 1550 | ret = request_irq(up->port.irq, serial8250_interrupt, |
1553 | irq_flags, "serial", i); | 1551 | irq_flags, "serial", i); |
1554 | if (ret < 0) | 1552 | if (ret < 0) |
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h index a10a40cc0d9e..91bd28f2bb47 100644 --- a/drivers/serial/8250.h +++ b/drivers/serial/8250.h | |||
@@ -78,8 +78,3 @@ struct serial8250_config { | |||
78 | #else | 78 | #else |
79 | #define ALPHA_KLUDGE_MCR 0 | 79 | #define ALPHA_KLUDGE_MCR 0 |
80 | #endif | 80 | #endif |
81 | |||
82 | #ifndef SERIAL_EXTRA_IRQ_FLAGS | ||
83 | #define SERIAL_EXTRA_IRQ_FLAGS 0 | ||
84 | #endif | ||
85 | |||
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 53fa19cf2f06..788c3559522d 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -2602,7 +2602,12 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2602 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, | 2602 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, |
2603 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */ | 2603 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */ |
2604 | pbn_b2_2_115200 }, | 2604 | pbn_b2_2_115200 }, |
2605 | 2605 | /* | |
2606 | * IntaShield IS-400 | ||
2607 | */ | ||
2608 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, | ||
2609 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ | ||
2610 | pbn_b2_4_115200 }, | ||
2606 | /* | 2611 | /* |
2607 | * Perle PCI-RAS cards | 2612 | * Perle PCI-RAS cards |
2608 | */ | 2613 | */ |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index eab032733790..53b03c629aff 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2054,6 +2054,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
2054 | int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | 2054 | int uart_resume_port(struct uart_driver *drv, struct uart_port *port) |
2055 | { | 2055 | { |
2056 | struct uart_state *state = drv->state + port->line; | 2056 | struct uart_state *state = drv->state + port->line; |
2057 | struct device *tty_dev; | ||
2058 | struct uart_match match = {port, drv}; | ||
2057 | 2059 | ||
2058 | mutex_lock(&state->mutex); | 2060 | mutex_lock(&state->mutex); |
2059 | 2061 | ||
@@ -2063,7 +2065,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
2063 | return 0; | 2065 | return 0; |
2064 | } | 2066 | } |
2065 | 2067 | ||
2066 | if (!port->suspended) { | 2068 | tty_dev = device_find_child(port->dev, &match, serial_match_port); |
2069 | if (!port->suspended && device_may_wakeup(tty_dev)) { | ||
2067 | disable_irq_wake(port->irq); | 2070 | disable_irq_wake(port->irq); |
2068 | mutex_unlock(&state->mutex); | 2071 | mutex_unlock(&state->mutex); |
2069 | return 0; | 2072 | return 0; |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index 145c0281495d..2847336742d7 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
@@ -499,7 +499,6 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig | |||
499 | } else | 499 | } else |
500 | spin_lock(&port->lock); | 500 | spin_lock(&port->lock); |
501 | 501 | ||
502 | spin_lock_irqsave(&port->lock, flags); | ||
503 | for (i = 0; i < n; i++) { | 502 | for (i = 0; i < n; i++) { |
504 | if (*s == '\n') | 503 | if (*s == '\n') |
505 | sunhv_console_putchar(port, '\r'); | 504 | sunhv_console_putchar(port, '\r'); |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index b3518ca9f04e..41620c0fb046 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -68,6 +68,7 @@ static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG]; | |||
68 | 68 | ||
69 | struct spidev_data { | 69 | struct spidev_data { |
70 | struct device dev; | 70 | struct device dev; |
71 | spinlock_t spi_lock; | ||
71 | struct spi_device *spi; | 72 | struct spi_device *spi; |
72 | struct list_head device_entry; | 73 | struct list_head device_entry; |
73 | 74 | ||
@@ -85,12 +86,75 @@ MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message"); | |||
85 | 86 | ||
86 | /*-------------------------------------------------------------------------*/ | 87 | /*-------------------------------------------------------------------------*/ |
87 | 88 | ||
89 | /* | ||
90 | * We can't use the standard synchronous wrappers for file I/O; we | ||
91 | * need to protect against async removal of the underlying spi_device. | ||
92 | */ | ||
93 | static void spidev_complete(void *arg) | ||
94 | { | ||
95 | complete(arg); | ||
96 | } | ||
97 | |||
98 | static ssize_t | ||
99 | spidev_sync(struct spidev_data *spidev, struct spi_message *message) | ||
100 | { | ||
101 | DECLARE_COMPLETION_ONSTACK(done); | ||
102 | int status; | ||
103 | |||
104 | message->complete = spidev_complete; | ||
105 | message->context = &done; | ||
106 | |||
107 | spin_lock_irq(&spidev->spi_lock); | ||
108 | if (spidev->spi == NULL) | ||
109 | status = -ESHUTDOWN; | ||
110 | else | ||
111 | status = spi_async(spidev->spi, message); | ||
112 | spin_unlock_irq(&spidev->spi_lock); | ||
113 | |||
114 | if (status == 0) { | ||
115 | wait_for_completion(&done); | ||
116 | status = message->status; | ||
117 | if (status == 0) | ||
118 | status = message->actual_length; | ||
119 | } | ||
120 | return status; | ||
121 | } | ||
122 | |||
123 | static inline ssize_t | ||
124 | spidev_sync_write(struct spidev_data *spidev, size_t len) | ||
125 | { | ||
126 | struct spi_transfer t = { | ||
127 | .tx_buf = spidev->buffer, | ||
128 | .len = len, | ||
129 | }; | ||
130 | struct spi_message m; | ||
131 | |||
132 | spi_message_init(&m); | ||
133 | spi_message_add_tail(&t, &m); | ||
134 | return spidev_sync(spidev, &m); | ||
135 | } | ||
136 | |||
137 | static inline ssize_t | ||
138 | spidev_sync_read(struct spidev_data *spidev, size_t len) | ||
139 | { | ||
140 | struct spi_transfer t = { | ||
141 | .rx_buf = spidev->buffer, | ||
142 | .len = len, | ||
143 | }; | ||
144 | struct spi_message m; | ||
145 | |||
146 | spi_message_init(&m); | ||
147 | spi_message_add_tail(&t, &m); | ||
148 | return spidev_sync(spidev, &m); | ||
149 | } | ||
150 | |||
151 | /*-------------------------------------------------------------------------*/ | ||
152 | |||
88 | /* Read-only message with current device setup */ | 153 | /* Read-only message with current device setup */ |
89 | static ssize_t | 154 | static ssize_t |
90 | spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) | 155 | spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) |
91 | { | 156 | { |
92 | struct spidev_data *spidev; | 157 | struct spidev_data *spidev; |
93 | struct spi_device *spi; | ||
94 | ssize_t status = 0; | 158 | ssize_t status = 0; |
95 | 159 | ||
96 | /* chipselect only toggles at start or end of operation */ | 160 | /* chipselect only toggles at start or end of operation */ |
@@ -98,10 +162,9 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) | |||
98 | return -EMSGSIZE; | 162 | return -EMSGSIZE; |
99 | 163 | ||
100 | spidev = filp->private_data; | 164 | spidev = filp->private_data; |
101 | spi = spidev->spi; | ||
102 | 165 | ||
103 | mutex_lock(&spidev->buf_lock); | 166 | mutex_lock(&spidev->buf_lock); |
104 | status = spi_read(spi, spidev->buffer, count); | 167 | status = spidev_sync_read(spidev, count); |
105 | if (status == 0) { | 168 | if (status == 0) { |
106 | unsigned long missing; | 169 | unsigned long missing; |
107 | 170 | ||
@@ -122,7 +185,6 @@ spidev_write(struct file *filp, const char __user *buf, | |||
122 | size_t count, loff_t *f_pos) | 185 | size_t count, loff_t *f_pos) |
123 | { | 186 | { |
124 | struct spidev_data *spidev; | 187 | struct spidev_data *spidev; |
125 | struct spi_device *spi; | ||
126 | ssize_t status = 0; | 188 | ssize_t status = 0; |
127 | unsigned long missing; | 189 | unsigned long missing; |
128 | 190 | ||
@@ -131,12 +193,11 @@ spidev_write(struct file *filp, const char __user *buf, | |||
131 | return -EMSGSIZE; | 193 | return -EMSGSIZE; |
132 | 194 | ||
133 | spidev = filp->private_data; | 195 | spidev = filp->private_data; |
134 | spi = spidev->spi; | ||
135 | 196 | ||
136 | mutex_lock(&spidev->buf_lock); | 197 | mutex_lock(&spidev->buf_lock); |
137 | missing = copy_from_user(spidev->buffer, buf, count); | 198 | missing = copy_from_user(spidev->buffer, buf, count); |
138 | if (missing == 0) { | 199 | if (missing == 0) { |
139 | status = spi_write(spi, spidev->buffer, count); | 200 | status = spidev_sync_write(spidev, count); |
140 | if (status == 0) | 201 | if (status == 0) |
141 | status = count; | 202 | status = count; |
142 | } else | 203 | } else |
@@ -153,7 +214,6 @@ static int spidev_message(struct spidev_data *spidev, | |||
153 | struct spi_transfer *k_xfers; | 214 | struct spi_transfer *k_xfers; |
154 | struct spi_transfer *k_tmp; | 215 | struct spi_transfer *k_tmp; |
155 | struct spi_ioc_transfer *u_tmp; | 216 | struct spi_ioc_transfer *u_tmp; |
156 | struct spi_device *spi = spidev->spi; | ||
157 | unsigned n, total; | 217 | unsigned n, total; |
158 | u8 *buf; | 218 | u8 *buf; |
159 | int status = -EFAULT; | 219 | int status = -EFAULT; |
@@ -215,7 +275,7 @@ static int spidev_message(struct spidev_data *spidev, | |||
215 | spi_message_add_tail(k_tmp, &msg); | 275 | spi_message_add_tail(k_tmp, &msg); |
216 | } | 276 | } |
217 | 277 | ||
218 | status = spi_sync(spi, &msg); | 278 | status = spidev_sync(spidev, &msg); |
219 | if (status < 0) | 279 | if (status < 0) |
220 | goto done; | 280 | goto done; |
221 | 281 | ||
@@ -269,8 +329,16 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
269 | if (err) | 329 | if (err) |
270 | return -EFAULT; | 330 | return -EFAULT; |
271 | 331 | ||
332 | /* guard against device removal before, or while, | ||
333 | * we issue this ioctl. | ||
334 | */ | ||
272 | spidev = filp->private_data; | 335 | spidev = filp->private_data; |
273 | spi = spidev->spi; | 336 | spin_lock_irq(&spidev->spi_lock); |
337 | spi = spi_dev_get(spidev->spi); | ||
338 | spin_unlock_irq(&spidev->spi_lock); | ||
339 | |||
340 | if (spi == NULL) | ||
341 | return -ESHUTDOWN; | ||
274 | 342 | ||
275 | switch (cmd) { | 343 | switch (cmd) { |
276 | /* read requests */ | 344 | /* read requests */ |
@@ -356,8 +424,10 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
356 | default: | 424 | default: |
357 | /* segmented and/or full-duplex I/O request */ | 425 | /* segmented and/or full-duplex I/O request */ |
358 | if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0)) | 426 | if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0)) |
359 | || _IOC_DIR(cmd) != _IOC_WRITE) | 427 | || _IOC_DIR(cmd) != _IOC_WRITE) { |
360 | return -ENOTTY; | 428 | retval = -ENOTTY; |
429 | break; | ||
430 | } | ||
361 | 431 | ||
362 | tmp = _IOC_SIZE(cmd); | 432 | tmp = _IOC_SIZE(cmd); |
363 | if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) { | 433 | if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) { |
@@ -385,6 +455,7 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
385 | kfree(ioc); | 455 | kfree(ioc); |
386 | break; | 456 | break; |
387 | } | 457 | } |
458 | spi_dev_put(spi); | ||
388 | return retval; | 459 | return retval; |
389 | } | 460 | } |
390 | 461 | ||
@@ -488,6 +559,7 @@ static int spidev_probe(struct spi_device *spi) | |||
488 | 559 | ||
489 | /* Initialize the driver data */ | 560 | /* Initialize the driver data */ |
490 | spidev->spi = spi; | 561 | spidev->spi = spi; |
562 | spin_lock_init(&spidev->spi_lock); | ||
491 | mutex_init(&spidev->buf_lock); | 563 | mutex_init(&spidev->buf_lock); |
492 | 564 | ||
493 | INIT_LIST_HEAD(&spidev->device_entry); | 565 | INIT_LIST_HEAD(&spidev->device_entry); |
@@ -526,13 +598,17 @@ static int spidev_remove(struct spi_device *spi) | |||
526 | { | 598 | { |
527 | struct spidev_data *spidev = dev_get_drvdata(&spi->dev); | 599 | struct spidev_data *spidev = dev_get_drvdata(&spi->dev); |
528 | 600 | ||
529 | mutex_lock(&device_list_lock); | 601 | /* make sure ops on existing fds can abort cleanly */ |
602 | spin_lock_irq(&spidev->spi_lock); | ||
603 | spidev->spi = NULL; | ||
604 | spin_unlock_irq(&spidev->spi_lock); | ||
530 | 605 | ||
606 | /* prevent new opens */ | ||
607 | mutex_lock(&device_list_lock); | ||
531 | list_del(&spidev->device_entry); | 608 | list_del(&spidev->device_entry); |
532 | dev_set_drvdata(&spi->dev, NULL); | 609 | dev_set_drvdata(&spi->dev, NULL); |
533 | clear_bit(MINOR(spidev->dev.devt), minors); | 610 | clear_bit(MINOR(spidev->dev.devt), minors); |
534 | device_unregister(&spidev->dev); | 611 | device_unregister(&spidev->dev); |
535 | |||
536 | mutex_unlock(&device_list_lock); | 612 | mutex_unlock(&device_list_lock); |
537 | 613 | ||
538 | return 0; | 614 | return 0; |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 55cc7b80422a..0a12e90ad416 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -649,15 +649,14 @@ int __uio_register_device(struct module *owner, | |||
649 | if (ret) | 649 | if (ret) |
650 | goto err_get_minor; | 650 | goto err_get_minor; |
651 | 651 | ||
652 | idev->dev = device_create(uio_class->class, parent, | 652 | idev->dev = device_create_drvdata(uio_class->class, parent, |
653 | MKDEV(uio_major, idev->minor), | 653 | MKDEV(uio_major, idev->minor), idev, |
654 | "uio%d", idev->minor); | 654 | "uio%d", idev->minor); |
655 | if (IS_ERR(idev->dev)) { | 655 | if (IS_ERR(idev->dev)) { |
656 | printk(KERN_ERR "UIO: device register failed\n"); | 656 | printk(KERN_ERR "UIO: device register failed\n"); |
657 | ret = PTR_ERR(idev->dev); | 657 | ret = PTR_ERR(idev->dev); |
658 | goto err_device_create; | 658 | goto err_device_create; |
659 | } | 659 | } |
660 | dev_set_drvdata(idev->dev, idev); | ||
661 | 660 | ||
662 | ret = uio_dev_add_attributes(idev); | 661 | ret = uio_dev_add_attributes(idev); |
663 | if (ret) | 662 | if (ret) |
diff --git a/drivers/usb/class/Kconfig b/drivers/usb/class/Kconfig index 3a9102d2591b..66f17ed88cb5 100644 --- a/drivers/usb/class/Kconfig +++ b/drivers/usb/class/Kconfig | |||
@@ -29,3 +29,14 @@ config USB_PRINTER | |||
29 | To compile this driver as a module, choose M here: the | 29 | To compile this driver as a module, choose M here: the |
30 | module will be called usblp. | 30 | module will be called usblp. |
31 | 31 | ||
32 | config USB_WDM | ||
33 | tristate "USB Wireless Device Management support" | ||
34 | depends on USB | ||
35 | ---help--- | ||
36 | This driver supports the WMC Device Management functionality | ||
37 | of cell phones compliant to the CDC WMC specification. You can use | ||
38 | AT commands over this device. | ||
39 | |||
40 | To compile this driver as a module, choose M here: the | ||
41 | module will be called cdc-wdm. | ||
42 | |||
diff --git a/drivers/usb/class/Makefile b/drivers/usb/class/Makefile index cc391e6c2af8..535d59a30600 100644 --- a/drivers/usb/class/Makefile +++ b/drivers/usb/class/Makefile | |||
@@ -5,3 +5,4 @@ | |||
5 | 5 | ||
6 | obj-$(CONFIG_USB_ACM) += cdc-acm.o | 6 | obj-$(CONFIG_USB_ACM) += cdc-acm.o |
7 | obj-$(CONFIG_USB_PRINTER) += usblp.o | 7 | obj-$(CONFIG_USB_PRINTER) += usblp.o |
8 | obj-$(CONFIG_USB_WDM) += cdc-wdm.o | ||
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c new file mode 100644 index 000000000000..107666d4e2ec --- /dev/null +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -0,0 +1,740 @@ | |||
1 | /* | ||
2 | * cdc-wdm.c | ||
3 | * | ||
4 | * This driver supports USB CDC WCM Device Management. | ||
5 | * | ||
6 | * Copyright (c) 2007-2008 Oliver Neukum | ||
7 | * | ||
8 | * Some code taken from cdc-acm.c | ||
9 | * | ||
10 | * Released under the GPLv2. | ||
11 | * | ||
12 | * Many thanks to Carl Nordbeck | ||
13 | */ | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/mutex.h> | ||
20 | #include <linux/uaccess.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/poll.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include <linux/usb/cdc.h> | ||
25 | #include <asm/byteorder.h> | ||
26 | #include <asm/unaligned.h> | ||
27 | |||
28 | /* | ||
29 | * Version Information | ||
30 | */ | ||
31 | #define DRIVER_VERSION "v0.02" | ||
32 | #define DRIVER_AUTHOR "Oliver Neukum" | ||
33 | |||
34 | static struct usb_device_id wdm_ids[] = { | ||
35 | { | ||
36 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | | ||
37 | USB_DEVICE_ID_MATCH_INT_SUBCLASS, | ||
38 | .bInterfaceClass = USB_CLASS_COMM, | ||
39 | .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM | ||
40 | }, | ||
41 | { } | ||
42 | }; | ||
43 | |||
44 | #define WDM_MINOR_BASE 176 | ||
45 | |||
46 | |||
47 | #define WDM_IN_USE 1 | ||
48 | #define WDM_DISCONNECTING 2 | ||
49 | #define WDM_RESULT 3 | ||
50 | #define WDM_READ 4 | ||
51 | #define WDM_INT_STALL 5 | ||
52 | #define WDM_POLL_RUNNING 6 | ||
53 | |||
54 | |||
55 | #define WDM_MAX 16 | ||
56 | |||
57 | |||
58 | static DEFINE_MUTEX(wdm_mutex); | ||
59 | |||
60 | /* --- method tables --- */ | ||
61 | |||
62 | struct wdm_device { | ||
63 | u8 *inbuf; /* buffer for response */ | ||
64 | u8 *outbuf; /* buffer for command */ | ||
65 | u8 *sbuf; /* buffer for status */ | ||
66 | u8 *ubuf; /* buffer for copy to user space */ | ||
67 | |||
68 | struct urb *command; | ||
69 | struct urb *response; | ||
70 | struct urb *validity; | ||
71 | struct usb_interface *intf; | ||
72 | struct usb_ctrlrequest *orq; | ||
73 | struct usb_ctrlrequest *irq; | ||
74 | spinlock_t iuspin; | ||
75 | |||
76 | unsigned long flags; | ||
77 | u16 bufsize; | ||
78 | u16 wMaxCommand; | ||
79 | u16 wMaxPacketSize; | ||
80 | u16 bMaxPacketSize0; | ||
81 | __le16 inum; | ||
82 | int reslength; | ||
83 | int length; | ||
84 | int read; | ||
85 | int count; | ||
86 | dma_addr_t shandle; | ||
87 | dma_addr_t ihandle; | ||
88 | struct mutex wlock; | ||
89 | struct mutex rlock; | ||
90 | wait_queue_head_t wait; | ||
91 | struct work_struct rxwork; | ||
92 | int werr; | ||
93 | int rerr; | ||
94 | }; | ||
95 | |||
96 | static struct usb_driver wdm_driver; | ||
97 | |||
98 | /* --- callbacks --- */ | ||
99 | static void wdm_out_callback(struct urb *urb) | ||
100 | { | ||
101 | struct wdm_device *desc; | ||
102 | desc = urb->context; | ||
103 | spin_lock(&desc->iuspin); | ||
104 | desc->werr = urb->status; | ||
105 | spin_unlock(&desc->iuspin); | ||
106 | clear_bit(WDM_IN_USE, &desc->flags); | ||
107 | kfree(desc->outbuf); | ||
108 | wake_up(&desc->wait); | ||
109 | } | ||
110 | |||
111 | static void wdm_in_callback(struct urb *urb) | ||
112 | { | ||
113 | struct wdm_device *desc = urb->context; | ||
114 | int status = urb->status; | ||
115 | |||
116 | spin_lock(&desc->iuspin); | ||
117 | |||
118 | if (status) { | ||
119 | switch (status) { | ||
120 | case -ENOENT: | ||
121 | dev_dbg(&desc->intf->dev, | ||
122 | "nonzero urb status received: -ENOENT"); | ||
123 | break; | ||
124 | case -ECONNRESET: | ||
125 | dev_dbg(&desc->intf->dev, | ||
126 | "nonzero urb status received: -ECONNRESET"); | ||
127 | break; | ||
128 | case -ESHUTDOWN: | ||
129 | dev_dbg(&desc->intf->dev, | ||
130 | "nonzero urb status received: -ESHUTDOWN"); | ||
131 | break; | ||
132 | case -EPIPE: | ||
133 | err("nonzero urb status received: -EPIPE"); | ||
134 | break; | ||
135 | default: | ||
136 | err("Unexpected error %d", status); | ||
137 | break; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | desc->rerr = status; | ||
142 | desc->reslength = urb->actual_length; | ||
143 | memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); | ||
144 | desc->length += desc->reslength; | ||
145 | wake_up(&desc->wait); | ||
146 | |||
147 | set_bit(WDM_READ, &desc->flags); | ||
148 | spin_unlock(&desc->iuspin); | ||
149 | } | ||
150 | |||
151 | static void wdm_int_callback(struct urb *urb) | ||
152 | { | ||
153 | int rv = 0; | ||
154 | int status = urb->status; | ||
155 | struct wdm_device *desc; | ||
156 | struct usb_ctrlrequest *req; | ||
157 | struct usb_cdc_notification *dr; | ||
158 | |||
159 | desc = urb->context; | ||
160 | req = desc->irq; | ||
161 | dr = (struct usb_cdc_notification *)desc->sbuf; | ||
162 | |||
163 | if (status) { | ||
164 | switch (status) { | ||
165 | case -ESHUTDOWN: | ||
166 | case -ENOENT: | ||
167 | case -ECONNRESET: | ||
168 | return; /* unplug */ | ||
169 | case -EPIPE: | ||
170 | set_bit(WDM_INT_STALL, &desc->flags); | ||
171 | err("Stall on int endpoint"); | ||
172 | goto sw; /* halt is cleared in work */ | ||
173 | default: | ||
174 | err("nonzero urb status received: %d", status); | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | if (urb->actual_length < sizeof(struct usb_cdc_notification)) { | ||
180 | err("wdm_int_callback - %d bytes", urb->actual_length); | ||
181 | goto exit; | ||
182 | } | ||
183 | |||
184 | switch (dr->bNotificationType) { | ||
185 | case USB_CDC_NOTIFY_RESPONSE_AVAILABLE: | ||
186 | dev_dbg(&desc->intf->dev, | ||
187 | "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d", | ||
188 | dr->wIndex, dr->wLength); | ||
189 | break; | ||
190 | |||
191 | case USB_CDC_NOTIFY_NETWORK_CONNECTION: | ||
192 | |||
193 | dev_dbg(&desc->intf->dev, | ||
194 | "NOTIFY_NETWORK_CONNECTION %s network", | ||
195 | dr->wValue ? "connected to" : "disconnected from"); | ||
196 | goto exit; | ||
197 | default: | ||
198 | clear_bit(WDM_POLL_RUNNING, &desc->flags); | ||
199 | err("unknown notification %d received: index %d len %d", | ||
200 | dr->bNotificationType, dr->wIndex, dr->wLength); | ||
201 | goto exit; | ||
202 | } | ||
203 | |||
204 | req->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); | ||
205 | req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; | ||
206 | req->wValue = 0; | ||
207 | req->wIndex = desc->inum; | ||
208 | req->wLength = cpu_to_le16(desc->bMaxPacketSize0); | ||
209 | |||
210 | usb_fill_control_urb( | ||
211 | desc->response, | ||
212 | interface_to_usbdev(desc->intf), | ||
213 | /* using common endpoint 0 */ | ||
214 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
215 | (unsigned char *)req, | ||
216 | desc->inbuf, | ||
217 | desc->bMaxPacketSize0, | ||
218 | wdm_in_callback, | ||
219 | desc | ||
220 | ); | ||
221 | desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
222 | spin_lock(&desc->iuspin); | ||
223 | clear_bit(WDM_READ, &desc->flags); | ||
224 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
225 | rv = usb_submit_urb(desc->response, GFP_ATOMIC); | ||
226 | dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d", | ||
227 | __func__, rv); | ||
228 | } | ||
229 | spin_unlock(&desc->iuspin); | ||
230 | if (rv < 0) { | ||
231 | if (rv == -EPERM) | ||
232 | return; | ||
233 | if (rv == -ENOMEM) { | ||
234 | sw: | ||
235 | rv = schedule_work(&desc->rxwork); | ||
236 | if (rv) | ||
237 | err("Cannot schedule work"); | ||
238 | } | ||
239 | } | ||
240 | exit: | ||
241 | rv = usb_submit_urb(urb, GFP_ATOMIC); | ||
242 | if (rv) | ||
243 | err("%s - usb_submit_urb failed with result %d", | ||
244 | __func__, rv); | ||
245 | |||
246 | } | ||
247 | |||
248 | static void kill_urbs(struct wdm_device *desc) | ||
249 | { | ||
250 | usb_kill_urb(desc->command); | ||
251 | usb_kill_urb(desc->validity); | ||
252 | usb_kill_urb(desc->response); | ||
253 | } | ||
254 | |||
255 | static void free_urbs(struct wdm_device *desc) | ||
256 | { | ||
257 | usb_free_urb(desc->validity); | ||
258 | usb_free_urb(desc->response); | ||
259 | usb_free_urb(desc->command); | ||
260 | } | ||
261 | |||
262 | static void cleanup(struct wdm_device *desc) | ||
263 | { | ||
264 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
265 | desc->wMaxPacketSize, | ||
266 | desc->sbuf, | ||
267 | desc->validity->transfer_dma); | ||
268 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
269 | desc->wMaxPacketSize, | ||
270 | desc->inbuf, | ||
271 | desc->response->transfer_dma); | ||
272 | kfree(desc->orq); | ||
273 | kfree(desc->irq); | ||
274 | kfree(desc->ubuf); | ||
275 | free_urbs(desc); | ||
276 | kfree(desc); | ||
277 | } | ||
278 | |||
279 | static ssize_t wdm_write | ||
280 | (struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | ||
281 | { | ||
282 | u8 *buf; | ||
283 | int rv = -EMSGSIZE, r, we; | ||
284 | struct wdm_device *desc = file->private_data; | ||
285 | struct usb_ctrlrequest *req; | ||
286 | |||
287 | if (count > desc->wMaxCommand) | ||
288 | count = desc->wMaxCommand; | ||
289 | |||
290 | spin_lock_irq(&desc->iuspin); | ||
291 | we = desc->werr; | ||
292 | desc->werr = 0; | ||
293 | spin_unlock_irq(&desc->iuspin); | ||
294 | if (we < 0) | ||
295 | return -EIO; | ||
296 | |||
297 | r = mutex_lock_interruptible(&desc->wlock); /* concurrent writes */ | ||
298 | rv = -ERESTARTSYS; | ||
299 | if (r) | ||
300 | goto outnl; | ||
301 | |||
302 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, | ||
303 | &desc->flags)); | ||
304 | if (r < 0) | ||
305 | goto out; | ||
306 | |||
307 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
308 | rv = -ENODEV; | ||
309 | goto out; | ||
310 | } | ||
311 | |||
312 | desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | ||
313 | if (!buf) { | ||
314 | rv = -ENOMEM; | ||
315 | goto out; | ||
316 | } | ||
317 | |||
318 | r = copy_from_user(buf, buffer, count); | ||
319 | if (r > 0) { | ||
320 | kfree(buf); | ||
321 | rv = -EFAULT; | ||
322 | goto out; | ||
323 | } | ||
324 | |||
325 | req = desc->orq; | ||
326 | usb_fill_control_urb( | ||
327 | desc->command, | ||
328 | interface_to_usbdev(desc->intf), | ||
329 | /* using common endpoint 0 */ | ||
330 | usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
331 | (unsigned char *)req, | ||
332 | buf, | ||
333 | count, | ||
334 | wdm_out_callback, | ||
335 | desc | ||
336 | ); | ||
337 | |||
338 | req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS | | ||
339 | USB_RECIP_INTERFACE); | ||
340 | req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND; | ||
341 | req->wValue = 0; | ||
342 | req->wIndex = desc->inum; | ||
343 | req->wLength = cpu_to_le16(count); | ||
344 | set_bit(WDM_IN_USE, &desc->flags); | ||
345 | |||
346 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | ||
347 | if (rv < 0) { | ||
348 | kfree(buf); | ||
349 | clear_bit(WDM_IN_USE, &desc->flags); | ||
350 | } else { | ||
351 | dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d", | ||
352 | req->wIndex); | ||
353 | } | ||
354 | out: | ||
355 | mutex_unlock(&desc->wlock); | ||
356 | outnl: | ||
357 | return rv < 0 ? rv : count; | ||
358 | } | ||
359 | |||
360 | static ssize_t wdm_read | ||
361 | (struct file *file, char __user *buffer, size_t count, loff_t *ppos) | ||
362 | { | ||
363 | int rv, cntr; | ||
364 | int i = 0; | ||
365 | struct wdm_device *desc = file->private_data; | ||
366 | |||
367 | |||
368 | rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ | ||
369 | if (rv < 0) | ||
370 | return -ERESTARTSYS; | ||
371 | |||
372 | if (desc->length == 0) { | ||
373 | desc->read = 0; | ||
374 | retry: | ||
375 | i++; | ||
376 | rv = wait_event_interruptible(desc->wait, | ||
377 | test_bit(WDM_READ, &desc->flags)); | ||
378 | |||
379 | if (rv < 0) { | ||
380 | rv = -ERESTARTSYS; | ||
381 | goto err; | ||
382 | } | ||
383 | |||
384 | spin_lock_irq(&desc->iuspin); | ||
385 | |||
386 | if (desc->rerr) { /* read completed, error happened */ | ||
387 | int t = desc->rerr; | ||
388 | desc->rerr = 0; | ||
389 | spin_unlock_irq(&desc->iuspin); | ||
390 | err("reading had resulted in %d", t); | ||
391 | rv = -EIO; | ||
392 | goto err; | ||
393 | } | ||
394 | /* | ||
395 | * recheck whether we've lost the race | ||
396 | * against the completion handler | ||
397 | */ | ||
398 | if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */ | ||
399 | spin_unlock_irq(&desc->iuspin); | ||
400 | goto retry; | ||
401 | } | ||
402 | if (!desc->reslength) { /* zero length read */ | ||
403 | spin_unlock_irq(&desc->iuspin); | ||
404 | goto retry; | ||
405 | } | ||
406 | clear_bit(WDM_READ, &desc->flags); | ||
407 | spin_unlock_irq(&desc->iuspin); | ||
408 | } | ||
409 | |||
410 | cntr = count > desc->length ? desc->length : count; | ||
411 | rv = copy_to_user(buffer, desc->ubuf, cntr); | ||
412 | if (rv > 0) { | ||
413 | rv = -EFAULT; | ||
414 | goto err; | ||
415 | } | ||
416 | |||
417 | for (i = 0; i < desc->length - cntr; i++) | ||
418 | desc->ubuf[i] = desc->ubuf[i + cntr]; | ||
419 | |||
420 | desc->length -= cntr; | ||
421 | rv = cntr; | ||
422 | |||
423 | err: | ||
424 | mutex_unlock(&desc->rlock); | ||
425 | if (rv < 0) | ||
426 | err("wdm_read: exit error"); | ||
427 | return rv; | ||
428 | } | ||
429 | |||
430 | static int wdm_flush(struct file *file, fl_owner_t id) | ||
431 | { | ||
432 | struct wdm_device *desc = file->private_data; | ||
433 | |||
434 | wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); | ||
435 | if (desc->werr < 0) | ||
436 | err("Error in flush path: %d", desc->werr); | ||
437 | |||
438 | return desc->werr; | ||
439 | } | ||
440 | |||
441 | static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait) | ||
442 | { | ||
443 | struct wdm_device *desc = file->private_data; | ||
444 | unsigned long flags; | ||
445 | unsigned int mask = 0; | ||
446 | |||
447 | spin_lock_irqsave(&desc->iuspin, flags); | ||
448 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
449 | mask = POLLERR; | ||
450 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
451 | goto desc_out; | ||
452 | } | ||
453 | if (test_bit(WDM_READ, &desc->flags)) | ||
454 | mask = POLLIN | POLLRDNORM; | ||
455 | if (desc->rerr || desc->werr) | ||
456 | mask |= POLLERR; | ||
457 | if (!test_bit(WDM_IN_USE, &desc->flags)) | ||
458 | mask |= POLLOUT | POLLWRNORM; | ||
459 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
460 | |||
461 | poll_wait(file, &desc->wait, wait); | ||
462 | |||
463 | desc_out: | ||
464 | return mask; | ||
465 | } | ||
466 | |||
467 | static int wdm_open(struct inode *inode, struct file *file) | ||
468 | { | ||
469 | int minor = iminor(inode); | ||
470 | int rv = -ENODEV; | ||
471 | struct usb_interface *intf; | ||
472 | struct wdm_device *desc; | ||
473 | |||
474 | mutex_lock(&wdm_mutex); | ||
475 | intf = usb_find_interface(&wdm_driver, minor); | ||
476 | if (!intf) | ||
477 | goto out; | ||
478 | |||
479 | desc = usb_get_intfdata(intf); | ||
480 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
481 | goto out; | ||
482 | |||
483 | desc->count++; | ||
484 | file->private_data = desc; | ||
485 | |||
486 | rv = usb_submit_urb(desc->validity, GFP_KERNEL); | ||
487 | |||
488 | if (rv < 0) { | ||
489 | desc->count--; | ||
490 | err("Error submitting int urb - %d", rv); | ||
491 | goto out; | ||
492 | } | ||
493 | rv = 0; | ||
494 | |||
495 | out: | ||
496 | mutex_unlock(&wdm_mutex); | ||
497 | return rv; | ||
498 | } | ||
499 | |||
500 | static int wdm_release(struct inode *inode, struct file *file) | ||
501 | { | ||
502 | struct wdm_device *desc = file->private_data; | ||
503 | |||
504 | mutex_lock(&wdm_mutex); | ||
505 | desc->count--; | ||
506 | if (!desc->count) { | ||
507 | dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); | ||
508 | kill_urbs(desc); | ||
509 | } | ||
510 | mutex_unlock(&wdm_mutex); | ||
511 | return 0; | ||
512 | } | ||
513 | |||
514 | static const struct file_operations wdm_fops = { | ||
515 | .owner = THIS_MODULE, | ||
516 | .read = wdm_read, | ||
517 | .write = wdm_write, | ||
518 | .open = wdm_open, | ||
519 | .flush = wdm_flush, | ||
520 | .release = wdm_release, | ||
521 | .poll = wdm_poll | ||
522 | }; | ||
523 | |||
524 | static struct usb_class_driver wdm_class = { | ||
525 | .name = "cdc-wdm%d", | ||
526 | .fops = &wdm_fops, | ||
527 | .minor_base = WDM_MINOR_BASE, | ||
528 | }; | ||
529 | |||
530 | /* --- error handling --- */ | ||
531 | static void wdm_rxwork(struct work_struct *work) | ||
532 | { | ||
533 | struct wdm_device *desc = container_of(work, struct wdm_device, rxwork); | ||
534 | unsigned long flags; | ||
535 | int rv; | ||
536 | |||
537 | spin_lock_irqsave(&desc->iuspin, flags); | ||
538 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
539 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
540 | } else { | ||
541 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
542 | rv = usb_submit_urb(desc->response, GFP_KERNEL); | ||
543 | if (rv < 0 && rv != -EPERM) { | ||
544 | spin_lock_irqsave(&desc->iuspin, flags); | ||
545 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
546 | schedule_work(&desc->rxwork); | ||
547 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | /* --- hotplug --- */ | ||
553 | |||
554 | static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
555 | { | ||
556 | int rv = -EINVAL; | ||
557 | struct usb_device *udev = interface_to_usbdev(intf); | ||
558 | struct wdm_device *desc; | ||
559 | struct usb_host_interface *iface; | ||
560 | struct usb_endpoint_descriptor *ep; | ||
561 | struct usb_cdc_dmm_desc *dmhd; | ||
562 | u8 *buffer = intf->altsetting->extra; | ||
563 | int buflen = intf->altsetting->extralen; | ||
564 | u16 maxcom = 0; | ||
565 | |||
566 | if (!buffer) | ||
567 | goto out; | ||
568 | |||
569 | while (buflen > 0) { | ||
570 | if (buffer [1] != USB_DT_CS_INTERFACE) { | ||
571 | err("skipping garbage"); | ||
572 | goto next_desc; | ||
573 | } | ||
574 | |||
575 | switch (buffer [2]) { | ||
576 | case USB_CDC_HEADER_TYPE: | ||
577 | break; | ||
578 | case USB_CDC_DMM_TYPE: | ||
579 | dmhd = (struct usb_cdc_dmm_desc *)buffer; | ||
580 | maxcom = le16_to_cpu(dmhd->wMaxCommand); | ||
581 | dev_dbg(&intf->dev, | ||
582 | "Finding maximum buffer length: %d", maxcom); | ||
583 | break; | ||
584 | default: | ||
585 | err("Ignoring extra header, type %d, length %d", | ||
586 | buffer[2], buffer[0]); | ||
587 | break; | ||
588 | } | ||
589 | next_desc: | ||
590 | buflen -= buffer[0]; | ||
591 | buffer += buffer[0]; | ||
592 | } | ||
593 | |||
594 | rv = -ENOMEM; | ||
595 | desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); | ||
596 | if (!desc) | ||
597 | goto out; | ||
598 | mutex_init(&desc->wlock); | ||
599 | mutex_init(&desc->rlock); | ||
600 | spin_lock_init(&desc->iuspin); | ||
601 | init_waitqueue_head(&desc->wait); | ||
602 | desc->wMaxCommand = maxcom; | ||
603 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); | ||
604 | desc->intf = intf; | ||
605 | INIT_WORK(&desc->rxwork, wdm_rxwork); | ||
606 | |||
607 | iface = &intf->altsetting[0]; | ||
608 | ep = &iface->endpoint[0].desc; | ||
609 | if (!usb_endpoint_is_int_in(ep)) { | ||
610 | rv = -EINVAL; | ||
611 | goto err; | ||
612 | } | ||
613 | |||
614 | desc->wMaxPacketSize = ep->wMaxPacketSize; | ||
615 | desc->bMaxPacketSize0 = cpu_to_le16(udev->descriptor.bMaxPacketSize0); | ||
616 | |||
617 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | ||
618 | if (!desc->orq) | ||
619 | goto err; | ||
620 | desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | ||
621 | if (!desc->irq) | ||
622 | goto err; | ||
623 | |||
624 | desc->validity = usb_alloc_urb(0, GFP_KERNEL); | ||
625 | if (!desc->validity) | ||
626 | goto err; | ||
627 | |||
628 | desc->response = usb_alloc_urb(0, GFP_KERNEL); | ||
629 | if (!desc->response) | ||
630 | goto err; | ||
631 | |||
632 | desc->command = usb_alloc_urb(0, GFP_KERNEL); | ||
633 | if (!desc->command) | ||
634 | goto err; | ||
635 | |||
636 | desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); | ||
637 | if (!desc->ubuf) | ||
638 | goto err; | ||
639 | |||
640 | desc->sbuf = usb_buffer_alloc(interface_to_usbdev(intf), | ||
641 | desc->wMaxPacketSize, | ||
642 | GFP_KERNEL, | ||
643 | &desc->validity->transfer_dma); | ||
644 | if (!desc->sbuf) | ||
645 | goto err; | ||
646 | |||
647 | desc->inbuf = usb_buffer_alloc(interface_to_usbdev(intf), | ||
648 | desc->bMaxPacketSize0, | ||
649 | GFP_KERNEL, | ||
650 | &desc->response->transfer_dma); | ||
651 | if (!desc->inbuf) | ||
652 | goto err2; | ||
653 | |||
654 | usb_fill_int_urb( | ||
655 | desc->validity, | ||
656 | interface_to_usbdev(intf), | ||
657 | usb_rcvintpipe(interface_to_usbdev(intf), ep->bEndpointAddress), | ||
658 | desc->sbuf, | ||
659 | desc->wMaxPacketSize, | ||
660 | wdm_int_callback, | ||
661 | desc, | ||
662 | ep->bInterval | ||
663 | ); | ||
664 | desc->validity->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
665 | |||
666 | usb_set_intfdata(intf, desc); | ||
667 | rv = usb_register_dev(intf, &wdm_class); | ||
668 | dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n", | ||
669 | intf->minor - WDM_MINOR_BASE); | ||
670 | if (rv < 0) | ||
671 | goto err; | ||
672 | out: | ||
673 | return rv; | ||
674 | err2: | ||
675 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
676 | desc->wMaxPacketSize, | ||
677 | desc->sbuf, | ||
678 | desc->validity->transfer_dma); | ||
679 | err: | ||
680 | free_urbs(desc); | ||
681 | kfree(desc->ubuf); | ||
682 | kfree(desc->orq); | ||
683 | kfree(desc->irq); | ||
684 | kfree(desc); | ||
685 | return rv; | ||
686 | } | ||
687 | |||
688 | static void wdm_disconnect(struct usb_interface *intf) | ||
689 | { | ||
690 | struct wdm_device *desc; | ||
691 | unsigned long flags; | ||
692 | |||
693 | usb_deregister_dev(intf, &wdm_class); | ||
694 | mutex_lock(&wdm_mutex); | ||
695 | desc = usb_get_intfdata(intf); | ||
696 | |||
697 | /* the spinlock makes sure no new urbs are generated in the callbacks */ | ||
698 | spin_lock_irqsave(&desc->iuspin, flags); | ||
699 | set_bit(WDM_DISCONNECTING, &desc->flags); | ||
700 | set_bit(WDM_READ, &desc->flags); | ||
701 | clear_bit(WDM_IN_USE, &desc->flags); | ||
702 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
703 | cancel_work_sync(&desc->rxwork); | ||
704 | kill_urbs(desc); | ||
705 | wake_up_all(&desc->wait); | ||
706 | if (!desc->count) | ||
707 | cleanup(desc); | ||
708 | mutex_unlock(&wdm_mutex); | ||
709 | } | ||
710 | |||
711 | static struct usb_driver wdm_driver = { | ||
712 | .name = "cdc_wdm", | ||
713 | .probe = wdm_probe, | ||
714 | .disconnect = wdm_disconnect, | ||
715 | .id_table = wdm_ids, | ||
716 | }; | ||
717 | |||
718 | /* --- low level module stuff --- */ | ||
719 | |||
720 | static int __init wdm_init(void) | ||
721 | { | ||
722 | int rv; | ||
723 | |||
724 | rv = usb_register(&wdm_driver); | ||
725 | |||
726 | return rv; | ||
727 | } | ||
728 | |||
729 | static void __exit wdm_exit(void) | ||
730 | { | ||
731 | usb_deregister(&wdm_driver); | ||
732 | } | ||
733 | |||
734 | module_init(wdm_init); | ||
735 | module_exit(wdm_exit); | ||
736 | |||
737 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
738 | MODULE_DESCRIPTION("USB Abstract Control Model driver for " | ||
739 | "USB WCM Device Management"); | ||
740 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index c1cb94e9f242..7e912f21fd36 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c | |||
@@ -155,9 +155,6 @@ static int generic_probe(struct usb_device *udev) | |||
155 | { | 155 | { |
156 | int err, c; | 156 | int err, c; |
157 | 157 | ||
158 | /* put device-specific files into sysfs */ | ||
159 | usb_create_sysfs_dev_files(udev); | ||
160 | |||
161 | /* Choose and set the configuration. This registers the interfaces | 158 | /* Choose and set the configuration. This registers the interfaces |
162 | * with the driver core and lets interface drivers bind to them. | 159 | * with the driver core and lets interface drivers bind to them. |
163 | */ | 160 | */ |
@@ -189,8 +186,6 @@ static void generic_disconnect(struct usb_device *udev) | |||
189 | * unconfigure the device */ | 186 | * unconfigure the device */ |
190 | if (udev->actconfig) | 187 | if (udev->actconfig) |
191 | usb_set_configuration(udev, -1); | 188 | usb_set_configuration(udev, -1); |
192 | |||
193 | usb_remove_sysfs_dev_files(udev); | ||
194 | } | 189 | } |
195 | 190 | ||
196 | #ifdef CONFIG_PM | 191 | #ifdef CONFIG_PM |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bf10e9c4195e..09a53e7f3327 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -818,12 +818,12 @@ static int usb_register_bus(struct usb_bus *bus) | |||
818 | set_bit (busnum, busmap.busmap); | 818 | set_bit (busnum, busmap.busmap); |
819 | bus->busnum = busnum; | 819 | bus->busnum = busnum; |
820 | 820 | ||
821 | bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0), | 821 | bus->dev = device_create_drvdata(usb_host_class, bus->controller, |
822 | "usb_host%d", busnum); | 822 | MKDEV(0, 0), bus, |
823 | "usb_host%d", busnum); | ||
823 | result = PTR_ERR(bus->dev); | 824 | result = PTR_ERR(bus->dev); |
824 | if (IS_ERR(bus->dev)) | 825 | if (IS_ERR(bus->dev)) |
825 | goto error_create_class_dev; | 826 | goto error_create_class_dev; |
826 | dev_set_drvdata(bus->dev, bus); | ||
827 | 827 | ||
828 | /* Add it to the local list of buses */ | 828 | /* Add it to the local list of buses */ |
829 | list_add (&bus->bus_list, &usb_bus_list); | 829 | list_add (&bus->bus_list, &usb_bus_list); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 1e4b81e9eb50..a0bf5df6cb6f 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -213,6 +213,8 @@ struct hc_driver { | |||
213 | 213 | ||
214 | /* force handover of high-speed port to full-speed companion */ | 214 | /* force handover of high-speed port to full-speed companion */ |
215 | void (*relinquish_port)(struct usb_hcd *, int); | 215 | void (*relinquish_port)(struct usb_hcd *, int); |
216 | /* has a port been handed over to a companion? */ | ||
217 | int (*port_handed_over)(struct usb_hcd *, int); | ||
216 | }; | 218 | }; |
217 | 219 | ||
218 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); | 220 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index eb57fcc701d7..8eb4da332f56 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1326,6 +1326,12 @@ void usb_disconnect(struct usb_device **pdev) | |||
1326 | 1326 | ||
1327 | usb_unlock_device(udev); | 1327 | usb_unlock_device(udev); |
1328 | 1328 | ||
1329 | /* Remove the device-specific files from sysfs. This must be | ||
1330 | * done with udev unlocked, because some of the attribute | ||
1331 | * routines try to acquire the device lock. | ||
1332 | */ | ||
1333 | usb_remove_sysfs_dev_files(udev); | ||
1334 | |||
1329 | /* Unregister the device. The device driver is responsible | 1335 | /* Unregister the device. The device driver is responsible |
1330 | * for removing the device files from usbfs and sysfs and for | 1336 | * for removing the device files from usbfs and sysfs and for |
1331 | * de-configuring the device. | 1337 | * de-configuring the device. |
@@ -1541,6 +1547,9 @@ int usb_new_device(struct usb_device *udev) | |||
1541 | goto fail; | 1547 | goto fail; |
1542 | } | 1548 | } |
1543 | 1549 | ||
1550 | /* put device-specific files into sysfs */ | ||
1551 | usb_create_sysfs_dev_files(udev); | ||
1552 | |||
1544 | /* Tell the world! */ | 1553 | /* Tell the world! */ |
1545 | announce_device(udev); | 1554 | announce_device(udev); |
1546 | return err; | 1555 | return err; |
@@ -2744,7 +2753,11 @@ loop: | |||
2744 | if ((status == -ENOTCONN) || (status == -ENOTSUPP)) | 2753 | if ((status == -ENOTCONN) || (status == -ENOTSUPP)) |
2745 | break; | 2754 | break; |
2746 | } | 2755 | } |
2747 | dev_err(hub_dev, "unable to enumerate USB device on port %d\n", port1); | 2756 | if (hub->hdev->parent || |
2757 | !hcd->driver->port_handed_over || | ||
2758 | !(hcd->driver->port_handed_over)(hcd, port1)) | ||
2759 | dev_err(hub_dev, "unable to enumerate USB device on port %d\n", | ||
2760 | port1); | ||
2748 | 2761 | ||
2749 | done: | 2762 | done: |
2750 | hub_port_disable(hub, port1, 1); | 2763 | hub_port_disable(hub, port1, 1); |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 2e2019390290..3da1ab4b389d 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -47,6 +47,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
47 | /* Edirol SD-20 */ | 47 | /* Edirol SD-20 */ |
48 | { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, | 48 | { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 49 | ||
50 | /* Avision AV600U */ | ||
51 | { USB_DEVICE(0x0638, 0x0a13), .driver_info = | ||
52 | USB_QUIRK_STRING_FETCH_255 }, | ||
53 | |||
50 | /* M-Systems Flash Disk Pioneers */ | 54 | /* M-Systems Flash Disk Pioneers */ |
51 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, | 55 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 56 | ||
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index c783cb111847..5e1f5d55bf04 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -588,35 +588,33 @@ read_descriptors(struct kobject *kobj, struct bin_attribute *attr, | |||
588 | container_of(kobj, struct device, kobj)); | 588 | container_of(kobj, struct device, kobj)); |
589 | size_t nleft = count; | 589 | size_t nleft = count; |
590 | size_t srclen, n; | 590 | size_t srclen, n; |
591 | int cfgno; | ||
592 | void *src; | ||
591 | 593 | ||
592 | usb_lock_device(udev); | 594 | /* The binary attribute begins with the device descriptor. |
593 | 595 | * Following that are the raw descriptor entries for all the | |
594 | /* The binary attribute begins with the device descriptor */ | 596 | * configurations (config plus subsidiary descriptors). |
595 | srclen = sizeof(struct usb_device_descriptor); | ||
596 | if (off < srclen) { | ||
597 | n = min_t(size_t, nleft, srclen - off); | ||
598 | memcpy(buf, off + (char *) &udev->descriptor, n); | ||
599 | nleft -= n; | ||
600 | buf += n; | ||
601 | off = 0; | ||
602 | } else { | ||
603 | off -= srclen; | ||
604 | } | ||
605 | |||
606 | /* Then follows the raw descriptor entry for the current | ||
607 | * configuration (config plus subsidiary descriptors). | ||
608 | */ | 597 | */ |
609 | if (udev->actconfig) { | 598 | for (cfgno = -1; cfgno < udev->descriptor.bNumConfigurations && |
610 | int cfgno = udev->actconfig - udev->config; | 599 | nleft > 0; ++cfgno) { |
611 | 600 | if (cfgno < 0) { | |
612 | srclen = __le16_to_cpu(udev->actconfig->desc.wTotalLength); | 601 | src = &udev->descriptor; |
602 | srclen = sizeof(struct usb_device_descriptor); | ||
603 | } else { | ||
604 | src = udev->rawdescriptors[cfgno]; | ||
605 | srclen = __le16_to_cpu(udev->config[cfgno].desc. | ||
606 | wTotalLength); | ||
607 | } | ||
613 | if (off < srclen) { | 608 | if (off < srclen) { |
614 | n = min_t(size_t, nleft, srclen - off); | 609 | n = min(nleft, srclen - (size_t) off); |
615 | memcpy(buf, off + udev->rawdescriptors[cfgno], n); | 610 | memcpy(buf, src + off, n); |
616 | nleft -= n; | 611 | nleft -= n; |
612 | buf += n; | ||
613 | off = 0; | ||
614 | } else { | ||
615 | off -= srclen; | ||
617 | } | 616 | } |
618 | } | 617 | } |
619 | usb_unlock_device(udev); | ||
620 | return count - nleft; | 618 | return count - nleft; |
621 | } | 619 | } |
622 | 620 | ||
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 651b82701394..18687543d7fa 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -1627,7 +1627,9 @@ static int reset_queues(struct fsl_udc *udc) | |||
1627 | udc_reset_ep_queue(udc, pipe); | 1627 | udc_reset_ep_queue(udc, pipe); |
1628 | 1628 | ||
1629 | /* report disconnect; the driver is already quiesced */ | 1629 | /* report disconnect; the driver is already quiesced */ |
1630 | spin_unlock(&udc->lock); | ||
1630 | udc->driver->disconnect(&udc->gadget); | 1631 | udc->driver->disconnect(&udc->gadget); |
1632 | spin_lock(&udc->lock); | ||
1631 | 1633 | ||
1632 | return 0; | 1634 | return 0; |
1633 | } | 1635 | } |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 499b7a23f351..e02bfd4df3a6 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1526,7 +1526,8 @@ static void udc_disable(struct pxa_udc *udc) | |||
1526 | 1526 | ||
1527 | ep0_idle(udc); | 1527 | ep0_idle(udc); |
1528 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1528 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1529 | udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 1529 | if (udc->mach->udc_command) |
1530 | udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | ||
1530 | } | 1531 | } |
1531 | 1532 | ||
1532 | /** | 1533 | /** |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 8b5f991e949c..08a4335401a9 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -223,6 +223,7 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
223 | .bus_suspend = ehci_bus_suspend, | 223 | .bus_suspend = ehci_bus_suspend, |
224 | .bus_resume = ehci_bus_resume, | 224 | .bus_resume = ehci_bus_resume, |
225 | .relinquish_port = ehci_relinquish_port, | 225 | .relinquish_port = ehci_relinquish_port, |
226 | .port_handed_over = ehci_port_handed_over, | ||
226 | }; | 227 | }; |
227 | 228 | ||
228 | /*-------------------------------------------------------------------------*/ | 229 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 6d9bed6c1f48..7370d6187c64 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -269,7 +269,7 @@ static int ehci_fsl_setup(struct usb_hcd *hcd) | |||
269 | if (retval) | 269 | if (retval) |
270 | return retval; | 270 | return retval; |
271 | 271 | ||
272 | ehci->is_tdi_rh_tt = 1; | 272 | hcd->has_tt = 1; |
273 | 273 | ||
274 | ehci->sbrn = 0x20; | 274 | ehci->sbrn = 0x20; |
275 | 275 | ||
@@ -295,10 +295,6 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
295 | */ | 295 | */ |
296 | .reset = ehci_fsl_setup, | 296 | .reset = ehci_fsl_setup, |
297 | .start = ehci_run, | 297 | .start = ehci_run, |
298 | #ifdef CONFIG_PM | ||
299 | .suspend = ehci_bus_suspend, | ||
300 | .resume = ehci_bus_resume, | ||
301 | #endif | ||
302 | .stop = ehci_stop, | 298 | .stop = ehci_stop, |
303 | .shutdown = ehci_shutdown, | 299 | .shutdown = ehci_shutdown, |
304 | 300 | ||
@@ -322,6 +318,7 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
322 | .bus_suspend = ehci_bus_suspend, | 318 | .bus_suspend = ehci_bus_suspend, |
323 | .bus_resume = ehci_bus_resume, | 319 | .bus_resume = ehci_bus_resume, |
324 | .relinquish_port = ehci_relinquish_port, | 320 | .relinquish_port = ehci_relinquish_port, |
321 | .port_handed_over = ehci_port_handed_over, | ||
325 | }; | 322 | }; |
326 | 323 | ||
327 | static int ehci_fsl_drv_probe(struct platform_device *pdev) | 324 | static int ehci_fsl_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 382587c4457c..740835bb8575 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -609,7 +609,7 @@ static int ehci_hub_control ( | |||
609 | } | 609 | } |
610 | break; | 610 | break; |
611 | case USB_PORT_FEAT_C_SUSPEND: | 611 | case USB_PORT_FEAT_C_SUSPEND: |
612 | /* we auto-clear this feature */ | 612 | clear_bit(wIndex, &ehci->port_c_suspend); |
613 | break; | 613 | break; |
614 | case USB_PORT_FEAT_POWER: | 614 | case USB_PORT_FEAT_POWER: |
615 | if (HCS_PPC (ehci->hcs_params)) | 615 | if (HCS_PPC (ehci->hcs_params)) |
@@ -688,7 +688,7 @@ static int ehci_hub_control ( | |||
688 | /* resume completed? */ | 688 | /* resume completed? */ |
689 | else if (time_after_eq(jiffies, | 689 | else if (time_after_eq(jiffies, |
690 | ehci->reset_done[wIndex])) { | 690 | ehci->reset_done[wIndex])) { |
691 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | 691 | set_bit(wIndex, &ehci->port_c_suspend); |
692 | ehci->reset_done[wIndex] = 0; | 692 | ehci->reset_done[wIndex] = 0; |
693 | 693 | ||
694 | /* stop resume signaling */ | 694 | /* stop resume signaling */ |
@@ -765,6 +765,8 @@ static int ehci_hub_control ( | |||
765 | status |= 1 << USB_PORT_FEAT_RESET; | 765 | status |= 1 << USB_PORT_FEAT_RESET; |
766 | if (temp & PORT_POWER) | 766 | if (temp & PORT_POWER) |
767 | status |= 1 << USB_PORT_FEAT_POWER; | 767 | status |= 1 << USB_PORT_FEAT_POWER; |
768 | if (test_bit(wIndex, &ehci->port_c_suspend)) | ||
769 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | ||
768 | 770 | ||
769 | #ifndef VERBOSE_DEBUG | 771 | #ifndef VERBOSE_DEBUG |
770 | if (status & ~0xffff) /* only if wPortChange is interesting */ | 772 | if (status & ~0xffff) /* only if wPortChange is interesting */ |
@@ -875,3 +877,13 @@ static void ehci_relinquish_port(struct usb_hcd *hcd, int portnum) | |||
875 | set_owner(ehci, --portnum, PORT_OWNER); | 877 | set_owner(ehci, --portnum, PORT_OWNER); |
876 | } | 878 | } |
877 | 879 | ||
880 | static int ehci_port_handed_over(struct usb_hcd *hcd, int portnum) | ||
881 | { | ||
882 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
883 | u32 __iomem *reg; | ||
884 | |||
885 | if (ehci_is_TDI(ehci)) | ||
886 | return 0; | ||
887 | reg = &ehci->regs->port_status[portnum - 1]; | ||
888 | return ehci_readl(ehci, reg) & PORT_OWNER; | ||
889 | } | ||
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index 601c8795a854..9d042f220097 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c | |||
@@ -26,7 +26,7 @@ static int ixp4xx_ehci_init(struct usb_hcd *hcd) | |||
26 | + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 26 | + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
27 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 27 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
28 | 28 | ||
29 | ehci->is_tdi_rh_tt = 1; | 29 | hcd->has_tt = 1; |
30 | ehci_reset(ehci); | 30 | ehci_reset(ehci); |
31 | 31 | ||
32 | retval = ehci_init(hcd); | 32 | retval = ehci_init(hcd); |
@@ -58,6 +58,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = { | |||
58 | .bus_suspend = ehci_bus_suspend, | 58 | .bus_suspend = ehci_bus_suspend, |
59 | .bus_resume = ehci_bus_resume, | 59 | .bus_resume = ehci_bus_resume, |
60 | #endif | 60 | #endif |
61 | .relinquish_port = ehci_relinquish_port, | ||
62 | .port_handed_over = ehci_port_handed_over, | ||
61 | }; | 63 | }; |
62 | 64 | ||
63 | static int ixp4xx_ehci_probe(struct platform_device *pdev) | 65 | static int ixp4xx_ehci_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index d187d0313742..ab625f0ba1d9 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -115,6 +115,8 @@ static int ehci_orion_setup(struct usb_hcd *hcd) | |||
115 | if (retval) | 115 | if (retval) |
116 | return retval; | 116 | return retval; |
117 | 117 | ||
118 | hcd->has_tt = 1; | ||
119 | |||
118 | ehci_reset(ehci); | 120 | ehci_reset(ehci); |
119 | ehci_port_power(ehci, 0); | 121 | ehci_port_power(ehci, 0); |
120 | 122 | ||
@@ -137,10 +139,6 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
137 | */ | 139 | */ |
138 | .reset = ehci_orion_setup, | 140 | .reset = ehci_orion_setup, |
139 | .start = ehci_run, | 141 | .start = ehci_run, |
140 | #ifdef CONFIG_PM | ||
141 | .suspend = ehci_bus_suspend, | ||
142 | .resume = ehci_bus_resume, | ||
143 | #endif | ||
144 | .stop = ehci_stop, | 142 | .stop = ehci_stop, |
145 | .shutdown = ehci_shutdown, | 143 | .shutdown = ehci_shutdown, |
146 | 144 | ||
@@ -163,6 +161,8 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
163 | .hub_control = ehci_hub_control, | 161 | .hub_control = ehci_hub_control, |
164 | .bus_suspend = ehci_bus_suspend, | 162 | .bus_suspend = ehci_bus_suspend, |
165 | .bus_resume = ehci_bus_resume, | 163 | .bus_resume = ehci_bus_resume, |
164 | .relinquish_port = ehci_relinquish_port, | ||
165 | .port_handed_over = ehci_port_handed_over, | ||
166 | }; | 166 | }; |
167 | 167 | ||
168 | static void __init | 168 | static void __init |
@@ -248,7 +248,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
248 | ehci->regs = hcd->regs + 0x100 + | 248 | ehci->regs = hcd->regs + 0x100 + |
249 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 249 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
250 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 250 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
251 | ehci->is_tdi_rh_tt = 1; | 251 | hcd->has_tt = 1; |
252 | ehci->sbrn = 0x20; | 252 | ehci->sbrn = 0x20; |
253 | 253 | ||
254 | /* | 254 | /* |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 5bb7f6bb13f3..c46a58f9181d 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -129,7 +129,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
129 | switch (pdev->vendor) { | 129 | switch (pdev->vendor) { |
130 | case PCI_VENDOR_ID_TDI: | 130 | case PCI_VENDOR_ID_TDI: |
131 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 131 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
132 | ehci->is_tdi_rh_tt = 1; | ||
133 | hcd->has_tt = 1; | 132 | hcd->has_tt = 1; |
134 | tdi_reset(ehci); | 133 | tdi_reset(ehci); |
135 | } | 134 | } |
@@ -379,7 +378,8 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
379 | .hub_control = ehci_hub_control, | 378 | .hub_control = ehci_hub_control, |
380 | .bus_suspend = ehci_bus_suspend, | 379 | .bus_suspend = ehci_bus_suspend, |
381 | .bus_resume = ehci_bus_resume, | 380 | .bus_resume = ehci_bus_resume, |
382 | .relinquish_port = ehci_relinquish_port, | 381 | .relinquish_port = ehci_relinquish_port, |
382 | .port_handed_over = ehci_port_handed_over, | ||
383 | }; | 383 | }; |
384 | 384 | ||
385 | /*-------------------------------------------------------------------------*/ | 385 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index ee305b1f99ff..b018deed2e8f 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -76,6 +76,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = { | |||
76 | .bus_suspend = ehci_bus_suspend, | 76 | .bus_suspend = ehci_bus_suspend, |
77 | .bus_resume = ehci_bus_resume, | 77 | .bus_resume = ehci_bus_resume, |
78 | #endif | 78 | #endif |
79 | .relinquish_port = ehci_relinquish_port, | ||
80 | .port_handed_over = ehci_port_handed_over, | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | 83 | ||
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c index 6c76036783a1..529590eb4037 100644 --- a/drivers/usb/host/ehci-ppc-soc.c +++ b/drivers/usb/host/ehci-ppc-soc.c | |||
@@ -163,6 +163,7 @@ static const struct hc_driver ehci_ppc_soc_hc_driver = { | |||
163 | .bus_suspend = ehci_bus_suspend, | 163 | .bus_suspend = ehci_bus_suspend, |
164 | .bus_resume = ehci_bus_resume, | 164 | .bus_resume = ehci_bus_resume, |
165 | .relinquish_port = ehci_relinquish_port, | 165 | .relinquish_port = ehci_relinquish_port, |
166 | .port_handed_over = ehci_port_handed_over, | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) | 169 | static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 69782221bcf3..37e6abeb794c 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -73,6 +73,7 @@ static const struct hc_driver ps3_ehci_hc_driver = { | |||
73 | .bus_resume = ehci_bus_resume, | 73 | .bus_resume = ehci_bus_resume, |
74 | #endif | 74 | #endif |
75 | .relinquish_port = ehci_relinquish_port, | 75 | .relinquish_port = ehci_relinquish_port, |
76 | .port_handed_over = ehci_port_handed_over, | ||
76 | }; | 77 | }; |
77 | 78 | ||
78 | static int ps3_ehci_probe(struct ps3_system_bus_device *dev) | 79 | static int ps3_ehci_probe(struct ps3_system_bus_device *dev) |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index be575e46eac3..b7853c8bac0f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1349,18 +1349,27 @@ iso_stream_schedule ( | |||
1349 | /* when's the last uframe this urb could start? */ | 1349 | /* when's the last uframe this urb could start? */ |
1350 | max = now + mod; | 1350 | max = now + mod; |
1351 | 1351 | ||
1352 | /* typical case: reuse current schedule. stream is still active, | 1352 | /* Typical case: reuse current schedule, stream is still active. |
1353 | * and no gaps from host falling behind (irq delays etc) | 1353 | * Hopefully there are no gaps from the host falling behind |
1354 | * (irq delays etc), but if there are we'll take the next | ||
1355 | * slot in the schedule, implicitly assuming URB_ISO_ASAP. | ||
1354 | */ | 1356 | */ |
1355 | if (likely (!list_empty (&stream->td_list))) { | 1357 | if (likely (!list_empty (&stream->td_list))) { |
1356 | start = stream->next_uframe; | 1358 | start = stream->next_uframe; |
1357 | if (start < now) | 1359 | if (start < now) |
1358 | start += mod; | 1360 | start += mod; |
1359 | if (likely ((start + sched->span) < max)) | 1361 | |
1360 | goto ready; | 1362 | /* Fell behind (by up to twice the slop amount)? */ |
1361 | /* else fell behind; someday, try to reschedule */ | 1363 | if (start >= max - 2 * 8 * SCHEDULE_SLOP) |
1362 | status = -EL2NSYNC; | 1364 | start += stream->interval * DIV_ROUND_UP( |
1363 | goto fail; | 1365 | max - start, stream->interval) - mod; |
1366 | |||
1367 | /* Tried to schedule too far into the future? */ | ||
1368 | if (unlikely((start + sched->span) >= max)) { | ||
1369 | status = -EFBIG; | ||
1370 | goto fail; | ||
1371 | } | ||
1372 | goto ready; | ||
1364 | } | 1373 | } |
1365 | 1374 | ||
1366 | /* need to schedule; when's the next (u)frame we could start? | 1375 | /* need to schedule; when's the next (u)frame we could start? |
@@ -1613,6 +1622,9 @@ itd_complete ( | |||
1613 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { | 1622 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { |
1614 | desc->status = 0; | 1623 | desc->status = 0; |
1615 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1624 | desc->actual_length = EHCI_ITD_LENGTH (t); |
1625 | } else { | ||
1626 | /* URB was too late */ | ||
1627 | desc->status = -EXDEV; | ||
1616 | } | 1628 | } |
1617 | } | 1629 | } |
1618 | 1630 | ||
@@ -2095,7 +2107,7 @@ done: | |||
2095 | static void | 2107 | static void |
2096 | scan_periodic (struct ehci_hcd *ehci) | 2108 | scan_periodic (struct ehci_hcd *ehci) |
2097 | { | 2109 | { |
2098 | unsigned frame, clock, now_uframe, mod; | 2110 | unsigned now_uframe, frame, clock, clock_frame, mod; |
2099 | unsigned modified; | 2111 | unsigned modified; |
2100 | 2112 | ||
2101 | mod = ehci->periodic_size << 3; | 2113 | mod = ehci->periodic_size << 3; |
@@ -2111,6 +2123,7 @@ scan_periodic (struct ehci_hcd *ehci) | |||
2111 | else | 2123 | else |
2112 | clock = now_uframe + mod - 1; | 2124 | clock = now_uframe + mod - 1; |
2113 | clock %= mod; | 2125 | clock %= mod; |
2126 | clock_frame = clock >> 3; | ||
2114 | 2127 | ||
2115 | for (;;) { | 2128 | for (;;) { |
2116 | union ehci_shadow q, *q_p; | 2129 | union ehci_shadow q, *q_p; |
@@ -2157,22 +2170,26 @@ restart: | |||
2157 | case Q_TYPE_ITD: | 2170 | case Q_TYPE_ITD: |
2158 | /* If this ITD is still active, leave it for | 2171 | /* If this ITD is still active, leave it for |
2159 | * later processing ... check the next entry. | 2172 | * later processing ... check the next entry. |
2173 | * No need to check for activity unless the | ||
2174 | * frame is current. | ||
2160 | */ | 2175 | */ |
2161 | rmb (); | 2176 | if (frame == clock_frame && live) { |
2162 | for (uf = 0; uf < 8 && live; uf++) { | 2177 | rmb(); |
2163 | if (0 == (q.itd->hw_transaction [uf] | 2178 | for (uf = 0; uf < 8; uf++) { |
2164 | & ITD_ACTIVE(ehci))) | 2179 | if (q.itd->hw_transaction[uf] & |
2165 | continue; | 2180 | ITD_ACTIVE(ehci)) |
2166 | incomplete = true; | 2181 | break; |
2167 | q_p = &q.itd->itd_next; | 2182 | } |
2168 | hw_p = &q.itd->hw_next; | 2183 | if (uf < 8) { |
2169 | type = Q_NEXT_TYPE(ehci, | 2184 | incomplete = true; |
2185 | q_p = &q.itd->itd_next; | ||
2186 | hw_p = &q.itd->hw_next; | ||
2187 | type = Q_NEXT_TYPE(ehci, | ||
2170 | q.itd->hw_next); | 2188 | q.itd->hw_next); |
2171 | q = *q_p; | 2189 | q = *q_p; |
2172 | break; | 2190 | break; |
2191 | } | ||
2173 | } | 2192 | } |
2174 | if (uf < 8 && live) | ||
2175 | break; | ||
2176 | 2193 | ||
2177 | /* Take finished ITDs out of the schedule | 2194 | /* Take finished ITDs out of the schedule |
2178 | * and process them: recycle, maybe report | 2195 | * and process them: recycle, maybe report |
@@ -2189,9 +2206,12 @@ restart: | |||
2189 | case Q_TYPE_SITD: | 2206 | case Q_TYPE_SITD: |
2190 | /* If this SITD is still active, leave it for | 2207 | /* If this SITD is still active, leave it for |
2191 | * later processing ... check the next entry. | 2208 | * later processing ... check the next entry. |
2209 | * No need to check for activity unless the | ||
2210 | * frame is current. | ||
2192 | */ | 2211 | */ |
2193 | if ((q.sitd->hw_results & SITD_ACTIVE(ehci)) | 2212 | if (frame == clock_frame && live && |
2194 | && live) { | 2213 | (q.sitd->hw_results & |
2214 | SITD_ACTIVE(ehci))) { | ||
2195 | incomplete = true; | 2215 | incomplete = true; |
2196 | q_p = &q.sitd->sitd_next; | 2216 | q_p = &q.sitd->sitd_next; |
2197 | hw_p = &q.sitd->hw_next; | 2217 | hw_p = &q.sitd->hw_next; |
@@ -2260,6 +2280,7 @@ restart: | |||
2260 | 2280 | ||
2261 | /* rescan the rest of this frame, then ... */ | 2281 | /* rescan the rest of this frame, then ... */ |
2262 | clock = now; | 2282 | clock = now; |
2283 | clock_frame = clock >> 3; | ||
2263 | } else { | 2284 | } else { |
2264 | now_uframe++; | 2285 | now_uframe++; |
2265 | now_uframe %= mod; | 2286 | now_uframe %= mod; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bf92d209a1a9..35a03095757e 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -97,6 +97,8 @@ struct ehci_hcd { /* one per controller */ | |||
97 | dedicated to the companion controller */ | 97 | dedicated to the companion controller */ |
98 | unsigned long owned_ports; /* which ports are | 98 | unsigned long owned_ports; /* which ports are |
99 | owned by the companion during a bus suspend */ | 99 | owned by the companion during a bus suspend */ |
100 | unsigned long port_c_suspend; /* which ports have | ||
101 | the change-suspend feature turned on */ | ||
100 | 102 | ||
101 | /* per-HC memory pools (could be per-bus, but ...) */ | 103 | /* per-HC memory pools (could be per-bus, but ...) */ |
102 | struct dma_pool *qh_pool; /* qh per active urb */ | 104 | struct dma_pool *qh_pool; /* qh per active urb */ |
@@ -112,7 +114,6 @@ struct ehci_hcd { /* one per controller */ | |||
112 | u32 command; | 114 | u32 command; |
113 | 115 | ||
114 | /* SILICON QUIRKS */ | 116 | /* SILICON QUIRKS */ |
115 | unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */ | ||
116 | unsigned no_selective_suspend:1; | 117 | unsigned no_selective_suspend:1; |
117 | unsigned has_fsl_port_bug:1; /* FreeScale */ | 118 | unsigned has_fsl_port_bug:1; /* FreeScale */ |
118 | unsigned big_endian_mmio:1; | 119 | unsigned big_endian_mmio:1; |
@@ -678,7 +679,7 @@ struct ehci_fstn { | |||
678 | * needed (mostly in root hub code). | 679 | * needed (mostly in root hub code). |
679 | */ | 680 | */ |
680 | 681 | ||
681 | #define ehci_is_TDI(e) ((e)->is_tdi_rh_tt) | 682 | #define ehci_is_TDI(e) (ehci_to_hcd(e)->has_tt) |
682 | 683 | ||
683 | /* Returns the speed of a device attached to a port on the root hub. */ | 684 | /* Returns the speed of a device attached to a port on the root hub. */ |
684 | static inline unsigned int | 685 | static inline unsigned int |
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index a53db1d4e07a..eb6c06979f3b 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig | |||
@@ -269,3 +269,14 @@ config USB_TEST | |||
269 | See <http://www.linux-usb.org/usbtest/> for more information, | 269 | See <http://www.linux-usb.org/usbtest/> for more information, |
270 | including sample test device firmware and "how to use it". | 270 | including sample test device firmware and "how to use it". |
271 | 271 | ||
272 | config USB_ISIGHTFW | ||
273 | tristate "iSight firmware loading support" | ||
274 | depends on USB | ||
275 | help | ||
276 | This driver loads firmware for USB Apple iSight cameras, allowing | ||
277 | them to be driven by the USB video class driver available at | ||
278 | http://linux-uvc.berlios.de | ||
279 | |||
280 | The firmware for this driver must be extracted from the MacOS | ||
281 | driver beforehand. Tools for doing so are available at | ||
282 | http://bersace03.free.fr | ||
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index b68e6b774f1a..aba091cb5ec0 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_EMI62) += emi62.o | |||
14 | obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o | 14 | obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o |
15 | obj-$(CONFIG_USB_IDMOUSE) += idmouse.o | 15 | obj-$(CONFIG_USB_IDMOUSE) += idmouse.o |
16 | obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o | 16 | obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o |
17 | obj-$(CONFIG_USB_ISIGHTFW) += isight_firmware.o | ||
17 | obj-$(CONFIG_USB_LCD) += usblcd.o | 18 | obj-$(CONFIG_USB_LCD) += usblcd.o |
18 | obj-$(CONFIG_USB_LD) += ldusb.o | 19 | obj-$(CONFIG_USB_LD) += ldusb.o |
19 | obj-$(CONFIG_USB_LED) += usbled.o | 20 | obj-$(CONFIG_USB_LED) += usbled.o |
diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c new file mode 100644 index 000000000000..390e04885536 --- /dev/null +++ b/drivers/usb/misc/isight_firmware.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Driver for loading USB isight firmware | ||
3 | * | ||
4 | * Copyright (C) 2008 Matthew Garrett <mjg@redhat.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * The USB isight cameras in recent Apples are roughly compatible with the USB | ||
11 | * video class specification, and can be driven by uvcvideo. However, they | ||
12 | * need firmware to be loaded beforehand. After firmware loading, the device | ||
13 | * detaches from the USB bus and reattaches with a new device ID. It can then | ||
14 | * be claimed by the uvc driver. | ||
15 | * | ||
16 | * The firmware is non-free and must be extracted by the user. Tools to do this | ||
17 | * are available at http://bersace03.free.fr/ift/ | ||
18 | * | ||
19 | * The isight firmware loading was reverse engineered by Johannes Berg | ||
20 | * <johannes@sipsolutions.de>, and this driver is based on code by Ronald | ||
21 | * Bultje <rbultje@ronald.bitfreak.net> | ||
22 | */ | ||
23 | |||
24 | #include <linux/usb.h> | ||
25 | #include <linux/firmware.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/module.h> | ||
28 | |||
29 | static struct usb_device_id id_table[] = { | ||
30 | {USB_DEVICE(0x05ac, 0x8300)}, | ||
31 | {}, | ||
32 | }; | ||
33 | |||
34 | MODULE_DEVICE_TABLE(usb, id_table); | ||
35 | |||
36 | static int isight_firmware_load(struct usb_interface *intf, | ||
37 | const struct usb_device_id *id) | ||
38 | { | ||
39 | struct usb_device *dev = interface_to_usbdev(intf); | ||
40 | int llen, len, req, ret = 0; | ||
41 | const struct firmware *firmware; | ||
42 | unsigned char *buf; | ||
43 | unsigned char data[4]; | ||
44 | char *ptr; | ||
45 | |||
46 | if (request_firmware(&firmware, "isight.fw", &dev->dev) != 0) { | ||
47 | printk(KERN_ERR "Unable to load isight firmware\n"); | ||
48 | return -ENODEV; | ||
49 | } | ||
50 | |||
51 | ptr = firmware->data; | ||
52 | |||
53 | if (usb_control_msg | ||
54 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\1", 1, | ||
55 | 300) != 1) { | ||
56 | printk(KERN_ERR | ||
57 | "Failed to initialise isight firmware loader\n"); | ||
58 | ret = -ENODEV; | ||
59 | goto out; | ||
60 | } | ||
61 | |||
62 | while (1) { | ||
63 | memcpy(data, ptr, 4); | ||
64 | len = (data[0] << 8 | data[1]); | ||
65 | req = (data[2] << 8 | data[3]); | ||
66 | ptr += 4; | ||
67 | |||
68 | if (len == 0x8001) | ||
69 | break; /* success */ | ||
70 | else if (len == 0) | ||
71 | continue; | ||
72 | |||
73 | for (; len > 0; req += 50) { | ||
74 | llen = len > 50 ? 50 : len; | ||
75 | len -= llen; | ||
76 | |||
77 | buf = kmalloc(llen, GFP_KERNEL); | ||
78 | memcpy(buf, ptr, llen); | ||
79 | |||
80 | ptr += llen; | ||
81 | |||
82 | if (usb_control_msg | ||
83 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, req, 0, | ||
84 | buf, llen, 300) != llen) { | ||
85 | printk(KERN_ERR | ||
86 | "Failed to load isight firmware\n"); | ||
87 | kfree(buf); | ||
88 | ret = -ENODEV; | ||
89 | goto out; | ||
90 | } | ||
91 | |||
92 | kfree(buf); | ||
93 | } | ||
94 | } | ||
95 | if (usb_control_msg | ||
96 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1, | ||
97 | 300) != 1) { | ||
98 | printk(KERN_ERR "isight firmware loading completion failed\n"); | ||
99 | ret = -ENODEV; | ||
100 | } | ||
101 | out: | ||
102 | release_firmware(firmware); | ||
103 | return ret; | ||
104 | } | ||
105 | |||
106 | static void isight_firmware_disconnect(struct usb_interface *intf) | ||
107 | { | ||
108 | } | ||
109 | |||
110 | static struct usb_driver isight_firmware_driver = { | ||
111 | .name = "isight_firmware", | ||
112 | .probe = isight_firmware_load, | ||
113 | .disconnect = isight_firmware_disconnect, | ||
114 | .id_table = id_table, | ||
115 | }; | ||
116 | |||
117 | static int __init isight_firmware_init(void) | ||
118 | { | ||
119 | return usb_register(&isight_firmware_driver); | ||
120 | } | ||
121 | |||
122 | static void __exit isight_firmware_exit(void) | ||
123 | { | ||
124 | usb_deregister(&isight_firmware_driver); | ||
125 | } | ||
126 | |||
127 | module_init(isight_firmware_init); | ||
128 | module_exit(isight_firmware_exit); | ||
129 | |||
130 | MODULE_LICENSE("GPL"); | ||
131 | MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); | ||
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 24230c638b8e..4cfa25b0f44e 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -595,14 +595,14 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic | |||
595 | } while(value); | 595 | } while(value); |
596 | kit->dev_no = bit; | 596 | kit->dev_no = bit; |
597 | 597 | ||
598 | kit->dev = device_create(phidget_class, &kit->udev->dev, 0, | 598 | kit->dev = device_create_drvdata(phidget_class, &kit->udev->dev, |
599 | "interfacekit%d", kit->dev_no); | 599 | MKDEV(0, 0), kit, |
600 | "interfacekit%d", kit->dev_no); | ||
600 | if (IS_ERR(kit->dev)) { | 601 | if (IS_ERR(kit->dev)) { |
601 | rc = PTR_ERR(kit->dev); | 602 | rc = PTR_ERR(kit->dev); |
602 | kit->dev = NULL; | 603 | kit->dev = NULL; |
603 | goto out; | 604 | goto out; |
604 | } | 605 | } |
605 | dev_set_drvdata(kit->dev, kit); | ||
606 | 606 | ||
607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { | 607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { |
608 | rc = -EIO; | 608 | rc = -EIO; |
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index f0113c17cc5a..9b4696f21b22 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -365,16 +365,15 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
365 | } while(value); | 365 | } while(value); |
366 | mc->dev_no = bit; | 366 | mc->dev_no = bit; |
367 | 367 | ||
368 | mc->dev = device_create(phidget_class, &mc->udev->dev, 0, | 368 | mc->dev = device_create_drvdata(phidget_class, &mc->udev->dev, |
369 | "motorcontrol%d", mc->dev_no); | 369 | MKDEV(0, 0), mc, |
370 | "motorcontrol%d", mc->dev_no); | ||
370 | if (IS_ERR(mc->dev)) { | 371 | if (IS_ERR(mc->dev)) { |
371 | rc = PTR_ERR(mc->dev); | 372 | rc = PTR_ERR(mc->dev); |
372 | mc->dev = NULL; | 373 | mc->dev = NULL; |
373 | goto out; | 374 | goto out; |
374 | } | 375 | } |
375 | 376 | ||
376 | dev_set_drvdata(mc->dev, mc); | ||
377 | |||
378 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { | 377 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { |
379 | rc = -EIO; | 378 | rc = -EIO; |
380 | goto out; | 379 | goto out; |
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 7d590c09434a..1ca7ddb41d4d 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c | |||
@@ -275,14 +275,14 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
275 | } while (value); | 275 | } while (value); |
276 | dev->dev_no = bit; | 276 | dev->dev_no = bit; |
277 | 277 | ||
278 | dev->dev = device_create(phidget_class, &dev->udev->dev, 0, | 278 | dev->dev = device_create_drvdata(phidget_class, &dev->udev->dev, |
279 | "servo%d", dev->dev_no); | 279 | MKDEV(0, 0), dev, |
280 | "servo%d", dev->dev_no); | ||
280 | if (IS_ERR(dev->dev)) { | 281 | if (IS_ERR(dev->dev)) { |
281 | rc = PTR_ERR(dev->dev); | 282 | rc = PTR_ERR(dev->dev); |
282 | dev->dev = NULL; | 283 | dev->dev = NULL; |
283 | goto out; | 284 | goto out; |
284 | } | 285 | } |
285 | dev_set_drvdata(dev->dev, dev); | ||
286 | 286 | ||
287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; | 287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; |
288 | 288 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index ba28fdc9ccd2..1f7c86bd8297 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -28,6 +28,7 @@ static int debug; | |||
28 | 28 | ||
29 | static struct usb_device_id id_table [] = { | 29 | static struct usb_device_id id_table [] = { |
30 | { USB_DEVICE(0x4348, 0x5523) }, | 30 | { USB_DEVICE(0x4348, 0x5523) }, |
31 | { USB_DEVICE(0x1a86, 0x7523) }, | ||
31 | { }, | 32 | { }, |
32 | }; | 33 | }; |
33 | MODULE_DEVICE_TABLE(usb, id_table); | 34 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 5b349ece7247..5234e7a3bd2c 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -174,8 +174,270 @@ static struct usb_device_id id_table_combined [] = { | |||
174 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, | 174 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, |
175 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, | 175 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
176 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 176 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
177 | { USB_DEVICE(MTXORB_VK_VID, MTXORB_VK_PID), | 177 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0100_PID) }, |
178 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0101_PID) }, | ||
179 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0102_PID) }, | ||
180 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0103_PID) }, | ||
181 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0104_PID) }, | ||
182 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0105_PID) }, | ||
183 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0106_PID) }, | ||
184 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0107_PID) }, | ||
185 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0108_PID) }, | ||
186 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0109_PID) }, | ||
187 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010A_PID) }, | ||
188 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010B_PID) }, | ||
189 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010C_PID) }, | ||
190 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010D_PID) }, | ||
191 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010E_PID) }, | ||
192 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010F_PID) }, | ||
193 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0110_PID) }, | ||
194 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0111_PID) }, | ||
195 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0112_PID) }, | ||
196 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0113_PID) }, | ||
197 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0114_PID) }, | ||
198 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0115_PID) }, | ||
199 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0116_PID) }, | ||
200 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0117_PID) }, | ||
201 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0118_PID) }, | ||
202 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0119_PID) }, | ||
203 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011A_PID) }, | ||
204 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011B_PID) }, | ||
205 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011C_PID) }, | ||
206 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011D_PID) }, | ||
207 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011E_PID) }, | ||
208 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011F_PID) }, | ||
209 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0120_PID) }, | ||
210 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0121_PID) }, | ||
211 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0122_PID) }, | ||
212 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0123_PID) }, | ||
213 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0124_PID) }, | ||
214 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0125_PID) }, | ||
215 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0126_PID) }, | ||
216 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0127_PID), | ||
178 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | 217 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, |
218 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0128_PID) }, | ||
219 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0129_PID) }, | ||
220 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012A_PID) }, | ||
221 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012B_PID) }, | ||
222 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012C_PID), | ||
223 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
224 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012D_PID) }, | ||
225 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012E_PID) }, | ||
226 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012F_PID) }, | ||
227 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0130_PID) }, | ||
228 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0131_PID) }, | ||
229 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0132_PID) }, | ||
230 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0133_PID) }, | ||
231 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0134_PID) }, | ||
232 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0135_PID) }, | ||
233 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0136_PID) }, | ||
234 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0137_PID) }, | ||
235 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0138_PID) }, | ||
236 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0139_PID) }, | ||
237 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013A_PID) }, | ||
238 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013B_PID) }, | ||
239 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013C_PID) }, | ||
240 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013D_PID) }, | ||
241 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013E_PID) }, | ||
242 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013F_PID) }, | ||
243 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0140_PID) }, | ||
244 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0141_PID) }, | ||
245 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0142_PID) }, | ||
246 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0143_PID) }, | ||
247 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0144_PID) }, | ||
248 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0145_PID) }, | ||
249 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0146_PID) }, | ||
250 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0147_PID) }, | ||
251 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0148_PID) }, | ||
252 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0149_PID) }, | ||
253 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014A_PID) }, | ||
254 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014B_PID) }, | ||
255 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014C_PID) }, | ||
256 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014D_PID) }, | ||
257 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014E_PID) }, | ||
258 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014F_PID) }, | ||
259 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0150_PID) }, | ||
260 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0151_PID) }, | ||
261 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0152_PID) }, | ||
262 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0153_PID), | ||
263 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
264 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0154_PID), | ||
265 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
266 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0155_PID), | ||
267 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
268 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0156_PID), | ||
269 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
270 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0157_PID), | ||
271 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
272 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0158_PID), | ||
273 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
274 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0159_PID) }, | ||
275 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015A_PID) }, | ||
276 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015B_PID) }, | ||
277 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015C_PID) }, | ||
278 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015D_PID) }, | ||
279 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015E_PID) }, | ||
280 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015F_PID) }, | ||
281 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0160_PID) }, | ||
282 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0161_PID) }, | ||
283 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0162_PID) }, | ||
284 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0163_PID) }, | ||
285 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0164_PID) }, | ||
286 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0165_PID) }, | ||
287 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0166_PID) }, | ||
288 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0167_PID) }, | ||
289 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0168_PID) }, | ||
290 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0169_PID) }, | ||
291 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016A_PID) }, | ||
292 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016B_PID) }, | ||
293 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016C_PID) }, | ||
294 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016D_PID) }, | ||
295 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016E_PID) }, | ||
296 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016F_PID) }, | ||
297 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0170_PID) }, | ||
298 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0171_PID) }, | ||
299 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0172_PID) }, | ||
300 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0173_PID) }, | ||
301 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0174_PID) }, | ||
302 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0175_PID) }, | ||
303 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0176_PID) }, | ||
304 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0177_PID) }, | ||
305 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0178_PID) }, | ||
306 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0179_PID) }, | ||
307 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017A_PID) }, | ||
308 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017B_PID) }, | ||
309 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017C_PID) }, | ||
310 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017D_PID) }, | ||
311 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017E_PID) }, | ||
312 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017F_PID) }, | ||
313 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0180_PID) }, | ||
314 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0181_PID) }, | ||
315 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0182_PID) }, | ||
316 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0183_PID) }, | ||
317 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0184_PID) }, | ||
318 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0185_PID) }, | ||
319 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0186_PID) }, | ||
320 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0187_PID) }, | ||
321 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0188_PID) }, | ||
322 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0189_PID) }, | ||
323 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018A_PID) }, | ||
324 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018B_PID) }, | ||
325 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018C_PID) }, | ||
326 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018D_PID) }, | ||
327 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018E_PID) }, | ||
328 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018F_PID) }, | ||
329 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0190_PID) }, | ||
330 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0191_PID) }, | ||
331 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0192_PID) }, | ||
332 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0193_PID) }, | ||
333 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0194_PID) }, | ||
334 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0195_PID) }, | ||
335 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0196_PID) }, | ||
336 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0197_PID) }, | ||
337 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0198_PID) }, | ||
338 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0199_PID) }, | ||
339 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019A_PID) }, | ||
340 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019B_PID) }, | ||
341 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019C_PID) }, | ||
342 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019D_PID) }, | ||
343 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019E_PID) }, | ||
344 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019F_PID) }, | ||
345 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A0_PID) }, | ||
346 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A1_PID) }, | ||
347 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A2_PID) }, | ||
348 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A3_PID) }, | ||
349 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A4_PID) }, | ||
350 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A5_PID) }, | ||
351 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A6_PID) }, | ||
352 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A7_PID) }, | ||
353 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A8_PID) }, | ||
354 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A9_PID) }, | ||
355 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AA_PID) }, | ||
356 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AB_PID) }, | ||
357 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AC_PID) }, | ||
358 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AD_PID) }, | ||
359 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AE_PID) }, | ||
360 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AF_PID) }, | ||
361 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B0_PID) }, | ||
362 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B1_PID) }, | ||
363 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B2_PID) }, | ||
364 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B3_PID) }, | ||
365 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B4_PID) }, | ||
366 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B5_PID) }, | ||
367 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B6_PID) }, | ||
368 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B7_PID) }, | ||
369 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B8_PID) }, | ||
370 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B9_PID) }, | ||
371 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BA_PID) }, | ||
372 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BB_PID) }, | ||
373 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BC_PID) }, | ||
374 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BD_PID) }, | ||
375 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BE_PID) }, | ||
376 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BF_PID) }, | ||
377 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C0_PID) }, | ||
378 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C1_PID) }, | ||
379 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C2_PID) }, | ||
380 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C3_PID) }, | ||
381 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C4_PID) }, | ||
382 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C5_PID) }, | ||
383 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C6_PID) }, | ||
384 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C7_PID) }, | ||
385 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C8_PID) }, | ||
386 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C9_PID) }, | ||
387 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CA_PID) }, | ||
388 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CB_PID) }, | ||
389 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CC_PID) }, | ||
390 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CD_PID) }, | ||
391 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CE_PID) }, | ||
392 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CF_PID) }, | ||
393 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D0_PID) }, | ||
394 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D1_PID) }, | ||
395 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D2_PID) }, | ||
396 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D3_PID) }, | ||
397 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D4_PID) }, | ||
398 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D5_PID) }, | ||
399 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D6_PID) }, | ||
400 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D7_PID) }, | ||
401 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D8_PID) }, | ||
402 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D9_PID) }, | ||
403 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DA_PID) }, | ||
404 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DB_PID) }, | ||
405 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DC_PID) }, | ||
406 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DD_PID) }, | ||
407 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DE_PID) }, | ||
408 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DF_PID) }, | ||
409 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E0_PID) }, | ||
410 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E1_PID) }, | ||
411 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E2_PID) }, | ||
412 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E3_PID) }, | ||
413 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E4_PID) }, | ||
414 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E5_PID) }, | ||
415 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E6_PID) }, | ||
416 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E7_PID) }, | ||
417 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E8_PID) }, | ||
418 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E9_PID) }, | ||
419 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EA_PID) }, | ||
420 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EB_PID) }, | ||
421 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EC_PID) }, | ||
422 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01ED_PID) }, | ||
423 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EE_PID) }, | ||
424 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EF_PID) }, | ||
425 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F0_PID) }, | ||
426 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F1_PID) }, | ||
427 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F2_PID) }, | ||
428 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F3_PID) }, | ||
429 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F4_PID) }, | ||
430 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F5_PID) }, | ||
431 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F6_PID) }, | ||
432 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F7_PID) }, | ||
433 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F8_PID) }, | ||
434 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F9_PID) }, | ||
435 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FA_PID) }, | ||
436 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FB_PID) }, | ||
437 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FC_PID) }, | ||
438 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FD_PID) }, | ||
439 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FE_PID) }, | ||
440 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FF_PID) }, | ||
179 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 441 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
180 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 442 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
181 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | 443 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, |
@@ -374,6 +636,7 @@ static struct usb_device_id id_table_combined [] = { | |||
374 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 636 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
375 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), | 637 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), |
376 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 638 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
639 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | ||
377 | { }, /* Optional parameter entry */ | 640 | { }, /* Optional parameter entry */ |
378 | { } /* Terminating entry */ | 641 | { } /* Terminating entry */ |
379 | }; | 642 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 504edf8c3a3f..06e0ecabb3eb 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -114,11 +114,268 @@ | |||
114 | #define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ | 114 | #define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * The following are the values for the Matrix Orbital VK204-25-USB | 117 | * The following are the values for the Matrix Orbital FTDI Range |
118 | * display, which use the FT232RL. | 118 | * Anything in this range will use an FT232RL. |
119 | */ | 119 | */ |
120 | #define MTXORB_VK_VID 0x1b3d | 120 | #define MTXORB_VID 0x1B3D |
121 | #define MTXORB_VK_PID 0x0158 | 121 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 |
122 | #define MTXORB_FTDI_RANGE_0101_PID 0x0101 | ||
123 | #define MTXORB_FTDI_RANGE_0102_PID 0x0102 | ||
124 | #define MTXORB_FTDI_RANGE_0103_PID 0x0103 | ||
125 | #define MTXORB_FTDI_RANGE_0104_PID 0x0104 | ||
126 | #define MTXORB_FTDI_RANGE_0105_PID 0x0105 | ||
127 | #define MTXORB_FTDI_RANGE_0106_PID 0x0106 | ||
128 | #define MTXORB_FTDI_RANGE_0107_PID 0x0107 | ||
129 | #define MTXORB_FTDI_RANGE_0108_PID 0x0108 | ||
130 | #define MTXORB_FTDI_RANGE_0109_PID 0x0109 | ||
131 | #define MTXORB_FTDI_RANGE_010A_PID 0x010A | ||
132 | #define MTXORB_FTDI_RANGE_010B_PID 0x010B | ||
133 | #define MTXORB_FTDI_RANGE_010C_PID 0x010C | ||
134 | #define MTXORB_FTDI_RANGE_010D_PID 0x010D | ||
135 | #define MTXORB_FTDI_RANGE_010E_PID 0x010E | ||
136 | #define MTXORB_FTDI_RANGE_010F_PID 0x010F | ||
137 | #define MTXORB_FTDI_RANGE_0110_PID 0x0110 | ||
138 | #define MTXORB_FTDI_RANGE_0111_PID 0x0111 | ||
139 | #define MTXORB_FTDI_RANGE_0112_PID 0x0112 | ||
140 | #define MTXORB_FTDI_RANGE_0113_PID 0x0113 | ||
141 | #define MTXORB_FTDI_RANGE_0114_PID 0x0114 | ||
142 | #define MTXORB_FTDI_RANGE_0115_PID 0x0115 | ||
143 | #define MTXORB_FTDI_RANGE_0116_PID 0x0116 | ||
144 | #define MTXORB_FTDI_RANGE_0117_PID 0x0117 | ||
145 | #define MTXORB_FTDI_RANGE_0118_PID 0x0118 | ||
146 | #define MTXORB_FTDI_RANGE_0119_PID 0x0119 | ||
147 | #define MTXORB_FTDI_RANGE_011A_PID 0x011A | ||
148 | #define MTXORB_FTDI_RANGE_011B_PID 0x011B | ||
149 | #define MTXORB_FTDI_RANGE_011C_PID 0x011C | ||
150 | #define MTXORB_FTDI_RANGE_011D_PID 0x011D | ||
151 | #define MTXORB_FTDI_RANGE_011E_PID 0x011E | ||
152 | #define MTXORB_FTDI_RANGE_011F_PID 0x011F | ||
153 | #define MTXORB_FTDI_RANGE_0120_PID 0x0120 | ||
154 | #define MTXORB_FTDI_RANGE_0121_PID 0x0121 | ||
155 | #define MTXORB_FTDI_RANGE_0122_PID 0x0122 | ||
156 | #define MTXORB_FTDI_RANGE_0123_PID 0x0123 | ||
157 | #define MTXORB_FTDI_RANGE_0124_PID 0x0124 | ||
158 | #define MTXORB_FTDI_RANGE_0125_PID 0x0125 | ||
159 | #define MTXORB_FTDI_RANGE_0126_PID 0x0126 | ||
160 | #define MTXORB_FTDI_RANGE_0127_PID 0x0127 | ||
161 | #define MTXORB_FTDI_RANGE_0128_PID 0x0128 | ||
162 | #define MTXORB_FTDI_RANGE_0129_PID 0x0129 | ||
163 | #define MTXORB_FTDI_RANGE_012A_PID 0x012A | ||
164 | #define MTXORB_FTDI_RANGE_012B_PID 0x012B | ||
165 | #define MTXORB_FTDI_RANGE_012C_PID 0x012C | ||
166 | #define MTXORB_FTDI_RANGE_012D_PID 0x012D | ||
167 | #define MTXORB_FTDI_RANGE_012E_PID 0x012E | ||
168 | #define MTXORB_FTDI_RANGE_012F_PID 0x012F | ||
169 | #define MTXORB_FTDI_RANGE_0130_PID 0x0130 | ||
170 | #define MTXORB_FTDI_RANGE_0131_PID 0x0131 | ||
171 | #define MTXORB_FTDI_RANGE_0132_PID 0x0132 | ||
172 | #define MTXORB_FTDI_RANGE_0133_PID 0x0133 | ||
173 | #define MTXORB_FTDI_RANGE_0134_PID 0x0134 | ||
174 | #define MTXORB_FTDI_RANGE_0135_PID 0x0135 | ||
175 | #define MTXORB_FTDI_RANGE_0136_PID 0x0136 | ||
176 | #define MTXORB_FTDI_RANGE_0137_PID 0x0137 | ||
177 | #define MTXORB_FTDI_RANGE_0138_PID 0x0138 | ||
178 | #define MTXORB_FTDI_RANGE_0139_PID 0x0139 | ||
179 | #define MTXORB_FTDI_RANGE_013A_PID 0x013A | ||
180 | #define MTXORB_FTDI_RANGE_013B_PID 0x013B | ||
181 | #define MTXORB_FTDI_RANGE_013C_PID 0x013C | ||
182 | #define MTXORB_FTDI_RANGE_013D_PID 0x013D | ||
183 | #define MTXORB_FTDI_RANGE_013E_PID 0x013E | ||
184 | #define MTXORB_FTDI_RANGE_013F_PID 0x013F | ||
185 | #define MTXORB_FTDI_RANGE_0140_PID 0x0140 | ||
186 | #define MTXORB_FTDI_RANGE_0141_PID 0x0141 | ||
187 | #define MTXORB_FTDI_RANGE_0142_PID 0x0142 | ||
188 | #define MTXORB_FTDI_RANGE_0143_PID 0x0143 | ||
189 | #define MTXORB_FTDI_RANGE_0144_PID 0x0144 | ||
190 | #define MTXORB_FTDI_RANGE_0145_PID 0x0145 | ||
191 | #define MTXORB_FTDI_RANGE_0146_PID 0x0146 | ||
192 | #define MTXORB_FTDI_RANGE_0147_PID 0x0147 | ||
193 | #define MTXORB_FTDI_RANGE_0148_PID 0x0148 | ||
194 | #define MTXORB_FTDI_RANGE_0149_PID 0x0149 | ||
195 | #define MTXORB_FTDI_RANGE_014A_PID 0x014A | ||
196 | #define MTXORB_FTDI_RANGE_014B_PID 0x014B | ||
197 | #define MTXORB_FTDI_RANGE_014C_PID 0x014C | ||
198 | #define MTXORB_FTDI_RANGE_014D_PID 0x014D | ||
199 | #define MTXORB_FTDI_RANGE_014E_PID 0x014E | ||
200 | #define MTXORB_FTDI_RANGE_014F_PID 0x014F | ||
201 | #define MTXORB_FTDI_RANGE_0150_PID 0x0150 | ||
202 | #define MTXORB_FTDI_RANGE_0151_PID 0x0151 | ||
203 | #define MTXORB_FTDI_RANGE_0152_PID 0x0152 | ||
204 | #define MTXORB_FTDI_RANGE_0153_PID 0x0153 | ||
205 | #define MTXORB_FTDI_RANGE_0154_PID 0x0154 | ||
206 | #define MTXORB_FTDI_RANGE_0155_PID 0x0155 | ||
207 | #define MTXORB_FTDI_RANGE_0156_PID 0x0156 | ||
208 | #define MTXORB_FTDI_RANGE_0157_PID 0x0157 | ||
209 | #define MTXORB_FTDI_RANGE_0158_PID 0x0158 | ||
210 | #define MTXORB_FTDI_RANGE_0159_PID 0x0159 | ||
211 | #define MTXORB_FTDI_RANGE_015A_PID 0x015A | ||
212 | #define MTXORB_FTDI_RANGE_015B_PID 0x015B | ||
213 | #define MTXORB_FTDI_RANGE_015C_PID 0x015C | ||
214 | #define MTXORB_FTDI_RANGE_015D_PID 0x015D | ||
215 | #define MTXORB_FTDI_RANGE_015E_PID 0x015E | ||
216 | #define MTXORB_FTDI_RANGE_015F_PID 0x015F | ||
217 | #define MTXORB_FTDI_RANGE_0160_PID 0x0160 | ||
218 | #define MTXORB_FTDI_RANGE_0161_PID 0x0161 | ||
219 | #define MTXORB_FTDI_RANGE_0162_PID 0x0162 | ||
220 | #define MTXORB_FTDI_RANGE_0163_PID 0x0163 | ||
221 | #define MTXORB_FTDI_RANGE_0164_PID 0x0164 | ||
222 | #define MTXORB_FTDI_RANGE_0165_PID 0x0165 | ||
223 | #define MTXORB_FTDI_RANGE_0166_PID 0x0166 | ||
224 | #define MTXORB_FTDI_RANGE_0167_PID 0x0167 | ||
225 | #define MTXORB_FTDI_RANGE_0168_PID 0x0168 | ||
226 | #define MTXORB_FTDI_RANGE_0169_PID 0x0169 | ||
227 | #define MTXORB_FTDI_RANGE_016A_PID 0x016A | ||
228 | #define MTXORB_FTDI_RANGE_016B_PID 0x016B | ||
229 | #define MTXORB_FTDI_RANGE_016C_PID 0x016C | ||
230 | #define MTXORB_FTDI_RANGE_016D_PID 0x016D | ||
231 | #define MTXORB_FTDI_RANGE_016E_PID 0x016E | ||
232 | #define MTXORB_FTDI_RANGE_016F_PID 0x016F | ||
233 | #define MTXORB_FTDI_RANGE_0170_PID 0x0170 | ||
234 | #define MTXORB_FTDI_RANGE_0171_PID 0x0171 | ||
235 | #define MTXORB_FTDI_RANGE_0172_PID 0x0172 | ||
236 | #define MTXORB_FTDI_RANGE_0173_PID 0x0173 | ||
237 | #define MTXORB_FTDI_RANGE_0174_PID 0x0174 | ||
238 | #define MTXORB_FTDI_RANGE_0175_PID 0x0175 | ||
239 | #define MTXORB_FTDI_RANGE_0176_PID 0x0176 | ||
240 | #define MTXORB_FTDI_RANGE_0177_PID 0x0177 | ||
241 | #define MTXORB_FTDI_RANGE_0178_PID 0x0178 | ||
242 | #define MTXORB_FTDI_RANGE_0179_PID 0x0179 | ||
243 | #define MTXORB_FTDI_RANGE_017A_PID 0x017A | ||
244 | #define MTXORB_FTDI_RANGE_017B_PID 0x017B | ||
245 | #define MTXORB_FTDI_RANGE_017C_PID 0x017C | ||
246 | #define MTXORB_FTDI_RANGE_017D_PID 0x017D | ||
247 | #define MTXORB_FTDI_RANGE_017E_PID 0x017E | ||
248 | #define MTXORB_FTDI_RANGE_017F_PID 0x017F | ||
249 | #define MTXORB_FTDI_RANGE_0180_PID 0x0180 | ||
250 | #define MTXORB_FTDI_RANGE_0181_PID 0x0181 | ||
251 | #define MTXORB_FTDI_RANGE_0182_PID 0x0182 | ||
252 | #define MTXORB_FTDI_RANGE_0183_PID 0x0183 | ||
253 | #define MTXORB_FTDI_RANGE_0184_PID 0x0184 | ||
254 | #define MTXORB_FTDI_RANGE_0185_PID 0x0185 | ||
255 | #define MTXORB_FTDI_RANGE_0186_PID 0x0186 | ||
256 | #define MTXORB_FTDI_RANGE_0187_PID 0x0187 | ||
257 | #define MTXORB_FTDI_RANGE_0188_PID 0x0188 | ||
258 | #define MTXORB_FTDI_RANGE_0189_PID 0x0189 | ||
259 | #define MTXORB_FTDI_RANGE_018A_PID 0x018A | ||
260 | #define MTXORB_FTDI_RANGE_018B_PID 0x018B | ||
261 | #define MTXORB_FTDI_RANGE_018C_PID 0x018C | ||
262 | #define MTXORB_FTDI_RANGE_018D_PID 0x018D | ||
263 | #define MTXORB_FTDI_RANGE_018E_PID 0x018E | ||
264 | #define MTXORB_FTDI_RANGE_018F_PID 0x018F | ||
265 | #define MTXORB_FTDI_RANGE_0190_PID 0x0190 | ||
266 | #define MTXORB_FTDI_RANGE_0191_PID 0x0191 | ||
267 | #define MTXORB_FTDI_RANGE_0192_PID 0x0192 | ||
268 | #define MTXORB_FTDI_RANGE_0193_PID 0x0193 | ||
269 | #define MTXORB_FTDI_RANGE_0194_PID 0x0194 | ||
270 | #define MTXORB_FTDI_RANGE_0195_PID 0x0195 | ||
271 | #define MTXORB_FTDI_RANGE_0196_PID 0x0196 | ||
272 | #define MTXORB_FTDI_RANGE_0197_PID 0x0197 | ||
273 | #define MTXORB_FTDI_RANGE_0198_PID 0x0198 | ||
274 | #define MTXORB_FTDI_RANGE_0199_PID 0x0199 | ||
275 | #define MTXORB_FTDI_RANGE_019A_PID 0x019A | ||
276 | #define MTXORB_FTDI_RANGE_019B_PID 0x019B | ||
277 | #define MTXORB_FTDI_RANGE_019C_PID 0x019C | ||
278 | #define MTXORB_FTDI_RANGE_019D_PID 0x019D | ||
279 | #define MTXORB_FTDI_RANGE_019E_PID 0x019E | ||
280 | #define MTXORB_FTDI_RANGE_019F_PID 0x019F | ||
281 | #define MTXORB_FTDI_RANGE_01A0_PID 0x01A0 | ||
282 | #define MTXORB_FTDI_RANGE_01A1_PID 0x01A1 | ||
283 | #define MTXORB_FTDI_RANGE_01A2_PID 0x01A2 | ||
284 | #define MTXORB_FTDI_RANGE_01A3_PID 0x01A3 | ||
285 | #define MTXORB_FTDI_RANGE_01A4_PID 0x01A4 | ||
286 | #define MTXORB_FTDI_RANGE_01A5_PID 0x01A5 | ||
287 | #define MTXORB_FTDI_RANGE_01A6_PID 0x01A6 | ||
288 | #define MTXORB_FTDI_RANGE_01A7_PID 0x01A7 | ||
289 | #define MTXORB_FTDI_RANGE_01A8_PID 0x01A8 | ||
290 | #define MTXORB_FTDI_RANGE_01A9_PID 0x01A9 | ||
291 | #define MTXORB_FTDI_RANGE_01AA_PID 0x01AA | ||
292 | #define MTXORB_FTDI_RANGE_01AB_PID 0x01AB | ||
293 | #define MTXORB_FTDI_RANGE_01AC_PID 0x01AC | ||
294 | #define MTXORB_FTDI_RANGE_01AD_PID 0x01AD | ||
295 | #define MTXORB_FTDI_RANGE_01AE_PID 0x01AE | ||
296 | #define MTXORB_FTDI_RANGE_01AF_PID 0x01AF | ||
297 | #define MTXORB_FTDI_RANGE_01B0_PID 0x01B0 | ||
298 | #define MTXORB_FTDI_RANGE_01B1_PID 0x01B1 | ||
299 | #define MTXORB_FTDI_RANGE_01B2_PID 0x01B2 | ||
300 | #define MTXORB_FTDI_RANGE_01B3_PID 0x01B3 | ||
301 | #define MTXORB_FTDI_RANGE_01B4_PID 0x01B4 | ||
302 | #define MTXORB_FTDI_RANGE_01B5_PID 0x01B5 | ||
303 | #define MTXORB_FTDI_RANGE_01B6_PID 0x01B6 | ||
304 | #define MTXORB_FTDI_RANGE_01B7_PID 0x01B7 | ||
305 | #define MTXORB_FTDI_RANGE_01B8_PID 0x01B8 | ||
306 | #define MTXORB_FTDI_RANGE_01B9_PID 0x01B9 | ||
307 | #define MTXORB_FTDI_RANGE_01BA_PID 0x01BA | ||
308 | #define MTXORB_FTDI_RANGE_01BB_PID 0x01BB | ||
309 | #define MTXORB_FTDI_RANGE_01BC_PID 0x01BC | ||
310 | #define MTXORB_FTDI_RANGE_01BD_PID 0x01BD | ||
311 | #define MTXORB_FTDI_RANGE_01BE_PID 0x01BE | ||
312 | #define MTXORB_FTDI_RANGE_01BF_PID 0x01BF | ||
313 | #define MTXORB_FTDI_RANGE_01C0_PID 0x01C0 | ||
314 | #define MTXORB_FTDI_RANGE_01C1_PID 0x01C1 | ||
315 | #define MTXORB_FTDI_RANGE_01C2_PID 0x01C2 | ||
316 | #define MTXORB_FTDI_RANGE_01C3_PID 0x01C3 | ||
317 | #define MTXORB_FTDI_RANGE_01C4_PID 0x01C4 | ||
318 | #define MTXORB_FTDI_RANGE_01C5_PID 0x01C5 | ||
319 | #define MTXORB_FTDI_RANGE_01C6_PID 0x01C6 | ||
320 | #define MTXORB_FTDI_RANGE_01C7_PID 0x01C7 | ||
321 | #define MTXORB_FTDI_RANGE_01C8_PID 0x01C8 | ||
322 | #define MTXORB_FTDI_RANGE_01C9_PID 0x01C9 | ||
323 | #define MTXORB_FTDI_RANGE_01CA_PID 0x01CA | ||
324 | #define MTXORB_FTDI_RANGE_01CB_PID 0x01CB | ||
325 | #define MTXORB_FTDI_RANGE_01CC_PID 0x01CC | ||
326 | #define MTXORB_FTDI_RANGE_01CD_PID 0x01CD | ||
327 | #define MTXORB_FTDI_RANGE_01CE_PID 0x01CE | ||
328 | #define MTXORB_FTDI_RANGE_01CF_PID 0x01CF | ||
329 | #define MTXORB_FTDI_RANGE_01D0_PID 0x01D0 | ||
330 | #define MTXORB_FTDI_RANGE_01D1_PID 0x01D1 | ||
331 | #define MTXORB_FTDI_RANGE_01D2_PID 0x01D2 | ||
332 | #define MTXORB_FTDI_RANGE_01D3_PID 0x01D3 | ||
333 | #define MTXORB_FTDI_RANGE_01D4_PID 0x01D4 | ||
334 | #define MTXORB_FTDI_RANGE_01D5_PID 0x01D5 | ||
335 | #define MTXORB_FTDI_RANGE_01D6_PID 0x01D6 | ||
336 | #define MTXORB_FTDI_RANGE_01D7_PID 0x01D7 | ||
337 | #define MTXORB_FTDI_RANGE_01D8_PID 0x01D8 | ||
338 | #define MTXORB_FTDI_RANGE_01D9_PID 0x01D9 | ||
339 | #define MTXORB_FTDI_RANGE_01DA_PID 0x01DA | ||
340 | #define MTXORB_FTDI_RANGE_01DB_PID 0x01DB | ||
341 | #define MTXORB_FTDI_RANGE_01DC_PID 0x01DC | ||
342 | #define MTXORB_FTDI_RANGE_01DD_PID 0x01DD | ||
343 | #define MTXORB_FTDI_RANGE_01DE_PID 0x01DE | ||
344 | #define MTXORB_FTDI_RANGE_01DF_PID 0x01DF | ||
345 | #define MTXORB_FTDI_RANGE_01E0_PID 0x01E0 | ||
346 | #define MTXORB_FTDI_RANGE_01E1_PID 0x01E1 | ||
347 | #define MTXORB_FTDI_RANGE_01E2_PID 0x01E2 | ||
348 | #define MTXORB_FTDI_RANGE_01E3_PID 0x01E3 | ||
349 | #define MTXORB_FTDI_RANGE_01E4_PID 0x01E4 | ||
350 | #define MTXORB_FTDI_RANGE_01E5_PID 0x01E5 | ||
351 | #define MTXORB_FTDI_RANGE_01E6_PID 0x01E6 | ||
352 | #define MTXORB_FTDI_RANGE_01E7_PID 0x01E7 | ||
353 | #define MTXORB_FTDI_RANGE_01E8_PID 0x01E8 | ||
354 | #define MTXORB_FTDI_RANGE_01E9_PID 0x01E9 | ||
355 | #define MTXORB_FTDI_RANGE_01EA_PID 0x01EA | ||
356 | #define MTXORB_FTDI_RANGE_01EB_PID 0x01EB | ||
357 | #define MTXORB_FTDI_RANGE_01EC_PID 0x01EC | ||
358 | #define MTXORB_FTDI_RANGE_01ED_PID 0x01ED | ||
359 | #define MTXORB_FTDI_RANGE_01EE_PID 0x01EE | ||
360 | #define MTXORB_FTDI_RANGE_01EF_PID 0x01EF | ||
361 | #define MTXORB_FTDI_RANGE_01F0_PID 0x01F0 | ||
362 | #define MTXORB_FTDI_RANGE_01F1_PID 0x01F1 | ||
363 | #define MTXORB_FTDI_RANGE_01F2_PID 0x01F2 | ||
364 | #define MTXORB_FTDI_RANGE_01F3_PID 0x01F3 | ||
365 | #define MTXORB_FTDI_RANGE_01F4_PID 0x01F4 | ||
366 | #define MTXORB_FTDI_RANGE_01F5_PID 0x01F5 | ||
367 | #define MTXORB_FTDI_RANGE_01F6_PID 0x01F6 | ||
368 | #define MTXORB_FTDI_RANGE_01F7_PID 0x01F7 | ||
369 | #define MTXORB_FTDI_RANGE_01F8_PID 0x01F8 | ||
370 | #define MTXORB_FTDI_RANGE_01F9_PID 0x01F9 | ||
371 | #define MTXORB_FTDI_RANGE_01FA_PID 0x01FA | ||
372 | #define MTXORB_FTDI_RANGE_01FB_PID 0x01FB | ||
373 | #define MTXORB_FTDI_RANGE_01FC_PID 0x01FC | ||
374 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD | ||
375 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE | ||
376 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF | ||
377 | |||
378 | |||
122 | 379 | ||
123 | /* Interbiometrics USB I/O Board */ | 380 | /* Interbiometrics USB I/O Board */ |
124 | /* Developed for Interbiometrics by Rudolf Gugler */ | 381 | /* Developed for Interbiometrics by Rudolf Gugler */ |
@@ -592,6 +849,12 @@ | |||
592 | #define FIC_NEO1973_DEBUG_PID 0x5118 | 849 | #define FIC_NEO1973_DEBUG_PID 0x5118 |
593 | 850 | ||
594 | /* | 851 | /* |
852 | * RATOC REX-USB60F | ||
853 | */ | ||
854 | #define RATOC_VENDOR_ID 0x0584 | ||
855 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | ||
856 | |||
857 | /* | ||
595 | * BmRequestType: 1100 0000b | 858 | * BmRequestType: 1100 0000b |
596 | * bRequest: FTDI_E2_READ | 859 | * bRequest: FTDI_E2_READ |
597 | * wValue: 0 | 860 | * wValue: 0 |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e7e016e60333..43cfde83a93b 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -183,6 +183,7 @@ static int option_send_setup(struct usb_serial_port *port); | |||
183 | #define AXESSTEL_PRODUCT_MV110H 0x1000 | 183 | #define AXESSTEL_PRODUCT_MV110H 0x1000 |
184 | 184 | ||
185 | #define ONDA_VENDOR_ID 0x19d2 | 185 | #define ONDA_VENDOR_ID 0x19d2 |
186 | #define ONDA_PRODUCT_MSA501HS 0x0001 | ||
186 | #define ONDA_PRODUCT_ET502HS 0x0002 | 187 | #define ONDA_PRODUCT_ET502HS 0x0002 |
187 | 188 | ||
188 | #define BANDRICH_VENDOR_ID 0x1A8D | 189 | #define BANDRICH_VENDOR_ID 0x1A8D |
@@ -196,6 +197,9 @@ static int option_send_setup(struct usb_serial_port *port); | |||
196 | 197 | ||
197 | #define MAXON_VENDOR_ID 0x16d8 | 198 | #define MAXON_VENDOR_ID 0x16d8 |
198 | 199 | ||
200 | #define TELIT_VENDOR_ID 0x1bc7 | ||
201 | #define TELIT_PRODUCT_UC864E 0x1003 | ||
202 | |||
199 | static struct usb_device_id option_ids[] = { | 203 | static struct usb_device_id option_ids[] = { |
200 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 204 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
201 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 205 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -232,25 +236,25 @@ static struct usb_device_id option_ids[] = { | |||
232 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) }, | 236 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) }, |
233 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, | 237 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, |
234 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, | 238 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, |
235 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 239 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) }, |
236 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, | 240 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, |
237 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, | 241 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, |
238 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401) }, | 242 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) }, |
239 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403) }, | 243 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) }, |
240 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405) }, | 244 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) }, |
241 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406) }, | 245 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) }, |
242 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408) }, | 246 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) }, |
243 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409) }, | 247 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) }, |
244 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410) }, | 248 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) }, |
245 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411) }, | 249 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) }, |
246 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412) }, | 250 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) }, |
247 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413) }, | 251 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413, 0xff, 0xff, 0xff) }, |
248 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414) }, | 252 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414, 0xff, 0xff, 0xff) }, |
249 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415) }, | 253 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415, 0xff, 0xff, 0xff) }, |
250 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416) }, | 254 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416, 0xff, 0xff, 0xff) }, |
251 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417) }, | 255 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) }, |
252 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418) }, | 256 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) }, |
253 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419) }, | 257 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) }, |
254 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, | 258 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, |
255 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ | 259 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ |
256 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ | 260 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ |
@@ -297,13 +301,14 @@ static struct usb_device_id option_ids[] = { | |||
297 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, | 301 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, |
298 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, | 302 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
299 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, | 303 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, |
304 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, | ||
300 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, | 305 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, |
301 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, | 306 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, |
302 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, | 307 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, |
303 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 308 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
304 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 309 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
305 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 310 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
306 | { USB_DEVICE(0x19d2, 0x0001) }, /* Telstra NextG CDMA */ | 311 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
307 | { } /* Terminating entry */ | 312 | { } /* Terminating entry */ |
308 | }; | 313 | }; |
309 | MODULE_DEVICE_TABLE(usb, option_ids); | 314 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index c605fb68f807..103195abd417 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -56,6 +56,7 @@ static struct usb_device_id id_table [] = { | |||
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
58 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, | 58 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, |
59 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, | ||
59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 60 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
60 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 61 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
61 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 62 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
@@ -66,7 +67,6 @@ static struct usb_device_id id_table [] = { | |||
66 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, | 67 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, |
67 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, | 68 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, |
68 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, | 69 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, |
69 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | ||
70 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, | 70 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, |
71 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, | 71 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, |
72 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, | 72 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 10cf872e5ecb..cff160abb130 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 | 15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 |
16 | #define PL2303_PRODUCT_ID_ALDIGA 0x0611 | 16 | #define PL2303_PRODUCT_ID_ALDIGA 0x0611 |
17 | #define PL2303_PRODUCT_ID_MMX 0x0612 | ||
17 | 18 | ||
18 | #define ATEN_VENDOR_ID 0x0557 | 19 | #define ATEN_VENDOR_ID 0x0557 |
19 | #define ATEN_VENDOR_ID2 0x0547 | 20 | #define ATEN_VENDOR_ID2 0x0547 |
@@ -36,7 +37,6 @@ | |||
36 | 37 | ||
37 | #define RATOC_VENDOR_ID 0x0584 | 38 | #define RATOC_VENDOR_ID 0x0584 |
38 | #define RATOC_PRODUCT_ID 0xb000 | 39 | #define RATOC_PRODUCT_ID 0xb000 |
39 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | ||
40 | 40 | ||
41 | #define TRIPP_VENDOR_ID 0x2478 | 41 | #define TRIPP_VENDOR_ID 0x2478 |
42 | #define TRIPP_PRODUCT_ID 0x2008 | 42 | #define TRIPP_PRODUCT_ID 0x2008 |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 1b09578cbb10..45fe3663fa7f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -405,7 +405,7 @@ UNUSUAL_DEV( 0x04a5, 0x3010, 0x0100, 0x0100, | |||
405 | UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, | 405 | UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, |
406 | "Cypress", | 406 | "Cypress", |
407 | "Cypress AT2LP", | 407 | "Cypress AT2LP", |
408 | US_SC_CYP_ATACB, US_PR_BULK, NULL, | 408 | US_SC_CYP_ATACB, US_PR_DEVICE, NULL, |
409 | 0), | 409 | 0), |
410 | #endif | 410 | #endif |
411 | 411 | ||
@@ -1522,7 +1522,7 @@ UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000, | |||
1522 | "Sony Ericsson", | 1522 | "Sony Ericsson", |
1523 | "M600i", | 1523 | "M600i", |
1524 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1524 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1525 | US_FL_FIX_CAPACITY ), | 1525 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), |
1526 | 1526 | ||
1527 | /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> | 1527 | /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> |
1528 | * Tested on hardware version 1.10. | 1528 | * Tested on hardware version 1.10. |
@@ -1716,10 +1716,12 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, | |||
1716 | /* | 1716 | /* |
1717 | * Patch by Pete Zaitcev <zaitcev@redhat.com> | 1717 | * Patch by Pete Zaitcev <zaitcev@redhat.com> |
1718 | * Report by Mark Patton. Red Hat bz#208928. | 1718 | * Report by Mark Patton. Red Hat bz#208928. |
1719 | * Added support for rev 0x0002 (Motorola ROKR W5) | ||
1720 | * by Javier Smaldone <javier@smaldone.com.ar> | ||
1719 | */ | 1721 | */ |
1720 | UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001, | 1722 | UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002, |
1721 | "Motorola", | 1723 | "Motorola", |
1722 | "RAZR V3i", | 1724 | "RAZR V3i/ROKR W5", |
1723 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1725 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1724 | US_FL_FIX_CAPACITY), | 1726 | US_FL_FIX_CAPACITY), |
1725 | 1727 | ||
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index e4bcf5376a99..bd4ac0bafecb 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -3356,7 +3356,7 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *i | |||
3356 | 3356 | ||
3357 | info->fix.mmio_start = raddr; | 3357 | info->fix.mmio_start = raddr; |
3358 | par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); | 3358 | par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); |
3359 | if (par->ati_regbase == 0) | 3359 | if (par->ati_regbase == NULL) |
3360 | return -ENOMEM; | 3360 | return -ENOMEM; |
3361 | 3361 | ||
3362 | info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; | 3362 | info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 72cd0d2f14ec..400e9264e456 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -2277,8 +2277,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2277 | do { | 2277 | do { |
2278 | rinfo->fb_base = ioremap (rinfo->fb_base_phys, | 2278 | rinfo->fb_base = ioremap (rinfo->fb_base_phys, |
2279 | rinfo->mapped_vram); | 2279 | rinfo->mapped_vram); |
2280 | } while ( rinfo->fb_base == 0 && | 2280 | } while (rinfo->fb_base == NULL && |
2281 | ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) ); | 2281 | ((rinfo->mapped_vram /= 2) >= MIN_MAPPED_VRAM)); |
2282 | 2282 | ||
2283 | if (rinfo->fb_base == NULL) { | 2283 | if (rinfo->fb_base == NULL) { |
2284 | printk (KERN_ERR "radeonfb (%s): cannot map FB\n", | 2284 | printk (KERN_ERR "radeonfb (%s): cannot map FB\n", |
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c index 35477177bef4..6ef800bdf482 100644 --- a/drivers/video/display/display-sysfs.c +++ b/drivers/video/display/display-sysfs.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/idr.h> | 27 | #include <linux/idr.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/kdev_t.h> | ||
29 | 30 | ||
30 | static ssize_t display_show_name(struct device *dev, | 31 | static ssize_t display_show_name(struct device *dev, |
31 | struct device_attribute *attr, char *buf) | 32 | struct device_attribute *attr, char *buf) |
@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver, | |||
152 | mutex_unlock(&allocated_dsp_lock); | 153 | mutex_unlock(&allocated_dsp_lock); |
153 | 154 | ||
154 | if (!ret) { | 155 | if (!ret) { |
155 | new_dev->dev = device_create(display_class, parent, 0, | 156 | new_dev->dev = device_create_drvdata(display_class, |
156 | "display%d", new_dev->idx); | 157 | parent, |
158 | MKDEV(0,0), | ||
159 | new_dev, | ||
160 | "display%d", | ||
161 | new_dev->idx); | ||
157 | if (!IS_ERR(new_dev->dev)) { | 162 | if (!IS_ERR(new_dev->dev)) { |
158 | dev_set_drvdata(new_dev->dev, new_dev); | ||
159 | new_dev->parent = parent; | 163 | new_dev->parent = parent; |
160 | new_dev->driver = driver; | 164 | new_dev->driver = driver; |
161 | mutex_init(&new_dev->lock); | 165 | mutex_init(&new_dev->lock); |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index f3107ad7e545..95883236c0cd 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -200,7 +200,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags, | |||
200 | virt->vaddr = ioremap_nocache(phys, size); | 200 | virt->vaddr = ioremap_nocache(phys, size); |
201 | else | 201 | else |
202 | virt->vaddr = ioremap(phys, size); | 202 | virt->vaddr = ioremap(phys, size); |
203 | return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */ | 203 | return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */ |
204 | } | 204 | } |
205 | 205 | ||
206 | static inline void mga_iounmap(vaddr_t va) { | 206 | static inline void mga_iounmap(vaddr_t va) { |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3ee314beacc1..274bc93ab7d8 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -1351,7 +1351,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) | |||
1351 | struct pxafb_info *fbi; | 1351 | struct pxafb_info *fbi; |
1352 | void *addr; | 1352 | void *addr; |
1353 | struct pxafb_mach_info *inf = dev->platform_data; | 1353 | struct pxafb_mach_info *inf = dev->platform_data; |
1354 | struct pxafb_mode_info *mode = inf->modes; | ||
1355 | 1354 | ||
1356 | /* Alloc the pxafb_info and pseudo_palette in one step */ | 1355 | /* Alloc the pxafb_info and pseudo_palette in one step */ |
1357 | fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); | 1356 | fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); |
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 13b38cbbe4cf..f0598961c6b0 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -1,75 +1,15 @@ | |||
1 | /* | 1 | /* linux/drivers/video/s3c2410fb.c |
2 | * linux/drivers/video/s3c2410fb.c | 2 | * Copyright (c) 2004,2005 Arnaud Patard |
3 | * Copyright (c) Arnaud Patard, Ben Dooks | 3 | * Copyright (c) 2004-2008 Ben Dooks |
4 | * | ||
5 | * S3C2410 LCD Framebuffer Driver | ||
4 | * | 6 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
6 | * License. See the file COPYING in the main directory of this archive for | 8 | * License. See the file COPYING in the main directory of this archive for |
7 | * more details. | 9 | * more details. |
8 | * | 10 | * |
9 | * S3C2410 LCD Controller Frame Buffer Driver | 11 | * Driver based on skeletonfb.c, sa1100fb.c and others. |
10 | * based on skeletonfb.c, sa1100fb.c and others | 12 | */ |
11 | * | ||
12 | * ChangeLog | ||
13 | * 2005-04-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
14 | * - u32 state -> pm_message_t state | ||
15 | * - S3C2410_{VA,SZ}_LCD -> S3C24XX | ||
16 | * | ||
17 | * 2005-03-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
18 | * - Removed the ioctl | ||
19 | * - use readl/writel instead of __raw_writel/__raw_readl | ||
20 | * | ||
21 | * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
22 | * - Added the possibility to set on or off the | ||
23 | * debugging messages | ||
24 | * - Replaced 0 and 1 by on or off when reading the | ||
25 | * /sys files | ||
26 | * | ||
27 | * 2005-03-23: Ben Dooks <ben-linux@fluff.org> | ||
28 | * - added non 16bpp modes | ||
29 | * - updated platform information for range of x/y/bpp | ||
30 | * - add code to ensure palette is written correctly | ||
31 | * - add pixel clock divisor control | ||
32 | * | ||
33 | * 2004-11-11: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
34 | * - Removed the use of currcon as it no more exists | ||
35 | * - Added LCD power sysfs interface | ||
36 | * | ||
37 | * 2004-11-03: Ben Dooks <ben-linux@fluff.org> | ||
38 | * - minor cleanups | ||
39 | * - add suspend/resume support | ||
40 | * - s3c2410fb_setcolreg() not valid in >8bpp modes | ||
41 | * - removed last CONFIG_FB_S3C2410_FIXED | ||
42 | * - ensure lcd controller stopped before cleanup | ||
43 | * - added sysfs interface for backlight power | ||
44 | * - added mask for gpio configuration | ||
45 | * - ensured IRQs disabled during GPIO configuration | ||
46 | * - disable TPAL before enabling video | ||
47 | * | ||
48 | * 2004-09-20: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
49 | * - Suppress command line options | ||
50 | * | ||
51 | * 2004-09-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
52 | * - code cleanup | ||
53 | * | ||
54 | * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
55 | * - Renamed from h1940fb.c to s3c2410fb.c | ||
56 | * - Add support for different devices | ||
57 | * - Backlight support | ||
58 | * | ||
59 | * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at> | ||
60 | * - added clock (de-)allocation code | ||
61 | * - added fixem fbmem option | ||
62 | * | ||
63 | * 2004-07-27: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
64 | * - code cleanup | ||
65 | * - added a forgotten return in h1940fb_init | ||
66 | * | ||
67 | * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at> | ||
68 | * - code cleanup and extended debugging | ||
69 | * | ||
70 | * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
71 | * - First version | ||
72 | */ | ||
73 | 13 | ||
74 | #include <linux/module.h> | 14 | #include <linux/module.h> |
75 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
@@ -580,6 +520,27 @@ static int s3c2410fb_setcolreg(unsigned regno, | |||
580 | return 0; | 520 | return 0; |
581 | } | 521 | } |
582 | 522 | ||
523 | /* s3c2410fb_lcd_enable | ||
524 | * | ||
525 | * shutdown the lcd controller | ||
526 | */ | ||
527 | static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable) | ||
528 | { | ||
529 | unsigned long flags; | ||
530 | |||
531 | local_irq_save(flags); | ||
532 | |||
533 | if (enable) | ||
534 | fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID; | ||
535 | else | ||
536 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; | ||
537 | |||
538 | writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); | ||
539 | |||
540 | local_irq_restore(flags); | ||
541 | } | ||
542 | |||
543 | |||
583 | /* | 544 | /* |
584 | * s3c2410fb_blank | 545 | * s3c2410fb_blank |
585 | * @blank_mode: the blank mode we want. | 546 | * @blank_mode: the blank mode we want. |
@@ -589,9 +550,6 @@ static int s3c2410fb_setcolreg(unsigned regno, | |||
589 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a | 550 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a |
590 | * video mode which doesn't support it. Implements VESA suspend | 551 | * video mode which doesn't support it. Implements VESA suspend |
591 | * and powerdown modes on hardware that supports disabling hsync/vsync: | 552 | * and powerdown modes on hardware that supports disabling hsync/vsync: |
592 | * blank_mode == 2: suspend vsync | ||
593 | * blank_mode == 3: suspend hsync | ||
594 | * blank_mode == 4: powerdown | ||
595 | * | 553 | * |
596 | * Returns negative errno on error, or zero on success. | 554 | * Returns negative errno on error, or zero on success. |
597 | * | 555 | * |
@@ -605,6 +563,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info) | |||
605 | 563 | ||
606 | tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; | 564 | tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; |
607 | 565 | ||
566 | if (blank_mode == FB_BLANK_POWERDOWN) { | ||
567 | s3c2410fb_lcd_enable(fbi, 0); | ||
568 | } else { | ||
569 | s3c2410fb_lcd_enable(fbi, 1); | ||
570 | } | ||
571 | |||
608 | if (blank_mode == FB_BLANK_UNBLANK) | 572 | if (blank_mode == FB_BLANK_UNBLANK) |
609 | writel(0x0, tpal_reg); | 573 | writel(0x0, tpal_reg); |
610 | else { | 574 | else { |
@@ -948,7 +912,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev, | |||
948 | } | 912 | } |
949 | 913 | ||
950 | /* create device files */ | 914 | /* create device files */ |
951 | device_create_file(&pdev->dev, &dev_attr_debug); | 915 | ret = device_create_file(&pdev->dev, &dev_attr_debug); |
916 | if (ret) { | ||
917 | printk(KERN_ERR "failed to add debug attribute\n"); | ||
918 | } | ||
952 | 919 | ||
953 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 920 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
954 | fbinfo->node, fbinfo->fix.id); | 921 | fbinfo->node, fbinfo->fix.id); |
@@ -983,21 +950,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev) | |||
983 | return s3c24xxfb_probe(pdev, DRV_S3C2412); | 950 | return s3c24xxfb_probe(pdev, DRV_S3C2412); |
984 | } | 951 | } |
985 | 952 | ||
986 | /* s3c2410fb_stop_lcd | ||
987 | * | ||
988 | * shutdown the lcd controller | ||
989 | */ | ||
990 | static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi) | ||
991 | { | ||
992 | unsigned long flags; | ||
993 | |||
994 | local_irq_save(flags); | ||
995 | |||
996 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; | ||
997 | writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); | ||
998 | |||
999 | local_irq_restore(flags); | ||
1000 | } | ||
1001 | 953 | ||
1002 | /* | 954 | /* |
1003 | * Cleanup | 955 | * Cleanup |
@@ -1010,7 +962,7 @@ static int s3c2410fb_remove(struct platform_device *pdev) | |||
1010 | 962 | ||
1011 | unregister_framebuffer(fbinfo); | 963 | unregister_framebuffer(fbinfo); |
1012 | 964 | ||
1013 | s3c2410fb_stop_lcd(info); | 965 | s3c2410fb_lcd_enable(info, 0); |
1014 | msleep(1); | 966 | msleep(1); |
1015 | 967 | ||
1016 | s3c2410fb_unmap_video_memory(fbinfo); | 968 | s3c2410fb_unmap_video_memory(fbinfo); |
@@ -1043,7 +995,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) | |||
1043 | struct fb_info *fbinfo = platform_get_drvdata(dev); | 995 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
1044 | struct s3c2410fb_info *info = fbinfo->par; | 996 | struct s3c2410fb_info *info = fbinfo->par; |
1045 | 997 | ||
1046 | s3c2410fb_stop_lcd(info); | 998 | s3c2410fb_lcd_enable(info, 0); |
1047 | 999 | ||
1048 | /* sleep before disabling the clock, we need to ensure | 1000 | /* sleep before disabling the clock, we need to ensure |
1049 | * the LCD DMA engine is not going to get back on the bus | 1001 | * the LCD DMA engine is not going to get back on the bus |
@@ -1118,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " | |||
1118 | "Ben Dooks <ben-linux@fluff.org>"); | 1070 | "Ben Dooks <ben-linux@fluff.org>"); |
1119 | MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); | 1071 | MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); |
1120 | MODULE_LICENSE("GPL"); | 1072 | MODULE_LICENSE("GPL"); |
1073 | MODULE_ALIAS("platform:s3c2410-lcd"); | ||
1074 | MODULE_ALIAS("platform:s3c2412-lcd"); | ||
diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h index dbb73b95e2ef..9a6ba3e9d1b8 100644 --- a/drivers/video/s3c2410fb.h +++ b/drivers/video/s3c2410fb.h | |||
@@ -1,26 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/video/s3c2410fb.h | 2 | * linux/drivers/video/s3c2410fb.h |
3 | * Copyright (c) Arnaud Patard | 3 | * Copyright (c) 2004 Arnaud Patard |
4 | * | ||
5 | * S3C2410 LCD Framebuffer Driver | ||
4 | * | 6 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
6 | * License. See the file COPYING in the main directory of this archive for | 8 | * License. See the file COPYING in the main directory of this archive for |
7 | * more details. | 9 | * more details. |
8 | * | 10 | * |
9 | * S3C2410 LCD Controller Frame Buffer Driver | 11 | */ |
10 | * based on skeletonfb.c, sa1100fb.h | ||
11 | * | ||
12 | * ChangeLog | ||
13 | * | ||
14 | * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
15 | * - Moved dprintk to s3c2410fb.c | ||
16 | * | ||
17 | * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
18 | * - Renamed from h1940fb.h to s3c2410fb.h | ||
19 | * - Changed h1940 to s3c2410 | ||
20 | * | ||
21 | * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
22 | * - First version | ||
23 | */ | ||
24 | 12 | ||
25 | #ifndef __S3C2410FB_H | 13 | #ifndef __S3C2410FB_H |
26 | #define __S3C2410FB_H | 14 | #define __S3C2410FB_H |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 73803624c131..b9343844cd1f 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -5787,7 +5787,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5787 | } else { | 5787 | } else { |
5788 | struct sis_video_info *countvideo = card_list; | 5788 | struct sis_video_info *countvideo = card_list; |
5789 | ivideo->cardnumber = 1; | 5789 | ivideo->cardnumber = 1; |
5790 | while((countvideo = countvideo->next) != 0) | 5790 | while((countvideo = countvideo->next) != NULL) |
5791 | ivideo->cardnumber++; | 5791 | ivideo->cardnumber++; |
5792 | } | 5792 | } |
5793 | 5793 | ||
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 742b5c656d66..15d4a768b1f6 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -663,14 +663,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to) | |||
663 | sm501fb_sync_regs(fbi); | 663 | sm501fb_sync_regs(fbi); |
664 | mdelay(10); | 664 | mdelay(10); |
665 | 665 | ||
666 | if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { | 666 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) { |
667 | control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ | 667 | control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ |
668 | writel(control, ctrl_reg); | 668 | writel(control, ctrl_reg); |
669 | sm501fb_sync_regs(fbi); | 669 | sm501fb_sync_regs(fbi); |
670 | mdelay(10); | 670 | mdelay(10); |
671 | } | 671 | } |
672 | 672 | ||
673 | if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { | 673 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) { |
674 | control |= SM501_DC_PANEL_CONTROL_FPEN; | 674 | control |= SM501_DC_PANEL_CONTROL_FPEN; |
675 | writel(control, ctrl_reg); | 675 | writel(control, ctrl_reg); |
676 | sm501fb_sync_regs(fbi); | 676 | sm501fb_sync_regs(fbi); |
@@ -678,14 +678,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to) | |||
678 | } | 678 | } |
679 | } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { | 679 | } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { |
680 | /* disable panel power */ | 680 | /* disable panel power */ |
681 | if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { | 681 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) { |
682 | control &= ~SM501_DC_PANEL_CONTROL_FPEN; | 682 | control &= ~SM501_DC_PANEL_CONTROL_FPEN; |
683 | writel(control, ctrl_reg); | 683 | writel(control, ctrl_reg); |
684 | sm501fb_sync_regs(fbi); | 684 | sm501fb_sync_regs(fbi); |
685 | mdelay(10); | 685 | mdelay(10); |
686 | } | 686 | } |
687 | 687 | ||
688 | if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { | 688 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) { |
689 | control &= ~SM501_DC_PANEL_CONTROL_BIAS; | 689 | control &= ~SM501_DC_PANEL_CONTROL_BIAS; |
690 | writel(control, ctrl_reg); | 690 | writel(control, ctrl_reg); |
691 | sm501fb_sync_regs(fbi); | 691 | sm501fb_sync_regs(fbi); |
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 13866789b356..0f3c2bb7bf35 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -2,6 +2,9 @@ | |||
2 | #include <linux/spinlock.h> | 2 | #include <linux/spinlock.h> |
3 | #include <linux/virtio_config.h> | 3 | #include <linux/virtio_config.h> |
4 | 4 | ||
5 | /* Unique numbering for virtio devices. */ | ||
6 | static unsigned int dev_index; | ||
7 | |||
5 | static ssize_t device_show(struct device *_d, | 8 | static ssize_t device_show(struct device *_d, |
6 | struct device_attribute *attr, char *buf) | 9 | struct device_attribute *attr, char *buf) |
7 | { | 10 | { |
@@ -166,7 +169,10 @@ int register_virtio_device(struct virtio_device *dev) | |||
166 | int err; | 169 | int err; |
167 | 170 | ||
168 | dev->dev.bus = &virtio_bus; | 171 | dev->dev.bus = &virtio_bus; |
169 | sprintf(dev->dev.bus_id, "%u", dev->index); | 172 | |
173 | /* Assign a unique device index and hence name. */ | ||
174 | dev->index = dev_index++; | ||
175 | sprintf(dev->dev.bus_id, "virtio%u", dev->index); | ||
170 | 176 | ||
171 | /* We always start by resetting the device, in case a previous | 177 | /* We always start by resetting the device, in case a previous |
172 | * driver messed it up. This also tests that code path a little. */ | 178 | * driver messed it up. This also tests that code path a little. */ |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 27e9fc9117cd..eae7236310e4 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -78,9 +78,6 @@ static struct device virtio_pci_root = { | |||
78 | .bus_id = "virtio-pci", | 78 | .bus_id = "virtio-pci", |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /* Unique numbering for devices under the kvm root */ | ||
82 | static unsigned int dev_index; | ||
83 | |||
84 | /* Convert a generic virtio device to our structure */ | 81 | /* Convert a generic virtio device to our structure */ |
85 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) | 82 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) |
86 | { | 83 | { |
@@ -325,10 +322,6 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | |||
325 | if (vp_dev == NULL) | 322 | if (vp_dev == NULL) |
326 | return -ENOMEM; | 323 | return -ENOMEM; |
327 | 324 | ||
328 | snprintf(vp_dev->vdev.dev.bus_id, BUS_ID_SIZE, "virtio%d", dev_index); | ||
329 | vp_dev->vdev.index = dev_index; | ||
330 | dev_index++; | ||
331 | |||
332 | vp_dev->vdev.dev.parent = &virtio_pci_root; | 325 | vp_dev->vdev.dev.parent = &virtio_pci_root; |
333 | vp_dev->vdev.config = &virtio_pci_config_ops; | 326 | vp_dev->vdev.config = &virtio_pci_config_ops; |
334 | vp_dev->pci_dev = pci_dev; | 327 | vp_dev->pci_dev = pci_dev; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 937a49d6772c..72bf8bc09014 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -227,7 +227,6 @@ static bool vring_enable_cb(struct virtqueue *_vq) | |||
227 | struct vring_virtqueue *vq = to_vvq(_vq); | 227 | struct vring_virtqueue *vq = to_vvq(_vq); |
228 | 228 | ||
229 | START_USE(vq); | 229 | START_USE(vq); |
230 | BUG_ON(!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)); | ||
231 | 230 | ||
232 | /* We optimistically turn back on interrupts, then check if there was | 231 | /* We optimistically turn back on interrupts, then check if there was |
233 | * more to do. */ | 232 | * more to do. */ |
@@ -254,13 +253,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq) | |||
254 | if (unlikely(vq->broken)) | 253 | if (unlikely(vq->broken)) |
255 | return IRQ_HANDLED; | 254 | return IRQ_HANDLED; |
256 | 255 | ||
257 | /* Other side may have missed us turning off the interrupt, | ||
258 | * but we should preserve disable semantic for virtio users. */ | ||
259 | if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) { | ||
260 | pr_debug("virtqueue interrupt after disable for %p\n", vq); | ||
261 | return IRQ_HANDLED; | ||
262 | } | ||
263 | |||
264 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); | 256 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); |
265 | if (vq->vq.callback) | 257 | if (vq->vq.callback) |
266 | vq->vq.callback(&vq->vq); | 258 | vq->vq.callback(&vq->vq); |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 254d115cafab..ccb78f66c2b6 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -295,6 +295,19 @@ config ALIM7101_WDT | |||
295 | 295 | ||
296 | Most people will say N. | 296 | Most people will say N. |
297 | 297 | ||
298 | config GEODE_WDT | ||
299 | tristate "AMD Geode CS5535/CS5536 Watchdog" | ||
300 | depends on MGEODE_LX | ||
301 | help | ||
302 | This driver enables a watchdog capability built into the | ||
303 | CS5535/CS5536 companion chips for the AMD Geode GX and LX | ||
304 | processors. This watchdog watches your kernel to make sure | ||
305 | it doesn't freeze, and if it does, it reboots your computer after | ||
306 | a certain amount of time. | ||
307 | |||
308 | You can compile this driver directly into the kernel, or use | ||
309 | it as a module. The module will be called geodewdt. | ||
310 | |||
298 | config SC520_WDT | 311 | config SC520_WDT |
299 | tristate "AMD Elan SC520 processor Watchdog" | 312 | tristate "AMD Elan SC520 processor Watchdog" |
300 | depends on X86 | 313 | depends on X86 |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index f3fb170fe5c6..25b352b664d9 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -59,6 +59,7 @@ obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | |||
59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o | 59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o |
60 | obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o | 60 | obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o |
61 | obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o | 61 | obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o |
62 | obj-$(CONFIG_GEODE_WDT) += geodewdt.o | ||
62 | obj-$(CONFIG_SC520_WDT) += sc520_wdt.o | 63 | obj-$(CONFIG_SC520_WDT) += sc520_wdt.o |
63 | obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o | 64 | obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o |
64 | obj-$(CONFIG_IB700_WDT) += ib700wdt.o | 65 | obj-$(CONFIG_IB700_WDT) += ib700wdt.o |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index 1237113dc14a..03b3e3d91e7c 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -29,7 +29,8 @@ | |||
29 | 29 | ||
30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) | 30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) |
31 | #define stampit() stamp("here i am") | 31 | #define stampit() stamp("here i am") |
32 | #define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); }) | 32 | #define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) |
33 | #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
33 | 34 | ||
34 | #define WATCHDOG_NAME "bfin-wdt" | 35 | #define WATCHDOG_NAME "bfin-wdt" |
35 | #define PFX WATCHDOG_NAME ": " | 36 | #define PFX WATCHDOG_NAME ": " |
@@ -377,20 +378,6 @@ static int bfin_wdt_resume(struct platform_device *pdev) | |||
377 | # define bfin_wdt_resume NULL | 378 | # define bfin_wdt_resume NULL |
378 | #endif | 379 | #endif |
379 | 380 | ||
380 | static struct platform_device bfin_wdt_device = { | ||
381 | .name = WATCHDOG_NAME, | ||
382 | .id = -1, | ||
383 | }; | ||
384 | |||
385 | static struct platform_driver bfin_wdt_driver = { | ||
386 | .driver = { | ||
387 | .name = WATCHDOG_NAME, | ||
388 | .owner = THIS_MODULE, | ||
389 | }, | ||
390 | .suspend = bfin_wdt_suspend, | ||
391 | .resume = bfin_wdt_resume, | ||
392 | }; | ||
393 | |||
394 | static const struct file_operations bfin_wdt_fops = { | 381 | static const struct file_operations bfin_wdt_fops = { |
395 | .owner = THIS_MODULE, | 382 | .owner = THIS_MODULE, |
396 | .llseek = no_llseek, | 383 | .llseek = no_llseek, |
@@ -418,11 +405,67 @@ static struct notifier_block bfin_wdt_notifier = { | |||
418 | }; | 405 | }; |
419 | 406 | ||
420 | /** | 407 | /** |
421 | * bfin_wdt_init - Initialize module | 408 | * bfin_wdt_probe - Initialize module |
422 | * | 409 | * |
423 | * Registers the device and notifier handler. Actual device | 410 | * Registers the misc device and notifier handler. Actual device |
424 | * initialization is handled by bfin_wdt_open(). | 411 | * initialization is handled by bfin_wdt_open(). |
425 | */ | 412 | */ |
413 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) | ||
414 | { | ||
415 | int ret; | ||
416 | |||
417 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
418 | if (ret) { | ||
419 | pr_devinit(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | ||
420 | return ret; | ||
421 | } | ||
422 | |||
423 | ret = misc_register(&bfin_wdt_miscdev); | ||
424 | if (ret) { | ||
425 | pr_devinit(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | ||
426 | WATCHDOG_MINOR, ret); | ||
427 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
428 | return ret; | ||
429 | } | ||
430 | |||
431 | pr_devinit(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
432 | timeout, nowayout); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * bfin_wdt_remove - Initialize module | ||
439 | * | ||
440 | * Unregisters the misc device and notifier handler. Actual device | ||
441 | * deinitialization is handled by bfin_wdt_close(). | ||
442 | */ | ||
443 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) | ||
444 | { | ||
445 | misc_deregister(&bfin_wdt_miscdev); | ||
446 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | static struct platform_device *bfin_wdt_device; | ||
451 | |||
452 | static struct platform_driver bfin_wdt_driver = { | ||
453 | .probe = bfin_wdt_probe, | ||
454 | .remove = __devexit_p(bfin_wdt_remove), | ||
455 | .suspend = bfin_wdt_suspend, | ||
456 | .resume = bfin_wdt_resume, | ||
457 | .driver = { | ||
458 | .name = WATCHDOG_NAME, | ||
459 | .owner = THIS_MODULE, | ||
460 | }, | ||
461 | }; | ||
462 | |||
463 | /** | ||
464 | * bfin_wdt_init - Initialize module | ||
465 | * | ||
466 | * Checks the module params and registers the platform device & driver. | ||
467 | * Real work is in the platform probe function. | ||
468 | */ | ||
426 | static int __init bfin_wdt_init(void) | 469 | static int __init bfin_wdt_init(void) |
427 | { | 470 | { |
428 | int ret; | 471 | int ret; |
@@ -436,44 +479,32 @@ static int __init bfin_wdt_init(void) | |||
436 | /* Since this is an on-chip device and needs no board-specific | 479 | /* Since this is an on-chip device and needs no board-specific |
437 | * resources, we'll handle all the platform device stuff here. | 480 | * resources, we'll handle all the platform device stuff here. |
438 | */ | 481 | */ |
439 | ret = platform_device_register(&bfin_wdt_device); | 482 | ret = platform_driver_register(&bfin_wdt_driver); |
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | ret = platform_driver_probe(&bfin_wdt_driver, NULL); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | |||
447 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
448 | if (ret) { | 483 | if (ret) { |
449 | pr_init(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | 484 | pr_init(KERN_ERR PFX "unable to register driver\n"); |
450 | return ret; | 485 | return ret; |
451 | } | 486 | } |
452 | 487 | ||
453 | ret = misc_register(&bfin_wdt_miscdev); | 488 | bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, -1, NULL, 0); |
454 | if (ret) { | 489 | if (IS_ERR(bfin_wdt_device)) { |
455 | pr_init(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 490 | pr_init(KERN_ERR PFX "unable to register device\n"); |
456 | WATCHDOG_MINOR, ret); | 491 | platform_driver_unregister(&bfin_wdt_driver); |
457 | unregister_reboot_notifier(&bfin_wdt_notifier); | 492 | return PTR_ERR(bfin_wdt_device); |
458 | return ret; | ||
459 | } | 493 | } |
460 | 494 | ||
461 | pr_init(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
462 | timeout, nowayout); | ||
463 | |||
464 | return 0; | 495 | return 0; |
465 | } | 496 | } |
466 | 497 | ||
467 | /** | 498 | /** |
468 | * bfin_wdt_exit - Deinitialize module | 499 | * bfin_wdt_exit - Deinitialize module |
469 | * | 500 | * |
470 | * Unregisters the device and notifier handler. Actual device | 501 | * Back out the platform device & driver steps. Real work is in the |
471 | * deinitialization is handled by bfin_wdt_close(). | 502 | * platform remove function. |
472 | */ | 503 | */ |
473 | static void __exit bfin_wdt_exit(void) | 504 | static void __exit bfin_wdt_exit(void) |
474 | { | 505 | { |
475 | misc_deregister(&bfin_wdt_miscdev); | 506 | platform_device_unregister(bfin_wdt_device); |
476 | unregister_reboot_notifier(&bfin_wdt_notifier); | 507 | platform_driver_unregister(&bfin_wdt_driver); |
477 | } | 508 | } |
478 | 509 | ||
479 | module_init(bfin_wdt_init); | 510 | module_init(bfin_wdt_init); |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index d362f5bf658a..c1ba0db48501 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -1,12 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/char/watchdog/booke_wdt.c | ||
3 | * | ||
4 | * Watchdog timer for PowerPC Book-E systems | 2 | * Watchdog timer for PowerPC Book-E systems |
5 | * | 3 | * |
6 | * Author: Matthew McClintock | 4 | * Author: Matthew McClintock |
7 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | 5 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> |
8 | * | 6 | * |
9 | * Copyright 2005 Freescale Semiconductor Inc. | 7 | * Copyright 2005, 2008 Freescale Semiconductor Inc. |
10 | * | 8 | * |
11 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
12 | * under the terms of the GNU General Public License as published by the | 10 | * under the terms of the GNU General Public License as published by the |
@@ -16,6 +14,7 @@ | |||
16 | 14 | ||
17 | #include <linux/module.h> | 15 | #include <linux/module.h> |
18 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/smp.h> | ||
19 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
20 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
21 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
@@ -38,7 +37,7 @@ | |||
38 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ | 37 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ |
39 | #endif /* for timing information */ | 38 | #endif /* for timing information */ |
40 | 39 | ||
41 | u32 booke_wdt_enabled = 0; | 40 | u32 booke_wdt_enabled; |
42 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | 41 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; |
43 | 42 | ||
44 | #ifdef CONFIG_FSL_BOOKE | 43 | #ifdef CONFIG_FSL_BOOKE |
@@ -47,33 +46,31 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | |||
47 | #define WDTP(x) (TCR_WP(x)) | 46 | #define WDTP(x) (TCR_WP(x)) |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | /* | 49 | static DEFINE_SPINLOCK(booke_wdt_lock); |
51 | * booke_wdt_ping: | 50 | |
52 | */ | 51 | static void __booke_wdt_ping(void *data) |
53 | static __inline__ void booke_wdt_ping(void) | ||
54 | { | 52 | { |
55 | mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); | 53 | mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); |
56 | } | 54 | } |
57 | 55 | ||
58 | /* | 56 | static void booke_wdt_ping(void) |
59 | * booke_wdt_enable: | 57 | { |
60 | */ | 58 | on_each_cpu(__booke_wdt_ping, NULL, 0, 0); |
61 | static __inline__ void booke_wdt_enable(void) | 59 | } |
60 | |||
61 | static void __booke_wdt_enable(void *data) | ||
62 | { | 62 | { |
63 | u32 val; | 63 | u32 val; |
64 | 64 | ||
65 | /* clear status before enabling watchdog */ | 65 | /* clear status before enabling watchdog */ |
66 | booke_wdt_ping(); | 66 | __booke_wdt_ping(NULL); |
67 | val = mfspr(SPRN_TCR); | 67 | val = mfspr(SPRN_TCR); |
68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); | 68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); |
69 | 69 | ||
70 | mtspr(SPRN_TCR, val); | 70 | mtspr(SPRN_TCR, val); |
71 | } | 71 | } |
72 | 72 | ||
73 | /* | 73 | static ssize_t booke_wdt_write(struct file *file, const char __user *buf, |
74 | * booke_wdt_write: | ||
75 | */ | ||
76 | static ssize_t booke_wdt_write (struct file *file, const char __user *buf, | ||
77 | size_t count, loff_t *ppos) | 74 | size_t count, loff_t *ppos) |
78 | { | 75 | { |
79 | booke_wdt_ping(); | 76 | booke_wdt_ping(); |
@@ -81,15 +78,11 @@ static ssize_t booke_wdt_write (struct file *file, const char __user *buf, | |||
81 | } | 78 | } |
82 | 79 | ||
83 | static struct watchdog_info ident = { | 80 | static struct watchdog_info ident = { |
84 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 81 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
85 | .firmware_version = 0, | 82 | .identity = "PowerPC Book-E Watchdog", |
86 | .identity = "PowerPC Book-E Watchdog", | ||
87 | }; | 83 | }; |
88 | 84 | ||
89 | /* | 85 | static int booke_wdt_ioctl(struct inode *inode, struct file *file, |
90 | * booke_wdt_ioctl: | ||
91 | */ | ||
92 | static int booke_wdt_ioctl (struct inode *inode, struct file *file, | ||
93 | unsigned int cmd, unsigned long arg) | 86 | unsigned int cmd, unsigned long arg) |
94 | { | 87 | { |
95 | u32 tmp = 0; | 88 | u32 tmp = 0; |
@@ -97,7 +90,7 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, | |||
97 | 90 | ||
98 | switch (cmd) { | 91 | switch (cmd) { |
99 | case WDIOC_GETSUPPORT: | 92 | case WDIOC_GETSUPPORT: |
100 | if (copy_to_user ((struct watchdog_info __user *) arg, &ident, | 93 | if (copy_to_user((struct watchdog_info __user *)arg, &ident, |
101 | sizeof(struct watchdog_info))) | 94 | sizeof(struct watchdog_info))) |
102 | return -EFAULT; | 95 | return -EFAULT; |
103 | case WDIOC_GETSTATUS: | 96 | case WDIOC_GETSTATUS: |
@@ -132,33 +125,33 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, | |||
132 | 125 | ||
133 | return 0; | 126 | return 0; |
134 | } | 127 | } |
135 | /* | 128 | |
136 | * booke_wdt_open: | 129 | static int booke_wdt_open(struct inode *inode, struct file *file) |
137 | */ | ||
138 | static int booke_wdt_open (struct inode *inode, struct file *file) | ||
139 | { | 130 | { |
131 | spin_lock(&booke_wdt_lock); | ||
140 | if (booke_wdt_enabled == 0) { | 132 | if (booke_wdt_enabled == 0) { |
141 | booke_wdt_enabled = 1; | 133 | booke_wdt_enabled = 1; |
142 | booke_wdt_enable(); | 134 | on_each_cpu(__booke_wdt_enable, NULL, 0, 0); |
143 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", | 135 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " |
144 | booke_wdt_period); | 136 | "(wdt_period=%d)\n", booke_wdt_period); |
145 | } | 137 | } |
138 | spin_unlock(&booke_wdt_lock); | ||
146 | 139 | ||
147 | return nonseekable_open(inode, file); | 140 | return nonseekable_open(inode, file); |
148 | } | 141 | } |
149 | 142 | ||
150 | static const struct file_operations booke_wdt_fops = { | 143 | static const struct file_operations booke_wdt_fops = { |
151 | .owner = THIS_MODULE, | 144 | .owner = THIS_MODULE, |
152 | .llseek = no_llseek, | 145 | .llseek = no_llseek, |
153 | .write = booke_wdt_write, | 146 | .write = booke_wdt_write, |
154 | .ioctl = booke_wdt_ioctl, | 147 | .ioctl = booke_wdt_ioctl, |
155 | .open = booke_wdt_open, | 148 | .open = booke_wdt_open, |
156 | }; | 149 | }; |
157 | 150 | ||
158 | static struct miscdevice booke_wdt_miscdev = { | 151 | static struct miscdevice booke_wdt_miscdev = { |
159 | .minor = WATCHDOG_MINOR, | 152 | .minor = WATCHDOG_MINOR, |
160 | .name = "watchdog", | 153 | .name = "watchdog", |
161 | .fops = &booke_wdt_fops, | 154 | .fops = &booke_wdt_fops, |
162 | }; | 155 | }; |
163 | 156 | ||
164 | static void __exit booke_wdt_exit(void) | 157 | static void __exit booke_wdt_exit(void) |
@@ -166,28 +159,27 @@ static void __exit booke_wdt_exit(void) | |||
166 | misc_deregister(&booke_wdt_miscdev); | 159 | misc_deregister(&booke_wdt_miscdev); |
167 | } | 160 | } |
168 | 161 | ||
169 | /* | ||
170 | * booke_wdt_init: | ||
171 | */ | ||
172 | static int __init booke_wdt_init(void) | 162 | static int __init booke_wdt_init(void) |
173 | { | 163 | { |
174 | int ret = 0; | 164 | int ret = 0; |
175 | 165 | ||
176 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); | 166 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); |
177 | ident.firmware_version = cur_cpu_spec->pvr_value; | 167 | ident.firmware_version = cur_cpu_spec->pvr_value; |
178 | 168 | ||
179 | ret = misc_register(&booke_wdt_miscdev); | 169 | ret = misc_register(&booke_wdt_miscdev); |
180 | if (ret) { | 170 | if (ret) { |
181 | printk (KERN_CRIT "Cannot register miscdev on minor=%d (err=%d)\n", | 171 | printk(KERN_CRIT "Cannot register miscdev on minor=%d: %d\n", |
182 | WATCHDOG_MINOR, ret); | 172 | WATCHDOG_MINOR, ret); |
183 | return ret; | 173 | return ret; |
184 | } | 174 | } |
185 | 175 | ||
176 | spin_lock(&booke_wdt_lock); | ||
186 | if (booke_wdt_enabled == 1) { | 177 | if (booke_wdt_enabled == 1) { |
187 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", | 178 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " |
188 | booke_wdt_period); | 179 | "(wdt_period=%d)\n", booke_wdt_period); |
189 | booke_wdt_enable(); | 180 | on_each_cpu(__booke_wdt_enable, NULL, 0, 0); |
190 | } | 181 | } |
182 | spin_unlock(&booke_wdt_lock); | ||
191 | 183 | ||
192 | return ret; | 184 | return ret; |
193 | } | 185 | } |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c new file mode 100644 index 000000000000..30d09cbbad94 --- /dev/null +++ b/drivers/watchdog/geodewdt.c | |||
@@ -0,0 +1,308 @@ | |||
1 | /* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip | ||
2 | * | ||
3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/miscdevice.h> | ||
16 | #include <linux/watchdog.h> | ||
17 | #include <linux/fs.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/reboot.h> | ||
20 | |||
21 | #include <asm/uaccess.h> | ||
22 | #include <asm/geode.h> | ||
23 | |||
24 | #define GEODEWDT_HZ 500 | ||
25 | #define GEODEWDT_SCALE 6 | ||
26 | #define GEODEWDT_MAX_SECONDS 131 | ||
27 | |||
28 | #define WDT_FLAGS_OPEN 1 | ||
29 | #define WDT_FLAGS_ORPHAN 2 | ||
30 | |||
31 | #define DRV_NAME "geodewdt" | ||
32 | #define WATCHDOG_NAME "Geode GX/LX WDT" | ||
33 | #define WATCHDOG_TIMEOUT 60 | ||
34 | |||
35 | static int timeout = WATCHDOG_TIMEOUT; | ||
36 | module_param(timeout, int, 0); | ||
37 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=131, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | ||
38 | |||
39 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
40 | module_param(nowayout, int, 0); | ||
41 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
42 | |||
43 | static struct platform_device *geodewdt_platform_device; | ||
44 | static unsigned long wdt_flags; | ||
45 | static int wdt_timer; | ||
46 | static int safe_close; | ||
47 | |||
48 | static void geodewdt_ping(void) | ||
49 | { | ||
50 | /* Stop the counter */ | ||
51 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
52 | |||
53 | /* Reset the counter */ | ||
54 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
55 | |||
56 | /* Enable the counter */ | ||
57 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
58 | } | ||
59 | |||
60 | static void geodewdt_disable(void) | ||
61 | { | ||
62 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
63 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
64 | } | ||
65 | |||
66 | static int geodewdt_set_heartbeat(int val) | ||
67 | { | ||
68 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) | ||
69 | return -EINVAL; | ||
70 | |||
71 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
72 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); | ||
73 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
74 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
75 | |||
76 | timeout = val; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int | ||
81 | geodewdt_open(struct inode *inode, struct file *file) | ||
82 | { | ||
83 | if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) | ||
84 | return -EBUSY; | ||
85 | |||
86 | if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) | ||
87 | __module_get(THIS_MODULE); | ||
88 | |||
89 | geodewdt_ping(); | ||
90 | return nonseekable_open(inode, file); | ||
91 | } | ||
92 | |||
93 | static int | ||
94 | geodewdt_release(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (safe_close) { | ||
97 | geodewdt_disable(); | ||
98 | module_put(THIS_MODULE); | ||
99 | } | ||
100 | else { | ||
101 | printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); | ||
102 | geodewdt_ping(); | ||
103 | |||
104 | set_bit(WDT_FLAGS_ORPHAN, &wdt_flags); | ||
105 | } | ||
106 | |||
107 | clear_bit(WDT_FLAGS_OPEN, &wdt_flags); | ||
108 | safe_close = 0; | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static ssize_t | ||
113 | geodewdt_write(struct file *file, const char __user *data, size_t len, | ||
114 | loff_t *ppos) | ||
115 | { | ||
116 | if(len) { | ||
117 | if (!nowayout) { | ||
118 | size_t i; | ||
119 | safe_close = 0; | ||
120 | |||
121 | for (i = 0; i != len; i++) { | ||
122 | char c; | ||
123 | |||
124 | if (get_user(c, data + i)) | ||
125 | return -EFAULT; | ||
126 | |||
127 | if (c == 'V') | ||
128 | safe_close = 1; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | geodewdt_ping(); | ||
133 | } | ||
134 | return len; | ||
135 | } | ||
136 | |||
137 | static int | ||
138 | geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
139 | unsigned long arg) | ||
140 | { | ||
141 | void __user *argp = (void __user *)arg; | ||
142 | int __user *p = argp; | ||
143 | int interval; | ||
144 | |||
145 | static struct watchdog_info ident = { | ||
146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | ||
147 | | WDIOF_MAGICCLOSE, | ||
148 | .firmware_version = 1, | ||
149 | .identity = WATCHDOG_NAME, | ||
150 | }; | ||
151 | |||
152 | switch(cmd) { | ||
153 | case WDIOC_GETSUPPORT: | ||
154 | return copy_to_user(argp, &ident, | ||
155 | sizeof(ident)) ? -EFAULT : 0; | ||
156 | break; | ||
157 | |||
158 | case WDIOC_GETSTATUS: | ||
159 | case WDIOC_GETBOOTSTATUS: | ||
160 | return put_user(0, p); | ||
161 | |||
162 | case WDIOC_KEEPALIVE: | ||
163 | geodewdt_ping(); | ||
164 | return 0; | ||
165 | |||
166 | case WDIOC_SETTIMEOUT: | ||
167 | if (get_user(interval, p)) | ||
168 | return -EFAULT; | ||
169 | |||
170 | if (geodewdt_set_heartbeat(interval)) | ||
171 | return -EINVAL; | ||
172 | |||
173 | /* Fall through */ | ||
174 | |||
175 | case WDIOC_GETTIMEOUT: | ||
176 | return put_user(timeout, p); | ||
177 | |||
178 | case WDIOC_SETOPTIONS: | ||
179 | { | ||
180 | int options, ret = -EINVAL; | ||
181 | |||
182 | if (get_user(options, p)) | ||
183 | return -EFAULT; | ||
184 | |||
185 | if (options & WDIOS_DISABLECARD) { | ||
186 | geodewdt_disable(); | ||
187 | ret = 0; | ||
188 | } | ||
189 | |||
190 | if (options & WDIOS_ENABLECARD) { | ||
191 | geodewdt_ping(); | ||
192 | ret = 0; | ||
193 | } | ||
194 | |||
195 | return ret; | ||
196 | } | ||
197 | default: | ||
198 | return -ENOTTY; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static const struct file_operations geodewdt_fops = { | ||
205 | .owner = THIS_MODULE, | ||
206 | .llseek = no_llseek, | ||
207 | .write = geodewdt_write, | ||
208 | .ioctl = geodewdt_ioctl, | ||
209 | .open = geodewdt_open, | ||
210 | .release = geodewdt_release, | ||
211 | }; | ||
212 | |||
213 | static struct miscdevice geodewdt_miscdev = { | ||
214 | .minor = WATCHDOG_MINOR, | ||
215 | .name = "watchdog", | ||
216 | .fops = &geodewdt_fops | ||
217 | }; | ||
218 | |||
219 | static int __devinit | ||
220 | geodewdt_probe(struct platform_device *dev) | ||
221 | { | ||
222 | int ret, timer; | ||
223 | |||
224 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); | ||
225 | |||
226 | if (timer == -1) { | ||
227 | printk(KERN_ERR "geodewdt: No timers were available\n"); | ||
228 | return -ENODEV; | ||
229 | } | ||
230 | |||
231 | wdt_timer = timer; | ||
232 | |||
233 | /* Set up the timer */ | ||
234 | |||
235 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, | ||
236 | GEODEWDT_SCALE | (3 << 8)); | ||
237 | |||
238 | /* Set up comparator 2 to reset when the event fires */ | ||
239 | geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); | ||
240 | |||
241 | /* Set up the initial timeout */ | ||
242 | |||
243 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, | ||
244 | timeout * GEODEWDT_HZ); | ||
245 | |||
246 | ret = misc_register(&geodewdt_miscdev); | ||
247 | |||
248 | return ret; | ||
249 | } | ||
250 | |||
251 | static int __devexit | ||
252 | geodewdt_remove(struct platform_device *dev) | ||
253 | { | ||
254 | misc_deregister(&geodewdt_miscdev); | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | static void | ||
259 | geodewdt_shutdown(struct platform_device *dev) | ||
260 | { | ||
261 | geodewdt_disable(); | ||
262 | } | ||
263 | |||
264 | static struct platform_driver geodewdt_driver = { | ||
265 | .probe = geodewdt_probe, | ||
266 | .remove = __devexit_p(geodewdt_remove), | ||
267 | .shutdown = geodewdt_shutdown, | ||
268 | .driver = { | ||
269 | .owner = THIS_MODULE, | ||
270 | .name = DRV_NAME, | ||
271 | }, | ||
272 | }; | ||
273 | |||
274 | static int __init | ||
275 | geodewdt_init(void) | ||
276 | { | ||
277 | int ret; | ||
278 | |||
279 | ret = platform_driver_register(&geodewdt_driver); | ||
280 | if (ret) | ||
281 | return ret; | ||
282 | |||
283 | geodewdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); | ||
284 | if (IS_ERR(geodewdt_platform_device)) { | ||
285 | ret = PTR_ERR(geodewdt_platform_device); | ||
286 | goto err; | ||
287 | } | ||
288 | |||
289 | return 0; | ||
290 | err: | ||
291 | platform_driver_unregister(&geodewdt_driver); | ||
292 | return ret; | ||
293 | } | ||
294 | |||
295 | static void __exit | ||
296 | geodewdt_exit(void) | ||
297 | { | ||
298 | platform_device_unregister(geodewdt_platform_device); | ||
299 | platform_driver_unregister(&geodewdt_driver); | ||
300 | } | ||
301 | |||
302 | module_init(geodewdt_init); | ||
303 | module_exit(geodewdt_exit); | ||
304 | |||
305 | MODULE_AUTHOR("Advanced Micro Devices, Inc"); | ||
306 | MODULE_DESCRIPTION("Geode GX/LX Watchdog Driver"); | ||
307 | MODULE_LICENSE("GPL"); | ||
308 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 6483d1066b95..6a63535fc04d 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -418,23 +418,20 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, | |||
418 | static unsigned long rom_pl; | 418 | static unsigned long rom_pl; |
419 | static int die_nmi_called; | 419 | static int die_nmi_called; |
420 | 420 | ||
421 | if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) | 421 | if (ulReason == DIE_NMI || ulReason == DIE_NMI_IPI) { |
422 | return NOTIFY_OK; | 422 | spin_lock_irqsave(&rom_lock, rom_pl); |
423 | 423 | if (!die_nmi_called) | |
424 | spin_lock_irqsave(&rom_lock, rom_pl); | 424 | asminline_call(&cmn_regs, cru_rom_addr); |
425 | if (!die_nmi_called) | 425 | die_nmi_called = 1; |
426 | asminline_call(&cmn_regs, cru_rom_addr); | 426 | spin_unlock_irqrestore(&rom_lock, rom_pl); |
427 | die_nmi_called = 1; | 427 | if (cmn_regs.u1.ral != 0) { |
428 | spin_unlock_irqrestore(&rom_lock, rom_pl); | 428 | panic("An NMI occurred, please see the Integrated " |
429 | if (cmn_regs.u1.ral == 0) { | 429 | "Management Log for details.\n"); |
430 | printk(KERN_WARNING "hpwdt: An NMI occurred, " | 430 | } |
431 | "but unable to determine source.\n"); | ||
432 | } else { | ||
433 | panic("An NMI occurred, please see the Integrated " | ||
434 | "Management Log for details.\n"); | ||
435 | } | 431 | } |
436 | 432 | ||
437 | return NOTIFY_STOP; | 433 | die_nmi_called = 0; |
434 | return NOTIFY_DONE; | ||
438 | } | 435 | } |
439 | 436 | ||
440 | /* | 437 | /* |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index a0e6809e369f..95ba985bd341 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -41,9 +41,10 @@ | |||
41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, | 41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, |
42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, | 42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, |
43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, | 43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, |
44 | * 82801IB (ICH9) : document number 316972-001, 316973-001, | 44 | * 82801IB (ICH9) : document number 316972-001, 316973-006, |
45 | * 82801IR (ICH9R) : document number 316972-001, 316973-001, | 45 | * 82801IR (ICH9R) : document number 316972-001, 316973-006, |
46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-001, | 46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-006, |
47 | * 82801IO (ICH9DO) : document number 316972-001, 316973-006, | ||
47 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, | 48 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, |
48 | * 631xESB (631xESB) : document number 313082-001, 313075-005, | 49 | * 631xESB (631xESB) : document number 313082-001, 313075-005, |
49 | * 632xESB (632xESB) : document number 313082-001, 313075-005 | 50 | * 632xESB (632xESB) : document number 313082-001, 313075-005 |
@@ -55,8 +56,8 @@ | |||
55 | 56 | ||
56 | /* Module and version information */ | 57 | /* Module and version information */ |
57 | #define DRV_NAME "iTCO_wdt" | 58 | #define DRV_NAME "iTCO_wdt" |
58 | #define DRV_VERSION "1.02" | 59 | #define DRV_VERSION "1.03" |
59 | #define DRV_RELDATE "26-Jul-2007" | 60 | #define DRV_RELDATE "30-Apr-2008" |
60 | #define PFX DRV_NAME ": " | 61 | #define PFX DRV_NAME ": " |
61 | 62 | ||
62 | /* Includes */ | 63 | /* Includes */ |
@@ -104,6 +105,7 @@ enum iTCO_chipsets { | |||
104 | TCO_ICH9, /* ICH9 */ | 105 | TCO_ICH9, /* ICH9 */ |
105 | TCO_ICH9R, /* ICH9R */ | 106 | TCO_ICH9R, /* ICH9R */ |
106 | TCO_ICH9DH, /* ICH9DH */ | 107 | TCO_ICH9DH, /* ICH9DH */ |
108 | TCO_ICH9DO, /* ICH9DO */ | ||
107 | TCO_631XESB, /* 631xESB/632xESB */ | 109 | TCO_631XESB, /* 631xESB/632xESB */ |
108 | }; | 110 | }; |
109 | 111 | ||
@@ -136,6 +138,7 @@ static struct { | |||
136 | {"ICH9", 2}, | 138 | {"ICH9", 2}, |
137 | {"ICH9R", 2}, | 139 | {"ICH9R", 2}, |
138 | {"ICH9DH", 2}, | 140 | {"ICH9DH", 2}, |
141 | {"ICH9DO", 2}, | ||
139 | {"631xESB/632xESB", 2}, | 142 | {"631xESB/632xESB", 2}, |
140 | {NULL,0} | 143 | {NULL,0} |
141 | }; | 144 | }; |
@@ -181,6 +184,7 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = { | |||
181 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, | 184 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, |
182 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, | 185 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, |
183 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, | 186 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, |
187 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4, TCO_ICH9DO )}, | ||
184 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, | 188 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, |
185 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, | 189 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, |
186 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, | 190 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, |
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index c622a0e6c9ae..528b882420b6 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #define WATCHDOG_NAME "w83697hf/hg WDT" | 44 | #define WATCHDOG_NAME "w83697hf/hg WDT" |
45 | #define PFX WATCHDOG_NAME ": " | 45 | #define PFX WATCHDOG_NAME ": " |
46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
47 | #define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ | ||
47 | 48 | ||
48 | static unsigned long wdt_is_open; | 49 | static unsigned long wdt_is_open; |
49 | static char expect_close; | 50 | static char expect_close; |
@@ -56,12 +57,16 @@ MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect) | |||
56 | 57 | ||
57 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ | 58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ |
58 | module_param(timeout, int, 0); | 59 | module_param(timeout, int, 0); |
59 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
60 | 61 | ||
61 | static int nowayout = WATCHDOG_NOWAYOUT; | 62 | static int nowayout = WATCHDOG_NOWAYOUT; |
62 | module_param(nowayout, int, 0); | 63 | module_param(nowayout, int, 0); |
63 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 64 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
64 | 65 | ||
66 | static int early_disable = WATCHDOG_EARLY_DISABLE; | ||
67 | module_param(early_disable, int, 0); | ||
68 | MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")"); | ||
69 | |||
65 | /* | 70 | /* |
66 | * Kernel methods. | 71 | * Kernel methods. |
67 | */ | 72 | */ |
@@ -140,7 +145,7 @@ w83697hf_init(void) | |||
140 | w83697hf_deselect_wdt(); | 145 | w83697hf_deselect_wdt(); |
141 | } | 146 | } |
142 | 147 | ||
143 | static int | 148 | static void |
144 | wdt_ping(void) | 149 | wdt_ping(void) |
145 | { | 150 | { |
146 | spin_lock(&io_lock); | 151 | spin_lock(&io_lock); |
@@ -150,10 +155,9 @@ wdt_ping(void) | |||
150 | 155 | ||
151 | w83697hf_deselect_wdt(); | 156 | w83697hf_deselect_wdt(); |
152 | spin_unlock(&io_lock); | 157 | spin_unlock(&io_lock); |
153 | return 0; | ||
154 | } | 158 | } |
155 | 159 | ||
156 | static int | 160 | static void |
157 | wdt_enable(void) | 161 | wdt_enable(void) |
158 | { | 162 | { |
159 | spin_lock(&io_lock); | 163 | spin_lock(&io_lock); |
@@ -164,10 +168,9 @@ wdt_enable(void) | |||
164 | 168 | ||
165 | w83697hf_deselect_wdt(); | 169 | w83697hf_deselect_wdt(); |
166 | spin_unlock(&io_lock); | 170 | spin_unlock(&io_lock); |
167 | return 0; | ||
168 | } | 171 | } |
169 | 172 | ||
170 | static int | 173 | static void |
171 | wdt_disable(void) | 174 | wdt_disable(void) |
172 | { | 175 | { |
173 | spin_lock(&io_lock); | 176 | spin_lock(&io_lock); |
@@ -178,7 +181,22 @@ wdt_disable(void) | |||
178 | 181 | ||
179 | w83697hf_deselect_wdt(); | 182 | w83697hf_deselect_wdt(); |
180 | spin_unlock(&io_lock); | 183 | spin_unlock(&io_lock); |
181 | return 0; | 184 | } |
185 | |||
186 | static unsigned char | ||
187 | wdt_running(void) | ||
188 | { | ||
189 | unsigned char t; | ||
190 | |||
191 | spin_lock(&io_lock); | ||
192 | w83697hf_select_wdt(); | ||
193 | |||
194 | t = w83697hf_get_reg(0xF4); /* Read timer */ | ||
195 | |||
196 | w83697hf_deselect_wdt(); | ||
197 | spin_unlock(&io_lock); | ||
198 | |||
199 | return t; | ||
182 | } | 200 | } |
183 | 201 | ||
184 | static int | 202 | static int |
@@ -397,7 +415,11 @@ wdt_init(void) | |||
397 | } | 415 | } |
398 | 416 | ||
399 | w83697hf_init(); | 417 | w83697hf_init(); |
400 | wdt_disable(); /* Disable watchdog until first use */ | 418 | if (early_disable) { |
419 | if (wdt_running()) | ||
420 | printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n"); | ||
421 | wdt_disable(); | ||
422 | } | ||
401 | 423 | ||
402 | if (wdt_set_heartbeat(timeout)) { | 424 | if (wdt_set_heartbeat(timeout)) { |
403 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 425 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |