aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2007-02-12 09:47:18 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-02-12 09:47:18 -0500
commit4dd3cc5caf41d55cd5e55f32902c8a2ad3296e19 (patch)
tree458be42776f00233f99fa270b8f249f6a1c95c5c /drivers
parent0ec67667ab414b18a0518d5b11c842fd342e9cb1 (diff)
[S390] cio: Fixup interface for setting options on ccw devices.
The current ccw_device_set_options() sets a specified mask of options and clears those not specified, but there is no way to find out which options have already been set. In order to fix this up, introduce the following interface changes: ccw_device_set_options() now only sets the specified bits, but does not clear those that are not specified. ccw_device_clear_options() clears the specified bits. ccw_device_set_options_mask() provides the old semantics (setting only the specified bits and clearing the others). Device drivers now work as expected. qdio has been adapted. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/cio/device_ops.c32
-rw-r--r--drivers/s390/cio/qdio.c2
2 files changed, 31 insertions, 3 deletions
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index d7b25b8f71d2..7c7775aae38a 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -23,8 +23,7 @@
23#include "chsc.h" 23#include "chsc.h"
24#include "device.h" 24#include "device.h"
25 25
26int 26int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
27ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
28{ 27{
29 /* 28 /*
30 * The flag usage is mutal exclusive ... 29 * The flag usage is mutal exclusive ...
@@ -39,6 +38,33 @@ ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
39 return 0; 38 return 0;
40} 39}
41 40
41int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
42{
43 /*
44 * The flag usage is mutal exclusive ...
45 */
46 if (((flags & CCWDEV_EARLY_NOTIFICATION) &&
47 (flags & CCWDEV_REPORT_ALL)) ||
48 ((flags & CCWDEV_EARLY_NOTIFICATION) &&
49 cdev->private->options.repall) ||
50 ((flags & CCWDEV_REPORT_ALL) &&
51 cdev->private->options.fast))
52 return -EINVAL;
53 cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0;
54 cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0;
55 cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0;
56 cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0;
57 return 0;
58}
59
60void ccw_device_clear_options(struct ccw_device *cdev, unsigned long flags)
61{
62 cdev->private->options.fast &= (flags & CCWDEV_EARLY_NOTIFICATION) == 0;
63 cdev->private->options.repall &= (flags & CCWDEV_REPORT_ALL) == 0;
64 cdev->private->options.pgroup &= (flags & CCWDEV_DO_PATHGROUP) == 0;
65 cdev->private->options.force &= (flags & CCWDEV_ALLOW_FORCE) == 0;
66}
67
42int 68int
43ccw_device_clear(struct ccw_device *cdev, unsigned long intparm) 69ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
44{ 70{
@@ -601,7 +627,9 @@ _ccw_device_get_device_number(struct ccw_device *cdev)
601 627
602 628
603MODULE_LICENSE("GPL"); 629MODULE_LICENSE("GPL");
630EXPORT_SYMBOL(ccw_device_set_options_mask);
604EXPORT_SYMBOL(ccw_device_set_options); 631EXPORT_SYMBOL(ccw_device_set_options);
632EXPORT_SYMBOL(ccw_device_clear_options);
605EXPORT_SYMBOL(ccw_device_clear); 633EXPORT_SYMBOL(ccw_device_clear);
606EXPORT_SYMBOL(ccw_device_halt); 634EXPORT_SYMBOL(ccw_device_halt);
607EXPORT_SYMBOL(ccw_device_resume); 635EXPORT_SYMBOL(ccw_device_resume);
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index d726cd5777de..5b1e3ff26c0b 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -3194,7 +3194,7 @@ qdio_establish(struct qdio_initialize *init_data)
3194 3194
3195 spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags); 3195 spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags);
3196 3196
3197 ccw_device_set_options(cdev, 0); 3197 ccw_device_set_options_mask(cdev, 0);
3198 result=ccw_device_start_timeout(cdev,&irq_ptr->ccw, 3198 result=ccw_device_start_timeout(cdev,&irq_ptr->ccw,
3199 QDIO_DOING_ESTABLISH,0, 0, 3199 QDIO_DOING_ESTABLISH,0, 0,
3200 QDIO_ESTABLISH_TIMEOUT); 3200 QDIO_ESTABLISH_TIMEOUT);