.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * HID Sensors Driver |
---|
3 | 4 | * Copyright (c) 2014, Intel Corporation. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify it |
---|
6 | | - * under the terms and conditions of the GNU General Public License, |
---|
7 | | - * version 2, as published by the Free Software Foundation. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
12 | | - * more details. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | #include <linux/device.h> |
---|
.. | .. |
---|
22 | 14 | #include <linux/iio/iio.h> |
---|
23 | 15 | #include <linux/iio/sysfs.h> |
---|
24 | 16 | #include <linux/iio/buffer.h> |
---|
25 | | -#include <linux/iio/trigger_consumer.h> |
---|
26 | | -#include <linux/iio/triggered_buffer.h> |
---|
27 | 17 | #include "../common/hid-sensors/hid-sensor-trigger.h" |
---|
28 | 18 | |
---|
29 | 19 | struct dev_rot_state { |
---|
.. | .. |
---|
291 | 281 | } |
---|
292 | 282 | |
---|
293 | 283 | indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels); |
---|
294 | | - indio_dev->dev.parent = &pdev->dev; |
---|
295 | 284 | indio_dev->info = &dev_rot_info; |
---|
296 | 285 | indio_dev->name = name; |
---|
297 | 286 | indio_dev->modes = INDIO_DIRECT_MODE; |
---|
298 | 287 | |
---|
299 | | - ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, |
---|
300 | | - NULL, NULL); |
---|
301 | | - if (ret) { |
---|
302 | | - dev_err(&pdev->dev, "failed to initialize trigger buffer\n"); |
---|
303 | | - return ret; |
---|
304 | | - } |
---|
305 | 288 | atomic_set(&rot_state->common_attributes.data_ready, 0); |
---|
| 289 | + |
---|
306 | 290 | ret = hid_sensor_setup_trigger(indio_dev, name, |
---|
307 | 291 | &rot_state->common_attributes); |
---|
308 | 292 | if (ret) { |
---|
309 | 293 | dev_err(&pdev->dev, "trigger setup failed\n"); |
---|
310 | | - goto error_unreg_buffer_funcs; |
---|
| 294 | + return ret; |
---|
311 | 295 | } |
---|
312 | 296 | |
---|
313 | 297 | ret = iio_device_register(indio_dev); |
---|
.. | .. |
---|
331 | 315 | error_iio_unreg: |
---|
332 | 316 | iio_device_unregister(indio_dev); |
---|
333 | 317 | error_remove_trigger: |
---|
334 | | - hid_sensor_remove_trigger(&rot_state->common_attributes); |
---|
335 | | -error_unreg_buffer_funcs: |
---|
336 | | - iio_triggered_buffer_cleanup(indio_dev); |
---|
| 318 | + hid_sensor_remove_trigger(indio_dev, &rot_state->common_attributes); |
---|
337 | 319 | return ret; |
---|
338 | 320 | } |
---|
339 | 321 | |
---|
.. | .. |
---|
346 | 328 | |
---|
347 | 329 | sensor_hub_remove_callback(hsdev, hsdev->usage); |
---|
348 | 330 | iio_device_unregister(indio_dev); |
---|
349 | | - hid_sensor_remove_trigger(&rot_state->common_attributes); |
---|
350 | | - iio_triggered_buffer_cleanup(indio_dev); |
---|
| 331 | + hid_sensor_remove_trigger(indio_dev, &rot_state->common_attributes); |
---|
351 | 332 | |
---|
352 | 333 | return 0; |
---|
353 | 334 | } |
---|