| .. | .. |
|---|
| 80 | 80 | static int |
|---|
| 81 | 81 | alpha_rtc_read_time(struct device *dev, struct rtc_time *tm) |
|---|
| 82 | 82 | { |
|---|
| 83 | | - mc146818_get_time(tm); |
|---|
| 83 | + int ret = mc146818_get_time(tm); |
|---|
| 84 | + |
|---|
| 85 | + if (ret < 0) { |
|---|
| 86 | + dev_err_ratelimited(dev, "unable to read current time\n"); |
|---|
| 87 | + return ret; |
|---|
| 88 | + } |
|---|
| 84 | 89 | |
|---|
| 85 | 90 | /* Adjust for non-default epochs. It's easier to depend on the |
|---|
| 86 | 91 | generic __get_rtc_time and adjust the epoch here than create |
|---|
| .. | .. |
|---|
| 198 | 203 | static int __init |
|---|
| 199 | 204 | alpha_rtc_init(void) |
|---|
| 200 | 205 | { |
|---|
| 201 | | - const struct rtc_class_ops *ops; |
|---|
| 202 | 206 | struct platform_device *pdev; |
|---|
| 203 | 207 | struct rtc_device *rtc; |
|---|
| 204 | | - const char *name; |
|---|
| 205 | 208 | |
|---|
| 206 | 209 | init_rtc_epoch(); |
|---|
| 207 | | - name = "rtc-alpha"; |
|---|
| 208 | | - ops = &alpha_rtc_ops; |
|---|
| 209 | 210 | |
|---|
| 210 | | -#ifdef HAVE_REMOTE_RTC |
|---|
| 211 | | - if (alpha_mv.rtc_boot_cpu_only) |
|---|
| 212 | | - ops = &remote_rtc_ops; |
|---|
| 213 | | -#endif |
|---|
| 214 | | - |
|---|
| 215 | | - pdev = platform_device_register_simple(name, -1, NULL, 0); |
|---|
| 216 | | - rtc = devm_rtc_device_register(&pdev->dev, name, ops, THIS_MODULE); |
|---|
| 211 | + pdev = platform_device_register_simple("rtc-alpha", -1, NULL, 0); |
|---|
| 212 | + rtc = devm_rtc_allocate_device(&pdev->dev); |
|---|
| 217 | 213 | if (IS_ERR(rtc)) |
|---|
| 218 | 214 | return PTR_ERR(rtc); |
|---|
| 219 | 215 | |
|---|
| 220 | 216 | platform_set_drvdata(pdev, rtc); |
|---|
| 221 | | - return 0; |
|---|
| 217 | + rtc->ops = &alpha_rtc_ops; |
|---|
| 218 | + |
|---|
| 219 | +#ifdef HAVE_REMOTE_RTC |
|---|
| 220 | + if (alpha_mv.rtc_boot_cpu_only) |
|---|
| 221 | + rtc->ops = &remote_rtc_ops; |
|---|
| 222 | +#endif |
|---|
| 223 | + |
|---|
| 224 | + return rtc_register_device(rtc); |
|---|
| 222 | 225 | } |
|---|
| 223 | 226 | device_initcall(alpha_rtc_init); |
|---|