diff options
author | Alexander Gordeev <agordeev@redhat.com> | 2014-09-29 12:25:58 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-10-06 11:43:34 -0400 |
commit | 1c62854f5f7321b3ee8c08d34d7c1e615608566d (patch) | |
tree | 5d3485de13bee343286f6de651dfaab1a007834c /drivers/ata/libahci.c | |
parent | a6849b9fdbffd2492a848df942b39d23bd81ef27 (diff) |
AHCI: Move ahci_host_activate() function to libahci.c
This update is a prerequisite for consolidation of
AHCI host activation code within ahci_host_activate()
function.
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Diffstat (limited to 'drivers/ata/libahci.c')
-rw-r--r-- | drivers/ata/libahci.c | 61 |
1 files changed, 61 insertions, 0 deletions
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"); |