| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * HID Sensors Driver |
|---|
| 3 | 4 | * 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. |
|---|
| 16 | 5 | */ |
|---|
| 17 | 6 | #include <linux/device.h> |
|---|
| 18 | 7 | #include <linux/hid-sensor-hub.h> |
|---|
| 19 | 8 | #include <linux/iio/buffer.h> |
|---|
| 20 | 9 | #include <linux/iio/iio.h> |
|---|
| 21 | | -#include <linux/iio/triggered_buffer.h> |
|---|
| 22 | | -#include <linux/iio/trigger_consumer.h> |
|---|
| 23 | 10 | #include <linux/module.h> |
|---|
| 24 | 11 | #include <linux/platform_device.h> |
|---|
| 25 | 12 | |
|---|
| .. | .. |
|---|
| 241 | 228 | |
|---|
| 242 | 229 | indio_dev->channels = humid_chans; |
|---|
| 243 | 230 | indio_dev->num_channels = ARRAY_SIZE(humidity_channels); |
|---|
| 244 | | - indio_dev->dev.parent = &pdev->dev; |
|---|
| 245 | 231 | indio_dev->info = &humidity_info; |
|---|
| 246 | 232 | indio_dev->name = name; |
|---|
| 247 | 233 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 248 | 234 | |
|---|
| 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 | | - |
|---|
| 254 | 235 | atomic_set(&humid_st->common_attributes.data_ready, 0); |
|---|
| 236 | + |
|---|
| 255 | 237 | ret = hid_sensor_setup_trigger(indio_dev, name, |
|---|
| 256 | 238 | &humid_st->common_attributes); |
|---|
| 257 | 239 | if (ret) |
|---|
| .. | .. |
|---|
| 274 | 256 | error_remove_callback: |
|---|
| 275 | 257 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY); |
|---|
| 276 | 258 | error_remove_trigger: |
|---|
| 277 | | - hid_sensor_remove_trigger(&humid_st->common_attributes); |
|---|
| 259 | + hid_sensor_remove_trigger(indio_dev, &humid_st->common_attributes); |
|---|
| 278 | 260 | return ret; |
|---|
| 279 | 261 | } |
|---|
| 280 | 262 | |
|---|
| .. | .. |
|---|
| 287 | 269 | |
|---|
| 288 | 270 | iio_device_unregister(indio_dev); |
|---|
| 289 | 271 | 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); |
|---|
| 291 | 273 | |
|---|
| 292 | 274 | return 0; |
|---|
| 293 | 275 | } |
|---|