forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/iio/humidity/hid-sensor-humidity.c
....@@ -1,25 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HID Sensors Driver
34 * Copyright (c) 2017, 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.
165 */
176 #include <linux/device.h>
187 #include <linux/hid-sensor-hub.h>
198 #include <linux/iio/buffer.h>
209 #include <linux/iio/iio.h>
21
-#include <linux/iio/triggered_buffer.h>
22
-#include <linux/iio/trigger_consumer.h>
2310 #include <linux/module.h>
2411 #include <linux/platform_device.h>
2512
....@@ -241,17 +228,12 @@
241228
242229 indio_dev->channels = humid_chans;
243230 indio_dev->num_channels = ARRAY_SIZE(humidity_channels);
244
- indio_dev->dev.parent = &pdev->dev;
245231 indio_dev->info = &humidity_info;
246232 indio_dev->name = name;
247233 indio_dev->modes = INDIO_DIRECT_MODE;
248234
249
- ret = devm_iio_triggered_buffer_setup(&pdev->dev, indio_dev,
250
- &iio_pollfunc_store_time, NULL, NULL);
251
- if (ret)
252
- return ret;
253
-
254235 atomic_set(&humid_st->common_attributes.data_ready, 0);
236
+
255237 ret = hid_sensor_setup_trigger(indio_dev, name,
256238 &humid_st->common_attributes);
257239 if (ret)
....@@ -274,7 +256,7 @@
274256 error_remove_callback:
275257 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY);
276258 error_remove_trigger:
277
- hid_sensor_remove_trigger(&humid_st->common_attributes);
259
+ hid_sensor_remove_trigger(indio_dev, &humid_st->common_attributes);
278260 return ret;
279261 }
280262
....@@ -287,7 +269,7 @@
287269
288270 iio_device_unregister(indio_dev);
289271 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY);
290
- hid_sensor_remove_trigger(&humid_st->common_attributes);
272
+ hid_sensor_remove_trigger(indio_dev, &humid_st->common_attributes);
291273
292274 return 0;
293275 }