lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201119114149.4117-24-brgl@bgdev.pl>
Date:   Thu, 19 Nov 2020 12:41:13 +0100
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc:     linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH 23/59] rtc: hid: stop using deprecated RTC API

From: Bartosz Golaszewski <bgolaszewski@...libre.com>

devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device()
and devm_rtc_register_device() pair instead.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
---
 drivers/rtc/rtc-hid-sensor-time.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
index 1b42ee0758d2..06cd21d6d2d1 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -267,21 +267,18 @@ static int hid_time_probe(struct platform_device *pdev)
 		goto err_open;
 	}
 
-	/*
-	 * Enable HID input processing early in order to be able to read the
-	 * clock already in devm_rtc_device_register().
-	 */
-	hid_device_io_start(hsdev->hdev);
+	time_state->rtc = devm_rtc_allocate_device(&pdev->dev);
+	if (IS_ERR(time_state->rtc)) {
+		ret = PTR_ERR(time_state->rtc);
+		goto err_rtc;
+	}
 
-	time_state->rtc = devm_rtc_device_register(&pdev->dev,
-					"hid-sensor-time", &hid_time_rtc_ops,
-					THIS_MODULE);
+	time_state->rtc->ops = &hid_time_rtc_ops;
+	hid_device_io_start(hsdev->hdev);
 
-	if (IS_ERR(time_state->rtc)) {
+	ret = devm_rtc_register_device(time_state->rtc);
+	if (ret) {
 		hid_device_io_stop(hsdev->hdev);
-		ret = PTR_ERR(time_state->rtc);
-		time_state->rtc = NULL;
-		dev_err(&pdev->dev, "rtc device register failed!\n");
 		goto err_rtc;
 	}
 
-- 
2.29.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ