diff options
author | Alan <alan@lxorguk.ukuu.org.uk> | 2007-03-06 05:37:52 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:15:58 -0400 |
commit | 04351821b43e6c0c91ad50d7e4be54a935f749e1 (patch) | |
tree | 1cca629143ad5ac370129a6188f951077059b19b | |
parent | fcc2f69a6fad1543b466db9c35aa5a2f364eb3d4 (diff) |
pata: expose set_mode method so it can be wrapped
This splits set_mode into do_set_mode and the wrapper so that a driver can
call the standard method inside its own. This in theory also obsoletes
->post_set_mode().
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/libata-core.c | 37 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
2 files changed, 31 insertions, 7 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 89a77e1793fa..14b469f7b23e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2519,12 +2519,13 @@ static int ata_dev_set_mode(struct ata_device *dev) | |||
2519 | } | 2519 | } |
2520 | 2520 | ||
2521 | /** | 2521 | /** |
2522 | * ata_set_mode - Program timings and issue SET FEATURES - XFER | 2522 | * ata_do_set_mode - Program timings and issue SET FEATURES - XFER |
2523 | * @ap: port on which timings will be programmed | 2523 | * @ap: port on which timings will be programmed |
2524 | * @r_failed_dev: out paramter for failed device | 2524 | * @r_failed_dev: out paramter for failed device |
2525 | * | 2525 | * |
2526 | * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). If | 2526 | * Standard implementation of the function used to tune and set |
2527 | * ata_set_mode() fails, pointer to the failing device is | 2527 | * ATA device disk transfer mode (PIO3, UDMA6, etc.). If |
2528 | * ata_dev_set_mode() fails, pointer to the failing device is | ||
2528 | * returned in @r_failed_dev. | 2529 | * returned in @r_failed_dev. |
2529 | * | 2530 | * |
2530 | * LOCKING: | 2531 | * LOCKING: |
@@ -2533,14 +2534,12 @@ static int ata_dev_set_mode(struct ata_device *dev) | |||
2533 | * RETURNS: | 2534 | * RETURNS: |
2534 | * 0 on success, negative errno otherwise | 2535 | * 0 on success, negative errno otherwise |
2535 | */ | 2536 | */ |
2536 | int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | 2537 | |
2538 | int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
2537 | { | 2539 | { |
2538 | struct ata_device *dev; | 2540 | struct ata_device *dev; |
2539 | int i, rc = 0, used_dma = 0, found = 0; | 2541 | int i, rc = 0, used_dma = 0, found = 0; |
2540 | 2542 | ||
2541 | /* has private set_mode? */ | ||
2542 | if (ap->ops->set_mode) | ||
2543 | return ap->ops->set_mode(ap, r_failed_dev); | ||
2544 | 2543 | ||
2545 | /* step 1: calculate xfer_mask */ | 2544 | /* step 1: calculate xfer_mask */ |
2546 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2545 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
@@ -2625,6 +2624,29 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2625 | } | 2624 | } |
2626 | 2625 | ||
2627 | /** | 2626 | /** |
2627 | * ata_set_mode - Program timings and issue SET FEATURES - XFER | ||
2628 | * @ap: port on which timings will be programmed | ||
2629 | * @r_failed_dev: out paramter for failed device | ||
2630 | * | ||
2631 | * Set ATA device disk transfer mode (PIO3, UDMA6, etc.). If | ||
2632 | * ata_set_mode() fails, pointer to the failing device is | ||
2633 | * returned in @r_failed_dev. | ||
2634 | * | ||
2635 | * LOCKING: | ||
2636 | * PCI/etc. bus probe sem. | ||
2637 | * | ||
2638 | * RETURNS: | ||
2639 | * 0 on success, negative errno otherwise | ||
2640 | */ | ||
2641 | int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
2642 | { | ||
2643 | /* has private set_mode? */ | ||
2644 | if (ap->ops->set_mode) | ||
2645 | return ap->ops->set_mode(ap, r_failed_dev); | ||
2646 | return ata_do_set_mode(ap, r_failed_dev); | ||
2647 | } | ||
2648 | |||
2649 | /** | ||
2628 | * ata_tf_to_host - issue ATA taskfile to host controller | 2650 | * ata_tf_to_host - issue ATA taskfile to host controller |
2629 | * @ap: port to which command is being issued | 2651 | * @ap: port to which command is being issued |
2630 | * @tf: ATA taskfile register set | 2652 | * @tf: ATA taskfile register set |
@@ -6413,6 +6435,7 @@ EXPORT_SYMBOL_GPL(ata_altstatus); | |||
6413 | EXPORT_SYMBOL_GPL(ata_exec_command); | 6435 | EXPORT_SYMBOL_GPL(ata_exec_command); |
6414 | EXPORT_SYMBOL_GPL(ata_port_start); | 6436 | EXPORT_SYMBOL_GPL(ata_port_start); |
6415 | EXPORT_SYMBOL_GPL(ata_interrupt); | 6437 | EXPORT_SYMBOL_GPL(ata_interrupt); |
6438 | EXPORT_SYMBOL_GPL(ata_do_set_mode); | ||
6416 | EXPORT_SYMBOL_GPL(ata_data_xfer); | 6439 | EXPORT_SYMBOL_GPL(ata_data_xfer); |
6417 | EXPORT_SYMBOL_GPL(ata_data_xfer_noirq); | 6440 | EXPORT_SYMBOL_GPL(ata_data_xfer_noirq); |
6418 | EXPORT_SYMBOL_GPL(ata_qc_prep); | 6441 | EXPORT_SYMBOL_GPL(ata_qc_prep); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 3451ef97a931..c145d9df04d0 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -831,6 +831,7 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev); | |||
831 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | 831 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, |
832 | int queue_depth); | 832 | int queue_depth); |
833 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 833 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
834 | extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); | ||
834 | extern u8 ata_irq_on(struct ata_port *ap); | 835 | extern u8 ata_irq_on(struct ata_port *ap); |
835 | extern u8 ata_dummy_irq_on(struct ata_port *ap); | 836 | extern u8 ata_dummy_irq_on(struct ata_port *ap); |
836 | extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); | 837 | extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); |