This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / net / irda / stir4200.c
index f80a19e..81282d9 100644 (file)
@@ -520,6 +520,11 @@ static int change_speed(struct stir_cb *stir, unsigned speed)
  found:
        pr_debug("speed change from %d to %d\n", stir->speed, speed);
 
+       /* sometimes needed to get chip out of stuck state */
+       err = usb_reset_device(stir->usbdev);
+       if (err)
+               goto out;
+
        /* Reset modulator */
        err = write_reg(stir, REG_CTRL1, CTRL1_SRESET);
        if (err)
@@ -570,7 +575,7 @@ static int change_speed(struct stir_cb *stir, unsigned speed)
  */
 static int stir_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
-       struct stir_cb *stir = netdev_priv(netdev);
+       struct stir_cb *stir = netdev->priv;
 
        netif_stop_queue(netdev);
 
@@ -705,7 +710,7 @@ static int receive_start(struct stir_cb *stir)
 static void receive_stop(struct stir_cb *stir)
 {
        stir->receiving = 0;
-       usb_kill_urb(stir->rx_urb);
+       usb_unlink_urb(stir->rx_urb);
 
        if (stir->rx_buff.in_frame) 
                stir->stats.collisions++;
@@ -761,9 +766,8 @@ static int stir_transmit_thread(void *arg)
               && netif_device_present(dev)
               && !signal_pending(current))
        {
-#ifdef CONFIG_PM
                /* if suspending, then power off and wait */
-               if (unlikely(current->flags & PF_FREEZE)) {
+               if (current->flags & PF_FREEZE) {
                        if (stir->receiving)
                                receive_stop(stir);
                        else
@@ -776,7 +780,6 @@ static int stir_transmit_thread(void *arg)
                        if (change_speed(stir, stir->speed))
                                break;
                }
-#endif
 
                /* if something to send? */
                skb = xchg(&stir->tx_pending, NULL);
@@ -871,7 +874,7 @@ static void stir_rcv_irq(struct urb *urb, struct pt_regs *regs)
  */
 static int stir_net_open(struct net_device *netdev)
 {
-       struct stir_cb *stir = netdev_priv(netdev);
+       struct stir_cb *stir = netdev->priv;
        int err;
        char hwname[16];
 
@@ -924,7 +927,7 @@ static int stir_net_open(struct net_device *netdev)
        sprintf(hwname, "usb#%d", stir->usbdev->devnum);
        stir->irlap = irlap_open(netdev, &stir->qos, hwname);
        if (!stir->irlap) {
-               err("stir4200: irlap_open failed");
+               err("irlap_open failed");
                goto err_out5;
        }
 
@@ -933,7 +936,7 @@ static int stir_net_open(struct net_device *netdev)
                                      CLONE_FS|CLONE_FILES);
        if (stir->thr_pid < 0) {
                err = stir->thr_pid;
-               err("stir4200: unable to start kernel thread");
+               err("unable to start kernel thread");
                goto err_out6;
        }
 
@@ -963,7 +966,7 @@ static int stir_net_open(struct net_device *netdev)
  */
 static int stir_net_close(struct net_device *netdev)
 {
-       struct stir_cb *stir = netdev_priv(netdev);
+       struct stir_cb *stir = netdev->priv;
 
        /* Stop transmit processing */
        netif_stop_queue(netdev);
@@ -974,7 +977,7 @@ static int stir_net_close(struct net_device *netdev)
        kfree(stir->fifo_status);
 
        /* Mop up receive urb's */
-       usb_kill_urb(stir->rx_urb);
+       usb_unlink_urb(stir->rx_urb);
        
        kfree(stir->io_buf);
        usb_free_urb(stir->rx_urb);
@@ -992,10 +995,10 @@ static int stir_net_close(struct net_device *netdev)
 /*
  * IOCTLs : Extra out-of-band network commands...
  */
-static int stir_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
+static int stir_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
        struct if_irda_req *irq = (struct if_irda_req *) rq;
-       struct stir_cb *stir = netdev_priv(netdev);
+       struct stir_cb *stir = dev->priv;
        int ret = 0;
 
        switch (cmd) {
@@ -1032,9 +1035,9 @@ static int stir_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
 /*
  * Get device stats (for /proc/net/dev and ifconfig)
  */
-static struct net_device_stats *stir_net_get_stats(struct net_device *netdev)
+static struct net_device_stats *stir_net_get_stats(struct net_device *dev)
 {
-       struct stir_cb *stir = netdev_priv(netdev);
+       struct stir_cb *stir = dev->priv;
        return &stir->stats;
 }
 
@@ -1060,13 +1063,13 @@ static int stir_probe(struct usb_interface *intf,
 
        SET_MODULE_OWNER(net);
        SET_NETDEV_DEV(net, &intf->dev);
-       stir = netdev_priv(net);
+       stir = net->priv;
        stir->netdev = net;
        stir->usbdev = dev;
 
        ret = usb_reset_configuration(dev);
        if (ret != 0) {
-               err("stir4200: usb reset configuration failed");
+               err("usb reset configuration failed");
                goto err_out2;
        }
 
@@ -1099,7 +1102,7 @@ static int stir_probe(struct usb_interface *intf,
        if (ret != 0)
                goto err_out2;
 
-       info("IrDA: Registered SigmaTel device %s", net->name);
+       MESSAGE("IrDA: Registered SigmaTel device %s\n", net->name);
 
        usb_set_intfdata(intf, stir);
 
@@ -1127,7 +1130,7 @@ static void stir_disconnect(struct usb_interface *intf)
        usb_set_intfdata(intf, NULL);
 }
 
-#ifdef CONFIG_PM
+
 /* Power management suspend, so power off the transmitter/receiver */
 static int stir_suspend(struct usb_interface *intf, u32 state)
 {
@@ -1147,7 +1150,6 @@ static int stir_resume(struct usb_interface *intf)
        /* receiver restarted when send thread wakes up */
        return 0;
 }
-#endif
 
 /*
  * USB device callbacks
@@ -1158,10 +1160,8 @@ static struct usb_driver irda_driver = {
        .probe          = stir_probe,
        .disconnect     = stir_disconnect,
        .id_table       = dongles,
-#ifdef CONFIG_PM
        .suspend        = stir_suspend,
        .resume         = stir_resume,
-#endif
 };
 
 /*
@@ -1169,7 +1169,11 @@ static struct usb_driver irda_driver = {
  */
 static int __init stir_init(void)
 {
-       return usb_register(&irda_driver);
+       if (usb_register(&irda_driver) < 0)
+               return -1;
+
+       MESSAGE("SigmaTel support registered\n");
+       return 0;
 }
 module_init(stir_init);