From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/3] mci: imx-esdhc: Check for errors in esdhc_pio_read_write
Date: Wed, 13 May 2015 08:20:36 +0200 [thread overview]
Message-ID: <1431498037-31789-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1431498037-31789-1-git-send-email-s.hauer@pengutronix.de>
esdhc_pio_read_write can fail, so let it return an error code
rather than void.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/imx-esdhc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 178967a..f310213 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -93,7 +93,7 @@ static u32 esdhc_xfertyp(struct mci_cmd *cmd, struct mci_data *data)
/*
* PIO Read/Write Mode reduce the performace as DMA is not used in this mode.
*/
-static void
+static int
esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data)
{
struct fsl_esdhc_host *host = to_fsl_esdhc(mci);
@@ -116,7 +116,7 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data)
&& --timeout);
if (timeout <= 0) {
printf("\nData Read Failed in PIO Mode.");
- return;
+ return -ETIMEDOUT;
}
while (size && (!(irqstat & IRQSTAT_TC))) {
udelay(100); /* Wait before last byte transfer complete */
@@ -139,7 +139,7 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data)
&& --timeout);
if (timeout <= 0) {
printf("\nData Write Failed in PIO Mode.");
- return;
+ return -ETIMEDOUT;
}
while (size && (!(irqstat & IRQSTAT_TC))) {
udelay(100); /* Wait before last byte transfer complete */
@@ -152,6 +152,8 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data)
blocks--;
}
}
+
+ return 0;
}
static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data)
@@ -206,10 +208,8 @@ static int esdhc_do_data(struct mci_host *mci, struct mci_data *data)
unsigned int num_bytes = data->blocks * data->blocksize;
u32 irqstat;
- if (IS_ENABLED(CONFIG_MCI_IMX_ESDHC_PIO)) {
- esdhc_pio_read_write(mci, data);
- return 0;
- }
+ if (IS_ENABLED(CONFIG_MCI_IMX_ESDHC_PIO))
+ return esdhc_pio_read_write(mci, data);
do {
irqstat = esdhc_read32(regs + SDHCI_INT_STATUS);
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-05-13 6:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 6:20 [PATCH 1/3] mci: imx-esdhc: Use IS_ENABLED() instead of #ifdef Sascha Hauer
2015-05-13 6:20 ` Sascha Hauer [this message]
2015-05-13 6:20 ` [PATCH 3/3] mci: imx-esdhc: Replace printf with dev_* Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431498037-31789-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox