tmio_mmc cleanup

From: Dmitry Baryshkov <dbaryshkov@gmail.com>

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 7a07c50..af1f19f 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -32,6 +32,7 @@
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/host.h>
 #include <linux/mfd-core.h>
+#include <linux/mfd/tmio.h>
 
 #include "tmio_mmc.h"
 
@@ -165,7 +166,7 @@ tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
 	enable_mmc_irqs(ctl, TMIO_MASK_CMD);
 
 	/* Fire off the command */
-	write_long_reg(cmd->arg, ctl->arg_reg);
+	tmio_iowrite32(cmd->arg, ctl->arg_reg);
 	writew(c, &ctl->sd_cmd);
 }
 
@@ -271,10 +272,10 @@ static inline void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, unsigned int sta
 	 */
 
 	/* FIXME - this works but readl is wrong and will break on asic3... */
-	cmd->resp[3] = read_long_reg(&ctl->response[0]);
-	cmd->resp[2] = read_long_reg(&ctl->response[2]);
-	cmd->resp[1] = read_long_reg(&ctl->response[4]);
-	cmd->resp[0] = read_long_reg(&ctl->response[6]);
+	cmd->resp[3] = tmio_ioread32(&ctl->response[0]);
+	cmd->resp[2] = tmio_ioread32(&ctl->response[2]);
+	cmd->resp[1] = tmio_ioread32(&ctl->response[4]);
+	cmd->resp[0] = tmio_ioread32(&ctl->response[6]);
 
 	if(cmd->flags &  MMC_RSP_136) {
 		cmd->resp[0] = (cmd->resp[0] <<8) | (cmd->resp[1] >>24);
@@ -313,22 +314,22 @@ static irqreturn_t tmio_mmc_irq(int irq, void *devid)
 {
 	struct tmio_mmc_host *host = devid;
 	struct tmio_mmc_ctl __iomem *ctl = host->ctl;
-	unsigned int ireg, mask, status;
+	unsigned int ireg, irq_mask, status;
 
 	DBG("MMC IRQ begin\n");
 
-	status = read_long_reg(ctl->status);
-	mask   = read_long_reg(ctl->irq_mask);
-	ireg   = status & TMIO_MASK_IRQ & ~mask;
+	status = tmio_ioread32(ctl->status);
+	irq_mask   = tmio_ioread32(ctl->irq_mask);
+	ireg   = status & TMIO_MASK_IRQ & ~irq_mask;
 
 #ifdef CONFIG_MMC_DEBUG
 	debug_status(status);
 	debug_status(ireg);
 #endif
 	if (!ireg) {
-		disable_mmc_irqs(ctl, status & ~mask);
+		disable_mmc_irqs(ctl, status & ~irq_mask);
 #ifdef CONFIG_MMC_DEBUG
-		WARN("tmio_mmc: Spurious MMC irq, disabling! 0x%08x 0x%08x 0x%08x\n", status, mask, ireg);
+		WARN("tmio_mmc: Spurious MMC irq, disabling! 0x%08x 0x%08x 0x%08x\n", status, irq_mask, ireg);
 		debug_status(status);
 #endif
 		goto out;
@@ -365,9 +366,9 @@ static irqreturn_t tmio_mmc_irq(int irq, void *devid)
 		}
 
 		/* Check status - keep going until we've handled it all */
-		status = read_long_reg(ctl->status);
-		mask   = read_long_reg(ctl->irq_mask);
-		ireg   = status & TMIO_MASK_IRQ & ~mask;
+		status = tmio_ioread32(ctl->status);
+		irq_mask   = tmio_ioread32(ctl->irq_mask);
+		ireg   = status & TMIO_MASK_IRQ & ~irq_mask;
 
 #ifdef CONFIG_MMC_DEBUG
 		DBG("Status at end of loop: %08x\n", status);
@@ -513,7 +514,7 @@ static int tmio_mmc_resume(struct platform_device *dev) {
 	return 0;
 }
 
-static int tmio_mmc_probe(struct platform_device *dev)
+static int __devinit tmio_mmc_probe(struct platform_device *dev)
 {
 	struct mfd_cell	*cell	= mfd_get_cell(dev);
 	struct tmio_mmc_cnf __iomem *cnf;
@@ -594,7 +595,7 @@ out:
 	return ret;
 }
 
-static int tmio_mmc_remove(struct platform_device *dev)
+static int __devexit tmio_mmc_remove(struct platform_device *dev)
 {
 	struct mmc_host *mmc = platform_get_drvdata(dev);
 
@@ -614,12 +615,12 @@ static int tmio_mmc_remove(struct platform_device *dev)
 
 /* ------------------- device registration ----------------------- */
 
-struct platform_driver tmio_mmc_driver = {
+static struct platform_driver tmio_mmc_driver = {
 	.driver = {
 		.name = "tmio-mmc",
 	},
 	.probe = tmio_mmc_probe,
-	.remove = tmio_mmc_remove,
+	.remove = __devexit_p(tmio_mmc_remove),
 #ifdef CONFIG_PM
 	.suspend = tmio_mmc_suspend,
 	.resume = tmio_mmc_resume,
@@ -630,12 +631,11 @@ struct platform_driver tmio_mmc_driver = {
 static int __init tmio_mmc_init(void)
 {
 	return platform_driver_register (&tmio_mmc_driver);
-	return 0;
 }
 
 static void __exit tmio_mmc_exit(void)
 {
-	return platform_driver_unregister (&tmio_mmc_driver);
+	platform_driver_unregister (&tmio_mmc_driver);
 }
 
 module_init(tmio_mmc_init);
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 7d8b860..d4d9f8f 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -101,36 +101,28 @@ struct tmio_mmc_ctl {
                            TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)
 #define TMIO_MASK_IRQ     (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD)
 
-#define read_long_reg(reg) (u32)(readw((u16*)(reg)) | (readw((u16*)(reg)+1) << 16))
-
-#define write_long_reg(value, reg) \
-	do { \
-		writew((u32)(value) & 0xffff, (u16*)(reg)); \
-		writew((u32)(value) >> 16, (u16*)(reg)+1); \
-	} while(0)
-
 #define enable_mmc_irqs(ctl, i) \
 	do { \
 		u32 mask;\
-		mask  = read_long_reg((ctl)->irq_mask); \
+		mask  = tmio_ioread32((ctl)->irq_mask); \
 		mask &= ~((i) & TMIO_MASK_IRQ); \
-		write_long_reg(mask, (ctl)->irq_mask); \
+		tmio_iowrite32(mask, (ctl)->irq_mask); \
 	} while (0)
 
 #define disable_mmc_irqs(ctl, i) \
 	do { \
 		u32 mask;\
-		mask  = read_long_reg((ctl)->irq_mask); \
+		mask  = tmio_ioread32((ctl)->irq_mask); \
 		mask |= ((i) & TMIO_MASK_IRQ); \
-		write_long_reg(mask, (ctl)->irq_mask); \
+		tmio_iowrite32(mask, (ctl)->irq_mask); \
 	} while (0)
 
 #define ack_mmc_irqs(ctl, i) \
 	do { \
 		u32 mask;\
-		mask  = read_long_reg((ctl)->status); \
+		mask  = tmio_ioread32((ctl)->status); \
 		mask &= ~((i) & TMIO_MASK_IRQ); \
-		write_long_reg(mask, (ctl)->status); \
+		tmio_iowrite32(mask, (ctl)->status); \
 	} while (0)
 
 
