Pull staging and IIO driver fixes from Greg KH: "Here are some Staging and IIO driver fixes to resolve some reported problems for 5.2-rc3. Nothing major here, just some tiny changes, full details are in the shortlog. All have been in linux-next for a while with no reported issues" * tag 'staging-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: kpc2000: Add dependency on MFD_CORE to kconfig symbol 'KPC2000' staging: wilc1000: Fix some double unlock bugs in wilc_wlan_cleanup() staging: vc04_services: prevent integer overflow in create_pagelist() Staging: vc04_services: Fix a couple error codes staging: wlan-ng: fix adapter initialization failure staging: kpc2000: double unlock in error handling in kpc_dma_transfer() staging: kpc2000: Fix build error without CONFIG_UIO staging: kpc2000: fix build error on xtensa staging: erofs: set sb->s_root to NULL when failing from __getname() iio: adc: ti-ads8688: fix timestamp is not updated in buffer iio: dac: ds4422/ds4424 fix chip verification iio: imu: mpu6050: Fix FIFO layout for ICM20602 iio: adc: ads124: avoid buffer overflow iio: adc: modify NPCM ADC read reference voltage
Unified · Split
| @@ -149,7 +149,7 @@ static int npcm_adc_read_raw(struct iio_dev *indio_dev, · 148 unmodified lines | ||
| 149 | 149 | } |
| 150 | 150 | return IIO_VAL_INT; |
| 151 | 151 | case IIO_CHAN_INFO_SCALE: |
| 152 | − if (info->vref) { | |
| 152 | + if (!IS_ERR(info->vref)) { | |
| 153 | 153 | vref_uv = regulator_get_voltage(info->vref); |
| 154 | 154 | *val = vref_uv / 1000; |
| 155 | 155 | } else { |
| @@ -202,7 +202,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) · 201 unmodified lines | ||
| 202 | 202 | }; |
| 203 | 203 | |
| 204 | 204 | priv->data[0] = ADS124S08_CMD_RDATA; |
| 205 | − memset(&priv->data[1], ADS124S08_CMD_NOP, sizeof(priv->data)); | |
| 205 | + memset(&priv->data[1], ADS124S08_CMD_NOP, sizeof(priv->data) - 1); | |
| 206 | 206 | |
| 207 | 207 | ret = spi_sync_transfer(priv->spi, t, ARRAY_SIZE(t)); |
| 208 | 208 | if (ret < 0) |
| @@ -397,7 +397,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) · 396 unmodified lines | ||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | iio_push_to_buffers_with_timestamp(indio_dev, buffer, |
| 400 | − pf->timestamp); | |
| 400 | + iio_get_time_ns(indio_dev)); | |
| 401 | 401 | |
| 402 | 402 | iio_trigger_notify_done(indio_dev->trig); |
| 403 | 403 | |
| @@ -166,7 +166,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev) · 165 unmodified lines | ||
| 166 | 166 | { |
| 167 | 167 | int ret, val; |
| 168 | 168 | |
| 169 | − ret = ds4424_get_value(indio_dev, &val, DS4424_DAC_ADDR(0)); | |
| 169 | + ret = ds4424_get_value(indio_dev, &val, 0); | |
| 170 | 170 | if (ret < 0) |
| 171 | 171 | dev_err(&indio_dev->dev, |
| 172 | 172 | "%s failed. ret: %d\n", __func__, ret); |
| @@ -471,7 +471,10 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev, · 470 unmodified lines | ||
| 471 | 471 | return IIO_VAL_INT_PLUS_MICRO; |
| 472 | 472 | case IIO_TEMP: |
| 473 | 473 | *val = 0; |
| 474 | − *val2 = INV_MPU6050_TEMP_SCALE; | |
| 474 | + if (st->chip_type == INV_ICM20602) | |
| 475 | + *val2 = INV_ICM20602_TEMP_SCALE; | |
| 476 | + else | |
| 477 | + *val2 = INV_MPU6050_TEMP_SCALE; | |
| 475 | 478 | |
| 476 | 479 | return IIO_VAL_INT_PLUS_MICRO; |
| 477 | 480 | default: |
| @@ -480,7 +483,10 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev, · 2 unmodified lines | ||
| 480 | 483 | case IIO_CHAN_INFO_OFFSET: |
| 481 | 484 | switch (chan->type) { |
| 482 | 485 | case IIO_TEMP: |
| 483 | − *val = INV_MPU6050_TEMP_OFFSET; | |
| 486 | + if (st->chip_type == INV_ICM20602) | |
| 487 | + *val = INV_ICM20602_TEMP_OFFSET; | |
| 488 | + else | |
| 489 | + *val = INV_MPU6050_TEMP_OFFSET; | |
| 484 | 490 | |
| 485 | 491 | return IIO_VAL_INT; |
| 486 | 492 | default: |
| @@ -847,6 +853,32 @@ static const struct iio_chan_spec inv_mpu_channels[] = { · 360 unmodified lines | ||
| 847 | 853 | INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SCAN_ACCL_Z), |
| 848 | 854 | }; |
| 849 | 855 | |
| 856 | +static const struct iio_chan_spec inv_icm20602_channels[] = { | |
| 857 | + IIO_CHAN_SOFT_TIMESTAMP(INV_ICM20602_SCAN_TIMESTAMP), | |
| 858 | + { | |
| 859 | + .type = IIO_TEMP, | |
| 860 | + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | |
| 861 | + | BIT(IIO_CHAN_INFO_OFFSET) | |
| 862 | + | BIT(IIO_CHAN_INFO_SCALE), | |
| 863 | + .scan_index = INV_ICM20602_SCAN_TEMP, | |
| 864 | + .scan_type = { | |
| 865 | + .sign = 's', | |
| 866 | + .realbits = 16, | |
| 867 | + .storagebits = 16, | |
| 868 | + .shift = 0, | |
| 869 | + .endianness = IIO_BE, | |
| 870 | + }, | |
| 871 | + }, | |
| 872 | + | |
| 873 | + INV_MPU6050_CHAN(IIO_ANGL_VEL, IIO_MOD_X, INV_ICM20602_SCAN_GYRO_X), | |
| 874 | + INV_MPU6050_CHAN(IIO_ANGL_VEL, IIO_MOD_Y, INV_ICM20602_SCAN_GYRO_Y), | |
| 875 | + INV_MPU6050_CHAN(IIO_ANGL_VEL, IIO_MOD_Z, INV_ICM20602_SCAN_GYRO_Z), | |
| 876 | + | |
| 877 | + INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Y, INV_ICM20602_SCAN_ACCL_Y), | |
| 878 | + INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_X, INV_ICM20602_SCAN_ACCL_X), | |
| 879 | + INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_ICM20602_SCAN_ACCL_Z), | |
| 880 | +}; | |
| 881 | + | |
| 850 | 882 | /* |
| 851 | 883 | * The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and |
| 852 | 884 | * INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by the |
| @@ -1102,8 +1134,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, · 249 unmodified lines | ||
| 1102 | 1134 | indio_dev->name = name; |
| 1103 | 1135 | else |
| 1104 | 1136 | indio_dev->name = dev_name(dev); |
| 1105 | − indio_dev->channels = inv_mpu_channels; | |
| 1106 | − indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); | |
| 1137 | + | |
| 1138 | + if (chip_type == INV_ICM20602) { | |
| 1139 | + indio_dev->channels = inv_icm20602_channels; | |
| 1140 | + indio_dev->num_channels = ARRAY_SIZE(inv_icm20602_channels); | |
| 1141 | + } else { | |
| 1142 | + indio_dev->channels = inv_mpu_channels; | |
| 1143 | + indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); | |
| 1144 | + } | |
| 1107 | 1145 | |
| 1108 | 1146 | indio_dev->info = &mpu_info; |
| 1109 | 1147 | indio_dev->modes = INDIO_BUFFER_TRIGGERED; |
| @@ -208,6 +208,9 @@ struct inv_mpu6050_state { · 207 unmodified lines | ||
| 208 | 208 | #define INV_MPU6050_BYTES_PER_3AXIS_SENSOR 6 |
| 209 | 209 | #define INV_MPU6050_FIFO_COUNT_BYTE 2 |
| 210 | 210 | |
| 211 | +/* ICM20602 FIFO samples include temperature readings */ | |
| 212 | +#define INV_ICM20602_BYTES_PER_TEMP_SENSOR 2 | |
| 213 | + | |
| 211 | 214 | /* mpu6500 registers */ |
| 212 | 215 | #define INV_MPU6500_REG_ACCEL_CONFIG_2 0x1D |
| 213 | 216 | #define INV_MPU6500_REG_ACCEL_OFFSET 0x77 |
| @@ -229,6 +232,9 @@ struct inv_mpu6050_state { · 15 unmodified lines | ||
| 229 | 232 | #define INV_MPU6050_GYRO_CONFIG_FSR_SHIFT 3 |
| 230 | 233 | #define INV_MPU6050_ACCL_CONFIG_FSR_SHIFT 3 |
| 231 | 234 | |
| 235 | +#define INV_ICM20602_TEMP_OFFSET 8170 | |
| 236 | +#define INV_ICM20602_TEMP_SCALE 3060 | |
| 237 | + | |
| 232 | 238 | /* 6 + 6 round up and plus 8 */ |
| 233 | 239 | #define INV_MPU6050_OUTPUT_DATA_SIZE 24 |
| 234 | 240 | |
| @@ -270,7 +276,7 @@ struct inv_mpu6050_state { · 35 unmodified lines | ||
| 270 | 276 | #define INV_ICM20608_WHOAMI_VALUE 0xAF |
| 271 | 277 | #define INV_ICM20602_WHOAMI_VALUE 0x12 |
| 272 | 278 | |
| 273 | −/* scan element definition */ | |
| 279 | +/* scan element definition for generic MPU6xxx devices */ | |
| 274 | 280 | enum inv_mpu6050_scan { |
| 275 | 281 | INV_MPU6050_SCAN_ACCL_X, |
| 276 | 282 | INV_MPU6050_SCAN_ACCL_Y, |
| @@ -281,6 +287,18 @@ enum inv_mpu6050_scan { · 4 unmodified lines | ||
| 281 | 287 | INV_MPU6050_SCAN_TIMESTAMP, |
| 282 | 288 | }; |
| 283 | 289 | |
| 290 | +/* scan element definition for ICM20602, which includes temperature */ | |
| 291 | +enum inv_icm20602_scan { | |
| 292 | + INV_ICM20602_SCAN_ACCL_X, | |
| 293 | + INV_ICM20602_SCAN_ACCL_Y, | |
| 294 | + INV_ICM20602_SCAN_ACCL_Z, | |
| 295 | + INV_ICM20602_SCAN_TEMP, | |
| 296 | + INV_ICM20602_SCAN_GYRO_X, | |
| 297 | + INV_ICM20602_SCAN_GYRO_Y, | |
| 298 | + INV_ICM20602_SCAN_GYRO_Z, | |
| 299 | + INV_ICM20602_SCAN_TIMESTAMP, | |
| 300 | +}; | |
| 301 | + | |
| 284 | 302 | enum inv_mpu6050_filter_e { |
| 285 | 303 | INV_MPU6050_FILTER_256HZ_NOLPF2 = 0, |
| 286 | 304 | INV_MPU6050_FILTER_188HZ, |
| @@ -207,6 +207,9 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) · 206 unmodified lines | ||
| 207 | 207 | if (st->chip_config.gyro_fifo_enable) |
| 208 | 208 | bytes_per_datum += INV_MPU6050_BYTES_PER_3AXIS_SENSOR; |
| 209 | 209 | |
| 210 | + if (st->chip_type == INV_ICM20602) | |
| 211 | + bytes_per_datum += INV_ICM20602_BYTES_PER_TEMP_SENSOR; | |
| 212 | + | |
| 210 | 213 | /* |
| 211 | 214 | * read fifo_count register to know how many bytes are inside the FIFO |
| 212 | 215 | * right now |
| @@ -457,6 +457,7 @@ static int erofs_read_super(struct super_block *sb, · 456 unmodified lines | ||
| 457 | 457 | */ |
| 458 | 458 | err_devname: |
| 459 | 459 | dput(sb->s_root); |
| 460 | + sb->s_root = NULL; | |
| 460 | 461 | err_iget: |
| 461 | 462 | #ifdef EROFS_FS_HAS_MANAGED_CACHE |
| 462 | 463 | iput(sbi->managed_cache); |
| @@ -2,7 +2,9 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | config KPC2000 |
| 4 | 4 | bool "Daktronics KPC Device support" |
| 5 | + select MFD_CORE | |
| 5 | 6 | depends on PCI |
| 7 | + depends on UIO | |
| 6 | 8 | help |
| 7 | 9 | Select this if you wish to use the Daktronics KPC PCI devices |
| 8 | 10 | |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/errno.h> /* error codes */ |
| 9 | 9 | #include <linux/types.h> /* size_t */ |
| 10 | 10 | #include <linux/cdev.h> |
| 11 | −#include <asm/uaccess.h> /* copy_*_user */ | |
| 11 | +#include <linux/uaccess.h> /* copy_*_user */ | |
| 12 | 12 | #include <linux/aio.h> /* aio stuff */ |
| 13 | 13 | #include <linux/highmem.h> |
| 14 | 14 | #include <linux/pagemap.h> |
| @@ -116,13 +116,11 @@ int kpc_dma_transfer(struct dev_private_data *priv, struct kiocb *kcb, unsigned · 101 unmodified lines | ||
| 116 | 116 | if (desc_needed >= ldev->desc_pool_cnt){ |
| 117 | 117 | dev_warn(&priv->ldev->pldev->dev, " mapped_entry_count = %d num_descrs_needed = %d num_descrs_avail = %d TOO MANY to ever complete!\n", acd->mapped_entry_count, desc_needed, num_descrs_avail); |
| 118 | 118 | rv = -EAGAIN; |
| 119 | − unlock_engine(ldev); | |
| 120 | 119 | goto err_descr_too_many; |
| 121 | 120 | } |
| 122 | 121 | if (desc_needed > num_descrs_avail){ |
| 123 | 122 | dev_warn(&priv->ldev->pldev->dev, " mapped_entry_count = %d num_descrs_needed = %d num_descrs_avail = %d Too many to complete right now.\n", acd->mapped_entry_count, desc_needed, num_descrs_avail); |
| 124 | 123 | rv = -EMSGSIZE; |
| 125 | − unlock_engine(ldev); | |
| 126 | 124 | goto err_descr_too_many; |
| 127 | 125 | } |
| 128 | 126 | |
| @@ -572,7 +572,7 @@ exit: · 571 unmodified lines | ||
| 572 | 572 | dev->colourfx.enable ? "true" : "false", |
| 573 | 573 | dev->colourfx.u, dev->colourfx.v, |
| 574 | 574 | ret, (ret == 0 ? 0 : -EINVAL)); |
| 575 | − return (ret == 0 ? 0 : EINVAL); | |
| 575 | + return (ret == 0 ? 0 : -EINVAL); | |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, |
| @@ -596,7 +596,7 @@ static int ctrl_set_colfx(struct bm2835_mmal_dev *dev, · 17 unmodified lines | ||
| 596 | 596 | "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n", |
| 597 | 597 | __func__, mmal_ctrl, ctrl->id, ctrl->val, ret, |
| 598 | 598 | (ret == 0 ? 0 : -EINVAL)); |
| 599 | − return (ret == 0 ? 0 : EINVAL); | |
| 599 | + return (ret == 0 ? 0 : -EINVAL); | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev, |
| @@ -368,9 +368,18 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) · 367 unmodified lines | ||
| 368 | 368 | int dma_buffers; |
| 369 | 369 | dma_addr_t dma_addr; |
| 370 | 370 | |
| 371 | + if (count >= INT_MAX - PAGE_SIZE) | |
| 372 | + return NULL; | |
| 373 | + | |
| 371 | 374 | offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1)); |
| 372 | 375 | num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE); |
| 373 | 376 | |
| 377 | + if (num_pages > (SIZE_MAX - sizeof(struct pagelist) - | |
| 378 | + sizeof(struct vchiq_pagelist_info)) / | |
| 379 | + (sizeof(u32) + sizeof(pages[0]) + | |
| 380 | + sizeof(struct scatterlist))) | |
| 381 | + return NULL; | |
| 382 | + | |
| 374 | 383 | pagelist_size = sizeof(struct pagelist) + |
| 375 | 384 | (num_pages * sizeof(u32)) + |
| 376 | 385 | (num_pages * sizeof(pages[0]) + |
| @@ -1076,13 +1076,17 @@ void wilc_wlan_cleanup(struct net_device *dev) · 1075 unmodified lines | ||
| 1076 | 1076 | acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); |
| 1077 | 1077 | |
| 1078 | 1078 | ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, ®); |
| 1079 | − if (!ret) | |
| 1079 | + if (!ret) { | |
| 1080 | 1080 | release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); |
| 1081 | + return; | |
| 1082 | + } | |
| 1081 | 1083 | |
| 1082 | 1084 | ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0, |
| 1083 | 1085 | (reg | ABORT_INT)); |
| 1084 | − if (!ret) | |
| 1086 | + if (!ret) { | |
| 1085 | 1087 | release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); |
| 1088 | + return; | |
| 1089 | + } | |
| 1086 | 1090 | |
| 1087 | 1091 | release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); |
| 1088 | 1092 | wilc->hif_func->hif_deinit(NULL); |
| @@ -3119,7 +3119,9 @@ static void hfa384x_usbin_callback(struct urb *urb) · 3118 unmodified lines | ||
| 3119 | 3119 | break; |
| 3120 | 3120 | } |
| 3121 | 3121 | |
| 3122 | + /* Save values from the RX URB before reposting overwrites it. */ | |
| 3122 | 3123 | urb_status = urb->status; |
| 3124 | + usbin = (union hfa384x_usbin *)urb->transfer_buffer; | |
| 3123 | 3125 | |
| 3124 | 3126 | if (action != ABORT) { |
| 3125 | 3127 | /* Repost the RX URB */ |
| @@ -3136,7 +3138,6 @@ static void hfa384x_usbin_callback(struct urb *urb) · 10 unmodified lines | ||
| 3136 | 3138 | /* Note: the check of the sw_support field, the type field doesn't |
| 3137 | 3139 | * have bit 12 set like the docs suggest. |
| 3138 | 3140 | */ |
| 3139 | − usbin = (union hfa384x_usbin *)urb->transfer_buffer; | |
| 3140 | 3141 | type = le16_to_cpu(usbin->type); |
| 3141 | 3142 | if (HFA384x_USB_ISRXFRM(type)) { |
| 3142 | 3143 | if (action == HANDLE) { |