| .. | .. |
|---|
| 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 | |
|---|
| .. | .. |
|---|
| 238 | 225 | |
|---|
| 239 | 226 | indio_dev->channels = temp_chans; |
|---|
| 240 | 227 | indio_dev->num_channels = ARRAY_SIZE(temperature_channels); |
|---|
| 241 | | - indio_dev->dev.parent = &pdev->dev; |
|---|
| 242 | 228 | indio_dev->info = &temperature_info; |
|---|
| 243 | 229 | indio_dev->name = name; |
|---|
| 244 | 230 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 245 | 231 | |
|---|
| 246 | | - ret = devm_iio_triggered_buffer_setup(&pdev->dev, indio_dev, |
|---|
| 247 | | - &iio_pollfunc_store_time, NULL, NULL); |
|---|
| 248 | | - if (ret) |
|---|
| 249 | | - return ret; |
|---|
| 250 | | - |
|---|
| 251 | 232 | atomic_set(&temp_st->common_attributes.data_ready, 0); |
|---|
| 233 | + |
|---|
| 252 | 234 | ret = hid_sensor_setup_trigger(indio_dev, name, |
|---|
| 253 | 235 | &temp_st->common_attributes); |
|---|
| 254 | 236 | if (ret) |
|---|
| .. | .. |
|---|
| 271 | 253 | error_remove_callback: |
|---|
| 272 | 254 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE); |
|---|
| 273 | 255 | error_remove_trigger: |
|---|
| 274 | | - hid_sensor_remove_trigger(&temp_st->common_attributes); |
|---|
| 256 | + hid_sensor_remove_trigger(indio_dev, &temp_st->common_attributes); |
|---|
| 275 | 257 | return ret; |
|---|
| 276 | 258 | } |
|---|
| 277 | 259 | |
|---|
| .. | .. |
|---|
| 283 | 265 | struct temperature_state *temp_st = iio_priv(indio_dev); |
|---|
| 284 | 266 | |
|---|
| 285 | 267 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE); |
|---|
| 286 | | - hid_sensor_remove_trigger(&temp_st->common_attributes); |
|---|
| 268 | + hid_sensor_remove_trigger(indio_dev, &temp_st->common_attributes); |
|---|
| 287 | 269 | |
|---|
| 288 | 270 | return 0; |
|---|
| 289 | 271 | } |
|---|