diff --git a/buffers/zio-buf-kmalloc.c b/buffers/zio-buf-kmalloc.c
index 5dbfa730a00083319b9835d0d640339a9e88d6ba..c72ae77094fca0c0d7ebf9a8774a28f202ed4254 100644
--- a/buffers/zio-buf-kmalloc.c
+++ b/buffers/zio-buf-kmalloc.c
@@ -33,9 +33,6 @@ struct zbk_instance {
 };
 #define to_zbki(bi) container_of(bi, struct zbk_instance, bi)
 
-#define ZBK_FLAG_INPUT		0x01 /* private: user reads */
-#define ZBK_FLAG_OUTPUT		0x02 /* private: user writes */
-
 /* The list in the structure above collects a bunch of these */
 struct zbk_item {
 	struct zio_block block;
@@ -117,7 +114,7 @@ static int zbk_store_block(struct zio_bi *bi, struct zio_block *block)
 	spin_unlock(&zbki->lock);
 
 	/* if input, awake user space */
-	if (awake && (bi->flags & ZIO_BUFFER_INPUT))
+	if (awake && ((bi->flags & ZIO_DIR) == ZIO_DIR_INPUT))
 		wake_up_interruptible(&bi->q);
 	return 0;
 
@@ -147,7 +144,7 @@ static struct zio_block *zbk_retr_block(struct zio_bi *bi)
 	zbki->nitem--;
 	spin_unlock(&zbki->lock);
 
-	if (awake && (bi->flags & ZIO_BUFFER_OUTPUT))
+	if (awake && (bi->flags & ZIO_DIR_OUTPUT))
 		wake_up_interruptible(&bi->q);
 	pr_debug("%s:%d (%p, %p)\n", __func__, __LINE__, bi, item);
 	return &item->block;
@@ -163,22 +160,9 @@ static struct zio_bi *zbk_create(struct zio_buffer_type *zbuf,
 	struct zio_channel *chan, fmode_t f_flags)
 {
 	struct zbk_instance *zbki;
-	unsigned long flags;
 
 	pr_debug("%s:%d\n", __func__, __LINE__);
 
-	/* FIXME: bi->flags must be set in zio-core */
-	switch (f_flags & (FMODE_READ | FMODE_WRITE)) {
-	case  FMODE_WRITE:
-		flags = ZIO_BUFFER_OUTPUT;
-		break;
-	case  FMODE_READ:
-		flags = ZIO_BUFFER_INPUT;
-		break;
-	default:
-		return ERR_PTR(-EINVAL);
-	}
-
 	zbki = kzalloc(sizeof(*zbki), GFP_KERNEL);
 	if (!zbki)
 		return ERR_PTR(-ENOMEM);
@@ -186,7 +170,6 @@ static struct zio_bi *zbk_create(struct zio_buffer_type *zbuf,
 	INIT_LIST_HEAD(&zbki->list);
 
 	/* all the fields of zio_bi are initialied by the caller */
-	zbki->bi.flags = flags;
 	return &zbki->bi;
 }
 
diff --git a/drivers/zio-zero.c b/drivers/zio-zero.c
index 9bdf82d605160eede63984157f936b85aede4185..d737a13745ed8acec0e7646a1849bb9ef4a8d2b7 100644
--- a/drivers/zio-zero.c
+++ b/drivers/zio-zero.c
@@ -41,7 +41,7 @@ static struct zio_cset zzero_cset[] = {
 	{
 		.n_chan =	3,
 		.ssize =	1,
-		.flags =	ZCSET_TYPE_ANALOG | ZCSET_DIR_INPUT,
+		.flags =	ZIO_DIR_INPUT | ZCSET_TYPE_ANALOG,
 	},
 };
 
diff --git a/include/linux/zio-buffer.h b/include/linux/zio-buffer.h
index 520308c840542fd434cc851fca7cefe47ffc9f22..22d5186057bec0cebbed06759512ff7c5bd2aebd 100644
--- a/include/linux/zio-buffer.h
+++ b/include/linux/zio-buffer.h
@@ -164,8 +164,8 @@ struct zio_bi {
 	struct zio_cset		*cset;		/* short for chan->cset */
 
 	/* Those using generic_read need this information */
-	unsigned long flags; /* input or output */
-	wait_queue_head_t q; /* either read or write */
+	unsigned long flags;			/* input or output, etc */
+	wait_queue_head_t q;			/* for reading or writing */
 
 	/* Standard and extended attributes for this object */
 	struct zio_attribute_set	zattr_set;
@@ -175,10 +175,6 @@ struct zio_bi {
 };
 #define to_zio_bi(_kobj) container_of(_kobj, struct zio_bi, head.kobj)
 
-/* the instance is either for input or for output */
-#define ZIO_BUFFER_INPUT	0x01
-#define ZIO_BUFFER_OUTPUT	0x01
-
 /* The block is the basic data item being transferred */
 struct zio_block {
 	unsigned long		ctrl_flags;
diff --git a/include/linux/zio-trigger.h b/include/linux/zio-trigger.h
index a6f78c8e5ddf4c42e902b1b806b68561773677bc..5a99e6a7461e5cc33c546a8b82fcffd2271279d5 100644
--- a/include/linux/zio-trigger.h
+++ b/include/linux/zio-trigger.h
@@ -34,8 +34,10 @@ struct zio_ti {
 	struct list_head	list;		/* instance list */
 	struct zio_cset		*cset;
 
+	unsigned long		flags;		/* input or output, etc */
 	struct zio_control	*current_ctrl;	/* the active one */
-	struct timespec tstamp;
+	/* This is for software stamping */
+	struct timespec		tstamp;
 	uint64_t tstamp_extra;
 
 	/* Standard and extended attributes for this object */
diff --git a/include/linux/zio.h b/include/linux/zio.h
index 3ba20918dbcfcaa5cbfe01c78264e9c9b739aa38..9c16d72ff0935a3d7e774e474e8114f8751de470 100644
--- a/include/linux/zio.h
+++ b/include/linux/zio.h
@@ -149,9 +149,12 @@ struct zio_attribute_set {
 		.value = _val,						\
 }
 
-/* Bits 0..3 are reserved for use in all objects. By now only bit 1 is used */
+/* Bits 0..3 are reserved for use in all objects. By now 2 of them are used */
 enum zobj_flags {
 	ZIO_DISABLED		= 0x1,	/* 0 (default) is enabled */
+	ZIO_DIR			= 0x2,	/* 0 is input  - 1 is output*/
+	ZIO_DIR_INPUT		= 0x0,
+	ZIO_DIR_OUTPUT		= 0x2,
 };
 
 /*
@@ -214,14 +217,11 @@ struct zio_cset {
 
 /* first 4bit are reserved for zio object universal flags */
 enum zcset_flags {
-	ZCSET_DIR		= 0x10,	/* 0 is input  - 1 is output*/
-	ZCSET_DIR_INPUT		= 0x00,
-	ZCSET_DIR_OUTPUT	= 0x10,
-	ZCSET_TYPE		= 0x20,	/* 0 is digital - 1 is analog*/
+	ZCSET_TYPE		= 0x10,	/* 0 is digital - 1 is analog*/
 	ZCSET_TYPE_DIGITAL	= 0x00,
-	ZCSET_TYPE_ANALOG	= 0x20,
-	ZCSET_CHAN_ALLOC	= 0x40, /* 1 if channels are allocated by zio*/
-	ZCSET_CHAN_ALLOC_ON	= 0x40,
+	ZCSET_TYPE_ANALOG	= 0x10,
+	ZCSET_CHAN_ALLOC	= 0x20, /* 1 if channels are allocated by zio*/
+	ZCSET_CHAN_ALLOC_ON	= 0x20,
 	ZCSET_CHAN_ALLOC_OFF	= 0x00,
 };
 
diff --git a/zio-sys.c b/zio-sys.c
index 36770e37cbc29e0ff4e2547f46ac3774532d2c9e..fe4d0f503942e8d7892af8b03666220b652f890d 100644
--- a/zio-sys.c
+++ b/zio-sys.c
@@ -548,6 +548,7 @@ static int __buffer_create_instance(struct zio_channel *chan)
 	/* Now fill the trigger instance, ops, head, then the rest */
 	bi->b_op = zbuf->b_op;
 	bi->f_op = zbuf->f_op;
+	bi->flags |= (chan->flags & ZIO_DIR);
 	bi->head.zobj_type = ZBI;
 	err = kobject_init_and_add(&bi->head.kobj, &zdktype,
 			&chan->head.kobj, "buffer");
@@ -628,6 +629,7 @@ static int __trigger_create_instance(struct zio_cset *cset)
 	/* Now fill the trigger instance, ops, head, then the rest */
 	ti->t_op = cset->trig->t_op;
 	ti->f_op = cset->trig->f_op;
+	ti->flags |= cset->flags & ZIO_DIR;
 	ti->head.zobj_type = ZTI;
 	err = kobject_init_and_add(&ti->head.kobj, &zdktype,
 		&cset->head.kobj, "trigger");
@@ -842,6 +844,7 @@ static int cset_register(struct zio_cset *cset)
 	for (i = 0; i < cset->n_chan; i++) {
 		cset->chan[i].index = i;
 		cset->chan[i].cset = cset;
+		cset->chan[i].flags |= cset->flags & ZIO_DIR;
 		err = chan_register(&cset->chan[i]);
 		if (err)
 			goto out_reg;