forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/iio/light/hid-sensor-prox.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_PRESENCE 0
....@@ -302,23 +288,17 @@
302288 }
303289
304290 indio_dev->num_channels = ARRAY_SIZE(prox_channels);
305
- indio_dev->dev.parent = &pdev->dev;
306291 indio_dev->info = &prox_info;
307292 indio_dev->name = name;
308293 indio_dev->modes = INDIO_DIRECT_MODE;
309294
310
- ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
311
- NULL, NULL);
312
- if (ret) {
313
- dev_err(&pdev->dev, "failed to initialize trigger buffer\n");
314
- goto error_free_dev_mem;
315
- }
316295 atomic_set(&prox_state->common_attributes.data_ready, 0);
296
+
317297 ret = hid_sensor_setup_trigger(indio_dev, name,
318298 &prox_state->common_attributes);
319299 if (ret) {
320300 dev_err(&pdev->dev, "trigger setup failed\n");
321
- goto error_unreg_buffer_funcs;
301
+ goto error_free_dev_mem;
322302 }
323303
324304 ret = iio_device_register(indio_dev);
....@@ -342,9 +322,7 @@
342322 error_iio_unreg:
343323 iio_device_unregister(indio_dev);
344324 error_remove_trigger:
345
- hid_sensor_remove_trigger(&prox_state->common_attributes);
346
-error_unreg_buffer_funcs:
347
- iio_triggered_buffer_cleanup(indio_dev);
325
+ hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes);
348326 error_free_dev_mem:
349327 kfree(indio_dev->channels);
350328 return ret;
....@@ -359,8 +337,7 @@
359337
360338 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PROX);
361339 iio_device_unregister(indio_dev);
362
- hid_sensor_remove_trigger(&prox_state->common_attributes);
363
- iio_triggered_buffer_cleanup(indio_dev);
340
+ hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes);
364341 kfree(indio_dev->channels);
365342
366343 return 0;