diff options
Diffstat (limited to 'drivers/rtc/rtc-hid-sensor-time.c')
-rw-r--r-- | drivers/rtc/rtc-hid-sensor-time.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c index 4e2a81854f51..45560ffb038d 100644 --- a/drivers/rtc/rtc-hid-sensor-time.c +++ b/drivers/rtc/rtc-hid-sensor-time.c | |||
@@ -275,6 +275,12 @@ static int hid_time_probe(struct platform_device *pdev) | |||
275 | return ret; | 275 | return ret; |
276 | } | 276 | } |
277 | 277 | ||
278 | ret = sensor_hub_device_open(hsdev); | ||
279 | if (ret) { | ||
280 | dev_err(&pdev->dev, "failed to open sensor hub device!\n"); | ||
281 | goto err_open; | ||
282 | } | ||
283 | |||
278 | time_state->rtc = devm_rtc_device_register(&pdev->dev, | 284 | time_state->rtc = devm_rtc_device_register(&pdev->dev, |
279 | "hid-sensor-time", &hid_time_rtc_ops, | 285 | "hid-sensor-time", &hid_time_rtc_ops, |
280 | THIS_MODULE); | 286 | THIS_MODULE); |
@@ -282,17 +288,24 @@ static int hid_time_probe(struct platform_device *pdev) | |||
282 | if (IS_ERR_OR_NULL(time_state->rtc)) { | 288 | if (IS_ERR_OR_NULL(time_state->rtc)) { |
283 | ret = time_state->rtc ? PTR_ERR(time_state->rtc) : -ENODEV; | 289 | ret = time_state->rtc ? PTR_ERR(time_state->rtc) : -ENODEV; |
284 | time_state->rtc = NULL; | 290 | time_state->rtc = NULL; |
285 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); | ||
286 | dev_err(&pdev->dev, "rtc device register failed!\n"); | 291 | dev_err(&pdev->dev, "rtc device register failed!\n"); |
292 | goto err_rtc; | ||
287 | } | 293 | } |
288 | 294 | ||
289 | return ret; | 295 | return ret; |
296 | |||
297 | err_rtc: | ||
298 | sensor_hub_device_close(hsdev); | ||
299 | err_open: | ||
300 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); | ||
301 | return ret; | ||
290 | } | 302 | } |
291 | 303 | ||
292 | static int hid_time_remove(struct platform_device *pdev) | 304 | static int hid_time_remove(struct platform_device *pdev) |
293 | { | 305 | { |
294 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 306 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
295 | 307 | ||
308 | sensor_hub_device_close(hsdev); | ||
296 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); | 309 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); |
297 | 310 | ||
298 | return 0; | 311 | return 0; |