[PATCH 05/23] mci: omap: use IS_ENABLED() rather than #ifdef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While touching it propagate the errors from read/write functions instead
of silently ignoring them.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/mci/omap_hsmmc.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index 9e7ecabf85..d8e40aba20 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -352,7 +352,6 @@ static int mmc_read_data(struct omap_hsmmc *hsmmc, char *buf, unsigned int size)
 	return 0;
 }
 
-#ifdef CONFIG_MCI_WRITE
 static int mmc_write_data(struct omap_hsmmc *hsmmc, const char *buf, unsigned int size)
 {
 	struct hsmmc *mmc_base = hsmmc->base;
@@ -406,7 +405,6 @@ static int mmc_write_data(struct omap_hsmmc *hsmmc, const char *buf, unsigned in
 	}
 	return 0;
 }
-#endif
 
 static int mmc_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 		struct mci_data *data)
@@ -517,13 +515,18 @@ static int mmc_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 		}
 	}
 
-	if (data && (data->flags & MMC_DATA_READ))
-		mmc_read_data(hsmmc, data->dest, data->blocksize * data->blocks);
-#ifdef CONFIG_MCI_WRITE
-	else if (data && (data->flags & MMC_DATA_WRITE))
-		mmc_write_data(hsmmc, data->src, data->blocksize * data->blocks);
-#endif
-	return 0;
+	if (!data)
+		return 0;
+
+	if (data->flags & MMC_DATA_READ)
+		return mmc_read_data(hsmmc, data->dest,
+				     data->blocksize * data->blocks);
+
+	if (IS_ENABLED(CONFIG_MCI_WRITE))
+		return mmc_write_data(hsmmc, data->src,
+				      data->blocksize * data->blocks);
+
+	return -ENOSYS;
 }
 
 static void mmc_set_ios(struct mci_host *mci, struct mci_ios *ios)
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux