* [PATCH #upstream] ahci: misc cleanups for EM stuff
@ 2009-04-27 23:42 Tejun Heo
2009-04-28 14:40 ` David Milburn
2009-05-11 18:13 ` Jeff Garzik
0 siblings, 2 replies; 5+ messages in thread
From: Tejun Heo @ 2009-04-27 23:42 UTC (permalink / raw)
To: Jeff Garzik, IDE/ATA development list, David Milburn
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/
[ Impact: cleanup, use of longer and fewer msleep() instead of udelay() ]
Signed-off-by: Tejun Heo <tj@kernel.org>
---
drivers/ata/ahci.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 3489085..65677b0 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -77,8 +77,8 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
size_t size);
static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
ssize_t size);
-#define MAX_SLOTS 8
-#define MAX_RETRY 15
+#define EM_MAX_SLOTS 8
+#define EM_MAX_RETRY 5
enum {
AHCI_PCI_BAR = 5,
@@ -281,8 +281,8 @@ struct ahci_port_priv {
unsigned int ncq_saw_dmas:1;
unsigned int ncq_saw_sdb:1;
u32 intr_mask; /* interrupts to enable */
- struct ahci_em_priv em_priv[MAX_SLOTS];/* enclosure management info
- * per PM slot */
+ /* enclosure management info per PM slot */
+ struct ahci_em_priv em_priv[EM_MAX_SLOTS];
};
static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
@@ -1139,12 +1139,12 @@ static void ahci_start_port(struct ata_port *ap)
emp = &pp->em_priv[link->pmp];
/* EM Transmit bit maybe busy during init */
- for (i = 0; i < MAX_RETRY; i++) {
+ for (i = 0; i < EM_MAX_RETRY; i++) {
rc = ahci_transmit_led_message(ap,
emp->led_state,
4);
if (rc == -EBUSY)
- udelay(100);
+ msleep(1);
else
break;
}
@@ -1338,7 +1338,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
/* get the slot number from the message */
pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
- if (pmp < MAX_SLOTS)
+ if (pmp < EM_MAX_SLOTS)
emp = &pp->em_priv[pmp];
else
return -EINVAL;
@@ -1406,7 +1406,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
/* get the slot number from the message */
pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
- if (pmp < MAX_SLOTS)
+ if (pmp < EM_MAX_SLOTS)
emp = &pp->em_priv[pmp];
else
return -EINVAL;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH #upstream] ahci: misc cleanups for EM stuff
2009-04-27 23:42 [PATCH #upstream] ahci: misc cleanups for EM stuff Tejun Heo
@ 2009-04-28 14:40 ` David Milburn
2009-05-11 18:13 ` Jeff Garzik
1 sibling, 0 replies; 5+ messages in thread
From: David Milburn @ 2009-04-28 14:40 UTC (permalink / raw)
To: Tejun Heo; +Cc: jeff, linux-ide
On Tue, Apr 28, 2009 at 08:42:52AM +0900, Tejun Heo wrote:
> 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/
>
> [ Impact: cleanup, use of longer and fewer msleep() instead of udelay() ]
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
Thanks Tejun, that should work fine.
Acked-by: David Milburn <dmilburn@redhat.com>
> ---
> drivers/ata/ahci.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 3489085..65677b0 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -77,8 +77,8 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
> size_t size);
> static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
> ssize_t size);
> -#define MAX_SLOTS 8
> -#define MAX_RETRY 15
> +#define EM_MAX_SLOTS 8
> +#define EM_MAX_RETRY 5
>
> enum {
> AHCI_PCI_BAR = 5,
> @@ -281,8 +281,8 @@ struct ahci_port_priv {
> unsigned int ncq_saw_dmas:1;
> unsigned int ncq_saw_sdb:1;
> u32 intr_mask; /* interrupts to enable */
> - struct ahci_em_priv em_priv[MAX_SLOTS];/* enclosure management info
> - * per PM slot */
> + /* enclosure management info per PM slot */
> + struct ahci_em_priv em_priv[EM_MAX_SLOTS];
> };
>
> static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
> @@ -1139,12 +1139,12 @@ static void ahci_start_port(struct ata_port *ap)
> emp = &pp->em_priv[link->pmp];
>
> /* EM Transmit bit maybe busy during init */
> - for (i = 0; i < MAX_RETRY; i++) {
> + for (i = 0; i < EM_MAX_RETRY; i++) {
> rc = ahci_transmit_led_message(ap,
> emp->led_state,
> 4);
> if (rc == -EBUSY)
> - udelay(100);
> + msleep(1);
> else
> break;
> }
> @@ -1338,7 +1338,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
>
> /* get the slot number from the message */
> pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
> - if (pmp < MAX_SLOTS)
> + if (pmp < EM_MAX_SLOTS)
> emp = &pp->em_priv[pmp];
> else
> return -EINVAL;
> @@ -1406,7 +1406,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
>
> /* get the slot number from the message */
> pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
> - if (pmp < MAX_SLOTS)
> + if (pmp < EM_MAX_SLOTS)
> emp = &pp->em_priv[pmp];
> else
> return -EINVAL;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH #upstream] ahci: misc cleanups for EM stuff
2009-04-27 23:42 [PATCH #upstream] ahci: misc cleanups for EM stuff Tejun Heo
2009-04-28 14:40 ` David Milburn
@ 2009-05-11 18:13 ` Jeff Garzik
2009-05-12 1:57 ` [PATCH UPDATED " Tejun Heo
1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2009-05-11 18:13 UTC (permalink / raw)
To: Tejun Heo; +Cc: IDE/ATA development list, David Milburn
Tejun Heo wrote:
> 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/
>
> [ Impact: cleanup, use of longer and fewer msleep() instead of udelay() ]
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
> drivers/ata/ahci.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 3489085..65677b0 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -77,8 +77,8 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
> size_t size);
> static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
> ssize_t size);
> -#define MAX_SLOTS 8
> -#define MAX_RETRY 15
> +#define EM_MAX_SLOTS 8
> +#define EM_MAX_RETRY 5
>
> enum {
> AHCI_PCI_BAR = 5,
If you are going to change this, please move these into 'enum' where
they belong...
Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH UPDATED #upstream] ahci: misc cleanups for EM stuff
2009-05-11 18:13 ` Jeff Garzik
@ 2009-05-12 1:57 ` Tejun Heo
2009-05-20 20:12 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2009-05-12 1:57 UTC (permalink / raw)
To: Jeff Garzik; +Cc: IDE/ATA development list, David Milburn
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>
---
drivers/ata/ahci.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 3489085..2af686a 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,
size_t size);
static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
ssize_t size);
-#define MAX_SLOTS 8
-#define MAX_RETRY 15
enum {
AHCI_PCI_BAR = 5,
@@ -230,6 +228,10 @@ enum {
ICH_MAP = 0x90, /* ICH MAP register */
+ /* em constants */
+ EM_MAX_SLOTS = 8,
+ EM_MAX_RETRY = 5,
+
/* em_ctl bits */
EM_CTL_RST = (1 << 9), /* Reset */
EM_CTL_TM = (1 << 8), /* Transmit Message */
@@ -281,8 +283,8 @@ struct ahci_port_priv {
unsigned int ncq_saw_dmas:1;
unsigned int ncq_saw_sdb:1;
u32 intr_mask; /* interrupts to enable */
- struct ahci_em_priv em_priv[MAX_SLOTS];/* enclosure management info
- * per PM slot */
+ /* enclosure management info per PM slot */
+ struct ahci_em_priv em_priv[EM_MAX_SLOTS];
};
static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
@@ -1139,12 +1141,12 @@ static void ahci_start_port(struct ata_port *ap)
emp = &pp->em_priv[link->pmp];
/* EM Transmit bit maybe busy during init */
- for (i = 0; i < MAX_RETRY; i++) {
+ for (i = 0; i < EM_MAX_RETRY; i++) {
rc = ahci_transmit_led_message(ap,
emp->led_state,
4);
if (rc == -EBUSY)
- udelay(100);
+ msleep(1);
else
break;
}
@@ -1338,7 +1340,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
/* get the slot number from the message */
pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
- if (pmp < MAX_SLOTS)
+ if (pmp < EM_MAX_SLOTS)
emp = &pp->em_priv[pmp];
else
return -EINVAL;
@@ -1406,7 +1408,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
/* get the slot number from the message */
pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
- if (pmp < MAX_SLOTS)
+ if (pmp < EM_MAX_SLOTS)
emp = &pp->em_priv[pmp];
else
return -EINVAL;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH UPDATED #upstream] ahci: misc cleanups for EM stuff
2009-05-12 1:57 ` [PATCH UPDATED " Tejun Heo
@ 2009-05-20 20:12 ` Jeff Garzik
0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2009-05-20 20:12 UTC (permalink / raw)
To: Tejun Heo; +Cc: IDE/ATA development list, David Milburn
Tejun Heo wrote:
> 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>
> ---
> drivers/ata/ahci.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
applied
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-20 20:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-27 23:42 [PATCH #upstream] ahci: misc cleanups for EM stuff Tejun Heo
2009-04-28 14:40 ` David Milburn
2009-05-11 18:13 ` Jeff Garzik
2009-05-12 1:57 ` [PATCH UPDATED " Tejun Heo
2009-05-20 20:12 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).