* [PATCH] mmc: sdhci-pci: simplify error handling
@ 2011-12-03 7:28 Axel Lin
2011-12-05 11:28 ` Adrian Hunter
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2011-12-03 7:28 UTC (permalink / raw)
To: linux-kernel; +Cc: Chris Ball, Adrian Hunter, Takashi Iwai, linux-mmc
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mmc/host/sdhci-pci.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 6878a94..d2e77fb 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -1012,11 +1012,8 @@ static int sdhci_pci_suspend(struct device *dev)
ret = sdhci_suspend_host(slot->host);
- if (ret) {
- for (i--; i >= 0; i--)
- sdhci_resume_host(chip->slots[i]->host);
- return ret;
- }
+ if (ret)
+ goto err_pci_suspend;
slot_pm_flags = slot->host->mmc->pm_flags;
if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
@@ -1027,11 +1024,8 @@ static int sdhci_pci_suspend(struct device *dev)
if (chip->fixes && chip->fixes->suspend) {
ret = chip->fixes->suspend(chip);
- if (ret) {
- for (i = chip->num_slots - 1; i >= 0; i--)
- sdhci_resume_host(chip->slots[i]->host);
- return ret;
- }
+ if (ret)
+ goto err_pci_suspend;
}
pci_save_state(pdev);
@@ -1048,6 +1042,11 @@ static int sdhci_pci_suspend(struct device *dev)
}
return 0;
+
+err_pci_suspend:
+ while (--i >= 0)
+ sdhci_resume_host(chip->slots[i]->host);
+ return ret;
}
static int sdhci_pci_resume(struct device *dev)
@@ -1113,23 +1112,22 @@ static int sdhci_pci_runtime_suspend(struct device *dev)
ret = sdhci_runtime_suspend_host(slot->host);
- if (ret) {
- for (i--; i >= 0; i--)
- sdhci_runtime_resume_host(chip->slots[i]->host);
- return ret;
- }
+ if (ret)
+ goto err_pci_runtime_suspend;
}
if (chip->fixes && chip->fixes->suspend) {
ret = chip->fixes->suspend(chip);
- if (ret) {
- for (i = chip->num_slots - 1; i >= 0; i--)
- sdhci_runtime_resume_host(chip->slots[i]->host);
- return ret;
- }
+ if (ret)
+ goto err_pci_runtime_suspend;
}
return 0;
+
+err_pci_runtime_suspend:
+ while (--i >= 0)
+ sdhci_runtime_resume_host(chip->slots[i]->host);
+ return ret;
}
static int sdhci_pci_runtime_resume(struct device *dev)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sdhci-pci: simplify error handling
2011-12-03 7:28 [PATCH] mmc: sdhci-pci: simplify error handling Axel Lin
@ 2011-12-05 11:28 ` Adrian Hunter
2011-12-08 3:53 ` Chris Ball
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2011-12-05 11:28 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Chris Ball, Takashi Iwai, linux-mmc
On 03/12/11 09:28, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-pci.c | 38 ++++++++++++++++++--------------------
> 1 files changed, 18 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
> index 6878a94..d2e77fb 100644
> --- a/drivers/mmc/host/sdhci-pci.c
> +++ b/drivers/mmc/host/sdhci-pci.c
> @@ -1012,11 +1012,8 @@ static int sdhci_pci_suspend(struct device *dev)
>
> ret = sdhci_suspend_host(slot->host);
>
> - if (ret) {
> - for (i--; i >= 0; i--)
> - sdhci_resume_host(chip->slots[i]->host);
> - return ret;
> - }
> + if (ret)
> + goto err_pci_suspend;
>
> slot_pm_flags = slot->host->mmc->pm_flags;
> if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
> @@ -1027,11 +1024,8 @@ static int sdhci_pci_suspend(struct device *dev)
>
> if (chip->fixes && chip->fixes->suspend) {
> ret = chip->fixes->suspend(chip);
> - if (ret) {
> - for (i = chip->num_slots - 1; i >= 0; i--)
> - sdhci_resume_host(chip->slots[i]->host);
> - return ret;
> - }
> + if (ret)
> + goto err_pci_suspend;
> }
>
> pci_save_state(pdev);
> @@ -1048,6 +1042,11 @@ static int sdhci_pci_suspend(struct device *dev)
> }
>
> return 0;
> +
> +err_pci_suspend:
> + while (--i >= 0)
> + sdhci_resume_host(chip->slots[i]->host);
> + return ret;
> }
>
> static int sdhci_pci_resume(struct device *dev)
> @@ -1113,23 +1112,22 @@ static int sdhci_pci_runtime_suspend(struct device *dev)
>
> ret = sdhci_runtime_suspend_host(slot->host);
>
> - if (ret) {
> - for (i--; i >= 0; i--)
> - sdhci_runtime_resume_host(chip->slots[i]->host);
> - return ret;
> - }
> + if (ret)
> + goto err_pci_runtime_suspend;
> }
>
> if (chip->fixes && chip->fixes->suspend) {
> ret = chip->fixes->suspend(chip);
> - if (ret) {
> - for (i = chip->num_slots - 1; i >= 0; i--)
> - sdhci_runtime_resume_host(chip->slots[i]->host);
> - return ret;
> - }
> + if (ret)
> + goto err_pci_runtime_suspend;
> }
>
> return 0;
> +
> +err_pci_runtime_suspend:
> + while (--i >= 0)
> + sdhci_runtime_resume_host(chip->slots[i]->host);
> + return ret;
> }
>
> static int sdhci_pci_runtime_resume(struct device *dev)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sdhci-pci: simplify error handling
2011-12-05 11:28 ` Adrian Hunter
@ 2011-12-08 3:53 ` Chris Ball
0 siblings, 0 replies; 3+ messages in thread
From: Chris Ball @ 2011-12-08 3:53 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Axel Lin, linux-kernel, Takashi Iwai, linux-mmc
Hi,
On Mon, Dec 05 2011, Adrian Hunter wrote:
> On 03/12/11 09:28, Axel Lin wrote:
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>> ---
>> drivers/mmc/host/sdhci-pci.c | 38 ++++++++++++++++++--------------------
>> 1 files changed, 18 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
>> index 6878a94..d2e77fb 100644
>> --- a/drivers/mmc/host/sdhci-pci.c
>> +++ b/drivers/mmc/host/sdhci-pci.c
>> @@ -1012,11 +1012,8 @@ static int sdhci_pci_suspend(struct device *dev)
>>
>> ret = sdhci_suspend_host(slot->host);
>>
>> - if (ret) {
>> - for (i--; i >= 0; i--)
>> - sdhci_resume_host(chip->slots[i]->host);
>> - return ret;
>> - }
>> + if (ret)
>> + goto err_pci_suspend;
>>
>> slot_pm_flags = slot->host->mmc->pm_flags;
>> if (slot_pm_flags & MMC_PM_WAKE_SDIO_IRQ)
>> @@ -1027,11 +1024,8 @@ static int sdhci_pci_suspend(struct device *dev)
>>
>> if (chip->fixes && chip->fixes->suspend) {
>> ret = chip->fixes->suspend(chip);
>> - if (ret) {
>> - for (i = chip->num_slots - 1; i >= 0; i--)
>> - sdhci_resume_host(chip->slots[i]->host);
>> - return ret;
>> - }
>> + if (ret)
>> + goto err_pci_suspend;
>> }
>>
>> pci_save_state(pdev);
>> @@ -1048,6 +1042,11 @@ static int sdhci_pci_suspend(struct device *dev)
>> }
>>
>> return 0;
>> +
>> +err_pci_suspend:
>> + while (--i >= 0)
>> + sdhci_resume_host(chip->slots[i]->host);
>> + return ret;
>> }
>>
>> static int sdhci_pci_resume(struct device *dev)
>> @@ -1113,23 +1112,22 @@ static int sdhci_pci_runtime_suspend(struct device *dev)
>>
>> ret = sdhci_runtime_suspend_host(slot->host);
>>
>> - if (ret) {
>> - for (i--; i >= 0; i--)
>> - sdhci_runtime_resume_host(chip->slots[i]->host);
>> - return ret;
>> - }
>> + if (ret)
>> + goto err_pci_runtime_suspend;
>> }
>>
>> if (chip->fixes && chip->fixes->suspend) {
>> ret = chip->fixes->suspend(chip);
>> - if (ret) {
>> - for (i = chip->num_slots - 1; i >= 0; i--)
>> - sdhci_runtime_resume_host(chip->slots[i]->host);
>> - return ret;
>> - }
>> + if (ret)
>> + goto err_pci_runtime_suspend;
>> }
>>
>> return 0;
>> +
>> +err_pci_runtime_suspend:
>> + while (--i >= 0)
>> + sdhci_runtime_resume_host(chip->slots[i]->host);
>> + return ret;
>> }
>>
>> static int sdhci_pci_runtime_resume(struct device *dev)
Thanks, pushed to mmc-next for 3.3 with Adrian's ACK.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-08 3:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-03 7:28 [PATCH] mmc: sdhci-pci: simplify error handling Axel Lin
2011-12-05 11:28 ` Adrian Hunter
2011-12-08 3:53 ` Chris Ball
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).