 +	}
 +
 +	/* ...copy mesh data */
-+	if (copy_from_user(buf, (void __user *)(arg + sizeof(desc)), length)) {
++	if (copy_from_user(buf, (void __user *)desc->data, length)) {
 +		v4l2_err(&imr->v4l2_dev, "failed to read %u bytes of mapping specification\n", length);
 +		ret = -EFAULT;
 +		goto out;
 +	}
 +
++	type = desc->type;
++
 +	/* ...mesh item size calculation */
-+	item_size = (desc.type & IMR_MAP_LUCE ? 4 : 0) + (desc.type & IMR_MAP_CLCE ? 4 : 0);
++	item_size = (type & IMR_MAP_LUCE ? 4 : 0) + (type & IMR_MAP_CLCE ? 4 : 0);
 +
 +	/* ...calculate the length of a display list */
-+	if (desc.type & IMR_MAP_MESH) {
++	if (type & IMR_MAP_MESH) {
 +		/* ...assure we have proper mesh descriptor */
 +		if (length < sizeof(struct imr_mesh)) {
 +			v4l2_err(&imr->v4l2_dev, "invalid mesh specification size: %u\n", length);

+static inline struct imr_ctx * fh_to_ctx(struct v4l2_fh *fh)
+{
+	return container_of(fh, struct imr_ctx, fh);
+}
+
+/*******************************************************************************

+#define IMR_OP_GOSUB                    ((0x8C << 24))
+#define IMR_OP_RET                      ((0x8D << 24))
+
+/*******************************************************************************
+ * Operation type decoding helpers
+ ******************************************************************************/
