forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/iio/pressure/hid-sensor-press.c
....@@ -1,19 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HID Sensors Driver
34 * 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
- *
175 */
186 #include <linux/device.h>
197 #include <linux/platform_device.h>
....@@ -26,8 +14,6 @@
2614 #include <linux/iio/iio.h>
2715 #include <linux/iio/sysfs.h>
2816 #include <linux/iio/buffer.h>
29
-#include <linux/iio/trigger_consumer.h>
30
-#include <linux/iio/triggered_buffer.h>
3117 #include "../common/hid-sensors/hid-sensor-trigger.h"
3218
3319 #define CHANNEL_SCAN_INDEX_PRESSURE 0
....@@ -297,23 +283,17 @@
297283
298284 indio_dev->num_channels =
299285 ARRAY_SIZE(press_channels);
300
- indio_dev->dev.parent = &pdev->dev;
301286 indio_dev->info = &press_info;
302287 indio_dev->name = name;
303288 indio_dev->modes = INDIO_DIRECT_MODE;
304289
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
- }
311290 atomic_set(&press_state->common_attributes.data_ready, 0);
291
+
312292 ret = hid_sensor_setup_trigger(indio_dev, name,
313293 &press_state->common_attributes);
314294 if (ret) {
315295 dev_err(&pdev->dev, "trigger setup failed\n");
316
- goto error_unreg_buffer_funcs;
296
+ goto error_free_dev_mem;
317297 }
318298
319299 ret = iio_device_register(indio_dev);
....@@ -337,9 +317,7 @@
337317 error_iio_unreg:
338318 iio_device_unregister(indio_dev);
339319 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);
343321 error_free_dev_mem:
344322 kfree(indio_dev->channels);
345323 return ret;
....@@ -354,8 +332,7 @@
354332
355333 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE);
356334 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);
359336 kfree(indio_dev->channels);
360337
361338 return 0;