Merge tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO driver fixes from Greg KH:
"Here are a number of staging and IIO driver fixes for 5.9-rc5.

The majority of these are IIO driver fixes, to resolve a timestamp
issue that was recently found to affect a bunch of IIO drivers.

The other fixes in here are:

- small IIO driver fixes

- greybus driver fix

- counter driver fix (came in through the IIO fixes tree)

All of these have been in linux-next for a while with no reported
issues"

* tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits)
iio: adc: mcp3422: fix locking on error path
iio: adc: mcp3422: fix locking scope
iio: adc: meson-saradc: Use the parent device to look up the calib data
iio:adc:max1118 Fix alignment of timestamp and data leak issues
iio:adc:ina2xx Fix timestamp alignment issue.
iio:adc:ti-adc084s021 Fix alignment and data leak issues.
iio:adc:ti-adc081c Fix alignment and data leak issues
iio:magnetometer:ak8975 Fix alignment and data leak issues.
iio:light:ltr501 Fix timestamp alignment issue.
iio:light:max44000 Fix timestamp alignment and prevent data leak.
iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
iio:proximity:mb1232: Fix timestamp alignment and prevent data leak.
iio:accel:mma7455: Fix timestamp alignment and prevent data leak.
iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak.
iio:accel:mma8452: Fix timestamp alignment and prevent data leak.
iio: accel: kxsd9: Fix alignment of local buffer.
iio: adc: rockchip_saradc: select IIO_TRIGGERED_BUFFER
iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
counter: microchip-tcb-capture: check the correct variable
iio: cros_ec: Set Gyroscope default frequency to 25Hz
...

+2 -2
drivers/counter/microchip-tcb-capture.c
··· 320 320 } 321 321 322 322 regmap = syscon_node_to_regmap(np->parent); 323 - if (IS_ERR(priv->regmap)) 324 - return PTR_ERR(priv->regmap); 323 + if (IS_ERR(regmap)) 324 + return PTR_ERR(regmap); 325 325 326 326 /* max. channels number is 2 when in QDEC mode */ 327 327 priv->num_channels = of_property_count_u32_elems(np, "reg");
+12 -3
drivers/iio/accel/bmc150-accel-core.c
··· 189 189 struct mutex mutex; 190 190 u8 fifo_mode, watermark; 191 191 s16 buffer[8]; 192 + /* 193 + * Ensure there is sufficient space and correct alignment for 194 + * the timestamp if enabled 195 + */ 196 + struct { 197 + __le16 channels[3]; 198 + s64 ts __aligned(8); 199 + } scan; 192 200 u8 bw_bits; 193 201 u32 slope_dur; 194 202 u32 slope_thres; ··· 930 922 * now. 931 923 */ 932 924 for (i = 0; i < count; i++) { 933 - u16 sample[8]; 934 925 int j, bit; 935 926 936 927 j = 0; 937 928 for_each_set_bit(bit, indio_dev->active_scan_mask, 938 929 indio_dev->masklength) 939 - memcpy(&sample[j++], &buffer[i * 3 + bit], 2); 930 + memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit], 931 + sizeof(data->scan.channels[0])); 940 932 941 - iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp); 933 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 934 + tstamp); 942 935 943 936 tstamp += sample_period; 944 937 }
+11 -5
drivers/iio/accel/kxsd9.c
··· 209 209 const struct iio_poll_func *pf = p; 210 210 struct iio_dev *indio_dev = pf->indio_dev; 211 211 struct kxsd9_state *st = iio_priv(indio_dev); 212 + /* 213 + * Ensure correct positioning and alignment of timestamp. 214 + * No need to zero initialize as all elements written. 215 + */ 216 + struct { 217 + __be16 chan[4]; 218 + s64 ts __aligned(8); 219 + } hw_values; 212 220 int ret; 213 - /* 4 * 16bit values AND timestamp */ 214 - __be16 hw_values[8]; 215 221 216 222 ret = regmap_bulk_read(st->map, 217 223 KXSD9_REG_X, 218 - &hw_values, 219 - 8); 224 + hw_values.chan, 225 + sizeof(hw_values.chan)); 220 226 if (ret) { 221 227 dev_err(st->dev, 222 228 "error reading data\n"); ··· 230 224 } 231 225 232 226 iio_push_to_buffers_with_timestamp(indio_dev, 233 - hw_values, 227 + &hw_values, 234 228 iio_get_time_ns(indio_dev)); 235 229 iio_trigger_notify_done(indio_dev->trig); 236 230
+12 -4
drivers/iio/accel/mma7455_core.c
··· 52 52 53 53 struct mma7455_data { 54 54 struct regmap *regmap; 55 + /* 56 + * Used to reorganize data. Will ensure correct alignment of 57 + * the timestamp if present 58 + */ 59 + struct { 60 + __le16 channels[3]; 61 + s64 ts __aligned(8); 62 + } scan; 55 63 }; 56 64 57 65 static int mma7455_drdy(struct mma7455_data *mma7455) ··· 90 82 struct iio_poll_func *pf = p; 91 83 struct iio_dev *indio_dev = pf->indio_dev; 92 84 struct mma7455_data *mma7455 = iio_priv(indio_dev); 93 - u8 buf[16]; /* 3 x 16-bit channels + padding + ts */ 94 85 int ret; 95 86 96 87 ret = mma7455_drdy(mma7455); 97 88 if (ret) 98 89 goto done; 99 90 100 - ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf, 101 - sizeof(__le16) * 3); 91 + ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, 92 + mma7455->scan.channels, 93 + sizeof(mma7455->scan.channels)); 102 94 if (ret) 103 95 goto done; 104 96 105 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 97 + iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan, 106 98 iio_get_time_ns(indio_dev)); 107 99 108 100 done:
+8 -3
drivers/iio/accel/mma8452.c
··· 110 110 int sleep_val; 111 111 struct regulator *vdd_reg; 112 112 struct regulator *vddio_reg; 113 + 114 + /* Ensure correct alignment of time stamp when present */ 115 + struct { 116 + __be16 channels[3]; 117 + s64 ts __aligned(8); 118 + } buffer; 113 119 }; 114 120 115 121 /** ··· 1097 1091 struct iio_poll_func *pf = p; 1098 1092 struct iio_dev *indio_dev = pf->indio_dev; 1099 1093 struct mma8452_data *data = iio_priv(indio_dev); 1100 - u8 buffer[16]; /* 3 16-bit channels + padding + ts */ 1101 1094 int ret; 1102 1095 1103 - ret = mma8452_read(data, (__be16 *)buffer); 1096 + ret = mma8452_read(data, data->buffer.channels); 1104 1097 if (ret < 0) 1105 1098 goto done; 1106 1099 1107 - iio_push_to_buffers_with_timestamp(indio_dev, buffer, 1100 + iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer, 1108 1101 iio_get_time_ns(indio_dev)); 1109 1102 1110 1103 done:
+2
drivers/iio/adc/Kconfig
··· 865 865 tristate "Rockchip SARADC driver" 866 866 depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) 867 867 depends on RESET_CONTROLLER 868 + select IIO_BUFFER 869 + select IIO_TRIGGERED_BUFFER 868 870 help 869 871 Say yes here to build support for the SARADC found in SoCs from 870 872 Rockchip.
+7 -4
drivers/iio/adc/ina2xx-adc.c
··· 146 146 int range_vbus; /* Bus voltage maximum in V */ 147 147 int pga_gain_vshunt; /* Shunt voltage PGA gain */ 148 148 bool allow_async_readout; 149 + /* data buffer needs space for channel data and timestamp */ 150 + struct { 151 + u16 chan[4]; 152 + u64 ts __aligned(8); 153 + } scan; 149 154 }; 150 155 151 156 static const struct ina2xx_config ina2xx_config[] = { ··· 743 738 static int ina2xx_work_buffer(struct iio_dev *indio_dev) 744 739 { 745 740 struct ina2xx_chip_info *chip = iio_priv(indio_dev); 746 - /* data buffer needs space for channel data and timestap */ 747 - unsigned short data[4 + sizeof(s64)/sizeof(short)]; 748 741 int bit, ret, i = 0; 749 742 s64 time; 750 743 ··· 761 758 if (ret < 0) 762 759 return ret; 763 760 764 - data[i++] = val; 761 + chip->scan.chan[i++] = val; 765 762 } 766 763 767 - iio_push_to_buffers_with_timestamp(indio_dev, data, time); 764 + iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time); 768 765 769 766 return 0; 770 767 };
+7 -3
drivers/iio/adc/max1118.c
··· 36 36 struct spi_device *spi; 37 37 struct mutex lock; 38 38 struct regulator *reg; 39 + /* Ensure natural alignment of buffer elements */ 40 + struct { 41 + u8 channels[2]; 42 + s64 ts __aligned(8); 43 + } scan; 39 44 40 45 u8 data ____cacheline_aligned; 41 46 }; ··· 171 166 struct iio_poll_func *pf = p; 172 167 struct iio_dev *indio_dev = pf->indio_dev; 173 168 struct max1118 *adc = iio_priv(indio_dev); 174 - u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */ 175 169 int scan_index; 176 170 int i = 0; 177 171 ··· 188 184 goto out; 189 185 } 190 186 191 - data[i] = ret; 187 + adc->scan.channels[i] = ret; 192 188 i++; 193 189 } 194 - iio_push_to_buffers_with_timestamp(indio_dev, data, 190 + iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, 195 191 iio_get_time_ns(indio_dev)); 196 192 out: 197 193 mutex_unlock(&adc->lock);
+10 -6
drivers/iio/adc/mcp3422.c
··· 96 96 { 97 97 int ret; 98 98 99 - mutex_lock(&adc->lock); 100 - 101 99 ret = i2c_master_send(adc->i2c, &newconfig, 1); 102 100 if (ret > 0) { 103 101 adc->config = newconfig; 104 102 ret = 0; 105 103 } 106 - 107 - mutex_unlock(&adc->lock); 108 104 109 105 return ret; 110 106 } ··· 134 138 u8 config; 135 139 u8 req_channel = channel->channel; 136 140 141 + mutex_lock(&adc->lock); 142 + 137 143 if (req_channel != MCP3422_CHANNEL(adc->config)) { 138 144 config = adc->config; 139 145 config &= ~MCP3422_CHANNEL_MASK; ··· 143 145 config &= ~MCP3422_PGA_MASK; 144 146 config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); 145 147 ret = mcp3422_update_config(adc, config); 146 - if (ret < 0) 148 + if (ret < 0) { 149 + mutex_unlock(&adc->lock); 147 150 return ret; 151 + } 148 152 msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); 149 153 } 150 154 151 - return mcp3422_read(adc, value, &config); 155 + ret = mcp3422_read(adc, value, &config); 156 + 157 + mutex_unlock(&adc->lock); 158 + 159 + return ret; 152 160 } 153 161 154 162 static int mcp3422_read_raw(struct iio_dev *iio,
+1 -1
drivers/iio/adc/meson_saradc.c
··· 707 707 size_t read_len; 708 708 int ret; 709 709 710 - temperature_calib = devm_nvmem_cell_get(&indio_dev->dev, 710 + temperature_calib = devm_nvmem_cell_get(indio_dev->dev.parent, 711 711 "temperature_calib"); 712 712 if (IS_ERR(temperature_calib)) { 713 713 ret = PTR_ERR(temperature_calib);
+8 -3
drivers/iio/adc/ti-adc081c.c
··· 33 33 34 34 /* 8, 10 or 12 */ 35 35 int bits; 36 + 37 + /* Ensure natural alignment of buffer elements */ 38 + struct { 39 + u16 channel; 40 + s64 ts __aligned(8); 41 + } scan; 36 42 }; 37 43 38 44 #define REG_CONV_RES 0x00 ··· 134 128 struct iio_poll_func *pf = p; 135 129 struct iio_dev *indio_dev = pf->indio_dev; 136 130 struct adc081c *data = iio_priv(indio_dev); 137 - u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */ 138 131 int ret; 139 132 140 133 ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES); 141 134 if (ret < 0) 142 135 goto out; 143 - buf[0] = ret; 144 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 136 + data->scan.channel = ret; 137 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 145 138 iio_get_time_ns(indio_dev)); 146 139 out: 147 140 iio_trigger_notify_done(indio_dev->trig);
+7 -3
drivers/iio/adc/ti-adc084s021.c
··· 26 26 struct spi_transfer spi_trans; 27 27 struct regulator *reg; 28 28 struct mutex lock; 29 + /* Buffer used to align data */ 30 + struct { 31 + __be16 channels[4]; 32 + s64 ts __aligned(8); 33 + } scan; 29 34 /* 30 35 * DMA (thus cache coherency maintenance) requires the 31 36 * transfer buffers to live in their own cache line. ··· 146 141 struct iio_poll_func *pf = pollfunc; 147 142 struct iio_dev *indio_dev = pf->indio_dev; 148 143 struct adc084s021 *adc = iio_priv(indio_dev); 149 - __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */ 150 144 151 145 mutex_lock(&adc->lock); 152 146 153 - if (adc084s021_adc_conversion(adc, &data) < 0) 147 + if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0) 154 148 dev_err(&adc->spi->dev, "Failed to read data\n"); 155 149 156 - iio_push_to_buffers_with_timestamp(indio_dev, data, 150 + iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, 157 151 iio_get_time_ns(indio_dev)); 158 152 mutex_unlock(&adc->lock); 159 153 iio_trigger_notify_done(indio_dev->trig);
+10
drivers/iio/adc/ti-ads1015.c
··· 316 316 IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP), 317 317 }; 318 318 319 + #ifdef CONFIG_PM 319 320 static int ads1015_set_power_state(struct ads1015_data *data, bool on) 320 321 { 321 322 int ret; ··· 333 332 334 333 return ret < 0 ? ret : 0; 335 334 } 335 + 336 + #else /* !CONFIG_PM */ 337 + 338 + static int ads1015_set_power_state(struct ads1015_data *data, bool on) 339 + { 340 + return 0; 341 + } 342 + 343 + #endif /* !CONFIG_PM */ 336 344 337 345 static 338 346 int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
+9 -4
drivers/iio/chemical/ccs811.c
··· 78 78 struct iio_trigger *drdy_trig; 79 79 struct gpio_desc *wakeup_gpio; 80 80 bool drdy_trig_on; 81 + /* Ensures correct alignment of timestamp if present */ 82 + struct { 83 + s16 channels[2]; 84 + s64 ts __aligned(8); 85 + } scan; 81 86 }; 82 87 83 88 static const struct iio_chan_spec ccs811_channels[] = { ··· 332 327 struct iio_dev *indio_dev = pf->indio_dev; 333 328 struct ccs811_data *data = iio_priv(indio_dev); 334 329 struct i2c_client *client = data->client; 335 - s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */ 336 330 int ret; 337 331 338 - ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4, 339 - (u8 *)&buf); 332 + ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 333 + sizeof(data->scan.channels), 334 + (u8 *)data->scan.channels); 340 335 if (ret != 4) { 341 336 dev_err(&client->dev, "cannot read sensor data\n"); 342 337 goto err; 343 338 } 344 339 345 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 340 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 346 341 iio_get_time_ns(indio_dev)); 347 342 348 343 err:
+4 -1
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
··· 72 72 73 73 switch (type) { 74 74 case MOTIONSENSE_TYPE_ACCEL: 75 - case MOTIONSENSE_TYPE_GYRO: 76 75 *min_freq = 12500; 76 + *max_freq = 100000; 77 + break; 78 + case MOTIONSENSE_TYPE_GYRO: 79 + *min_freq = 25000; 77 80 *max_freq = 100000; 78 81 break; 79 82 case MOTIONSENSE_TYPE_MAG:
+9 -6
drivers/iio/light/ltr501.c
··· 1243 1243 struct iio_poll_func *pf = p; 1244 1244 struct iio_dev *indio_dev = pf->indio_dev; 1245 1245 struct ltr501_data *data = iio_priv(indio_dev); 1246 - u16 buf[8]; 1246 + struct { 1247 + u16 channels[3]; 1248 + s64 ts __aligned(8); 1249 + } scan; 1247 1250 __le16 als_buf[2]; 1248 1251 u8 mask = 0; 1249 1252 int j = 0; 1250 1253 int ret, psdata; 1251 1254 1252 - memset(buf, 0, sizeof(buf)); 1255 + memset(&scan, 0, sizeof(scan)); 1253 1256 1254 1257 /* figure out which data needs to be ready */ 1255 1258 if (test_bit(0, indio_dev->active_scan_mask) || ··· 1271 1268 if (ret < 0) 1272 1269 return ret; 1273 1270 if (test_bit(0, indio_dev->active_scan_mask)) 1274 - buf[j++] = le16_to_cpu(als_buf[1]); 1271 + scan.channels[j++] = le16_to_cpu(als_buf[1]); 1275 1272 if (test_bit(1, indio_dev->active_scan_mask)) 1276 - buf[j++] = le16_to_cpu(als_buf[0]); 1273 + scan.channels[j++] = le16_to_cpu(als_buf[0]); 1277 1274 } 1278 1275 1279 1276 if (mask & LTR501_STATUS_PS_RDY) { ··· 1281 1278 &psdata, 2); 1282 1279 if (ret < 0) 1283 1280 goto done; 1284 - buf[j++] = psdata & LTR501_PS_DATA_MASK; 1281 + scan.channels[j++] = psdata & LTR501_PS_DATA_MASK; 1285 1282 } 1286 1283 1287 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 1284 + iio_push_to_buffers_with_timestamp(indio_dev, &scan, 1288 1285 iio_get_time_ns(indio_dev)); 1289 1286 1290 1287 done:
+8 -4
drivers/iio/light/max44000.c
··· 75 75 struct max44000_data { 76 76 struct mutex lock; 77 77 struct regmap *regmap; 78 + /* Ensure naturally aligned timestamp */ 79 + struct { 80 + u16 channels[2]; 81 + s64 ts __aligned(8); 82 + } scan; 78 83 }; 79 84 80 85 /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */ ··· 493 488 struct iio_poll_func *pf = p; 494 489 struct iio_dev *indio_dev = pf->indio_dev; 495 490 struct max44000_data *data = iio_priv(indio_dev); 496 - u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */ 497 491 int index = 0; 498 492 unsigned int regval; 499 493 int ret; ··· 502 498 ret = max44000_read_alsval(data); 503 499 if (ret < 0) 504 500 goto out_unlock; 505 - buf[index++] = ret; 501 + data->scan.channels[index++] = ret; 506 502 } 507 503 if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { 508 504 ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval); 509 505 if (ret < 0) 510 506 goto out_unlock; 511 - buf[index] = regval; 507 + data->scan.channels[index] = regval; 512 508 } 513 509 mutex_unlock(&data->lock); 514 510 515 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 511 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 516 512 iio_get_time_ns(indio_dev)); 517 513 iio_trigger_notify_done(indio_dev->trig); 518 514 return IRQ_HANDLED;
+11 -5
drivers/iio/magnetometer/ak8975.c
··· 366 366 struct iio_mount_matrix orientation; 367 367 struct regulator *vdd; 368 368 struct regulator *vid; 369 + 370 + /* Ensure natural alignment of timestamp */ 371 + struct { 372 + s16 channels[3]; 373 + s64 ts __aligned(8); 374 + } scan; 369 375 }; 370 376 371 377 /* Enable attached power regulator if any. */ ··· 799 793 const struct i2c_client *client = data->client; 800 794 const struct ak_def *def = data->def; 801 795 int ret; 802 - s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */ 803 796 __le16 fval[3]; 804 797 805 798 mutex_lock(&data->lock); ··· 821 816 mutex_unlock(&data->lock); 822 817 823 818 /* Clamp to valid range. */ 824 - buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); 825 - buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); 826 - buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); 819 + data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); 820 + data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); 821 + data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); 827 822 828 - iio_push_to_buffers_with_timestamp(indio_dev, buff, 823 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 829 824 iio_get_time_ns(indio_dev)); 825 + 830 826 return; 831 827 832 828 unlock:
+9 -8
drivers/iio/proximity/mb1232.c
··· 40 40 */ 41 41 struct completion ranging; 42 42 int irqnr; 43 + /* Ensure correct alignment of data to push to IIO buffer */ 44 + struct { 45 + s16 distance; 46 + s64 ts __aligned(8); 47 + } scan; 43 48 }; 44 49 45 50 static irqreturn_t mb1232_handle_irq(int irq, void *dev_id) ··· 118 113 struct iio_poll_func *pf = p; 119 114 struct iio_dev *indio_dev = pf->indio_dev; 120 115 struct mb1232_data *data = iio_priv(indio_dev); 121 - /* 122 - * triggered buffer 123 - * 16-bit channel + 48-bit padding + 64-bit timestamp 124 - */ 125 - s16 buffer[8] = { 0 }; 126 116 127 - buffer[0] = mb1232_read_distance(data); 128 - if (buffer[0] < 0) 117 + data->scan.distance = mb1232_read_distance(data); 118 + if (data->scan.distance < 0) 129 119 goto err; 130 120 131 - iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); 121 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 122 + pf->timestamp); 132 123 133 124 err: 134 125 iio_trigger_notify_done(indio_dev->trig);
+1 -2
drivers/staging/greybus/audio_helper.c
··· 173 173 id.index = control->index; 174 174 kctl = snd_ctl_find_id(card, &id); 175 175 if (!kctl) { 176 - dev_err(dev, "%d: Failed to find %s\n", err, 177 - control->name); 176 + dev_err(dev, "Failed to find %s\n", control->name); 178 177 continue; 179 178 } 180 179 err = snd_ctl_remove(card, kctl);
+15 -14
drivers/staging/greybus/audio_topology.c
··· 456 456 val = ucontrol->value.integer.value[0] & mask; 457 457 connect = !!val; 458 458 459 + ret = gb_pm_runtime_get_sync(bundle); 460 + if (ret) 461 + return ret; 462 + 463 + ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id, 464 + GB_AUDIO_INVALID_INDEX, &gbvalue); 465 + if (ret) 466 + goto exit; 467 + 459 468 /* update ucontrol */ 460 469 if (gbvalue.value.integer_value[0] != val) { 461 470 for (wi = 0; wi < wlist->num_widgets; wi++) { ··· 475 466 gbvalue.value.integer_value[0] = 476 467 cpu_to_le32(ucontrol->value.integer.value[0]); 477 468 478 - ret = gb_pm_runtime_get_sync(bundle); 479 - if (ret) 480 - return ret; 481 - 482 469 ret = gb_audio_gb_set_control(module->mgmt_connection, 483 470 data->ctl_id, 484 471 GB_AUDIO_INVALID_INDEX, &gbvalue); 485 - 486 - gb_pm_runtime_put_autosuspend(bundle); 487 - 488 - if (ret) { 489 - dev_err_ratelimited(codec_dev, 490 - "%d:Error in %s for %s\n", ret, 491 - __func__, kcontrol->id.name); 492 - return ret; 493 - } 494 472 } 495 473 496 - return 0; 474 + exit: 475 + gb_pm_runtime_put_autosuspend(bundle); 476 + if (ret) 477 + dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret, 478 + __func__, kcontrol->id.name); 479 + return ret; 497 480 } 498 481 499 482 #define SOC_DAPM_MIXER_GB(xname, kcount, data) \
-5
drivers/staging/wlan-ng/hfa384x_usb.c
··· 524 524 */ 525 525 void hfa384x_create(struct hfa384x *hw, struct usb_device *usb) 526 526 { 527 - memset(hw, 0, sizeof(*hw)); 528 527 hw->usb = usb; 529 - 530 - /* set up the endpoints */ 531 - hw->endp_in = usb_rcvbulkpipe(usb, 1); 532 - hw->endp_out = usb_sndbulkpipe(usb, 2); 533 528 534 529 /* Set up the waitq */ 535 530 init_waitqueue_head(&hw->cmdq);
+6 -13
drivers/staging/wlan-ng/prism2usb.c
··· 61 61 const struct usb_device_id *id) 62 62 { 63 63 struct usb_device *dev; 64 - const struct usb_endpoint_descriptor *epd; 65 - const struct usb_host_interface *iface_desc = interface->cur_altsetting; 64 + struct usb_endpoint_descriptor *bulk_in, *bulk_out; 65 + struct usb_host_interface *iface_desc = interface->cur_altsetting; 66 66 struct wlandevice *wlandev = NULL; 67 67 struct hfa384x *hw = NULL; 68 68 int result = 0; 69 69 70 - if (iface_desc->desc.bNumEndpoints != 2) { 71 - result = -ENODEV; 72 - goto failed; 73 - } 74 - 75 - result = -EINVAL; 76 - epd = &iface_desc->endpoint[1].desc; 77 - if (!usb_endpoint_is_bulk_in(epd)) 78 - goto failed; 79 - epd = &iface_desc->endpoint[2].desc; 80 - if (!usb_endpoint_is_bulk_out(epd)) 70 + result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL); 71 + if (result) 81 72 goto failed; 82 73 83 74 dev = interface_to_usbdev(interface); ··· 87 96 } 88 97 89 98 /* Initialize the hw data */ 99 + hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress); 100 + hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress); 90 101 hfa384x_create(hw, dev); 91 102 hw->wlandev = wlandev; 92 103