diff options
author | Robert Richter <robert.richter@amd.com> | 2010-04-23 14:30:22 +0200 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2010-04-23 14:30:22 +0200 |
commit | a36bf32e9e8a86f291f746b7f8292e042ee04a46 (patch) | |
tree | c5c999baa4c214218e3adea9b336cbd9f23950ad /drivers/s390/block/dasd_devmap.c | |
parent | oprofile: convert oprofile from timer_hook to hrtimer (diff) | |
parent | Linux 2.6.34-rc5 (diff) | |
download | linux-a36bf32e9e8a86f291f746b7f8292e042ee04a46.tar.xz linux-a36bf32e9e8a86f291f746b7f8292e042ee04a46.zip |
Merge commit 'v2.6.34-rc5' into oprofile/core
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 4cac5b54f26a..eff9c812c5c2 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -18,6 +18,7 @@ #include <linux/ctype.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/slab.h> #include <asm/debug.h> #include <asm/uaccess.h> @@ -742,6 +743,7 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct dasd_devmap *devmap; + struct dasd_device *device; int val; char *endp; @@ -758,12 +760,14 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, devmap->features |= DASD_FEATURE_READONLY; else devmap->features &= ~DASD_FEATURE_READONLY; - if (devmap->device) - devmap->device->features = devmap->features; - if (devmap->device && devmap->device->block - && devmap->device->block->gdp) - set_disk_ro(devmap->device->block->gdp, val); + device = devmap->device; + if (device) { + device->features = devmap->features; + val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); + } spin_unlock(&dasd_devmap_lock); + if (device && device->block && device->block->gdp) + set_disk_ro(device->block->gdp, val); return count; } @@ -874,12 +878,19 @@ dasd_discipline_show(struct device *dev, struct device_attribute *attr, ssize_t len; device = dasd_device_from_cdev(to_ccwdev(dev)); - if (!IS_ERR(device) && device->discipline) { + if (IS_ERR(device)) + goto out; + else if (!device->discipline) { + dasd_put_device(device); + goto out; + } else { len = snprintf(buf, PAGE_SIZE, "%s\n", device->discipline->name); dasd_put_device(device); - } else - len = snprintf(buf, PAGE_SIZE, "none\n"); + return len; + } +out: + len = snprintf(buf, PAGE_SIZE, "none\n"); return len; } |