diff options
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r-- | drivers/ata/sata_nv.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 7b7ba0e26903..5637b082bc85 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -466,58 +466,61 @@ static struct ata_port_operations nv_swncq_ops = { | |||
466 | .port_start = nv_swncq_port_start, | 466 | .port_start = nv_swncq_port_start, |
467 | }; | 467 | }; |
468 | 468 | ||
469 | struct nv_pi_priv { | ||
470 | irq_handler_t irq_handler; | ||
471 | struct scsi_host_template *sht; | ||
472 | }; | ||
473 | |||
474 | #define NV_PI_PRIV(_irq_handler, _sht) \ | ||
475 | &(struct nv_pi_priv){ .irq_handler = _irq_handler, .sht = _sht } | ||
476 | |||
469 | static const struct ata_port_info nv_port_info[] = { | 477 | static const struct ata_port_info nv_port_info[] = { |
470 | /* generic */ | 478 | /* generic */ |
471 | { | 479 | { |
472 | .sht = &nv_sht, | ||
473 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 480 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
474 | .pio_mask = NV_PIO_MASK, | 481 | .pio_mask = NV_PIO_MASK, |
475 | .mwdma_mask = NV_MWDMA_MASK, | 482 | .mwdma_mask = NV_MWDMA_MASK, |
476 | .udma_mask = NV_UDMA_MASK, | 483 | .udma_mask = NV_UDMA_MASK, |
477 | .port_ops = &nv_generic_ops, | 484 | .port_ops = &nv_generic_ops, |
478 | .irq_handler = nv_generic_interrupt, | 485 | .private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht), |
479 | }, | 486 | }, |
480 | /* nforce2/3 */ | 487 | /* nforce2/3 */ |
481 | { | 488 | { |
482 | .sht = &nv_sht, | ||
483 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 489 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
484 | .pio_mask = NV_PIO_MASK, | 490 | .pio_mask = NV_PIO_MASK, |
485 | .mwdma_mask = NV_MWDMA_MASK, | 491 | .mwdma_mask = NV_MWDMA_MASK, |
486 | .udma_mask = NV_UDMA_MASK, | 492 | .udma_mask = NV_UDMA_MASK, |
487 | .port_ops = &nv_nf2_ops, | 493 | .port_ops = &nv_nf2_ops, |
488 | .irq_handler = nv_nf2_interrupt, | 494 | .private_data = NV_PI_PRIV(nv_nf2_interrupt, &nv_sht), |
489 | }, | 495 | }, |
490 | /* ck804 */ | 496 | /* ck804 */ |
491 | { | 497 | { |
492 | .sht = &nv_sht, | ||
493 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 498 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
494 | .pio_mask = NV_PIO_MASK, | 499 | .pio_mask = NV_PIO_MASK, |
495 | .mwdma_mask = NV_MWDMA_MASK, | 500 | .mwdma_mask = NV_MWDMA_MASK, |
496 | .udma_mask = NV_UDMA_MASK, | 501 | .udma_mask = NV_UDMA_MASK, |
497 | .port_ops = &nv_ck804_ops, | 502 | .port_ops = &nv_ck804_ops, |
498 | .irq_handler = nv_ck804_interrupt, | 503 | .private_data = NV_PI_PRIV(nv_ck804_interrupt, &nv_sht), |
499 | }, | 504 | }, |
500 | /* ADMA */ | 505 | /* ADMA */ |
501 | { | 506 | { |
502 | .sht = &nv_adma_sht, | ||
503 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 507 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
504 | ATA_FLAG_MMIO | ATA_FLAG_NCQ, | 508 | ATA_FLAG_MMIO | ATA_FLAG_NCQ, |
505 | .pio_mask = NV_PIO_MASK, | 509 | .pio_mask = NV_PIO_MASK, |
506 | .mwdma_mask = NV_MWDMA_MASK, | 510 | .mwdma_mask = NV_MWDMA_MASK, |
507 | .udma_mask = NV_UDMA_MASK, | 511 | .udma_mask = NV_UDMA_MASK, |
508 | .port_ops = &nv_adma_ops, | 512 | .port_ops = &nv_adma_ops, |
509 | .irq_handler = nv_adma_interrupt, | 513 | .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht), |
510 | }, | 514 | }, |
511 | /* SWNCQ */ | 515 | /* SWNCQ */ |
512 | { | 516 | { |
513 | .sht = &nv_swncq_sht, | ||
514 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 517 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
515 | ATA_FLAG_NCQ, | 518 | ATA_FLAG_NCQ, |
516 | .pio_mask = NV_PIO_MASK, | 519 | .pio_mask = NV_PIO_MASK, |
517 | .mwdma_mask = NV_MWDMA_MASK, | 520 | .mwdma_mask = NV_MWDMA_MASK, |
518 | .udma_mask = NV_UDMA_MASK, | 521 | .udma_mask = NV_UDMA_MASK, |
519 | .port_ops = &nv_swncq_ops, | 522 | .port_ops = &nv_swncq_ops, |
520 | .irq_handler = nv_swncq_interrupt, | 523 | .private_data = NV_PI_PRIV(nv_swncq_interrupt, &nv_swncq_sht), |
521 | }, | 524 | }, |
522 | }; | 525 | }; |
523 | 526 | ||
@@ -2316,6 +2319,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2316 | { | 2319 | { |
2317 | static int printed_version; | 2320 | static int printed_version; |
2318 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 2321 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
2322 | struct nv_pi_priv *ipriv; | ||
2319 | struct ata_host *host; | 2323 | struct ata_host *host; |
2320 | struct nv_host_priv *hpriv; | 2324 | struct nv_host_priv *hpriv; |
2321 | int rc; | 2325 | int rc; |
@@ -2352,6 +2356,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2352 | } | 2356 | } |
2353 | 2357 | ||
2354 | ppi[0] = &nv_port_info[type]; | 2358 | ppi[0] = &nv_port_info[type]; |
2359 | ipriv = ppi[0]->private_data; | ||
2355 | rc = ata_pci_prepare_sff_host(pdev, ppi, &host); | 2360 | rc = ata_pci_prepare_sff_host(pdev, ppi, &host); |
2356 | if (rc) | 2361 | if (rc) |
2357 | return rc; | 2362 | return rc; |
@@ -2390,8 +2395,8 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2390 | nv_swncq_host_init(host); | 2395 | nv_swncq_host_init(host); |
2391 | 2396 | ||
2392 | pci_set_master(pdev); | 2397 | pci_set_master(pdev); |
2393 | return ata_host_activate(host, pdev->irq, ppi[0]->irq_handler, | 2398 | return ata_host_activate(host, pdev->irq, ipriv->irq_handler, |
2394 | IRQF_SHARED, ppi[0]->sht); | 2399 | IRQF_SHARED, ipriv->sht); |
2395 | } | 2400 | } |
2396 | 2401 | ||
2397 | #ifdef CONFIG_PM | 2402 | #ifdef CONFIG_PM |