Merge branch 'timers/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / sbus / char / openprom.c
index 81ba2d7..29dc735 100644 (file)
@@ -31,9 +31,9 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
+#include <linux/smp_lock.h>
 #include <linux/string.h>
 #include <linux/miscdevice.h>
 #include <linux/init.h>
@@ -45,7 +45,6 @@
 #include <asm/openpromio.h>
 #ifdef CONFIG_PCI
 #include <linux/pci.h>
-#include <asm/pbm.h>
 #endif
 
 MODULE_AUTHOR("Thomas K. Dyas (tdyas@noc.rutgers.edu) and Eddie C. Dost  (ecd@skynet.be)");
@@ -142,7 +141,7 @@ static int copyout(void __user *info, struct openpromio *opp, int len)
 
 static int opromgetprop(void __user *argp, struct device_node *dp, struct openpromio *op, int bufsize)
 {
-       void *pval;
+       const void *pval;
        int len;
 
        if (!dp ||
@@ -249,18 +248,18 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
        if (bufsize >= 2*sizeof(int)) {
 #ifdef CONFIG_PCI
                struct pci_dev *pdev;
-               struct pcidev_cookie *pcp;
-               pdev = pci_find_slot (((int *) op->oprom_array)[0],
+               struct device_node *dp;
+
+               pdev = pci_get_bus_and_slot (((int *) op->oprom_array)[0],
                                      ((int *) op->oprom_array)[1]);
 
-               pcp = pdev->sysdata;
-               if (pcp != NULL) {
-                       dp = pcp->prom_node;
-                       data->current_node = dp;
-                       *((int *)op->oprom_array) = dp->node;
-                       op->oprom_size = sizeof(int);
-                       err = copyout(argp, op, bufsize + sizeof(int));
-               }
+               dp = pci_device_to_OF_node(pdev);
+               data->current_node = dp;
+               *((int *)op->oprom_array) = dp->node;
+               op->oprom_size = sizeof(int);
+               err = copyout(argp, op, bufsize + sizeof(int));
+
+               pci_dev_put(pdev);
 #endif
        }
 
@@ -410,7 +409,7 @@ static int opiocget(void __user *argp, DATA *data)
        struct opiocdesc op;
        struct device_node *dp;
        char *str;
-       void *pval;
+       const void *pval;
        int err, len;
 
        if (copy_from_user(&op, argp, sizeof(op)))
@@ -676,7 +675,7 @@ static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
        case OPROMSETCUR:
        case OPROMPCI2NODE:
        case OPROMPATH2NODE:
-               rval = openprom_ioctl(file->f_dentry->d_inode, file, cmd, arg);
+               rval = openprom_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
                break;
        }
 
@@ -691,9 +690,11 @@ static int openprom_open(struct inode * inode, struct file * file)
        if (!data)
                return -ENOMEM;
 
+       lock_kernel();
        data->current_node = of_find_node_by_path("/");
        data->lastnode = data->current_node;
        file->private_data = (void *) data;
+       unlock_kernel();
 
        return 0;
 }
@@ -704,7 +705,7 @@ static int openprom_release(struct inode * inode, struct file * file)
        return 0;
 }
 
-static struct file_operations openprom_fops = {
+static const struct file_operations openprom_fops = {
        .owner =        THIS_MODULE,
        .llseek =       no_llseek,
        .ioctl =        openprom_ioctl,