const: constify remaining dev_pm_ops
[safe/jmp/linux-2.6] / drivers / s390 / char / vmlogrdr.c
index e925808..7dfa541 100644 (file)
@@ -312,11 +312,9 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
                return -ENOSYS;
 
        /* Besure this device hasn't already been opened */
-       lock_kernel();
        spin_lock_bh(&logptr->priv_lock);
        if (logptr->dev_in_use) {
                spin_unlock_bh(&logptr->priv_lock);
-               unlock_kernel();
                return -EBUSY;
        }
        logptr->dev_in_use = 1;
@@ -360,9 +358,8 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
                   || (logptr->iucv_path_severed));
        if (logptr->iucv_path_severed)
                goto out_record;
-       ret = nonseekable_open(inode, filp);
-       unlock_kernel();
-       return ret;
+       nonseekable_open(inode, filp);
+       return 0;
 
 out_record:
        if (logptr->autorecording)
@@ -372,7 +369,6 @@ out_path:
        logptr->path = NULL;
 out_dev:
        logptr->dev_in_use = 0;
-       unlock_kernel();
        return -EIO;
 }
 
@@ -504,7 +500,7 @@ static ssize_t vmlogrdr_autopurge_store(struct device * dev,
                                        struct device_attribute *attr,
                                        const char * buf, size_t count)
 {
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
        ssize_t ret = count;
 
        switch (buf[0]) {
@@ -525,7 +521,7 @@ static ssize_t vmlogrdr_autopurge_show(struct device *dev,
                                       struct device_attribute *attr,
                                       char *buf)
 {
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
        return sprintf(buf, "%u\n", priv->autopurge);
 }
 
@@ -541,7 +537,7 @@ static ssize_t vmlogrdr_purge_store(struct device * dev,
 
        char cp_command[80];
        char cp_response[80];
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
 
        if (buf[0] != '1')
                return -EINVAL;
@@ -578,7 +574,7 @@ static ssize_t vmlogrdr_autorecording_store(struct device *dev,
                                            struct device_attribute *attr,
                                            const char *buf, size_t count)
 {
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
        ssize_t ret = count;
 
        switch (buf[0]) {
@@ -599,7 +595,7 @@ static ssize_t vmlogrdr_autorecording_show(struct device *dev,
                                           struct device_attribute *attr,
                                           char *buf)
 {
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
        return sprintf(buf, "%u\n", priv->autorecording);
 }
 
@@ -612,7 +608,7 @@ static ssize_t vmlogrdr_recording_store(struct device * dev,
                                        struct device_attribute *attr,
                                        const char * buf, size_t count)
 {
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
        ssize_t ret;
 
        switch (buf[0]) {
@@ -663,7 +659,7 @@ static struct attribute *vmlogrdr_attrs[] = {
 static int vmlogrdr_pm_prepare(struct device *dev)
 {
        int rc;
-       struct vmlogrdr_priv_t *priv = dev->driver_data;
+       struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
 
        rc = 0;
        if (priv) {
@@ -679,7 +675,7 @@ static int vmlogrdr_pm_prepare(struct device *dev)
 }
 
 
-static struct dev_pm_ops vmlogrdr_pm_ops = {
+static const struct dev_pm_ops vmlogrdr_pm_ops = {
        .prepare = vmlogrdr_pm_prepare,
 };
 
@@ -753,7 +749,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
                dev->bus = &iucv_bus;
                dev->parent = iucv_root;
                dev->driver = &vmlogrdr_driver;
-               dev->driver_data = priv;
+               dev_set_drvdata(dev, priv);
                /*
                 * The release function could be called after the
                 * module has been unloaded. It's _only_ task is to
@@ -765,8 +761,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
        } else
                return -ENOMEM;
        ret = device_register(dev);
-       if (ret)
+       if (ret) {
+               put_device(dev);
                return ret;
+       }
 
        ret = sysfs_create_group(&dev->kobj, &vmlogrdr_attr_group);
        if (ret) {