@@ -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
303287static 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-
506398static 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 }
0 commit comments