aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-11 21:57:41 -0400
committerJeff Garzik <jgarzik@redhat.com>2009-06-10 07:50:17 -0400
commitd50ce07d6fd8a422757a231f9d7293cbddeaec31 (patch)
tree27fdf48eb56e171a60da15156162758fedf84021 /drivers
parent437681800bdaa9feb58cf943dfbbd239c21d3705 (diff)
ahci: misc cleanups for EM stuff
Make the following EM related cleanups. * Use msleep(1) instead of udelay(100) and reduce retry count to 5. * s/MAX_SLOTS/EM_MAX_SLOTS/, s/MAX_RETRY/EM_MAX_RETRY/ * Make EM constants enums as suggested by Jeff. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: David Milburn <dmilburn@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index cd832cb69492..2141a31f176b 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -77,8 +77,6 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
77 size_t size); 77 size_t size);
78static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, 78static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
79 ssize_t size); 79 ssize_t size);
80#define MAX_SLOTS 8
81#define MAX_RETRY 15
82 80
83enum { 81enum {
84 AHCI_PCI_BAR = 5, 82 AHCI_PCI_BAR = 5,
@@ -231,6 +229,10 @@ enum {
231 229
232 ICH_MAP = 0x90, /* ICH MAP register */ 230 ICH_MAP = 0x90, /* ICH MAP register */
233 231
232 /* em constants */
233 EM_MAX_SLOTS = 8,
234 EM_MAX_RETRY = 5,
235
234 /* em_ctl bits */ 236 /* em_ctl bits */
235 EM_CTL_RST = (1 << 9), /* Reset */ 237 EM_CTL_RST = (1 << 9), /* Reset */
236 EM_CTL_TM = (1 << 8), /* Transmit Message */ 238 EM_CTL_TM = (1 << 8), /* Transmit Message */
@@ -282,8 +284,8 @@ struct ahci_port_priv {
282 unsigned int ncq_saw_dmas:1; 284 unsigned int ncq_saw_dmas:1;
283 unsigned int ncq_saw_sdb:1; 285 unsigned int ncq_saw_sdb:1;
284 u32 intr_mask; /* interrupts to enable */ 286 u32 intr_mask; /* interrupts to enable */
285 struct ahci_em_priv em_priv[MAX_SLOTS];/* enclosure management info 287 /* enclosure management info per PM slot */
286 * per PM slot */ 288 struct ahci_em_priv em_priv[EM_MAX_SLOTS];
287}; 289};
288 290
289static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); 291static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
@@ -1140,12 +1142,12 @@ static void ahci_start_port(struct ata_port *ap)
1140 emp = &pp->em_priv[link->pmp]; 1142 emp = &pp->em_priv[link->pmp];
1141 1143
1142 /* EM Transmit bit maybe busy during init */ 1144 /* EM Transmit bit maybe busy during init */
1143 for (i = 0; i < MAX_RETRY; i++) { 1145 for (i = 0; i < EM_MAX_RETRY; i++) {
1144 rc = ahci_transmit_led_message(ap, 1146 rc = ahci_transmit_led_message(ap,
1145 emp->led_state, 1147 emp->led_state,
1146 4); 1148 4);
1147 if (rc == -EBUSY) 1149 if (rc == -EBUSY)
1148 udelay(100); 1150 msleep(1);
1149 else 1151 else
1150 break; 1152 break;
1151 } 1153 }
@@ -1339,7 +1341,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1339 1341
1340 /* get the slot number from the message */ 1342 /* get the slot number from the message */
1341 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; 1343 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
1342 if (pmp < MAX_SLOTS) 1344 if (pmp < EM_MAX_SLOTS)
1343 emp = &pp->em_priv[pmp]; 1345 emp = &pp->em_priv[pmp];
1344 else 1346 else
1345 return -EINVAL; 1347 return -EINVAL;
@@ -1407,7 +1409,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
1407 1409
1408 /* get the slot number from the message */ 1410 /* get the slot number from the message */
1409 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; 1411 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
1410 if (pmp < MAX_SLOTS) 1412 if (pmp < EM_MAX_SLOTS)
1411 emp = &pp->em_priv[pmp]; 1413 emp = &pp->em_priv[pmp];
1412 else 1414 else
1413 return -EINVAL; 1415 return -EINVAL;