.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * hdaps.c - driver for IBM's Hard Drive Active Protection System |
---|
3 | 4 | * |
---|
.. | .. |
---|
11 | 12 | * This driver is based on the document by Mark A. Smith available at |
---|
12 | 13 | * http://www.almaden.ibm.com/cs/people/marksmith/tpaps.html and a lot of trial |
---|
13 | 14 | * and error. |
---|
14 | | - * |
---|
15 | | - * This program is free software; you can redistribute it and/or modify it |
---|
16 | | - * under the terms of the GNU General Public License v2 as published by the |
---|
17 | | - * Free Software Foundation. |
---|
18 | | - * |
---|
19 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
20 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
21 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
22 | | - * more details. |
---|
23 | | - * |
---|
24 | | - * You should have received a copy of the GNU General Public License along with |
---|
25 | | - * this program; if not, write to the Free Software Foundation, Inc., |
---|
26 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
---|
27 | 15 | */ |
---|
28 | 16 | |
---|
29 | 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
30 | 18 | |
---|
31 | 19 | #include <linux/delay.h> |
---|
32 | 20 | #include <linux/platform_device.h> |
---|
33 | | -#include <linux/input-polldev.h> |
---|
| 21 | +#include <linux/input.h> |
---|
34 | 22 | #include <linux/kernel.h> |
---|
35 | 23 | #include <linux/mutex.h> |
---|
36 | 24 | #include <linux/module.h> |
---|
.. | .. |
---|
71 | 59 | #define HDAPS_BOTH_AXES (HDAPS_X_AXIS | HDAPS_Y_AXIS) |
---|
72 | 60 | |
---|
73 | 61 | static struct platform_device *pdev; |
---|
74 | | -static struct input_polled_dev *hdaps_idev; |
---|
| 62 | +static struct input_dev *hdaps_idev; |
---|
75 | 63 | static unsigned int hdaps_invert; |
---|
76 | 64 | static u8 km_activity; |
---|
77 | 65 | static int rest_x; |
---|
.. | .. |
---|
330 | 318 | __hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &rest_x, &rest_y); |
---|
331 | 319 | } |
---|
332 | 320 | |
---|
333 | | -static void hdaps_mousedev_poll(struct input_polled_dev *dev) |
---|
| 321 | +static void hdaps_mousedev_poll(struct input_dev *input_dev) |
---|
334 | 322 | { |
---|
335 | | - struct input_dev *input_dev = dev->input; |
---|
336 | 323 | int x, y; |
---|
337 | 324 | |
---|
338 | 325 | mutex_lock(&hdaps_mtx); |
---|
.. | .. |
---|
378 | 365 | static ssize_t hdaps_temp1_show(struct device *dev, |
---|
379 | 366 | struct device_attribute *attr, char *buf) |
---|
380 | 367 | { |
---|
381 | | - u8 uninitialized_var(temp); |
---|
| 368 | + u8 temp; |
---|
382 | 369 | int ret; |
---|
383 | 370 | |
---|
384 | 371 | ret = hdaps_readb_one(HDAPS_PORT_TEMP1, &temp); |
---|
.. | .. |
---|
391 | 378 | static ssize_t hdaps_temp2_show(struct device *dev, |
---|
392 | 379 | struct device_attribute *attr, char *buf) |
---|
393 | 380 | { |
---|
394 | | - u8 uninitialized_var(temp); |
---|
| 381 | + u8 temp; |
---|
395 | 382 | int ret; |
---|
396 | 383 | |
---|
397 | 384 | ret = hdaps_readb_one(HDAPS_PORT_TEMP2, &temp); |
---|
.. | .. |
---|
543 | 530 | |
---|
544 | 531 | static int __init hdaps_init(void) |
---|
545 | 532 | { |
---|
546 | | - struct input_dev *idev; |
---|
547 | 533 | int ret; |
---|
548 | 534 | |
---|
549 | 535 | if (!dmi_check_system(hdaps_whitelist)) { |
---|
.. | .. |
---|
571 | 557 | if (ret) |
---|
572 | 558 | goto out_device; |
---|
573 | 559 | |
---|
574 | | - hdaps_idev = input_allocate_polled_device(); |
---|
| 560 | + hdaps_idev = input_allocate_device(); |
---|
575 | 561 | if (!hdaps_idev) { |
---|
576 | 562 | ret = -ENOMEM; |
---|
577 | 563 | goto out_group; |
---|
578 | 564 | } |
---|
579 | 565 | |
---|
580 | | - hdaps_idev->poll = hdaps_mousedev_poll; |
---|
581 | | - hdaps_idev->poll_interval = HDAPS_POLL_INTERVAL; |
---|
582 | | - |
---|
583 | 566 | /* initial calibrate for the input device */ |
---|
584 | 567 | hdaps_calibrate(); |
---|
585 | 568 | |
---|
586 | 569 | /* initialize the input class */ |
---|
587 | | - idev = hdaps_idev->input; |
---|
588 | | - idev->name = "hdaps"; |
---|
589 | | - idev->phys = "isa1600/input0"; |
---|
590 | | - idev->id.bustype = BUS_ISA; |
---|
591 | | - idev->dev.parent = &pdev->dev; |
---|
592 | | - idev->evbit[0] = BIT_MASK(EV_ABS); |
---|
593 | | - input_set_abs_params(idev, ABS_X, |
---|
| 570 | + hdaps_idev->name = "hdaps"; |
---|
| 571 | + hdaps_idev->phys = "isa1600/input0"; |
---|
| 572 | + hdaps_idev->id.bustype = BUS_ISA; |
---|
| 573 | + hdaps_idev->dev.parent = &pdev->dev; |
---|
| 574 | + input_set_abs_params(hdaps_idev, ABS_X, |
---|
594 | 575 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); |
---|
595 | | - input_set_abs_params(idev, ABS_Y, |
---|
| 576 | + input_set_abs_params(hdaps_idev, ABS_Y, |
---|
596 | 577 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); |
---|
597 | 578 | |
---|
598 | | - ret = input_register_polled_device(hdaps_idev); |
---|
| 579 | + ret = input_setup_polling(hdaps_idev, hdaps_mousedev_poll); |
---|
| 580 | + if (ret) |
---|
| 581 | + goto out_idev; |
---|
| 582 | + |
---|
| 583 | + input_set_poll_interval(hdaps_idev, HDAPS_POLL_INTERVAL); |
---|
| 584 | + |
---|
| 585 | + ret = input_register_device(hdaps_idev); |
---|
599 | 586 | if (ret) |
---|
600 | 587 | goto out_idev; |
---|
601 | 588 | |
---|
.. | .. |
---|
603 | 590 | return 0; |
---|
604 | 591 | |
---|
605 | 592 | out_idev: |
---|
606 | | - input_free_polled_device(hdaps_idev); |
---|
| 593 | + input_free_device(hdaps_idev); |
---|
607 | 594 | out_group: |
---|
608 | 595 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); |
---|
609 | 596 | out_device: |
---|
.. | .. |
---|
619 | 606 | |
---|
620 | 607 | static void __exit hdaps_exit(void) |
---|
621 | 608 | { |
---|
622 | | - input_unregister_polled_device(hdaps_idev); |
---|
623 | | - input_free_polled_device(hdaps_idev); |
---|
| 609 | + input_unregister_device(hdaps_idev); |
---|
624 | 610 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); |
---|
625 | 611 | platform_device_unregister(pdev); |
---|
626 | 612 | platform_driver_unregister(&hdaps_driver); |
---|