tree-wide: fix assorted typos all over the place
[safe/jmp/linux-2.6] / drivers / s390 / cio / cmf.c
index 288482b..2985eb4 100644 (file)
@@ -25,6 +25,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define KMSG_COMPONENT "cio"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
 #include <linux/bootmem.h>
 #include <linux/device.h>
 #include <linux/init.h>
@@ -185,58 +188,19 @@ static inline void cmf_activate(void *area, unsigned int onoff)
 static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc,
                     unsigned long address)
 {
-       int ret;
-       int retry;
        struct subchannel *sch;
-       struct schib *schib;
 
        sch = to_subchannel(cdev->dev.parent);
-       schib = &sch->schib;
-       /* msch can silently fail, so do it again if necessary */
-       for (retry = 0; retry < 3; retry++) {
-               /* prepare schib */
-               if (cio_update_schib(sch))
-                       return -ENODEV;
-               schib->pmcw.mme  = mme;
-               schib->pmcw.mbfc = mbfc;
-               /* address can be either a block address or a block index */
-               if (mbfc)
-                       schib->mba = address;
-               else
-                       schib->pmcw.mbi = address;
-
-               /* try to submit it */
-               switch(ret = msch_err(sch->schid, schib)) {
-                       case 0:
-                               break;
-                       case 1:
-                       case 2: /* in I/O or status pending */
-                               ret = -EBUSY;
-                               break;
-                       case 3: /* subchannel is no longer valid */
-                               ret = -ENODEV;
-                               break;
-                       default: /* msch caught an exception */
-                               ret = -EINVAL;
-                               break;
-               }
-               if (cio_update_schib(sch))
-                       return -ENODEV;
-
-               if (ret)
-                       break;
-
-               /* check if it worked */
-               if (schib->pmcw.mme  == mme &&
-                   schib->pmcw.mbfc == mbfc &&
-                   (mbfc ? (schib->mba == address)
-                         : (schib->pmcw.mbi == address)))
-                       return 0;
 
-               ret = -EINVAL;
-       }
+       sch->config.mme = mme;
+       sch->config.mbfc = mbfc;
+       /* address can be either a block address or a block index */
+       if (mbfc)
+               sch->config.mba = address;
+       else
+               sch->config.mbi = address;
 
-       return ret;
+       return cio_commit_config(sch);
 }
 
 struct set_schib_struct {
@@ -498,7 +462,7 @@ static struct cmb_area cmb_area = {
  * block of memory, which can not be moved as long as any channel
  * is active. Therefore, a maximum number of subchannels needs to
  * be defined somewhere. This is a module parameter, defaulting to
- * a resonable value of 1024, or 32 kb of memory.
+ * a reasonable value of 1024, or 32 kb of memory.
  * Current kernels don't allow kmalloc with more than 128kb, so the
  * maximum is 4096.
  */
@@ -1240,6 +1204,11 @@ static ssize_t cmb_enable_store(struct device *dev,
 
 DEVICE_ATTR(cmb_enable, 0644, cmb_enable_show, cmb_enable_store);
 
+int ccw_set_cmf(struct ccw_device *cdev, int enable)
+{
+       return cmbops->set(cdev, enable ? 2 : 0);
+}
+
 /**
  * enable_cmf() - switch on the channel measurement for a specific device
  *  @cdev:     The ccw device to be enabled
@@ -1361,9 +1330,8 @@ static int __init init_cmf(void)
        default:
                return 1;
        }
-
-       printk(KERN_INFO "cio: Channel measurement facility using %s "
-              "format (%s)\n", format_string, detect_string);
+       pr_info("Channel measurement facility initialized using format "
+               "%s (mode %s)\n", format_string, detect_string);
        return 0;
 }