build uml
[linux-2.6.git] / drivers / net / irda / stir4200.c
index f80a19e..31867e4 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/time.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
-#include <linux/suspend.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/usb.h>
@@ -209,7 +208,7 @@ static int write_reg(struct stir_cb *stir, __u16 reg, __u8 value)
                               REQ_WRITE_SINGLE,
                               USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_DEVICE,
                               value, reg, NULL, 0,
-                              msecs_to_jiffies(CTRL_TIMEOUT));
+                              CTRL_TIMEOUT);
 }
 
 /* Send control message to read multiple registers */
@@ -222,7 +221,7 @@ static inline int read_reg(struct stir_cb *stir, __u16 reg,
                               REQ_READ_REG,
                               USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                               0, reg, data, count,
-                              msecs_to_jiffies(CTRL_TIMEOUT));
+                              CTRL_TIMEOUT);
 }
 
 static inline int isfir(u32 speed)
@@ -672,16 +671,16 @@ static void turnaround_delay(const struct stir_cb *stir, long us)
                return;
 
        do_gettimeofday(&now);
-       us -= (now.tv_sec - stir->rx_time.tv_sec) * USEC_PER_SEC;
+       if (now.tv_sec - stir->rx_time.tv_sec > 0)
+               us -= USEC_PER_SEC;
        us -= now.tv_usec - stir->rx_time.tv_usec;
        if (us < 10)
                return;
 
        ticks = us / (1000000 / HZ);
-       if (ticks > 0) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule_timeout(1 + ticks);
-       } else
+       if (ticks > 0)
+               schedule_timeout_interruptible(1 + ticks);
+       else
                udelay(us);
 }
 
@@ -741,7 +740,7 @@ static void stir_send(struct stir_cb *stir, struct sk_buff *skb)
 
        if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1),
                         stir->io_buf, wraplen,
-                        NULL, msecs_to_jiffies(TRANSMIT_TIMEOUT)))
+                        NULL, TRANSMIT_TIMEOUT))
                stir->stats.tx_errors++;
 }
 
@@ -763,7 +762,7 @@ static int stir_transmit_thread(void *arg)
        {
 #ifdef CONFIG_PM
                /* if suspending, then power off and wait */
-               if (unlikely(current->flags & PF_FREEZE)) {
+               if (unlikely(freezing(current))) {
                        if (stir->receiving)
                                receive_stop(stir);
                        else
@@ -771,7 +770,7 @@ static int stir_transmit_thread(void *arg)
 
                        write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
 
-                       refrigerator(PF_FREEZE);
+                       refrigerator();
 
                        if (change_speed(stir, stir->speed))
                                break;
@@ -788,7 +787,7 @@ static int stir_transmit_thread(void *arg)
                                stir_send(stir, skb);
                        dev_kfree_skb(skb);
 
-                       if (stir->speed != new_speed) {
+                       if ((new_speed != -1) && (stir->speed != new_speed)) {
                                if (fifo_txwait(stir, -1) ||
                                    change_speed(stir, new_speed))
                                        break;
@@ -1072,8 +1071,8 @@ static int stir_probe(struct usb_interface *intf,
 
        printk(KERN_INFO "SigmaTel STIr4200 IRDA/USB found at address %d, "
                "Vendor: %x, Product: %x\n",
-              dev->devnum, dev->descriptor.idVendor,
-              dev->descriptor.idProduct);
+              dev->devnum, le16_to_cpu(dev->descriptor.idVendor),
+              le16_to_cpu(dev->descriptor.idProduct));
 
        /* Initialize QoS for this device */
        irda_init_max_qos_capabilies(&stir->qos);
@@ -1128,8 +1127,8 @@ static void stir_disconnect(struct usb_interface *intf)
 }
 
 #ifdef CONFIG_PM
-/* Power management suspend, so power off the transmitter/receiver */
-static int stir_suspend(struct usb_interface *intf, u32 state)
+/* USB suspend, so power off the transmitter/receiver */
+static int stir_suspend(struct usb_interface *intf, pm_message_t message)
 {
        struct stir_cb *stir = usb_get_intfdata(intf);
 
@@ -1153,7 +1152,6 @@ static int stir_resume(struct usb_interface *intf)
  * USB device callbacks
  */
 static struct usb_driver irda_driver = {
-       .owner          = THIS_MODULE,
        .name           = "stir4200",
        .probe          = stir_probe,
        .disconnect     = stir_disconnect,