Skip to content

Commit cb95585

Browse files
larsclausenjic23
authored andcommitted
iio: Remove support for the legacy event config interface
Now that all drivers have been converted to the new event config interface we can remove for the legacy event config interface. Also drop the '_new' suffix for the event config interface callbacks, since those are the only callbacks now. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent bb7f9d9 commit cb95585

16 files changed

Lines changed: 97 additions & 235 deletions

File tree

‎drivers/iio/adc/max1363.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,10 +1039,10 @@ static const struct iio_info max1238_info = {
10391039
};
10401040

10411041
static const struct iio_info max1363_info = {
1042-
.read_event_value_new = &max1363_read_thresh,
1043-
.write_event_value_new = &max1363_write_thresh,
1044-
.read_event_config_new = &max1363_read_event_config,
1045-
.write_event_config_new = &max1363_write_event_config,
1042+
.read_event_value = &max1363_read_thresh,
1043+
.write_event_value = &max1363_write_thresh,
1044+
.read_event_config = &max1363_read_event_config,
1045+
.write_event_config = &max1363_write_event_config,
10461046
.read_raw = &max1363_read_raw,
10471047
.update_scan_mode = &max1363_update_scan_mode,
10481048
.driver_module = THIS_MODULE,

‎drivers/iio/dac/ad5421.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,9 @@ static int ad5421_read_event_value(struct iio_dev *indio_dev,
458458
static const struct iio_info ad5421_info = {
459459
.read_raw = ad5421_read_raw,
460460
.write_raw = ad5421_write_raw,
461-
.read_event_config_new = ad5421_read_event_config,
462-
.write_event_config_new = ad5421_write_event_config,
463-
.read_event_value_new = ad5421_read_event_value,
461+
.read_event_config = ad5421_read_event_config,
462+
.write_event_config = ad5421_write_event_config,
463+
.read_event_value = ad5421_read_event_value,
464464
.driver_module = THIS_MODULE,
465465
};
466466

‎drivers/iio/industrialio-event.c‎

Lines changed: 22 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,9 @@ static ssize_t iio_ev_state_store(struct device *dev,
242242
if (ret < 0)
243243
return ret;
244244

245-
if (indio_dev->info->write_event_config)
246-
ret = indio_dev->info->write_event_config(indio_dev,
247-
this_attr->address, val);
248-
else
249-
ret = indio_dev->info->write_event_config_new(indio_dev,
250-
this_attr->c, iio_ev_attr_type(this_attr),
251-
iio_ev_attr_dir(this_attr), val);
245+
ret = indio_dev->info->write_event_config(indio_dev,
246+
this_attr->c, iio_ev_attr_type(this_attr),
247+
iio_ev_attr_dir(this_attr), val);
252248

253249
return (ret < 0) ? ret : len;
254250
}
@@ -261,13 +257,9 @@ static ssize_t iio_ev_state_show(struct device *dev,
261257
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
262258
int val;
263259

264-
if (indio_dev->info->read_event_config)
265-
val = indio_dev->info->read_event_config(indio_dev,
266-
this_attr->address);
267-
else
268-
val = indio_dev->info->read_event_config_new(indio_dev,
269-
this_attr->c, iio_ev_attr_type(this_attr),
270-
iio_ev_attr_dir(this_attr));
260+
val = indio_dev->info->read_event_config(indio_dev,
261+
this_attr->c, iio_ev_attr_type(this_attr),
262+
iio_ev_attr_dir(this_attr));
271263
if (val < 0)
272264
return val;
273265
else
@@ -283,21 +275,13 @@ static ssize_t iio_ev_value_show(struct device *dev,
283275
int val, val2;
284276
int ret;
285277

286-
if (indio_dev->info->read_event_value) {
287-
ret = indio_dev->info->read_event_value(indio_dev,
288-
this_attr->address, &val);
289-
if (ret < 0)
290-
return ret;
291-
return sprintf(buf, "%d\n", val);
292-
} else {
293-
ret = indio_dev->info->read_event_value_new(indio_dev,
294-
this_attr->c, iio_ev_attr_type(this_attr),
295-
iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
296-
&val, &val2);
297-
if (ret < 0)
298-
return ret;
299-
return iio_format_value(buf, ret, val, val2);
300-
}
278+
ret = indio_dev->info->read_event_value(indio_dev,
279+
this_attr->c, iio_ev_attr_type(this_attr),
280+
iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
281+
&val, &val2);
282+
if (ret < 0)
283+
return ret;
284+
return iio_format_value(buf, ret, val, val2);
301285
}
302286

303287
static ssize_t iio_ev_value_store(struct device *dev,
@@ -310,25 +294,16 @@ static ssize_t iio_ev_value_store(struct device *dev,
310294
int val, val2;
311295
int ret;
312296

313-
if (!indio_dev->info->write_event_value &&
314-
!indio_dev->info->write_event_value_new)
297+
if (!indio_dev->info->write_event_value)
315298
return -EINVAL;
316299

317-
if (indio_dev->info->write_event_value) {
318-
ret = kstrtoint(buf, 10, &val);
319-
if (ret)
320-
return ret;
321-
ret = indio_dev->info->write_event_value(indio_dev,
322-
this_attr->address, val);
323-
} else {
324-
ret = iio_str_to_fixpoint(buf, 100000, &val, &val2);
325-
if (ret)
326-
return ret;
327-
ret = indio_dev->info->write_event_value_new(indio_dev,
328-
this_attr->c, iio_ev_attr_type(this_attr),
329-
iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
330-
val, val2);
331-
}
300+
ret = iio_str_to_fixpoint(buf, 100000, &val, &val2);
301+
if (ret)
302+
return ret;
303+
ret = indio_dev->info->write_event_value(indio_dev,
304+
this_attr->c, iio_ev_attr_type(this_attr),
305+
iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
306+
val, val2);
332307
if (ret < 0)
333308
return ret;
334309

@@ -377,7 +352,7 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
377352
return attrcount;
378353
}
379354

380-
static int iio_device_add_event_sysfs_new(struct iio_dev *indio_dev,
355+
static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
381356
struct iio_chan_spec const *chan)
382357
{
383358
int ret = 0, i, attrcount = 0;
@@ -420,89 +395,6 @@ static int iio_device_add_event_sysfs_new(struct iio_dev *indio_dev,
420395
return ret;
421396
}
422397

423-
static int iio_device_add_event_sysfs_old(struct iio_dev *indio_dev,
424-
struct iio_chan_spec const *chan)
425-
{
426-
int ret = 0, i, attrcount = 0;
427-
u64 mask = 0;
428-
char *postfix;
429-
if (!chan->event_mask)
430-
return 0;
431-
432-
for_each_set_bit(i, &chan->event_mask, sizeof(chan->event_mask)*8) {
433-
postfix = kasprintf(GFP_KERNEL, "%s_%s_en",
434-
iio_ev_type_text[i/IIO_EV_DIR_MAX],
435-
iio_ev_dir_text[i%IIO_EV_DIR_MAX]);
436-
if (postfix == NULL) {
437-
ret = -ENOMEM;
438-
goto error_ret;
439-
}
440-
if (chan->modified)
441-
mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel2,
442-
i/IIO_EV_DIR_MAX,
443-
i%IIO_EV_DIR_MAX);
444-
else if (chan->differential)
445-
mask = IIO_EVENT_CODE(chan->type,
446-
0, 0,
447-
i%IIO_EV_DIR_MAX,
448-
i/IIO_EV_DIR_MAX,
449-
0,
450-
chan->channel,
451-
chan->channel2);
452-
else
453-
mask = IIO_UNMOD_EVENT_CODE(chan->type,
454-
chan->channel,
455-
i/IIO_EV_DIR_MAX,
456-
i%IIO_EV_DIR_MAX);
457-
458-
ret = __iio_add_chan_devattr(postfix,
459-
chan,
460-
&iio_ev_state_show,
461-
iio_ev_state_store,
462-
mask,
463-
0,
464-
&indio_dev->dev,
465-
&indio_dev->event_interface->
466-
dev_attr_list);
467-
kfree(postfix);
468-
if (ret)
469-
goto error_ret;
470-
attrcount++;
471-
postfix = kasprintf(GFP_KERNEL, "%s_%s_value",
472-
iio_ev_type_text[i/IIO_EV_DIR_MAX],
473-
iio_ev_dir_text[i%IIO_EV_DIR_MAX]);
474-
if (postfix == NULL) {
475-
ret = -ENOMEM;
476-
goto error_ret;
477-
}
478-
ret = __iio_add_chan_devattr(postfix, chan,
479-
iio_ev_value_show,
480-
iio_ev_value_store,
481-
mask,
482-
0,
483-
&indio_dev->dev,
484-
&indio_dev->event_interface->
485-
dev_attr_list);
486-
kfree(postfix);
487-
if (ret)
488-
goto error_ret;
489-
attrcount++;
490-
}
491-
ret = attrcount;
492-
error_ret:
493-
return ret;
494-
}
495-
496-
497-
static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
498-
struct iio_chan_spec const *chan)
499-
{
500-
if (chan->event_mask)
501-
return iio_device_add_event_sysfs_old(indio_dev, chan);
502-
else
503-
return iio_device_add_event_sysfs_new(indio_dev, chan);
504-
}
505-
506398
static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev)
507399
{
508400
int j, ret, attrcount = 0;
@@ -523,8 +415,6 @@ static bool iio_check_for_dynamic_events(struct iio_dev *indio_dev)
523415
int j;
524416

525417
for (j = 0; j < indio_dev->num_channels; j++) {
526-
if (indio_dev->channels[j].event_mask != 0)
527-
return true;
528418
if (indio_dev->channels[j].num_event_specs != 0)
529419
return true;
530420
}

‎drivers/iio/light/apds9300.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,10 @@ static const struct iio_info apds9300_info_no_irq = {
344344
static const struct iio_info apds9300_info = {
345345
.driver_module = THIS_MODULE,
346346
.read_raw = apds9300_read_raw,
347-
.read_event_value_new = apds9300_read_thresh,
348-
.write_event_value_new = apds9300_write_thresh,
349-
.read_event_config_new = apds9300_read_interrupt_config,
350-
.write_event_config_new = apds9300_write_interrupt_config,
347+
.read_event_value = apds9300_read_thresh,
348+
.write_event_value = apds9300_write_thresh,
349+
.read_event_config = apds9300_read_interrupt_config,
350+
.write_event_config = apds9300_write_interrupt_config,
351351
};
352352

353353
static const struct iio_event_spec apds9300_event_spec[] = {

‎drivers/iio/light/cm36651.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,10 @@ static const struct iio_info cm36651_info = {
614614
.driver_module = THIS_MODULE,
615615
.read_raw = &cm36651_read_raw,
616616
.write_raw = &cm36651_write_raw,
617-
.read_event_value_new = &cm36651_read_prox_thresh,
618-
.write_event_value_new = &cm36651_write_prox_thresh,
619-
.read_event_config_new = &cm36651_read_prox_event_config,
620-
.write_event_config_new = &cm36651_write_prox_event_config,
617+
.read_event_value = &cm36651_read_prox_thresh,
618+
.write_event_value = &cm36651_write_prox_thresh,
619+
.read_event_config = &cm36651_read_prox_event_config,
620+
.write_event_config = &cm36651_write_prox_event_config,
621621
.attrs = &cm36651_attribute_group,
622622
};
623623

‎drivers/iio/light/gp2ap020a00f.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,10 +1388,10 @@ static const struct iio_chan_spec gp2ap020a00f_channels[] = {
13881388

13891389
static const struct iio_info gp2ap020a00f_info = {
13901390
.read_raw = &gp2ap020a00f_read_raw,
1391-
.read_event_value_new = &gp2ap020a00f_read_event_val,
1392-
.read_event_config_new = &gp2ap020a00f_read_event_config,
1393-
.write_event_value_new = &gp2ap020a00f_write_event_val,
1394-
.write_event_config_new = &gp2ap020a00f_write_event_config,
1391+
.read_event_value = &gp2ap020a00f_read_event_val,
1392+
.read_event_config = &gp2ap020a00f_read_event_config,
1393+
.write_event_value = &gp2ap020a00f_write_event_val,
1394+
.write_event_config = &gp2ap020a00f_write_event_config,
13951395
.driver_module = THIS_MODULE,
13961396
};
13971397

‎drivers/iio/light/tsl2563.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,10 @@ static const struct iio_info tsl2563_info = {
702702
.driver_module = THIS_MODULE,
703703
.read_raw = &tsl2563_read_raw,
704704
.write_raw = &tsl2563_write_raw,
705-
.read_event_value_new = &tsl2563_read_thresh,
706-
.write_event_value_new = &tsl2563_write_thresh,
707-
.read_event_config_new = &tsl2563_read_interrupt_config,
708-
.write_event_config_new = &tsl2563_write_interrupt_config,
705+
.read_event_value = &tsl2563_read_thresh,
706+
.write_event_value = &tsl2563_write_thresh,
707+
.read_event_config = &tsl2563_read_interrupt_config,
708+
.write_event_config = &tsl2563_write_interrupt_config,
709709
};
710710

711711
static int tsl2563_probe(struct i2c_client *client,

‎drivers/staging/iio/accel/lis3l02dq_core.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,10 @@ static const struct attribute_group lis3l02dq_attribute_group = {
676676
static const struct iio_info lis3l02dq_info = {
677677
.read_raw = &lis3l02dq_read_raw,
678678
.write_raw = &lis3l02dq_write_raw,
679-
.read_event_value_new = &lis3l02dq_read_thresh,
680-
.write_event_value_new = &lis3l02dq_write_thresh,
681-
.write_event_config_new = &lis3l02dq_write_event_config,
682-
.read_event_config_new = &lis3l02dq_read_event_config,
679+
.read_event_value = &lis3l02dq_read_thresh,
680+
.write_event_value = &lis3l02dq_write_thresh,
681+
.write_event_config = &lis3l02dq_write_event_config,
682+
.read_event_config = &lis3l02dq_read_event_config,
683683
.driver_module = THIS_MODULE,
684684
.attrs = &lis3l02dq_attribute_group,
685685
};

‎drivers/staging/iio/accel/sca3000_core.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,20 +1126,20 @@ static const struct iio_info sca3000_info = {
11261126
.attrs = &sca3000_attribute_group,
11271127
.read_raw = &sca3000_read_raw,
11281128
.event_attrs = &sca3000_event_attribute_group,
1129-
.read_event_value_new = &sca3000_read_thresh,
1130-
.write_event_value_new = &sca3000_write_thresh,
1131-
.read_event_config_new = &sca3000_read_event_config,
1132-
.write_event_config_new = &sca3000_write_event_config,
1129+
.read_event_value = &sca3000_read_thresh,
1130+
.write_event_value = &sca3000_write_thresh,
1131+
.read_event_config = &sca3000_read_event_config,
1132+
.write_event_config = &sca3000_write_event_config,
11331133
.driver_module = THIS_MODULE,
11341134
};
11351135

11361136
static const struct iio_info sca3000_info_with_temp = {
11371137
.attrs = &sca3000_attribute_group_with_temp,
11381138
.read_raw = &sca3000_read_raw,
1139-
.read_event_value_new = &sca3000_read_thresh,
1140-
.write_event_value_new = &sca3000_write_thresh,
1141-
.read_event_config_new = &sca3000_read_event_config,
1142-
.write_event_config_new = &sca3000_write_event_config,
1139+
.read_event_value = &sca3000_read_thresh,
1140+
.write_event_value = &sca3000_write_thresh,
1141+
.read_event_config = &sca3000_read_event_config,
1142+
.write_event_config = &sca3000_write_event_config,
11431143
.driver_module = THIS_MODULE,
11441144
};
11451145

‎drivers/staging/iio/adc/ad7291.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,10 @@ static const struct iio_chan_spec ad7291_channels[] = {
452452

453453
static const struct iio_info ad7291_info = {
454454
.read_raw = &ad7291_read_raw,
455-
.read_event_config_new = &ad7291_read_event_config,
456-
.write_event_config_new = &ad7291_write_event_config,
457-
.read_event_value_new = &ad7291_read_event_value,
458-
.write_event_value_new = &ad7291_write_event_value,
455+
.read_event_config = &ad7291_read_event_config,
456+
.write_event_config = &ad7291_write_event_config,
457+
.read_event_value = &ad7291_read_event_value,
458+
.write_event_value = &ad7291_write_event_value,
459459
.driver_module = THIS_MODULE,
460460
};
461461

0 commit comments

Comments
 (0)