]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/io_ti.c
USB: use DIV_ROUND_UP
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / io_ti.c
index cd3405953f741a4b4e103d482a0009db59453550..6afee30a6a5ce03c1c1f5045c8f9546dc5667a2e 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/serial.h>
 #include <linux/ioctl.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 
@@ -655,7 +654,7 @@ static void TIChasePort(struct edgeport_port *port, unsigned long timeout, int f
        /* (TIIsTxActive doesn't seem to wait for the last byte) */
        if ((baud_rate=port->baud_rate) == 0)
                baud_rate = 50;
-       msleep(max(1,(10000+baud_rate-1)/baud_rate));
+       msleep(max(1, DIV_ROUND_UP(10000, baud_rate)));
 }
 
 static int TIChooseConfiguration (struct usb_device *dev)
@@ -1087,12 +1086,11 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
        if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) {
                struct ti_i2c_desc *rom_desc;
 
-               dbg ("%s - <<<<<<<<<<<<<<<RUNNING IN DOWNLOAD MODE>>>>>>>>>>", __FUNCTION__);
+               dbg("%s - RUNNING IN DOWNLOAD MODE", __func__);
 
                status = TiValidateI2cImage (serial);
                if (status) {
-                       dbg ("%s - <<<<<<<<<<<<<<<DOWNLOAD MODE -- BAD I2C >>>>>>>>>>",
-                            __FUNCTION__);
+                       dbg("%s - DOWNLOAD MODE -- BAD I2C", __func__);
                        return status;
                }
                
@@ -1346,8 +1344,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
        /********************************************************************/
        /* Boot Mode */
        /********************************************************************/
-       dbg ("%s - <<<<<<<<<<<<<<<RUNNING IN BOOT MODE>>>>>>>>>>>>>>>",
-            __FUNCTION__);
+       dbg("%s - RUNNING IN BOOT MODE", __func__);
 
        // Configure the TI device so we can use the BULK pipes for download
        status = TIConfigureBootDevice (serial->serial->dev);
@@ -1462,7 +1459,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
 
 StayInBootMode:
        // Eprom is invalid or blank stay in boot mode
-       dbg ("%s - <<<<<<<<<<<<<<<STAYING IN BOOT MODE>>>>>>>>>>>>", __FUNCTION__);
+       dbg("%s - STAYING IN BOOT MODE", __func__);
        serial->product_info.TiMode = TI_MODE_BOOT;
 
        return 0;
@@ -2562,9 +2559,11 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig
 {
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        unsigned int mcr;
+       unsigned long flags;
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
+       spin_lock_irqsave(&edge_port->ep_lock, flags);
        mcr = edge_port->shadow_mcr;
        if (set & TIOCM_RTS)
                mcr |= MCR_RTS;
@@ -2581,6 +2580,7 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig
                mcr &= ~MCR_LOOPBACK;
 
        edge_port->shadow_mcr = mcr;
+       spin_unlock_irqrestore(&edge_port->ep_lock, flags);
 
        TIRestoreMCR (edge_port, mcr);
 
@@ -2593,9 +2593,12 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file)
        unsigned int result = 0;
        unsigned int msr;
        unsigned int mcr;
+       unsigned long flags;
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
+       spin_lock_irqsave(&edge_port->ep_lock, flags);
+
        msr = edge_port->shadow_msr;
        mcr = edge_port->shadow_mcr;
        result = ((mcr & MCR_DTR)       ? TIOCM_DTR: 0)   /* 0x002 */
@@ -2607,6 +2610,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file)
 
 
        dbg("%s -- %x", __FUNCTION__, result);
+       spin_unlock_irqrestore(&edge_port->ep_lock, flags);
 
        return result;
 }