Skip to content

Commit

Permalink
libata-link: linkify config/EH related functions
Browse files Browse the repository at this point in the history
Make the following functions deal with ata_link instead of ata_port.

* ata_set_mode()
* ata_eh_autopsy() and related functions
* ata_eh_report() and related functions
* suspend/resume related functions
* ata_eh_recover() and related functions

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Oct 12, 2007
1 parent cc0680a commit 0260731
Show file tree
Hide file tree
Showing 15 changed files with 122 additions and 111 deletions.
7 changes: 4 additions & 3 deletions drivers/ata/ata_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

/**
* generic_set_mode - mode setting
* @ap: interface to set up
* @link: link to set up
* @unused: returned device on error
*
* Use a non standard set_mode function. We don't want to be tuned.
Expand All @@ -43,16 +43,17 @@
* and respect them.
*/

static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
{
struct ata_port *ap = link->ap;
int dma_enabled = 0;
struct ata_device *dev;

/* Bits 5 and 6 indicate if DMA is active on master/slave */
if (ap->ioaddr.bmdma_addr)
dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);

ata_link_for_each_dev(dev, &ap->link) {
ata_link_for_each_dev(dev, link) {
if (ata_dev_enabled(dev)) {
/* We don't really care */
dev->pio_mode = XFER_PIO_0;
Expand Down
18 changes: 10 additions & 8 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ int ata_bus_probe(struct ata_port *ap)
}

/* configure transfer mode */
rc = ata_set_mode(ap, &dev);
rc = ata_set_mode(&ap->link, &dev);
if (rc)
goto fail;

Expand Down Expand Up @@ -2782,7 +2782,7 @@ static int ata_dev_set_mode(struct ata_device *dev)

/**
* ata_do_set_mode - Program timings and issue SET FEATURES - XFER
* @ap: port on which timings will be programmed
* @link: link on which timings will be programmed
* @r_failed_dev: out paramter for failed device
*
* Standard implementation of the function used to tune and set
Expand All @@ -2797,9 +2797,9 @@ static int ata_dev_set_mode(struct ata_device *dev)
* 0 on success, negative errno otherwise
*/

int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
{
struct ata_link *link = &ap->link;
struct ata_port *ap = link->ap;
struct ata_device *dev;
int rc = 0, used_dma = 0, found = 0;

Expand Down Expand Up @@ -2877,7 +2877,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)

/**
* ata_set_mode - Program timings and issue SET FEATURES - XFER
* @ap: port on which timings will be programmed
* @link: link on which timings will be programmed
* @r_failed_dev: out paramter for failed device
*
* Set ATA device disk transfer mode (PIO3, UDMA6, etc.). If
Expand All @@ -2890,12 +2890,14 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
* RETURNS:
* 0 on success, negative errno otherwise
*/
int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
{
struct ata_port *ap = link->ap;

/* has private set_mode? */
if (ap->ops->set_mode)
return ap->ops->set_mode(ap, r_failed_dev);
return ata_do_set_mode(ap, r_failed_dev);
return ap->ops->set_mode(link, r_failed_dev);
return ata_do_set_mode(link, r_failed_dev);
}

/**
Expand Down
Loading

0 comments on commit 0260731

Please sign in to comment.