]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
tifm: layout fixes, small changes to comments and printfs
authorAlex Dubov <oakad@yahoo.com>
Thu, 12 Apr 2007 07:05:26 +0000 (17:05 +1000)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 1 May 2007 11:04:15 +0000 (13:04 +0200)
Cosmetic changes to the code.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/misc/tifm_7xx1.c
drivers/misc/tifm_core.c
drivers/mmc/tifm_sd.c
include/linux/tifm.h

index eafa5575f312fe859ddeadc58c7d62158dcb7028..9dcff14e752ca1fc3f8c8805ed28014802aee25d 100644 (file)
@@ -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 @@ static irqreturn_t tifm_7xx1_isr(int irq, void *dev_id)
 {
        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 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
 {
        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;
index 70220beb3e04257be48d5c6ab69b710218d6cc9d..d195fb088f4a05a7678ea7e289e5f18a503e64c7 100644 (file)
@@ -115,23 +115,23 @@ static int tifm_device_remove(struct device *dev)
 
 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 device_attribute tifm_dev_attrs[] = {
 };
 
 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)
index 8e69514e415d40e6899d6a2f2cbd168012bc8b13..f692a2ec09c58c5bf2664a2d940440f06c961a37 100644 (file)
@@ -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 @@ module_param(fixed_timeout, bool, 0644);
 
 #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 @@ module_param(fixed_timeout, bool, 0644);
 #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 @@ enum {
 };
 
 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 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
        }
 
        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 @@ static void tifm_sd_end_cmd(unsigned long data)
        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 @@ static void tifm_sd_abort(unsigned long data)
 {
        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 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
        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 @@ static int tifm_sd_probe(struct tifm_dev *sock)
 
        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 @@ static int tifm_sd_probe(struct tifm_dev *sock)
 
        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;
 }
index 7ccad07954668a77b077005113babc934490ae8b..2a196982601f8b6647d2137a1e97df2a94c2bd91 100644 (file)
 
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
-#include <linux/wait.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
-#include <linux/kthread.h>
+#include <linux/workqueue.h>
 
 /* Host registers (relative to pci base address): */
 enum {
        FM_SET_INTERRUPT_ENABLE   = 0x008,
        FM_CLEAR_INTERRUPT_ENABLE = 0x00c,
-       FM_INTERRUPT_STATUS       = 0x014 };
+       FM_INTERRUPT_STATUS       = 0x014
+};
 
 /* Socket registers (relative to socket base address): */
 enum {
@@ -58,7 +58,8 @@ enum {
        SOCK_MS_DATA                   = 0x188,
        SOCK_MS_STATUS                 = 0x18c,
        SOCK_MS_SYSTEM                 = 0x190,
-       SOCK_FIFO_ACCESS               = 0x200 };
+       SOCK_FIFO_ACCESS               = 0x200
+};
 
 #define TIFM_CTRL_LED             0x00000040
 #define TIFM_CTRL_FAST_CLK        0x00000100
@@ -66,14 +67,14 @@ enum {
 #define TIFM_SOCK_STATE_OCCUPIED  0x00000008
 #define TIFM_SOCK_STATE_POWERED   0x00000080
 
-#define TIFM_FIFO_ENABLE          0x00000001 /* Meaning of this constant is unverified */
-#define TIFM_FIFO_READY           0x00000001 /* Meaning of this constant is unverified */
+#define TIFM_FIFO_ENABLE          0x00000001
+#define TIFM_FIFO_READY           0x00000001
 #define TIFM_FIFO_INT_SETALL      0x0000ffff
-#define TIFM_FIFO_INTMASK         0x00000005 /* Meaning of this constant is unverified */
+#define TIFM_FIFO_INTMASK         0x00000005
 
-#define TIFM_DMA_RESET            0x00000002 /* Meaning of this constant is unverified */
-#define TIFM_DMA_TX               0x00008000 /* Meaning of this constant is unverified */
-#define TIFM_DMA_EN               0x00000001 /* Meaning of this constant is unverified */
+#define TIFM_DMA_RESET            0x00000002
+#define TIFM_DMA_TX               0x00008000
+#define TIFM_DMA_EN               0x00000001
 #define TIFM_DMA_TSIZE            0x0000007f
 
 #define TIFM_TYPE_XD 1
@@ -86,44 +87,44 @@ struct tifm_device_id {
 
 struct tifm_driver;
 struct tifm_dev {
-       char __iomem            *addr;
-       spinlock_t              lock;
-       unsigned char           type;
-       unsigned int            socket_id;
+       char __iomem  *addr;
+       spinlock_t    lock;
+       unsigned char type;
+       unsigned int  socket_id;
 
        void          (*card_event)(struct tifm_dev *sock);
        void          (*data_event)(struct tifm_dev *sock);
 
-       struct device           dev;
+       struct device dev;
 };
 
 struct tifm_driver {
        struct tifm_device_id *id_table;
-       int                  (*probe)(struct tifm_dev *dev);
-       void                 (*remove)(struct tifm_dev *dev);
-       int                  (*suspend)(struct tifm_dev *dev,
-                                        pm_message_t state);
-       int                  (*resume)(struct tifm_dev *dev);
+       int                   (*probe)(struct tifm_dev *dev);
+       void                  (*remove)(struct tifm_dev *dev);
+       int                   (*suspend)(struct tifm_dev *dev,
+                                        pm_message_t state);
+       int                   (*resume)(struct tifm_dev *dev);
 
-       struct device_driver driver;
+       struct device_driver  driver;
 };
 
 struct tifm_adapter {
-       char __iomem            *addr;
-       spinlock_t              lock;
-       unsigned int            irq_status;
-       unsigned int            socket_change_set;
-       unsigned int            id;
-       unsigned int            num_sockets;
-       struct completion       *finish_me;
+       char __iomem        *addr;
+       spinlock_t          lock;
+       unsigned int        irq_status;
+       unsigned int        socket_change_set;
+       unsigned int        id;
+       unsigned int        num_sockets;
+       struct completion   *finish_me;
 
-       struct work_struct      media_switcher;
-       struct class_device     cdev;
+       struct work_struct  media_switcher;
+       struct class_device cdev;
 
-       void                    (*eject)(struct tifm_adapter *fm,
-                                        struct tifm_dev *sock);
+       void                (*eject)(struct tifm_adapter *fm,
+                                    struct tifm_dev *sock);
 
-       struct tifm_dev         *sockets[0];
+       struct tifm_dev     *sockets[0];
 };
 
 struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
@@ -147,7 +148,7 @@ void tifm_queue_work(struct work_struct *work);
 
 static inline void *tifm_get_drvdata(struct tifm_dev *dev)
 {
-        return dev_get_drvdata(&dev->dev);
+       return dev_get_drvdata(&dev->dev);
 }
 
 static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data)