diff --git a/drivers/staging/iio/buffer_generic.h b/drivers/staging/iio/buffer_generic.h
index 548bb74..9e8f010 100644
--- a/drivers/staging/iio/buffer_generic.h
+++ b/drivers/staging/iio/buffer_generic.h
@@ -120,10 +120,10 @@
 /**
  * iio_buffer_init() - Initialize the buffer structure
  * @buffer: buffer to be initialized
- * @dev_info: the iio device the buffer is assocated with
+ * @indio_dev: the iio device the buffer is assocated with
  **/
 void iio_buffer_init(struct iio_buffer *buffer,
-			  struct iio_dev *dev_info);
+			  struct iio_dev *indio_dev);
 
 void iio_buffer_deinit(struct iio_buffer *buffer);
 
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index e7c2865..f3d88cd 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -323,23 +323,23 @@
 
 /**
  * iio_device_register() - register a device with the IIO subsystem
- * @dev_info:		Device structure filled by the device driver
+ * @indio_dev:		Device structure filled by the device driver
  **/
-int iio_device_register(struct iio_dev *dev_info);
+int iio_device_register(struct iio_dev *indio_dev);
 
 /**
  * iio_device_unregister() - unregister a device from the IIO subsystem
- * @dev_info:		Device structure representing the device.
+ * @indio_dev:		Device structure representing the device.
  **/
-void iio_device_unregister(struct iio_dev *dev_info);
+void iio_device_unregister(struct iio_dev *indio_dev);
 
 /**
  * iio_push_event() - try to add event to the list for userspace reading
- * @dev_info:		IIO device structure
+ * @indio_dev:		IIO device structure
  * @ev_code:		What event
  * @timestamp:		When the event occurred
  **/
-int iio_push_event(struct iio_dev *dev_info, u64 ev_code, s64 timestamp);
+int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
 
 extern struct bus_type iio_bus_type;
 
@@ -347,10 +347,10 @@
  * iio_put_device() - reference counted deallocation of struct device
  * @dev: the iio_device containing the device
  **/
-static inline void iio_put_device(struct iio_dev *dev)
+static inline void iio_put_device(struct iio_dev *indio_dev)
 {
-	if (dev)
-		put_device(&dev->dev);
+	if (indio_dev)
+		put_device(&indio_dev->dev);
 };
 
 /* Can we make this smaller? */
@@ -361,9 +361,9 @@
  **/
 struct iio_dev *iio_allocate_device(int sizeof_priv);
 
-static inline void *iio_priv(const struct iio_dev *dev)
+static inline void *iio_priv(const struct iio_dev *indio_dev)
 {
-	return (char *)dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
+	return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
 }
 
 static inline struct iio_dev *iio_priv_to_dev(void *priv)
@@ -376,15 +376,15 @@
  * iio_free_device() - free an iio_dev from a driver
  * @dev: the iio_dev associated with the device
  **/
-void iio_free_device(struct iio_dev *dev);
+void iio_free_device(struct iio_dev *indio_dev);
 
 /**
  * iio_buffer_enabled() - helper function to test if the buffer is enabled
- * @dev_info:		IIO device info structure for device
+ * @indio_dev:		IIO device info structure for device
  **/
-static inline bool iio_buffer_enabled(struct iio_dev *dev_info)
+static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
 {
-	return dev_info->currentmode
+	return indio_dev->currentmode
 		& (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
 };
 
diff --git a/drivers/staging/iio/iio_core_trigger.h b/drivers/staging/iio/iio_core_trigger.h
index 3e5195a..523c288 100644
--- a/drivers/staging/iio/iio_core_trigger.h
+++ b/drivers/staging/iio/iio_core_trigger.h
@@ -11,32 +11,33 @@
 #ifdef CONFIG_IIO_TRIGGER
 /**
  * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers
- * @dev_info: iio_dev associated with the device that will consume the trigger
+ * @indio_dev: iio_dev associated with the device that will consume the trigger
  **/
-int iio_device_register_trigger_consumer(struct iio_dev *dev_info);
+
+int iio_device_register_trigger_consumer(struct iio_dev *indio_dev);
 
 /**
  * iio_device_unregister_trigger_consumer() - reverse the registration process
- * @dev_info: iio_dev associated with the device that consumed the trigger
+ * @indio_dev: iio_dev associated with the device that consumed the trigger
  **/
-void iio_device_unregister_trigger_consumer(struct iio_dev *dev_info);
+void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev);
 
 #else
 
 /**
  * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers
- * @dev_info: iio_dev associated with the device that will consume the trigger
+ * @indio_dev: iio_dev associated with the device that will consume the trigger
  **/
-static int iio_device_register_trigger_consumer(struct iio_dev *dev_info)
+static int iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
 {
 	return 0;
 };
 
 /**
  * iio_device_unregister_trigger_consumer() - reverse the registration process
- * @dev_info: iio_dev associated with the device that consumed the trigger
+ * @indio_dev: iio_dev associated with the device that consumed the trigger
  **/
-static void iio_device_unregister_trigger_consumer(struct iio_dev *dev_info)
+static void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
 {
 };
 
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c
index 60929ff..6dd5d7d 100644
--- a/drivers/staging/iio/industrialio-buffer.c
+++ b/drivers/staging/iio/industrialio-buffer.c
@@ -82,9 +82,9 @@
 		rb->access->unmark_in_use(rb);
 }
 
-void iio_buffer_init(struct iio_buffer *buffer, struct iio_dev *dev_info)
+void iio_buffer_init(struct iio_buffer *buffer, struct iio_dev *indio_dev)
 {
-	buffer->indio_dev = dev_info;
+	buffer->indio_dev = indio_dev;
 	init_waitqueue_head(&buffer->pollq);
 }
 EXPORT_SYMBOL(iio_buffer_init);
@@ -123,9 +123,9 @@
 				char *buf)
 {
 	int ret;
-	struct iio_dev *dev_info = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
-	ret = iio_scan_mask_query(dev_info->buffer,
+	ret = iio_scan_mask_query(indio_dev->buffer,
 				  to_iio_dev_attr(attr)->address);
 	if (ret < 0)
 		return ret;
@@ -180,8 +180,8 @@
 				   struct device_attribute *attr,
 				   char *buf)
 {
-	struct iio_dev *dev_info = dev_get_drvdata(dev);
-	return sprintf(buf, "%d\n", dev_info->buffer->scan_timestamp);
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	return sprintf(buf, "%d\n", indio_dev->buffer->scan_timestamp);
 }
 
 static ssize_t iio_scan_el_ts_store(struct device *dev,
@@ -427,11 +427,11 @@
 	int ret;
 	bool requested_state, current_state;
 	int previous_mode;
-	struct iio_dev *dev_info = dev_get_drvdata(dev);
-	struct iio_buffer *buffer = dev_info->buffer;
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_buffer *buffer = indio_dev->buffer;
 
-	mutex_lock(&dev_info->mlock);
-	previous_mode = dev_info->currentmode;
+	mutex_lock(&indio_dev->mlock);
+	previous_mode = indio_dev->currentmode;
 	requested_state = !(buf[0] == '0');
 	current_state = !!(previous_mode & INDIO_ALL_BUFFER_MODES);
 	if (current_state == requested_state) {
@@ -440,7 +440,7 @@
 	}
 	if (requested_state) {
 		if (buffer->setup_ops->preenable) {
-			ret = buffer->setup_ops->preenable(dev_info);
+			ret = buffer->setup_ops->preenable(indio_dev);
 			if (ret) {
 				printk(KERN_ERR
 				       "Buffer not started:"
@@ -460,8 +460,8 @@
 		if (buffer->access->mark_in_use)
 			buffer->access->mark_in_use(buffer);
 		/* Definitely possible for devices to support both of these.*/
-		if (dev_info->modes & INDIO_BUFFER_TRIGGERED) {
-			if (!dev_info->trig) {
+		if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) {
+			if (!indio_dev->trig) {
 				printk(KERN_INFO
 				       "Buffer not started: no trigger\n");
 				ret = -EINVAL;
@@ -469,50 +469,50 @@
 					buffer->access->unmark_in_use(buffer);
 				goto error_ret;
 			}
-			dev_info->currentmode = INDIO_BUFFER_TRIGGERED;
-		} else if (dev_info->modes & INDIO_BUFFER_HARDWARE)
-			dev_info->currentmode = INDIO_BUFFER_HARDWARE;
+			indio_dev->currentmode = INDIO_BUFFER_TRIGGERED;
+		} else if (indio_dev->modes & INDIO_BUFFER_HARDWARE)
+			indio_dev->currentmode = INDIO_BUFFER_HARDWARE;
 		else { /* should never be reached */
 			ret = -EINVAL;
 			goto error_ret;
 		}
 
 		if (buffer->setup_ops->postenable) {
-			ret = buffer->setup_ops->postenable(dev_info);
+			ret = buffer->setup_ops->postenable(indio_dev);
 			if (ret) {
 				printk(KERN_INFO
 				       "Buffer not started:"
 				       "postenable failed\n");
 				if (buffer->access->unmark_in_use)
 					buffer->access->unmark_in_use(buffer);
-				dev_info->currentmode = previous_mode;
+				indio_dev->currentmode = previous_mode;
 				if (buffer->setup_ops->postdisable)
 					buffer->setup_ops->
-						postdisable(dev_info);
+						postdisable(indio_dev);
 				goto error_ret;
 			}
 		}
 	} else {
 		if (buffer->setup_ops->predisable) {
-			ret = buffer->setup_ops->predisable(dev_info);
+			ret = buffer->setup_ops->predisable(indio_dev);
 			if (ret)
 				goto error_ret;
 		}
 		if (buffer->access->unmark_in_use)
 			buffer->access->unmark_in_use(buffer);
-		dev_info->currentmode = INDIO_DIRECT_MODE;
+		indio_dev->currentmode = INDIO_DIRECT_MODE;
 		if (buffer->setup_ops->postdisable) {
-			ret = buffer->setup_ops->postdisable(dev_info);
+			ret = buffer->setup_ops->postdisable(indio_dev);
 			if (ret)
 				goto error_ret;
 		}
 	}
 done:
-	mutex_unlock(&dev_info->mlock);
+	mutex_unlock(&indio_dev->mlock);
 	return len;
 
 error_ret:
-	mutex_unlock(&dev_info->mlock);
+	mutex_unlock(&indio_dev->mlock);
 	return ret;
 }
 EXPORT_SYMBOL(iio_buffer_store_enable);
@@ -521,8 +521,8 @@
 			       struct device_attribute *attr,
 			       char *buf)
 {
-	struct iio_dev *dev_info = dev_get_drvdata(dev);
-	return sprintf(buf, "%d\n", !!(dev_info->currentmode
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	return sprintf(buf, "%d\n", !!(indio_dev->currentmode
 				       & INDIO_ALL_BUFFER_MODES));
 }
 EXPORT_SYMBOL(iio_buffer_show_enable);
@@ -575,34 +575,34 @@
  **/
 int iio_scan_mask_set(struct iio_buffer *buffer, int bit)
 {
-	struct iio_dev *dev_info = buffer->indio_dev;
+	struct iio_dev *indio_dev = buffer->indio_dev;
 	unsigned long *mask;
 	unsigned long *trialmask;
 
 	trialmask = kmalloc(sizeof(*trialmask)*
-			    BITS_TO_LONGS(dev_info->masklength),
+			    BITS_TO_LONGS(indio_dev->masklength),
 			    GFP_KERNEL);
 
 	if (trialmask == NULL)
 		return -ENOMEM;
-	if (!dev_info->masklength) {
+	if (!indio_dev->masklength) {
 		WARN_ON("trying to set scanmask prior to registering buffer\n");
 		kfree(trialmask);
 		return -EINVAL;
 	}
-	bitmap_copy(trialmask, buffer->scan_mask, dev_info->masklength);
+	bitmap_copy(trialmask, buffer->scan_mask, indio_dev->masklength);
 	set_bit(bit, trialmask);
 
-	if (dev_info->available_scan_masks) {
-		mask = iio_scan_mask_match(dev_info->available_scan_masks,
-					   dev_info->masklength,
+	if (indio_dev->available_scan_masks) {
+		mask = iio_scan_mask_match(indio_dev->available_scan_masks,
+					   indio_dev->masklength,
 					   trialmask);
 		if (!mask) {
 			kfree(trialmask);
 			return -EINVAL;
 		}
 	}
-	bitmap_copy(buffer->scan_mask, trialmask, dev_info->masklength);
+	bitmap_copy(buffer->scan_mask, trialmask, indio_dev->masklength);
 	buffer->scan_count++;
 
 	kfree(trialmask);
@@ -613,17 +613,17 @@
 
 int iio_scan_mask_query(struct iio_buffer *buffer, int bit)
 {
-	struct iio_dev *dev_info = buffer->indio_dev;
+	struct iio_dev *indio_dev = buffer->indio_dev;
 	long *mask;
 
-	if (bit > dev_info->masklength)
+	if (bit > indio_dev->masklength)
 		return -EINVAL;
 
 	if (!buffer->scan_mask)
 		return 0;
-	if (dev_info->available_scan_masks)
-		mask = iio_scan_mask_match(dev_info->available_scan_masks,
-					   dev_info->masklength,
+	if (indio_dev->available_scan_masks)
+		mask = iio_scan_mask_match(indio_dev->available_scan_masks,
+					   indio_dev->masklength,
 					   buffer->scan_mask);
 	else
 		mask = buffer->scan_mask;
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 5a6dde8..f52fa3a 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -119,9 +119,9 @@
 	struct attribute_group			group;
 };
 
-int iio_push_event(struct iio_dev *dev_info, u64 ev_code, s64 timestamp)
+int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)
 {
-	struct iio_event_interface *ev_int = dev_info->event_interface;
+	struct iio_event_interface *ev_int = indio_dev->event_interface;
 	struct iio_detected_event_list *ev;
 	int ret = 0;
 
@@ -567,7 +567,7 @@
 	return ret;
 }
 
-static int iio_device_add_channel_sysfs(struct iio_dev *dev_info,
+static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
 					struct iio_chan_spec const *chan)
 {
 	int ret, i, attrcount = 0;
@@ -582,8 +582,8 @@
 				      &iio_write_channel_info : NULL),
 				     0,
 				     0,
-				     &dev_info->dev,
-				     &dev_info->channel_attr_list);
+				     &indio_dev->dev,
+				     &indio_dev->channel_attr_list);
 	if (ret)
 		goto error_ret;
 	attrcount++;
@@ -595,8 +595,8 @@
 					     &iio_write_channel_info,
 					     (1 << i),
 					     !(i%2),
-					     &dev_info->dev,
-					     &dev_info->channel_attr_list);
+					     &indio_dev->dev,
+					     &indio_dev->channel_attr_list);
 		if (ret == -EBUSY && (i%2 == 0)) {
 			ret = 0;
 			continue;
@@ -610,7 +610,7 @@
 	return ret;
 }
 
-static void iio_device_remove_and_free_read_attr(struct iio_dev *dev_info,
+static void iio_device_remove_and_free_read_attr(struct iio_dev *indio_dev,
 						 struct iio_dev_attr *p)
 {
 	kfree(p->dev_attr.attr.name);
@@ -627,15 +627,15 @@
 
 static DEVICE_ATTR(name, S_IRUGO, iio_show_dev_name, NULL);
 
-static int iio_device_register_sysfs(struct iio_dev *dev_info)
+static int iio_device_register_sysfs(struct iio_dev *indio_dev)
 {
 	int i, ret = 0, attrcount, attrn, attrcount_orig = 0;
 	struct iio_dev_attr *p, *n;
 	struct attribute **attr;
 
 	/* First count elements in any existing group */
-	if (dev_info->info->attrs) {
-		attr = dev_info->info->attrs->attrs;
+	if (indio_dev->info->attrs) {
+		attr = indio_dev->info->attrs->attrs;
 		while (*attr++ != NULL)
 			attrcount_orig++;
 	}
@@ -644,66 +644,66 @@
 	 * New channel registration method - relies on the fact a group does
 	 *  not need to be initialized if it is name is NULL.
 	 */
-	INIT_LIST_HEAD(&dev_info->channel_attr_list);
-	if (dev_info->channels)
-		for (i = 0; i < dev_info->num_channels; i++) {
-			ret = iio_device_add_channel_sysfs(dev_info,
-							   &dev_info
+	INIT_LIST_HEAD(&indio_dev->channel_attr_list);
+	if (indio_dev->channels)
+		for (i = 0; i < indio_dev->num_channels; i++) {
+			ret = iio_device_add_channel_sysfs(indio_dev,
+							   &indio_dev
 							   ->channels[i]);
 			if (ret < 0)
 				goto error_clear_attrs;
 			attrcount += ret;
 		}
 
-	if (dev_info->name)
+	if (indio_dev->name)
 		attrcount++;
 
-	dev_info->chan_attr_group.attrs
-		= kzalloc(sizeof(dev_info->chan_attr_group.attrs[0])*
+	indio_dev->chan_attr_group.attrs
+		= kzalloc(sizeof(indio_dev->chan_attr_group.attrs[0])*
 			  (attrcount + 1),
 			  GFP_KERNEL);
-	if (dev_info->chan_attr_group.attrs == NULL) {
+	if (indio_dev->chan_attr_group.attrs == NULL) {
 		ret = -ENOMEM;
 		goto error_clear_attrs;
 	}
 	/* Copy across original attributes */
-	if (dev_info->info->attrs)
-		memcpy(dev_info->chan_attr_group.attrs,
-		       dev_info->info->attrs->attrs,
-		       sizeof(dev_info->chan_attr_group.attrs[0])
+	if (indio_dev->info->attrs)
+		memcpy(indio_dev->chan_attr_group.attrs,
+		       indio_dev->info->attrs->attrs,
+		       sizeof(indio_dev->chan_attr_group.attrs[0])
 		       *attrcount_orig);
 	attrn = attrcount_orig;
 	/* Add all elements from the list. */
-	list_for_each_entry(p, &dev_info->channel_attr_list, l)
-		dev_info->chan_attr_group.attrs[attrn++] = &p->dev_attr.attr;
-	if (dev_info->name)
-		dev_info->chan_attr_group.attrs[attrn++] = &dev_attr_name.attr;
+	list_for_each_entry(p, &indio_dev->channel_attr_list, l)
+		indio_dev->chan_attr_group.attrs[attrn++] = &p->dev_attr.attr;
+	if (indio_dev->name)
+		indio_dev->chan_attr_group.attrs[attrn++] = &dev_attr_name.attr;
 
-	dev_info->groups[dev_info->groupcounter++] =
-		&dev_info->chan_attr_group;
+	indio_dev->groups[indio_dev->groupcounter++] =
+		&indio_dev->chan_attr_group;
 
 	return 0;
 
 error_clear_attrs:
 	list_for_each_entry_safe(p, n,
-				 &dev_info->channel_attr_list, l) {
+				 &indio_dev->channel_attr_list, l) {
 		list_del(&p->l);
-		iio_device_remove_and_free_read_attr(dev_info, p);
+		iio_device_remove_and_free_read_attr(indio_dev, p);
 	}
 
 	return ret;
 }
 
-static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
+static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
 {
 
 	struct iio_dev_attr *p, *n;
 
-	list_for_each_entry_safe(p, n, &dev_info->channel_attr_list, l) {
+	list_for_each_entry_safe(p, n, &indio_dev->channel_attr_list, l) {
 		list_del(&p->l);
-		iio_device_remove_and_free_read_attr(dev_info, p);
+		iio_device_remove_and_free_read_attr(indio_dev, p);
 	}
-	kfree(dev_info->chan_attr_group.attrs);
+	kfree(indio_dev->chan_attr_group.attrs);
 }
 
 static const char * const iio_ev_type_text[] = {
@@ -793,7 +793,7 @@
 	return len;
 }
 
-static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
+static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
 				      struct iio_chan_spec const *chan)
 {
 	int ret = 0, i, attrcount = 0;
@@ -834,8 +834,8 @@
 					     iio_ev_state_store,
 					     mask,
 					     0,
-					     &dev_info->dev,
-					     &dev_info->event_interface->
+					     &indio_dev->dev,
+					     &indio_dev->event_interface->
 					     dev_attr_list);
 		kfree(postfix);
 		if (ret)
@@ -853,8 +853,8 @@
 					     iio_ev_value_store,
 					     mask,
 					     0,
-					     &dev_info->dev,
-					     &dev_info->event_interface->
+					     &indio_dev->dev,
+					     &indio_dev->event_interface->
 					     dev_attr_list);
 		kfree(postfix);
 		if (ret)
@@ -866,26 +866,26 @@
 	return ret;
 }
 
-static inline void __iio_remove_event_config_attrs(struct iio_dev *dev_info)
+static inline void __iio_remove_event_config_attrs(struct iio_dev *indio_dev)
 {
 	struct iio_dev_attr *p, *n;
 	list_for_each_entry_safe(p, n,
-				 &dev_info->event_interface->
+				 &indio_dev->event_interface->
 				 dev_attr_list, l) {
 		kfree(p->dev_attr.attr.name);
 		kfree(p);
 	}
 }
 
-static inline int __iio_add_event_config_attrs(struct iio_dev *dev_info)
+static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev)
 {
 	int j, ret, attrcount = 0;
 
-	INIT_LIST_HEAD(&dev_info->event_interface->dev_attr_list);
+	INIT_LIST_HEAD(&indio_dev->event_interface->dev_attr_list);
 	/* Dynically created from the channels array */
-	for (j = 0; j < dev_info->num_channels; j++) {
-		ret = iio_device_add_event_sysfs(dev_info,
-						 &dev_info->channels[j]);
+	for (j = 0; j < indio_dev->num_channels; j++) {
+		ret = iio_device_add_event_sysfs(indio_dev,
+						 &indio_dev->channels[j]);
 		if (ret < 0)
 			goto error_clear_attrs;
 		attrcount += ret;
@@ -893,17 +893,17 @@
 	return attrcount;
 
 error_clear_attrs:
-	__iio_remove_event_config_attrs(dev_info);
+	__iio_remove_event_config_attrs(indio_dev);
 
 	return ret;
 }
 
-static bool iio_check_for_dynamic_events(struct iio_dev *dev_info)
+static bool iio_check_for_dynamic_events(struct iio_dev *indio_dev)
 {
 	int j;
 
-	for (j = 0; j < dev_info->num_channels; j++)
-		if (dev_info->channels[j].event_mask != 0)
+	for (j = 0; j < indio_dev->num_channels; j++)
+		if (indio_dev->channels[j].event_mask != 0)
 			return true;
 	return false;
 }
@@ -919,91 +919,91 @@
 }
 
 static const char *iio_event_group_name = "events";
-static int iio_device_register_eventset(struct iio_dev *dev_info)
+static int iio_device_register_eventset(struct iio_dev *indio_dev)
 {
 	struct iio_dev_attr *p;
 	int ret = 0, attrcount_orig = 0, attrcount, attrn;
 	struct attribute **attr;
 
-	if (!(dev_info->info->event_attrs ||
-	      iio_check_for_dynamic_events(dev_info)))
+	if (!(indio_dev->info->event_attrs ||
+	      iio_check_for_dynamic_events(indio_dev)))
 		return 0;
 
-	dev_info->event_interface =
+	indio_dev->event_interface =
 		kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL);
-	if (dev_info->event_interface == NULL) {
+	if (indio_dev->event_interface == NULL) {
 		ret = -ENOMEM;
 		goto error_ret;
 	}
 
-	iio_setup_ev_int(dev_info->event_interface);
-	if (dev_info->info->event_attrs != NULL) {
-		attr = dev_info->info->event_attrs->attrs;
+	iio_setup_ev_int(indio_dev->event_interface);
+	if (indio_dev->info->event_attrs != NULL) {
+		attr = indio_dev->info->event_attrs->attrs;
 		while (*attr++ != NULL)
 			attrcount_orig++;
 	}
 	attrcount = attrcount_orig;
-	if (dev_info->channels) {
-		ret = __iio_add_event_config_attrs(dev_info);
+	if (indio_dev->channels) {
+		ret = __iio_add_event_config_attrs(indio_dev);
 		if (ret < 0)
 			goto error_free_setup_event_lines;
 		attrcount += ret;
 	}
 
-	dev_info->event_interface->group.name = iio_event_group_name;
-	dev_info->event_interface->group.attrs =
-		kzalloc(sizeof(dev_info->event_interface->group.attrs[0])
+	indio_dev->event_interface->group.name = iio_event_group_name;
+	indio_dev->event_interface->group.attrs =
+		kzalloc(sizeof(indio_dev->event_interface->group.attrs[0])
 			*(attrcount + 1),
 			GFP_KERNEL);
-	if (dev_info->event_interface->group.attrs == NULL) {
+	if (indio_dev->event_interface->group.attrs == NULL) {
 		ret = -ENOMEM;
 		goto error_free_setup_event_lines;
 	}
-	if (dev_info->info->event_attrs)
-		memcpy(dev_info->event_interface->group.attrs,
-		       dev_info->info->event_attrs->attrs,
-		       sizeof(dev_info->event_interface->group.attrs[0])
+	if (indio_dev->info->event_attrs)
+		memcpy(indio_dev->event_interface->group.attrs,
+		       indio_dev->info->event_attrs->attrs,
+		       sizeof(indio_dev->event_interface->group.attrs[0])
 		       *attrcount_orig);
 	attrn = attrcount_orig;
 	/* Add all elements from the list. */
 	list_for_each_entry(p,
-			    &dev_info->event_interface->dev_attr_list,
+			    &indio_dev->event_interface->dev_attr_list,
 			    l)
-		dev_info->event_interface->group.attrs[attrn++] =
+		indio_dev->event_interface->group.attrs[attrn++] =
 			&p->dev_attr.attr;
 
-	dev_info->groups[dev_info->groupcounter++] =
-		&dev_info->event_interface->group;
+	indio_dev->groups[indio_dev->groupcounter++] =
+		&indio_dev->event_interface->group;
 
 	return 0;
 
 error_free_setup_event_lines:
-	__iio_remove_event_config_attrs(dev_info);
-	kfree(dev_info->event_interface);
+	__iio_remove_event_config_attrs(indio_dev);
+	kfree(indio_dev->event_interface);
 error_ret:
 
 	return ret;
 }
 
-static void iio_device_unregister_eventset(struct iio_dev *dev_info)
+static void iio_device_unregister_eventset(struct iio_dev *indio_dev)
 {
-	if (dev_info->event_interface == NULL)
+	if (indio_dev->event_interface == NULL)
 		return;
-	__iio_remove_event_config_attrs(dev_info);
-	kfree(dev_info->event_interface->group.attrs);
-	kfree(dev_info->event_interface);
+	__iio_remove_event_config_attrs(indio_dev);
+	kfree(indio_dev->event_interface->group.attrs);
+	kfree(indio_dev->event_interface);
 }
 
 static void iio_dev_release(struct device *device)
 {
-	struct iio_dev *dev_info = container_of(device, struct iio_dev, dev);
-	cdev_del(&dev_info->chrdev);
-	if (dev_info->modes & INDIO_BUFFER_TRIGGERED)
-		iio_device_unregister_trigger_consumer(dev_info);
-	iio_device_unregister_eventset(dev_info);
-	iio_device_unregister_sysfs(dev_info);
-	ida_simple_remove(&iio_ida, dev_info->id);
-	kfree(dev_info);
+	struct iio_dev *indio_dev = container_of(device, struct iio_dev, dev);
+	cdev_del(&indio_dev->chrdev);
+	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+		iio_device_unregister_trigger_consumer(indio_dev);
+	iio_device_unregister_eventset(indio_dev);
+	iio_device_unregister_sysfs(indio_dev);
+	ida_simple_remove(&iio_ida, indio_dev->id);
+	kfree(indio_dev);
 }
 
 static struct device_type iio_dev_type = {
@@ -1062,11 +1062,11 @@
  **/
 static int iio_chrdev_open(struct inode *inode, struct file *filp)
 {
-	struct iio_dev *dev_info = container_of(inode->i_cdev,
+	struct iio_dev *indio_dev = container_of(inode->i_cdev,
 						struct iio_dev, chrdev);
-	filp->private_data = dev_info;
+	filp->private_data = indio_dev;
 
-	return iio_chrdev_buffer_open(dev_info);
+	return iio_chrdev_buffer_open(indio_dev);
 }
 
 /**
@@ -1107,52 +1107,52 @@
 	.compat_ioctl = iio_ioctl,
 };
 
-int iio_device_register(struct iio_dev *dev_info)
+int iio_device_register(struct iio_dev *indio_dev)
 {
 	int ret;
 
 	/* configure elements for the chrdev */
-	dev_info->dev.devt = MKDEV(MAJOR(iio_devt), dev_info->id);
+	indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);
 
-	ret = iio_device_register_sysfs(dev_info);
+	ret = iio_device_register_sysfs(indio_dev);
 	if (ret) {
-		dev_err(dev_info->dev.parent,
+		dev_err(indio_dev->dev.parent,
 			"Failed to register sysfs interfaces\n");
 		goto error_ret;
 	}
-	ret = iio_device_register_eventset(dev_info);
+	ret = iio_device_register_eventset(indio_dev);
 	if (ret) {
-		dev_err(dev_info->dev.parent,
+		dev_err(indio_dev->dev.parent,
 			"Failed to register event set\n");
 		goto error_free_sysfs;
 	}
-	if (dev_info->modes & INDIO_BUFFER_TRIGGERED)
-		iio_device_register_trigger_consumer(dev_info);
+	if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+		iio_device_register_trigger_consumer(indio_dev);
 
-	ret = device_add(&dev_info->dev);
+	ret = device_add(&indio_dev->dev);
 	if (ret < 0)
 		goto error_unreg_eventset;
-	cdev_init(&dev_info->chrdev, &iio_buffer_fileops);
-	dev_info->chrdev.owner = dev_info->info->driver_module;
-	ret = cdev_add(&dev_info->chrdev, dev_info->dev.devt, 1);
+	cdev_init(&indio_dev->chrdev, &iio_buffer_fileops);
+	indio_dev->chrdev.owner = indio_dev->info->driver_module;
+	ret = cdev_add(&indio_dev->chrdev, indio_dev->dev.devt, 1);
 	if (ret < 0)
 		goto error_del_device;
 	return 0;
 
 error_del_device:
-	device_del(&dev_info->dev);
+	device_del(&indio_dev->dev);
 error_unreg_eventset:
-	iio_device_unregister_eventset(dev_info);
+	iio_device_unregister_eventset(indio_dev);
 error_free_sysfs:
-	iio_device_unregister_sysfs(dev_info);
+	iio_device_unregister_sysfs(indio_dev);
 error_ret:
 	return ret;
 }
 EXPORT_SYMBOL(iio_device_register);
 
-void iio_device_unregister(struct iio_dev *dev_info)
+void iio_device_unregister(struct iio_dev *indio_dev)
 {
-	device_unregister(&dev_info->dev);
+	device_unregister(&indio_dev->dev);
 }
 EXPORT_SYMBOL(iio_device_unregister);
 subsys_initcall(iio_init);
diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c
index 3926649..2c626e0 100644
--- a/drivers/staging/iio/industrialio-trigger.c
+++ b/drivers/staging/iio/industrialio-trigger.c
@@ -304,10 +304,10 @@
 					struct device_attribute *attr,
 					char *buf)
 {
-	struct iio_dev *dev_info = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
-	if (dev_info->trig)
-		return sprintf(buf, "%s\n", dev_info->trig->name);
+	if (indio_dev->trig)
+		return sprintf(buf, "%s\n", indio_dev->trig->name);
 	return 0;
 }
 
@@ -323,38 +323,38 @@
 					 const char *buf,
 					 size_t len)
 {
-	struct iio_dev *dev_info = dev_get_drvdata(dev);
-	struct iio_trigger *oldtrig = dev_info->trig;
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_trigger *oldtrig = indio_dev->trig;
 	struct iio_trigger *trig;
 	int ret;
 
-	mutex_lock(&dev_info->mlock);
-	if (dev_info->currentmode == INDIO_BUFFER_TRIGGERED) {
-		mutex_unlock(&dev_info->mlock);
+	mutex_lock(&indio_dev->mlock);
+	if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
+		mutex_unlock(&indio_dev->mlock);
 		return -EBUSY;
 	}
-	mutex_unlock(&dev_info->mlock);
+	mutex_unlock(&indio_dev->mlock);
 
 	trig = iio_trigger_find_by_name(buf, len);
 
-	if (trig && dev_info->info->validate_trigger) {
-		ret = dev_info->info->validate_trigger(dev_info, trig);
+	if (trig && indio_dev->info->validate_trigger) {
+		ret = indio_dev->info->validate_trigger(indio_dev, trig);
 		if (ret)
 			return ret;
 	}
 
 	if (trig && trig->ops && trig->ops->validate_device) {
-		ret = trig->ops->validate_device(trig, dev_info);
+		ret = trig->ops->validate_device(trig, indio_dev);
 		if (ret)
 			return ret;
 	}
 
-	dev_info->trig = trig;
+	indio_dev->trig = trig;
 
-	if (oldtrig && dev_info->trig != oldtrig)
+	if (oldtrig && indio_dev->trig != oldtrig)
 		iio_put_trigger(oldtrig);
-	if (dev_info->trig)
-		iio_get_trigger(dev_info->trig);
+	if (indio_dev->trig)
+		iio_get_trigger(indio_dev->trig);
 
 	return len;
 }
@@ -473,19 +473,19 @@
 }
 EXPORT_SYMBOL(iio_free_trigger);
 
-int iio_device_register_trigger_consumer(struct iio_dev *dev_info)
+int iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
 {
-	dev_info->groups[dev_info->groupcounter++] =
+	indio_dev->groups[indio_dev->groupcounter++] =
 		&iio_trigger_consumer_attr_group;
 
 	return 0;
 }
 
-void iio_device_unregister_trigger_consumer(struct iio_dev *dev_info)
+void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
 {
 	/* Clean up and associated but not attached triggers references */
-	if (dev_info->trig)
-		iio_put_trigger(dev_info->trig);
+	if (indio_dev->trig)
+		iio_put_trigger(indio_dev->trig);
 }
 
 int iio_triggered_buffer_postenable(struct iio_dev *indio_dev)
