.. | .. |
---|
| 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 | | - * |
---|
14 | | - * You should have received a copy of the GNU General Public License along with |
---|
15 | | - * this program. |
---|
16 | | - * |
---|
17 | 5 | */ |
---|
18 | 6 | #include <linux/device.h> |
---|
19 | 7 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
26 | 14 | #include <linux/iio/iio.h> |
---|
27 | 15 | #include <linux/iio/sysfs.h> |
---|
28 | 16 | #include <linux/iio/buffer.h> |
---|
29 | | -#include <linux/iio/trigger_consumer.h> |
---|
30 | | -#include <linux/iio/triggered_buffer.h> |
---|
31 | 17 | #include "../common/hid-sensors/hid-sensor-trigger.h" |
---|
32 | 18 | |
---|
33 | 19 | #define CHANNEL_SCAN_INDEX_PRESSURE 0 |
---|
.. | .. |
---|
297 | 283 | |
---|
298 | 284 | indio_dev->num_channels = |
---|
299 | 285 | ARRAY_SIZE(press_channels); |
---|
300 | | - indio_dev->dev.parent = &pdev->dev; |
---|
301 | 286 | indio_dev->info = &press_info; |
---|
302 | 287 | indio_dev->name = name; |
---|
303 | 288 | indio_dev->modes = INDIO_DIRECT_MODE; |
---|
304 | 289 | |
---|
305 | | - ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, |
---|
306 | | - NULL, NULL); |
---|
307 | | - if (ret) { |
---|
308 | | - dev_err(&pdev->dev, "failed to initialize trigger buffer\n"); |
---|
309 | | - goto error_free_dev_mem; |
---|
310 | | - } |
---|
311 | 290 | atomic_set(&press_state->common_attributes.data_ready, 0); |
---|
| 291 | + |
---|
312 | 292 | ret = hid_sensor_setup_trigger(indio_dev, name, |
---|
313 | 293 | &press_state->common_attributes); |
---|
314 | 294 | if (ret) { |
---|
315 | 295 | dev_err(&pdev->dev, "trigger setup failed\n"); |
---|
316 | | - goto error_unreg_buffer_funcs; |
---|
| 296 | + goto error_free_dev_mem; |
---|
317 | 297 | } |
---|
318 | 298 | |
---|
319 | 299 | ret = iio_device_register(indio_dev); |
---|
.. | .. |
---|
337 | 317 | error_iio_unreg: |
---|
338 | 318 | iio_device_unregister(indio_dev); |
---|
339 | 319 | error_remove_trigger: |
---|
340 | | - hid_sensor_remove_trigger(&press_state->common_attributes); |
---|
341 | | -error_unreg_buffer_funcs: |
---|
342 | | - iio_triggered_buffer_cleanup(indio_dev); |
---|
| 320 | + hid_sensor_remove_trigger(indio_dev, &press_state->common_attributes); |
---|
343 | 321 | error_free_dev_mem: |
---|
344 | 322 | kfree(indio_dev->channels); |
---|
345 | 323 | return ret; |
---|
.. | .. |
---|
354 | 332 | |
---|
355 | 333 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE); |
---|
356 | 334 | iio_device_unregister(indio_dev); |
---|
357 | | - hid_sensor_remove_trigger(&press_state->common_attributes); |
---|
358 | | - iio_triggered_buffer_cleanup(indio_dev); |
---|
| 335 | + hid_sensor_remove_trigger(indio_dev, &press_state->common_attributes); |
---|
359 | 336 | kfree(indio_dev->channels); |
---|
360 | 337 | |
---|
361 | 338 | return 0; |
---|