diff options
author | Mark Lord <liml@rtr.ca> | 2008-05-02 14:02:28 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-06 11:38:25 -0400 |
commit | c46938ccfe35a58a0873715ee4c26fc9eb8d87b3 (patch) | |
tree | 786202a85f5a93bc4514dfa395929a0396cfacb9 | |
parent | 4c299ca3649ccf666819e7d4a27a68c39fa174f1 (diff) |
sata_mv use hweight16() for bit counting (V2)
Some tidying as suggested by Grant Grundler.
Nuke local bit-counting function from sata_mv in favour of using hweight16().
Also add a short explanation for the 15msec timeout used when waiting for empty/idle.
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/ata/sata_mv.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index b948dc866e04..bb73b2222627 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <linux/platform_device.h> | 65 | #include <linux/platform_device.h> |
66 | #include <linux/ata_platform.h> | 66 | #include <linux/ata_platform.h> |
67 | #include <linux/mbus.h> | 67 | #include <linux/mbus.h> |
68 | #include <linux/bitops.h> | ||
68 | #include <scsi/scsi_host.h> | 69 | #include <scsi/scsi_host.h> |
69 | #include <scsi/scsi_cmnd.h> | 70 | #include <scsi/scsi_cmnd.h> |
70 | #include <scsi/scsi_device.h> | 71 | #include <scsi/scsi_device.h> |
@@ -903,6 +904,10 @@ static void mv_wait_for_edma_empty_idle(struct ata_port *ap) | |||
903 | 904 | ||
904 | /* | 905 | /* |
905 | * Wait for the EDMA engine to finish transactions in progress. | 906 | * Wait for the EDMA engine to finish transactions in progress. |
907 | * No idea what a good "timeout" value might be, but measurements | ||
908 | * indicate that it often requires hundreds of microseconds | ||
909 | * with two drives in-use. So we use the 15msec value above | ||
910 | * as a rough guess at what even more drives might require. | ||
906 | */ | 911 | */ |
907 | for (i = 0; i < timeout; ++i) { | 912 | for (i = 0; i < timeout; ++i) { |
908 | u32 edma_stat = readl(port_mmio + EDMA_STATUS_OFS); | 913 | u32 edma_stat = readl(port_mmio + EDMA_STATUS_OFS); |
@@ -1640,17 +1645,6 @@ static unsigned int mv_get_err_pmp_map(struct ata_port *ap) | |||
1640 | return readl(port_mmio + SATA_TESTCTL_OFS) >> 16; | 1645 | return readl(port_mmio + SATA_TESTCTL_OFS) >> 16; |
1641 | } | 1646 | } |
1642 | 1647 | ||
1643 | static int mv_count_pmp_links(unsigned int pmp_map) | ||
1644 | { | ||
1645 | unsigned int link_count = 0; | ||
1646 | |||
1647 | while (pmp_map) { | ||
1648 | link_count += (pmp_map & 1); | ||
1649 | pmp_map >>= 1; | ||
1650 | } | ||
1651 | return link_count; | ||
1652 | } | ||
1653 | |||
1654 | static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) | 1648 | static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) |
1655 | { | 1649 | { |
1656 | struct ata_eh_info *ehi; | 1650 | struct ata_eh_info *ehi; |
@@ -1701,7 +1695,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) | |||
1701 | pp->delayed_eh_pmp_map = new_map; | 1695 | pp->delayed_eh_pmp_map = new_map; |
1702 | mv_pmp_eh_prep(ap, new_map & ~old_map); | 1696 | mv_pmp_eh_prep(ap, new_map & ~old_map); |
1703 | } | 1697 | } |
1704 | failed_links = mv_count_pmp_links(new_map); | 1698 | failed_links = hweight16(new_map); |
1705 | 1699 | ||
1706 | ata_port_printk(ap, KERN_INFO, "%s: pmp_map=%04x qc_map=%04x " | 1700 | ata_port_printk(ap, KERN_INFO, "%s: pmp_map=%04x qc_map=%04x " |
1707 | "failed_links=%d nr_active_links=%d\n", | 1701 | "failed_links=%d nr_active_links=%d\n", |