aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_devmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r--drivers/s390/block/dasd_devmap.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index ad1841a96c87..1aedc48e5f85 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -11,7 +11,7 @@
11 * functions may not be called from interrupt context. In particular 11 * functions may not be called from interrupt context. In particular
12 * dasd_get_device is a no-no from interrupt context. 12 * dasd_get_device is a no-no from interrupt context.
13 * 13 *
14 * $Revision: 1.37 $ 14 * $Revision: 1.40 $
15 */ 15 */
16 16
17#include <linux/config.h> 17#include <linux/config.h>
@@ -513,14 +513,6 @@ dasd_create_device(struct ccw_device *cdev)
513 if (!devmap->device) { 513 if (!devmap->device) {
514 devmap->device = device; 514 devmap->device = device;
515 device->devindex = devmap->devindex; 515 device->devindex = devmap->devindex;
516 if (devmap->features & DASD_FEATURE_READONLY)
517 set_bit(DASD_FLAG_RO, &device->flags);
518 else
519 clear_bit(DASD_FLAG_RO, &device->flags);
520 if (devmap->features & DASD_FEATURE_USEDIAG)
521 set_bit(DASD_FLAG_USE_DIAG, &device->flags);
522 else
523 clear_bit(DASD_FLAG_USE_DIAG, &device->flags);
524 get_device(&cdev->dev); 516 get_device(&cdev->dev);
525 device->cdev = cdev; 517 device->cdev = cdev;
526 rc = 0; 518 rc = 0;
@@ -651,14 +643,8 @@ dasd_ro_store(struct device *dev, const char *buf, size_t count)
651 devmap->features |= DASD_FEATURE_READONLY; 643 devmap->features |= DASD_FEATURE_READONLY;
652 else 644 else
653 devmap->features &= ~DASD_FEATURE_READONLY; 645 devmap->features &= ~DASD_FEATURE_READONLY;
654 if (devmap->device) { 646 if (devmap->device && devmap->device->gdp)
655 if (devmap->device->gdp) 647 set_disk_ro(devmap->device->gdp, ro_flag);
656 set_disk_ro(devmap->device->gdp, ro_flag);
657 if (ro_flag)
658 set_bit(DASD_FLAG_RO, &devmap->device->flags);
659 else
660 clear_bit(DASD_FLAG_RO, &devmap->device->flags);
661 }
662 spin_unlock(&dasd_devmap_lock); 648 spin_unlock(&dasd_devmap_lock);
663 return count; 649 return count;
664} 650}
@@ -739,6 +725,45 @@ static struct attribute_group dasd_attr_group = {
739 .attrs = dasd_attrs, 725 .attrs = dasd_attrs,
740}; 726};
741 727
728/*
729 * Return value of the specified feature.
730 */
731int
732dasd_get_feature(struct ccw_device *cdev, int feature)
733{
734 struct dasd_devmap *devmap;
735
736 devmap = dasd_find_busid(cdev->dev.bus_id);
737 if (IS_ERR(devmap))
738 return (int) PTR_ERR(devmap);
739
740 return ((devmap->features & feature) != 0);
741}
742
743/*
744 * Set / reset given feature.
745 * Flag indicates wether to set (!=0) or the reset (=0) the feature.
746 */
747int
748dasd_set_feature(struct ccw_device *cdev, int feature, int flag)
749{
750 struct dasd_devmap *devmap;
751
752 devmap = dasd_find_busid(cdev->dev.bus_id);
753 if (IS_ERR(devmap))
754 return (int) PTR_ERR(devmap);
755
756 spin_lock(&dasd_devmap_lock);
757 if (flag)
758 devmap->features |= feature;
759 else
760 devmap->features &= ~feature;
761
762 spin_unlock(&dasd_devmap_lock);
763 return 0;
764}
765
766
742int 767int
743dasd_add_sysfs_files(struct ccw_device *cdev) 768dasd_add_sysfs_files(struct ccw_device *cdev)
744{ 769{