diff options
Diffstat (limited to 'drivers/rtc/rtc-hid-sensor-time.c')
-rw-r--r-- | drivers/rtc/rtc-hid-sensor-time.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c index 7273b0139e5c..4e2a81854f51 100644 --- a/drivers/rtc/rtc-hid-sensor-time.c +++ b/drivers/rtc/rtc-hid-sensor-time.c | |||
@@ -23,10 +23,6 @@ | |||
23 | #include <linux/iio/iio.h> | 23 | #include <linux/iio/iio.h> |
24 | #include <linux/rtc.h> | 24 | #include <linux/rtc.h> |
25 | 25 | ||
26 | /* Format: HID-SENSOR-usage_id_in_hex */ | ||
27 | /* Usage ID from spec for Time: 0x2000A0 */ | ||
28 | #define DRIVER_NAME "HID-SENSOR-2000a0" /* must be lowercase */ | ||
29 | |||
30 | enum hid_time_channel { | 26 | enum hid_time_channel { |
31 | CHANNEL_SCAN_INDEX_YEAR, | 27 | CHANNEL_SCAN_INDEX_YEAR, |
32 | CHANNEL_SCAN_INDEX_MONTH, | 28 | CHANNEL_SCAN_INDEX_MONTH, |
@@ -283,9 +279,11 @@ static int hid_time_probe(struct platform_device *pdev) | |||
283 | "hid-sensor-time", &hid_time_rtc_ops, | 279 | "hid-sensor-time", &hid_time_rtc_ops, |
284 | THIS_MODULE); | 280 | THIS_MODULE); |
285 | 281 | ||
286 | if (IS_ERR(time_state->rtc)) { | 282 | if (IS_ERR_OR_NULL(time_state->rtc)) { |
283 | ret = time_state->rtc ? PTR_ERR(time_state->rtc) : -ENODEV; | ||
284 | time_state->rtc = NULL; | ||
285 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TIME); | ||
287 | dev_err(&pdev->dev, "rtc device register failed!\n"); | 286 | dev_err(&pdev->dev, "rtc device register failed!\n"); |
288 | return PTR_ERR(time_state->rtc); | ||
289 | } | 287 | } |
290 | 288 | ||
291 | return ret; | 289 | return ret; |
@@ -300,9 +298,19 @@ static int hid_time_remove(struct platform_device *pdev) | |||
300 | return 0; | 298 | return 0; |
301 | } | 299 | } |
302 | 300 | ||
301 | static struct platform_device_id hid_time_ids[] = { | ||
302 | { | ||
303 | /* Format: HID-SENSOR-usage_id_in_hex_lowercase */ | ||
304 | .name = "HID-SENSOR-2000a0", | ||
305 | }, | ||
306 | { /* sentinel */ } | ||
307 | }; | ||
308 | MODULE_DEVICE_TABLE(platform, hid_time_ids); | ||
309 | |||
303 | static struct platform_driver hid_time_platform_driver = { | 310 | static struct platform_driver hid_time_platform_driver = { |
311 | .id_table = hid_time_ids, | ||
304 | .driver = { | 312 | .driver = { |
305 | .name = DRIVER_NAME, | 313 | .name = KBUILD_MODNAME, |
306 | .owner = THIS_MODULE, | 314 | .owner = THIS_MODULE, |
307 | }, | 315 | }, |
308 | .probe = hid_time_probe, | 316 | .probe = hid_time_probe, |