Commit 479243b2cd763744cd740c05e5d61abc1c518256

Authored by Jingoo Han
Committed by Linus Torvalds
1 parent 360fe134e2

rtc: hid-sensor-time: use devm_rtc_device_register()

devm_rtc_device_register() is device managed and makes cleanup paths
simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 3 additions and 4 deletions Side-by-side Diff

drivers/rtc/rtc-hid-sensor-time.c
... ... @@ -255,8 +255,9 @@
255 255 return ret;
256 256 }
257 257  
258   - time_state->rtc = rtc_device_register("hid-sensor-time",
259   - &pdev->dev, &hid_time_rtc_ops, THIS_MODULE);
  258 + time_state->rtc = devm_rtc_device_register(&pdev->dev,
  259 + "hid-sensor-time", &hid_time_rtc_ops,
  260 + THIS_MODULE);
260 261  
261 262 if (IS_ERR(time_state->rtc)) {
262 263 dev_err(&pdev->dev, "rtc device register failed!\n");
263 264  
... ... @@ -269,9 +270,7 @@
269 270 static int hid_time_remove(struct platform_device *pdev)
270 271 {
271 272 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
272   - struct hid_time_state *time_state = platform_get_drvdata(pdev);
273 273  
274   - rtc_device_unregister(time_state->rtc);
275 274 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME);
276 275  
277 276 return 0;