Skip to content

Commit 33f855c

Browse files
committed
Merge tag 'char-misc-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are a number of small char/misc and iio driver fixes for 6.10-rc4. Included in here are the following: - iio driver fixes for a bunch of reported problems. - mei driver fixes for a number of reported issues. - amiga parport driver build fix. - .editorconfig fix that was causing lots of unintended whitespace changes to happen to files when they were being edited. Unless we want to sweep the whole tree and remove all trailing whitespace at once, this is needed for the .editorconfig file to be able to be used at all. This change is required because the original submitters never touched older files in the tree. - jfs bugfix for a buffer overflow The jfs bugfix is in here as I didn't know where else to put it, and it's been ignored for a while as the filesystem seems to be abandoned and I'm tired of seeing the same issue reported in multiple places. All of these have been in linux-next with no reported issues" * tag 'char-misc-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (25 commits) .editorconfig: remove trim_trailing_whitespace option jfs: xattr: fix buffer overflow for invalid xattr misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe() misc: microchip: pci1xxxx: fix double free in the error handling of gp_aux_bus_probe() parport: amiga: Mark driver struct with __refdata to prevent section mismatch mei: vsc: Fix wrong invocation of ACPI SID method mei: vsc: Don't stop/restart mei device during system suspend/resume mei: me: release irq in mei_me_pci_resume error path mei: demote client disconnect warning on suspend to debug iio: inkern: fix channel read regression iio: imu: inv_mpu6050: stabilized timestamping in interrupt iio: adc: ad7173: Fix sampling frequency setting iio: adc: ad7173: Clear append status bit iio: imu: inv_icm42600: delete unneeded update watermark call iio: imu: inv_icm42600: stabilized timestamp in interrupt iio: invensense: fix odr switching to same value iio: adc: ad7173: Remove index from temp channel iio: adc: ad7173: Add ad7173_device_info names iio: adc: ad7173: fix buffers enablement for ad7176-2 iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe() ...
2 parents e8b0264 + 7da9dfd commit 33f855c

File tree

24 files changed

+100
-80
lines changed

24 files changed

+100
-80
lines changed

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ root = true
55
[{*.{awk,c,dts,dtsi,dtso,h,mk,s,S},Kconfig,Makefile,Makefile.*}]
66
charset = utf-8
77
end_of_line = lf
8-
trim_trailing_whitespace = true
98
insert_final_newline = true
109
indent_style = tab
1110
indent_size = 8
1211

1312
[*.{json,py,rs}]
1413
charset = utf-8
1514
end_of_line = lf
16-
trim_trailing_whitespace = true
1715
insert_final_newline = true
1816
indent_style = space
1917
indent_size = 4
@@ -26,7 +24,6 @@ indent_size = 8
2624
[*.yaml]
2725
charset = utf-8
2826
end_of_line = lf
29-
trim_trailing_whitespace = unset
3027
insert_final_newline = true
3128
indent_style = space
3229
indent_size = 2

Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ allOf:
139139
Voltage output range of the channel as <minimum, maximum>
140140
Required connections:
141141
Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V;
142-
Rfb2x for: 0 to 10 V; 2.5 to 7.5V; -5 to 5 V;
142+
Rfb2x for: 0 to 10 V; -2.5 to 7.5V; -5 to 5 V;
143143
oneOf:
144144
- items:
145145
- const: 0

drivers/iio/adc/ad7173.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ struct ad7173_device_info {
145145
unsigned int id;
146146
char *name;
147147
bool has_temp;
148+
bool has_input_buf;
148149
bool has_int_ref;
149150
bool has_ref2;
150151
u8 num_gpios;
@@ -212,18 +213,21 @@ static const struct ad7173_device_info ad7173_device_info[] = {
212213
.num_configs = 4,
213214
.num_gpios = 2,
214215
.has_temp = true,
216+
.has_input_buf = true,
215217
.has_int_ref = true,
216218
.clock = 2 * HZ_PER_MHZ,
217219
.sinc5_data_rates = ad7173_sinc5_data_rates,
218220
.num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates),
219221
},
220222
[ID_AD7172_4] = {
223+
.name = "ad7172-4",
221224
.id = AD7172_4_ID,
222225
.num_inputs = 9,
223226
.num_channels = 8,
224227
.num_configs = 8,
225228
.num_gpios = 4,
226229
.has_temp = false,
230+
.has_input_buf = true,
227231
.has_ref2 = true,
228232
.clock = 2 * HZ_PER_MHZ,
229233
.sinc5_data_rates = ad7173_sinc5_data_rates,
@@ -237,6 +241,7 @@ static const struct ad7173_device_info ad7173_device_info[] = {
237241
.num_configs = 8,
238242
.num_gpios = 4,
239243
.has_temp = true,
244+
.has_input_buf = true,
240245
.has_int_ref = true,
241246
.has_ref2 = true,
242247
.clock = 2 * HZ_PER_MHZ,
@@ -251,18 +256,21 @@ static const struct ad7173_device_info ad7173_device_info[] = {
251256
.num_configs = 4,
252257
.num_gpios = 2,
253258
.has_temp = true,
259+
.has_input_buf = true,
254260
.has_int_ref = true,
255261
.clock = 16 * HZ_PER_MHZ,
256262
.sinc5_data_rates = ad7175_sinc5_data_rates,
257263
.num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates),
258264
},
259265
[ID_AD7175_8] = {
266+
.name = "ad7175-8",
260267
.id = AD7175_8_ID,
261268
.num_inputs = 17,
262269
.num_channels = 16,
263270
.num_configs = 8,
264271
.num_gpios = 4,
265272
.has_temp = true,
273+
.has_input_buf = true,
266274
.has_int_ref = true,
267275
.has_ref2 = true,
268276
.clock = 16 * HZ_PER_MHZ,
@@ -277,18 +285,21 @@ static const struct ad7173_device_info ad7173_device_info[] = {
277285
.num_configs = 4,
278286
.num_gpios = 2,
279287
.has_temp = false,
288+
.has_input_buf = false,
280289
.has_int_ref = true,
281290
.clock = 16 * HZ_PER_MHZ,
282291
.sinc5_data_rates = ad7175_sinc5_data_rates,
283292
.num_sinc5_data_rates = ARRAY_SIZE(ad7175_sinc5_data_rates),
284293
},
285294
[ID_AD7177_2] = {
295+
.name = "ad7177-2",
286296
.id = AD7177_ID,
287297
.num_inputs = 5,
288298
.num_channels = 4,
289299
.num_configs = 4,
290300
.num_gpios = 2,
291301
.has_temp = true,
302+
.has_input_buf = true,
292303
.has_int_ref = true,
293304
.clock = 16 * HZ_PER_MHZ,
294305
.odr_start_value = AD7177_ODR_START_VALUE,
@@ -532,6 +543,7 @@ static int ad7173_append_status(struct ad_sigma_delta *sd, bool append)
532543
unsigned int interface_mode = st->interface_mode;
533544
int ret;
534545

546+
interface_mode &= ~AD7173_INTERFACE_DATA_STAT;
535547
interface_mode |= AD7173_INTERFACE_DATA_STAT_EN(append);
536548
ret = ad_sd_write_reg(&st->sd, AD7173_REG_INTERFACE_MODE, 2, interface_mode);
537549
if (ret)
@@ -705,7 +717,7 @@ static int ad7173_write_raw(struct iio_dev *indio_dev,
705717
{
706718
struct ad7173_state *st = iio_priv(indio_dev);
707719
struct ad7173_channel_config *cfg;
708-
unsigned int freq, i, reg;
720+
unsigned int freq, i;
709721
int ret;
710722

711723
ret = iio_device_claim_direct_mode(indio_dev);
@@ -721,16 +733,7 @@ static int ad7173_write_raw(struct iio_dev *indio_dev,
721733

722734
cfg = &st->channels[chan->address].cfg;
723735
cfg->odr = i;
724-
725-
if (!cfg->live)
726-
break;
727-
728-
ret = ad_sd_read_reg(&st->sd, AD7173_REG_FILTER(cfg->cfg_slot), 2, &reg);
729-
if (ret)
730-
break;
731-
reg &= ~AD7173_FILTER_ODR0_MASK;
732-
reg |= FIELD_PREP(AD7173_FILTER_ODR0_MASK, i);
733-
ret = ad_sd_write_reg(&st->sd, AD7173_REG_FILTER(cfg->cfg_slot), 2, reg);
736+
cfg->live = false;
734737
break;
735738

736739
default:
@@ -792,8 +795,7 @@ static const struct iio_chan_spec ad7173_channel_template = {
792795
.type = IIO_VOLTAGE,
793796
.indexed = 1,
794797
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
795-
BIT(IIO_CHAN_INFO_SCALE),
796-
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
798+
BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ),
797799
.scan_type = {
798800
.sign = 'u',
799801
.realbits = 24,
@@ -804,12 +806,11 @@ static const struct iio_chan_spec ad7173_channel_template = {
804806

805807
static const struct iio_chan_spec ad7173_temp_iio_channel_template = {
806808
.type = IIO_TEMP,
807-
.indexed = 1,
808809
.channel = AD7173_AIN_TEMP_POS,
809810
.channel2 = AD7173_AIN_TEMP_NEG,
810811
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
811-
BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET),
812-
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
812+
BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET) |
813+
BIT(IIO_CHAN_INFO_SAMP_FREQ),
813814
.scan_type = {
814815
.sign = 'u',
815816
.realbits = 24,
@@ -932,7 +933,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
932933
AD7173_CH_ADDRESS(chan_arr[chan_index].channel,
933934
chan_arr[chan_index].channel2);
934935
chan_st_priv->cfg.bipolar = false;
935-
chan_st_priv->cfg.input_buf = true;
936+
chan_st_priv->cfg.input_buf = st->info->has_input_buf;
936937
chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF;
937938
st->adc_mode |= AD7173_ADC_MODE_REF_EN;
938939

@@ -989,7 +990,7 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
989990

990991
chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]);
991992
chan_st_priv->chan_reg = chan_index;
992-
chan_st_priv->cfg.input_buf = true;
993+
chan_st_priv->cfg.input_buf = st->info->has_input_buf;
993994
chan_st_priv->cfg.odr = 0;
994995

995996
chan_st_priv->cfg.bipolar = fwnode_property_read_bool(child, "bipolar");

drivers/iio/adc/ad9467.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ static void __ad9467_get_scale(struct ad9467_state *st, int index,
243243
}
244244

245245
static const struct iio_chan_spec ad9434_channels[] = {
246-
AD9467_CHAN(0, 0, 12, 'S'),
246+
AD9467_CHAN(0, 0, 12, 's'),
247247
};
248248

249249
static const struct iio_chan_spec ad9467_channels[] = {
250-
AD9467_CHAN(0, 0, 16, 'S'),
250+
AD9467_CHAN(0, 0, 16, 's'),
251251
};
252252

253253
static const struct ad9467_chip_info ad9467_chip_tbl = {

drivers/iio/common/inv_sensors/inv_sensors_timestamp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_init, IIO_INV_SENSORS_TIMESTAMP);
6060
int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
6161
uint32_t period, bool fifo)
6262
{
63+
uint32_t mult;
64+
6365
/* when FIFO is on, prevent odr change if one is already pending */
6466
if (fifo && ts->new_mult != 0)
6567
return -EAGAIN;
6668

67-
ts->new_mult = period / ts->chip.clock_period;
69+
mult = period / ts->chip.clock_period;
70+
if (mult != ts->mult)
71+
ts->new_mult = mult;
6872

6973
return 0;
7074
}

drivers/iio/dac/ad5592r-base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static int ad5592r_read_raw(struct iio_dev *iio_dev,
415415
s64 tmp = *val * (3767897513LL / 25LL);
416416
*val = div_s64_rem(tmp, 1000000000LL, val2);
417417

418-
return IIO_VAL_INT_PLUS_MICRO;
418+
return IIO_VAL_INT_PLUS_NANO;
419419
}
420420

421421
mutex_lock(&st->lock);

drivers/iio/imu/bmi323/bmi323_core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ static irqreturn_t bmi323_trigger_handler(int irq, void *p)
13911391
&data->buffer.channels,
13921392
ARRAY_SIZE(data->buffer.channels));
13931393
if (ret)
1394-
return IRQ_NONE;
1394+
goto out;
13951395
} else {
13961396
for_each_set_bit(bit, indio_dev->active_scan_mask,
13971397
BMI323_CHAN_MAX) {
@@ -1400,13 +1400,14 @@ static irqreturn_t bmi323_trigger_handler(int irq, void *p)
14001400
&data->buffer.channels[index++],
14011401
BMI323_BYTES_PER_SAMPLE);
14021402
if (ret)
1403-
return IRQ_NONE;
1403+
goto out;
14041404
}
14051405
}
14061406

14071407
iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
14081408
iio_get_time_ns(indio_dev));
14091409

1410+
out:
14101411
iio_trigger_notify_done(indio_dev->trig);
14111412

14121413
return IRQ_HANDLED;

drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
130130
/* update data FIFO write */
131131
inv_sensors_timestamp_apply_odr(ts, 0, 0, 0);
132132
ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en);
133-
if (ret)
134-
goto out_unlock;
135-
136-
ret = inv_icm42600_buffer_update_watermark(st);
137133

138134
out_unlock:
139135
mutex_unlock(&st->lock);

drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,15 @@ int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st)
222222
latency_accel = period_accel * wm_accel;
223223

224224
/* 0 value for watermark means that the sensor is turned off */
225+
if (wm_gyro == 0 && wm_accel == 0)
226+
return 0;
227+
225228
if (latency_gyro == 0) {
226229
watermark = wm_accel;
230+
st->fifo.watermark.eff_accel = wm_accel;
227231
} else if (latency_accel == 0) {
228232
watermark = wm_gyro;
233+
st->fifo.watermark.eff_gyro = wm_gyro;
229234
} else {
230235
/* compute the smallest latency that is a multiple of both */
231236
if (latency_gyro <= latency_accel)
@@ -241,6 +246,13 @@ int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st)
241246
watermark = latency / period;
242247
if (watermark < 1)
243248
watermark = 1;
249+
/* update effective watermark */
250+
st->fifo.watermark.eff_gyro = latency / period_gyro;
251+
if (st->fifo.watermark.eff_gyro < 1)
252+
st->fifo.watermark.eff_gyro = 1;
253+
st->fifo.watermark.eff_accel = latency / period_accel;
254+
if (st->fifo.watermark.eff_accel < 1)
255+
st->fifo.watermark.eff_accel = 1;
244256
}
245257

246258
/* compute watermark value in bytes */
@@ -514,7 +526,7 @@ int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st)
514526
/* handle gyroscope timestamp and FIFO data parsing */
515527
if (st->fifo.nb.gyro > 0) {
516528
ts = &gyro_st->ts;
517-
inv_sensors_timestamp_interrupt(ts, st->fifo.nb.gyro,
529+
inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_gyro,
518530
st->timestamp.gyro);
519531
ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
520532
if (ret)
@@ -524,7 +536,7 @@ int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st)
524536
/* handle accelerometer timestamp and FIFO data parsing */
525537
if (st->fifo.nb.accel > 0) {
526538
ts = &accel_st->ts;
527-
inv_sensors_timestamp_interrupt(ts, st->fifo.nb.accel,
539+
inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_accel,
528540
st->timestamp.accel);
529541
ret = inv_icm42600_accel_parse_fifo(st->indio_accel);
530542
if (ret)
@@ -577,6 +589,9 @@ int inv_icm42600_buffer_init(struct inv_icm42600_state *st)
577589
unsigned int val;
578590
int ret;
579591

592+
st->fifo.watermark.eff_gyro = 1;
593+
st->fifo.watermark.eff_accel = 1;
594+
580595
/*
581596
* Default FIFO configuration (bits 7 to 5)
582597
* - use invalid value

drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct inv_icm42600_fifo {
3232
struct {
3333
unsigned int gyro;
3434
unsigned int accel;
35+
unsigned int eff_gyro;
36+
unsigned int eff_accel;
3537
} watermark;
3638
size_t count;
3739
struct {

drivers/iio/imu/inv_icm42600/inv_icm42600_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ static int inv_icm42600_irq_init(struct inv_icm42600_state *st, int irq,
537537
if (ret)
538538
return ret;
539539

540+
irq_type |= IRQF_ONESHOT;
540541
return devm_request_threaded_irq(dev, irq, inv_icm42600_irq_timestamp,
541542
inv_icm42600_irq_handler, irq_type,
542543
"inv_icm42600", st);

drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev,
130130
/* update data FIFO write */
131131
inv_sensors_timestamp_apply_odr(ts, 0, 0, 0);
132132
ret = inv_icm42600_buffer_set_fifo_en(st, fifo_en | st->fifo.en);
133-
if (ret)
134-
goto out_unlock;
135-
136-
ret = inv_icm42600_buffer_update_watermark(st);
137133

138134
out_unlock:
139135
mutex_unlock(&st->lock);

drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
100100
goto end_session;
101101
/* Each FIFO data contains all sensors, so same number for FIFO and sensor data */
102102
fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
103-
inv_sensors_timestamp_interrupt(&st->timestamp, nb, pf->timestamp);
104-
inv_sensors_timestamp_apply_odr(&st->timestamp, fifo_period, nb, 0);
103+
inv_sensors_timestamp_interrupt(&st->timestamp, 1, pf->timestamp);
104+
inv_sensors_timestamp_apply_odr(&st->timestamp, fifo_period, 1, 0);
105105

106106
/* clear internal data buffer for avoiding kernel data leak */
107107
memset(data, 0, sizeof(data));

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev, int irq_type)
300300
if (!st->trig)
301301
return -ENOMEM;
302302

303+
irq_type |= IRQF_ONESHOT;
303304
ret = devm_request_threaded_irq(&indio_dev->dev, st->irq,
304305
&inv_mpu6050_interrupt_timestamp,
305306
&inv_mpu6050_interrupt_handle,

drivers/iio/inkern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ int iio_read_channel_processed_scale(struct iio_channel *chan, int *val,
721721
return ret;
722722
*val *= scale;
723723

724-
return 0;
724+
return ret;
725725
} else {
726726
ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_RAW);
727727
if (ret < 0)

0 commit comments

Comments
 (0)