aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-24 17:55:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-24 17:55:20 -0400
commit3d8bbe243dc7418b4b2eadcbf5693887d076a521 (patch)
tree80cb6e131441ded36bbbdd82ce2e9c526eaafb45
parentbc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff)
parentc1b03ab5e886760bdd38c9c7a27af149046ffe01 (diff)
Merge tag 'iio-fixes-for-4.0c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: 3rd set of IIO fixes for the 4.0 cycle. * A double free occured on an error path in due to an event registration issue. The fix is the minimal change rather than possibly reworking this area of the core to give a more elegant solution (future work). * A number of drivers were directly accessing indio_dev->buffer->scan_mask to identify the currently enabled channel set. This may not be correct if we have additional clients on the push interface. The correct option is indio_dev->active_scan_mask. This is fixed. * bmc150 had incorrectly specified sampling frequency (a datasheet confusion as they are specified in terms of bandwith - e.g. half the sampling frequency). * hmc5843 wasn't setting it's name and hence the name attribute was returning an empty string. * inv_mpu6050 wasn't clearing the locally held timestamp buffer when the hardware fifo was reset. Also an inconsistency existed in the interface for the scale of the channels. Magic numbers were written but real ones were used for the reads. Now uses real numbers (i.e. not array indexes) for both. * fix a missing dependency in the dummy driver. Previously shielded from the autobuilders by an earlier build error.
-rw-r--r--drivers/iio/accel/bma180.c2
-rw-r--r--drivers/iio/accel/bmc150-accel.c20
-rw-r--r--drivers/iio/accel/kxcjk-1013.c2
-rw-r--r--drivers/iio/adc/at91_adc.c5
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c3
-rw-r--r--drivers/iio/gyro/bmg160.c2
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_core.c56
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c25
-rw-r--r--drivers/iio/imu/kmx61.c2
-rw-r--r--drivers/iio/industrialio-core.c5
-rw-r--r--drivers/iio/industrialio-event.c1
-rw-r--r--drivers/iio/proximity/sx9500.c2
-rw-r--r--drivers/staging/iio/Kconfig1
-rw-r--r--drivers/staging/iio/magnetometer/hmc5843_core.c1
14 files changed, 68 insertions, 59 deletions
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 1096da327130..75c6d2103e07 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
659 659
660 mutex_lock(&data->mutex); 660 mutex_lock(&data->mutex);
661 661
662 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 662 for_each_set_bit(bit, indio_dev->active_scan_mask,
663 indio_dev->masklength) { 663 indio_dev->masklength) {
664 ret = bma180_get_data_reg(data, bit); 664 ret = bma180_get_data_reg(data, bit);
665 if (ret < 0) { 665 if (ret < 0) {
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c
index 066d0c04072c..75567fd457dc 100644
--- a/drivers/iio/accel/bmc150-accel.c
+++ b/drivers/iio/accel/bmc150-accel.c
@@ -168,14 +168,14 @@ static const struct {
168 int val; 168 int val;
169 int val2; 169 int val2;
170 u8 bw_bits; 170 u8 bw_bits;
171} bmc150_accel_samp_freq_table[] = { {7, 810000, 0x08}, 171} bmc150_accel_samp_freq_table[] = { {15, 620000, 0x08},
172 {15, 630000, 0x09}, 172 {31, 260000, 0x09},
173 {31, 250000, 0x0A}, 173 {62, 500000, 0x0A},
174 {62, 500000, 0x0B}, 174 {125, 0, 0x0B},
175 {125, 0, 0x0C}, 175 {250, 0, 0x0C},
176 {250, 0, 0x0D}, 176 {500, 0, 0x0D},
177 {500, 0, 0x0E}, 177 {1000, 0, 0x0E},
178 {1000, 0, 0x0F} }; 178 {2000, 0, 0x0F} };
179 179
180static const struct { 180static const struct {
181 int bw_bits; 181 int bw_bits;
@@ -840,7 +840,7 @@ static int bmc150_accel_validate_trigger(struct iio_dev *indio_dev,
840} 840}
841 841
842static IIO_CONST_ATTR_SAMP_FREQ_AVAIL( 842static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
843 "7.810000 15.630000 31.250000 62.500000 125 250 500 1000"); 843 "15.620000 31.260000 62.50000 125 250 500 1000 2000");
844 844
845static struct attribute *bmc150_accel_attributes[] = { 845static struct attribute *bmc150_accel_attributes[] = {
846 &iio_const_attr_sampling_frequency_available.dev_attr.attr, 846 &iio_const_attr_sampling_frequency_available.dev_attr.attr,
@@ -986,7 +986,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)
986 int bit, ret, i = 0; 986 int bit, ret, i = 0;
987 987
988 mutex_lock(&data->mutex); 988 mutex_lock(&data->mutex);
989 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 989 for_each_set_bit(bit, indio_dev->active_scan_mask,
990 indio_dev->masklength) { 990 indio_dev->masklength) {
991 ret = i2c_smbus_read_word_data(data->client, 991 ret = i2c_smbus_read_word_data(data->client,
992 BMC150_ACCEL_AXIS_TO_REG(bit)); 992 BMC150_ACCEL_AXIS_TO_REG(bit));
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 567de269cc00..1a6379525fa4 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
956 956
957 mutex_lock(&data->mutex); 957 mutex_lock(&data->mutex);
958 958
959 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 959 for_each_set_bit(bit, indio_dev->active_scan_mask,
960 indio_dev->masklength) { 960 indio_dev->masklength) {
961 ret = kxcjk1013_get_acc_reg(data, bit); 961 ret = kxcjk1013_get_acc_reg(data, bit);
962 if (ret < 0) { 962 if (ret < 0) {
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index ff61ae55dd3f..8a0eb4a04fb5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
544{ 544{
545 struct iio_dev *idev = iio_trigger_get_drvdata(trig); 545 struct iio_dev *idev = iio_trigger_get_drvdata(trig);
546 struct at91_adc_state *st = iio_priv(idev); 546 struct at91_adc_state *st = iio_priv(idev);
547 struct iio_buffer *buffer = idev->buffer;
548 struct at91_adc_reg_desc *reg = st->registers; 547 struct at91_adc_reg_desc *reg = st->registers;
549 u32 status = at91_adc_readl(st, reg->trigger_register); 548 u32 status = at91_adc_readl(st, reg->trigger_register);
550 int value; 549 int value;
@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
564 at91_adc_writel(st, reg->trigger_register, 563 at91_adc_writel(st, reg->trigger_register,
565 status | value); 564 status | value);
566 565
567 for_each_set_bit(bit, buffer->scan_mask, 566 for_each_set_bit(bit, idev->active_scan_mask,
568 st->num_channels) { 567 st->num_channels) {
569 struct iio_chan_spec const *chan = idev->channels + bit; 568 struct iio_chan_spec const *chan = idev->channels + bit;
570 at91_adc_writel(st, AT91_ADC_CHER, 569 at91_adc_writel(st, AT91_ADC_CHER,
@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
579 at91_adc_writel(st, reg->trigger_register, 578 at91_adc_writel(st, reg->trigger_register,
580 status & ~value); 579 status & ~value);
581 580
582 for_each_set_bit(bit, buffer->scan_mask, 581 for_each_set_bit(bit, idev->active_scan_mask,
583 st->num_channels) { 582 st->num_channels) {
584 struct iio_chan_spec const *chan = idev->channels + bit; 583 struct iio_chan_spec const *chan = idev->channels + bit;
585 at91_adc_writel(st, AT91_ADC_CHDR, 584 at91_adc_writel(st, AT91_ADC_CHDR,
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 2e5cc4409f78..a0e7161f040c 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -188,12 +188,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
188static int tiadc_buffer_postenable(struct iio_dev *indio_dev) 188static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
189{ 189{
190 struct tiadc_device *adc_dev = iio_priv(indio_dev); 190 struct tiadc_device *adc_dev = iio_priv(indio_dev);
191 struct iio_buffer *buffer = indio_dev->buffer;
192 unsigned int enb = 0; 191 unsigned int enb = 0;
193 u8 bit; 192 u8 bit;
194 193
195 tiadc_step_config(indio_dev); 194 tiadc_step_config(indio_dev);
196 for_each_set_bit(bit, buffer->scan_mask, adc_dev->channels) 195 for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels)
197 enb |= (get_adc_step_bit(adc_dev, bit) << 1); 196 enb |= (get_adc_step_bit(adc_dev, bit) << 1);
198 adc_dev->buffer_en_ch_steps = enb; 197 adc_dev->buffer_en_ch_steps = enb;
199 198
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c
index 60451b328242..ccf3ea7e1afa 100644
--- a/drivers/iio/gyro/bmg160.c
+++ b/drivers/iio/gyro/bmg160.c
@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)
822 int bit, ret, i = 0; 822 int bit, ret, i = 0;
823 823
824 mutex_lock(&data->mutex); 824 mutex_lock(&data->mutex);
825 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 825 for_each_set_bit(bit, indio_dev->active_scan_mask,
826 indio_dev->masklength) { 826 indio_dev->masklength) {
827 ret = i2c_smbus_read_word_data(data->client, 827 ret = i2c_smbus_read_word_data(data->client,
828 BMG160_AXIS_TO_REG(bit)); 828 BMG160_AXIS_TO_REG(bit));
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index d8d5bed65e07..ef76afe2643c 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -410,42 +410,46 @@ error_read_raw:
410 } 410 }
411} 411}
412 412
413static int inv_mpu6050_write_fsr(struct inv_mpu6050_state *st, int fsr) 413static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val)
414{ 414{
415 int result; 415 int result, i;
416 u8 d; 416 u8 d;
417 417
418 if (fsr < 0 || fsr > INV_MPU6050_MAX_GYRO_FS_PARAM) 418 for (i = 0; i < ARRAY_SIZE(gyro_scale_6050); ++i) {
419 return -EINVAL; 419 if (gyro_scale_6050[i] == val) {
420 if (fsr == st->chip_config.fsr) 420 d = (i << INV_MPU6050_GYRO_CONFIG_FSR_SHIFT);
421 return 0; 421 result = inv_mpu6050_write_reg(st,
422 st->reg->gyro_config, d);
423 if (result)
424 return result;
422 425
423 d = (fsr << INV_MPU6050_GYRO_CONFIG_FSR_SHIFT); 426 st->chip_config.fsr = i;
424 result = inv_mpu6050_write_reg(st, st->reg->gyro_config, d); 427 return 0;
425 if (result) 428 }
426 return result; 429 }
427 st->chip_config.fsr = fsr;
428 430
429 return 0; 431 return -EINVAL;
430} 432}
431 433
432static int inv_mpu6050_write_accel_fs(struct inv_mpu6050_state *st, int fs) 434static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val)
433{ 435{
434 int result; 436 int result, i;
435 u8 d; 437 u8 d;
436 438
437 if (fs < 0 || fs > INV_MPU6050_MAX_ACCL_FS_PARAM) 439 for (i = 0; i < ARRAY_SIZE(accel_scale); ++i) {
438 return -EINVAL; 440 if (accel_scale[i] == val) {
439 if (fs == st->chip_config.accl_fs) 441 d = (i << INV_MPU6050_ACCL_CONFIG_FSR_SHIFT);
440 return 0; 442 result = inv_mpu6050_write_reg(st,
443 st->reg->accl_config, d);
444 if (result)
445 return result;
441 446
442 d = (fs << INV_MPU6050_ACCL_CONFIG_FSR_SHIFT); 447 st->chip_config.accl_fs = i;
443 result = inv_mpu6050_write_reg(st, st->reg->accl_config, d); 448 return 0;
444 if (result) 449 }
445 return result; 450 }
446 st->chip_config.accl_fs = fs;
447 451
448 return 0; 452 return -EINVAL;
449} 453}
450 454
451static int inv_mpu6050_write_raw(struct iio_dev *indio_dev, 455static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
@@ -471,10 +475,10 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
471 case IIO_CHAN_INFO_SCALE: 475 case IIO_CHAN_INFO_SCALE:
472 switch (chan->type) { 476 switch (chan->type) {
473 case IIO_ANGL_VEL: 477 case IIO_ANGL_VEL:
474 result = inv_mpu6050_write_fsr(st, val); 478 result = inv_mpu6050_write_gyro_scale(st, val2);
475 break; 479 break;
476 case IIO_ACCEL: 480 case IIO_ACCEL:
477 result = inv_mpu6050_write_accel_fs(st, val); 481 result = inv_mpu6050_write_accel_scale(st, val2);
478 break; 482 break;
479 default: 483 default:
480 result = -EINVAL; 484 result = -EINVAL;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index 0cd306a72a6e..ba27e277511f 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -24,6 +24,16 @@
24#include <linux/poll.h> 24#include <linux/poll.h>
25#include "inv_mpu_iio.h" 25#include "inv_mpu_iio.h"
26 26
27static void inv_clear_kfifo(struct inv_mpu6050_state *st)
28{
29 unsigned long flags;
30
31 /* take the spin lock sem to avoid interrupt kick in */
32 spin_lock_irqsave(&st->time_stamp_lock, flags);
33 kfifo_reset(&st->timestamps);
34 spin_unlock_irqrestore(&st->time_stamp_lock, flags);
35}
36
27int inv_reset_fifo(struct iio_dev *indio_dev) 37int inv_reset_fifo(struct iio_dev *indio_dev)
28{ 38{
29 int result; 39 int result;
@@ -50,6 +60,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev)
50 INV_MPU6050_BIT_FIFO_RST); 60 INV_MPU6050_BIT_FIFO_RST);
51 if (result) 61 if (result)
52 goto reset_fifo_fail; 62 goto reset_fifo_fail;
63
64 /* clear timestamps fifo */
65 inv_clear_kfifo(st);
66
53 /* enable interrupt */ 67 /* enable interrupt */
54 if (st->chip_config.accl_fifo_enable || 68 if (st->chip_config.accl_fifo_enable ||
55 st->chip_config.gyro_fifo_enable) { 69 st->chip_config.gyro_fifo_enable) {
@@ -83,16 +97,6 @@ reset_fifo_fail:
83 return result; 97 return result;
84} 98}
85 99
86static void inv_clear_kfifo(struct inv_mpu6050_state *st)
87{
88 unsigned long flags;
89
90 /* take the spin lock sem to avoid interrupt kick in */
91 spin_lock_irqsave(&st->time_stamp_lock, flags);
92 kfifo_reset(&st->timestamps);
93 spin_unlock_irqrestore(&st->time_stamp_lock, flags);
94}
95
96/** 100/**
97 * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. 101 * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt.
98 */ 102 */
@@ -184,7 +188,6 @@ end_session:
184flush_fifo: 188flush_fifo:
185 /* Flush HW and SW FIFOs. */ 189 /* Flush HW and SW FIFOs. */
186 inv_reset_fifo(indio_dev); 190 inv_reset_fifo(indio_dev);
187 inv_clear_kfifo(st);
188 mutex_unlock(&indio_dev->mlock); 191 mutex_unlock(&indio_dev->mlock);
189 iio_trigger_notify_done(indio_dev->trig); 192 iio_trigger_notify_done(indio_dev->trig);
190 193
diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index 5cc3692acf37..b3a36376c719 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -1227,7 +1227,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p)
1227 base = KMX61_MAG_XOUT_L; 1227 base = KMX61_MAG_XOUT_L;
1228 1228
1229 mutex_lock(&data->lock); 1229 mutex_lock(&data->lock);
1230 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 1230 for_each_set_bit(bit, indio_dev->active_scan_mask,
1231 indio_dev->masklength) { 1231 indio_dev->masklength) {
1232 ret = kmx61_read_measurement(data, base, bit); 1232 ret = kmx61_read_measurement(data, base, bit);
1233 if (ret < 0) { 1233 if (ret < 0) {
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index aaba9d3d980e..4df97f650e44 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -847,8 +847,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
847 * @attr_list: List of IIO device attributes 847 * @attr_list: List of IIO device attributes
848 * 848 *
849 * This function frees the memory allocated for each of the IIO device 849 * This function frees the memory allocated for each of the IIO device
850 * attributes in the list. Note: if you want to reuse the list after calling 850 * attributes in the list.
851 * this function you have to reinitialize it using INIT_LIST_HEAD().
852 */ 851 */
853void iio_free_chan_devattr_list(struct list_head *attr_list) 852void iio_free_chan_devattr_list(struct list_head *attr_list)
854{ 853{
@@ -856,6 +855,7 @@ void iio_free_chan_devattr_list(struct list_head *attr_list)
856 855
857 list_for_each_entry_safe(p, n, attr_list, l) { 856 list_for_each_entry_safe(p, n, attr_list, l) {
858 kfree(p->dev_attr.attr.name); 857 kfree(p->dev_attr.attr.name);
858 list_del(&p->l);
859 kfree(p); 859 kfree(p);
860 } 860 }
861} 861}
@@ -936,6 +936,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
936 936
937 iio_free_chan_devattr_list(&indio_dev->channel_attr_list); 937 iio_free_chan_devattr_list(&indio_dev->channel_attr_list);
938 kfree(indio_dev->chan_attr_group.attrs); 938 kfree(indio_dev->chan_attr_group.attrs);
939 indio_dev->chan_attr_group.attrs = NULL;
939} 940}
940 941
941static void iio_dev_release(struct device *device) 942static void iio_dev_release(struct device *device)
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index a4b397048f71..a99692ba91bc 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -500,6 +500,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev)
500error_free_setup_event_lines: 500error_free_setup_event_lines:
501 iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); 501 iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list);
502 kfree(indio_dev->event_interface); 502 kfree(indio_dev->event_interface);
503 indio_dev->event_interface = NULL;
503 return ret; 504 return ret;
504} 505}
505 506
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 74dff4e4a11a..89fca3a70750 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)
494 494
495 mutex_lock(&data->mutex); 495 mutex_lock(&data->mutex);
496 496
497 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 497 for_each_set_bit(bit, indio_dev->active_scan_mask,
498 indio_dev->masklength) { 498 indio_dev->masklength) {
499 ret = sx9500_read_proximity(data, &indio_dev->channels[bit], 499 ret = sx9500_read_proximity(data, &indio_dev->channels[bit],
500 &val); 500 &val);
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig
index 24183028bd71..6d5b38d69578 100644
--- a/drivers/staging/iio/Kconfig
+++ b/drivers/staging/iio/Kconfig
@@ -38,6 +38,7 @@ config IIO_SIMPLE_DUMMY_EVENTS
38config IIO_SIMPLE_DUMMY_BUFFER 38config IIO_SIMPLE_DUMMY_BUFFER
39 bool "Buffered capture support" 39 bool "Buffered capture support"
40 select IIO_BUFFER 40 select IIO_BUFFER
41 select IIO_TRIGGER
41 select IIO_KFIFO_BUF 42 select IIO_KFIFO_BUF
42 help 43 help
43 Add buffered data capture to the simple dummy driver. 44 Add buffered data capture to the simple dummy driver.
diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c
index fd171d8b38fb..90cc18b703cf 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -592,6 +592,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
592 mutex_init(&data->lock); 592 mutex_init(&data->lock);
593 593
594 indio_dev->dev.parent = dev; 594 indio_dev->dev.parent = dev;
595 indio_dev->name = dev->driver->name;
595 indio_dev->info = &hmc5843_info; 596 indio_dev->info = &hmc5843_info;
596 indio_dev->modes = INDIO_DIRECT_MODE; 597 indio_dev->modes = INDIO_DIRECT_MODE;
597 indio_dev->channels = data->variant->channels; 598 indio_dev->channels = data->variant->channels;