tifm: layout fixes, small changes to comments and printfs

Cosmetic changes to the code.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index eafa557..9dcff14 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -10,8 +10,6 @@
  */
 
 #include <linux/tifm.h>
-#include <linux/dma-mapping.h>
-#include <linux/freezer.h>
 
 #define DRIVER_NAME "tifm_7xx1"
 #define DRIVER_VERSION "0.8"
@@ -41,8 +39,7 @@
 {
 	struct tifm_adapter *fm = dev_id;
 	struct tifm_dev *sock;
-	unsigned int irq_status;
-	unsigned int cnt;
+	unsigned int irq_status, cnt;
 
 	spin_lock(&fm->lock);
 	irq_status = readl(fm->addr + FM_INTERRUPT_STATUS);
@@ -134,11 +131,10 @@
 {
 	struct tifm_adapter *fm = container_of(work, struct tifm_adapter,
 					       media_switcher);
+	struct tifm_dev *sock;
 	unsigned long flags;
 	unsigned char media_id;
-	int cnt;
-	struct tifm_dev *sock;
-	unsigned int socket_change_set;
+	unsigned int socket_change_set, cnt;
 
 	spin_lock_irqsave(&fm->lock, flags);
 	socket_change_set = fm->socket_change_set;
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 70220be..d195fb0 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -115,23 +115,23 @@
 
 static int tifm_device_suspend(struct device *dev, pm_message_t state)
 {
-	struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev);
+	struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
 	struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
 					       driver);
 
 	if (dev->driver && drv->suspend)
-		return drv->suspend(fm_dev, state);
+		return drv->suspend(sock, state);
 	return 0;
 }
 
 static int tifm_device_resume(struct device *dev)
 {
-	struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev);
+	struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
 	struct tifm_driver *drv = container_of(dev->driver, struct tifm_driver,
 					       driver);
 
 	if (dev->driver && drv->resume)
-		return drv->resume(fm_dev);
+		return drv->resume(sock);
 	return 0;
 }
 
@@ -155,14 +155,14 @@
 };
 
 static struct bus_type tifm_bus_type = {
-	.name           = "tifm",
-	.dev_attrs      = tifm_dev_attrs,
-	.match          = tifm_bus_match,
-	.uevent         = tifm_uevent,
-	.probe          = tifm_device_probe,
-	.remove         = tifm_device_remove,
-	.suspend        = tifm_device_suspend,
-	.resume         = tifm_device_resume
+	.name      = "tifm",
+	.dev_attrs = tifm_dev_attrs,
+	.match     = tifm_bus_match,
+	.uevent    = tifm_uevent,
+	.probe     = tifm_device_probe,
+	.remove    = tifm_device_remove,
+	.suspend   = tifm_device_suspend,
+	.resume    = tifm_device_resume
 };
 
 static void tifm_free(struct class_device *cdev)
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index 8e69514e..f692a2e 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -7,6 +7,8 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
+ * Special thanks to Brad Campbell for extensive testing of this driver.
+ *
  */
 
 
@@ -39,6 +41,7 @@
 
 #define TIFM_MMCSD_ERRMASK    0x01e0   /* set bits: CCRC, CTO, DCRC, DTO */
 #define TIFM_MMCSD_EOC        0x0001   /* end of command phase  */
+#define TIFM_MMCSD_CD         0x0002   /* card detect           */
 #define TIFM_MMCSD_CB         0x0004   /* card enter busy state */
 #define TIFM_MMCSD_BRS        0x0008   /* block received/sent   */
 #define TIFM_MMCSD_EOFB       0x0010   /* card exit busy state  */
@@ -48,6 +51,8 @@
 #define TIFM_MMCSD_CCRC       0x0100   /* command crc error     */
 #define TIFM_MMCSD_AF         0x0400   /* fifo almost full      */
 #define TIFM_MMCSD_AE         0x0800   /* fifo almost empty     */
+#define TIFM_MMCSD_OCRB       0x1000   /* OCR busy              */
+#define TIFM_MMCSD_CIRQ       0x2000   /* card irq (cmd40/sdio) */
 #define TIFM_MMCSD_CERR       0x4000   /* card status error     */
 
 #define TIFM_MMCSD_ODTO       0x0040   /* open drain / extended timeout */
@@ -83,16 +88,16 @@
 };
 
 struct tifm_sd {
-	struct tifm_dev     *dev;
+	struct tifm_dev       *dev;
 
-	unsigned short      eject:1,
-			    open_drain:1,
-			    no_dma:1;
-	unsigned short      cmd_flags;
+	unsigned short        eject:1,
+			      open_drain:1,
+			      no_dma:1;
+	unsigned short        cmd_flags;
 
-	unsigned int        clk_freq;
-	unsigned int        clk_div;
-	unsigned long       timeout_jiffies;
+	unsigned int          clk_freq;
+	unsigned int          clk_div;
+	unsigned long         timeout_jiffies;
 
 	struct tasklet_struct finish_tasklet;
 	struct timer_list     timer;
@@ -627,7 +632,8 @@
 	}
 
 	if (host->req) {
-		printk(KERN_ERR DRIVER_NAME ": unfinished request detected\n");
+		printk(KERN_ERR "%s : unfinished request detected\n",
+		       sock->dev.bus_id);
 		spin_unlock_irqrestore(&sock->lock, flags);
 		goto err_out;
 	}
@@ -737,7 +743,8 @@
 	host->req = NULL;
 
 	if (!mrq) {
-		printk(KERN_ERR DRIVER_NAME ": no request to complete?\n");
+		printk(KERN_ERR " %s : no request to complete?\n",
+		       sock->dev.bus_id);
 		spin_unlock_irqrestore(&sock->lock, flags);
 		return;
 	}
@@ -775,8 +782,10 @@
 {
 	struct tifm_sd *host = (struct tifm_sd*)data;
 
-	printk(KERN_ERR DRIVER_NAME
-	       ": card failed to respond for a long period of time\n");
+	printk(KERN_ERR
+	       "%s : card failed to respond for a long period of time "
+	       "(%x, %x)\n",
+	       host->dev->dev.bus_id, host->req->cmd->opcode, host->cmd_flags);
 
 	tifm_eject(host->dev);
 }
@@ -790,8 +799,11 @@
 
 	spin_lock_irqsave(&sock->lock, flags);
 
-	dev_dbg(&sock->dev, "Setting bus width %d, power %d\n", ios->bus_width,
-		ios->power_mode);
+	dev_dbg(&sock->dev, "ios: clock = %u, vdd = %x, bus_mode = %x, "
+		"chip_select = %x, power_mode = %x, bus_width = %x\n",
+		ios->clock, ios->vdd, ios->bus_mode, ios->chip_select,
+		ios->power_mode, ios->bus_width);
+
 	if (ios->bus_width == MMC_BUS_WIDTH_4) {
 		writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG),
 		       sock->addr + SOCK_MMCSD_CONFIG);
@@ -937,7 +949,8 @@
 
 	if (!(TIFM_SOCK_STATE_OCCUPIED
 	      & readl(sock->addr + SOCK_PRESENT_STATE))) {
-		printk(KERN_WARNING DRIVER_NAME ": card gone, unexpectedly\n");
+		printk(KERN_WARNING "%s : card gone, unexpectedly\n",
+		       sock->dev.bus_id);
 		return rc;
 	}
 
@@ -974,11 +987,9 @@
 
 	if (!rc)
 		rc = mmc_add_host(mmc);
-	if (rc)
-		goto out_free_mmc;
+	if (!rc)
+		return 0;
 
-	return 0;
-out_free_mmc:
 	mmc_free_host(mmc);
 	return rc;
 }