Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[pandora-kernel.git] / drivers / s390 / cio / device_ops.c
index d7b25b8..16f59fc 100644 (file)
 
 #include <asm/ccwdev.h>
 #include <asm/idals.h>
+#include <asm/chpid.h>
 
 #include "cio.h"
 #include "cio_debug.h"
 #include "css.h"
 #include "chsc.h"
 #include "device.h"
+#include "chp.h"
 
-int
-ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
+int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
 {
        /*
        * The flag usage is mutal exclusive ...
@@ -39,6 +40,33 @@ ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
        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
 ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
 {
@@ -580,9 +608,12 @@ void *
 ccw_device_get_chp_desc(struct ccw_device *cdev, int chp_no)
 {
        struct subchannel *sch;
+       struct chp_id chpid;
 
        sch = to_subchannel(cdev->dev.parent);
-       return chsc_get_chp_desc(sch, chp_no);
+       chp_id_init(&chpid);
+       chpid.id = sch->schib.pmcw.chpid[chp_no];
+       return chp_get_chp_desc(chpid);
 }
 
 // FIXME: these have to go:
@@ -601,7 +632,9 @@ _ccw_device_get_device_number(struct ccw_device *cdev)
 
 
 MODULE_LICENSE("GPL");
+EXPORT_SYMBOL(ccw_device_set_options_mask);
 EXPORT_SYMBOL(ccw_device_set_options);
+EXPORT_SYMBOL(ccw_device_clear_options);
 EXPORT_SYMBOL(ccw_device_clear);
 EXPORT_SYMBOL(ccw_device_halt);
 EXPORT_SYMBOL(ccw_device_resume);