hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iio/orientation/hid-sensor-incl-3d.c
....@@ -1,19 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HID Sensors Driver
34 * Copyright (c) 2013, 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; if not, write to the Free Software Foundation, Inc.
16
- *
175 */
186
197 #include <linux/device.h>
....@@ -27,8 +15,6 @@
2715 #include <linux/iio/iio.h>
2816 #include <linux/iio/sysfs.h>
2917 #include <linux/iio/buffer.h>
30
-#include <linux/iio/trigger_consumer.h>
31
-#include <linux/iio/triggered_buffer.h>
3218 #include "../common/hid-sensors/hid-sensor-trigger.h"
3319
3420 enum incl_3d_channel {
....@@ -353,23 +339,17 @@
353339 }
354340
355341 indio_dev->num_channels = ARRAY_SIZE(incl_3d_channels);
356
- indio_dev->dev.parent = &pdev->dev;
357342 indio_dev->info = &incl_3d_info;
358343 indio_dev->name = name;
359344 indio_dev->modes = INDIO_DIRECT_MODE;
360345
361
- ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
362
- NULL, NULL);
363
- if (ret) {
364
- dev_err(&pdev->dev, "failed to initialize trigger buffer\n");
365
- goto error_free_dev_mem;
366
- }
367346 atomic_set(&incl_state->common_attributes.data_ready, 0);
347
+
368348 ret = hid_sensor_setup_trigger(indio_dev, name,
369349 &incl_state->common_attributes);
370350 if (ret) {
371351 dev_err(&pdev->dev, "trigger setup failed\n");
372
- goto error_unreg_buffer_funcs;
352
+ goto error_free_dev_mem;
373353 }
374354
375355 ret = iio_device_register(indio_dev);
....@@ -394,9 +374,7 @@
394374 error_iio_unreg:
395375 iio_device_unregister(indio_dev);
396376 error_remove_trigger:
397
- hid_sensor_remove_trigger(&incl_state->common_attributes);
398
-error_unreg_buffer_funcs:
399
- iio_triggered_buffer_cleanup(indio_dev);
377
+ hid_sensor_remove_trigger(indio_dev, &incl_state->common_attributes);
400378 error_free_dev_mem:
401379 kfree(indio_dev->channels);
402380 return ret;
....@@ -411,8 +389,7 @@
411389
412390 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_INCLINOMETER_3D);
413391 iio_device_unregister(indio_dev);
414
- hid_sensor_remove_trigger(&incl_state->common_attributes);
415
- iio_triggered_buffer_cleanup(indio_dev);
392
+ hid_sensor_remove_trigger(indio_dev, &incl_state->common_attributes);
416393 kfree(indio_dev->channels);
417394
418395 return 0;