summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Lord <liml@rtr.ca>2008-05-02 14:02:28 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-05-06 11:38:25 -0400
commitc46938ccfe35a58a0873715ee4c26fc9eb8d87b3 (patch)
tree786202a85f5a93bc4514dfa395929a0396cfacb9 /drivers
parent4c299ca3649ccf666819e7d4a27a68c39fa174f1 (diff)
downloadop-kernel-dev-c46938ccfe35a58a0873715ee4c26fc9eb8d87b3.zip
op-kernel-dev-c46938ccfe35a58a0873715ee4c26fc9eb8d87b3.tar.gz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/sata_mv.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index b948dc8..bb73b22 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -65,6 +65,7 @@
#include <linux/platform_device.h>
#include <linux/ata_platform.h>
#include <linux/mbus.h>
+#include <linux/bitops.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
@@ -903,6 +904,10 @@ static void mv_wait_for_edma_empty_idle(struct ata_port *ap)
/*
* Wait for the EDMA engine to finish transactions in progress.
+ * No idea what a good "timeout" value might be, but measurements
+ * indicate that it often requires hundreds of microseconds
+ * with two drives in-use. So we use the 15msec value above
+ * as a rough guess at what even more drives might require.
*/
for (i = 0; i < timeout; ++i) {
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)
return readl(port_mmio + SATA_TESTCTL_OFS) >> 16;
}
-static int mv_count_pmp_links(unsigned int pmp_map)
-{
- unsigned int link_count = 0;
-
- while (pmp_map) {
- link_count += (pmp_map & 1);
- pmp_map >>= 1;
- }
- return link_count;
-}
-
static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map)
{
struct ata_eh_info *ehi;
@@ -1701,7 +1695,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap)
pp->delayed_eh_pmp_map = new_map;
mv_pmp_eh_prep(ap, new_map & ~old_map);
}
- failed_links = mv_count_pmp_links(new_map);
+ failed_links = hweight16(new_map);
ata_port_printk(ap, KERN_INFO, "%s: pmp_map=%04x qc_map=%04x "
"failed_links=%d nr_active_links=%d\n",
OpenPOWER on IntegriCloud