diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 60 | ||||
-rw-r--r-- | drivers/ata/libahci.c | 61 |
2 files changed, 61 insertions, 60 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index fcda5b663030..0b2160457046 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1226,66 +1226,6 @@ intx: | |||
1226 | return 0; | 1226 | return 0; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | /** | ||
1230 | * ahci_host_activate - start AHCI host, request IRQs and register it | ||
1231 | * @host: target ATA host | ||
1232 | * @irq: base IRQ number to request | ||
1233 | * @sht: scsi_host_template to use when registering the host | ||
1234 | * | ||
1235 | * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1 | ||
1236 | * when multiple MSIs were allocated. That is one MSI per port, starting | ||
1237 | * from @irq. | ||
1238 | * | ||
1239 | * LOCKING: | ||
1240 | * Inherited from calling layer (may sleep). | ||
1241 | * | ||
1242 | * RETURNS: | ||
1243 | * 0 on success, -errno otherwise. | ||
1244 | */ | ||
1245 | int ahci_host_activate(struct ata_host *host, int irq, | ||
1246 | struct scsi_host_template *sht) | ||
1247 | { | ||
1248 | int i, rc; | ||
1249 | |||
1250 | rc = ata_host_start(host); | ||
1251 | if (rc) | ||
1252 | return rc; | ||
1253 | |||
1254 | for (i = 0; i < host->n_ports; i++) { | ||
1255 | struct ahci_port_priv *pp = host->ports[i]->private_data; | ||
1256 | |||
1257 | /* Do not receive interrupts sent by dummy ports */ | ||
1258 | if (!pp) { | ||
1259 | disable_irq(irq + i); | ||
1260 | continue; | ||
1261 | } | ||
1262 | |||
1263 | rc = devm_request_threaded_irq(host->dev, irq + i, | ||
1264 | ahci_hw_interrupt, | ||
1265 | ahci_thread_fn, IRQF_SHARED, | ||
1266 | pp->irq_desc, host->ports[i]); | ||
1267 | if (rc) | ||
1268 | goto out_free_irqs; | ||
1269 | } | ||
1270 | |||
1271 | for (i = 0; i < host->n_ports; i++) | ||
1272 | ata_port_desc(host->ports[i], "irq %d", irq + i); | ||
1273 | |||
1274 | rc = ata_host_register(host, sht); | ||
1275 | if (rc) | ||
1276 | goto out_free_all_irqs; | ||
1277 | |||
1278 | return 0; | ||
1279 | |||
1280 | out_free_all_irqs: | ||
1281 | i = host->n_ports; | ||
1282 | out_free_irqs: | ||
1283 | for (i--; i >= 0; i--) | ||
1284 | devm_free_irq(host->dev, irq + i, host->ports[i]); | ||
1285 | |||
1286 | return rc; | ||
1287 | } | ||
1288 | |||
1289 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1229 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1290 | { | 1230 | { |
1291 | unsigned int board_id = ent->driver_data; | 1231 | unsigned int board_id = ent->driver_data; |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index b784e9de426a..21bb427d9df4 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -2472,6 +2472,67 @@ void ahci_set_em_messages(struct ahci_host_priv *hpriv, | |||
2472 | } | 2472 | } |
2473 | EXPORT_SYMBOL_GPL(ahci_set_em_messages); | 2473 | EXPORT_SYMBOL_GPL(ahci_set_em_messages); |
2474 | 2474 | ||
2475 | /** | ||
2476 | * ahci_host_activate - start AHCI host, request IRQs and register it | ||
2477 | * @host: target ATA host | ||
2478 | * @irq: base IRQ number to request | ||
2479 | * @sht: scsi_host_template to use when registering the host | ||
2480 | * | ||
2481 | * Similar to ata_host_activate, but requests IRQs according to AHCI-1.1 | ||
2482 | * when multiple MSIs were allocated. That is one MSI per port, starting | ||
2483 | * from @irq. | ||
2484 | * | ||
2485 | * LOCKING: | ||
2486 | * Inherited from calling layer (may sleep). | ||
2487 | * | ||
2488 | * RETURNS: | ||
2489 | * 0 on success, -errno otherwise. | ||
2490 | */ | ||
2491 | int ahci_host_activate(struct ata_host *host, int irq, | ||
2492 | struct scsi_host_template *sht) | ||
2493 | { | ||
2494 | int i, rc; | ||
2495 | |||
2496 | rc = ata_host_start(host); | ||
2497 | if (rc) | ||
2498 | return rc; | ||
2499 | |||
2500 | for (i = 0; i < host->n_ports; i++) { | ||
2501 | struct ahci_port_priv *pp = host->ports[i]->private_data; | ||
2502 | |||
2503 | /* Do not receive interrupts sent by dummy ports */ | ||
2504 | if (!pp) { | ||
2505 | disable_irq(irq + i); | ||
2506 | continue; | ||
2507 | } | ||
2508 | |||
2509 | rc = devm_request_threaded_irq(host->dev, irq + i, | ||
2510 | ahci_hw_interrupt, | ||
2511 | ahci_thread_fn, IRQF_SHARED, | ||
2512 | pp->irq_desc, host->ports[i]); | ||
2513 | if (rc) | ||
2514 | goto out_free_irqs; | ||
2515 | } | ||
2516 | |||
2517 | for (i = 0; i < host->n_ports; i++) | ||
2518 | ata_port_desc(host->ports[i], "irq %d", irq + i); | ||
2519 | |||
2520 | rc = ata_host_register(host, sht); | ||
2521 | if (rc) | ||
2522 | goto out_free_all_irqs; | ||
2523 | |||
2524 | return 0; | ||
2525 | |||
2526 | out_free_all_irqs: | ||
2527 | i = host->n_ports; | ||
2528 | out_free_irqs: | ||
2529 | for (i--; i >= 0; i--) | ||
2530 | devm_free_irq(host->dev, irq + i, host->ports[i]); | ||
2531 | |||
2532 | return rc; | ||
2533 | } | ||
2534 | EXPORT_SYMBOL_GPL(ahci_host_activate); | ||
2535 | |||
2475 | MODULE_AUTHOR("Jeff Garzik"); | 2536 | MODULE_AUTHOR("Jeff Garzik"); |
2476 | MODULE_DESCRIPTION("Common AHCI SATA low-level routines"); | 2537 | MODULE_DESCRIPTION("Common AHCI SATA low-level routines"); |
2477 | MODULE_LICENSE("GPL"); | 2538 | MODULE_LICENSE("GPL"); |