Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
[safe/jmp/linux-2.6] / drivers / net / irda / vlsi_ir.c
index 79b407f..d15e00b 100644 (file)
@@ -44,7 +44,7 @@ MODULE_LICENSE("GPL");
 #include <linux/time.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
 
@@ -993,7 +993,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                        goto drop;
                }
                else
-                       memcpy(rd->buf, skb->data, len);
+                       skb_copy_from_linear_data(skb, rd->buf, len);
        }
 
        rd->skb = skb;                  /* remember skb for tx-complete stats */
@@ -1584,8 +1584,6 @@ static int vlsi_irda_init(struct net_device *ndev)
        vlsi_irda_dev_t *idev = ndev->priv;
        struct pci_dev *pdev = idev->pdev;
 
-       SET_MODULE_OWNER(ndev);
-
        ndev->irq = pdev->irq;
        ndev->base_addr = pci_resource_start(pdev,0);
 
@@ -1661,8 +1659,8 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        idev = ndev->priv;
 
        spin_lock_init(&idev->lock);
-       init_MUTEX(&idev->sem);
-       down(&idev->sem);
+       mutex_init(&idev->mtx);
+       mutex_lock(&idev->mtx);
        idev->pdev = pdev;
 
        if (vlsi_irda_init(ndev) < 0)
@@ -1676,13 +1674,12 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (vlsi_proc_root != NULL) {
                struct proc_dir_entry *ent;
 
-               ent = create_proc_entry(ndev->name, S_IFREG|S_IRUGO, vlsi_proc_root);
+               ent = proc_create_data(ndev->name, S_IFREG|S_IRUGO,
+                                      vlsi_proc_root, VLSI_PROC_FOPS, ndev);
                if (!ent) {
                        IRDA_WARNING("%s: failed to create proc entry\n",
                                     __FUNCTION__);
                } else {
-                       ent->data = ndev;
-                       ent->proc_fops = VLSI_PROC_FOPS;
                        ent->size = 0;
                }
                idev->proc_entry = ent;
@@ -1690,12 +1687,12 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        IRDA_MESSAGE("%s: registered device %s\n", drivername, ndev->name);
 
        pci_set_drvdata(pdev, ndev);
-       up(&idev->sem);
+       mutex_unlock(&idev->mtx);
 
        return 0;
 
 out_freedev:
-       up(&idev->sem);
+       mutex_unlock(&idev->mtx);
        free_netdev(ndev);
 out_disable:
        pci_disable_device(pdev);
@@ -1717,12 +1714,12 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
        unregister_netdev(ndev);
 
        idev = ndev->priv;
-       down(&idev->sem);
+       mutex_lock(&idev->mtx);
        if (idev->proc_entry) {
                remove_proc_entry(ndev->name, vlsi_proc_root);
                idev->proc_entry = NULL;
        }
-       up(&idev->sem);
+       mutex_unlock(&idev->mtx);
 
        free_netdev(ndev);
 
@@ -1752,7 +1749,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
                return 0;
        }
        idev = ndev->priv;      
-       down(&idev->sem);
+       mutex_lock(&idev->mtx);
        if (pdev->current_state != 0) {                 /* already suspended */
                if (state.event > pdev->current_state) {        /* simply go deeper */
                        pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1760,7 +1757,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
                }
                else
                        IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, pci_name(pdev), pdev->current_state, state.event);
-               up(&idev->sem);
+               mutex_unlock(&idev->mtx);
                return 0;
        }
 
@@ -1776,7 +1773,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
        pci_set_power_state(pdev, pci_choose_state(pdev, state));
        pdev->current_state = state.event;
        idev->resume_ok = 1;
-       up(&idev->sem);
+       mutex_unlock(&idev->mtx);
        return 0;
 }
 
@@ -1791,9 +1788,9 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
                return 0;
        }
        idev = ndev->priv;      
-       down(&idev->sem);
+       mutex_lock(&idev->mtx);
        if (pdev->current_state == 0) {
-               up(&idev->sem);
+               mutex_unlock(&idev->mtx);
                IRDA_WARNING("%s - %s: already resumed\n",
                             __FUNCTION__, pci_name(pdev));
                return 0;
@@ -1815,7 +1812,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
                 * device and independently resume_ok should catch any garbage config.
                 */
                IRDA_WARNING("%s - hm, nothing to resume?\n", __FUNCTION__);
-               up(&idev->sem);
+               mutex_unlock(&idev->mtx);
                return 0;
        }
 
@@ -1825,7 +1822,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
                netif_device_attach(ndev);
        }
        idev->resume_ok = 0;
-       up(&idev->sem);
+       mutex_unlock(&idev->mtx);
        return 0;
 }