hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/iio/orientation/hid-sensor-rotation.c
....@@ -1,15 +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.
135 */
146
157 #include <linux/device.h>
....@@ -22,8 +14,6 @@
2214 #include <linux/iio/iio.h>
2315 #include <linux/iio/sysfs.h>
2416 #include <linux/iio/buffer.h>
25
-#include <linux/iio/trigger_consumer.h>
26
-#include <linux/iio/triggered_buffer.h>
2717 #include "../common/hid-sensors/hid-sensor-trigger.h"
2818
2919 struct dev_rot_state {
....@@ -291,23 +281,17 @@
291281 }
292282
293283 indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels);
294
- indio_dev->dev.parent = &pdev->dev;
295284 indio_dev->info = &dev_rot_info;
296285 indio_dev->name = name;
297286 indio_dev->modes = INDIO_DIRECT_MODE;
298287
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
- }
305288 atomic_set(&rot_state->common_attributes.data_ready, 0);
289
+
306290 ret = hid_sensor_setup_trigger(indio_dev, name,
307291 &rot_state->common_attributes);
308292 if (ret) {
309293 dev_err(&pdev->dev, "trigger setup failed\n");
310
- goto error_unreg_buffer_funcs;
294
+ return ret;
311295 }
312296
313297 ret = iio_device_register(indio_dev);
....@@ -331,9 +315,7 @@
331315 error_iio_unreg:
332316 iio_device_unregister(indio_dev);
333317 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);
337319 return ret;
338320 }
339321
....@@ -346,8 +328,7 @@
346328
347329 sensor_hub_remove_callback(hsdev, hsdev->usage);
348330 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);
351332
352333 return 0;
353334 }