.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * HID Sensors Driver |
---|
3 | 4 | * Copyright (c) 2012, 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 | | - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
---|
17 | | - * |
---|
18 | 5 | */ |
---|
19 | 6 | #include <linux/device.h> |
---|
20 | 7 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
27 | 14 | #include <linux/iio/iio.h> |
---|
28 | 15 | #include <linux/iio/sysfs.h> |
---|
29 | 16 | #include <linux/iio/buffer.h> |
---|
30 | | -#include <linux/iio/trigger_consumer.h> |
---|
31 | | -#include <linux/iio/triggered_buffer.h> |
---|
32 | 17 | #include "../common/hid-sensors/hid-sensor-trigger.h" |
---|
33 | 18 | |
---|
34 | 19 | enum { |
---|
.. | .. |
---|
316 | 301 | |
---|
317 | 302 | indio_dev->num_channels = |
---|
318 | 303 | ARRAY_SIZE(als_channels); |
---|
319 | | - indio_dev->dev.parent = &pdev->dev; |
---|
320 | 304 | indio_dev->info = &als_info; |
---|
321 | 305 | indio_dev->name = name; |
---|
322 | 306 | indio_dev->modes = INDIO_DIRECT_MODE; |
---|
323 | 307 | |
---|
324 | | - ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, |
---|
325 | | - NULL, NULL); |
---|
326 | | - if (ret) { |
---|
327 | | - dev_err(&pdev->dev, "failed to initialize trigger buffer\n"); |
---|
328 | | - goto error_free_dev_mem; |
---|
329 | | - } |
---|
330 | 308 | atomic_set(&als_state->common_attributes.data_ready, 0); |
---|
| 309 | + |
---|
331 | 310 | ret = hid_sensor_setup_trigger(indio_dev, name, |
---|
332 | 311 | &als_state->common_attributes); |
---|
333 | 312 | if (ret < 0) { |
---|
334 | 313 | dev_err(&pdev->dev, "trigger setup failed\n"); |
---|
335 | | - goto error_unreg_buffer_funcs; |
---|
| 314 | + goto error_free_dev_mem; |
---|
336 | 315 | } |
---|
337 | 316 | |
---|
338 | 317 | ret = iio_device_register(indio_dev); |
---|
.. | .. |
---|
356 | 335 | error_iio_unreg: |
---|
357 | 336 | iio_device_unregister(indio_dev); |
---|
358 | 337 | error_remove_trigger: |
---|
359 | | - hid_sensor_remove_trigger(&als_state->common_attributes); |
---|
360 | | -error_unreg_buffer_funcs: |
---|
361 | | - iio_triggered_buffer_cleanup(indio_dev); |
---|
| 338 | + hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes); |
---|
362 | 339 | error_free_dev_mem: |
---|
363 | 340 | kfree(indio_dev->channels); |
---|
364 | 341 | return ret; |
---|
.. | .. |
---|
373 | 350 | |
---|
374 | 351 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ALS); |
---|
375 | 352 | iio_device_unregister(indio_dev); |
---|
376 | | - hid_sensor_remove_trigger(&als_state->common_attributes); |
---|
377 | | - iio_triggered_buffer_cleanup(indio_dev); |
---|
| 353 | + hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes); |
---|
378 | 354 | kfree(indio_dev->channels); |
---|
379 | 355 | |
---|
380 | 356 | return 0; |
---|