diff mbox

[07/10] mmc: omap_hsmmc: consolidate flush posted writes for HSMMC IRQs

Message ID 1345229550-8672-8-git-send-email-svenkatr@ti.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Venkatraman S Aug. 17, 2012, 6:52 p.m. UTC
Flushing spurious IRQs from HSMMC IP is done twice in
omap_hsmmc_irq and omap_hsmmc_do_irq.
Consolidate them to one location.

Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Comments

Balaji T K Aug. 21, 2012, 3:21 p.m. UTC | #1
On Sat, Aug 18, 2012 at 12:22 AM, Venkatraman S <svenkatr@ti.com> wrote:
> Flushing spurious IRQs from HSMMC IP is done twice in
> omap_hsmmc_irq and omap_hsmmc_do_irq.

spurious IRQ is flushed in start of omap_hsmmc_do_irq
and irq acked at the end of omap_hsmmc_do_irq

> Consolidate them to one location.

if you wanted to consolidated ...

>
> Signed-off-by: Venkatraman S <svenkatr@ti.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 4bc55ac..20453c8 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -969,15 +969,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
>         struct mmc_data *data;
>         int end_cmd = 0, end_trans = 0;
>
> -       if (!host->req_in_progress) {

just do a return from here

> -               do {
> -                       OMAP_HSMMC_WRITE(host->base, STAT, status);
> -                       /* Flush posted write */
> -                       status = OMAP_HSMMC_READ(host->base, STAT);
> -               } while (status & INT_EN_MASK);
> -               return;
> -       }
> -
>         data = host->data;
>         dev_vdbg(mmc_dev(host->mmc), "IRQ Status is %x\n", status);
>
> @@ -1028,8 +1019,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
>                 }
>         }
>
> -       OMAP_HSMMC_WRITE(host->base, STAT, status);
> -
>         if (end_cmd || ((status & CC) && host->cmd))
>                 omap_hsmmc_cmd_done(host, host->cmd);
>         if ((end_trans || (status & TC)) && host->mrq)
> @@ -1045,11 +1034,13 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
>         int status;
>
>         status = OMAP_HSMMC_READ(host->base, STAT);
> -       do {
> +       while (status & INT_EN_MASK && host->req_in_progress) {

and remove the check for host->req_in_progress
I think do while loop can be retained as it will get executed once anyway.

>                 omap_hsmmc_do_irq(host, status);
> +

>                 /* Flush posted write */

comment is misplaced

> +               OMAP_HSMMC_WRITE(host->base, STAT, status);
>                 status = OMAP_HSMMC_READ(host->base, STAT);
> -       } while (status & INT_EN_MASK);
> +       }
>
>         return IRQ_HANDLED;
>  }
> --
> 1.7.11.1.25.g0e18bef
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Venkatraman S Aug. 27, 2012, 11:02 a.m. UTC | #2
On Tue, Aug 21, 2012 at 8:51 PM, T Krishnamoorthy, Balaji
<balajitk@ti.com> wrote:
> On Sat, Aug 18, 2012 at 12:22 AM, Venkatraman S <svenkatr@ti.com> wrote:
>> Flushing spurious IRQs from HSMMC IP is done twice in
>> omap_hsmmc_irq and omap_hsmmc_do_irq.
>
> spurious IRQ is flushed in start of omap_hsmmc_do_irq
> and irq acked at the end of omap_hsmmc_do_irq
>
>> Consolidate them to one location.
>
> if you wanted to consolidated ...
>
>>
>> Signed-off-by: Venkatraman S <svenkatr@ti.com>
>> ---
>>  drivers/mmc/host/omap_hsmmc.c | 17 ++++-------------
>>  1 file changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 4bc55ac..20453c8 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -969,15 +969,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
>>         struct mmc_data *data;
>>         int end_cmd = 0, end_trans = 0;
>>
>> -       if (!host->req_in_progress) {
>
> just do a return from here

I think it's still better to filter out the validation to the outer
function and let do_irq to just 'do' it.

>
>> -               do {
>> -                       OMAP_HSMMC_WRITE(host->base, STAT, status);
>> -                       /* Flush posted write */
>> -                       status = OMAP_HSMMC_READ(host->base, STAT);
>> -               } while (status & INT_EN_MASK);
>> -               return;
>> -       }
>> -
>>         data = host->data;
>>         dev_vdbg(mmc_dev(host->mmc), "IRQ Status is %x\n", status);
>>
>> @@ -1028,8 +1019,6 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
>>                 }
>>         }
>>
>> -       OMAP_HSMMC_WRITE(host->base, STAT, status);
>> -
>>         if (end_cmd || ((status & CC) && host->cmd))
>>                 omap_hsmmc_cmd_done(host, host->cmd);
>>         if ((end_trans || (status & TC)) && host->mrq)
>> @@ -1045,11 +1034,13 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
>>         int status;
>>
>>         status = OMAP_HSMMC_READ(host->base, STAT);
>> -       do {
>> +       while (status & INT_EN_MASK && host->req_in_progress) {
>
> and remove the check for host->req_in_progress
> I think do while loop can be retained as it will get executed once anyway.

It's a minor issue, and the consolidation of the check for
req_in_progress makes sure that it might
sometimes be not executed at all..


>
>>                 omap_hsmmc_do_irq(host, status);
>> +
>
>>                 /* Flush posted write */
>
> comment is misplaced
>
Ok. I'll remove.

>> +               OMAP_HSMMC_WRITE(host->base, STAT, status);
>>                 status = OMAP_HSMMC_READ(host->base, STAT);
>> -       } while (status & INT_EN_MASK);
>> +       }
>>
>>         return IRQ_HANDLED;
>>  }
>> --
>> 1.7.11.1.25.g0e18bef
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 4bc55ac..20453c8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -969,15 +969,6 @@  static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 	struct mmc_data *data;
 	int end_cmd = 0, end_trans = 0;
 
-	if (!host->req_in_progress) {
-		do {
-			OMAP_HSMMC_WRITE(host->base, STAT, status);
-			/* Flush posted write */
-			status = OMAP_HSMMC_READ(host->base, STAT);
-		} while (status & INT_EN_MASK);
-		return;
-	}
-
 	data = host->data;
 	dev_vdbg(mmc_dev(host->mmc), "IRQ Status is %x\n", status);
 
@@ -1028,8 +1019,6 @@  static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 		}
 	}
 
-	OMAP_HSMMC_WRITE(host->base, STAT, status);
-
 	if (end_cmd || ((status & CC) && host->cmd))
 		omap_hsmmc_cmd_done(host, host->cmd);
 	if ((end_trans || (status & TC)) && host->mrq)
@@ -1045,11 +1034,13 @@  static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
 	int status;
 
 	status = OMAP_HSMMC_READ(host->base, STAT);
-	do {
+	while (status & INT_EN_MASK && host->req_in_progress) {
 		omap_hsmmc_do_irq(host, status);
+
 		/* Flush posted write */
+		OMAP_HSMMC_WRITE(host->base, STAT, status);
 		status = OMAP_HSMMC_READ(host->base, STAT);
-	} while (status & INT_EN_MASK);
+	}
 
 	return IRQ_HANDLED;
 }