.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * An RTC driver for Allwinner A10/A20 |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2013, Carlo Caione <carlo.caione@gmail.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
12 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
13 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
14 | | - * more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License along |
---|
17 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
---|
18 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
19 | 6 | */ |
---|
20 | 7 | |
---|
21 | 8 | #include <linux/delay.h> |
---|
.. | .. |
---|
435 | 422 | static int sunxi_rtc_probe(struct platform_device *pdev) |
---|
436 | 423 | { |
---|
437 | 424 | struct sunxi_rtc_dev *chip; |
---|
438 | | - struct resource *res; |
---|
439 | 425 | int ret; |
---|
440 | 426 | |
---|
441 | 427 | chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); |
---|
.. | .. |
---|
449 | 435 | if (IS_ERR(chip->rtc)) |
---|
450 | 436 | return PTR_ERR(chip->rtc); |
---|
451 | 437 | |
---|
452 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
453 | | - chip->base = devm_ioremap_resource(&pdev->dev, res); |
---|
| 438 | + chip->base = devm_platform_ioremap_resource(pdev, 0); |
---|
454 | 439 | if (IS_ERR(chip->base)) |
---|
455 | 440 | return PTR_ERR(chip->base); |
---|
456 | 441 | |
---|
457 | 442 | chip->irq = platform_get_irq(pdev, 0); |
---|
458 | | - if (chip->irq < 0) { |
---|
459 | | - dev_err(&pdev->dev, "No IRQ resource\n"); |
---|
| 443 | + if (chip->irq < 0) |
---|
460 | 444 | return chip->irq; |
---|
461 | | - } |
---|
462 | 445 | ret = devm_request_irq(&pdev->dev, chip->irq, sunxi_rtc_alarmirq, |
---|
463 | 446 | 0, dev_name(&pdev->dev), chip); |
---|
464 | 447 | if (ret) { |
---|
.. | .. |
---|
487 | 470 | |
---|
488 | 471 | chip->rtc->ops = &sunxi_rtc_ops; |
---|
489 | 472 | |
---|
490 | | - ret = rtc_register_device(chip->rtc); |
---|
491 | | - if (ret) { |
---|
492 | | - dev_err(&pdev->dev, "unable to register device\n"); |
---|
493 | | - return ret; |
---|
494 | | - } |
---|
495 | | - |
---|
496 | | - dev_info(&pdev->dev, "RTC enabled\n"); |
---|
497 | | - |
---|
498 | | - return 0; |
---|
| 473 | + return rtc_register_device(chip->rtc); |
---|
499 | 474 | } |
---|
500 | 475 | |
---|
501 | 476 | static struct platform_driver sunxi_rtc_driver = { |
---|