提交 4dd3cc5c 编写于 作者: C Cornelia Huck 提交者: Martin Schwidefsky

[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: NCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 0ec67667
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#include "chsc.h" #include "chsc.h"
#include "device.h" #include "device.h"
int int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
{ {
/* /*
* The flag usage is mutal exclusive ... * The flag usage is mutal exclusive ...
...@@ -39,6 +38,33 @@ ccw_device_set_options(struct ccw_device *cdev, unsigned long flags) ...@@ -39,6 +38,33 @@ ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
return 0; return 0;
} }
int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
{
/*
* The flag usage is mutal exclusive ...
*/
if (((flags & CCWDEV_EARLY_NOTIFICATION) &&
(flags & CCWDEV_REPORT_ALL)) ||
((flags & CCWDEV_EARLY_NOTIFICATION) &&
cdev->private->options.repall) ||
((flags & CCWDEV_REPORT_ALL) &&
cdev->private->options.fast))
return -EINVAL;
cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0;
cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0;
cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0;
cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0;
return 0;
}
void ccw_device_clear_options(struct ccw_device *cdev, unsigned long flags)
{
cdev->private->options.fast &= (flags & CCWDEV_EARLY_NOTIFICATION) == 0;
cdev->private->options.repall &= (flags & CCWDEV_REPORT_ALL) == 0;
cdev->private->options.pgroup &= (flags & CCWDEV_DO_PATHGROUP) == 0;
cdev->private->options.force &= (flags & CCWDEV_ALLOW_FORCE) == 0;
}
int int
ccw_device_clear(struct ccw_device *cdev, unsigned long intparm) ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
{ {
...@@ -601,7 +627,9 @@ _ccw_device_get_device_number(struct ccw_device *cdev) ...@@ -601,7 +627,9 @@ _ccw_device_get_device_number(struct ccw_device *cdev)
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(ccw_device_set_options_mask);
EXPORT_SYMBOL(ccw_device_set_options); EXPORT_SYMBOL(ccw_device_set_options);
EXPORT_SYMBOL(ccw_device_clear_options);
EXPORT_SYMBOL(ccw_device_clear); EXPORT_SYMBOL(ccw_device_clear);
EXPORT_SYMBOL(ccw_device_halt); EXPORT_SYMBOL(ccw_device_halt);
EXPORT_SYMBOL(ccw_device_resume); EXPORT_SYMBOL(ccw_device_resume);
......
...@@ -3194,7 +3194,7 @@ qdio_establish(struct qdio_initialize *init_data) ...@@ -3194,7 +3194,7 @@ qdio_establish(struct qdio_initialize *init_data)
spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags); spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags);
ccw_device_set_options(cdev, 0); ccw_device_set_options_mask(cdev, 0);
result=ccw_device_start_timeout(cdev,&irq_ptr->ccw, result=ccw_device_start_timeout(cdev,&irq_ptr->ccw,
QDIO_DOING_ESTABLISH,0, 0, QDIO_DOING_ESTABLISH,0, 0,
QDIO_ESTABLISH_TIMEOUT); QDIO_ESTABLISH_TIMEOUT);
......
...@@ -110,7 +110,9 @@ extern void ccw_driver_unregister (struct ccw_driver *driver); ...@@ -110,7 +110,9 @@ extern void ccw_driver_unregister (struct ccw_driver *driver);
struct ccw1; struct ccw1;
extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long);
extern int ccw_device_set_options(struct ccw_device *, unsigned long); extern int ccw_device_set_options(struct ccw_device *, unsigned long);
extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
/* Allow for i/o completion notification after primary interrupt status. */ /* Allow for i/o completion notification after primary interrupt status. */
#define CCWDEV_EARLY_NOTIFICATION 0x0001 #define CCWDEV_EARLY_NOTIFICATION 0x0001
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册