diff options
Diffstat (limited to 'drivers')
62 files changed, 653 insertions, 468 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 5207f9e4b443..cbb6f0814ce2 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -322,10 +322,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
| 322 | if (result) | 322 | if (result) |
| 323 | return result; | 323 | return result; |
| 324 | 324 | ||
| 325 | result = acpi_processor_get_platform_limit(pr); | ||
| 326 | if (result) | ||
| 327 | return result; | ||
| 328 | |||
| 329 | return 0; | 325 | return 0; |
| 330 | } | 326 | } |
| 331 | 327 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 36b37d755dbc..3d54680d0333 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -1677,8 +1677,6 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 1677 | struct acpi_video_device *video_device = data; | 1677 | struct acpi_video_device *video_device = data; |
| 1678 | struct acpi_device *device = NULL; | 1678 | struct acpi_device *device = NULL; |
| 1679 | 1679 | ||
| 1680 | |||
| 1681 | printk("video device notify\n"); | ||
| 1682 | if (!video_device) | 1680 | if (!video_device) |
| 1683 | return; | 1681 | return; |
| 1684 | 1682 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index da21552d2b1c..1c94b43d2c9b 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
| @@ -19,6 +19,10 @@ config ATA | |||
| 19 | 19 | ||
| 20 | if ATA | 20 | if ATA |
| 21 | 21 | ||
| 22 | config ATA_NONSTANDARD | ||
| 23 | bool | ||
| 24 | default n | ||
| 25 | |||
| 22 | config SATA_AHCI | 26 | config SATA_AHCI |
| 23 | tristate "AHCI SATA support" | 27 | tristate "AHCI SATA support" |
| 24 | depends on PCI | 28 | depends on PCI |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index b517d2493551..28a82e3403f1 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -75,6 +75,7 @@ enum { | |||
| 75 | AHCI_CMD_CLR_BUSY = (1 << 10), | 75 | AHCI_CMD_CLR_BUSY = (1 << 10), |
| 76 | 76 | ||
| 77 | RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ | 77 | RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ |
| 78 | RX_FIS_SDB = 0x58, /* offset of SDB FIS data */ | ||
| 78 | RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ | 79 | RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ |
| 79 | 80 | ||
| 80 | board_ahci = 0, | 81 | board_ahci = 0, |
| @@ -202,6 +203,10 @@ struct ahci_port_priv { | |||
| 202 | dma_addr_t cmd_tbl_dma; | 203 | dma_addr_t cmd_tbl_dma; |
| 203 | void *rx_fis; | 204 | void *rx_fis; |
| 204 | dma_addr_t rx_fis_dma; | 205 | dma_addr_t rx_fis_dma; |
| 206 | /* for NCQ spurious interrupt analysis */ | ||
| 207 | int ncq_saw_spurious_sdb_cnt; | ||
| 208 | unsigned int ncq_saw_d2h:1; | ||
| 209 | unsigned int ncq_saw_dmas:1; | ||
| 205 | }; | 210 | }; |
| 206 | 211 | ||
| 207 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); | 212 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); |
| @@ -361,7 +366,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 361 | { PCI_VDEVICE(INTEL, 0x27c1), board_ahci }, /* ICH7 */ | 366 | { PCI_VDEVICE(INTEL, 0x27c1), board_ahci }, /* ICH7 */ |
| 362 | { PCI_VDEVICE(INTEL, 0x27c5), board_ahci }, /* ICH7M */ | 367 | { PCI_VDEVICE(INTEL, 0x27c5), board_ahci }, /* ICH7M */ |
| 363 | { PCI_VDEVICE(INTEL, 0x27c3), board_ahci }, /* ICH7R */ | 368 | { PCI_VDEVICE(INTEL, 0x27c3), board_ahci }, /* ICH7R */ |
| 364 | { PCI_VDEVICE(AL, 0x5288), board_ahci }, /* ULi M5288 */ | 369 | { PCI_VDEVICE(AL, 0x5288), board_ahci_ign_iferr }, /* ULi M5288 */ |
| 365 | { PCI_VDEVICE(INTEL, 0x2681), board_ahci }, /* ESB2 */ | 370 | { PCI_VDEVICE(INTEL, 0x2681), board_ahci }, /* ESB2 */ |
| 366 | { PCI_VDEVICE(INTEL, 0x2682), board_ahci }, /* ESB2 */ | 371 | { PCI_VDEVICE(INTEL, 0x2682), board_ahci }, /* ESB2 */ |
| 367 | { PCI_VDEVICE(INTEL, 0x2683), board_ahci }, /* ESB2 */ | 372 | { PCI_VDEVICE(INTEL, 0x2683), board_ahci }, /* ESB2 */ |
| @@ -586,35 +591,18 @@ static void ahci_power_down(void __iomem *port_mmio, u32 cap) | |||
| 586 | { | 591 | { |
| 587 | u32 cmd, scontrol; | 592 | u32 cmd, scontrol; |
| 588 | 593 | ||
| 589 | cmd = readl(port_mmio + PORT_CMD) & ~PORT_CMD_ICC_MASK; | 594 | if (!(cap & HOST_CAP_SSS)) |
| 590 | 595 | return; | |
| 591 | if (cap & HOST_CAP_SSC) { | ||
| 592 | /* enable transitions to slumber mode */ | ||
| 593 | scontrol = readl(port_mmio + PORT_SCR_CTL); | ||
| 594 | if ((scontrol & 0x0f00) > 0x100) { | ||
| 595 | scontrol &= ~0xf00; | ||
| 596 | writel(scontrol, port_mmio + PORT_SCR_CTL); | ||
| 597 | } | ||
| 598 | |||
| 599 | /* put device into slumber mode */ | ||
| 600 | writel(cmd | PORT_CMD_ICC_SLUMBER, port_mmio + PORT_CMD); | ||
| 601 | |||
| 602 | /* wait for the transition to complete */ | ||
| 603 | ata_wait_register(port_mmio + PORT_CMD, PORT_CMD_ICC_SLUMBER, | ||
| 604 | PORT_CMD_ICC_SLUMBER, 1, 50); | ||
| 605 | } | ||
| 606 | 596 | ||
| 607 | /* put device into listen mode */ | 597 | /* put device into listen mode, first set PxSCTL.DET to 0 */ |
| 608 | if (cap & HOST_CAP_SSS) { | 598 | scontrol = readl(port_mmio + PORT_SCR_CTL); |
| 609 | /* first set PxSCTL.DET to 0 */ | 599 | scontrol &= ~0xf; |
| 610 | scontrol = readl(port_mmio + PORT_SCR_CTL); | 600 | writel(scontrol, port_mmio + PORT_SCR_CTL); |
| 611 | scontrol &= ~0xf; | ||
| 612 | writel(scontrol, port_mmio + PORT_SCR_CTL); | ||
| 613 | 601 | ||
| 614 | /* then set PxCMD.SUD to 0 */ | 602 | /* then set PxCMD.SUD to 0 */ |
| 615 | cmd &= ~PORT_CMD_SPIN_UP; | 603 | cmd = readl(port_mmio + PORT_CMD) & ~PORT_CMD_ICC_MASK; |
| 616 | writel(cmd, port_mmio + PORT_CMD); | 604 | cmd &= ~PORT_CMD_SPIN_UP; |
| 617 | } | 605 | writel(cmd, port_mmio + PORT_CMD); |
| 618 | } | 606 | } |
| 619 | 607 | ||
| 620 | static void ahci_init_port(void __iomem *port_mmio, u32 cap, | 608 | static void ahci_init_port(void __iomem *port_mmio, u32 cap, |
| @@ -915,7 +903,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class) | |||
| 915 | 903 | ||
| 916 | /* clear D2H reception area to properly wait for D2H FIS */ | 904 | /* clear D2H reception area to properly wait for D2H FIS */ |
| 917 | ata_tf_init(ap->device, &tf); | 905 | ata_tf_init(ap->device, &tf); |
| 918 | tf.command = 0xff; | 906 | tf.command = 0x80; |
| 919 | ata_tf_to_fis(&tf, d2h_fis, 0); | 907 | ata_tf_to_fis(&tf, d2h_fis, 0); |
| 920 | 908 | ||
| 921 | rc = sata_std_hardreset(ap, class); | 909 | rc = sata_std_hardreset(ap, class); |
| @@ -1126,8 +1114,9 @@ static void ahci_host_intr(struct ata_port *ap) | |||
| 1126 | void __iomem *mmio = ap->host->mmio_base; | 1114 | void __iomem *mmio = ap->host->mmio_base; |
| 1127 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1115 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
| 1128 | struct ata_eh_info *ehi = &ap->eh_info; | 1116 | struct ata_eh_info *ehi = &ap->eh_info; |
| 1117 | struct ahci_port_priv *pp = ap->private_data; | ||
| 1129 | u32 status, qc_active; | 1118 | u32 status, qc_active; |
| 1130 | int rc; | 1119 | int rc, known_irq = 0; |
| 1131 | 1120 | ||
| 1132 | status = readl(port_mmio + PORT_IRQ_STAT); | 1121 | status = readl(port_mmio + PORT_IRQ_STAT); |
| 1133 | writel(status, port_mmio + PORT_IRQ_STAT); | 1122 | writel(status, port_mmio + PORT_IRQ_STAT); |
| @@ -1154,17 +1143,53 @@ static void ahci_host_intr(struct ata_port *ap) | |||
| 1154 | 1143 | ||
| 1155 | /* hmmm... a spurious interupt */ | 1144 | /* hmmm... a spurious interupt */ |
| 1156 | 1145 | ||
| 1157 | /* some devices send D2H reg with I bit set during NCQ command phase */ | 1146 | /* if !NCQ, ignore. No modern ATA device has broken HSM |
| 1158 | if (ap->sactive && (status & PORT_IRQ_D2H_REG_FIS)) | 1147 | * implementation for non-NCQ commands. |
| 1148 | */ | ||
| 1149 | if (!ap->sactive) | ||
| 1159 | return; | 1150 | return; |
| 1160 | 1151 | ||
| 1161 | /* ignore interim PIO setup fis interrupts */ | 1152 | if (status & PORT_IRQ_D2H_REG_FIS) { |
| 1162 | if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) | 1153 | if (!pp->ncq_saw_d2h) |
| 1163 | return; | 1154 | ata_port_printk(ap, KERN_INFO, |
| 1155 | "D2H reg with I during NCQ, " | ||
| 1156 | "this message won't be printed again\n"); | ||
| 1157 | pp->ncq_saw_d2h = 1; | ||
| 1158 | known_irq = 1; | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | if (status & PORT_IRQ_DMAS_FIS) { | ||
| 1162 | if (!pp->ncq_saw_dmas) | ||
| 1163 | ata_port_printk(ap, KERN_INFO, | ||
| 1164 | "DMAS FIS during NCQ, " | ||
| 1165 | "this message won't be printed again\n"); | ||
| 1166 | pp->ncq_saw_dmas = 1; | ||
| 1167 | known_irq = 1; | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | if (status & PORT_IRQ_SDB_FIS && | ||
| 1171 | pp->ncq_saw_spurious_sdb_cnt < 10) { | ||
| 1172 | /* SDB FIS containing spurious completions might be | ||
| 1173 | * dangerous, we need to know more about them. Print | ||
| 1174 | * more of it. | ||
| 1175 | */ | ||
| 1176 | const u32 *f = pp->rx_fis + RX_FIS_SDB; | ||
| 1177 | |||
| 1178 | ata_port_printk(ap, KERN_INFO, "Spurious SDB FIS during NCQ " | ||
| 1179 | "issue=0x%x SAct=0x%x FIS=%08x:%08x%s\n", | ||
| 1180 | readl(port_mmio + PORT_CMD_ISSUE), | ||
| 1181 | readl(port_mmio + PORT_SCR_ACT), | ||
| 1182 | le32_to_cpu(f[0]), le32_to_cpu(f[1]), | ||
| 1183 | pp->ncq_saw_spurious_sdb_cnt < 10 ? | ||
| 1184 | "" : ", shutting up"); | ||
| 1185 | |||
| 1186 | pp->ncq_saw_spurious_sdb_cnt++; | ||
| 1187 | known_irq = 1; | ||
| 1188 | } | ||
| 1164 | 1189 | ||
| 1165 | if (ata_ratelimit()) | 1190 | if (!known_irq) |
| 1166 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " | 1191 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " |
| 1167 | "(irq_stat 0x%x active_tag %d sactive 0x%x)\n", | 1192 | "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n", |
| 1168 | status, ap->active_tag, ap->sactive); | 1193 | status, ap->active_tag, ap->sactive); |
| 1169 | } | 1194 | } |
| 1170 | 1195 | ||
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 908751d27e76..24af56081b5d 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
| @@ -64,6 +64,7 @@ static void generic_error_handler(struct ata_port *ap) | |||
| 64 | /** | 64 | /** |
| 65 | * generic_set_mode - mode setting | 65 | * generic_set_mode - mode setting |
| 66 | * @ap: interface to set up | 66 | * @ap: interface to set up |
| 67 | * @unused: returned device on error | ||
| 67 | * | 68 | * |
| 68 | * Use a non standard set_mode function. We don't want to be tuned. | 69 | * Use a non standard set_mode function. We don't want to be tuned. |
| 69 | * The BIOS configured everything. Our job is not to fiddle. We | 70 | * The BIOS configured everything. Our job is not to fiddle. We |
| @@ -71,7 +72,7 @@ static void generic_error_handler(struct ata_port *ap) | |||
| 71 | * and respect them. | 72 | * and respect them. |
| 72 | */ | 73 | */ |
| 73 | 74 | ||
| 74 | static void generic_set_mode(struct ata_port *ap) | 75 | static int generic_set_mode(struct ata_port *ap, struct ata_device **unused) |
| 75 | { | 76 | { |
| 76 | int dma_enabled = 0; | 77 | int dma_enabled = 0; |
| 77 | int i; | 78 | int i; |
| @@ -82,7 +83,7 @@ static void generic_set_mode(struct ata_port *ap) | |||
| 82 | 83 | ||
| 83 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 84 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
| 84 | struct ata_device *dev = &ap->device[i]; | 85 | struct ata_device *dev = &ap->device[i]; |
| 85 | if (ata_dev_enabled(dev)) { | 86 | if (ata_dev_ready(dev)) { |
| 86 | /* We don't really care */ | 87 | /* We don't really care */ |
| 87 | dev->pio_mode = XFER_PIO_0; | 88 | dev->pio_mode = XFER_PIO_0; |
| 88 | dev->dma_mode = XFER_MW_DMA_0; | 89 | dev->dma_mode = XFER_MW_DMA_0; |
| @@ -99,6 +100,7 @@ static void generic_set_mode(struct ata_port *ap) | |||
| 99 | } | 100 | } |
| 100 | } | 101 | } |
| 101 | } | 102 | } |
| 103 | return 0; | ||
| 102 | } | 104 | } |
| 103 | 105 | ||
| 104 | static struct scsi_host_template generic_sht = { | 106 | static struct scsi_host_template generic_sht = { |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 0d51d13b16bf..a388a8df0043 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -2431,18 +2431,8 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
| 2431 | int i, rc = 0, used_dma = 0, found = 0; | 2431 | int i, rc = 0, used_dma = 0, found = 0; |
| 2432 | 2432 | ||
| 2433 | /* has private set_mode? */ | 2433 | /* has private set_mode? */ |
| 2434 | if (ap->ops->set_mode) { | 2434 | if (ap->ops->set_mode) |
| 2435 | /* FIXME: make ->set_mode handle no device case and | 2435 | return ap->ops->set_mode(ap, r_failed_dev); |
| 2436 | * return error code and failing device on failure. | ||
| 2437 | */ | ||
| 2438 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | ||
| 2439 | if (ata_dev_ready(&ap->device[i])) { | ||
| 2440 | ap->ops->set_mode(ap); | ||
| 2441 | break; | ||
| 2442 | } | ||
| 2443 | } | ||
| 2444 | return 0; | ||
| 2445 | } | ||
| 2446 | 2436 | ||
| 2447 | /* step 1: calculate xfer_mask */ | 2437 | /* step 1: calculate xfer_mask */ |
| 2448 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2438 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 836947da5b14..7cc5a4a910a4 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -372,7 +372,7 @@ struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
| 372 | if (cmd->use_sg) { | 372 | if (cmd->use_sg) { |
| 373 | qc->__sg = (struct scatterlist *) cmd->request_buffer; | 373 | qc->__sg = (struct scatterlist *) cmd->request_buffer; |
| 374 | qc->n_elem = cmd->use_sg; | 374 | qc->n_elem = cmd->use_sg; |
| 375 | } else { | 375 | } else if (cmd->request_bufflen) { |
| 376 | qc->__sg = &qc->sgent; | 376 | qc->__sg = &qc->sgent; |
| 377 | qc->n_elem = 1; | 377 | qc->n_elem = 1; |
| 378 | } | 378 | } |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 623cec914c9b..12c88c588039 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
| @@ -827,7 +827,8 @@ void ata_bmdma_error_handler(struct ata_port *ap) | |||
| 827 | */ | 827 | */ |
| 828 | void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) | 828 | void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) |
| 829 | { | 829 | { |
| 830 | ata_bmdma_stop(qc); | 830 | if (qc->ap->ioaddr.bmdma_addr) |
| 831 | ata_bmdma_stop(qc); | ||
| 831 | } | 832 | } |
| 832 | 833 | ||
| 833 | #ifdef CONFIG_PCI | 834 | #ifdef CONFIG_PCI |
| @@ -870,7 +871,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
| 870 | pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; | 871 | pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; |
| 871 | bmdma = pci_resource_start(pdev, 4); | 872 | bmdma = pci_resource_start(pdev, 4); |
| 872 | if (bmdma) { | 873 | if (bmdma) { |
| 873 | if (inb(bmdma + 2) & 0x80) | 874 | if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) && |
| 875 | (inb(bmdma + 2) & 0x80)) | ||
| 874 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; | 876 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; |
| 875 | probe_ent->port[p].bmdma_addr = bmdma; | 877 | probe_ent->port[p].bmdma_addr = bmdma; |
| 876 | } | 878 | } |
| @@ -886,7 +888,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int | |||
| 886 | bmdma = pci_resource_start(pdev, 4); | 888 | bmdma = pci_resource_start(pdev, 4); |
| 887 | if (bmdma) { | 889 | if (bmdma) { |
| 888 | bmdma += 8; | 890 | bmdma += 8; |
| 889 | if(inb(bmdma + 2) & 0x80) | 891 | if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) && |
| 892 | (inb(bmdma + 2) & 0x80)) | ||
| 890 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; | 893 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; |
| 891 | probe_ent->port[p].bmdma_addr = bmdma; | 894 | probe_ent->port[p].bmdma_addr = bmdma; |
| 892 | } | 895 | } |
| @@ -914,13 +917,14 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | |||
| 914 | probe_ent->irq_flags = IRQF_SHARED; | 917 | probe_ent->irq_flags = IRQF_SHARED; |
| 915 | 918 | ||
| 916 | if (port_mask & ATA_PORT_PRIMARY) { | 919 | if (port_mask & ATA_PORT_PRIMARY) { |
| 917 | probe_ent->irq = ATA_PRIMARY_IRQ; | 920 | probe_ent->irq = ATA_PRIMARY_IRQ(pdev); |
| 918 | probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD; | 921 | probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD; |
| 919 | probe_ent->port[0].altstatus_addr = | 922 | probe_ent->port[0].altstatus_addr = |
| 920 | probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL; | 923 | probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL; |
| 921 | if (bmdma) { | 924 | if (bmdma) { |
| 922 | probe_ent->port[0].bmdma_addr = bmdma; | 925 | probe_ent->port[0].bmdma_addr = bmdma; |
| 923 | if (inb(bmdma + 2) & 0x80) | 926 | if ((!(port[0]->flags & ATA_FLAG_IGN_SIMPLEX)) && |
| 927 | (inb(bmdma + 2) & 0x80)) | ||
| 924 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; | 928 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; |
| 925 | } | 929 | } |
| 926 | ata_std_ports(&probe_ent->port[0]); | 930 | ata_std_ports(&probe_ent->port[0]); |
| @@ -929,15 +933,16 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, | |||
| 929 | 933 | ||
| 930 | if (port_mask & ATA_PORT_SECONDARY) { | 934 | if (port_mask & ATA_PORT_SECONDARY) { |
| 931 | if (probe_ent->irq) | 935 | if (probe_ent->irq) |
| 932 | probe_ent->irq2 = ATA_SECONDARY_IRQ; | 936 | probe_ent->irq2 = ATA_SECONDARY_IRQ(pdev); |
| 933 | else | 937 | else |
| 934 | probe_ent->irq = ATA_SECONDARY_IRQ; | 938 | probe_ent->irq = ATA_SECONDARY_IRQ(pdev); |
| 935 | probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD; | 939 | probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD; |
| 936 | probe_ent->port[1].altstatus_addr = | 940 | probe_ent->port[1].altstatus_addr = |
| 937 | probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL; | 941 | probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL; |
| 938 | if (bmdma) { | 942 | if (bmdma) { |
| 939 | probe_ent->port[1].bmdma_addr = bmdma + 8; | 943 | probe_ent->port[1].bmdma_addr = bmdma + 8; |
| 940 | if (inb(bmdma + 10) & 0x80) | 944 | if ((!(port[1]->flags & ATA_FLAG_IGN_SIMPLEX)) && |
| 945 | (inb(bmdma + 10) & 0x80)) | ||
| 941 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; | 946 | probe_ent->_host_flags |= ATA_HOST_SIMPLEX; |
| 942 | } | 947 | } |
| 943 | ata_std_ports(&probe_ent->port[1]); | 948 | ata_std_ports(&probe_ent->port[1]); |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 15841a563694..449162cbf93e 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
| @@ -197,7 +197,7 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
| 197 | static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 197 | static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
| 198 | { | 198 | { |
| 199 | static const u8 udma_data[] = { | 199 | static const u8 udma_data[] = { |
| 200 | 0x31, 0x21, 0x11, 0x25, 0x15, 0x05 | 200 | 0x30, 0x20, 0x10, 0x20, 0x10, 0x00 |
| 201 | }; | 201 | }; |
| 202 | static const u8 mwdma_data[] = { | 202 | static const u8 mwdma_data[] = { |
| 203 | 0x30, 0x20, 0x10 | 203 | 0x30, 0x20, 0x10 |
| @@ -213,12 +213,21 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
| 213 | pci_read_config_byte(pdev, pciD, ®D); | 213 | pci_read_config_byte(pdev, pciD, ®D); |
| 214 | pci_read_config_byte(pdev, pciU, ®U); | 214 | pci_read_config_byte(pdev, pciU, ®U); |
| 215 | 215 | ||
| 216 | regD &= ~(0x20 << shift); | 216 | /* DMA bits off */ |
| 217 | regU &= ~(0x35 << shift); | 217 | regD &= ~(0x20 << adev->devno); |
| 218 | /* DMA control bits */ | ||
| 219 | regU &= ~(0x30 << shift); | ||
| 220 | /* DMA timing bits */ | ||
| 221 | regU &= ~(0x05 << adev->devno); | ||
| 218 | 222 | ||
| 219 | if (adev->dma_mode >= XFER_UDMA_0) | 223 | if (adev->dma_mode >= XFER_UDMA_0) { |
| 224 | /* Merge thge timing value */ | ||
| 220 | regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; | 225 | regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; |
| 221 | else | 226 | /* Merge the control bits */ |
| 227 | regU |= 1 << adev->devno; /* UDMA on */ | ||
| 228 | if (adev->dma_mode > 2) /* 15nS timing */ | ||
| 229 | regU |= 4 << adev->devno; | ||
| 230 | } else | ||
| 222 | regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift; | 231 | regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift; |
| 223 | 232 | ||
| 224 | regD |= 0x20 << adev->devno; | 233 | regD |= 0x20 << adev->devno; |
| @@ -239,8 +248,8 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc) | |||
| 239 | struct ata_port *ap = qc->ap; | 248 | struct ata_port *ap = qc->ap; |
| 240 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 249 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
| 241 | u8 dma_intr; | 250 | u8 dma_intr; |
| 242 | int dma_reg = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; | 251 | int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; |
| 243 | int dma_mask = ap->port_no ? ARTTIM2 : CFR; | 252 | int dma_reg = ap->port_no ? ARTTIM2 : CFR; |
| 244 | 253 | ||
| 245 | ata_bmdma_stop(qc); | 254 | ata_bmdma_stop(qc); |
| 246 | 255 | ||
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index f6817b4093a4..886fab9aa62c 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
| 26 | 26 | ||
| 27 | #define DRV_NAME "pata_hpt3x2n" | 27 | #define DRV_NAME "pata_hpt3x2n" |
| 28 | #define DRV_VERSION "0.3" | 28 | #define DRV_VERSION "0.3.2" |
| 29 | 29 | ||
| 30 | enum { | 30 | enum { |
| 31 | HPT_PCI_FAST = (1 << 31), | 31 | HPT_PCI_FAST = (1 << 31), |
| @@ -297,11 +297,11 @@ static int hpt3x2n_pair_idle(struct ata_port *ap) | |||
| 297 | return 0; | 297 | return 0; |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | static int hpt3x2n_use_dpll(struct ata_port *ap, int reading) | 300 | static int hpt3x2n_use_dpll(struct ata_port *ap, int writing) |
| 301 | { | 301 | { |
| 302 | long flags = (long)ap->host->private_data; | 302 | long flags = (long)ap->host->private_data; |
| 303 | /* See if we should use the DPLL */ | 303 | /* See if we should use the DPLL */ |
| 304 | if (reading == 0) | 304 | if (writing) |
| 305 | return USE_DPLL; /* Needed for write */ | 305 | return USE_DPLL; /* Needed for write */ |
| 306 | if (flags & PCI66) | 306 | if (flags & PCI66) |
| 307 | return USE_DPLL; /* Needed at 66Mhz */ | 307 | return USE_DPLL; /* Needed at 66Mhz */ |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 0b56ff3d1cfe..e8afd486434a 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
| @@ -476,6 +476,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc) | |||
| 476 | /** | 476 | /** |
| 477 | * it821x_smart_set_mode - mode setting | 477 | * it821x_smart_set_mode - mode setting |
| 478 | * @ap: interface to set up | 478 | * @ap: interface to set up |
| 479 | * @unused: device that failed (error only) | ||
| 479 | * | 480 | * |
| 480 | * Use a non standard set_mode function. We don't want to be tuned. | 481 | * Use a non standard set_mode function. We don't want to be tuned. |
| 481 | * The BIOS configured everything. Our job is not to fiddle. We | 482 | * The BIOS configured everything. Our job is not to fiddle. We |
| @@ -483,7 +484,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc) | |||
| 483 | * and respect them. | 484 | * and respect them. |
| 484 | */ | 485 | */ |
| 485 | 486 | ||
| 486 | static void it821x_smart_set_mode(struct ata_port *ap) | 487 | static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused) |
| 487 | { | 488 | { |
| 488 | int dma_enabled = 0; | 489 | int dma_enabled = 0; |
| 489 | int i; | 490 | int i; |
| @@ -512,6 +513,7 @@ static void it821x_smart_set_mode(struct ata_port *ap) | |||
| 512 | } | 513 | } |
| 513 | } | 514 | } |
| 514 | } | 515 | } |
| 516 | return 0; | ||
| 515 | } | 517 | } |
| 516 | 518 | ||
| 517 | /** | 519 | /** |
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index cb8924109f59..23b8aab3ebd8 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
| @@ -23,9 +23,9 @@ | |||
| 23 | #include <scsi/scsi_host.h> | 23 | #include <scsi/scsi_host.h> |
| 24 | 24 | ||
| 25 | #define DRV_NAME "pata_ixp4xx_cf" | 25 | #define DRV_NAME "pata_ixp4xx_cf" |
| 26 | #define DRV_VERSION "0.1.1" | 26 | #define DRV_VERSION "0.1.1ac1" |
| 27 | 27 | ||
| 28 | static void ixp4xx_set_mode(struct ata_port *ap) | 28 | static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device *adev) |
| 29 | { | 29 | { |
| 30 | int i; | 30 | int i; |
| 31 | 31 | ||
| @@ -38,6 +38,7 @@ static void ixp4xx_set_mode(struct ata_port *ap) | |||
| 38 | dev->flags |= ATA_DFLAG_PIO; | 38 | dev->flags |= ATA_DFLAG_PIO; |
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | return 0; | ||
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | static void ixp4xx_phy_reset(struct ata_port *ap) | 44 | static void ixp4xx_phy_reset(struct ata_port *ap) |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index e7bf9d89c8ee..581cb33c6f45 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
| @@ -96,6 +96,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */ | |||
| 96 | /** | 96 | /** |
| 97 | * legacy_set_mode - mode setting | 97 | * legacy_set_mode - mode setting |
| 98 | * @ap: IDE interface | 98 | * @ap: IDE interface |
| 99 | * @unused: Device that failed when error is returned | ||
| 99 | * | 100 | * |
| 100 | * Use a non standard set_mode function. We don't want to be tuned. | 101 | * Use a non standard set_mode function. We don't want to be tuned. |
| 101 | * | 102 | * |
| @@ -105,7 +106,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */ | |||
| 105 | * expand on this as per hdparm in the base kernel. | 106 | * expand on this as per hdparm in the base kernel. |
| 106 | */ | 107 | */ |
| 107 | 108 | ||
| 108 | static void legacy_set_mode(struct ata_port *ap) | 109 | static int legacy_set_mode(struct ata_port *ap, struct ata_device **unused) |
| 109 | { | 110 | { |
| 110 | int i; | 111 | int i; |
| 111 | 112 | ||
| @@ -118,6 +119,7 @@ static void legacy_set_mode(struct ata_port *ap) | |||
| 118 | dev->flags |= ATA_DFLAG_PIO; | 119 | dev->flags |= ATA_DFLAG_PIO; |
| 119 | } | 120 | } |
| 120 | } | 121 | } |
| 122 | return 0; | ||
| 121 | } | 123 | } |
| 122 | 124 | ||
| 123 | static struct scsi_host_template legacy_sht = { | 125 | static struct scsi_host_template legacy_sht = { |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index adf4cc134f25..cec0729225e1 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
| @@ -52,19 +52,20 @@ static void rz1000_error_handler(struct ata_port *ap) | |||
| 52 | /** | 52 | /** |
| 53 | * rz1000_set_mode - mode setting function | 53 | * rz1000_set_mode - mode setting function |
| 54 | * @ap: ATA interface | 54 | * @ap: ATA interface |
| 55 | * @unused: returned device on set_mode failure | ||
| 55 | * | 56 | * |
| 56 | * Use a non standard set_mode function. We don't want to be tuned. We | 57 | * Use a non standard set_mode function. We don't want to be tuned. We |
| 57 | * would prefer to be BIOS generic but for the fact our hardware is | 58 | * would prefer to be BIOS generic but for the fact our hardware is |
| 58 | * whacked out. | 59 | * whacked out. |
| 59 | */ | 60 | */ |
| 60 | 61 | ||
| 61 | static void rz1000_set_mode(struct ata_port *ap) | 62 | static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused) |
| 62 | { | 63 | { |
| 63 | int i; | 64 | int i; |
| 64 | 65 | ||
| 65 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 66 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
| 66 | struct ata_device *dev = &ap->device[i]; | 67 | struct ata_device *dev = &ap->device[i]; |
| 67 | if (ata_dev_enabled(dev)) { | 68 | if (ata_dev_ready(dev)) { |
| 68 | /* We don't really care */ | 69 | /* We don't really care */ |
| 69 | dev->pio_mode = XFER_PIO_0; | 70 | dev->pio_mode = XFER_PIO_0; |
| 70 | dev->xfer_mode = XFER_PIO_0; | 71 | dev->xfer_mode = XFER_PIO_0; |
| @@ -72,6 +73,7 @@ static void rz1000_set_mode(struct ata_port *ap) | |||
| 72 | dev->flags |= ATA_DFLAG_PIO; | 73 | dev->flags |= ATA_DFLAG_PIO; |
| 73 | } | 74 | } |
| 74 | } | 75 | } |
| 76 | return 0; | ||
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | 79 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index f6d498e1cf80..f7a963eb1f02 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -700,7 +700,6 @@ static void nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err) | |||
| 700 | static int nv_host_intr(struct ata_port *ap, u8 irq_stat) | 700 | static int nv_host_intr(struct ata_port *ap, u8 irq_stat) |
| 701 | { | 701 | { |
| 702 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | 702 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); |
| 703 | int handled; | ||
| 704 | 703 | ||
| 705 | /* freeze if hotplugged */ | 704 | /* freeze if hotplugged */ |
| 706 | if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) { | 705 | if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) { |
| @@ -719,13 +718,7 @@ static int nv_host_intr(struct ata_port *ap, u8 irq_stat) | |||
| 719 | } | 718 | } |
| 720 | 719 | ||
| 721 | /* handle interrupt */ | 720 | /* handle interrupt */ |
| 722 | handled = ata_host_intr(ap, qc); | 721 | return ata_host_intr(ap, qc); |
| 723 | if (unlikely(!handled)) { | ||
| 724 | /* spurious, clear it */ | ||
| 725 | ata_check_status(ap); | ||
| 726 | } | ||
| 727 | |||
| 728 | return 1; | ||
| 729 | } | 722 | } |
| 730 | 723 | ||
| 731 | static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | 724 | static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) |
| @@ -752,6 +745,11 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
| 752 | if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { | 745 | if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { |
| 753 | u8 irq_stat = readb(host->mmio_base + NV_INT_STATUS_CK804) | 746 | u8 irq_stat = readb(host->mmio_base + NV_INT_STATUS_CK804) |
| 754 | >> (NV_INT_PORT_SHIFT * i); | 747 | >> (NV_INT_PORT_SHIFT * i); |
| 748 | if(ata_tag_valid(ap->active_tag)) | ||
| 749 | /** NV_INT_DEV indication seems unreliable at times | ||
| 750 | at least in ADMA mode. Force it on always when a | ||
| 751 | command is active, to prevent losing interrupts. */ | ||
| 752 | irq_stat |= NV_INT_DEV; | ||
| 755 | handled += nv_host_intr(ap, irq_stat); | 753 | handled += nv_host_intr(ap, irq_stat); |
| 756 | continue; | 754 | continue; |
| 757 | } | 755 | } |
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index 5c603ca3a50a..a43aec62d505 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
| @@ -128,7 +128,8 @@ static const struct ata_port_operations uli_ops = { | |||
| 128 | 128 | ||
| 129 | static struct ata_port_info uli_port_info = { | 129 | static struct ata_port_info uli_port_info = { |
| 130 | .sht = &uli_sht, | 130 | .sht = &uli_sht, |
| 131 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 131 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
| 132 | ATA_FLAG_IGN_SIMPLEX, | ||
| 132 | .pio_mask = 0x1f, /* pio0-4 */ | 133 | .pio_mask = 0x1f, /* pio0-4 */ |
| 133 | .udma_mask = 0x7f, /* udma0-6 */ | 134 | .udma_mask = 0x7f, /* udma0-6 */ |
| 134 | .port_ops = &uli_ops, | 135 | .port_ops = &uli_ops, |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 88f0565c8883..d3d5c0d57032 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
| @@ -74,6 +74,7 @@ enum { | |||
| 74 | static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 74 | static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
| 75 | static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); | 75 | static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); |
| 76 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 76 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
| 77 | static void svia_noop_freeze(struct ata_port *ap); | ||
| 77 | static void vt6420_error_handler(struct ata_port *ap); | 78 | static void vt6420_error_handler(struct ata_port *ap); |
| 78 | 79 | ||
| 79 | static const struct pci_device_id svia_pci_tbl[] = { | 80 | static const struct pci_device_id svia_pci_tbl[] = { |
| @@ -128,7 +129,7 @@ static const struct ata_port_operations vt6420_sata_ops = { | |||
| 128 | .qc_issue = ata_qc_issue_prot, | 129 | .qc_issue = ata_qc_issue_prot, |
| 129 | .data_xfer = ata_pio_data_xfer, | 130 | .data_xfer = ata_pio_data_xfer, |
| 130 | 131 | ||
| 131 | .freeze = ata_bmdma_freeze, | 132 | .freeze = svia_noop_freeze, |
| 132 | .thaw = ata_bmdma_thaw, | 133 | .thaw = ata_bmdma_thaw, |
| 133 | .error_handler = vt6420_error_handler, | 134 | .error_handler = vt6420_error_handler, |
| 134 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 135 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
| @@ -204,6 +205,15 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
| 204 | outl(val, ap->ioaddr.scr_addr + (4 * sc_reg)); | 205 | outl(val, ap->ioaddr.scr_addr + (4 * sc_reg)); |
| 205 | } | 206 | } |
| 206 | 207 | ||
| 208 | static void svia_noop_freeze(struct ata_port *ap) | ||
| 209 | { | ||
| 210 | /* Some VIA controllers choke if ATA_NIEN is manipulated in | ||
| 211 | * certain way. Leave it alone and just clear pending IRQ. | ||
| 212 | */ | ||
| 213 | ata_chk_status(ap); | ||
| 214 | ata_bmdma_irq_clear(ap); | ||
| 215 | } | ||
| 216 | |||
| 207 | /** | 217 | /** |
| 208 | * vt6420_prereset - prereset for vt6420 | 218 | * vt6420_prereset - prereset for vt6420 |
| 209 | * @ap: target ATA port | 219 | * @ap: target ATA port |
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 4dc10105d610..f96446c358ba 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c | |||
| @@ -1845,7 +1845,7 @@ static u16 __devinit read_bia (const hrz_dev * dev, u16 addr) | |||
| 1845 | 1845 | ||
| 1846 | /********** initialise a card **********/ | 1846 | /********** initialise a card **********/ |
| 1847 | 1847 | ||
| 1848 | static int __init hrz_init (hrz_dev * dev) { | 1848 | static int __devinit hrz_init (hrz_dev * dev) { |
| 1849 | int onefivefive; | 1849 | int onefivefive; |
| 1850 | 1850 | ||
| 1851 | u16 chan; | 1851 | u16 chan; |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 448d5083c381..4fac2bdf6215 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
| @@ -186,6 +186,7 @@ static int got_event; /* if events processing have been done */ | |||
| 186 | static void switchover_timeout(unsigned long data); | 186 | static void switchover_timeout(unsigned long data); |
| 187 | static struct timer_list switchover_timer = | 187 | static struct timer_list switchover_timer = |
| 188 | TIMER_INITIALIZER(switchover_timeout , 0, 0); | 188 | TIMER_INITIALIZER(switchover_timeout , 0, 0); |
| 189 | static unsigned long tlclk_timer_data; | ||
| 189 | 190 | ||
| 190 | static struct tlclk_alarms *alarm_events; | 191 | static struct tlclk_alarms *alarm_events; |
| 191 | 192 | ||
| @@ -197,10 +198,19 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id); | |||
| 197 | 198 | ||
| 198 | static DECLARE_WAIT_QUEUE_HEAD(wq); | 199 | static DECLARE_WAIT_QUEUE_HEAD(wq); |
| 199 | 200 | ||
| 201 | static unsigned long useflags; | ||
| 202 | static DEFINE_MUTEX(tlclk_mutex); | ||
| 203 | |||
| 200 | static int tlclk_open(struct inode *inode, struct file *filp) | 204 | static int tlclk_open(struct inode *inode, struct file *filp) |
| 201 | { | 205 | { |
| 202 | int result; | 206 | int result; |
| 203 | 207 | ||
| 208 | if (test_and_set_bit(0, &useflags)) | ||
| 209 | return -EBUSY; | ||
| 210 | /* this legacy device is always one per system and it doesn't | ||
| 211 | * know how to handle multiple concurrent clients. | ||
| 212 | */ | ||
| 213 | |||
| 204 | /* Make sure there is no interrupt pending while | 214 | /* Make sure there is no interrupt pending while |
| 205 | * initialising interrupt handler */ | 215 | * initialising interrupt handler */ |
| 206 | inb(TLCLK_REG6); | 216 | inb(TLCLK_REG6); |
| @@ -221,6 +231,7 @@ static int tlclk_open(struct inode *inode, struct file *filp) | |||
| 221 | static int tlclk_release(struct inode *inode, struct file *filp) | 231 | static int tlclk_release(struct inode *inode, struct file *filp) |
| 222 | { | 232 | { |
| 223 | free_irq(telclk_interrupt, tlclk_interrupt); | 233 | free_irq(telclk_interrupt, tlclk_interrupt); |
| 234 | clear_bit(0, &useflags); | ||
| 224 | 235 | ||
| 225 | return 0; | 236 | return 0; |
| 226 | } | 237 | } |
| @@ -230,26 +241,25 @@ static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count, | |||
| 230 | { | 241 | { |
| 231 | if (count < sizeof(struct tlclk_alarms)) | 242 | if (count < sizeof(struct tlclk_alarms)) |
| 232 | return -EIO; | 243 | return -EIO; |
| 244 | if (mutex_lock_interruptible(&tlclk_mutex)) | ||
| 245 | return -EINTR; | ||
| 246 | |||
| 233 | 247 | ||
| 234 | wait_event_interruptible(wq, got_event); | 248 | wait_event_interruptible(wq, got_event); |
| 235 | if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms))) | 249 | if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms))) { |
| 250 | mutex_unlock(&tlclk_mutex); | ||
| 236 | return -EFAULT; | 251 | return -EFAULT; |
| 252 | } | ||
| 237 | 253 | ||
| 238 | memset(alarm_events, 0, sizeof(struct tlclk_alarms)); | 254 | memset(alarm_events, 0, sizeof(struct tlclk_alarms)); |
| 239 | got_event = 0; | 255 | got_event = 0; |
| 240 | 256 | ||
| 257 | mutex_unlock(&tlclk_mutex); | ||
| 241 | return sizeof(struct tlclk_alarms); | 258 | return sizeof(struct tlclk_alarms); |
| 242 | } | 259 | } |
| 243 | 260 | ||
| 244 | static ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t count, | ||
| 245 | loff_t *f_pos) | ||
| 246 | { | ||
| 247 | return 0; | ||
| 248 | } | ||
| 249 | |||
| 250 | static const struct file_operations tlclk_fops = { | 261 | static const struct file_operations tlclk_fops = { |
| 251 | .read = tlclk_read, | 262 | .read = tlclk_read, |
| 252 | .write = tlclk_write, | ||
| 253 | .open = tlclk_open, | 263 | .open = tlclk_open, |
| 254 | .release = tlclk_release, | 264 | .release = tlclk_release, |
| 255 | 265 | ||
| @@ -540,7 +550,7 @@ static ssize_t store_select_amcb1_transmit_clock(struct device *d, | |||
| 540 | SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x7); | 550 | SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x7); |
| 541 | switch (val) { | 551 | switch (val) { |
| 542 | case CLK_8_592MHz: | 552 | case CLK_8_592MHz: |
| 543 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 1); | 553 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 2); |
| 544 | break; | 554 | break; |
| 545 | case CLK_11_184MHz: | 555 | case CLK_11_184MHz: |
| 546 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 0); | 556 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 0); |
| @@ -549,7 +559,7 @@ static ssize_t store_select_amcb1_transmit_clock(struct device *d, | |||
| 549 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 3); | 559 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 3); |
| 550 | break; | 560 | break; |
| 551 | case CLK_44_736MHz: | 561 | case CLK_44_736MHz: |
| 552 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 2); | 562 | SET_PORT_BITS(TLCLK_REG0, 0xfc, 1); |
| 553 | break; | 563 | break; |
| 554 | } | 564 | } |
| 555 | } else | 565 | } else |
| @@ -839,11 +849,13 @@ static void __exit tlclk_cleanup(void) | |||
| 839 | 849 | ||
| 840 | static void switchover_timeout(unsigned long data) | 850 | static void switchover_timeout(unsigned long data) |
| 841 | { | 851 | { |
| 842 | if ((data & 1)) { | 852 | unsigned long flags = *(unsigned long *) data; |
| 843 | if ((inb(TLCLK_REG1) & 0x08) != (data & 0x08)) | 853 | |
| 854 | if ((flags & 1)) { | ||
| 855 | if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) | ||
| 844 | alarm_events->switchover_primary++; | 856 | alarm_events->switchover_primary++; |
| 845 | } else { | 857 | } else { |
| 846 | if ((inb(TLCLK_REG1) & 0x08) != (data & 0x08)) | 858 | if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) |
| 847 | alarm_events->switchover_secondary++; | 859 | alarm_events->switchover_secondary++; |
| 848 | } | 860 | } |
| 849 | 861 | ||
| @@ -901,8 +913,9 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id) | |||
| 901 | 913 | ||
| 902 | /* TIMEOUT in ~10ms */ | 914 | /* TIMEOUT in ~10ms */ |
| 903 | switchover_timer.expires = jiffies + msecs_to_jiffies(10); | 915 | switchover_timer.expires = jiffies + msecs_to_jiffies(10); |
| 904 | switchover_timer.data = inb(TLCLK_REG1); | 916 | tlclk_timer_data = inb(TLCLK_REG1); |
| 905 | add_timer(&switchover_timer); | 917 | switchover_timer.data = (unsigned long) &tlclk_timer_data; |
| 918 | mod_timer(&switchover_timer, switchover_timer.expires); | ||
| 906 | } else { | 919 | } else { |
| 907 | got_event = 1; | 920 | got_event = 1; |
| 908 | wake_up(&wq); | 921 | wake_up(&wq); |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index a744dad9cf45..0cea8d4907df 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2002 MontaVista Software Inc. | 4 | * Copyright (C) 2002 MontaVista Software Inc. |
| 5 | * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> | 5 | * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> |
| 6 | * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 6 | * Copyright (C) 2003-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 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 | 9 | * it under the terms of the GNU General Public License as published by |
| @@ -125,30 +125,17 @@ static inline uint16_t giu_clear(uint16_t offset, uint16_t clear) | |||
| 125 | return data; | 125 | return data; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | static unsigned int startup_giuint_low_irq(unsigned int irq) | 128 | static void ack_giuint_low(unsigned int irq) |
| 129 | { | 129 | { |
| 130 | unsigned int pin; | 130 | giu_write(GIUINTSTATL, 1 << GPIO_PIN_OF_IRQ(irq)); |
| 131 | |||
| 132 | pin = GPIO_PIN_OF_IRQ(irq); | ||
| 133 | giu_write(GIUINTSTATL, 1 << pin); | ||
| 134 | giu_set(GIUINTENL, 1 << pin); | ||
| 135 | |||
| 136 | return 0; | ||
| 137 | } | 131 | } |
| 138 | 132 | ||
| 139 | static void shutdown_giuint_low_irq(unsigned int irq) | 133 | static void mask_giuint_low(unsigned int irq) |
| 140 | { | 134 | { |
| 141 | giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); | 135 | giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); |
| 142 | } | 136 | } |
| 143 | 137 | ||
| 144 | static void enable_giuint_low_irq(unsigned int irq) | 138 | static void mask_ack_giuint_low(unsigned int irq) |
| 145 | { | ||
| 146 | giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); | ||
| 147 | } | ||
| 148 | |||
| 149 | #define disable_giuint_low_irq shutdown_giuint_low_irq | ||
| 150 | |||
| 151 | static void ack_giuint_low_irq(unsigned int irq) | ||
| 152 | { | 139 | { |
| 153 | unsigned int pin; | 140 | unsigned int pin; |
| 154 | 141 | ||
| @@ -157,46 +144,30 @@ static void ack_giuint_low_irq(unsigned int irq) | |||
| 157 | giu_write(GIUINTSTATL, 1 << pin); | 144 | giu_write(GIUINTSTATL, 1 << pin); |
| 158 | } | 145 | } |
| 159 | 146 | ||
| 160 | static void end_giuint_low_irq(unsigned int irq) | 147 | static void unmask_giuint_low(unsigned int irq) |
| 161 | { | 148 | { |
| 162 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | 149 | giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); |
| 163 | giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); | ||
| 164 | } | 150 | } |
| 165 | 151 | ||
| 166 | static struct hw_interrupt_type giuint_low_irq_type = { | 152 | static struct irq_chip giuint_low_irq_chip = { |
| 167 | .typename = "GIUINTL", | 153 | .name = "GIUINTL", |
| 168 | .startup = startup_giuint_low_irq, | 154 | .ack = ack_giuint_low, |
| 169 | .shutdown = shutdown_giuint_low_irq, | 155 | .mask = mask_giuint_low, |
| 170 | .enable = enable_giuint_low_irq, | 156 | .mask_ack = mask_ack_giuint_low, |
| 171 | .disable = disable_giuint_low_irq, | 157 | .unmask = unmask_giuint_low, |
| 172 | .ack = ack_giuint_low_irq, | ||
| 173 | .end = end_giuint_low_irq, | ||
| 174 | }; | 158 | }; |
| 175 | 159 | ||
| 176 | static unsigned int startup_giuint_high_irq(unsigned int irq) | 160 | static void ack_giuint_high(unsigned int irq) |
| 177 | { | 161 | { |
| 178 | unsigned int pin; | 162 | giu_write(GIUINTSTATH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); |
| 179 | |||
| 180 | pin = GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET; | ||
| 181 | giu_write(GIUINTSTATH, 1 << pin); | ||
| 182 | giu_set(GIUINTENH, 1 << pin); | ||
| 183 | |||
| 184 | return 0; | ||
| 185 | } | 163 | } |
| 186 | 164 | ||
| 187 | static void shutdown_giuint_high_irq(unsigned int irq) | 165 | static void mask_giuint_high(unsigned int irq) |
| 188 | { | 166 | { |
| 189 | giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); | 167 | giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); |
| 190 | } | 168 | } |
| 191 | 169 | ||
| 192 | static void enable_giuint_high_irq(unsigned int irq) | 170 | static void mask_ack_giuint_high(unsigned int irq) |
| 193 | { | ||
| 194 | giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); | ||
| 195 | } | ||
| 196 | |||
| 197 | #define disable_giuint_high_irq shutdown_giuint_high_irq | ||
| 198 | |||
| 199 | static void ack_giuint_high_irq(unsigned int irq) | ||
| 200 | { | 171 | { |
| 201 | unsigned int pin; | 172 | unsigned int pin; |
| 202 | 173 | ||
| @@ -205,20 +176,17 @@ static void ack_giuint_high_irq(unsigned int irq) | |||
| 205 | giu_write(GIUINTSTATH, 1 << pin); | 176 | giu_write(GIUINTSTATH, 1 << pin); |
| 206 | } | 177 | } |
| 207 | 178 | ||
| 208 | static void end_giuint_high_irq(unsigned int irq) | 179 | static void unmask_giuint_high(unsigned int irq) |
| 209 | { | 180 | { |
| 210 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | 181 | giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); |
| 211 | giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); | ||
| 212 | } | 182 | } |
| 213 | 183 | ||
| 214 | static struct hw_interrupt_type giuint_high_irq_type = { | 184 | static struct irq_chip giuint_high_irq_chip = { |
| 215 | .typename = "GIUINTH", | 185 | .name = "GIUINTH", |
| 216 | .startup = startup_giuint_high_irq, | 186 | .ack = ack_giuint_high, |
| 217 | .shutdown = shutdown_giuint_high_irq, | 187 | .mask = mask_giuint_high, |
| 218 | .enable = enable_giuint_high_irq, | 188 | .mask_ack = mask_ack_giuint_high, |
| 219 | .disable = disable_giuint_high_irq, | 189 | .unmask = unmask_giuint_high, |
| 220 | .ack = ack_giuint_high_irq, | ||
| 221 | .end = end_giuint_high_irq, | ||
| 222 | }; | 190 | }; |
| 223 | 191 | ||
| 224 | static int giu_get_irq(unsigned int irq) | 192 | static int giu_get_irq(unsigned int irq) |
| @@ -282,9 +250,15 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_ | |||
| 282 | break; | 250 | break; |
| 283 | } | 251 | } |
| 284 | } | 252 | } |
| 253 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
| 254 | &giuint_low_irq_chip, | ||
| 255 | handle_edge_irq); | ||
| 285 | } else { | 256 | } else { |
| 286 | giu_clear(GIUINTTYPL, mask); | 257 | giu_clear(GIUINTTYPL, mask); |
| 287 | giu_clear(GIUINTHTSELL, mask); | 258 | giu_clear(GIUINTHTSELL, mask); |
| 259 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
| 260 | &giuint_low_irq_chip, | ||
| 261 | handle_level_irq); | ||
| 288 | } | 262 | } |
| 289 | giu_write(GIUINTSTATL, mask); | 263 | giu_write(GIUINTSTATL, mask); |
| 290 | } else if (pin < GIUINT_HIGH_MAX) { | 264 | } else if (pin < GIUINT_HIGH_MAX) { |
| @@ -311,9 +285,15 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_ | |||
| 311 | break; | 285 | break; |
| 312 | } | 286 | } |
| 313 | } | 287 | } |
| 288 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
| 289 | &giuint_high_irq_chip, | ||
| 290 | handle_edge_irq); | ||
| 314 | } else { | 291 | } else { |
| 315 | giu_clear(GIUINTTYPH, mask); | 292 | giu_clear(GIUINTTYPH, mask); |
| 316 | giu_clear(GIUINTHTSELH, mask); | 293 | giu_clear(GIUINTHTSELH, mask); |
| 294 | set_irq_chip_and_handler(GIU_IRQ(pin), | ||
| 295 | &giuint_high_irq_chip, | ||
| 296 | handle_level_irq); | ||
| 317 | } | 297 | } |
| 318 | giu_write(GIUINTSTATH, mask); | 298 | giu_write(GIUINTSTATH, mask); |
| 319 | } | 299 | } |
| @@ -617,10 +597,11 @@ static const struct file_operations gpio_fops = { | |||
| 617 | static int __devinit giu_probe(struct platform_device *dev) | 597 | static int __devinit giu_probe(struct platform_device *dev) |
| 618 | { | 598 | { |
| 619 | unsigned long start, size, flags = 0; | 599 | unsigned long start, size, flags = 0; |
| 620 | unsigned int nr_pins = 0; | 600 | unsigned int nr_pins = 0, trigger, i, pin; |
| 621 | struct resource *res1, *res2 = NULL; | 601 | struct resource *res1, *res2 = NULL; |
| 622 | void *base; | 602 | void *base; |
| 623 | int retval, i; | 603 | struct irq_chip *chip; |
| 604 | int retval; | ||
| 624 | 605 | ||
| 625 | switch (current_cpu_data.cputype) { | 606 | switch (current_cpu_data.cputype) { |
| 626 | case CPU_VR4111: | 607 | case CPU_VR4111: |
| @@ -688,11 +669,20 @@ static int __devinit giu_probe(struct platform_device *dev) | |||
| 688 | giu_write(GIUINTENL, 0); | 669 | giu_write(GIUINTENL, 0); |
| 689 | giu_write(GIUINTENH, 0); | 670 | giu_write(GIUINTENH, 0); |
| 690 | 671 | ||
| 672 | trigger = giu_read(GIUINTTYPH) << 16; | ||
| 673 | trigger |= giu_read(GIUINTTYPL); | ||
| 691 | for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { | 674 | for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { |
| 692 | if (i < GIU_IRQ(GIUINT_HIGH_OFFSET)) | 675 | pin = GPIO_PIN_OF_IRQ(i); |
| 693 | irq_desc[i].chip = &giuint_low_irq_type; | 676 | if (pin < GIUINT_HIGH_OFFSET) |
| 677 | chip = &giuint_low_irq_chip; | ||
| 694 | else | 678 | else |
| 695 | irq_desc[i].chip = &giuint_high_irq_type; | 679 | chip = &giuint_high_irq_chip; |
| 680 | |||
| 681 | if (trigger & (1 << pin)) | ||
| 682 | set_irq_chip_and_handler(i, chip, handle_edge_irq); | ||
| 683 | else | ||
| 684 | set_irq_chip_and_handler(i, chip, handle_level_irq); | ||
| 685 | |||
| 696 | } | 686 | } |
| 697 | 687 | ||
| 698 | return cascade_irq(GIUINT_IRQ, giu_get_irq); | 688 | return cascade_irq(GIUINT_IRQ, giu_get_irq); |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 5ab5e393b882..c6281ccd4fe7 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
| @@ -122,8 +122,6 @@ struct efivar_entry { | |||
| 122 | struct kobject kobj; | 122 | struct kobject kobj; |
| 123 | }; | 123 | }; |
| 124 | 124 | ||
| 125 | #define get_efivar_entry(n) list_entry(n, struct efivar_entry, list) | ||
| 126 | |||
| 127 | struct efivar_attribute { | 125 | struct efivar_attribute { |
| 128 | struct attribute attr; | 126 | struct attribute attr; |
| 129 | ssize_t (*show) (struct efivar_entry *entry, char *buf); | 127 | ssize_t (*show) (struct efivar_entry *entry, char *buf); |
| @@ -386,9 +384,6 @@ static struct sysfs_ops efivar_attr_ops = { | |||
| 386 | static void efivar_release(struct kobject *kobj) | 384 | static void efivar_release(struct kobject *kobj) |
| 387 | { | 385 | { |
| 388 | struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj); | 386 | struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj); |
| 389 | spin_lock(&efivars_lock); | ||
| 390 | list_del(&var->list); | ||
| 391 | spin_unlock(&efivars_lock); | ||
| 392 | kfree(var); | 387 | kfree(var); |
| 393 | } | 388 | } |
| 394 | 389 | ||
| @@ -430,9 +425,8 @@ static ssize_t | |||
| 430 | efivar_create(struct subsystem *sub, const char *buf, size_t count) | 425 | efivar_create(struct subsystem *sub, const char *buf, size_t count) |
| 431 | { | 426 | { |
| 432 | struct efi_variable *new_var = (struct efi_variable *)buf; | 427 | struct efi_variable *new_var = (struct efi_variable *)buf; |
| 433 | struct efivar_entry *search_efivar = NULL; | 428 | struct efivar_entry *search_efivar, *n; |
| 434 | unsigned long strsize1, strsize2; | 429 | unsigned long strsize1, strsize2; |
| 435 | struct list_head *pos, *n; | ||
| 436 | efi_status_t status = EFI_NOT_FOUND; | 430 | efi_status_t status = EFI_NOT_FOUND; |
| 437 | int found = 0; | 431 | int found = 0; |
| 438 | 432 | ||
| @@ -444,8 +438,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count) | |||
| 444 | /* | 438 | /* |
| 445 | * Does this variable already exist? | 439 | * Does this variable already exist? |
| 446 | */ | 440 | */ |
| 447 | list_for_each_safe(pos, n, &efivar_list) { | 441 | list_for_each_entry_safe(search_efivar, n, &efivar_list, list) { |
| 448 | search_efivar = get_efivar_entry(pos); | ||
| 449 | strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024); | 442 | strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024); |
| 450 | strsize2 = utf8_strsize(new_var->VariableName, 1024); | 443 | strsize2 = utf8_strsize(new_var->VariableName, 1024); |
| 451 | if (strsize1 == strsize2 && | 444 | if (strsize1 == strsize2 && |
| @@ -490,9 +483,8 @@ static ssize_t | |||
| 490 | efivar_delete(struct subsystem *sub, const char *buf, size_t count) | 483 | efivar_delete(struct subsystem *sub, const char *buf, size_t count) |
| 491 | { | 484 | { |
| 492 | struct efi_variable *del_var = (struct efi_variable *)buf; | 485 | struct efi_variable *del_var = (struct efi_variable *)buf; |
| 493 | struct efivar_entry *search_efivar = NULL; | 486 | struct efivar_entry *search_efivar, *n; |
| 494 | unsigned long strsize1, strsize2; | 487 | unsigned long strsize1, strsize2; |
| 495 | struct list_head *pos, *n; | ||
| 496 | efi_status_t status = EFI_NOT_FOUND; | 488 | efi_status_t status = EFI_NOT_FOUND; |
| 497 | int found = 0; | 489 | int found = 0; |
| 498 | 490 | ||
| @@ -504,8 +496,7 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count) | |||
| 504 | /* | 496 | /* |
| 505 | * Does this variable already exist? | 497 | * Does this variable already exist? |
| 506 | */ | 498 | */ |
| 507 | list_for_each_safe(pos, n, &efivar_list) { | 499 | list_for_each_entry_safe(search_efivar, n, &efivar_list, list) { |
| 508 | search_efivar = get_efivar_entry(pos); | ||
| 509 | strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024); | 500 | strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024); |
| 510 | strsize2 = utf8_strsize(del_var->VariableName, 1024); | 501 | strsize2 = utf8_strsize(del_var->VariableName, 1024); |
| 511 | if (strsize1 == strsize2 && | 502 | if (strsize1 == strsize2 && |
| @@ -537,9 +528,9 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count) | |||
| 537 | spin_unlock(&efivars_lock); | 528 | spin_unlock(&efivars_lock); |
| 538 | return -EIO; | 529 | return -EIO; |
| 539 | } | 530 | } |
| 531 | list_del(&search_efivar->list); | ||
| 540 | /* We need to release this lock before unregistering. */ | 532 | /* We need to release this lock before unregistering. */ |
| 541 | spin_unlock(&efivars_lock); | 533 | spin_unlock(&efivars_lock); |
| 542 | |||
| 543 | efivar_unregister(search_efivar); | 534 | efivar_unregister(search_efivar); |
| 544 | 535 | ||
| 545 | /* It's dead Jim.... */ | 536 | /* It's dead Jim.... */ |
| @@ -768,10 +759,14 @@ out_free: | |||
| 768 | static void __exit | 759 | static void __exit |
| 769 | efivars_exit(void) | 760 | efivars_exit(void) |
| 770 | { | 761 | { |
| 771 | struct list_head *pos, *n; | 762 | struct efivar_entry *entry, *n; |
| 772 | 763 | ||
| 773 | list_for_each_safe(pos, n, &efivar_list) | 764 | list_for_each_entry_safe(entry, n, &efivar_list, list) { |
| 774 | efivar_unregister(get_efivar_entry(pos)); | 765 | spin_lock(&efivars_lock); |
| 766 | list_del(&entry->list); | ||
| 767 | spin_unlock(&efivars_lock); | ||
| 768 | efivar_unregister(entry); | ||
| 769 | } | ||
| 775 | 770 | ||
| 776 | subsystem_unregister(&vars_subsys); | 771 | subsystem_unregister(&vars_subsys); |
| 777 | firmware_unregister(&efi_subsys); | 772 | firmware_unregister(&efi_subsys); |
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c index 93995b658d94..6074c897f51c 100644 --- a/drivers/infiniband/hw/ehca/ehca_cq.c +++ b/drivers/infiniband/hw/ehca/ehca_cq.c | |||
| @@ -344,8 +344,11 @@ int ehca_destroy_cq(struct ib_cq *cq) | |||
| 344 | unsigned long flags; | 344 | unsigned long flags; |
| 345 | 345 | ||
| 346 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 346 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
| 347 | while (my_cq->nr_callbacks) | 347 | while (my_cq->nr_callbacks) { |
| 348 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
| 348 | yield(); | 349 | yield(); |
| 350 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
| 351 | } | ||
| 349 | 352 | ||
| 350 | idr_remove(&ehca_cq_idr, my_cq->token); | 353 | idr_remove(&ehca_cq_idr, my_cq->token); |
| 351 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | 354 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); |
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index e7209afb4250..c069be8cbcb2 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
| @@ -440,7 +440,8 @@ void ehca_tasklet_eq(unsigned long data) | |||
| 440 | cq = idr_find(&ehca_cq_idr, token); | 440 | cq = idr_find(&ehca_cq_idr, token); |
| 441 | 441 | ||
| 442 | if (cq == NULL) { | 442 | if (cq == NULL) { |
| 443 | spin_unlock(&ehca_cq_idr_lock); | 443 | spin_unlock_irqrestore(&ehca_cq_idr_lock, |
| 444 | flags); | ||
| 444 | break; | 445 | break; |
| 445 | } | 446 | } |
| 446 | 447 | ||
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index cdecbf5911c8..72611fd15103 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
| @@ -1621,18 +1621,30 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target) | |||
| 1621 | switch (token) { | 1621 | switch (token) { |
| 1622 | case SRP_OPT_ID_EXT: | 1622 | case SRP_OPT_ID_EXT: |
| 1623 | p = match_strdup(args); | 1623 | p = match_strdup(args); |
| 1624 | if (!p) { | ||
| 1625 | ret = -ENOMEM; | ||
| 1626 | goto out; | ||
| 1627 | } | ||
| 1624 | target->id_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); | 1628 | target->id_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); |
| 1625 | kfree(p); | 1629 | kfree(p); |
| 1626 | break; | 1630 | break; |
| 1627 | 1631 | ||
| 1628 | case SRP_OPT_IOC_GUID: | 1632 | case SRP_OPT_IOC_GUID: |
| 1629 | p = match_strdup(args); | 1633 | p = match_strdup(args); |
| 1634 | if (!p) { | ||
| 1635 | ret = -ENOMEM; | ||
| 1636 | goto out; | ||
| 1637 | } | ||
| 1630 | target->ioc_guid = cpu_to_be64(simple_strtoull(p, NULL, 16)); | 1638 | target->ioc_guid = cpu_to_be64(simple_strtoull(p, NULL, 16)); |
| 1631 | kfree(p); | 1639 | kfree(p); |
| 1632 | break; | 1640 | break; |
| 1633 | 1641 | ||
| 1634 | case SRP_OPT_DGID: | 1642 | case SRP_OPT_DGID: |
| 1635 | p = match_strdup(args); | 1643 | p = match_strdup(args); |
| 1644 | if (!p) { | ||
| 1645 | ret = -ENOMEM; | ||
| 1646 | goto out; | ||
| 1647 | } | ||
| 1636 | if (strlen(p) != 32) { | 1648 | if (strlen(p) != 32) { |
| 1637 | printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p); | 1649 | printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p); |
| 1638 | kfree(p); | 1650 | kfree(p); |
| @@ -1656,6 +1668,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target) | |||
| 1656 | 1668 | ||
| 1657 | case SRP_OPT_SERVICE_ID: | 1669 | case SRP_OPT_SERVICE_ID: |
| 1658 | p = match_strdup(args); | 1670 | p = match_strdup(args); |
| 1671 | if (!p) { | ||
| 1672 | ret = -ENOMEM; | ||
| 1673 | goto out; | ||
| 1674 | } | ||
| 1659 | target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16)); | 1675 | target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16)); |
| 1660 | kfree(p); | 1676 | kfree(p); |
| 1661 | break; | 1677 | break; |
| @@ -1693,6 +1709,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target) | |||
| 1693 | 1709 | ||
| 1694 | case SRP_OPT_INITIATOR_EXT: | 1710 | case SRP_OPT_INITIATOR_EXT: |
| 1695 | p = match_strdup(args); | 1711 | p = match_strdup(args); |
| 1712 | if (!p) { | ||
| 1713 | ret = -ENOMEM; | ||
| 1714 | goto out; | ||
| 1715 | } | ||
| 1696 | target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); | 1716 | target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); |
| 1697 | kfree(p); | 1717 | kfree(p); |
| 1698 | break; | 1718 | break; |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 95eff3b2917a..4f75cce6fdff 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
| @@ -356,16 +356,17 @@ static struct cardstate *alloc_cs(struct gigaset_driver *drv) | |||
| 356 | { | 356 | { |
| 357 | unsigned long flags; | 357 | unsigned long flags; |
| 358 | unsigned i; | 358 | unsigned i; |
| 359 | static struct cardstate *ret = NULL; | 359 | struct cardstate *ret = NULL; |
| 360 | 360 | ||
| 361 | spin_lock_irqsave(&drv->lock, flags); | 361 | spin_lock_irqsave(&drv->lock, flags); |
| 362 | for (i = 0; i < drv->minors; ++i) { | 362 | for (i = 0; i < drv->minors; ++i) { |
| 363 | if (!(drv->flags[i] & VALID_MINOR)) { | 363 | if (!(drv->flags[i] & VALID_MINOR)) { |
| 364 | drv->flags[i] = VALID_MINOR; | 364 | if (try_module_get(drv->owner)) { |
| 365 | ret = drv->cs + i; | 365 | drv->flags[i] = VALID_MINOR; |
| 366 | } | 366 | ret = drv->cs + i; |
| 367 | if (ret) | 367 | } |
| 368 | break; | 368 | break; |
| 369 | } | ||
| 369 | } | 370 | } |
| 370 | spin_unlock_irqrestore(&drv->lock, flags); | 371 | spin_unlock_irqrestore(&drv->lock, flags); |
| 371 | return ret; | 372 | return ret; |
| @@ -376,6 +377,8 @@ static void free_cs(struct cardstate *cs) | |||
| 376 | unsigned long flags; | 377 | unsigned long flags; |
| 377 | struct gigaset_driver *drv = cs->driver; | 378 | struct gigaset_driver *drv = cs->driver; |
| 378 | spin_lock_irqsave(&drv->lock, flags); | 379 | spin_lock_irqsave(&drv->lock, flags); |
| 380 | if (drv->flags[cs->minor_index] & VALID_MINOR) | ||
| 381 | module_put(drv->owner); | ||
| 379 | drv->flags[cs->minor_index] = 0; | 382 | drv->flags[cs->minor_index] = 0; |
| 380 | spin_unlock_irqrestore(&drv->lock, flags); | 383 | spin_unlock_irqrestore(&drv->lock, flags); |
| 381 | } | 384 | } |
| @@ -579,7 +582,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
| 579 | } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) | 582 | } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) |
| 580 | skb_reserve(bcs->skb, HW_HDR_LEN); | 583 | skb_reserve(bcs->skb, HW_HDR_LEN); |
| 581 | else { | 584 | else { |
| 582 | warn("could not allocate skb\n"); | 585 | warn("could not allocate skb"); |
| 583 | bcs->inputstate |= INS_skip_frame; | 586 | bcs->inputstate |= INS_skip_frame; |
| 584 | } | 587 | } |
| 585 | 588 | ||
| @@ -632,17 +635,25 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
| 632 | int i; | 635 | int i; |
| 633 | 636 | ||
| 634 | gig_dbg(DEBUG_INIT, "allocating cs"); | 637 | gig_dbg(DEBUG_INIT, "allocating cs"); |
| 635 | cs = alloc_cs(drv); | 638 | if (!(cs = alloc_cs(drv))) { |
| 636 | if (!cs) | 639 | err("maximum number of devices exceeded"); |
| 637 | goto error; | 640 | return NULL; |
| 641 | } | ||
| 642 | mutex_init(&cs->mutex); | ||
| 643 | mutex_lock(&cs->mutex); | ||
| 644 | |||
| 638 | gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1); | 645 | gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1); |
| 639 | cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL); | 646 | cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL); |
| 640 | if (!cs->bcs) | 647 | if (!cs->bcs) { |
| 648 | err("out of memory"); | ||
| 641 | goto error; | 649 | goto error; |
| 650 | } | ||
| 642 | gig_dbg(DEBUG_INIT, "allocating inbuf"); | 651 | gig_dbg(DEBUG_INIT, "allocating inbuf"); |
| 643 | cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL); | 652 | cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL); |
| 644 | if (!cs->inbuf) | 653 | if (!cs->inbuf) { |
| 654 | err("out of memory"); | ||
| 645 | goto error; | 655 | goto error; |
| 656 | } | ||
| 646 | 657 | ||
| 647 | cs->cs_init = 0; | 658 | cs->cs_init = 0; |
| 648 | cs->channels = channels; | 659 | cs->channels = channels; |
| @@ -654,8 +665,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
| 654 | spin_lock_init(&cs->ev_lock); | 665 | spin_lock_init(&cs->ev_lock); |
| 655 | cs->ev_tail = 0; | 666 | cs->ev_tail = 0; |
| 656 | cs->ev_head = 0; | 667 | cs->ev_head = 0; |
| 657 | mutex_init(&cs->mutex); | ||
| 658 | mutex_lock(&cs->mutex); | ||
| 659 | 668 | ||
| 660 | tasklet_init(&cs->event_tasklet, &gigaset_handle_event, | 669 | tasklet_init(&cs->event_tasklet, &gigaset_handle_event, |
| 661 | (unsigned long) cs); | 670 | (unsigned long) cs); |
| @@ -684,8 +693,10 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
| 684 | 693 | ||
| 685 | for (i = 0; i < channels; ++i) { | 694 | for (i = 0; i < channels; ++i) { |
| 686 | gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i); | 695 | gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i); |
| 687 | if (!gigaset_initbcs(cs->bcs + i, cs, i)) | 696 | if (!gigaset_initbcs(cs->bcs + i, cs, i)) { |
| 697 | err("could not allocate channel %d data", i); | ||
| 688 | goto error; | 698 | goto error; |
| 699 | } | ||
| 689 | } | 700 | } |
| 690 | 701 | ||
| 691 | ++cs->cs_init; | 702 | ++cs->cs_init; |
| @@ -720,8 +731,10 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
| 720 | make_valid(cs, VALID_ID); | 731 | make_valid(cs, VALID_ID); |
| 721 | ++cs->cs_init; | 732 | ++cs->cs_init; |
| 722 | gig_dbg(DEBUG_INIT, "setting up hw"); | 733 | gig_dbg(DEBUG_INIT, "setting up hw"); |
| 723 | if (!cs->ops->initcshw(cs)) | 734 | if (!cs->ops->initcshw(cs)) { |
| 735 | err("could not allocate device specific data"); | ||
| 724 | goto error; | 736 | goto error; |
| 737 | } | ||
| 725 | 738 | ||
| 726 | ++cs->cs_init; | 739 | ++cs->cs_init; |
| 727 | 740 | ||
| @@ -743,8 +756,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, | |||
| 743 | mutex_unlock(&cs->mutex); | 756 | mutex_unlock(&cs->mutex); |
| 744 | return cs; | 757 | return cs; |
| 745 | 758 | ||
| 746 | error: if (cs) | 759 | error: |
| 747 | mutex_unlock(&cs->mutex); | 760 | mutex_unlock(&cs->mutex); |
| 748 | gig_dbg(DEBUG_INIT, "failed"); | 761 | gig_dbg(DEBUG_INIT, "failed"); |
| 749 | gigaset_freecs(cs); | 762 | gigaset_freecs(cs); |
| 750 | return NULL; | 763 | return NULL; |
| @@ -1040,7 +1053,6 @@ void gigaset_freedriver(struct gigaset_driver *drv) | |||
| 1040 | spin_unlock_irqrestore(&driver_lock, flags); | 1053 | spin_unlock_irqrestore(&driver_lock, flags); |
| 1041 | 1054 | ||
| 1042 | gigaset_if_freedriver(drv); | 1055 | gigaset_if_freedriver(drv); |
| 1043 | module_put(drv->owner); | ||
| 1044 | 1056 | ||
| 1045 | kfree(drv->cs); | 1057 | kfree(drv->cs); |
| 1046 | kfree(drv->flags); | 1058 | kfree(drv->flags); |
| @@ -1072,10 +1084,6 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, | |||
| 1072 | if (!drv) | 1084 | if (!drv) |
| 1073 | return NULL; | 1085 | return NULL; |
| 1074 | 1086 | ||
| 1075 | if (!try_module_get(owner)) | ||
| 1076 | goto out1; | ||
| 1077 | |||
| 1078 | drv->cs = NULL; | ||
| 1079 | drv->have_tty = 0; | 1087 | drv->have_tty = 0; |
| 1080 | drv->minor = minor; | 1088 | drv->minor = minor; |
| 1081 | drv->minors = minors; | 1089 | drv->minors = minors; |
| @@ -1087,11 +1095,11 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, | |||
| 1087 | 1095 | ||
| 1088 | drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL); | 1096 | drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL); |
| 1089 | if (!drv->cs) | 1097 | if (!drv->cs) |
| 1090 | goto out2; | 1098 | goto error; |
| 1091 | 1099 | ||
| 1092 | drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL); | 1100 | drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL); |
| 1093 | if (!drv->flags) | 1101 | if (!drv->flags) |
| 1094 | goto out3; | 1102 | goto error; |
| 1095 | 1103 | ||
| 1096 | for (i = 0; i < minors; ++i) { | 1104 | for (i = 0; i < minors; ++i) { |
| 1097 | drv->flags[i] = 0; | 1105 | drv->flags[i] = 0; |
| @@ -1108,11 +1116,8 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, | |||
| 1108 | 1116 | ||
| 1109 | return drv; | 1117 | return drv; |
| 1110 | 1118 | ||
| 1111 | out3: | 1119 | error: |
| 1112 | kfree(drv->cs); | 1120 | kfree(drv->cs); |
| 1113 | out2: | ||
| 1114 | module_put(owner); | ||
| 1115 | out1: | ||
| 1116 | kfree(drv); | 1121 | kfree(drv); |
| 1117 | return NULL; | 1122 | return NULL; |
| 1118 | } | 1123 | } |
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 91e0c75aca8f..2db1ca4c6800 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
| @@ -242,6 +242,7 @@ struct kvm_vcpu { | |||
| 242 | u64 pdptrs[4]; /* pae */ | 242 | u64 pdptrs[4]; /* pae */ |
| 243 | u64 shadow_efer; | 243 | u64 shadow_efer; |
| 244 | u64 apic_base; | 244 | u64 apic_base; |
| 245 | u64 ia32_misc_enable_msr; | ||
| 245 | int nmsrs; | 246 | int nmsrs; |
| 246 | struct vmx_msr_entry *guest_msrs; | 247 | struct vmx_msr_entry *guest_msrs; |
| 247 | struct vmx_msr_entry *host_msrs; | 248 | struct vmx_msr_entry *host_msrs; |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 67c1154960f0..b10972ed0c9f 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
| @@ -272,7 +272,9 @@ static void kvm_free_physmem(struct kvm *kvm) | |||
| 272 | 272 | ||
| 273 | static void kvm_free_vcpu(struct kvm_vcpu *vcpu) | 273 | static void kvm_free_vcpu(struct kvm_vcpu *vcpu) |
| 274 | { | 274 | { |
| 275 | vcpu_load(vcpu->kvm, vcpu_slot(vcpu)); | ||
| 275 | kvm_mmu_destroy(vcpu); | 276 | kvm_mmu_destroy(vcpu); |
| 277 | vcpu_put(vcpu); | ||
| 276 | kvm_arch_ops->vcpu_free(vcpu); | 278 | kvm_arch_ops->vcpu_free(vcpu); |
| 277 | } | 279 | } |
| 278 | 280 | ||
| @@ -1224,6 +1226,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) | |||
| 1224 | case MSR_IA32_APICBASE: | 1226 | case MSR_IA32_APICBASE: |
| 1225 | data = vcpu->apic_base; | 1227 | data = vcpu->apic_base; |
| 1226 | break; | 1228 | break; |
| 1229 | case MSR_IA32_MISC_ENABLE: | ||
| 1230 | data = vcpu->ia32_misc_enable_msr; | ||
| 1231 | break; | ||
| 1227 | #ifdef CONFIG_X86_64 | 1232 | #ifdef CONFIG_X86_64 |
| 1228 | case MSR_EFER: | 1233 | case MSR_EFER: |
| 1229 | data = vcpu->shadow_efer; | 1234 | data = vcpu->shadow_efer; |
| @@ -1295,6 +1300,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
| 1295 | case MSR_IA32_APICBASE: | 1300 | case MSR_IA32_APICBASE: |
| 1296 | vcpu->apic_base = data; | 1301 | vcpu->apic_base = data; |
| 1297 | break; | 1302 | break; |
| 1303 | case MSR_IA32_MISC_ENABLE: | ||
| 1304 | vcpu->ia32_misc_enable_msr = data; | ||
| 1305 | break; | ||
| 1298 | default: | 1306 | default: |
| 1299 | printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); | 1307 | printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); |
| 1300 | return 1; | 1308 | return 1; |
| @@ -1598,6 +1606,10 @@ static u32 msrs_to_save[] = { | |||
| 1598 | 1606 | ||
| 1599 | static unsigned num_msrs_to_save; | 1607 | static unsigned num_msrs_to_save; |
| 1600 | 1608 | ||
| 1609 | static u32 emulated_msrs[] = { | ||
| 1610 | MSR_IA32_MISC_ENABLE, | ||
| 1611 | }; | ||
| 1612 | |||
| 1601 | static __init void kvm_init_msr_list(void) | 1613 | static __init void kvm_init_msr_list(void) |
| 1602 | { | 1614 | { |
| 1603 | u32 dummy[2]; | 1615 | u32 dummy[2]; |
| @@ -1923,7 +1935,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
| 1923 | if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list)) | 1935 | if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list)) |
| 1924 | goto out; | 1936 | goto out; |
| 1925 | n = msr_list.nmsrs; | 1937 | n = msr_list.nmsrs; |
| 1926 | msr_list.nmsrs = num_msrs_to_save; | 1938 | msr_list.nmsrs = num_msrs_to_save + ARRAY_SIZE(emulated_msrs); |
| 1927 | if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list)) | 1939 | if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list)) |
| 1928 | goto out; | 1940 | goto out; |
| 1929 | r = -E2BIG; | 1941 | r = -E2BIG; |
| @@ -1933,6 +1945,11 @@ static long kvm_dev_ioctl(struct file *filp, | |||
| 1933 | if (copy_to_user(user_msr_list->indices, &msrs_to_save, | 1945 | if (copy_to_user(user_msr_list->indices, &msrs_to_save, |
| 1934 | num_msrs_to_save * sizeof(u32))) | 1946 | num_msrs_to_save * sizeof(u32))) |
| 1935 | goto out; | 1947 | goto out; |
| 1948 | if (copy_to_user(user_msr_list->indices | ||
| 1949 | + num_msrs_to_save * sizeof(u32), | ||
| 1950 | &emulated_msrs, | ||
| 1951 | ARRAY_SIZE(emulated_msrs) * sizeof(u32))) | ||
| 1952 | goto out; | ||
| 1936 | r = 0; | 1953 | r = 0; |
| 1937 | break; | 1954 | break; |
| 1938 | } | 1955 | } |
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index c6f972914f08..22c426cd8cb2 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
| @@ -143,6 +143,7 @@ static int dbg = 1; | |||
| 143 | #define PFERR_PRESENT_MASK (1U << 0) | 143 | #define PFERR_PRESENT_MASK (1U << 0) |
| 144 | #define PFERR_WRITE_MASK (1U << 1) | 144 | #define PFERR_WRITE_MASK (1U << 1) |
| 145 | #define PFERR_USER_MASK (1U << 2) | 145 | #define PFERR_USER_MASK (1U << 2) |
| 146 | #define PFERR_FETCH_MASK (1U << 4) | ||
| 146 | 147 | ||
| 147 | #define PT64_ROOT_LEVEL 4 | 148 | #define PT64_ROOT_LEVEL 4 |
| 148 | #define PT32_ROOT_LEVEL 2 | 149 | #define PT32_ROOT_LEVEL 2 |
| @@ -168,6 +169,11 @@ static int is_cpuid_PSE36(void) | |||
| 168 | return 1; | 169 | return 1; |
| 169 | } | 170 | } |
| 170 | 171 | ||
| 172 | static int is_nx(struct kvm_vcpu *vcpu) | ||
| 173 | { | ||
| 174 | return vcpu->shadow_efer & EFER_NX; | ||
| 175 | } | ||
| 176 | |||
| 171 | static int is_present_pte(unsigned long pte) | 177 | static int is_present_pte(unsigned long pte) |
| 172 | { | 178 | { |
| 173 | return pte & PT_PRESENT_MASK; | 179 | return pte & PT_PRESENT_MASK; |
| @@ -992,16 +998,6 @@ static inline int fix_read_pf(u64 *shadow_ent) | |||
| 992 | return 0; | 998 | return 0; |
| 993 | } | 999 | } |
| 994 | 1000 | ||
| 995 | static int may_access(u64 pte, int write, int user) | ||
| 996 | { | ||
| 997 | |||
| 998 | if (user && !(pte & PT_USER_MASK)) | ||
| 999 | return 0; | ||
| 1000 | if (write && !(pte & PT_WRITABLE_MASK)) | ||
| 1001 | return 0; | ||
| 1002 | return 1; | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | static void paging_free(struct kvm_vcpu *vcpu) | 1001 | static void paging_free(struct kvm_vcpu *vcpu) |
| 1006 | { | 1002 | { |
| 1007 | nonpaging_free(vcpu); | 1003 | nonpaging_free(vcpu); |
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 2dbf4307ed9e..149fa45fd9a5 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
| @@ -63,13 +63,15 @@ struct guest_walker { | |||
| 63 | pt_element_t *ptep; | 63 | pt_element_t *ptep; |
| 64 | pt_element_t inherited_ar; | 64 | pt_element_t inherited_ar; |
| 65 | gfn_t gfn; | 65 | gfn_t gfn; |
| 66 | u32 error_code; | ||
| 66 | }; | 67 | }; |
| 67 | 68 | ||
| 68 | /* | 69 | /* |
| 69 | * Fetch a guest pte for a guest virtual address | 70 | * Fetch a guest pte for a guest virtual address |
| 70 | */ | 71 | */ |
| 71 | static void FNAME(walk_addr)(struct guest_walker *walker, | 72 | static int FNAME(walk_addr)(struct guest_walker *walker, |
| 72 | struct kvm_vcpu *vcpu, gva_t addr) | 73 | struct kvm_vcpu *vcpu, gva_t addr, |
| 74 | int write_fault, int user_fault, int fetch_fault) | ||
| 73 | { | 75 | { |
| 74 | hpa_t hpa; | 76 | hpa_t hpa; |
| 75 | struct kvm_memory_slot *slot; | 77 | struct kvm_memory_slot *slot; |
| @@ -86,7 +88,7 @@ static void FNAME(walk_addr)(struct guest_walker *walker, | |||
| 86 | walker->ptep = &vcpu->pdptrs[(addr >> 30) & 3]; | 88 | walker->ptep = &vcpu->pdptrs[(addr >> 30) & 3]; |
| 87 | root = *walker->ptep; | 89 | root = *walker->ptep; |
| 88 | if (!(root & PT_PRESENT_MASK)) | 90 | if (!(root & PT_PRESENT_MASK)) |
| 89 | return; | 91 | goto not_present; |
| 90 | --walker->level; | 92 | --walker->level; |
| 91 | } | 93 | } |
| 92 | #endif | 94 | #endif |
| @@ -111,11 +113,23 @@ static void FNAME(walk_addr)(struct guest_walker *walker, | |||
| 111 | ASSERT(((unsigned long)walker->table & PAGE_MASK) == | 113 | ASSERT(((unsigned long)walker->table & PAGE_MASK) == |
| 112 | ((unsigned long)ptep & PAGE_MASK)); | 114 | ((unsigned long)ptep & PAGE_MASK)); |
| 113 | 115 | ||
| 114 | if (is_present_pte(*ptep) && !(*ptep & PT_ACCESSED_MASK)) | ||
| 115 | *ptep |= PT_ACCESSED_MASK; | ||
| 116 | |||
| 117 | if (!is_present_pte(*ptep)) | 116 | if (!is_present_pte(*ptep)) |
| 118 | break; | 117 | goto not_present; |
| 118 | |||
| 119 | if (write_fault && !is_writeble_pte(*ptep)) | ||
| 120 | if (user_fault || is_write_protection(vcpu)) | ||
| 121 | goto access_error; | ||
| 122 | |||
| 123 | if (user_fault && !(*ptep & PT_USER_MASK)) | ||
| 124 | goto access_error; | ||
| 125 | |||
| 126 | #if PTTYPE == 64 | ||
| 127 | if (fetch_fault && is_nx(vcpu) && (*ptep & PT64_NX_MASK)) | ||
| 128 | goto access_error; | ||
| 129 | #endif | ||
| 130 | |||
| 131 | if (!(*ptep & PT_ACCESSED_MASK)) | ||
| 132 | *ptep |= PT_ACCESSED_MASK; /* avoid rmw */ | ||
| 119 | 133 | ||
| 120 | if (walker->level == PT_PAGE_TABLE_LEVEL) { | 134 | if (walker->level == PT_PAGE_TABLE_LEVEL) { |
| 121 | walker->gfn = (*ptep & PT_BASE_ADDR_MASK) | 135 | walker->gfn = (*ptep & PT_BASE_ADDR_MASK) |
| @@ -146,6 +160,23 @@ static void FNAME(walk_addr)(struct guest_walker *walker, | |||
| 146 | } | 160 | } |
| 147 | walker->ptep = ptep; | 161 | walker->ptep = ptep; |
| 148 | pgprintk("%s: pte %llx\n", __FUNCTION__, (u64)*ptep); | 162 | pgprintk("%s: pte %llx\n", __FUNCTION__, (u64)*ptep); |
| 163 | return 1; | ||
| 164 | |||
| 165 | not_present: | ||
| 166 | walker->error_code = 0; | ||
| 167 | goto err; | ||
| 168 | |||
| 169 | access_error: | ||
| 170 | walker->error_code = PFERR_PRESENT_MASK; | ||
| 171 | |||
| 172 | err: | ||
| 173 | if (write_fault) | ||
| 174 | walker->error_code |= PFERR_WRITE_MASK; | ||
| 175 | if (user_fault) | ||
| 176 | walker->error_code |= PFERR_USER_MASK; | ||
| 177 | if (fetch_fault) | ||
| 178 | walker->error_code |= PFERR_FETCH_MASK; | ||
| 179 | return 0; | ||
| 149 | } | 180 | } |
| 150 | 181 | ||
| 151 | static void FNAME(release_walker)(struct guest_walker *walker) | 182 | static void FNAME(release_walker)(struct guest_walker *walker) |
| @@ -274,7 +305,7 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu, | |||
| 274 | struct kvm_mmu_page *page; | 305 | struct kvm_mmu_page *page; |
| 275 | 306 | ||
| 276 | if (is_writeble_pte(*shadow_ent)) | 307 | if (is_writeble_pte(*shadow_ent)) |
| 277 | return 0; | 308 | return !user || (*shadow_ent & PT_USER_MASK); |
| 278 | 309 | ||
| 279 | writable_shadow = *shadow_ent & PT_SHADOW_WRITABLE_MASK; | 310 | writable_shadow = *shadow_ent & PT_SHADOW_WRITABLE_MASK; |
| 280 | if (user) { | 311 | if (user) { |
| @@ -347,8 +378,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
| 347 | u32 error_code) | 378 | u32 error_code) |
| 348 | { | 379 | { |
| 349 | int write_fault = error_code & PFERR_WRITE_MASK; | 380 | int write_fault = error_code & PFERR_WRITE_MASK; |
| 350 | int pte_present = error_code & PFERR_PRESENT_MASK; | ||
| 351 | int user_fault = error_code & PFERR_USER_MASK; | 381 | int user_fault = error_code & PFERR_USER_MASK; |
| 382 | int fetch_fault = error_code & PFERR_FETCH_MASK; | ||
| 352 | struct guest_walker walker; | 383 | struct guest_walker walker; |
| 353 | u64 *shadow_pte; | 384 | u64 *shadow_pte; |
| 354 | int fixed; | 385 | int fixed; |
| @@ -365,19 +396,20 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
| 365 | /* | 396 | /* |
| 366 | * Look up the shadow pte for the faulting address. | 397 | * Look up the shadow pte for the faulting address. |
| 367 | */ | 398 | */ |
| 368 | FNAME(walk_addr)(&walker, vcpu, addr); | 399 | r = FNAME(walk_addr)(&walker, vcpu, addr, write_fault, user_fault, |
| 369 | shadow_pte = FNAME(fetch)(vcpu, addr, &walker); | 400 | fetch_fault); |
| 370 | 401 | ||
| 371 | /* | 402 | /* |
| 372 | * The page is not mapped by the guest. Let the guest handle it. | 403 | * The page is not mapped by the guest. Let the guest handle it. |
| 373 | */ | 404 | */ |
| 374 | if (!shadow_pte) { | 405 | if (!r) { |
| 375 | pgprintk("%s: not mapped\n", __FUNCTION__); | 406 | pgprintk("%s: guest page fault\n", __FUNCTION__); |
| 376 | inject_page_fault(vcpu, addr, error_code); | 407 | inject_page_fault(vcpu, addr, walker.error_code); |
| 377 | FNAME(release_walker)(&walker); | 408 | FNAME(release_walker)(&walker); |
| 378 | return 0; | 409 | return 0; |
| 379 | } | 410 | } |
| 380 | 411 | ||
| 412 | shadow_pte = FNAME(fetch)(vcpu, addr, &walker); | ||
| 381 | pgprintk("%s: shadow pte %p %llx\n", __FUNCTION__, | 413 | pgprintk("%s: shadow pte %p %llx\n", __FUNCTION__, |
| 382 | shadow_pte, *shadow_pte); | 414 | shadow_pte, *shadow_pte); |
| 383 | 415 | ||
| @@ -399,22 +431,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
| 399 | * mmio: emulate if accessible, otherwise its a guest fault. | 431 | * mmio: emulate if accessible, otherwise its a guest fault. |
| 400 | */ | 432 | */ |
| 401 | if (is_io_pte(*shadow_pte)) { | 433 | if (is_io_pte(*shadow_pte)) { |
| 402 | if (may_access(*shadow_pte, write_fault, user_fault)) | 434 | return 1; |
| 403 | return 1; | ||
| 404 | pgprintk("%s: io work, no access\n", __FUNCTION__); | ||
| 405 | inject_page_fault(vcpu, addr, | ||
| 406 | error_code | PFERR_PRESENT_MASK); | ||
| 407 | kvm_mmu_audit(vcpu, "post page fault (io)"); | ||
| 408 | return 0; | ||
| 409 | } | ||
| 410 | |||
| 411 | /* | ||
| 412 | * pte not present, guest page fault. | ||
| 413 | */ | ||
| 414 | if (pte_present && !fixed && !write_pt) { | ||
| 415 | inject_page_fault(vcpu, addr, error_code); | ||
| 416 | kvm_mmu_audit(vcpu, "post page fault (guest)"); | ||
| 417 | return 0; | ||
| 418 | } | 435 | } |
| 419 | 436 | ||
| 420 | ++kvm_stat.pf_fixed; | 437 | ++kvm_stat.pf_fixed; |
| @@ -429,7 +446,7 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) | |||
| 429 | pt_element_t guest_pte; | 446 | pt_element_t guest_pte; |
| 430 | gpa_t gpa; | 447 | gpa_t gpa; |
| 431 | 448 | ||
| 432 | FNAME(walk_addr)(&walker, vcpu, vaddr); | 449 | FNAME(walk_addr)(&walker, vcpu, vaddr, 0, 0, 0); |
| 433 | guest_pte = *walker.ptep; | 450 | guest_pte = *walker.ptep; |
| 434 | FNAME(release_walker)(&walker); | 451 | FNAME(release_walker)(&walker); |
| 435 | 452 | ||
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 714f6a7841cd..9c70ff65e6b7 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
| @@ -502,6 +502,7 @@ static void init_vmcb(struct vmcb *vmcb) | |||
| 502 | (1ULL << INTERCEPT_IOIO_PROT) | | 502 | (1ULL << INTERCEPT_IOIO_PROT) | |
| 503 | (1ULL << INTERCEPT_MSR_PROT) | | 503 | (1ULL << INTERCEPT_MSR_PROT) | |
| 504 | (1ULL << INTERCEPT_TASK_SWITCH) | | 504 | (1ULL << INTERCEPT_TASK_SWITCH) | |
| 505 | (1ULL << INTERCEPT_SHUTDOWN) | | ||
| 505 | (1ULL << INTERCEPT_VMRUN) | | 506 | (1ULL << INTERCEPT_VMRUN) | |
| 506 | (1ULL << INTERCEPT_VMMCALL) | | 507 | (1ULL << INTERCEPT_VMMCALL) | |
| 507 | (1ULL << INTERCEPT_VMLOAD) | | 508 | (1ULL << INTERCEPT_VMLOAD) | |
| @@ -680,14 +681,14 @@ static void svm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l) | |||
| 680 | 681 | ||
| 681 | static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) | 682 | static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) |
| 682 | { | 683 | { |
| 683 | dt->limit = vcpu->svm->vmcb->save.ldtr.limit; | 684 | dt->limit = vcpu->svm->vmcb->save.idtr.limit; |
| 684 | dt->base = vcpu->svm->vmcb->save.ldtr.base; | 685 | dt->base = vcpu->svm->vmcb->save.idtr.base; |
| 685 | } | 686 | } |
| 686 | 687 | ||
| 687 | static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) | 688 | static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) |
| 688 | { | 689 | { |
| 689 | vcpu->svm->vmcb->save.ldtr.limit = dt->limit; | 690 | vcpu->svm->vmcb->save.idtr.limit = dt->limit; |
| 690 | vcpu->svm->vmcb->save.ldtr.base = dt->base ; | 691 | vcpu->svm->vmcb->save.idtr.base = dt->base ; |
| 691 | } | 692 | } |
| 692 | 693 | ||
| 693 | static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) | 694 | static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) |
| @@ -892,6 +893,19 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
| 892 | return 0; | 893 | return 0; |
| 893 | } | 894 | } |
| 894 | 895 | ||
| 896 | static int shutdown_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
| 897 | { | ||
| 898 | /* | ||
| 899 | * VMCB is undefined after a SHUTDOWN intercept | ||
| 900 | * so reinitialize it. | ||
| 901 | */ | ||
| 902 | memset(vcpu->svm->vmcb, 0, PAGE_SIZE); | ||
| 903 | init_vmcb(vcpu->svm->vmcb); | ||
| 904 | |||
| 905 | kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; | ||
| 906 | return 0; | ||
| 907 | } | ||
| 908 | |||
| 895 | static int io_get_override(struct kvm_vcpu *vcpu, | 909 | static int io_get_override(struct kvm_vcpu *vcpu, |
| 896 | struct vmcb_seg **seg, | 910 | struct vmcb_seg **seg, |
| 897 | int *addr_override) | 911 | int *addr_override) |
| @@ -1249,6 +1263,7 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
| 1249 | [SVM_EXIT_IOIO] = io_interception, | 1263 | [SVM_EXIT_IOIO] = io_interception, |
| 1250 | [SVM_EXIT_MSR] = msr_interception, | 1264 | [SVM_EXIT_MSR] = msr_interception, |
| 1251 | [SVM_EXIT_TASK_SWITCH] = task_switch_interception, | 1265 | [SVM_EXIT_TASK_SWITCH] = task_switch_interception, |
| 1266 | [SVM_EXIT_SHUTDOWN] = shutdown_interception, | ||
| 1252 | [SVM_EXIT_VMRUN] = invalid_op_interception, | 1267 | [SVM_EXIT_VMRUN] = invalid_op_interception, |
| 1253 | [SVM_EXIT_VMMCALL] = invalid_op_interception, | 1268 | [SVM_EXIT_VMMCALL] = invalid_op_interception, |
| 1254 | [SVM_EXIT_VMLOAD] = invalid_op_interception, | 1269 | [SVM_EXIT_VMLOAD] = invalid_op_interception, |
| @@ -1407,7 +1422,8 @@ static int svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
| 1407 | int r; | 1422 | int r; |
| 1408 | 1423 | ||
| 1409 | again: | 1424 | again: |
| 1410 | do_interrupt_requests(vcpu, kvm_run); | 1425 | if (!vcpu->mmio_read_completed) |
| 1426 | do_interrupt_requests(vcpu, kvm_run); | ||
| 1411 | 1427 | ||
| 1412 | clgi(); | 1428 | clgi(); |
| 1413 | 1429 | ||
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 0aa2659f6ae5..27f2751c3baa 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
| @@ -1717,7 +1717,8 @@ again: | |||
| 1717 | vmcs_writel(HOST_GS_BASE, segment_base(gs_sel)); | 1717 | vmcs_writel(HOST_GS_BASE, segment_base(gs_sel)); |
| 1718 | #endif | 1718 | #endif |
| 1719 | 1719 | ||
| 1720 | do_interrupt_requests(vcpu, kvm_run); | 1720 | if (!vcpu->mmio_read_completed) |
| 1721 | do_interrupt_requests(vcpu, kvm_run); | ||
| 1721 | 1722 | ||
| 1722 | if (vcpu->guest_debug.enabled) | 1723 | if (vcpu->guest_debug.enabled) |
| 1723 | kvm_guest_debug_pre(vcpu); | 1724 | kvm_guest_debug_pre(vcpu); |
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index be70795b4822..7513cddb929f 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
| @@ -61,6 +61,7 @@ | |||
| 61 | #define ModRM (1<<6) | 61 | #define ModRM (1<<6) |
| 62 | /* Destination is only written; never read. */ | 62 | /* Destination is only written; never read. */ |
| 63 | #define Mov (1<<7) | 63 | #define Mov (1<<7) |
| 64 | #define BitOp (1<<8) | ||
| 64 | 65 | ||
| 65 | static u8 opcode_table[256] = { | 66 | static u8 opcode_table[256] = { |
| 66 | /* 0x00 - 0x07 */ | 67 | /* 0x00 - 0x07 */ |
| @@ -148,7 +149,7 @@ static u8 opcode_table[256] = { | |||
| 148 | 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM | 149 | 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM |
| 149 | }; | 150 | }; |
| 150 | 151 | ||
| 151 | static u8 twobyte_table[256] = { | 152 | static u16 twobyte_table[256] = { |
| 152 | /* 0x00 - 0x0F */ | 153 | /* 0x00 - 0x0F */ |
| 153 | 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, | 154 | 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, |
| 154 | 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, | 155 | 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, |
| @@ -180,16 +181,16 @@ static u8 twobyte_table[256] = { | |||
| 180 | /* 0x90 - 0x9F */ | 181 | /* 0x90 - 0x9F */ |
| 181 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 182 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 182 | /* 0xA0 - 0xA7 */ | 183 | /* 0xA0 - 0xA7 */ |
| 183 | 0, 0, 0, DstMem | SrcReg | ModRM, 0, 0, 0, 0, | 184 | 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0, |
| 184 | /* 0xA8 - 0xAF */ | 185 | /* 0xA8 - 0xAF */ |
| 185 | 0, 0, 0, DstMem | SrcReg | ModRM, 0, 0, 0, 0, | 186 | 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0, |
| 186 | /* 0xB0 - 0xB7 */ | 187 | /* 0xB0 - 0xB7 */ |
| 187 | ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0, | 188 | ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0, |
| 188 | DstMem | SrcReg | ModRM, | 189 | DstMem | SrcReg | ModRM | BitOp, |
| 189 | 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, | 190 | 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, |
| 190 | DstReg | SrcMem16 | ModRM | Mov, | 191 | DstReg | SrcMem16 | ModRM | Mov, |
| 191 | /* 0xB8 - 0xBF */ | 192 | /* 0xB8 - 0xBF */ |
| 192 | 0, 0, DstMem | SrcImmByte | ModRM, DstMem | SrcReg | ModRM, | 193 | 0, 0, DstMem | SrcImmByte | ModRM, DstMem | SrcReg | ModRM | BitOp, |
| 193 | 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, | 194 | 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, |
| 194 | DstReg | SrcMem16 | ModRM | Mov, | 195 | DstReg | SrcMem16 | ModRM | Mov, |
| 195 | /* 0xC0 - 0xCF */ | 196 | /* 0xC0 - 0xCF */ |
| @@ -469,7 +470,8 @@ static int read_descriptor(struct x86_emulate_ctxt *ctxt, | |||
| 469 | int | 470 | int |
| 470 | x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) | 471 | x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) |
| 471 | { | 472 | { |
| 472 | u8 b, d, sib, twobyte = 0, rex_prefix = 0; | 473 | unsigned d; |
| 474 | u8 b, sib, twobyte = 0, rex_prefix = 0; | ||
| 473 | u8 modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0; | 475 | u8 modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0; |
| 474 | unsigned long *override_base = NULL; | 476 | unsigned long *override_base = NULL; |
| 475 | unsigned int op_bytes, ad_bytes, lock_prefix = 0, rep_prefix = 0, i; | 477 | unsigned int op_bytes, ad_bytes, lock_prefix = 0, rep_prefix = 0, i; |
| @@ -726,46 +728,6 @@ done_prefixes: | |||
| 726 | ; | 728 | ; |
| 727 | } | 729 | } |
| 728 | 730 | ||
| 729 | /* Decode and fetch the destination operand: register or memory. */ | ||
| 730 | switch (d & DstMask) { | ||
| 731 | case ImplicitOps: | ||
| 732 | /* Special instructions do their own operand decoding. */ | ||
| 733 | goto special_insn; | ||
| 734 | case DstReg: | ||
| 735 | dst.type = OP_REG; | ||
| 736 | if ((d & ByteOp) | ||
| 737 | && !(twobyte_table && (b == 0xb6 || b == 0xb7))) { | ||
| 738 | dst.ptr = decode_register(modrm_reg, _regs, | ||
| 739 | (rex_prefix == 0)); | ||
| 740 | dst.val = *(u8 *) dst.ptr; | ||
| 741 | dst.bytes = 1; | ||
| 742 | } else { | ||
| 743 | dst.ptr = decode_register(modrm_reg, _regs, 0); | ||
| 744 | switch ((dst.bytes = op_bytes)) { | ||
| 745 | case 2: | ||
| 746 | dst.val = *(u16 *)dst.ptr; | ||
| 747 | break; | ||
| 748 | case 4: | ||
| 749 | dst.val = *(u32 *)dst.ptr; | ||
| 750 | break; | ||
| 751 | case 8: | ||
| 752 | dst.val = *(u64 *)dst.ptr; | ||
| 753 | break; | ||
| 754 | } | ||
| 755 | } | ||
| 756 | break; | ||
| 757 | case DstMem: | ||
| 758 | dst.type = OP_MEM; | ||
| 759 | dst.ptr = (unsigned long *)cr2; | ||
| 760 | dst.bytes = (d & ByteOp) ? 1 : op_bytes; | ||
| 761 | if (!(d & Mov) && /* optimisation - avoid slow emulated read */ | ||
| 762 | ((rc = ops->read_emulated((unsigned long)dst.ptr, | ||
| 763 | &dst.val, dst.bytes, ctxt)) != 0)) | ||
| 764 | goto done; | ||
| 765 | break; | ||
| 766 | } | ||
| 767 | dst.orig_val = dst.val; | ||
| 768 | |||
| 769 | /* | 731 | /* |
| 770 | * Decode and fetch the source operand: register, memory | 732 | * Decode and fetch the source operand: register, memory |
| 771 | * or immediate. | 733 | * or immediate. |
| @@ -838,6 +800,50 @@ done_prefixes: | |||
| 838 | break; | 800 | break; |
| 839 | } | 801 | } |
| 840 | 802 | ||
| 803 | /* Decode and fetch the destination operand: register or memory. */ | ||
| 804 | switch (d & DstMask) { | ||
| 805 | case ImplicitOps: | ||
| 806 | /* Special instructions do their own operand decoding. */ | ||
| 807 | goto special_insn; | ||
| 808 | case DstReg: | ||
| 809 | dst.type = OP_REG; | ||
| 810 | if ((d & ByteOp) | ||
| 811 | && !(twobyte_table && (b == 0xb6 || b == 0xb7))) { | ||
| 812 | dst.ptr = decode_register(modrm_reg, _regs, | ||
| 813 | (rex_prefix == 0)); | ||
| 814 | dst.val = *(u8 *) dst.ptr; | ||
| 815 | dst.bytes = 1; | ||
| 816 | } else { | ||
| 817 | dst.ptr = decode_register(modrm_reg, _regs, 0); | ||
| 818 | switch ((dst.bytes = op_bytes)) { | ||
| 819 | case 2: | ||
| 820 | dst.val = *(u16 *)dst.ptr; | ||
| 821 | break; | ||
| 822 | case 4: | ||
| 823 | dst.val = *(u32 *)dst.ptr; | ||
| 824 | break; | ||
| 825 | case 8: | ||
| 826 | dst.val = *(u64 *)dst.ptr; | ||
| 827 | break; | ||
| 828 | } | ||
| 829 | } | ||
| 830 | break; | ||
| 831 | case DstMem: | ||
| 832 | dst.type = OP_MEM; | ||
| 833 | dst.ptr = (unsigned long *)cr2; | ||
| 834 | dst.bytes = (d & ByteOp) ? 1 : op_bytes; | ||
| 835 | if (d & BitOp) { | ||
| 836 | dst.ptr += src.val / BITS_PER_LONG; | ||
| 837 | dst.bytes = sizeof(long); | ||
| 838 | } | ||
| 839 | if (!(d & Mov) && /* optimisation - avoid slow emulated read */ | ||
| 840 | ((rc = ops->read_emulated((unsigned long)dst.ptr, | ||
| 841 | &dst.val, dst.bytes, ctxt)) != 0)) | ||
| 842 | goto done; | ||
| 843 | break; | ||
| 844 | } | ||
| 845 | dst.orig_val = dst.val; | ||
| 846 | |||
| 841 | if (twobyte) | 847 | if (twobyte) |
| 842 | goto twobyte_insn; | 848 | goto twobyte_insn; |
| 843 | 849 | ||
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 5432d07c074d..11108165e264 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
| @@ -479,9 +479,12 @@ static int bitmap_read_sb(struct bitmap *bitmap) | |||
| 479 | int err = -EINVAL; | 479 | int err = -EINVAL; |
| 480 | 480 | ||
| 481 | /* page 0 is the superblock, read it... */ | 481 | /* page 0 is the superblock, read it... */ |
| 482 | if (bitmap->file) | 482 | if (bitmap->file) { |
| 483 | bitmap->sb_page = read_page(bitmap->file, 0, bitmap, PAGE_SIZE); | 483 | loff_t isize = i_size_read(bitmap->file->f_mapping->host); |
| 484 | else { | 484 | int bytes = isize > PAGE_SIZE ? PAGE_SIZE : isize; |
| 485 | |||
| 486 | bitmap->sb_page = read_page(bitmap->file, 0, bitmap, bytes); | ||
| 487 | } else { | ||
| 485 | bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0); | 488 | bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0); |
| 486 | } | 489 | } |
| 487 | if (IS_ERR(bitmap->sb_page)) { | 490 | if (IS_ERR(bitmap->sb_page)) { |
| @@ -877,7 +880,8 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
| 877 | int count; | 880 | int count; |
| 878 | /* unmap the old page, we're done with it */ | 881 | /* unmap the old page, we're done with it */ |
| 879 | if (index == num_pages-1) | 882 | if (index == num_pages-1) |
| 880 | count = bytes - index * PAGE_SIZE; | 883 | count = bytes + sizeof(bitmap_super_t) |
| 884 | - index * PAGE_SIZE; | ||
| 881 | else | 885 | else |
| 882 | count = PAGE_SIZE; | 886 | count = PAGE_SIZE; |
| 883 | if (index == 0) { | 887 | if (index == 0) { |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index fe7c56e10435..3668b170ea68 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -1116,7 +1116,8 @@ static int __bind(struct mapped_device *md, struct dm_table *t) | |||
| 1116 | if (size != get_capacity(md->disk)) | 1116 | if (size != get_capacity(md->disk)) |
| 1117 | memset(&md->geometry, 0, sizeof(md->geometry)); | 1117 | memset(&md->geometry, 0, sizeof(md->geometry)); |
| 1118 | 1118 | ||
| 1119 | __set_size(md, size); | 1119 | if (md->suspended_bdev) |
| 1120 | __set_size(md, size); | ||
| 1120 | if (size == 0) | 1121 | if (size == 0) |
| 1121 | return 0; | 1122 | return 0; |
| 1122 | 1123 | ||
| @@ -1264,6 +1265,11 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table) | |||
| 1264 | if (!dm_suspended(md)) | 1265 | if (!dm_suspended(md)) |
| 1265 | goto out; | 1266 | goto out; |
| 1266 | 1267 | ||
| 1268 | /* without bdev, the device size cannot be changed */ | ||
| 1269 | if (!md->suspended_bdev) | ||
| 1270 | if (get_capacity(md->disk) != dm_table_get_size(table)) | ||
| 1271 | goto out; | ||
| 1272 | |||
| 1267 | __unbind(md); | 1273 | __unbind(md); |
| 1268 | r = __bind(md, table); | 1274 | r = __bind(md, table); |
| 1269 | 1275 | ||
| @@ -1341,11 +1347,14 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags) | |||
| 1341 | /* This does not get reverted if there's an error later. */ | 1347 | /* This does not get reverted if there's an error later. */ |
| 1342 | dm_table_presuspend_targets(map); | 1348 | dm_table_presuspend_targets(map); |
| 1343 | 1349 | ||
| 1344 | md->suspended_bdev = bdget_disk(md->disk, 0); | 1350 | /* bdget() can stall if the pending I/Os are not flushed */ |
| 1345 | if (!md->suspended_bdev) { | 1351 | if (!noflush) { |
| 1346 | DMWARN("bdget failed in dm_suspend"); | 1352 | md->suspended_bdev = bdget_disk(md->disk, 0); |
| 1347 | r = -ENOMEM; | 1353 | if (!md->suspended_bdev) { |
| 1348 | goto flush_and_out; | 1354 | DMWARN("bdget failed in dm_suspend"); |
| 1355 | r = -ENOMEM; | ||
| 1356 | goto flush_and_out; | ||
| 1357 | } | ||
| 1349 | } | 1358 | } |
| 1350 | 1359 | ||
| 1351 | /* | 1360 | /* |
| @@ -1473,8 +1482,10 @@ int dm_resume(struct mapped_device *md) | |||
| 1473 | 1482 | ||
| 1474 | unlock_fs(md); | 1483 | unlock_fs(md); |
| 1475 | 1484 | ||
| 1476 | bdput(md->suspended_bdev); | 1485 | if (md->suspended_bdev) { |
| 1477 | md->suspended_bdev = NULL; | 1486 | bdput(md->suspended_bdev); |
| 1487 | md->suspended_bdev = NULL; | ||
| 1488 | } | ||
| 1478 | 1489 | ||
| 1479 | clear_bit(DMF_SUSPENDED, &md->flags); | 1490 | clear_bit(DMF_SUSPENDED, &md->flags); |
| 1480 | 1491 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index d1cb45f6d6a9..e8807ea5377d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -1633,7 +1633,8 @@ repeat: | |||
| 1633 | * and 'events' is odd, we can roll back to the previous clean state */ | 1633 | * and 'events' is odd, we can roll back to the previous clean state */ |
| 1634 | if (nospares | 1634 | if (nospares |
| 1635 | && (mddev->in_sync && mddev->recovery_cp == MaxSector) | 1635 | && (mddev->in_sync && mddev->recovery_cp == MaxSector) |
| 1636 | && (mddev->events & 1)) | 1636 | && (mddev->events & 1) |
| 1637 | && mddev->events != 1) | ||
| 1637 | mddev->events--; | 1638 | mddev->events--; |
| 1638 | else { | 1639 | else { |
| 1639 | /* otherwise we have to go forward and ... */ | 1640 | /* otherwise we have to go forward and ... */ |
| @@ -3563,6 +3564,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg) | |||
| 3563 | char *ptr, *buf = NULL; | 3564 | char *ptr, *buf = NULL; |
| 3564 | int err = -ENOMEM; | 3565 | int err = -ENOMEM; |
| 3565 | 3566 | ||
| 3567 | md_allow_write(mddev); | ||
| 3568 | |||
| 3566 | file = kmalloc(sizeof(*file), GFP_KERNEL); | 3569 | file = kmalloc(sizeof(*file), GFP_KERNEL); |
| 3567 | if (!file) | 3570 | if (!file) |
| 3568 | goto out; | 3571 | goto out; |
| @@ -5031,6 +5034,33 @@ void md_write_end(mddev_t *mddev) | |||
| 5031 | } | 5034 | } |
| 5032 | } | 5035 | } |
| 5033 | 5036 | ||
| 5037 | /* md_allow_write(mddev) | ||
| 5038 | * Calling this ensures that the array is marked 'active' so that writes | ||
| 5039 | * may proceed without blocking. It is important to call this before | ||
| 5040 | * attempting a GFP_KERNEL allocation while holding the mddev lock. | ||
| 5041 | * Must be called with mddev_lock held. | ||
| 5042 | */ | ||
| 5043 | void md_allow_write(mddev_t *mddev) | ||
| 5044 | { | ||
| 5045 | if (!mddev->pers) | ||
| 5046 | return; | ||
| 5047 | if (mddev->ro) | ||
| 5048 | return; | ||
| 5049 | |||
| 5050 | spin_lock_irq(&mddev->write_lock); | ||
| 5051 | if (mddev->in_sync) { | ||
| 5052 | mddev->in_sync = 0; | ||
| 5053 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); | ||
| 5054 | if (mddev->safemode_delay && | ||
| 5055 | mddev->safemode == 0) | ||
| 5056 | mddev->safemode = 1; | ||
| 5057 | spin_unlock_irq(&mddev->write_lock); | ||
| 5058 | md_update_sb(mddev, 0); | ||
| 5059 | } else | ||
| 5060 | spin_unlock_irq(&mddev->write_lock); | ||
| 5061 | } | ||
| 5062 | EXPORT_SYMBOL_GPL(md_allow_write); | ||
| 5063 | |||
| 5034 | static DECLARE_WAIT_QUEUE_HEAD(resync_wait); | 5064 | static DECLARE_WAIT_QUEUE_HEAD(resync_wait); |
| 5035 | 5065 | ||
| 5036 | #define SYNC_MARKS 10 | 5066 | #define SYNC_MARKS 10 |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 164b25dca101..97ee870b265d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -1266,6 +1266,11 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
| 1266 | sbio->bi_sector = r1_bio->sector + | 1266 | sbio->bi_sector = r1_bio->sector + |
| 1267 | conf->mirrors[i].rdev->data_offset; | 1267 | conf->mirrors[i].rdev->data_offset; |
| 1268 | sbio->bi_bdev = conf->mirrors[i].rdev->bdev; | 1268 | sbio->bi_bdev = conf->mirrors[i].rdev->bdev; |
| 1269 | for (j = 0; j < vcnt ; j++) | ||
| 1270 | memcpy(page_address(sbio->bi_io_vec[j].bv_page), | ||
| 1271 | page_address(pbio->bi_io_vec[j].bv_page), | ||
| 1272 | PAGE_SIZE); | ||
| 1273 | |||
| 1269 | } | 1274 | } |
| 1270 | } | 1275 | } |
| 1271 | } | 1276 | } |
| @@ -2099,6 +2104,8 @@ static int raid1_reshape(mddev_t *mddev) | |||
| 2099 | return -EINVAL; | 2104 | return -EINVAL; |
| 2100 | } | 2105 | } |
| 2101 | 2106 | ||
| 2107 | md_allow_write(mddev); | ||
| 2108 | |||
| 2102 | raid_disks = mddev->raid_disks + mddev->delta_disks; | 2109 | raid_disks = mddev->raid_disks + mddev->delta_disks; |
| 2103 | 2110 | ||
| 2104 | if (raid_disks < conf->raid_disks) { | 2111 | if (raid_disks < conf->raid_disks) { |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index be008f034ada..467c16982d02 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -405,6 +405,8 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) | |||
| 405 | if (newsize <= conf->pool_size) | 405 | if (newsize <= conf->pool_size) |
| 406 | return 0; /* never bother to shrink */ | 406 | return 0; /* never bother to shrink */ |
| 407 | 407 | ||
| 408 | md_allow_write(conf->mddev); | ||
| 409 | |||
| 408 | /* Step 1 */ | 410 | /* Step 1 */ |
| 409 | sc = kmem_cache_create(conf->cache_name[1-conf->active_name], | 411 | sc = kmem_cache_create(conf->cache_name[1-conf->active_name], |
| 410 | sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev), | 412 | sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev), |
| @@ -2678,7 +2680,7 @@ static int chunk_aligned_read(request_queue_t *q, struct bio * raid_bio) | |||
| 2678 | mdk_rdev_t *rdev; | 2680 | mdk_rdev_t *rdev; |
| 2679 | 2681 | ||
| 2680 | if (!in_chunk_boundary(mddev, raid_bio)) { | 2682 | if (!in_chunk_boundary(mddev, raid_bio)) { |
| 2681 | printk("chunk_aligned_read : non aligned\n"); | 2683 | PRINTK("chunk_aligned_read : non aligned\n"); |
| 2682 | return 0; | 2684 | return 0; |
| 2683 | } | 2685 | } |
| 2684 | /* | 2686 | /* |
| @@ -3250,6 +3252,7 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len) | |||
| 3250 | else | 3252 | else |
| 3251 | break; | 3253 | break; |
| 3252 | } | 3254 | } |
| 3255 | md_allow_write(mddev); | ||
| 3253 | while (new > conf->max_nr_stripes) { | 3256 | while (new > conf->max_nr_stripes) { |
| 3254 | if (grow_one_stripe(conf)) | 3257 | if (grow_one_stripe(conf)) |
| 3255 | conf->max_nr_stripes++; | 3258 | conf->max_nr_stripes++; |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 635d102c86f0..6504a5866849 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
| @@ -700,6 +700,7 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
| 700 | goto done; | 700 | goto done; |
| 701 | } | 701 | } |
| 702 | if (buf->state == STATE_QUEUED || | 702 | if (buf->state == STATE_QUEUED || |
| 703 | buf->state == STATE_PREPARED || | ||
| 703 | buf->state == STATE_ACTIVE) { | 704 | buf->state == STATE_ACTIVE) { |
| 704 | dprintk(1,"qbuf: buffer is already queued or active.\n"); | 705 | dprintk(1,"qbuf: buffer is already queued or active.\n"); |
| 705 | goto done; | 706 | goto done; |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index ca5acc4736df..953808efe551 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
| @@ -57,8 +57,8 @@ | |||
| 57 | 57 | ||
| 58 | #define DRV_MODULE_NAME "bnx2" | 58 | #define DRV_MODULE_NAME "bnx2" |
| 59 | #define PFX DRV_MODULE_NAME ": " | 59 | #define PFX DRV_MODULE_NAME ": " |
| 60 | #define DRV_MODULE_VERSION "1.5.3" | 60 | #define DRV_MODULE_VERSION "1.5.4" |
| 61 | #define DRV_MODULE_RELDATE "January 8, 2007" | 61 | #define DRV_MODULE_RELDATE "January 24, 2007" |
| 62 | 62 | ||
| 63 | #define RUN_AT(x) (jiffies + (x)) | 63 | #define RUN_AT(x) (jiffies + (x)) |
| 64 | 64 | ||
| @@ -5845,9 +5845,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
| 5845 | reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); | 5845 | reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); |
| 5846 | 5846 | ||
| 5847 | if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == | 5847 | if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == |
| 5848 | BNX2_SHM_HDR_SIGNATURE_SIG) | 5848 | BNX2_SHM_HDR_SIGNATURE_SIG) { |
| 5849 | bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0); | 5849 | u32 off = PCI_FUNC(pdev->devfn) << 2; |
| 5850 | else | 5850 | |
| 5851 | bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0 + off); | ||
| 5852 | } else | ||
| 5851 | bp->shmem_base = HOST_VIEW_SHMEM_BASE; | 5853 | bp->shmem_base = HOST_VIEW_SHMEM_BASE; |
| 5852 | 5854 | ||
| 5853 | /* Get the permanent MAC address. First we need to make sure the | 5855 | /* Get the permanent MAC address. First we need to make sure the |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 39ad9f73d1ec..be10a3a26b5b 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
| 40 | 40 | ||
| 41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
| 42 | #define DRV_VERSION "EHEA_0043" | 42 | #define DRV_VERSION "EHEA_0044" |
| 43 | 43 | ||
| 44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | 44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ |
| 45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) | 45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 83fa32f72398..1072e69ef85d 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
| @@ -558,12 +558,12 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param) | |||
| 558 | u32 qp_token; | 558 | u32 qp_token; |
| 559 | 559 | ||
| 560 | eqe = ehea_poll_eq(port->qp_eq); | 560 | eqe = ehea_poll_eq(port->qp_eq); |
| 561 | ehea_debug("eqe=%p", eqe); | 561 | |
| 562 | while (eqe) { | 562 | while (eqe) { |
| 563 | ehea_debug("*eqe=%lx", *(u64*)eqe); | ||
| 564 | eqe = ehea_poll_eq(port->qp_eq); | ||
| 565 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); | 563 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); |
| 566 | ehea_debug("next eqe=%p", eqe); | 564 | ehea_error("QP aff_err: entry=0x%lx, token=0x%x", |
| 565 | eqe->entry, qp_token); | ||
| 566 | eqe = ehea_poll_eq(port->qp_eq); | ||
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | return IRQ_HANDLED; | 569 | return IRQ_HANDLED; |
| @@ -575,8 +575,9 @@ static struct ehea_port *ehea_get_port(struct ehea_adapter *adapter, | |||
| 575 | int i; | 575 | int i; |
| 576 | 576 | ||
| 577 | for (i = 0; i < adapter->num_ports; i++) | 577 | for (i = 0; i < adapter->num_ports; i++) |
| 578 | if (adapter->port[i]->logical_port_id == logical_port) | 578 | if (adapter->port[i]) |
| 579 | return adapter->port[i]; | 579 | if (adapter->port[i]->logical_port_id == logical_port) |
| 580 | return adapter->port[i]; | ||
| 580 | return NULL; | 581 | return NULL; |
| 581 | } | 582 | } |
| 582 | 583 | ||
| @@ -642,6 +643,8 @@ int ehea_sense_port_attr(struct ehea_port *port) | |||
| 642 | break; | 643 | break; |
| 643 | } | 644 | } |
| 644 | 645 | ||
| 646 | port->autoneg = 1; | ||
| 647 | |||
| 645 | /* Number of default QPs */ | 648 | /* Number of default QPs */ |
| 646 | port->num_def_qps = cb0->num_default_qps; | 649 | port->num_def_qps = cb0->num_default_qps; |
| 647 | 650 | ||
| @@ -728,10 +731,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed) | |||
| 728 | } | 731 | } |
| 729 | } else { | 732 | } else { |
| 730 | if (hret == H_AUTHORITY) { | 733 | if (hret == H_AUTHORITY) { |
| 731 | ehea_info("Hypervisor denied setting port speed. Either" | 734 | ehea_info("Hypervisor denied setting port speed"); |
| 732 | " this partition is not authorized to set " | ||
| 733 | "port speed or another partition has modified" | ||
| 734 | " port speed first."); | ||
| 735 | ret = -EPERM; | 735 | ret = -EPERM; |
| 736 | } else { | 736 | } else { |
| 737 | ret = -EIO; | 737 | ret = -EIO; |
| @@ -998,7 +998,7 @@ static int ehea_configure_port(struct ehea_port *port) | |||
| 998 | | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1); | 998 | | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1); |
| 999 | 999 | ||
| 1000 | for (i = 0; i < port->num_def_qps; i++) | 1000 | for (i = 0; i < port->num_def_qps; i++) |
| 1001 | cb0->default_qpn_arr[i] = port->port_res[i].qp->init_attr.qp_nr; | 1001 | cb0->default_qpn_arr[i] = port->port_res[0].qp->init_attr.qp_nr; |
| 1002 | 1002 | ||
| 1003 | if (netif_msg_ifup(port)) | 1003 | if (netif_msg_ifup(port)) |
| 1004 | ehea_dump(cb0, sizeof(*cb0), "ehea_configure_port"); | 1004 | ehea_dump(cb0, sizeof(*cb0), "ehea_configure_port"); |
| @@ -1485,11 +1485,12 @@ out: | |||
| 1485 | 1485 | ||
| 1486 | static void ehea_promiscuous_error(u64 hret, int enable) | 1486 | static void ehea_promiscuous_error(u64 hret, int enable) |
| 1487 | { | 1487 | { |
| 1488 | ehea_info("Hypervisor denied %sabling promiscuous mode.%s", | 1488 | if (hret == H_AUTHORITY) |
| 1489 | enable == 1 ? "en" : "dis", | 1489 | ehea_info("Hypervisor denied %sabling promiscuous mode", |
| 1490 | hret != H_AUTHORITY ? "" : " Another partition owning a " | 1490 | enable == 1 ? "en" : "dis"); |
| 1491 | "logical port on the same physical port might have altered " | 1491 | else |
| 1492 | "promiscuous mode first."); | 1492 | ehea_error("failed %sabling promiscuous mode", |
| 1493 | enable == 1 ? "en" : "dis"); | ||
| 1493 | } | 1494 | } |
| 1494 | 1495 | ||
| 1495 | static void ehea_promiscuous(struct net_device *dev, int enable) | 1496 | static void ehea_promiscuous(struct net_device *dev, int enable) |
| @@ -2267,6 +2268,8 @@ static void ehea_tx_watchdog(struct net_device *dev) | |||
| 2267 | int ehea_sense_adapter_attr(struct ehea_adapter *adapter) | 2268 | int ehea_sense_adapter_attr(struct ehea_adapter *adapter) |
| 2268 | { | 2269 | { |
| 2269 | struct hcp_query_ehea *cb; | 2270 | struct hcp_query_ehea *cb; |
| 2271 | struct device_node *lhea_dn = NULL; | ||
| 2272 | struct device_node *eth_dn = NULL; | ||
| 2270 | u64 hret; | 2273 | u64 hret; |
| 2271 | int ret; | 2274 | int ret; |
| 2272 | 2275 | ||
| @@ -2283,7 +2286,18 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter) | |||
| 2283 | goto out_herr; | 2286 | goto out_herr; |
| 2284 | } | 2287 | } |
| 2285 | 2288 | ||
| 2286 | adapter->num_ports = cb->num_ports; | 2289 | /* Determine the number of available logical ports |
| 2290 | * by counting the child nodes of the lhea OFDT entry | ||
| 2291 | */ | ||
| 2292 | adapter->num_ports = 0; | ||
| 2293 | lhea_dn = of_find_node_by_name(lhea_dn, "lhea"); | ||
| 2294 | do { | ||
| 2295 | eth_dn = of_get_next_child(lhea_dn, eth_dn); | ||
| 2296 | if (eth_dn) | ||
| 2297 | adapter->num_ports++; | ||
| 2298 | } while ( eth_dn ); | ||
| 2299 | of_node_put(lhea_dn); | ||
| 2300 | |||
| 2287 | adapter->max_mc_mac = cb->max_mc_mac - 1; | 2301 | adapter->max_mc_mac = cb->max_mc_mac - 1; |
| 2288 | ret = 0; | 2302 | ret = 0; |
| 2289 | 2303 | ||
| @@ -2334,8 +2348,6 @@ static int ehea_setup_single_port(struct ehea_port *port, | |||
| 2334 | 2348 | ||
| 2335 | INIT_LIST_HEAD(&port->mc_list->list); | 2349 | INIT_LIST_HEAD(&port->mc_list->list); |
| 2336 | 2350 | ||
| 2337 | ehea_set_portspeed(port, EHEA_SPEED_AUTONEG); | ||
| 2338 | |||
| 2339 | ret = ehea_sense_port_attr(port); | 2351 | ret = ehea_sense_port_attr(port); |
| 2340 | if (ret) | 2352 | if (ret) |
| 2341 | goto out; | 2353 | goto out; |
| @@ -2471,14 +2483,16 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev, | |||
| 2471 | 2483 | ||
| 2472 | adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", | 2484 | adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", |
| 2473 | NULL); | 2485 | NULL); |
| 2474 | if (!adapter_handle) { | 2486 | if (adapter_handle) |
| 2487 | adapter->handle = *adapter_handle; | ||
| 2488 | |||
| 2489 | if (!adapter->handle) { | ||
| 2475 | dev_err(&dev->ofdev.dev, "failed getting handle for adapter" | 2490 | dev_err(&dev->ofdev.dev, "failed getting handle for adapter" |
| 2476 | " '%s'\n", dev->ofdev.node->full_name); | 2491 | " '%s'\n", dev->ofdev.node->full_name); |
| 2477 | ret = -ENODEV; | 2492 | ret = -ENODEV; |
| 2478 | goto out_free_ad; | 2493 | goto out_free_ad; |
| 2479 | } | 2494 | } |
| 2480 | 2495 | ||
| 2481 | adapter->handle = *adapter_handle; | ||
| 2482 | adapter->pd = EHEA_PD_ID; | 2496 | adapter->pd = EHEA_PD_ID; |
| 2483 | 2497 | ||
| 2484 | dev->ofdev.dev.driver_data = adapter; | 2498 | dev->ofdev.dev.driver_data = adapter; |
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c index 0cfc2bc1a27b..37716e05e808 100644 --- a/drivers/net/ehea/ehea_phyp.c +++ b/drivers/net/ehea/ehea_phyp.c | |||
| @@ -94,6 +94,7 @@ static long ehea_plpar_hcall9(unsigned long opcode, | |||
| 94 | { | 94 | { |
| 95 | long ret; | 95 | long ret; |
| 96 | int i, sleep_msecs; | 96 | int i, sleep_msecs; |
| 97 | u8 cb_cat; | ||
| 97 | 98 | ||
| 98 | for (i = 0; i < 5; i++) { | 99 | for (i = 0; i < 5; i++) { |
| 99 | ret = plpar_hcall9(opcode, outs, | 100 | ret = plpar_hcall9(opcode, outs, |
| @@ -106,7 +107,13 @@ static long ehea_plpar_hcall9(unsigned long opcode, | |||
| 106 | continue; | 107 | continue; |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 109 | if (ret < H_SUCCESS) | 110 | cb_cat = EHEA_BMASK_GET(H_MEHEAPORT_CAT, arg2); |
| 111 | |||
| 112 | if ((ret < H_SUCCESS) && !(((ret == H_AUTHORITY) | ||
| 113 | && (opcode == H_MODIFY_HEA_PORT)) | ||
| 114 | && (((cb_cat == H_PORT_CB4) && ((arg3 == H_PORT_CB4_JUMBO) | ||
| 115 | || (arg3 == H_PORT_CB4_SPEED))) || ((cb_cat == H_PORT_CB7) | ||
| 116 | && (arg3 == H_PORT_CB7_DUCQPN))))) | ||
| 110 | ehea_error("opcode=%lx ret=%lx" | 117 | ehea_error("opcode=%lx ret=%lx" |
| 111 | " arg1=%lx arg2=%lx arg3=%lx arg4=%lx" | 118 | " arg1=%lx arg2=%lx arg3=%lx arg4=%lx" |
| 112 | " arg5=%lx arg6=%lx arg7=%lx arg8=%lx" | 119 | " arg5=%lx arg6=%lx arg7=%lx arg8=%lx" |
| @@ -120,7 +127,6 @@ static long ehea_plpar_hcall9(unsigned long opcode, | |||
| 120 | outs[0], outs[1], outs[2], outs[3], | 127 | outs[0], outs[1], outs[2], outs[3], |
| 121 | outs[4], outs[5], outs[6], outs[7], | 128 | outs[4], outs[5], outs[6], outs[7], |
| 122 | outs[8]); | 129 | outs[8]); |
| 123 | |||
| 124 | return ret; | 130 | return ret; |
| 125 | } | 131 | } |
| 126 | 132 | ||
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 3ca1082ec776..340ee99652eb 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
| @@ -441,25 +441,13 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 441 | goto drop; | 441 | goto drop; |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | /* Make sure there is room for IrDA-USB header. The actual | 444 | memcpy(self->tx_buff + self->header_length, skb->data, skb->len); |
| 445 | * allocation will be done lower in skb_push(). | ||
| 446 | * Also, we don't use directly skb_cow(), because it require | ||
| 447 | * headroom >= 16, which force unnecessary copies - Jean II */ | ||
| 448 | if (skb_headroom(skb) < self->header_length) { | ||
| 449 | IRDA_DEBUG(0, "%s(), Insuficient skb headroom.\n", __FUNCTION__); | ||
| 450 | if (skb_cow(skb, self->header_length)) { | ||
| 451 | IRDA_WARNING("%s(), failed skb_cow() !!!\n", __FUNCTION__); | ||
| 452 | goto drop; | ||
| 453 | } | ||
| 454 | } | ||
| 455 | 445 | ||
| 456 | /* Change setting for next frame */ | 446 | /* Change setting for next frame */ |
| 457 | |||
| 458 | if (self->capability & IUC_STIR421X) { | 447 | if (self->capability & IUC_STIR421X) { |
| 459 | __u8 turnaround_time; | 448 | __u8 turnaround_time; |
| 460 | __u8* frame; | 449 | __u8* frame = self->tx_buff; |
| 461 | turnaround_time = get_turnaround_time( skb ); | 450 | turnaround_time = get_turnaround_time( skb ); |
| 462 | frame= skb_push(skb, self->header_length); | ||
| 463 | irda_usb_build_header(self, frame, 0); | 451 | irda_usb_build_header(self, frame, 0); |
| 464 | frame[2] = turnaround_time; | 452 | frame[2] = turnaround_time; |
| 465 | if ((skb->len != 0) && | 453 | if ((skb->len != 0) && |
| @@ -472,17 +460,17 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 472 | frame[1] = 0; | 460 | frame[1] = 0; |
| 473 | } | 461 | } |
| 474 | } else { | 462 | } else { |
| 475 | irda_usb_build_header(self, skb_push(skb, self->header_length), 0); | 463 | irda_usb_build_header(self, self->tx_buff, 0); |
| 476 | } | 464 | } |
| 477 | 465 | ||
| 478 | /* FIXME: Make macro out of this one */ | 466 | /* FIXME: Make macro out of this one */ |
| 479 | ((struct irda_skb_cb *)skb->cb)->context = self; | 467 | ((struct irda_skb_cb *)skb->cb)->context = self; |
| 480 | 468 | ||
| 481 | usb_fill_bulk_urb(urb, self->usbdev, | 469 | usb_fill_bulk_urb(urb, self->usbdev, |
| 482 | usb_sndbulkpipe(self->usbdev, self->bulk_out_ep), | 470 | usb_sndbulkpipe(self->usbdev, self->bulk_out_ep), |
| 483 | skb->data, IRDA_SKB_MAX_MTU, | 471 | self->tx_buff, skb->len + self->header_length, |
| 484 | write_bulk_callback, skb); | 472 | write_bulk_callback, skb); |
| 485 | urb->transfer_buffer_length = skb->len; | 473 | |
| 486 | /* This flag (URB_ZERO_PACKET) indicates that what we send is not | 474 | /* This flag (URB_ZERO_PACKET) indicates that what we send is not |
| 487 | * a continuous stream of data but separate packets. | 475 | * a continuous stream of data but separate packets. |
| 488 | * In this case, the USB layer will insert an empty USB frame (TD) | 476 | * In this case, the USB layer will insert an empty USB frame (TD) |
| @@ -1455,6 +1443,9 @@ static inline void irda_usb_close(struct irda_usb_cb *self) | |||
| 1455 | /* Remove the speed buffer */ | 1443 | /* Remove the speed buffer */ |
| 1456 | kfree(self->speed_buff); | 1444 | kfree(self->speed_buff); |
| 1457 | self->speed_buff = NULL; | 1445 | self->speed_buff = NULL; |
| 1446 | |||
| 1447 | kfree(self->tx_buff); | ||
| 1448 | self->tx_buff = NULL; | ||
| 1458 | } | 1449 | } |
| 1459 | 1450 | ||
| 1460 | /********************** USB CONFIG SUBROUTINES **********************/ | 1451 | /********************** USB CONFIG SUBROUTINES **********************/ |
| @@ -1524,8 +1515,6 @@ static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_ | |||
| 1524 | 1515 | ||
| 1525 | IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n", | 1516 | IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n", |
| 1526 | __FUNCTION__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep); | 1517 | __FUNCTION__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep); |
| 1527 | /* Should be 8, 16, 32 or 64 bytes */ | ||
| 1528 | IRDA_ASSERT(self->bulk_out_mtu == 64, ;); | ||
| 1529 | 1518 | ||
| 1530 | return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0)); | 1519 | return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0)); |
| 1531 | } | 1520 | } |
| @@ -1753,9 +1742,14 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
| 1753 | 1742 | ||
| 1754 | memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU); | 1743 | memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU); |
| 1755 | 1744 | ||
| 1745 | self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, | ||
| 1746 | GFP_KERNEL); | ||
| 1747 | if (self->tx_buff == NULL) | ||
| 1748 | goto err_out_4; | ||
| 1749 | |||
| 1756 | ret = irda_usb_open(self); | 1750 | ret = irda_usb_open(self); |
| 1757 | if (ret) | 1751 | if (ret) |
| 1758 | goto err_out_4; | 1752 | goto err_out_5; |
| 1759 | 1753 | ||
| 1760 | IRDA_MESSAGE("IrDA: Registered device %s\n", net->name); | 1754 | IRDA_MESSAGE("IrDA: Registered device %s\n", net->name); |
| 1761 | usb_set_intfdata(intf, self); | 1755 | usb_set_intfdata(intf, self); |
| @@ -1766,14 +1760,14 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
| 1766 | self->needspatch = (ret < 0); | 1760 | self->needspatch = (ret < 0); |
| 1767 | if (self->needspatch) { | 1761 | if (self->needspatch) { |
| 1768 | IRDA_ERROR("STIR421X: Couldn't upload patch\n"); | 1762 | IRDA_ERROR("STIR421X: Couldn't upload patch\n"); |
| 1769 | goto err_out_5; | 1763 | goto err_out_6; |
| 1770 | } | 1764 | } |
| 1771 | 1765 | ||
| 1772 | /* replace IrDA class descriptor with what patched device is now reporting */ | 1766 | /* replace IrDA class descriptor with what patched device is now reporting */ |
| 1773 | irda_desc = irda_usb_find_class_desc (self->usbintf); | 1767 | irda_desc = irda_usb_find_class_desc (self->usbintf); |
| 1774 | if (irda_desc == NULL) { | 1768 | if (irda_desc == NULL) { |
| 1775 | ret = -ENODEV; | 1769 | ret = -ENODEV; |
| 1776 | goto err_out_5; | 1770 | goto err_out_6; |
| 1777 | } | 1771 | } |
| 1778 | if (self->irda_desc) | 1772 | if (self->irda_desc) |
| 1779 | kfree (self->irda_desc); | 1773 | kfree (self->irda_desc); |
| @@ -1782,9 +1776,10 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
| 1782 | } | 1776 | } |
| 1783 | 1777 | ||
| 1784 | return 0; | 1778 | return 0; |
| 1785 | 1779 | err_out_6: | |
| 1786 | err_out_5: | ||
| 1787 | unregister_netdev(self->netdev); | 1780 | unregister_netdev(self->netdev); |
| 1781 | err_out_5: | ||
| 1782 | kfree(self->tx_buff); | ||
| 1788 | err_out_4: | 1783 | err_out_4: |
| 1789 | kfree(self->speed_buff); | 1784 | kfree(self->speed_buff); |
| 1790 | err_out_3: | 1785 | err_out_3: |
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h index 6b2271f18e77..e846c38224a3 100644 --- a/drivers/net/irda/irda-usb.h +++ b/drivers/net/irda/irda-usb.h | |||
| @@ -156,6 +156,7 @@ struct irda_usb_cb { | |||
| 156 | struct irlap_cb *irlap; /* The link layer we are binded to */ | 156 | struct irlap_cb *irlap; /* The link layer we are binded to */ |
| 157 | struct qos_info qos; | 157 | struct qos_info qos; |
| 158 | char *speed_buff; /* Buffer for speed changes */ | 158 | char *speed_buff; /* Buffer for speed changes */ |
| 159 | char *tx_buff; | ||
| 159 | 160 | ||
| 160 | struct timeval stamp; | 161 | struct timeval stamp; |
| 161 | struct timeval now; | 162 | struct timeval now; |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index c14a74634fd5..20d306fea4cb 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
| @@ -59,7 +59,7 @@ | |||
| 59 | #include <asm/byteorder.h> | 59 | #include <asm/byteorder.h> |
| 60 | #include <asm/unaligned.h> | 60 | #include <asm/unaligned.h> |
| 61 | 61 | ||
| 62 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); | 62 | MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>"); |
| 63 | MODULE_DESCRIPTION("IrDA-USB Dongle Driver for SigmaTel STIr4200"); | 63 | MODULE_DESCRIPTION("IrDA-USB Dongle Driver for SigmaTel STIr4200"); |
| 64 | MODULE_LICENSE("GPL"); | 64 | MODULE_LICENSE("GPL"); |
| 65 | 65 | ||
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 18c68193bf14..e2b1af618450 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c | |||
| @@ -166,7 +166,7 @@ static void vlsi_proc_pdev(struct seq_file *seq, struct pci_dev *pdev) | |||
| 166 | unsigned i; | 166 | unsigned i; |
| 167 | 167 | ||
| 168 | seq_printf(seq, "\n%s (vid/did: %04x/%04x)\n", | 168 | seq_printf(seq, "\n%s (vid/did: %04x/%04x)\n", |
| 169 | PCIDEV_NAME(pdev), (int)pdev->vendor, (int)pdev->device); | 169 | pci_name(pdev), (int)pdev->vendor, (int)pdev->device); |
| 170 | seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state); | 170 | seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state); |
| 171 | seq_printf(seq, "resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n", | 171 | seq_printf(seq, "resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n", |
| 172 | pdev->irq, (unsigned)pci_resource_start(pdev, 0), (unsigned long long)pdev->dma_mask); | 172 | pdev->irq, (unsigned)pci_resource_start(pdev, 0), (unsigned long long)pdev->dma_mask); |
| @@ -1401,7 +1401,7 @@ static void vlsi_tx_timeout(struct net_device *ndev) | |||
| 1401 | 1401 | ||
| 1402 | if (vlsi_start_hw(idev)) | 1402 | if (vlsi_start_hw(idev)) |
| 1403 | IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n", | 1403 | IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n", |
| 1404 | __FUNCTION__, PCIDEV_NAME(idev->pdev), ndev->name); | 1404 | __FUNCTION__, pci_name(idev->pdev), ndev->name); |
| 1405 | else | 1405 | else |
| 1406 | netif_start_queue(ndev); | 1406 | netif_start_queue(ndev); |
| 1407 | } | 1407 | } |
| @@ -1643,7 +1643,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1643 | pdev->current_state = 0; /* hw must be running now */ | 1643 | pdev->current_state = 0; /* hw must be running now */ |
| 1644 | 1644 | ||
| 1645 | IRDA_MESSAGE("%s: IrDA PCI controller %s detected\n", | 1645 | IRDA_MESSAGE("%s: IrDA PCI controller %s detected\n", |
| 1646 | drivername, PCIDEV_NAME(pdev)); | 1646 | drivername, pci_name(pdev)); |
| 1647 | 1647 | ||
| 1648 | if ( !pci_resource_start(pdev,0) | 1648 | if ( !pci_resource_start(pdev,0) |
| 1649 | || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) { | 1649 | || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) { |
| @@ -1728,7 +1728,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev) | |||
| 1728 | 1728 | ||
| 1729 | pci_set_drvdata(pdev, NULL); | 1729 | pci_set_drvdata(pdev, NULL); |
| 1730 | 1730 | ||
| 1731 | IRDA_MESSAGE("%s: %s removed\n", drivername, PCIDEV_NAME(pdev)); | 1731 | IRDA_MESSAGE("%s: %s removed\n", drivername, pci_name(pdev)); |
| 1732 | } | 1732 | } |
| 1733 | 1733 | ||
| 1734 | #ifdef CONFIG_PM | 1734 | #ifdef CONFIG_PM |
| @@ -1748,7 +1748,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 1748 | 1748 | ||
| 1749 | if (!ndev) { | 1749 | if (!ndev) { |
| 1750 | IRDA_ERROR("%s - %s: no netdevice \n", | 1750 | IRDA_ERROR("%s - %s: no netdevice \n", |
| 1751 | __FUNCTION__, PCIDEV_NAME(pdev)); | 1751 | __FUNCTION__, pci_name(pdev)); |
| 1752 | return 0; | 1752 | return 0; |
| 1753 | } | 1753 | } |
| 1754 | idev = ndev->priv; | 1754 | idev = ndev->priv; |
| @@ -1759,7 +1759,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 1759 | pdev->current_state = state.event; | 1759 | pdev->current_state = state.event; |
| 1760 | } | 1760 | } |
| 1761 | else | 1761 | else |
| 1762 | IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state.event); | 1762 | IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, pci_name(pdev), pdev->current_state, state.event); |
| 1763 | up(&idev->sem); | 1763 | up(&idev->sem); |
| 1764 | return 0; | 1764 | return 0; |
| 1765 | } | 1765 | } |
| @@ -1787,7 +1787,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev) | |||
| 1787 | 1787 | ||
| 1788 | if (!ndev) { | 1788 | if (!ndev) { |
| 1789 | IRDA_ERROR("%s - %s: no netdevice \n", | 1789 | IRDA_ERROR("%s - %s: no netdevice \n", |
| 1790 | __FUNCTION__, PCIDEV_NAME(pdev)); | 1790 | __FUNCTION__, pci_name(pdev)); |
| 1791 | return 0; | 1791 | return 0; |
| 1792 | } | 1792 | } |
| 1793 | idev = ndev->priv; | 1793 | idev = ndev->priv; |
| @@ -1795,7 +1795,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev) | |||
| 1795 | if (pdev->current_state == 0) { | 1795 | if (pdev->current_state == 0) { |
| 1796 | up(&idev->sem); | 1796 | up(&idev->sem); |
| 1797 | IRDA_WARNING("%s - %s: already resumed\n", | 1797 | IRDA_WARNING("%s - %s: already resumed\n", |
| 1798 | __FUNCTION__, PCIDEV_NAME(pdev)); | 1798 | __FUNCTION__, pci_name(pdev)); |
| 1799 | return 0; | 1799 | return 0; |
| 1800 | } | 1800 | } |
| 1801 | 1801 | ||
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h index c37f0bc4c7f9..2d3b773d8e35 100644 --- a/drivers/net/irda/vlsi_ir.h +++ b/drivers/net/irda/vlsi_ir.h | |||
| @@ -41,39 +41,6 @@ | |||
| 41 | #define PCI_CLASS_SUBCLASS_MASK 0xffff | 41 | #define PCI_CLASS_SUBCLASS_MASK 0xffff |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | /* in recent 2.5 interrupt handlers have non-void return value */ | ||
| 45 | #ifndef IRQ_RETVAL | ||
| 46 | typedef void irqreturn_t; | ||
| 47 | #define IRQ_NONE | ||
| 48 | #define IRQ_HANDLED | ||
| 49 | #define IRQ_RETVAL(x) | ||
| 50 | #endif | ||
| 51 | |||
| 52 | /* some stuff need to check kernelversion. Not all 2.5 stuff was present | ||
| 53 | * in early 2.5.x - the test is merely to separate 2.4 from 2.5 | ||
| 54 | */ | ||
| 55 | #include <linux/version.h> | ||
| 56 | |||
| 57 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 58 | |||
| 59 | /* PDE() introduced in 2.5.4 */ | ||
| 60 | #ifdef CONFIG_PROC_FS | ||
| 61 | #define PDE(inode) ((inode)->i_private) | ||
| 62 | #endif | ||
| 63 | |||
| 64 | /* irda crc16 calculation exported in 2.5.42 */ | ||
| 65 | #define irda_calc_crc16(fcs,buf,len) (GOOD_FCS) | ||
| 66 | |||
| 67 | /* we use this for unified pci device name access */ | ||
| 68 | #define PCIDEV_NAME(pdev) ((pdev)->name) | ||
| 69 | |||
| 70 | #else /* 2.5 or later */ | ||
| 71 | |||
| 72 | /* whatever we get from the associated struct device - bus:slot:dev.fn id */ | ||
| 73 | #define PCIDEV_NAME(pdev) (pci_name(pdev)) | ||
| 74 | |||
| 75 | #endif | ||
| 76 | |||
| 77 | /* ================================================================ */ | 44 | /* ================================================================ */ |
| 78 | 45 | ||
| 79 | /* non-standard PCI registers */ | 46 | /* non-standard PCI registers */ |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index c41ae4286eea..b3bf86422734 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
| @@ -314,6 +314,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) | |||
| 314 | 314 | ||
| 315 | while (mp->tx_desc_count > 0) { | 315 | while (mp->tx_desc_count > 0) { |
| 316 | spin_lock_irqsave(&mp->lock, flags); | 316 | spin_lock_irqsave(&mp->lock, flags); |
| 317 | |||
| 318 | /* tx_desc_count might have changed before acquiring the lock */ | ||
| 319 | if (mp->tx_desc_count <= 0) { | ||
| 320 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 321 | return released; | ||
| 322 | } | ||
| 323 | |||
| 317 | tx_index = mp->tx_used_desc_q; | 324 | tx_index = mp->tx_used_desc_q; |
| 318 | desc = &mp->p_tx_desc_area[tx_index]; | 325 | desc = &mp->p_tx_desc_area[tx_index]; |
| 319 | cmd_sts = desc->cmd_sts; | 326 | cmd_sts = desc->cmd_sts; |
| @@ -332,13 +339,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force) | |||
| 332 | if (skb) | 339 | if (skb) |
| 333 | mp->tx_skb[tx_index] = NULL; | 340 | mp->tx_skb[tx_index] = NULL; |
| 334 | 341 | ||
| 335 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 336 | |||
| 337 | if (cmd_sts & ETH_ERROR_SUMMARY) { | 342 | if (cmd_sts & ETH_ERROR_SUMMARY) { |
| 338 | printk("%s: Error in TX\n", dev->name); | 343 | printk("%s: Error in TX\n", dev->name); |
| 339 | mp->stats.tx_errors++; | 344 | mp->stats.tx_errors++; |
| 340 | } | 345 | } |
| 341 | 346 | ||
| 347 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 348 | |||
| 342 | if (cmd_sts & ETH_TX_FIRST_DESC) | 349 | if (cmd_sts & ETH_TX_FIRST_DESC) |
| 343 | dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE); | 350 | dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE); |
| 344 | else | 351 | else |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 6490acf05305..59324b1693d6 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -63,12 +63,11 @@ | |||
| 63 | 63 | ||
| 64 | #include "netxen_nic_hw.h" | 64 | #include "netxen_nic_hw.h" |
| 65 | 65 | ||
| 66 | #define NETXEN_NIC_BUILD_NO "4" | 66 | #define NETXEN_NIC_BUILD_NO "2" |
| 67 | #define _NETXEN_NIC_LINUX_MAJOR 3 | 67 | #define _NETXEN_NIC_LINUX_MAJOR 3 |
| 68 | #define _NETXEN_NIC_LINUX_MINOR 3 | 68 | #define _NETXEN_NIC_LINUX_MINOR 3 |
| 69 | #define _NETXEN_NIC_LINUX_SUBVERSION 2 | 69 | #define _NETXEN_NIC_LINUX_SUBVERSION 3 |
| 70 | #define NETXEN_NIC_LINUX_VERSIONID "3.3.2" "-" NETXEN_NIC_BUILD_NO | 70 | #define NETXEN_NIC_LINUX_VERSIONID "3.3.3" "-" NETXEN_NIC_BUILD_NO |
| 71 | #define NETXEN_NIC_FW_VERSIONID "3.3.2" | ||
| 72 | 71 | ||
| 73 | #define RCV_DESC_RINGSIZE \ | 72 | #define RCV_DESC_RINGSIZE \ |
| 74 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) | 73 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index c0c31d1914a7..191e2336e323 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
| @@ -984,7 +984,8 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
| 984 | _NETXEN_NIC_LINUX_MAJOR, fw_major); | 984 | _NETXEN_NIC_LINUX_MAJOR, fw_major); |
| 985 | adapter->driver_mismatch = 1; | 985 | adapter->driver_mismatch = 1; |
| 986 | } | 986 | } |
| 987 | if (fw_minor != _NETXEN_NIC_LINUX_MINOR) { | 987 | if (fw_minor != _NETXEN_NIC_LINUX_MINOR && |
| 988 | fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) { | ||
| 988 | printk(KERN_ERR "The mismatch in driver version and firmware " | 989 | printk(KERN_ERR "The mismatch in driver version and firmware " |
| 989 | "version minor number\n" | 990 | "version minor number\n" |
| 990 | "Driver version minor number = %d \t" | 991 | "Driver version minor number = %d \t" |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 8a5792fea774..96e1bee19ba0 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -1144,7 +1144,7 @@ static int __init netxen_init_module(void) | |||
| 1144 | if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0) | 1144 | if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0) |
| 1145 | return -ENOMEM; | 1145 | return -ENOMEM; |
| 1146 | 1146 | ||
| 1147 | return pci_module_init(&netxen_driver); | 1147 | return pci_register_driver(&netxen_driver); |
| 1148 | } | 1148 | } |
| 1149 | 1149 | ||
| 1150 | module_init(netxen_init_module); | 1150 | module_init(netxen_init_module); |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 342f4062de0b..461e8274ef69 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
| @@ -606,11 +606,14 @@ static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 606 | { | 606 | { |
| 607 | kio_addr_t ioaddr = dev->base_addr; | 607 | kio_addr_t ioaddr = dev->base_addr; |
| 608 | struct el3_private *priv = netdev_priv(dev); | 608 | struct el3_private *priv = netdev_priv(dev); |
| 609 | unsigned long flags; | ||
| 609 | 610 | ||
| 610 | DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " | 611 | DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " |
| 611 | "status %4.4x.\n", dev->name, (long)skb->len, | 612 | "status %4.4x.\n", dev->name, (long)skb->len, |
| 612 | inw(ioaddr + EL3_STATUS)); | 613 | inw(ioaddr + EL3_STATUS)); |
| 613 | 614 | ||
| 615 | spin_lock_irqsave(&priv->lock, flags); | ||
| 616 | |||
| 614 | priv->stats.tx_bytes += skb->len; | 617 | priv->stats.tx_bytes += skb->len; |
| 615 | 618 | ||
| 616 | /* Put out the doubleword header... */ | 619 | /* Put out the doubleword header... */ |
| @@ -628,6 +631,7 @@ static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 628 | 631 | ||
| 629 | dev_kfree_skb(skb); | 632 | dev_kfree_skb(skb); |
| 630 | pop_tx_status(dev); | 633 | pop_tx_status(dev); |
| 634 | spin_unlock_irqrestore(&priv->lock, flags); | ||
| 631 | 635 | ||
| 632 | return 0; | 636 | return 0; |
| 633 | } | 637 | } |
| @@ -729,14 +733,13 @@ static void media_check(unsigned long arg) | |||
| 729 | 733 | ||
| 730 | if (!netif_device_present(dev)) goto reschedule; | 734 | if (!netif_device_present(dev)) goto reschedule; |
| 731 | 735 | ||
| 732 | EL3WINDOW(1); | ||
| 733 | /* Check for pending interrupt with expired latency timer: with | 736 | /* Check for pending interrupt with expired latency timer: with |
| 734 | this, we can limp along even if the interrupt is blocked */ | 737 | this, we can limp along even if the interrupt is blocked */ |
| 735 | if ((inw(ioaddr + EL3_STATUS) & IntLatch) && | 738 | if ((inw(ioaddr + EL3_STATUS) & IntLatch) && |
| 736 | (inb(ioaddr + EL3_TIMER) == 0xff)) { | 739 | (inb(ioaddr + EL3_TIMER) == 0xff)) { |
| 737 | if (!lp->fast_poll) | 740 | if (!lp->fast_poll) |
| 738 | printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name); | 741 | printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name); |
| 739 | el3_interrupt(dev->irq, lp); | 742 | el3_interrupt(dev->irq, dev); |
| 740 | lp->fast_poll = HZ; | 743 | lp->fast_poll = HZ; |
| 741 | } | 744 | } |
| 742 | if (lp->fast_poll) { | 745 | if (lp->fast_poll) { |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e175f3910b18..9765fa661467 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
| @@ -286,6 +286,7 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) | |||
| 286 | 286 | ||
| 287 | return 0; | 287 | return 0; |
| 288 | } | 288 | } |
| 289 | EXPORT_SYMBOL(phy_ethtool_sset); | ||
| 289 | 290 | ||
| 290 | int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) | 291 | int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) |
| 291 | { | 292 | { |
| @@ -302,7 +303,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) | |||
| 302 | 303 | ||
| 303 | return 0; | 304 | return 0; |
| 304 | } | 305 | } |
| 305 | 306 | EXPORT_SYMBOL(phy_ethtool_gset); | |
| 306 | 307 | ||
| 307 | /* Note that this function is currently incompatible with the | 308 | /* Note that this function is currently incompatible with the |
| 308 | * PHYCONTROL layer. It changes registers without regard to | 309 | * PHYCONTROL layer. It changes registers without regard to |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 250cdbeefdfd..1dd66b8ea0fa 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
| @@ -556,10 +556,9 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
| 556 | } | 556 | } |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL); | 559 | nic->ufo_in_band_v = kcalloc(size, sizeof(u64), GFP_KERNEL); |
| 560 | if (!nic->ufo_in_band_v) | 560 | if (!nic->ufo_in_band_v) |
| 561 | return -ENOMEM; | 561 | return -ENOMEM; |
| 562 | memset(nic->ufo_in_band_v, 0, size); | ||
| 563 | 562 | ||
| 564 | /* Allocation and initialization of RXDs in Rings */ | 563 | /* Allocation and initialization of RXDs in Rings */ |
| 565 | size = 0; | 564 | size = 0; |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index deedfd5f8226..45283f3f95e4 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | #define LINK_HZ (HZ/2) | 60 | #define LINK_HZ (HZ/2) |
| 61 | 61 | ||
| 62 | MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); | 62 | MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); |
| 63 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); | 63 | MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>"); |
| 64 | MODULE_LICENSE("GPL"); | 64 | MODULE_LICENSE("GPL"); |
| 65 | MODULE_VERSION(DRV_VERSION); | 65 | MODULE_VERSION(DRV_VERSION); |
| 66 | 66 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index a6601e8d423c..a2e804ddca6c 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
| @@ -3691,6 +3691,6 @@ module_init(sky2_init_module); | |||
| 3691 | module_exit(sky2_cleanup_module); | 3691 | module_exit(sky2_cleanup_module); |
| 3692 | 3692 | ||
| 3693 | MODULE_DESCRIPTION("Marvell Yukon 2 Gigabit Ethernet driver"); | 3693 | MODULE_DESCRIPTION("Marvell Yukon 2 Gigabit Ethernet driver"); |
| 3694 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); | 3694 | MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>"); |
| 3695 | MODULE_LICENSE("GPL"); | 3695 | MODULE_LICENSE("GPL"); |
| 3696 | MODULE_VERSION(DRV_VERSION); | 3696 | MODULE_VERSION(DRV_VERSION); |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index e9e0934380b8..198b9f22fbff 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
| @@ -492,10 +492,10 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |||
| 492 | 492 | ||
| 493 | spin_lock_irq(&rtc->lock); | 493 | spin_lock_irq(&rtc->lock); |
| 494 | 494 | ||
| 495 | /* disable alarm interrupt and clear flag */ | 495 | /* disable alarm interrupt and clear the alarm flag */ |
| 496 | rcr1 = readb(rtc->regbase + RCR1); | 496 | rcr1 = readb(rtc->regbase + RCR1); |
| 497 | rcr1 &= ~RCR1_AF; | 497 | rcr1 &= ~(RCR1_AF|RCR1_AIE); |
| 498 | writeb(rcr1 & ~RCR1_AIE, rtc->regbase + RCR1); | 498 | writeb(rcr1, rtc->regbase + RCR1); |
| 499 | 499 | ||
| 500 | rtc->rearm_aie = 0; | 500 | rtc->rearm_aie = 0; |
| 501 | 501 | ||
| @@ -510,8 +510,10 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |||
| 510 | mon += 1; | 510 | mon += 1; |
| 511 | sh_rtc_write_alarm_value(rtc, mon, RMONAR); | 511 | sh_rtc_write_alarm_value(rtc, mon, RMONAR); |
| 512 | 512 | ||
| 513 | /* Restore interrupt activation status */ | 513 | if (wkalrm->enabled) { |
| 514 | writeb(rcr1, rtc->regbase + RCR1); | 514 | rcr1 |= RCR1_AIE; |
| 515 | writeb(rcr1, rtc->regbase + RCR1); | ||
| 516 | } | ||
| 515 | 517 | ||
| 516 | spin_unlock_irq(&rtc->lock); | 518 | spin_unlock_irq(&rtc->lock); |
| 517 | 519 | ||
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c index 9418a59fb368..2ddd0cf07140 100644 --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c | |||
| @@ -78,7 +78,7 @@ static struct attribute_group rtc_attr_group = { | |||
| 78 | .attrs = rtc_attrs, | 78 | .attrs = rtc_attrs, |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | static int __devinit rtc_sysfs_add_device(struct class_device *class_dev, | 81 | static int rtc_sysfs_add_device(struct class_device *class_dev, |
| 82 | struct class_interface *class_intf) | 82 | struct class_interface *class_intf) |
| 83 | { | 83 | { |
| 84 | int err; | 84 | int err; |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 6ed3f1da9296..8b41f9cc2560 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
| @@ -1169,8 +1169,9 @@ static int setup(struct spi_device *spi) | |||
| 1169 | spi->bits_per_word - 16 : spi->bits_per_word) | 1169 | spi->bits_per_word - 16 : spi->bits_per_word) |
| 1170 | | SSCR0_SSE | 1170 | | SSCR0_SSE |
| 1171 | | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0); | 1171 | | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0); |
| 1172 | chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4) | 1172 | chip->cr1 &= ~(SSCR1_SPO | SSCR1_SPH); |
| 1173 | | (((spi->mode & SPI_CPOL) != 0) << 3); | 1173 | chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0) |
| 1174 | | (((spi->mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0); | ||
| 1174 | 1175 | ||
| 1175 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ | 1176 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ |
| 1176 | if (drv_data->ssp_type != PXA25x_SSP) | 1177 | if (drv_data->ssp_type != PXA25x_SSP) |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 270e6211c2e3..6307428d2c94 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -366,7 +366,6 @@ spi_alloc_master(struct device *dev, unsigned size) | |||
| 366 | 366 | ||
| 367 | class_device_initialize(&master->cdev); | 367 | class_device_initialize(&master->cdev); |
| 368 | master->cdev.class = &spi_master_class; | 368 | master->cdev.class = &spi_master_class; |
| 369 | kobj_set_kset_s(&master->cdev, spi_master_class.subsys); | ||
| 370 | master->cdev.dev = get_device(dev); | 369 | master->cdev.dev = get_device(dev); |
| 371 | spi_master_set_devdata(master, &master[1]); | 370 | spi_master_set_devdata(master, &master[1]); |
| 372 | 371 | ||
| @@ -466,14 +465,20 @@ EXPORT_SYMBOL_GPL(spi_unregister_master); | |||
| 466 | */ | 465 | */ |
| 467 | struct spi_master *spi_busnum_to_master(u16 bus_num) | 466 | struct spi_master *spi_busnum_to_master(u16 bus_num) |
| 468 | { | 467 | { |
| 469 | char name[9]; | 468 | struct class_device *cdev; |
| 470 | struct kobject *bus; | 469 | struct spi_master *master = NULL; |
| 471 | 470 | struct spi_master *m; | |
| 472 | snprintf(name, sizeof name, "spi%u", bus_num); | 471 | |
| 473 | bus = kset_find_obj(&spi_master_class.subsys.kset, name); | 472 | down(&spi_master_class.sem); |
| 474 | if (bus) | 473 | list_for_each_entry(cdev, &spi_master_class.children, node) { |
| 475 | return container_of(bus, struct spi_master, cdev.kobj); | 474 | m = container_of(cdev, struct spi_master, cdev); |
| 476 | return NULL; | 475 | if (m->bus_num == bus_num) { |
| 476 | master = spi_master_get(m); | ||
| 477 | break; | ||
| 478 | } | ||
| 479 | } | ||
| 480 | up(&spi_master_class.sem); | ||
| 481 | return master; | ||
| 477 | } | 482 | } |
| 478 | EXPORT_SYMBOL_GPL(spi_busnum_to_master); | 483 | EXPORT_SYMBOL_GPL(spi_busnum_to_master); |
| 479 | 484 | ||
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 8ca08713528e..651379c51ae6 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
| @@ -10,9 +10,6 @@ | |||
| 10 | * | 10 | * |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | |||
| 14 | //#define DEBUG | ||
| 15 | |||
| 16 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 17 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
| 18 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
| @@ -44,6 +41,9 @@ struct s3c24xx_spi { | |||
| 44 | int len; | 41 | int len; |
| 45 | int count; | 42 | int count; |
| 46 | 43 | ||
| 44 | int (*set_cs)(struct s3c2410_spi_info *spi, | ||
| 45 | int cs, int pol); | ||
| 46 | |||
| 47 | /* data buffers */ | 47 | /* data buffers */ |
| 48 | const unsigned char *tx; | 48 | const unsigned char *tx; |
| 49 | unsigned char *rx; | 49 | unsigned char *rx; |
| @@ -64,6 +64,11 @@ static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev) | |||
| 64 | return spi_master_get_devdata(sdev->master); | 64 | return spi_master_get_devdata(sdev->master); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol) | ||
| 68 | { | ||
| 69 | s3c2410_gpio_setpin(spi->pin_cs, pol); | ||
| 70 | } | ||
| 71 | |||
| 67 | static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | 72 | static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) |
| 68 | { | 73 | { |
| 69 | struct s3c24xx_spi *hw = to_hw(spi); | 74 | struct s3c24xx_spi *hw = to_hw(spi); |
| @@ -72,10 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
| 72 | 77 | ||
| 73 | switch (value) { | 78 | switch (value) { |
| 74 | case BITBANG_CS_INACTIVE: | 79 | case BITBANG_CS_INACTIVE: |
| 75 | if (hw->pdata->set_cs) | 80 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1); |
| 76 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
| 77 | else | ||
| 78 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1); | ||
| 79 | break; | 81 | break; |
| 80 | 82 | ||
| 81 | case BITBANG_CS_ACTIVE: | 83 | case BITBANG_CS_ACTIVE: |
| @@ -96,14 +98,9 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
| 96 | /* write new configration */ | 98 | /* write new configration */ |
| 97 | 99 | ||
| 98 | writeb(spcon, hw->regs + S3C2410_SPCON); | 100 | writeb(spcon, hw->regs + S3C2410_SPCON); |
| 99 | 101 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol); | |
| 100 | if (hw->pdata->set_cs) | ||
| 101 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
| 102 | else | ||
| 103 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol); | ||
| 104 | 102 | ||
| 105 | break; | 103 | break; |
| 106 | |||
| 107 | } | 104 | } |
| 108 | } | 105 | } |
| 109 | 106 | ||
| @@ -330,9 +327,12 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) | |||
| 330 | /* setup any gpio we can */ | 327 | /* setup any gpio we can */ |
| 331 | 328 | ||
| 332 | if (!hw->pdata->set_cs) { | 329 | if (!hw->pdata->set_cs) { |
| 330 | hw->set_cs = s3c24xx_spi_gpiocs; | ||
| 331 | |||
| 333 | s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); | 332 | s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); |
| 334 | s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); | 333 | s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); |
| 335 | } | 334 | } else |
| 335 | hw->set_cs = hw->pdata->set_cs; | ||
| 336 | 336 | ||
| 337 | /* register our spi controller */ | 337 | /* register our spi controller */ |
| 338 | 338 | ||
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c index 31501c9361b9..2bebd63d5ed1 100644 --- a/drivers/usb/serial/funsoft.c +++ b/drivers/usb/serial/funsoft.c | |||
| @@ -27,7 +27,7 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
| 27 | static int funsoft_ioctl(struct usb_serial_port *port, struct file *file, | 27 | static int funsoft_ioctl(struct usb_serial_port *port, struct file *file, |
| 28 | unsigned int cmd, unsigned long arg) | 28 | unsigned int cmd, unsigned long arg) |
| 29 | { | 29 | { |
| 30 | struct termios t; | 30 | struct ktermios t; |
| 31 | 31 | ||
| 32 | dbg("%s - port %d, cmd 0x%04x", __FUNCTION__, port->number, cmd); | 32 | dbg("%s - port %d, cmd 0x%04x", __FUNCTION__, port->number, cmd); |
| 33 | 33 | ||
